org.mycore.datamodel.ifs
Class MCRFileMetadataManager

java.lang.Object
  extended by org.mycore.datamodel.ifs.MCRFileMetadataManager

public class MCRFileMetadataManager
extends Object

The single instance of this class is used by the other IFS classes to create, retrieve, update or delete the metadata of all MCRFilesystemNode objects in a persistent datastore. The manager holds a cache of all MCRFilesystemNodes most recently used. It creates the MCRFileMetadataStore instance as configured in the MyCoRe properties and hides its usage from the other classes. Configuration properties:

Version:
$Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
Author:
Frank Lützenkirchen
See Also:
MCRFilesystemNode, MCRFileMetadataStore

Method Summary
 MCRFilesystemNode buildNode(String type, String ID, String parentID, String ownerID, String name, String label, long size, GregorianCalendar date, String storeID, String storageID, String fctID, String md5, int numchdd, int numchdf, int numchtd, int numchtf)
          Callback method for internal use by any MCRFileMetadataStore implementation, do not use.
(package private)  String createNodeID()
          Creates a new, unique ID for each MCRFilesystemNode
(package private)  void deleteNode(String ID)
          Deletes a MCRFilesystemNode in the persistent MCRFileMetadataStore.
static MCRFileMetadataManager instance()
          Returns the single instance of this class to use *
 MCRFilesystemNode retrieveChild(String parentID, String name)
          Retrieves a child node of a given MCRDirectory node.
(package private)  Vector retrieveChildrenIDs(String ID)
          Retrieves a list of all IDs of the child MCRFilesystemNodes of a given MCRDirectory.
(package private)  MCRFilesystemNode retrieveNode(String ID)
          Retrieves the MCRFilesystemNode with the given ID from the persistent MCRFileMetadataStore.
(package private)  MCRFilesystemNode retrieveRootNode(String ownerID)
          Retrieves the first MCRFilesystemNode found in the persistent MCRFileMetadataStore, that has the given owner ID.
(package private)  void storeNode(MCRFilesystemNode node)
          Creates or updates the data of the MCRFilesystemNode in the persistent MCRFileMetadataStore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static MCRFileMetadataManager instance()
Returns the single instance of this class to use *


createNodeID

String createNodeID()
Creates a new, unique ID for each MCRFilesystemNode


storeNode

void storeNode(MCRFilesystemNode node)
         throws MCRPersistenceException
Creates or updates the data of the MCRFilesystemNode in the persistent MCRFileMetadataStore.

Parameters:
node - the MCRFilesystemNode to store
Throws:
MCRPersistenceException

retrieveNode

MCRFilesystemNode retrieveNode(String ID)
                         throws MCRPersistenceException
Retrieves the MCRFilesystemNode with the given ID from the persistent MCRFileMetadataStore.

Parameters:
ID - the unique ID of the MCRFilesystemNode
Returns:
the MCRFilesystemNode with that ID, or null if no such node exists.
Throws:
MCRPersistenceException

retrieveRootNode

MCRFilesystemNode retrieveRootNode(String ownerID)
                             throws MCRPersistenceException
Retrieves the first MCRFilesystemNode found in the persistent MCRFileMetadataStore, that has the given owner ID. This is assumed to be a root node.

Parameters:
ownerID - the ID of the owner of the MCRFilesystemNode to be retrieved
Returns:
the MCRFilesystemNode with that owner, or null if no such node exists.
Throws:
MCRPersistenceException

retrieveChild

public MCRFilesystemNode retrieveChild(String parentID,
                                       String name)
                                throws MCRPersistenceException
Retrieves a child node of a given MCRDirectory node.

Parameters:
parentID - the ID of the parent MCRDirectory
name - the file name of the child in that directory
Returns:
the child MCRFilesystemNode, or null, if no such child exists
Throws:
MCRPersistenceException

buildNode

public MCRFilesystemNode buildNode(String type,
                                   String ID,
                                   String parentID,
                                   String ownerID,
                                   String name,
                                   String label,
                                   long size,
                                   GregorianCalendar date,
                                   String storeID,
                                   String storageID,
                                   String fctID,
                                   String md5,
                                   int numchdd,
                                   int numchdf,
                                   int numchtd,
                                   int numchtf)
                            throws MCRPersistenceException
Callback method for internal use by any MCRFileMetadataStore implementation, do not use. Builds a MCRFilesystemNode object from the raw data that is retrieved from the persistent store, or uses the existing copy in the MCRCache instance.

Throws:
MCRPersistenceException

retrieveChildrenIDs

Vector retrieveChildrenIDs(String ID)
                     throws MCRPersistenceException
Retrieves a list of all IDs of the child MCRFilesystemNodes of a given MCRDirectory.

Parameters:
ID - the ID of the parent MCRDirectory
Returns:
a Vector of String objects containing the IDs of all children of that MCRDirectory
Throws:
MCRPersistenceException

deleteNode

void deleteNode(String ID)
          throws MCRPersistenceException
Deletes a MCRFilesystemNode in the persistent MCRFileMetadataStore.

Parameters:
ID - the ID of the node to delete from the store
Throws:
MCRPersistenceException