IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.base
Class Context

java.lang.Object
  extended bycom.ibm.btt.base.Context
All Implemented Interfaces:
Externalizable, java.io.Externalizable, java.io.Serializable

public class Context
extends java.lang.Object
implements Externalizable

This class is the basic repository of data and services. Instances of this class can be linked, or chained, in a tree of contexts, and the instances are capable of navigating over this tree, always in the upper direction. The instances of this class also can be passed as parameters of the format() and unformat() methods of a record format.

See Also:
Serialized Form

Field Summary
protected  int bufferSize
           
static int DEFAULT_BUFFER_SIZE
           
static byte DEFAULT_COMPRESSION
           
protected static Externalizer externalizer
           
 
Constructor Summary
Context()
          This constructor creates a local context object without name.
Context(java.lang.String contextName, boolean isDistributed)
          This constructor creates a distributed Context object or a local context according to the value of the parameter isDistributed.
Context(java.lang.String aName, java.lang.String aType, Context aParent)
          Creates a local context without predefined definition and chain to another local or distributed context.
Context(java.lang.String contextName, java.lang.String typeName, Context parentContext, boolean isDistributed)
          If isDistributed = true, create a distributed Context based on a context name, and the following optional params, type name, parent Context.
Context(java.lang.String aName, java.lang.String aType, Context aParent, KeyedCollection aKeyedCollection)
          Creates a local context without predefined definition and chain to another local or distributed context.
Context(java.lang.String contextName, java.lang.String typeName, Context parentContext, KeyedCollection aKeyedCollection, boolean isDistributed)
          If isDistributed = true, create a distributed Context based on a context name, and the following optional params, type name, parent Context, a KeyedCollection.
Context(java.lang.String aName, java.lang.String aType, KeyedCollection aKeyedCollection)
          Creates a local context without predefined definition and chain to another local or distributed context.
 
Method Summary
 void addChild(Context aNewChild)
          Adds a child specified by the parameter to the children list of current context.
 void addElement(DataElement aDataElement)
          Adds an element to its keyedCollection.
 void chainTo(Context aContext)
          Chains this context to aContext.
 void clearKeyedCollection()
          Clears the context (current level only) by destroying the current keyed collection associated and replacing it with a new one.
 void clearKeyedCollection(boolean keepKCollStatus, boolean clearOnlyValues)
          This method clears both the typed and non-typed elements in the context keyed collection.
 boolean containsChild(java.lang.String aContextName)
          Returns true if this context has a child with the name aContextName.
 Externalizer externalizer()
          Returns the externalizer instance of this class.
 Vector fields()
          Returns all the data fields, which are addressable from this context.
 Context getAncestorByName(java.lang.String aContextName)
          Searches the context tree for an ancestor Context named aContextName and returns the first matching context.
 java.lang.String getCHALocation(java.lang.String contextName)
          Get the CHA server location where the context specified by the parameter contextName is stored.
 Vector getChildren()
          Returns the children contexts of this one.
 Vector getChildrenAtAnyLevel()
          Get the children of a remote context at any level from the context tree.
static Context getContextByInstanceID(java.lang.String anInstanceID)
          Returns the distributed context that matches the parameter: instanceID.
 Context getContextByType(java.lang.String aTypeName)
          Returns the first context that matches its type to aTypeName.
static Context getContextNamed(java.lang.String aContextName)
          Searches the context tree from the root context for a context named aContextName
 DataElement getElementAt(java.lang.String aCompositeKey)
          Returns the element of its keyedCollection,or keyedCollections of the upper contexts which is located at aCompositeKey path.
static Externalizer getExternalizer()
          Gets the externalizer.
 java.lang.String getInstanceID()
          Returns the instanceID.
 KeyedCollection getKeyedCollection()
          Returns the keyedCollection attribute.
 java.lang.String getLevel()
          We can define an attribute --level-- in dsectxt.xml file to indicate level of the context.
 int getMode()
          Returns the mode.
 java.lang.String getName()
          Return the name attribute.
 Context getNextContextHorizontal()
          The method used to iterate over the context tree.
 Context getNextContextVertical(Context parentContext)
           
 Context getParent()
          Returns the parent attribute.
