Class COM.ibm.jaws.services.sroot.SimpleRootBC
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.ibm.jaws.services.sroot.SimpleRootBC

java.lang.Object
   |
   +----COM.ibm.jaws.motk.BaseAO
           |
           +----COM.ibm.jaws.motk.BaseQC
                   |
                   +----COM.ibm.jaws.motk.BaseKC
                           |
                           +----COM.ibm.jaws.motk.BaseBC
                                   |
                                   +----COM.ibm.jaws.services.sroot.SimpleRootBC

public class SimpleRootBC
extends BaseBC
implements Managed, Syncable
This is a simple root BaseCollection. It is transient (i.e., does not need to have its state externalized and internalized.) Its MOs are defined by files residing in a directory, called its base directory. The base directory is set in a class method call (getRoot). Once one instance of this BC is created in an address space by a getRoot call, all other calls specifing the same base directory will return the same instance. It can only be removed from the address space by an explicit call to release. This will deactivate it and remove its class memory until the next call to getRoot for the same directory at which time it will be reactivated.

New entries can be added to or removed from the base directory at any time, but removing entries from the base directory will not cause them to be deactivated.

Restrictions:

The current implementation does not release MOs once they have been activated until the whole BC is released by an explicit call. This will be improved in future releases.

See Overview for an overview of the SimpleRootBC and how to use it.
(Alternate link to the Overview.)


Variable Index

 o activeMOs
The active objects list.
 o baseDir
The actual base directory.
 o baseDirName
The path name of the base directory.
 o containedObjectDC
The dependent context for contained objects
 o d

Constructor Index

 o SimpleRootBC()
Required default constructor, does nothing
 o SimpleRootBC(String)
 o SimpleRootBC(String, SRootNC)

Method Index

 o activateBaseDir()
 o activateObjectFromData(String, InputEDStream, String)
News up the object and adds it to the active list.
 o activateObjectFromFile(String)
Only called once per root level object.
 o createFromCopy(String, Manageable, String)
Creates an file in the activation space directory using the specified key as its name.
 o createFromCopy(String, Manageable, String, boolean)
Creates an file in the activation space directory using the specified key as its name.
 o createFromData(String, InputEDStream, String)
Creates an file in the activation space directory using the specified key as its name.
 o createFromData(String, InputEDStream, String, boolean)
Creates an file in the activation space directory using the specified key as its name.
 o createFromDefault(String, Object, String)
Not supported
 o evaluate(String, String)
 o externalizeToStream(OutputEDStream)
Does nothing
 o finalize()
Code to perform when this object is garbage collected.
 o getActivationSpaceName()
Returns the activation space id of this object.
 o getConstantRandomId()
Returns the java.lang.Object.hashCode() for this object's activation space name.
 o getDependentContext()
 o getIdentifier(BaseCollection)
 o getRoot(String)
 o initialize()
sets up the name context to hand to contained objects as a dependent context (containedObjectDC)
 o internalizeFromStream(InputEDStream)
Does nothing
 o isIdentical(Identifiable)
Returns true if the two objects are SimpleRoots for the same activation space.
 o release()
Releases all the resources associated with this activation space.
 o remove()
Not supported
 o resolve(String)
Provides support for absolute key paths, you need to override this and add support for relatitive key paths.
 o saveDependentContext()
 o saveMO(String)
Saves the state of a top level MO.
 o sync()
Saves the state of all the active top level objects in this activation space.

Variables

 o d
  public static Debug d
 o baseDirName
  protected transient String baseDirName
The path name of the base directory.
 o baseDir
  protected transient File baseDir
The actual base directory.
 o activeMOs
  protected transient Hashtable activeMOs
The active objects list.
 o containedObjectDC
  protected transient SRootNC containedObjectDC
The dependent context for contained objects

Constructors

 o SimpleRootBC
  public SimpleRootBC()
Required default constructor, does nothing
 o SimpleRootBC
  public SimpleRootBC(String baseDirName)
 o SimpleRootBC
  public SimpleRootBC(String baseDirName,
                      SRootNC dependentContext)

