org.naregi.rns
Class RNSDBCache

java.lang.Object
  extended by org.naregi.rns.RNSDBCache
All Implemented Interfaces:
RNSDB

public class RNSDBCache
extends java.lang.Object
implements RNSDB

A caching system for the implementations of RNSDB.


Field Summary
 
Fields inherited from interface org.naregi.rns.RNSDB
TYPE_DERBY, TYPE_FILE, TYPE_MEMORY, TYPE_XML
 
Constructor Summary
RNSDBCache(RNSDB db, boolean forceCachedList)
           
 
Method Summary
 void commit()
          Makes all changes made since the previous commit/rollback permanent.
 void createAndSetNewID()
          Create a new directory and Set the new ID to this object.
 void createAndSetNewRootID()
          Create the new root directory and Set the Root ID to this object.
 void destroy()
          Delete this directory permanently.
 ACL getACL()
          Get an ACL information of this directory.
 RNSDirectoryProperties getDirectoryProperties()
          Get properties of this directory.
 RNSEntryData getEntryData(java.lang.String name)
          Get an entry data (EPR and Metadata).
 java.lang.String getID()
          Get the setID()ed ID.
 java.util.List<java.lang.String> getList()
          Get this directory list.
 long getListSize()
          Get the list size of this directory.
 java.lang.Object getLockAndStartTransaction()
          Get a lock object and Start the transaction.
 java.lang.String getRootID()
          Get the root directory ID of this implementation.
 void insertEntryData(java.lang.String name, RNSEntryData ent)
          Create a new entry and Insert a new entry data.
 void removeACL(short type, java.lang.String[] names)
          Remove the ACL of this directory.
 void removeEntryData(java.lang.String name)
          Remove an entry.
 void rename(java.lang.String from, java.lang.String to)
          Change an entry name.
 void replaceMetadata(java.lang.String name, org.apache.axis.message.MessageElement[] xmls)
          Replace a Metadata of the entry.
 void rollback()
          Undoes all changes made in the current transaction.
 void setAccessTime(java.util.Calendar t)
          Set a time at which the RNS directory is last accessed.
 void setACL(ACL acl)
          Replace an ACL information to this directory.
 void setCreateTime(java.util.Calendar t)
          Set a time at which the RNS directory is created.
 void setDirectoryProperties(RNSDirectoryProperties props)
          Set properties to this directory.
 boolean setID(java.lang.String id)
          Initialize this object and Search an existing entry ID from this database.
 void setModificationTime(java.util.Calendar t)
          Set a time at which the RNS directory is last modified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RNSDBCache

public RNSDBCache(RNSDB db,
                  boolean forceCachedList)
Method Detail

createAndSetNewRootID

public void createAndSetNewRootID()
                           throws java.lang.Exception
Description copied from interface: RNSDB
Create the new root directory and Set the Root ID to this object.

Specified by:
createAndSetNewRootID in interface RNSDB
Throws:
java.lang.Exception

createAndSetNewID

public void createAndSetNewID()
                       throws java.lang.Exception
Description copied from interface: RNSDB
Create a new directory and Set the new ID to this object.

Specified by:
createAndSetNewID in interface RNSDB
Throws:
java.lang.Exception

setID

public boolean setID(java.lang.String id)
              throws java.lang.Exception
Description copied from interface: RNSDB
Initialize this object and Search an existing entry ID from this database.

Specified by:
setID in interface RNSDB
Returns:
true if the entry exists
Throws:
java.lang.Exception

getID

public java.lang.String getID()
Description copied from interface: RNSDB
Get the setID()ed ID.

Specified by:
getID in interface RNSDB
Returns:
ID

getRootID

public java.lang.String getRootID()
Description copied from interface: RNSDB
Get the root directory ID of this implementation.

Specified by:
getRootID in interface RNSDB
Returns:
the root ID (fixed String)

getLockAndStartTransaction

public java.lang.Object getLockAndStartTransaction()
Description copied from interface: RNSDB
Get a lock object and Start the transaction.

Specified by:
getLockAndStartTransaction in interface RNSDB
Returns:
Object for locks and synchronization

commit

public void commit()
            throws java.lang.Exception
Description copied from interface: RNSDB
Makes all changes made since the previous commit/rollback permanent.

Specified by:
commit in interface RNSDB
Throws:
java.lang.Exception

rollback

public void rollback()
Description copied from interface: RNSDB
Undoes all changes made in the current transaction.

Specified by:
rollback in interface RNSDB

getDirectoryProperties

public RNSDirectoryProperties getDirectoryProperties()
                                              throws java.lang.Exception