static Context getRoot()
          Returns the root context of the context tree.
 java.lang.String getRootLocation()
          Get the CHA server location where the root context will be stored.
 java.lang.String getTagName()
          Returns a String used by the externalizer.
 java.lang.String getType()
          Returns the "type" attribute.
 java.lang.Object getValueAt(java.lang.String aCompositeKey)
          Returns the value of the element of its keyedCollection, or keyedCollections of the upper contexts, located in the "aCompositeKey" path.
 boolean hasChildren()
          Returns true if this context has any children.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a Context with the Tag attributes.
 boolean isAddToDynamicKColl()
          Returns the value of the addToDynamicKColl property.
 boolean isChained()
          Returns true if this context is in the context tree.
 boolean isReadOnly()
          If the definition of this context in dsetxt.xml has the attribute readonly="true", this method will return true, otherwise, false is returned.
 boolean isRoot()
          Returns true if this context is the root context.
 void prune()
          Removes this context and its children from the context tree.
 void readExternal()
          Initializes a dataElement with its external value.
 void readExternal(java.io.ObjectInput s)
          Invokes the object creation from an ObjectInput.
 void readExternal(TagInputStream aTIS)
          Initializes this instance with values read from a file.
 void readFromStream(java.io.ObjectInput s)
          Invokes the object creation from an ObjectInput.
 DataElement removeAt(java.lang.String aCompositeKey)
          Removes aCompositeKey element of its keyedCollection.
 DataElement removeAtAnyLevel(java.lang.String aCompositeKey)
          Removes an element of its keyedCollection, or the keyedCollections in the upper contexts, located in the aCompositeKey path.
 void removeChild(Context aContext)
          Removes a child of this context from the context tree if the current context and its child are both local contexts.
 void removeChild(java.lang.String childInstanceID)
          Remove the child-parent relationship in CHAChildren table when the current context is a remote context and Multiple CHA Architecture is used (supportMultipleCHAServers=true).
 void removeExternal()
          Removes the object's tags from the file in which the object is externalized.
 void removeInstance()
          The method used to remove the current context if it is a remote context.
static void reset()
          Deletes all context instances.
 void setAddToDynamicKColl(boolean newValue)
          Sets the value of the addToDynamicKColl property.
 void setChildren(Vector aChildrenCollection)
          Sets the children property.
static void setExternalizer(Externalizer anExternalizer)
          Sets the externalizer.
 void setInstanceID(java.lang.String anInstanceID)
          Sets the instanceID for a local context which must not predefined in the configuration file such as dsectxt.xml.
 void setKCollDynamic(boolean aValue)
          Set the value to the attribute dynamic for the keyedCollection in this context.
 void setKeyedCollection(KeyedCollection aKeyedCollection)
          Sets the attribute keyedCollection.
 void setName(java.lang.String aContextName)
          Sets the name property of this context.
 void setReadOnly(boolean isReadOnly)
           
 void setSerializableLevel(int i)
          Set the value of variable serializableLevel.
 void setSerializeParentsAndChildren(boolean b)
          Set the value of variable serializeParentsAndChildren When the local context will be serialized, if serializeParentsAndChildren = true, the parents and children of the local context will be serialized.
 void setType(java.lang.String aContextType)
          Sets the type property of this context.
 int setValueAt(SortedTable aSortedTable)
          The function is similiar to setValueAt(String, Object) except that set pairs of keys and values stored in aSortedTable via one method.
 void setValueAt(java.lang.String aCompositeKey, java.lang.Object aDataValue)
          Sets the value of the element of its keyedCollection, or keyedCollections of the upper contexts, located in the aCompositeKey path.
 java.lang.String toString()
          Returns an XML representation of this context.
 Vector toStrings()
          Returns a visual representation of this context.
 Vector toTags()
          Returns a Vector with the elements represented as a Tag.
 DataElement tryGetElementAt(java.lang.String aCompositeKey)
          Returns the element of its keyedCollection, or keyedCollections of the upper contexts which is located at aCompositeKey path.
 java.lang.Object tryGetValueAt(java.lang.String aCompositeKey)
          Returns the value of the element of its keyedCollection, or keyedCollections of the upper contexts, located in the aCompositeKey path.
 int trySetElementAt(java.lang.String aCompositeKey, java.io.Serializable aValue)
          Set the value of the element of its keyedCollection, or keyedCollections of the upper contexts which is located at aCompositeKey path.
 void unchain()
          Removes this context and all its children from the context tree.
 void writeExternal()
          Writes this instance to a file using tags.
 void writeExternal(java.io.ObjectOutput s)
          Provides concrete serialization handling for contexts.
 void writeToStream(java.io.ObjectOutput s)
          Provides concrete serialization handling for contexts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

