IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.base
Class LocalContextImpl

java.lang.Object
  extended by com.ibm.btt.base.ContextImpl
      extended by com.ibm.btt.base.LocalContextImpl
All Implemented Interfaces:
Context, java.io.Externalizable, java.io.Serializable

public class LocalContextImpl
extends ContextImpl

Local context implementatation

See Also:
Context, Serialized Form

Field Summary
 
Fields inherited from class com.ibm.btt.base.ContextImpl
addToDynamicKColl, bufferSize, childInstanceIDs, children, currentChild, DEFAULT_BUFFER_SIZE, DEFAULT_COMPRESSION, dirty, externalizer, instanceID, keyedCollection, level, localCall, mode, name, parent, parentInstanceID, parentName, readOnly, rootContext, serializableLevel, serializeParentsAndChildren, type
 
Constructor Summary
LocalContextImpl()
          This constructor creates a local context object without name.
LocalContextImpl(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.
LocalContextImpl(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.
LocalContextImpl(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.
LocalContextImpl(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.
LocalContextImpl(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.
LocalContextImpl(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 addService(Service aService, java.lang.String aServiceName, java.lang.String aServiceType)
          Adds a service to the service list of this context.
 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.
 void commit()
          Commit a context and all its children and childrenĄŻ children into db, and remove these contexts from memory.
 boolean containsChild(java.lang.String aContextName)
          Returns true if this context has a child with the name aContextName.
 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.
static boolean getAutoChainToParentContext()
           
 Vector getChildInstanceIDs()
          Deprecated.
 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.
 java.lang.String getClassID()
          get the class instance ID
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
static Vector getContextTable()
          Get a Vector containing all the instanceIDs in the server side hashtable.
 DataElement getElementAt(java.lang.String aCompositeKey)
          Returns the element of its keyedCollection,or keyedCollections of the upper contexts which is located at aCompositeKey path.
 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.
 java.lang.String getName()
          Return the name attribute.
 Context getNextContextHorizontal()
          The method used to iterate over the context tree.
 Context getNextContextVertical(Context parentContext)
          Search the context tree from Vertical direction
 Context getParent()
          Returns the parent attribute.
 java.lang.String getParentInstanceID()
          Deprecated.
 java.lang.String getParentName()
           
static Context getRoot()
          Returns the root context of the context tree.
 Service getService(java.lang.String aServiceName)
          Returns the first service named aServiceName, by searching over this context branch in the upper direction.
 Hashtable getServices()
          get the Services from context
 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.
 java.lang.Object initializeServiceFrom(Tag aTag)
          Initializes services in the context.
 boolean isAddToDynamicKColl()
          Returns the value of the addToDynamicKColl property.
 boolean isChained()
          Returns true if this context is in the context tree.
 boolean isDirty()
          Check if the context is dirty, if it is dirty it can be commited to persistence
 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 from both memory and DB.
 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.
 void removeChild(java.lang.String childInstanceID)
          Remove the child-parent relationship between this context and its child context specified by the parameter childInstanceID
 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.
 void setAddToDynamicKColl(boolean newValue)
          Sets the value of the addToDynamicKColl property.
static void setAutoChainToParentContext(boolean value)
          set the flag if to chain to parent context automatically when parent attribute is defined in cotext XML definition
 void setChildren(Vector aChildrenCollection)
          Sets the children property.
 void setDirty(boolean aDirty)
          Set the dirty value of context.
 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 setParentInstanceID(java.lang.String string)
          Deprecated.
 void setReadOnly(boolean isReadOnly)
          Set the value for readonly attribute for this context.
 java.lang.String setRemote()
          Change the mode of this context to remote
protected static void setRoot(Context aContext)
          Sets the value of rootContext.
 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.
 void stopServices()
          Stops all services in the context invoking the terminate service's method.
 void stopServicesInChildren()
          Stops all services in this context and all of its children.
 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 com.ibm.btt.base.ContextImpl
checkObject, checkString, convertToByte, convertToContext, externalizer, getExternalizer, getInstanceID, getMode, getTagName, read, reset, setExternalizer, setMode, setSerializableLevel, setSerializeParentsAndChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalContextImpl

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


LocalContextImpl

public LocalContextImpl(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.

Parameters:
contextName -
isDistributed -
Throws:
DSEInvalidRequestException

LocalContextImpl

public LocalContextImpl(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 -
aType -
aKeyedCollection -
Throws:
DSEInvalidRequestException

LocalContextImpl

public LocalContextImpl(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.

Parameters:
aName -
aType -
aParent -
aKeyedCollection -
Throws:
DSEInvalidRequestException

LocalContextImpl

public LocalContextImpl(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 -
aType -
aParent -
Throws:
DSEInvalidRequestException

LocalContextImpl

public LocalContextImpl(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 = false, 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

LocalContextImpl

public LocalContextImpl(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 = false, 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
Method Detail

addChild

public void addChild(Context aNewChild)
              throws DSEInvalidRequestException
Adds a child specified by the parameter to the children list of current context. Both the child and parent must be local contexts. Or, both of them must be remote contexts.

Parameters:
aNewChild -
Throws:
DSEInvalidRequestException

addElement

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

Parameters:
aDataElement -
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.

Parameters:
aContext -
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.

Parameters:
aContextName -
Returns:
Throws:
DSEInvalidRequestException

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:
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 -
Returns:
Throws:
DSEInvalidRequestException

getChildrenAtAnyLevel

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

Returns:
Throws:
DSEInvalidRequestException

getChildren

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

Returns:
Throws:
DSEInvalidRequestException

getContextByType

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

Parameters:
aTypeName -
Returns:
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

Parameters:
aContextName -
Returns:
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.

Parameters:
anInstanceID -
Returns:
Throws:
DSEInvalidRequestException

getContextTable

public static Vector getContextTable()
                              throws DSEInvalidRequestException
Get a Vector containing all the instanceIDs in the server side hashtable. In this hashtable, the key is instanceID and the value is the context object.

Returns:
a Vector
Throws:
DSEInvalidRequestException

getNextContextHorizontal

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

Returns:
Throws:
DSEInvalidRequestException

getNextContextVertical

public Context getNextContextVertical(Context parentContext)
                               throws DSEInvalidRequestException
Search the context tree from Vertical direction

Parameters:
parentContext -
Returns:
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.

Parameters:
aCompositeKey -
Returns:
Throws:
DSEObjectNotFoundException

getKeyedCollection

public KeyedCollection getKeyedCollection()
Returns the keyedCollection attribute.

Returns:
Throws:
DSEInvalidRequestException

getName

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


getParent

public Context getParent()
Returns the parent attribute.

Returns:
Throws:
DSEInvalidRequestException

getRoot

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

Returns:
Throws:
DSEInvalidRequestException

getType

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

Returns:
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.

Parameters:
aCompositeKey -
Returns:
Throws:
DSEObjectNotFoundException

hasChildren

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

Returns:
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

Parameters:
aTag - Tag
Returns:
java.lang.Object
Throws:
java.io.IOException - DSEException
DSEException

isAddToDynamicKColl

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

Returns:
Throws:
DSEInvalidRequestException

isChained

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

Returns:
Throws:
DSEInvalidRequestException

isRoot

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

Returns:
Throws:
DSEInvalidRequestException

prune

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

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.

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

Parameters:
aTIS -
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.

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.

Parameters:
aCompositeKey -
Returns:
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.

Parameters:
aCompositeKey -
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 DSEInvalidRequestException
Removes a child of this context from the context tree. 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.

Parameters:
aContext -
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 between this context and its child context specified by the parameter childInstanceID

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.

Throws:
java.io.IOException

setAddToDynamicKColl

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

Parameters:
newValue -
Throws:
DSEInvalidRequestException

setChildren

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

Parameters:
aChildrenCollection -
Throws:
DSEInvalidRequestException

setKeyedCollection

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

Parameters:
aKeyedCollection -
Throws:
DSEInvalidRequestException

setName

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


setRoot

protected static void setRoot(Context aContext)
                       throws DSEInvalidRequestException
Sets the value of rootContext.

Parameters:
aContext -
Throws:
DSEInvalidRequestException

setType

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

Parameters:
aContextType -
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.

Specified by:
toString in interface Context
Overrides:
toString in class java.lang.Object
Returns:
java.lang.String

toStrings

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

Returns:
Vector

toTags

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

Returns:
Vector
Throws:
java.io.IOException

tryGetElementAt

public DataElement tryGetElementAt(java.lang.String aCompositeKey)
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.

Parameters:
aCompositeKey -
Returns:
Throws:
DSEObjectNotFoundException

tryGetValueAt

public 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. Returns null if the element is not found or if it is found but has a null value.

Parameters:
aCompositeKey -
Returns:
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.

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.

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

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.

Parameters:
anInstanceID -
Throws:
DSEInvalidArgumentException

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)
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.

Parameters:
aCompositeKey -
aValue -
Returns:
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.

Parameters:
aCompositeKey -
aDataValue -
Throws:
DSEInvalidArgumentException
DSEObjectNotFoundException
DSEInvalidRequestException

isReadOnly

public 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.

Returns:
Throws:
DSEInvalidRequestException

setReadOnly

public void setReadOnly(boolean isReadOnly)
Set the value for readonly attribute for this context.

Parameters:
isReadOnly -

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 two levels:root, normal.

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

commit

public void commit()
            throws DSEInvalidRequestException
Commit a context and all its children and childrenĄŻ children into db, and remove these contexts from memory.

Parameters:
instanceID -
Throws:
DSEInvalidRequestException

getParentInstanceID

public java.lang.String getParentInstanceID()
                                     throws DSEInvalidRequestException
Deprecated. This method is restricted to used in CHA server side. It would result in incorrect result if it is used ouside CHA server side. The preferred way to get the parent instance ID of a context is to call getParent().getInstanceID().

Returns:
String
Throws:
DSEInvalidRequestException

setParentInstanceID

public void setParentInstanceID(java.lang.String string)
                         throws DSEInvalidRequestException
Deprecated. This method is restricted to used in CHA server side. It would result in incorrect result if it is used ouside CHA server side. The preferred way to set a parent of a context is to call chainTo().

Parameters:
string -
Throws:
DSEInvalidRequestException

getChildInstanceIDs

public Vector getChildInstanceIDs()
                           throws DSEInvalidRequestException
Deprecated. This method is restricted to used in CHA server side. It would result in incorrect result if it is used ouside CHA server side. The preferred way to get children of a context is to call getChildren().

Returns:
Vector
Throws:
DSEInvalidRequestException

getParentName

public java.lang.String getParentName()
                               throws DSEInvalidRequestException
Returns:
Returns the parentName defined in context definition.
Throws:
DSEInvalidRequestException

setDirty

public void setDirty(boolean aDirty)
Set the dirty value of context.

Parameters:
dirty -

isDirty

public boolean isDirty()
Check if the context is dirty, if it is dirty it can be commited to persistence

Parameters:
dirty -

setRemote

public java.lang.String setRemote()
                           throws DSEInvalidRequestException
Change the mode of this context to remote

Throws:
DSEInvalidRequestException

getClassID

public java.lang.String getClassID()
get the class instance ID

Returns:

initializeServiceFrom

public java.lang.Object initializeServiceFrom(Tag aTag)
                                       throws java.io.IOException
Initializes services in the context.

Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object
Throws:
java.io.IOException

addService

public void addService(Service aService,
                       java.lang.String aServiceName,
                       java.lang.String aServiceType)
                throws DSEInvalidRequestException
Adds a service to the service list of this context. This method verifies that there are no duplicate service names and non-null parameters.

Throws:
DSEInvalidRequestException

getServices

public Hashtable getServices()
get the Services from context


getService

public Service getService(java.lang.String aServiceName)
                   throws DSEObjectNotFoundException
Returns the first service named aServiceName, by searching over this context branch in the upper direction.

Throws:
DSEObjectNotFoundException

stopServicesInChildren

public void stopServicesInChildren()
                            throws DSEInvalidRequestException
Stops all services in this context and all of its children.

Throws:
DSEInvalidRequestException

stopServices

public void stopServices()
Stops all services in the context invoking the terminate service's method.


setAutoChainToParentContext

public static void setAutoChainToParentContext(boolean value)
set the flag if to chain to parent context automatically when parent attribute is defined in cotext XML definition

Parameters:
value -

getAutoChainToParentContext

public static boolean getAutoChainToParentContext()
Returns:
the flag if to chain to parent context automatically when parent attribute is defined in cotext XML definition

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009