Description copied from interface: RNSDB
Get properties of this directory.

Specified by:
getDirectoryProperties in interface RNSDB
Returns:
RNSDirectoryProperties (should not be null)
Throws:
java.lang.Exception

setDirectoryProperties

public void setDirectoryProperties(RNSDirectoryProperties props)
                            throws java.lang.Exception
Description copied from interface: RNSDB
Set properties to this directory.

Specified by:
setDirectoryProperties in interface RNSDB
Throws:
java.lang.Exception

setCreateTime

public void setCreateTime(java.util.Calendar t)
                   throws java.lang.Exception
Description copied from interface: RNSDB
Set a time at which the RNS directory is created.

Specified by:
setCreateTime in interface RNSDB
Parameters:
t - a time at which the RNS resource is created.
Throws:
java.lang.Exception

setAccessTime

public void setAccessTime(java.util.Calendar t)
                   throws java.lang.Exception
Description copied from interface: RNSDB
Set a time at which the RNS directory is last accessed.

Specified by:
setAccessTime in interface RNSDB
Parameters:
t - a time at which the RNS directory is last accessed
Throws:
java.lang.Exception

setModificationTime

public void setModificationTime(java.util.Calendar t)
                         throws java.lang.Exception
Description copied from interface: RNSDB
Set a time at which the RNS directory is last modified.

Specified by:
setModificationTime in interface RNSDB
Parameters:
t - a time at which the RNS directory is last modified
Throws:
java.lang.Exception

getList

public java.util.List<java.lang.String> getList()
                                         throws java.lang.Exception
Description copied from interface: RNSDB
Get this directory list.

Specified by:
getList in interface RNSDB
Returns:
entry name array (should not be null)
Throws:
java.lang.Exception

getListSize

public long getListSize()
                 throws java.lang.Exception
Description copied from interface: RNSDB
Get the list size of this directory.

Specified by:
getListSize in interface RNSDB
Returns:
the list size
Throws:
java.lang.Exception

getEntryData

public RNSEntryData getEntryData(java.lang.String name)
                          throws java.lang.Exception
Description copied from interface: RNSDB
Get an entry data (EPR and Metadata).

Specified by:
getEntryData in interface RNSDB
Parameters:
name - an entry name
Returns:
the entry data (may be null)
Throws:
java.lang.Exception

insertEntryData

public void insertEntryData(java.lang.String name,
                            RNSEntryData ent)
                     throws java.lang.Exception
Description copied from interface: RNSDB
Create a new entry and Insert a new entry data.

Specified by:
insertEntryData in interface RNSDB
Parameters:
name - an entry name
ent - the entry data (should not be null)
Throws:
java.lang.Exception

rename

public void rename(java.lang.String from,
                   java.lang.String to)
            throws java.lang.Exception
Description copied from interface: RNSDB
Change an entry name.

Specified by:
rename in interface RNSDB
Parameters:
from - old name
to - new name
Throws:
java.lang.Exception

replaceMetadata

public void replaceMetadata(java.lang.String name,
                            org.apache.axis.message.MessageElement[] xmls)
                     throws java.lang.Exception
Description copied from interface: RNSDB
Replace a Metadata of the entry.

Specified by:
replaceMetadata in interface RNSDB
Parameters:
name - an entry name.
xmls - Metadata
Throws:
java.lang.Exception

removeEntryData

public void removeEntryData(java.lang.String name)
                     throws java.lang.Exception
Description copied from interface: RNSDB
Remove an entry.

Specified by:
removeEntryData in interface RNSDB
Parameters:
name - a name to be removed.
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Description copied from interface: RNSDB
Delete this directory permanently.

Specified by:
destroy in interface RNSDB
Throws:
java.lang.Exception

getACL

public ACL getACL()
           throws java.lang.Exception
Description copied from interface: RNSDB
Get an ACL information of this directory.

Specified by:
getACL in interface RNSDB
Returns:
ACL
Throws:
java.lang.Exception

setACL

public void setACL(ACL acl)
            throws java.lang.Exception
Description copied from interface: RNSDB
Replace an ACL information to this directory.

Specified by:
setACL in interface RNSDB
Parameters:
acl - ACL
Throws:
java.lang.Exception

removeACL

public void removeACL(short type,
                      java.lang.String[] names)
               throws java.lang.Exception
Description copied from interface: RNSDB
Remove the ACL of this directory.

Specified by:
removeACL in interface RNSDB
Parameters:
type - ACL type (see ACL)
names - if names is null, the entries of type are removed.
Throws:
java.lang.Exception - if an error occurs