org.mycore.datamodel.ifs2
Class MCRFileCollection

java.lang.Object
  extended by org.mycore.datamodel.ifs2.MCRNode
      extended by org.mycore.datamodel.ifs2.MCRStoredNode
          extended by org.mycore.datamodel.ifs2.MCRDirectory
              extended by org.mycore.datamodel.ifs2.MCRFileCollection

public class MCRFileCollection
extends MCRDirectory

Represents a set of files and directories belonging together, that are stored in a persistent MCRFileStore. A FileCollection has a unique ID within the store, it is the root folder of all files and directories in the collection.

Author:
Frank Lützenkirchen

Field Summary
 
Fields inherited from class org.mycore.datamodel.ifs2.MCRStoredNode
data
 
Fields inherited from class org.mycore.datamodel.ifs2.MCRNode
fo, parent
 
Constructor Summary
protected MCRFileCollection(MCRStore store, int id)
          Creates a new file collection in the given store, or retrieves an existing one.
 
Method Summary
 MCRNode getChild(String name)
          Returns the child node with the given filename, or null
 int getID()
          Returns the ID of this file collection
(package private)  Document getMetadata()
          Returns additional metadata stored for all files and directories in this collection
 String getName()
          Returns the file or directory name
 int getNumChildren()
          Returns the number of child nodes of this node.
 MCRFileCollection getRoot()
          Returns this object, because the FileCollection instance is the root of all files and directories contained in the collection.
 MCRStore getStore()
          Returns the store this file collection is stored in.
 void renameTo(String name)
          Throws a exception, because a file collection's name is always the empty string and therefore can not be renamed.
 void repairMetadata()
          Repairs additional metadata stored for all files and directories in this collection
protected  void saveAdditionalData()
           
 
Methods inherited from class org.mycore.datamodel.ifs2.MCRDirectory
buildChildNode, createDir, createFile
 
Methods inherited from class org.mycore.datamodel.ifs2.MCRStoredNode
clearLabels, delete, getCurrentLabel, getLabel, getLabels, setLabel, setLastModified
 
Methods inherited from class org.mycore.datamodel.ifs2.MCRNode
getChildren, getContent, getLastModified, getNodeByPath, getParent, getPath, getRandomAccessContent, getSize, hasChildren, isDirectory, isFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCRFileCollection

protected MCRFileCollection(MCRStore store,
                            int id)
                     throws Exception
Creates a new file collection in the given store, or retrieves an existing one.

Parameters:
store - the store this file collection is stored in
id - the ID of this file collection
Throws:
Exception
See Also:
MCRFileStore
Method Detail

saveAdditionalData

protected void saveAdditionalData()
                           throws Exception
Throws:
Exception

renameTo

public void renameTo(String name)
Throws a exception, because a file collection's name is always the empty string and therefore can not be renamed.

Overrides:
renameTo in class MCRStoredNode
Parameters:
name - the new file name

getStore

public MCRStore getStore()
Returns the store this file collection is stored in.

Returns:
the store this file collection is stored in.

getID

public int getID()
Returns the ID of this file collection

Returns:
the ID of this file collection

getRoot

public MCRFileCollection getRoot()
Returns this object, because the FileCollection instance is the root of all files and directories contained in the collection.

Overrides:
getRoot in class MCRNode
Returns:
this

getNumChildren

public int getNumChildren()
                   throws Exception
Description copied from class: MCRNode
Returns the number of child nodes of this node.

Overrides:
getNumChildren in class MCRNode
Returns:
the number of child nodes of this node.
Throws:
Exception

getChild

public MCRNode getChild(String name)
                 throws Exception
Description copied from class: MCRNode
Returns the child node with the given filename, or null

Overrides:
getChild in class MCRNode
Parameters:
name - the name of the child node
Returns:
the child node with that name, or null when no such file exists
Throws:
Exception

getName

public String getName()
Description copied from class: MCRNode
Returns the file or directory name

Overrides:
getName in class MCRNode
Returns:
the node's filename

repairMetadata

public void repairMetadata()
                    throws Exception
Repairs additional metadata stored for all files and directories in this collection

Overrides:
repairMetadata in class MCRDirectory
Throws:
Exception

getMetadata

Document getMetadata()
               throws Exception
Returns additional metadata stored for all files and directories in this collection

Throws:
Exception