org.mycore.datamodel.ifs2
Class MCRDirectory

java.lang.Object
  extended by org.mycore.datamodel.ifs2.MCRNode
      extended by org.mycore.datamodel.ifs2.MCRStoredNode
          extended by org.mycore.datamodel.ifs2.MCRDirectory
Direct Known Subclasses:
MCRFileCollection

public class MCRDirectory
extends MCRStoredNode

Represents a directory stored in a file collection, which may contain other files and directories.

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 MCRDirectory(MCRDirectory parent, org.apache.commons.vfs.FileObject fo, Element data)
          Create MCRDirectory representing an existing, already stored directory.
protected MCRDirectory(MCRDirectory parent, String name)
          Create a new MCRDirectory that does not exist yet
 
Method Summary
protected  MCRStoredNode buildChildNode(org.apache.commons.vfs.FileObject fo)
          Returns the MCRFile or MCRDirectory that is represented by the given FileObject, which is a direct child of the directory FileObject this MCRDirectory is stored in.
 MCRDirectory createDir(String name)
          Creates a new subdirectory within this directory
 MCRFile createFile(String name)
          Creates a new file within this directory
(package private)  void repairMetadata()
          Repairs additional metadata of this directory and all its children
 
Methods inherited from class org.mycore.datamodel.ifs2.MCRStoredNode
clearLabels, delete, getCurrentLabel, getLabel, getLabels, renameTo, setLabel, setLastModified
 
Methods inherited from class org.mycore.datamodel.ifs2.MCRNode
getChild, getChildren, getContent, getLastModified, getName, getNodeByPath, getNumChildren, getParent, getPath, getRandomAccessContent, getRoot, getSize, hasChildren, isDirectory, isFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCRDirectory

protected MCRDirectory(MCRDirectory parent,
                       org.apache.commons.vfs.FileObject fo,
                       Element data)
                throws Exception
Create MCRDirectory representing an existing, already stored directory.

Parameters:
parent - the parent directory of this directory
fo - the local directory in the store storing this directory
Throws:
Exception

MCRDirectory

protected MCRDirectory(MCRDirectory parent,
                       String name)
                throws Exception
Create a new MCRDirectory that does not exist yet

Parameters:
parent - the parent directory of this directory
name - the name of the new subdirectory to create
Throws:
Exception
Method Detail

createDir

public MCRDirectory createDir(String name)
                       throws Exception
Creates a new subdirectory within this directory

Parameters:
name - the name of the new directory
Throws:
Exception

createFile

public MCRFile createFile(String name)
                   throws Exception
Creates a new file within this directory

Parameters:
name - the name of the new file
Throws:
Exception

buildChildNode

protected MCRStoredNode buildChildNode(org.apache.commons.vfs.FileObject fo)
                                throws Exception
Returns the MCRFile or MCRDirectory that is represented by the given FileObject, which is a direct child of the directory FileObject this MCRDirectory is stored in.

Specified by:
buildChildNode in class MCRNode
Parameters:
fo - the FileObject representing the child in the underlying filesystem
Returns:
an MCRFile or MCRDirectory child
Throws:
Exception

repairMetadata

void repairMetadata()
              throws Exception
Repairs additional metadata of this directory and all its children

Specified by:
repairMetadata in class MCRStoredNode
Throws:
Exception