externalizer

protected static Externalizer externalizer

DEFAULT_COMPRESSION

public static final byte DEFAULT_COMPRESSION
See Also:
Constant Field Values

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

bufferSize

protected int bufferSize
Constructor Detail

Context

public Context()
This constructor creates a local context object without name.


Context

public Context(java.lang.String contextName,
               boolean isDistributed)
        throws DSEInvalidRequestException
This constructor creates a distributed Context object or a local context according to the value of the parameter isDistributed. The context specified by the parameter contextName must be pre-defined in dsectxt.xml stored in CHA server. If isDistributed is false, a local context is created. Otherwise, a distribute one is created.


Context

public Context(java.lang.String aName,
               java.lang.String aType,
               Context aParent)
        throws DSEInvalidRequestException
Creates a local context without predefined definition and chain to another local or distributed context.

Parameters:
aName - java.lang.String
aType - java.lang.String
aParent - Context

Context

public Context(java.lang.String aName,
               java.lang.String aType,
               Context aParent,
               KeyedCollection aKeyedCollection)
        throws DSEInvalidRequestException
Creates a local context without predefined definition and chain to another local or distributed context.


Context

public Context(java.lang.String aName,
               java.lang.String aType,
               KeyedCollection aKeyedCollection)
        throws DSEInvalidRequestException
Creates a local context without predefined definition and chain to another local or distributed context.

Parameters:
aName - java.lang.String
aType - java.lang.String
aKeyedCollection - KeyedCollection

Context

public Context(java.lang.String contextName,
               java.lang.String typeName,
               Context parentContext,
               boolean isDistributed)
        throws DSEInvalidRequestException
If isDistributed = true, create a distributed Context based on a context name, and the following optional params, type name, parent Context. The name specified in the context name must exist in the external XML definiton files. If typeName is null, the type will be the one predefined in dsectxt.xml. If isDistributed = true, create a predefined local context. The context specified by parameter contextName must be defined in dsectxt.xml. Parameters typeName and ParentContext specify the type name and the parent context instead of using the type name and parent context defined in the dsectxt.xml file.

Parameters:
contextName -
typeName -
parentContext -
isDistributed -
Throws:
DSEInvalidRequestException

Context

public Context(java.lang.String contextName,
               java.lang.String typeName,
               Context parentContext,
               KeyedCollection aKeyedCollection,
               boolean isDistributed)
        throws DSEInvalidRequestException
If isDistributed = true, create a distributed Context based on a context name, and the following optional params, type name, parent Context, a KeyedCollection. The name specified in the context name must exist in the external XML definiton files. If typeName is null, the type will be the one predefined in dsectxt.xml. If isDistributed = true, create a predefined local context. The context specified by parameter contextName must be defined in dsectxt.xml. Parameters typeName, ParentContext, aKeyedCollection specify the type name, the parent context and the keyedCollection instead of using the type name, the parent context and the keyedCollection defined in the dsectxt.xml file.

Parameters:
contextName -
typeName -
parentContext -
aKeyedCollection -
isDistributed -
Throws:
DSEInvalidRequestException
Method Detail

addChild

public void addChild(Context aNewChild)
              throws DSEInvalidRequestException
Adds a child specified by the parameter to the children list of current context. When supportMultipleCHAServers = "false"(support one single CHA server), this method is to add child only for the local context. Otherwise, when supportMultipleCHAServers = "true"(support multiple CHA server Architecture), there are two cases: 1. Both the current context and its child are local contexts: adds a child specified by the parameter to the children list of current context. 2. Both the current context and its child are remote contexts: Create a row in CHAChildren table to show the parent-child relationship of the two contexts.

Parameters:
aNewChild - Context
Throws:
DSEInvalidRequestException

addElement

public void addElement(DataElement aDataElement)
                throws DSEInvalidRequestException
Adds an element to its keyedCollection.

Throws:
DSEInvalidRequestException

chainTo

public void chainTo(Context aContext)
             throws DSEInvalidRequestException
Chains this context to aContext. This method verifies the consistency of the resultant context tree and changes the parent and children attributes of its respective contexts.

Throws:
DSEInvalidRequestException

clearKeyedCollection