Methods

 o getRoot
  public static SimpleRootBC getRoot(String baseDirName)
 o getDependentContext
  public SRootNC getDependentContext()
 o activateBaseDir
  protected void activateBaseDir()
 o saveDependentContext
  public void saveDependentContext()
 o getActivationSpaceName
  public String getActivationSpaceName()
Returns the activation space id of this object.
 o initialize
  protected void initialize()
sets up the name context to hand to contained objects as a dependent context (containedObjectDC)
 o evaluate
  public Iterator evaluate(String queryParameter,
                           String queryString)
Overrides:
evaluate in class BaseQC
 o resolve
  public Object resolve(String keyPathString)
Provides support for absolute key paths, you need to override this and add support for relatitive key paths.
Overrides:
resolve in class BaseKC
 o activateObjectFromFile
  public SRootMO activateObjectFromFile(String keyName)
Only called once per root level object. This actually opens the file and then calls activateFromData to really activate the object. This is called the first time resolve is called for the object or one of its aliases.
 o saveMO
  protected void saveMO(String key)
Saves the state of a top level MO. Key names the MO. Throws an error if the MO is not active.
 o createFromData
  public Managed createFromData(String key,
                                InputEDStream data,
                                String interfaceKey)
Creates an file in the activation space directory using the specified key as its name. This file will contain the essential data for the created object.
Overrides:
createFromData in class BaseBC
See Also:
createFromData
 o createFromData
  public Managed createFromData(String key,
                                InputEDStream data,
                                String interfaceKey,
                                boolean allowDuplicates)
Creates an file in the activation space directory using the specified key as its name. This file will contain the essential data for the created object. If allowDuplicates is true then an existing file if any will be overwritten.
See Also:
createFromData
 o activateObjectFromData
  protected SRootMO activateObjectFromData(String key,
                                           InputEDStream in,
                                           String moClassName)
News up the object and adds it to the active list.
 o createFromCopy
  public Managed createFromCopy(String key,
                                Manageable copy,
                                String interfaceKey)
Creates an file in the activation space directory using the specified key as its name. This file will contain the essential data for the created object.
Overrides:
createFromCopy in class BaseBC
See Also:
createFromCopy
 o createFromCopy
  public Managed createFromCopy(String key,
                                Manageable copy,
                                String interfaceKey,
                                boolean allowDuplicates)
Creates an file in the activation space directory using the specified key as its name. This file will contain the essential data for the created object. If allowDuplicates is true then an existing file if any will be overwritten.
See Also:
createFromCopy
 o createFromDefault
  public Managed createFromDefault(String key,
                                   Object creator,
                                   String interfaceName)
Not supported
Overrides:
createFromDefault in class BaseBC
 o externalizeToStream
  public void externalizeToStream(OutputEDStream out)
Does nothing
Overrides:
externalizeToStream in class BaseAO
 o internalizeFromStream
  public void internalizeFromStream(InputEDStream in)
Does nothing
Overrides:
internalizeFromStream in class BaseAO
 o sync
  public void sync()
Saves the state of all the active top level objects in this activation space.
 o finalize
  public void finalize()
Code to perform when this object is garbage collected.
Overrides:
finalize in class Object
 o release
  public void release()
Releases all the resources associated with this activation space. Note: this does not save the resources first. Call saveAll first if you want to save the state of the objects in the activation space.
Overrides:
release in class BaseAO
See Also:
release
 o remove
  public void remove()
Not supported
Overrides:
remove in class BaseAO
 o getIdentifier
  public String getIdentifier(BaseCollection relativeTo)
 o isIdentical
  public boolean isIdentical(Identifiable otherObject)
Returns true if the two objects are SimpleRoots for the same activation space.
See Also:
isIdentical
 o getConstantRandomId
  public int getConstantRandomId()
Returns the java.lang.Object.hashCode() for this object's activation space name.
See Also:
getConstantRandomId

All Packages  Class Hierarchy  This Package  Previous  Next  Index