Package org.mycore.datamodel.ifs2
Class MCRFileCollection
java.lang.Object
org.mycore.datamodel.ifs2.MCRNode
org.mycore.datamodel.ifs2.MCRStoredNode
org.mycore.datamodel.ifs2.MCRDirectory
org.mycore.datamodel.ifs2.MCRFileCollection
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
-
Constructor Summary
ModifierConstructorDescriptionprotected
MCRFileCollection
(MCRStore store, int id) Creates a new file collection in the given store, or retrieves an existing one. -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
Deletes this file collection with all its data and childrenReturns the child node with the given filename, or nullReturns the children of this node.int
getID()
Returns the ID of this file collectiongetName()
Returns the file or directory nameint
Returns the number of child nodes of this node.getRoot()
Returns this object, because the FileCollection instance is the root of all files and directories contained in the collection.getStore()
Returns the store this file collection is stored in.boolean
Returns true if this node has child nodes.void
Throws a exception, because a file collection's name is always the empty string and therefore can not be renamed.void
Repairs additional metadata stored for all files and directories in this collectionprotected void
Methods inherited from class org.mycore.datamodel.ifs2.MCRDirectory
buildChildNode, createDir, createFile
Methods inherited from class org.mycore.datamodel.ifs2.MCRStoredNode
clearLabels, getBasicFileAttributes, getCurrentLabel, getLabel, getLabels, getLocalFile, getLocalPath, readData, setLabel, setLastModified, writeData
Methods inherited from class org.mycore.datamodel.ifs2.MCRNode
getContent, getLastModified, getNodeByPath, getParent, getPath, getRandomAccessContent, getSize, isDirectory, isFile
-
Field Details
-
DATA_FILE
- See Also:
-
-
Constructor Details
-
MCRFileCollection
Creates a new file collection in the given store, or retrieves an existing one.- Parameters:
store
- the store this file collection is stored inid
- the ID of this file collection- Throws:
IOException
- See Also:
-
-
Method Details
-
saveAdditionalData
- Throws:
IOException
-
getChildren
Description copied from class:MCRNode
Returns the children of this node.- Overrides:
getChildren
in classMCRNode
- Returns:
- a List of child nodes, which may be empty, in undefined order
- Throws:
IOException
-
delete
Deletes this file collection with all its data and children- Overrides:
delete
in classMCRStoredNode
- Throws:
IOException
-
renameTo
Throws a exception, because a file collection's name is always the empty string and therefore can not be renamed.- Overrides:
renameTo
in classMCRStoredNode
- Parameters:
name
- the new file name
-
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
Returns this object, because the FileCollection instance is the root of all files and directories contained in the collection. -
getChild
Description copied from class:MCRNode
Returns the child node with the given filename, or null -
hasChildren
Description copied from class:MCRNode
Returns true if this node has child nodes. Directories and container files like zip or tar may have child nodes.- Overrides:
hasChildren
in classMCRNode
- Returns:
- true if children exist
- Throws:
IOException
-
getNumChildren
Description copied from class:MCRNode
Returns the number of child nodes of this node.- Overrides:
getNumChildren
in classMCRNode
- Returns:
- the number of child nodes of this node.
- Throws:
IOException
-
getName
Description copied from class:MCRNode
Returns the file or directory name -
repairMetadata
Repairs additional metadata stored for all files and directories in this collection- Throws:
IOException
-