public void clearKeyedCollection()
                          throws DSEInvalidRequestException
Clears the context (current level only) by destroying the current keyed collection associated and replacing it with a new one.

Throws:
DSEInvalidRequestException

clearKeyedCollection

public void clearKeyedCollection(boolean keepKCollStatus,
                                 boolean clearOnlyValues)
                          throws java.io.IOException,
                                 DSEInvalidRequestException
This method clears both the typed and non-typed elements in the context keyed collection. It can clear only the elements of the kColl and keep the kColl attributes. For the kColl elements it is possible to clear only the values or to clear all the attributes.

Parameters:
keepKCollStatus - boolean (false - clear also the context kColl attributes; true - keep the context kColl attributes and clear only the kColl data elements)
clearOnlyValues - boolean (false - clear all attributes of the context kColl data elements; true - clear only kColl data elements values)
Throws:
java.io.IOException - - If keepKCollStatus or clearOnlyValues are false and the keyed collection has not been defined in the generic data file or in the generic types file
DSEInvalidRequestException

containsChild

public boolean containsChild(java.lang.String aContextName)
                      throws DSEInvalidRequestException
Returns true if this context has a child with the name aContextName. It returns false otherwise.

Throws:
DSEInvalidRequestException

externalizer

public Externalizer externalizer()
Returns the externalizer instance of this class. This method can not be used in CHA Facade.

Specified by:
externalizer in interface Externalizable
Returns:
Externalizer

fields

public Vector fields()
              throws DSEInvalidRequestException
Returns all the data fields, which are addressable from this context. This includes all the data fields of this context and the upper context.

Returns:
Vector
Throws:
DSEInvalidRequestException

getAncestorByName

public Context getAncestorByName(java.lang.String aContextName)
                          throws DSEInvalidRequestException
Searches the context tree for an ancestor Context named aContextName and returns the first matching context.

Parameters:
aContextName - java.lang.String
Returns:
Context
Throws:
DSEInvalidRequestException

getChildrenAtAnyLevel

public Vector getChildrenAtAnyLevel()
                             throws DSEInvalidRequestException
Get the children of a remote context at any level from the context tree.

Throws:
DSEInvalidRequestException

getChildren

public Vector getChildren()
                   throws DSEInvalidRequestException
Returns the children contexts of this one.

Throws:
DSEInvalidRequestException

getContextByType

public Context getContextByType(java.lang.String aTypeName)
                         throws DSEInvalidRequestException
Returns the first context that matches its type to aTypeName.

Throws:
DSEInvalidRequestException

getContextNamed

public static Context getContextNamed(java.lang.String aContextName)
                               throws DSEInvalidRequestException
Searches the context tree from the root context for a context named aContextName

Throws:
DSEInvalidRequestException

getNextContextHorizontal

public Context getNextContextHorizontal()
                                 throws DSEInvalidRequestException
The method used to iterate over the context tree.

Returns:
com.ibm.dse.base.Context
Throws:
DSEInvalidRequestException

getNextContextVertical

public Context getNextContextVertical(Context parentContext)
                               throws DSEInvalidRequestException
Throws:
DSEInvalidRequestException

getElementAt

public DataElement getElementAt(java.lang.String aCompositeKey)
                         throws DSEObjectNotFoundException
Returns the element of its keyedCollection,or keyedCollections of the upper contexts which is located at aCompositeKey path.

Throws:
DSEObjectNotFoundException

getExternalizer

public static Externalizer getExternalizer()
Gets the externalizer. This method can not be used in CHAFacade.


getKeyedCollection

public KeyedCollection getKeyedCollection()
                                   throws DSEInvalidRequestException
Returns the keyedCollection attribute.

Throws:
DSEInvalidRequestException

getName

public java.lang.String getName()
Return the name attribute.

Specified by:
getName in interface Externalizable
Returns:
java.lang.String

getParent

public Context getParent()
                  throws DSEInvalidRequestException
Returns the parent attribute.

Throws:
DSEInvalidRequestException

getRoot

public static Context getRoot()
                       throws DSEInvalidRequestException
Returns the root context of the context tree.

Throws:
DSEInvalidRequestException

getTagName

public java.lang.String getTagName()
Returns a String used by the externalizer. This method can not be call in CHA Facade

Returns:
java.lang.String

getType

public java.lang.String getType()
                         throws DSEInvalidRequestException
