org.iges.anagram
Class Catalog

java.lang.Object
  |
  +--org.iges.anagram.AbstractModule
        |
        +--org.iges.anagram.Catalog
All Implemented Interfaces:
Module

public class Catalog
extends AbstractModule

Manages the list of available data objects.


Field Summary
protected static java.lang.String CATALOG_FILE
           
protected  DirHandle root
           
protected  ExclusiveLock synch
           
protected static java.lang.String TEMP_ENTRY_FILE
           
protected  long tempAgeLimit
           
protected  java.util.LinkedList tempDeleteQueue
           
protected  DirHandle tempEntries
           
protected  long tempEntryLimit
           
protected  long tempStorage
           
protected  long tempStorageLimit
           
 
Fields inherited from class org.iges.anagram.AbstractModule
log, moduleName, parent, server
 
Constructor Summary
Catalog()
           
 
Method Summary
protected  void addHandle(DataHandle handle)
          Adds a handle to the correct dir, creating it if necessary
 void addTemp(TempDataHandle tempData)
          Adds a temporary dataset to the catalog.
protected  void addTemp(TempDataHandle tempData, boolean save)
           
protected  void checkDependencies(DataHandle data)
           
protected  void checkLimits()
           
 void clearTemp()
          Deletes all temporary entries in the catalog
 void configure(Setting setting)
          Configures the module according to the settings provided.
 boolean contains(java.lang.String path)
          Returns true if the catalog contains a handle that matches the given pathname.
protected  Handle get(java.lang.String path)
           
protected  java.lang.String getChildPath(java.lang.String completePath, DirHandle dir)
          Used by add, remove and getDir Takes "basepath[/name1[/name2/../nameN]]" Returns name1 if followed by name2, or "" otherwise
protected  DirHandle getDir(java.lang.String path, DirHandle dir)
          Used by add, remove, get, and getParent to look up datasets
 Handle getLocked(java.lang.String path)
          Retrieves the handle, if any, that maches the given pathname.
 java.lang.String getModuleID()
          Returns an ID for this module.
 DirHandle getParent(Handle handle)
          Returns the parent of the handle given.
protected  void loadCatalogFromStore()
           
protected  void loadEntries(java.util.List newEntries)
           
protected  void loadTempEntriesFromStore()
           
protected  boolean outdated(TempDataHandle tempData)
           
protected  void removeHandle(Handle handle)
          Removes a handle, removing the parent dir if appropriate.
protected  void removeTemp(java.lang.String reason, TempDataHandle tempHandle)
           
 void saveCatalogToStore()
           
protected  void saveTempEntriesToStore()
           
protected  void unloadEntries(java.util.List newEntries)
           
 
Methods inherited from class org.iges.anagram.AbstractModule
configModule, debug, debug, error, fail, fail, fail, getModuleName, info, init, toString, verbose, verbose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEMP_ENTRY_FILE

protected static final java.lang.String TEMP_ENTRY_FILE
See Also:
Constant Field Values

CATALOG_FILE

protected static final java.lang.String CATALOG_FILE
See Also:
Constant Field Values

synch

protected ExclusiveLock synch

root

protected DirHandle root

tempEntries

protected DirHandle tempEntries

tempDeleteQueue

protected java.util.LinkedList tempDeleteQueue

tempStorage

protected long tempStorage

tempStorageLimit

protected long tempStorageLimit

tempEntryLimit

protected long tempEntryLimit

tempAgeLimit

protected long tempAgeLimit
Constructor Detail

Catalog

public Catalog()
Method Detail

getModuleID

public java.lang.String getModuleID()
Description copied from interface: Module
Returns an ID for this module. This ID should be a legal XML tag name. It has two uses: as a tag name in the server's configuration file, and as the final element of the complete module name.

Specified by:
getModuleID in interface Module
Specified by:
getModuleID in class AbstractModule

configure

public void configure(Setting setting)
               throws ConfigException
Description copied from class: AbstractModule
Configures the module according to the settings provided. The server supports dynamic reconfiguration. Thus this method may be called at any time in the life of the module. If the module cannot be reconfigured, it should throw an exception.

Specified by:
configure in interface Module
Specified by:
configure in class AbstractModule
ConfigException

addTemp

public void addTemp(TempDataHandle tempData)
Adds a temporary dataset to the catalog.


addTemp

protected void addTemp(TempDataHandle tempData,
                       boolean save)

outdated

protected boolean outdated(TempDataHandle tempData)

checkDependencies

protected void checkDependencies(DataHandle data)

getLocked

public Handle getLocked(java.lang.String path)
Retrieves the handle, if any, that maches the given pathname. If a handle is found, it will be non-exclusively locked for the calling thread. This lock must be released when the caller finishes using the handle or other requests may become deadlocked.


contains

public boolean contains(java.lang.String path)
Returns true if the catalog contains a handle that matches the given pathname.


get

protected Handle get(java.lang.String path)

clearTemp

public void clearTemp()
Deletes all temporary entries in the catalog


getParent

public DirHandle getParent(Handle handle)
Returns the parent of the handle given. The resulting handle is not locked, since directory handles are only modified during reconfiguration.


getDir

protected DirHandle getDir(java.lang.String path,
                           DirHandle dir)
Used by add, remove, get, and getParent to look up datasets


getChildPath

protected java.lang.String getChildPath(java.lang.String completePath,
                                        DirHandle dir)
Used by add, remove and getDir Takes "basepath[/name1[/name2/../nameN]]" Returns name1 if followed by name2, or "" otherwise


addHandle

protected void addHandle(DataHandle handle)
Adds a handle to the correct dir, creating it if necessary


removeHandle

protected void removeHandle(Handle handle)
Removes a handle, removing the parent dir if appropriate.


unloadEntries

protected void unloadEntries(java.util.List newEntries)

loadEntries

protected void loadEntries(java.util.List newEntries)

loadTempEntriesFromStore

protected void loadTempEntriesFromStore()

loadCatalogFromStore

protected void loadCatalogFromStore()

saveTempEntriesToStore

protected void saveTempEntriesToStore()

saveCatalogToStore

public void saveCatalogToStore()

checkLimits

protected void checkLimits()

removeTemp

protected void removeTemp(java.lang.String reason,
                          TempDataHandle tempHandle)