org.mycore.datamodel.ifs2
Class MCRFileStore

java.lang.Object
  extended by org.mycore.datamodel.ifs2.MCRStore
      extended by org.mycore.datamodel.ifs2.MCRFileStore

public class MCRFileStore
extends MCRStore

Stores file collections containing files and directories. For each store, properties must be defined, for example MCR.IFS2.Store.ID.Class=org.mycore.datamodel.ifs2.MCRFileStore MCR.IFS2.Store.ID.BaseDir=/foo/bar MCR.IFS2.Store.ID.SlotLayout=4-2-2

Author:
Frank Lützenkirchen

Field Summary
 
Fields inherited from class org.mycore.datamodel.ifs2.MCRStore
ASCENDING, DESCENDING, dir, id, idLength, lastID, offset, prefix, slotLength, stores, suffix
 
Constructor Summary
MCRFileStore()
           
 
Method Summary
 MCRFileCollection create()
          Creates and stores a new, empty file collection using the next free ID in the store.
 MCRFileCollection create(int id)
          Creates and stores a new, empty file collection with the given ID
static MCRFileStore getStore(String type)
          Returns the store with the given ID
 void repairAllMetadata()
          Repairs metadata of all file collections stored here
 MCRFileCollection retrieve(int id)
          Returns the file collection stored under the given ID, or null when no collection is stored for the given ID.
 
Methods inherited from class org.mycore.datamodel.ifs2.MCRStore
delete, delete, exists, getBaseDir, getHighestStoredID, getID, getNextFreeID, getSlot, getSlotPath, getSlotPaths, init, listIDs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCRFileStore

public MCRFileStore()
Method Detail

getStore

public static MCRFileStore getStore(String type)
Returns the store with the given ID

Parameters:
ID - the ID of the store
Returns:
the store with that ID

create

public MCRFileCollection create()
                         throws Exception
Creates and stores a new, empty file collection using the next free ID in the store.

Returns:
a newly created file collection
Throws:
Exception

create

public MCRFileCollection create(int id)
                         throws Exception
Creates and stores a new, empty file collection with the given ID

Parameters:
id - the ID of the file collection
Returns:
a newly created file collection
Throws:
Exception - when a file collection with the given ID already exists

retrieve

public MCRFileCollection retrieve(int id)
                           throws Exception
Returns the file collection stored under the given ID, or null when no collection is stored for the given ID.

Parameters:
id - the file collection's ID
Returns:
the file collection with the given ID, or null
Throws:
Exception

repairAllMetadata

public void repairAllMetadata()
                       throws Exception
Repairs metadata of all file collections stored here

Throws:
Exception