Returns the "type" attribute.

Returns:
Hashtable.
Throws:
DSEInvalidRequestException

getValueAt

public java.lang.Object getValueAt(java.lang.String aCompositeKey)
                            throws DSEObjectNotFoundException
Returns the value of the element of its keyedCollection, or keyedCollections of the upper contexts, located in the "aCompositeKey" path.

Throws:
DSEObjectNotFoundException

hasChildren

public boolean hasChildren()
                    throws DSEInvalidRequestException
Returns true if this context has any children.

Throws:
DSEInvalidRequestException

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException
Initializes a Context with the Tag attributes. This method can not be executed in CHA Facade

Specified by:
initializeFrom in interface Externalizable
Parameters:
aTag - Tag
Returns:
java.lang.Object
Throws:
java.io.IOException
DSEException

isAddToDynamicKColl

public boolean isAddToDynamicKColl()
                            throws DSEInvalidRequestException
Returns the value of the addToDynamicKColl property.

Returns:
boolean - The current value of addToDynamicKColl
Throws:
DSEInvalidRequestException

isChained

public boolean isChained()
                  throws DSEInvalidRequestException
Returns true if this context is in the context tree.

Throws:
DSEInvalidRequestException

isRoot

public boolean isRoot()
               throws DSEInvalidRequestException
Returns true if this context is the root context.

Throws:
DSEInvalidRequestException

prune

public void prune()
           throws DSEInvalidRequestException,
                  DSEObjectNotFoundException
Removes this context and its children from the context tree.

Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

readExternal

public void readExternal()
                  throws java.io.IOException
Initializes a dataElement with its external value. This instance requires an id (name) and the Externalizer and its tagInputStream are initialized.

Specified by:
readExternal in interface Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(TagInputStream aTIS)
                  throws java.io.IOException
Initializes this instance with values read from a file. Call this method only when the Externalizer has not initialized its tagStream. Once the tagStream is initialized, the method to call is readExternal()

Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput s)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Invokes the object creation from an ObjectInput. The ObjectInput has a context and all of its children.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
s - java.io.ObjectInput
Throws:
java.io.IOException.
java.lang.ClassNotFoundException.
java.io.IOException
java.lang.ClassNotFoundException

readFromStream

public void readFromStream(java.io.ObjectInput s)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException
Invokes the object creation from an ObjectInput. The ObjectInput has a context and all of its children.

Parameters:
s - java.io.ObjectInput
Throws:
java.io.IOException.
java.lang.ClassNotFoundException.
java.io.IOException
java.lang.ClassNotFoundException

removeAt

public DataElement removeAt(java.lang.String aCompositeKey)
                     throws DSEObjectNotFoundException,
                            DSEInvalidRequestException
Removes aCompositeKey element of its keyedCollection.

Throws:
DSEObjectNotFoundException
DSEInvalidRequestException

removeAtAnyLevel

public DataElement removeAtAnyLevel(java.lang.String aCompositeKey)
                             throws DSEObjectNotFoundException,
                                    DSEInvalidRequestException
Removes an element of its keyedCollection, or the keyedCollections in the upper contexts, located in the aCompositeKey path.

Returns:
Return null if the dataElment specified by parameter aCompositeKey is not able to removed. return the dataElment specified by parameter aCompositeKey if the dataElment is removed successfully.
Throws:
DSEObjectNotFoundException
DSEInvalidRequestException

removeChild

public void removeChild(Context aContext)
                 throws DSEObjectNotFoundException,
                        DSEInvalidRequestException
Removes a child of this context from the context tree if the current context and its child are both local contexts. If the child that will be removed contains children, please do not use this method. Otherwise, we will leave the child's children be orphan. If the current context and its child are both remote contexts, there are the following two cases: 1. supportMultipleCHAServers = "false"(support one single CHA server) This method do nothing. 2. supportMultipleCHAServers = "true"(support multiple CHA server Architecture) This method remove the row in CHAChildren table representing the parent-child relationship of these two contexts.

Parameters:
aContext - Context
Throws:
DSEObjectNotFoundException
DSEInvalidRequestException

removeInstance

public void removeInstance()
                    throws DSEInvalidRequestException
The method used to remove the current context if it is a remote context. Since this method do not maintain the relationship among contexts, our customers are advised not to use it in the application code. Use prune() method, instead.

