org.iges.anagram
Class Store

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

public class Store
extends AbstractModule

Provides a convenient access mechanism for temporary disk storage. Each module receives a separate namespace for its entries, thus minimizing the possibility of namespace conflicts.


Field Summary
protected  java.io.File baseDir
           
 
Fields inherited from class org.iges.anagram.AbstractModule
log, moduleName, parent, server
 
Constructor Summary
Store()
           
 
Method Summary
 void configure(Setting setting)
          Configures the module according to the settings provided.
 java.io.File get(Module module, java.lang.String entryName)
          Returns the file handle associated with the given entry name, for the given module.
 java.io.File get(Module module, java.lang.String entryName, long staleTime)
          Returns the file handle associated with the given entry name, for the given module.
 java.io.File get(Module module, java.lang.String prefix, java.lang.String suffix)
          Returns a unique (to this JVM session) file handle whose name is constructed using the given prefix and suffix, for the given module.
 java.lang.String getModuleID()
          Returns an ID for this module.
protected  void mkdirs(java.io.File entryDir)
           
protected  java.io.File resolve(Module module, java.lang.String entryName)
           
 
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

baseDir

protected java.io.File baseDir
Constructor Detail

Store

public Store()
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

get

public java.io.File get(Module module,
                        java.lang.String entryName,
                        long staleTime)
Returns the file handle associated with the given entry name, for the given module. If the file is older than the time given, it is deleted before the handle is returned.

Used in combination with the DataHandle.getCreateTime() method, this provides a way for modules to keep cached data associated with a particular data handle up to date.

It is guaranteed that all parent directories exist for the handle before it is returned.

Parameters:
entryName - This parameter should uniquely identify the resource being stored or accessed, and should not contain any characters that are illegal in filenames.

get

public java.io.File get(Module module,
                        java.lang.String entryName)
Returns the file handle associated with the given entry name, for the given module.

It is guaranteed that all parent directories exist for the handle before it is returned.


get

public java.io.File get(Module module,
                        java.lang.String prefix,
                        java.lang.String suffix)
                 throws ModuleException
Returns a unique (to this JVM session) file handle whose name is constructed using the given prefix and suffix, for the given module.

It is guaranteed that all parent directories exist for the handle before it is returned.

ModuleException

mkdirs

protected void mkdirs(java.io.File entryDir)

resolve

protected java.io.File resolve(Module module,
                               java.lang.String entryName)