electric.directory.persistent
Class PersistentDirectory

java.lang.Object
  extended byelectric.directory.Directory
      extended byelectric.directory.persistent.PersistentDirectory
All Implemented Interfaces:
IContainer, IDirectory, IEntry, ILoggingConstants

public class PersistentDirectory
extends Directory
implements IEntry

PersistentDirectory is an implementation of IDirectory that uses a TransactionalDictionary for its underlying storage. Operations that occur outside of a transaction are committed immediately. Operations that within a transaction are cached and can be either committed or rolled back using the GLUE transaction APIs.

Author:
webMethods

Field Summary
 
Fields inherited from class electric.directory.Directory
dictionary, parent
 
Fields inherited from interface electric.util.log.ILoggingConstants
CLASSLOADER_EVENT, COMMAND_EVENT, COMMENT_EVENT, CONFIG_EVENT, DEBUG_EVENT, ELECTRIC_LOGGING_PROPERTY, ERROR_EVENT, EXCEPTION_EVENT, FILE_EVENT, LICENSE_EVENT, RESOURCES_EVENT, SECURITY_EVENT, SHUTDOWN_EVENT, SOURCE_EVENT, SQL_EVENT, STARTUP_EVENT, WARNING_EVENT
 
Constructor Summary
PersistentDirectory(java.lang.String root)
          Construct a PersistentDirectory that is associated with the specified filesystem root.
PersistentDirectory(java.lang.String root, boolean delete)
          Construct a PerisistentDirectory that is associated with the specified filesystem root.
 
Method Summary
 void delete()
          Delete this directory, removing it from its parent directory.
 boolean getEncoded()
          Return true if I use an EncodedWriter to persist objects to storage.
 boolean getSync()
           
protected  TransactionalDictionary getTransactionalDictionary()
          Return the underlying TransactionalDictionary.
 java.lang.Object loadEntry()
           
 IDirectory newSubdirectory(java.lang.String name)
          Create and return a new subdirectory with the specified name.
 java.lang.Object peek(java.lang.String path)
          Return the object with the specified path, or null if not found.
 void putEntry()
          Do nothing.
 void removedEntry()
          Delete this entry by calling delete().
 void setEncoded(boolean encoded)
          If the encoded argument is true, use an EncodedWriter to persist objects to storage, otherwise use a LiteralWriter.
 void setSync(boolean flag)
           
 java.lang.String toString()
          Return a description of this directory.
 
Methods inherited from class electric.directory.Directory
findAll, findFirst, get, getParent, getParts, getPath, getRoot, getSubdirectory, keys, put, remove, removeObject, setParent, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistentDirectory

public PersistentDirectory(java.lang.String root)
                    throws DirectoryException
Construct a PersistentDirectory that is associated with the specified filesystem root. The contents of the root are not replaced. Objects that are stored as XML files in the root are only loaded into memory on demand.

Parameters:
root - The filesystem root.
Throws:
DirectoryException

PersistentDirectory

public PersistentDirectory(java.lang.String root,
                           boolean delete)
                    throws DirectoryException
Construct a PerisistentDirectory that is associated with the specified filesystem root. If the delete flag is true, the existing contents of the root are deleted. Objects that are stored as XML files in the root are only loaded into memory on demand.

Parameters:
root - The filesystem root.
delete - If true, delete the previous contents.
Throws:
DirectoryException - If an error occurred in the underlying TransactionalDictionary.
Method Detail

toString

public java.lang.String toString()
Return a description of this directory.

Overrides:
toString in class Directory

peek

public java.lang.Object peek(java.lang.String path)
                      throws DirectoryException
Return the object with the specified path, or null if not found. If the object is lazy loaded by the underlying directory, this operation return null instead of retrieving the object.

Specified by:
peek in interface IDirectory
Overrides:
peek in class Directory
Parameters:
path - The path.
Throws:
DirectoryException - If an error occurs in the underlying directory.

newSubdirectory

public IDirectory newSubdirectory(java.lang.String name)
                           throws DirectoryException
Create and return a new subdirectory with the specified name.

Specified by:
newSubdirectory in interface IDirectory
Overrides:
newSubdirectory in class Directory
Parameters:
name - The name of the new subdirectory.
Throws:
DirectoryException - If the name is invalid or the subdirectory could not be constructed.

delete

public void delete()
            throws DirectoryException
Delete this directory, removing it from its parent directory. This operation does not affect the subdirectories.

Specified by:
delete in interface IDirectory
Overrides:
delete in class Directory
Throws:
DirectoryException - If the directory could not be deleted.

getTransactionalDictionary

protected TransactionalDictionary getTransactionalDictionary()
Return the underlying TransactionalDictionary.


getEncoded

public boolean getEncoded()
Return true if I use an EncodedWriter to persist objects to storage.


setEncoded

public void setEncoded(boolean encoded)
If the encoded argument is true, use an EncodedWriter to persist objects to storage, otherwise use a LiteralWriter.

Parameters:
encoded - The new encoded mode.

setSync

public void setSync(boolean flag)
Parameters:
flag -

getSync

public boolean getSync()

putEntry

public void putEntry()
Do nothing.

Specified by:
putEntry in interface IEntry

removedEntry

public void removedEntry()
Delete this entry by calling delete().

Specified by:
removedEntry in interface IEntry

loadEntry

public java.lang.Object loadEntry()
Specified by:
loadEntry in interface IEntry


copyright© 2001-2004 by webMethods All Rights Reserved.