Throws:
DSEInvalidRequestException

removeChild

public void removeChild(java.lang.String childInstanceID)
                 throws DSEInvalidRequestException
Remove the child-parent relationship in CHAChildren table when the current context is a remote context and Multiple CHA Architecture is used (supportMultipleCHAServers=true).

Parameters:
childInstanceID -
Throws:
DSEInvalidRequestException

removeExternal

public void removeExternal()
                    throws java.io.IOException
Removes the object's tags from the file in which the object is externalized.

Specified by:
removeExternal in interface Externalizable
Throws:
java.io.IOException

reset

public static void reset()
                  throws DSEException
Deletes all context instances. Resets the rootInstance variable.

Throws:
DSEException

setAddToDynamicKColl

public void setAddToDynamicKColl(boolean newValue)
                          throws DSEInvalidRequestException
Sets the value of the addToDynamicKColl property.

Parameters:
newValue - boolean The new value of the property.
Throws:
DSEInvalidRequestException

setChildren

public void setChildren(Vector aChildrenCollection)
                 throws DSEInvalidRequestException
Sets the children property. If a remote Context calls this method, do nothing.

Throws:
DSEInvalidRequestException

setExternalizer

public static void setExternalizer(Externalizer anExternalizer)
Sets the externalizer. This method can not be used in CHAFacade.


setKeyedCollection

public void setKeyedCollection(KeyedCollection aKeyedCollection)
                        throws DSEInvalidRequestException
Sets the attribute keyedCollection.

Throws:
DSEInvalidRequestException

setName

public void setName(java.lang.String aContextName)
Sets the name property of this context.

Specified by:
setName in interface Externalizable
Parameters:
aContextName - java.lang.String

setType

public void setType(java.lang.String aContextType)
             throws DSEInvalidRequestException
Sets the type property of this context.

Throws:
DSEInvalidRequestException

setValueAt

public int setValueAt(SortedTable aSortedTable)
               throws DSEInvalidRequestException
The function is similiar to setValueAt(String, Object) except that set pairs of keys and values stored in aSortedTable via one method. Behind this method, when this context is a distributed context, the pairs of keys and values stored in aSortedTable will be sent to CHA server a time, thus improving performance.

Parameters:
aSortedTable -
Returns:
int = 0 : success int = 1,2,...,n: a value is failed to set which is indicated by return int value. For example, if return value is 1, the first value in aSortedTable can not be set successfully. if return value is 2, the first value is set successfully, but the second value is failed to be set and subsequent pairs of the keys and values will not be set .
Throws:
DSEInvalidRequestException

toString

public java.lang.String toString()
Returns an XML representation of this context.

Returns:
java.lang.String

toStrings

public Vector toStrings()
Returns a visual representation of this context.

Specified by:
toStrings in interface Externalizable
Returns:
Vector

toTags

public Vector toTags()
              throws java.io.IOException
Returns a Vector with the elements represented as a Tag.

Specified by:
toTags in interface Externalizable
Returns:
Vector
Throws:
java.io.IOException

tryGetElementAt

public DataElement tryGetElementAt(java.lang.String aCompositeKey)
                            throws DSEObjectNotFoundException
Returns the element of its keyedCollection, or keyedCollections of the upper contexts which is located at aCompositeKey path. If the element does not exist or some network errors occur, return null.

Throws:
DSEObjectNotFoundException

tryGetValueAt

public java.lang.Object tryGetValueAt(java.lang.String aCompositeKey)
                               throws DSEObjectNotFoundException
Returns the value of the element of its keyedCollection, or keyedCollections of the upper contexts, located in the aCompositeKey path. Returns null if the element is not found or if it is found but has a null value.

Throws:
DSEObjectNotFoundException

unchain

public void unchain()
             throws DSEInvalidRequestException,
                    DSEObjectNotFoundException
Removes this context and all its children from the context tree. Also maintains the consistency of the context tree.

Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

writeExternal

public void writeExternal()
                   throws java.io.IOException
Writes this instance to a file using tags.

Specified by:
writeExternal in interface Externalizable
Throws:
java.io.IOException

writeExternal

public void writeExternal(java.io.ObjectOutput s)
                   throws java.io.IOException
Provides concrete serialization handling for contexts. This method serializes the current context and all its children.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
s - java.io.ObjectOutput
Throws:
java.io.IOException

writeToStream

public void writeToStream(java.io.ObjectOutput s)
                   throws java.io.IOException
Provides concrete serialization handling for contexts. This method serializes the current context and all its children.

Parameters:
s - java.io.ObjectOutput
Throws:
java.io.IOException

getInstanceID

public java.lang.String getInstanceID()
Returns the instanceID.

Returns:
String

setInstanceID

public void setInstanceID(java.lang.String anInstanceID)
                   throws DSEInvalidArgumentException
Sets the instanceID for a local context which must not predefined in the configuration file such as dsectxt.xml.

Throws:
DSEInvalidArgumentException

getMode

public int getMode()
Returns the mode.

Returns:
int

setKCollDynamic

public void setKCollDynamic(boolean aValue)
                     throws DSEInvalidRequestException
Set the value to the attribute dynamic for the keyedCollection in this context.

Parameters:
aValue -
Throws:
DSEInvalidRequestException

trySetElementAt

public int trySetElementAt(java.lang.String aCompositeKey,
                           java.io.Serializable aValue)
                    throws DSEInvalidRequestException
Set the value of the element of its keyedCollection, or keyedCollections of the upper contexts which is located at aCompositeKey path. If the dataElement can be found in the current context or its upper contexts, set its value and return int 1. Otherwise, return -1 saying this dataElement does not exist.

Throws:
DSEInvalidRequestException

getContextByInstanceID

public static Context getContextByInstanceID(java.lang.String anInstanceID)
                                      throws DSEInvalidRequestException
Returns the distributed context that matches the parameter: instanceID. When instanceID is equal to null, the value null will be returned.

Throws:
DSEInvalidRequestException

setValueAt

public void setValueAt(java.lang.String aCompositeKey,
                       java.lang.Object aDataValue)
                throws DSEInvalidArgumentException,
                       DSEObjectNotFoundException,
                       DSEInvalidRequestException
Sets the value of the element of its keyedCollection, or keyedCollections of the upper contexts, located in the aCompositeKey path. When the KeyedCollection of the Context is dynamic, this method has different behavior depending on value of addToDynamicKColl property. If addToDynamicKColl is false, this method first looks for the aCompositekey element in the hierarchy. If the method finds it, the method modifies its value. If the method does not find the element, the method creates it dynamically. When addToDynamicKColl is true, this method either creates a new element in the current context or overwrites the existing element without checking the existence of the element in upper contexts.

Throws:
DSEInvalidArgumentException
DSEObjectNotFoundException
DSEInvalidRequestException

isReadOnly

public boolean isReadOnly()
                   throws DSEInvalidRequestException
If the definition of this context in dsetxt.xml has the attribute readonly="true", this method will return true, otherwise, false is returned.

Returns:
boolean
Throws:
DSEInvalidRequestException

getLevel

public java.lang.String getLevel()
                          throws DSEInvalidRequestException
We can define an attribute --level-- in dsectxt.xml file to indicate level of the context. The context can be devided into three levels:root, session, normal.

Returns:
"root", "session", "normal". If this attribute is not difined, return null ;
Throws:
DSEInvalidRequestException

getRootLocation

public java.lang.String getRootLocation()
                                 throws DSEInvalidRequestException
Get the CHA server location where the root context will be stored.

Returns:
the CHA server location. It looks like "iiop://hostname:2809"
Throws:
DSEInvalidRequestException

setReadOnly

public void setReadOnly(boolean isReadOnly)

getCHALocation

public java.lang.String getCHALocation(java.lang.String contextName)
                                throws DSEInvalidRequestException
Get the CHA server location where the context specified by the parameter contextName is stored.

Returns:
CHA server location
Throws:
DSEInvalidRequestException

setSerializableLevel

public void setSerializableLevel(int i)
                          throws DSEInvalidRequestException
Set the value of variable serializableLevel. If serializableLevel = 0, serialize the local context and its parent and its children If serializableLevel = 1, serialize the local context and its parent If serializableLevel = -1, serialize the local context and its children

Throws:
DSEInvalidRequestException

setSerializeParentsAndChildren

public void setSerializeParentsAndChildren(boolean b)
Set the value of variable serializeParentsAndChildren When the local context will be serialized, if serializeParentsAndChildren = true, the parents and children of the local context will be serialized. If serializeParentsAndChildren = false, they will not be serialized. The default value of serializeParentsAndChildren is true.


IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005