IBM Branch Transformation Toolkit Javadoc

com.ibm.dse.base
Class Context

java.lang.Object
  extended bycom.ibm.dse.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
           
static java.lang.String DEFAULTPROCTIMEOUT
          Default processes timeout constant
protected static Externalizer externalizer
           
 
Constructor Summary
Context()
          This constructor creates a Context object.
Context(java.lang.String aName)
          This constructor creates a new instance of the Context class, which is obtained from the external definition files through aName.
Context(java.lang.String aName, java.lang.String aType, Context aParent)
          Creates a context with the provided parameters.
Context(java.lang.String aName, java.lang.String aType, Context aContext, KeyedCollection aKeyedCollection)
          Creates a context with the provided parameters.
Context(java.lang.String aName, java.lang.String aType, KeyedCollection aKeyedCollection)
          Creates a context with the provided parameters.
Context(java.lang.String aName, java.lang.String aType, java.lang.String aContextName)
          Creates a context with the provided parameters.
 
Method Summary
static void addApplicationSession(java.lang.String aSession, java.lang.String aParentSession, Context aContext)
          Adds a new SessionEntry kColl for the application id to the kColl for the session id.
 void addElement(DataElement aDataElement)
          Adds an element to its keyedCollection.
 void addNotifier(Notifier aNotifier, java.lang.String aNotifierName, java.lang.String aNotifierType)
          Adds a notifier to the notifiers list of this context.
 void addService(Service aService, java.lang.String aServiceName, java.lang.String aServiceType)
          Adds a service to the service list of this context.
static void addSession(SessionEntry se)
          Adds a session entry in the table of sessions in the root context.
static void addSession(java.lang.String aType, java.lang.Long aTimeStamp, java.lang.String aSession, java.lang.String aTID, Context aContext)
          Adds an entry in the table of sessions in the root context.
static void addSession(java.lang.String aType, java.lang.Long aTimeStamp, java.lang.String aSession, java.lang.String aTID, Context aContext, java.util.Locale locale)
          Adds an entry in the table of sessions in the root context.
static void addSession(java.lang.String aType, java.lang.Long aTimeStamp, java.lang.String aSession, java.lang.String aTID, Context aContext, java.lang.String ipAddress, java.lang.Integer port)
          Adds an entry in the table of sessions in the root context.
static void addSession(java.lang.String aSession, java.lang.String aTID, Context aContext)
          Adds an entry in the table of sessions in the root context.
static void addSession(java.lang.String aSession, java.lang.String aTID, Context aContext, java.util.Locale locale)
          Adds an entry in the table of sessions in the root context.
 void chainTo(Context aContext)
          Chains this context to aContext.
 void chainToContextNamed(java.lang.String aContextName)
          Chains this context to the context named aContextName.
 void chainToCurrentContext()
          Chains this context to the current context.
static void checkExpiredSessions()
          Fires an event and marks the session as expired when it finds an expired session.
 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.
static Context currentContext()
          Returns the context set as the currentContext from the root.
 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.
static SessionEntry getApplicationSession(java.lang.String sessionId, java.lang.String applicationId)
          Returns the SessionEntry for the applicationId.
 Vector getChildren()
          Returns the children contexts of this one.
 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 for a context named aContextName and returns the first matching context.
static CSClientService getCSClient()
          Obtains the first instance of the CSClient service.
static CSServerService getCSServer()
          Returns the instance of CSServer.
 Context getCurrentContext()
          Obtains the context marked as currentContext from this one.
static Context getCurrentContextForSession(java.lang.String aSession)
          Returns the current Context for the specified sessionId.
static Context getCurrentContextForSession(java.lang.String aSession, java.lang.String anApplication)
          Returns the current Context for the specified sessionId and applicationId.
static Context getCurrentContextForSessionOrApplication(java.lang.String aSession)
          Returns the current Context for the specified sessionId.
 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.
static java.util.Vector getIpAddressAndPortForTID(java.lang.String tid)
          Returns a vector with two integers: the ipAddress and port that a TID has associated or null if there is no ipAddress and port associated with the passed TID.
 KeyedCollection getKeyedCollection()
          Returns the keyedCollection attribute.
 java.lang.String getName()
          Return the name attribute.
 Context getNextContextNamed(java.lang.String aContextName)
          Returns the first context named aContextName beginning at this context.
 Notifier getNotifier(java.lang.String aNotifierName)
          Returns the first notifier named "aNotifierName" found by searching over this context branch in the upper direction.
 Notifier getNotifierByType(java.lang.String aNotifierType)
          Returns the first notifier that has a type that matches aNotifierType found by searching over this context branch in the upper direction.
protected  Hashtable getNotifiers()
          Returns the notifiers attribute.
 Context getParent()
          Returns the parent attribute.
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.
 Service getServiceByType(java.lang.String aServiceType)
          Returns the first service that has a type that matches aServiceType found by searching over this context branch in the upper direction.
 Hashtable getServices()
          Returns the services attribute.
static SessionEntry getSession(java.lang.String aSession)
          Returns the SessionEntry for the sessionId.
static java.lang.String getSessionForTID(java.lang.String tid)
          Returns the session id that a TID has associated or null if there is no session id associated with the passed TID.
static java.lang.Object getSessionObjectForSession(java.lang.String aSession)
          Returns the Session Object for the specified sessionId.
static SessionTable getSessionTable()
          Returns the sessionTable.
 java.lang.String getTagName()
          Returns a String used by the externalizer.
static java.lang.String getTIDForSession(java.lang.String aSession)
          Returns the client workstation TID for the sessionId.
static java.lang.Long getTimeStampForSession(java.lang.String aSession)
          Returns the timeStamp of the last operation executed for the sessionId.
 java.lang.String getType()
          Returns the "type" attribute.
static java.lang.String getTypeForSession(java.lang.String aSession)
          Returns the client workstation type for the sessionId.
 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.
 boolean hasNotifiers()
          Returns true if this context has any notifier.
 boolean hasServices()
          Returns true if this context has any service.
 java.lang.Object initializeContextFrom(Tag aContextTag)
          Initializes a DataField with the aTag attributes.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a Context with the Tag attributes.
 java.lang.Object initializeKeyedCollectionFrom(Tag aTag)
          Initializes the context KeyedCollection.
 java.lang.Object initializeKeyedCollectionValueFrom(Tag aTag)
          Initializes a collection of values from aTag.
 java.lang.Object initializeServiceFrom(Tag aTag)
          Initializes services in the context.
 java.lang.Object initializeTypeFrom(Tag aTag)
          Initializes the context's KeyedCollection with a new instance created by the Types Externalizer.
 boolean isAddToDynamicKColl()
          Returns the value of the addToDynamicKColl property.
 boolean isChained()
          Returns true if this context is in the context tree.
static boolean isContext(java.lang.String aContextName)
          Returns true if there is at least one context in the context tree that has a name that matches aContextName.
 boolean isRoot()
          Returns true if this context is the root context.
static int occurrencesNamed(java.lang.String aContextName)
          Returns the number of contexts in the context tree that have names that match aContextName.
 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.
static java.lang.Object readObject(java.lang.String name)
          Instantiates a Context called name from an XML source.
 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 removeExternal()
          Removes the object's tags from the file in which the object is externalized.
 void removeNotifier(java.lang.String aNotifierName)
          Removes a notifier from the context.
 void removeService(java.lang.String aServiceName)
          Remove a service from the context.
static void removeSession(java.lang.String aSession)
          Removes an entry in the session table using the remove method of SessionEntry for safety.
static void removeSession(java.lang.String aSession, java.lang.String anApplication)
          Removes an sub session entry in the session table for a given session id and application id.
static void reset()
          Deletes all context instances.
 void setAddToDynamicKColl(boolean newValue)
          Sets the value of the addToDynamicKColl property.
 void setAsCurrentChild()
          Sets this context as currentChild in the parent Context.
 void setAsCurrentContext()
          Sets this context as currentChild in all its parent Contexts until the root.
 void setChildren(Vector aChildrenCollection)
          Sets the children property.
static void setCurrentContextForSession(java.lang.String aSession, Context aContext)
          Sets the specified Context for the specified sessionId.
static void setCurrentContextForSession(java.lang.String aSession, java.lang.String anApplication, Context aContext)
          Sets the Context for the specified sessionId and applicationId.
static void setExternalizer(Externalizer anExternalizer)
          Sets the externalizer.
 void setKeyedCollection(KeyedCollection aKeyedCollection)
          Sets the attribute keyedCollection.
 void setName(java.lang.String aContextName)
          Sets the name property of this context.
 void setServices(Hashtable aHashtable)
          Sets the service property of this context.
static void setSessionObjectForSession(java.lang.String aSession, java.lang.Object aSessionObject)
          Sets the specified Session Object for the specified sessionId.
static void setTimeStampForApplicationSession(java.lang.String sessionId, java.lang.String applicationId, java.lang.Long timeStamp)
          Sets the timeStamp for the applicationId.
static void setTimeStampForSession(java.lang.String aSession, java.lang.Long aTimeStamp)
          Sets the timeStamp for the sessionId.
 void setType(java.lang.String aContextType)
          Sets the type property of this context.
static void setTypeForSession(java.lang.String aSession, java.lang.String aType)
          Sets the client type for the sessionId.
 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 stopNotifiers()
          Stops all notifiers in the context invoking the terminate notifier's method.
 void stopNotifiersInChildren()
          Stops all notifiers in this context and all its children.
 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.
 void terminateServices()
          Looks for all the services in the context and removes them.
 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.
 Notifier tryGetNotifier(java.lang.String aNotifierName)
          Returns the first notifier named aNotifierName found by searching over this context branch in the upper direction.
 Notifier tryGetNotifierByType(java.lang.String aNotifierType)
          Returns the first notifier that has a type that matches aNotifierType found by searching over this context branch in the upper direction.
 Service tryGetService(java.lang.String aServiceName)
          Returns the first service named aServiceName, by searching over this context branch in the upper direction.
 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.
 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

DEFAULTPROCTIMEOUT

public static final java.lang.String DEFAULTPROCTIMEOUT
Default processes timeout constant

See Also:
Constant Field Values

bufferSize

protected int bufferSize
Constructor Detail

Context

public Context()
This constructor creates a Context object.


Context

public Context(java.lang.String aName)
        throws java.io.IOException
This constructor creates a new instance of the Context class, which is obtained from the external definition files through aName.

Parameters:
aName - java.lang.String

Context

public Context(java.lang.String aName,
               java.lang.String aType,
               Context aParent)
        throws DSEInvalidRequestException
Creates a context with the provided parameters.

Parameters:
aName - java.lang.String
aType - java.lang.String
aParent - com.ibm.dse.base.Context

Context

public Context(java.lang.String aName,
               java.lang.String aType,
               Context aContext,
               KeyedCollection aKeyedCollection)
        throws DSEInvalidRequestException
Creates a context with the provided parameters.

Parameters:
aName - java.lang.String
aType - java.lang.String
aContext - com.ibm.dse.base.Context
aKeyedCollection - com.ibm.dse.base.KeyedCollection

Context

public Context(java.lang.String aName,
               java.lang.String aType,
               KeyedCollection aKeyedCollection)
Creates a context with the provided parameters.

Parameters:
aName - java.lang.String
aType - java.lang.String
aKeyedCollection - com.ibm.dse.base.KeyedCollection

Context

public Context(java.lang.String aName,
               java.lang.String aType,
               java.lang.String aContextName)
        throws DSEInvalidRequestException
Creates a context with the provided parameters.

Parameters:
aName - java.lang.String
aType - java.lang.String
aContextName - java.lang.String
Method Detail

addApplicationSession

public static void addApplicationSession(java.lang.String aSession,
                                         java.lang.String aParentSession,
                                         Context aContext)
                                  throws DSEInvalidRequestException
Adds a new SessionEntry kColl for the application id to the kColl for the session id. This table is used to maintain information about the established connections of the server with the client machines, and to administrate the different branches of the context tree. This API only should be used in the server application.

Parameters:
aSession - java.lang.String
aParentSession - java.lang.String
aContext - com.ibm.dse.base.Context
Throws:
DSEInvalidRequestException

addElement

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

Throws:
DSEInvalidRequestException

addNotifier

public void addNotifier(Notifier aNotifier,
                        java.lang.String aNotifierName,
                        java.lang.String aNotifierType)
                 throws DSEInvalidRequestException
Adds a notifier to the notifiers list of this context. This method verifies that there are no duplicate notifier names and non-null parameters.

Throws:
DSEInvalidRequestException

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

addSession

public static void addSession(SessionEntry se)
                       throws DSEInvalidRequestException
Adds a session entry in the table of sessions in the root context. This method does not verify whether the session entry already exists.

Parameters:
se - com.ibm.dse.base.SessionEntry
Throws:
DSEInvalidRequestException

addSession

public static void addSession(java.lang.String aType,
                              java.lang.Long aTimeStamp,
                              java.lang.String aSession,
                              java.lang.String aTID,
                              Context aContext)
                       throws DSEInvalidRequestException
Adds an entry in the table of sessions in the root context. This table is used to maintain information about the established connections of the server with the client machines, and to administrate the different branches of the context tree. This API only should be used in the server application.

Parameters:
aType - java.lang.String
aTimeStamp - java.lang.Long
aSession - java.lang.String
aTID - java.lang.String
aContext - com.ibm.dse.base.Context
Throws:
DSEInvalidRequestException

addSession

public static void addSession(java.lang.String aType,
                              java.lang.Long aTimeStamp,
                              java.lang.String aSession,
                              java.lang.String aTID,
                              Context aContext,
                              java.util.Locale locale)
                       throws DSEInvalidRequestException
Adds an entry in the table of sessions in the root context. This table is used to maintain information about the established connections of the server with the client machines and to administrate the different branches of the context tree. This API only should be used in the server application.

Parameters:
aType - java.lang.String
aTimeStamp - java.lang.Long
aSession - java.lang.String
aTID - java.lang.String
aContext - com.ibm.dse.base.Context
locale - Locale
Throws:
DSEInvalidRequestException

addSession

public static void addSession(java.lang.String aType,
                              java.lang.Long aTimeStamp,
                              java.lang.String aSession,
                              java.lang.String aTID,
                              Context aContext,
                              java.lang.String ipAddress,
                              java.lang.Integer port)
                       throws DSEInvalidRequestException
Adds an entry in the table of sessions in the root context. This table is used to maintain information about the established connections of the server with the client machines, and to administrate the different branches of the context tree. This API only should be used in the server application.

Parameters:
aType - java.lang.String
aTimeStamp - java.lang.Long
aSession - java.lang.String
aTID - java.lang.String
aContext - com.ibm.dse.base.Context
ipAddress - Integer
port - Integer
Throws:
DSEInvalidRequestException

addSession

public static void addSession(java.lang.String aSession,
                              java.lang.String aTID,
                              Context aContext)
                       throws DSEInvalidRequestException
Adds an entry in the table of sessions in the root context.

Parameters:
aSession - java.lang.String
aTID - java.lang.String
aContext - com.ibm.dse.base.Context
Throws:
DSEInvalidRequestException

addSession

public static void addSession(java.lang.String aSession,
                              java.lang.String aTID,
                              Context aContext,
                              java.util.Locale locale)
                       throws DSEInvalidRequestException
Adds an entry in the table of sessions in the root context.

Parameters:
aSession - java.lang.String
aTID - java.lang.String
aContext - com.ibm.dse.base.Context
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

chainToContextNamed

public void chainToContextNamed(java.lang.String aContextName)
                         throws DSEInvalidRequestException,
                                DSEObjectNotFoundException
Chains this context to the context named aContextName. This method throws an exception if this context does not exist.

Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

chainToCurrentContext

public void chainToCurrentContext()
                           throws DSEInvalidRequestException
Chains this context to the current context.

Throws:
DSEInvalidRequestException

checkExpiredSessions

public static void checkExpiredSessions()
                                 throws DSEInvalidRequestException,
                                        DSEObjectNotFoundException
Fires an event and marks the session as expired when it finds an expired session. This method is called from the ExpiredSessionsChecker thread. It is synchronized with the addSession and removeSession methods.

Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

clearKeyedCollection

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


clearKeyedCollection

public void clearKeyedCollection(boolean keepKCollStatus,
                                 boolean clearOnlyValues)
                          throws java.io.IOException
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

containsChild

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


currentContext

public static Context currentContext()
Returns the context set as the currentContext from the root.


externalizer

public Externalizer externalizer()
Returns the externalizer instance of this class.

Specified by:
externalizer in interface Externalizable
Returns:
com.ibm.dse.base.Externalizer

fields

public Vector fields()
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:
com.ibm.dse.base.Vector

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:
com.ibm.dse.base.Context
Throws:
DSEInvalidRequestException

getChildren

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


getContextByType

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


getContextNamed

public static Context getContextNamed(java.lang.String aContextName)
                               throws DSEInvalidRequestException
Searches the context tree for a context named aContextName and returns the first matching context.

Throws:
DSEInvalidRequestException

getCSClient

public static CSClientService getCSClient()
Obtains the first instance of the CSClient service.

Returns:
com.ibm.dse.clientserver.CSClient

getCSServer

public static CSServerService getCSServer()
Returns the instance of CSServer. It looks only in the root context because the CSServer must be chained to it.

Returns:
com.ibm.dse.clientserver.CSServer

getCurrentContext

public Context getCurrentContext()
Obtains the context marked as currentContext from this one.

Returns:
com.ibm.dse.base.Context

getCurrentContextForSession

public static Context getCurrentContextForSession(java.lang.String aSession)
                                           throws DSEInvalidRequestException,
                                                  DSEObjectNotFoundException
Returns the current Context for the specified sessionId.

Parameters:
aSession - java.lang.String
Returns:
com.ibm.dse.base.Context
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

getCurrentContextForSession

public static Context getCurrentContextForSession(java.lang.String aSession,
                                                  java.lang.String anApplication)
                                           throws DSEInvalidRequestException,
                                                  DSEObjectNotFoundException
Returns the current Context for the specified sessionId and applicationId.

Parameters:
aSession - java.lang.String
anApplication - java.lang.String
Returns:
com.ibm.dse.base.Context
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

getCurrentContextForSessionOrApplication

public static Context getCurrentContextForSessionOrApplication(java.lang.String aSession)
                                                        throws DSEInvalidRequestException,
                                                               DSEObjectNotFoundException
Returns the current Context for the specified sessionId.

Parameters:
aSession - java.lang.String
Returns:
com.ibm.dse.base.Context
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

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.


getKeyedCollection

public KeyedCollection getKeyedCollection()
Returns the keyedCollection attribute.


getName

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

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

getNextContextNamed

public Context getNextContextNamed(java.lang.String aContextName)
                            throws DSEInvalidRequestException
Returns the first context named aContextName beginning at this context. This method can be used for recursive searching of all contexts named aContextName.

Parameters:
aContextName - java.lang.String
Returns:
com.ibm.dse.base.Context
Throws:
DSEInvalidRequestException

getNotifier

public Notifier getNotifier(java.lang.String aNotifierName)
                     throws DSEObjectNotFoundException
Returns the first notifier named "aNotifierName" found by searching over this context branch in the upper direction.

Throws:
DSEObjectNotFoundException

getNotifierByType

public Notifier getNotifierByType(java.lang.String aNotifierType)
                           throws DSEObjectNotFoundException
Returns the first notifier that has a type that matches aNotifierType found by searching over this context branch in the upper direction.

Throws:
DSEObjectNotFoundException

getNotifiers

protected Hashtable getNotifiers()
Returns the notifiers attribute.

Returns:
com.ibm.dse.base.Hashtable.

getParent

public Context getParent()
Returns the parent attribute.


getRoot

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


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

getServiceByType

public Service getServiceByType(java.lang.String aServiceType)
                         throws DSEObjectNotFoundException
Returns the first service that has a type that matches aServiceType found by searching over this context branch in the upper direction.

Throws:
DSEObjectNotFoundException

getServices

public Hashtable getServices()
Returns the services attribute.

Returns:
com.ibm.dse.base.Hashtable.

getSession

public static SessionEntry getSession(java.lang.String aSession)
                               throws DSEInvalidRequestException,
                                      DSEObjectNotFoundException
Returns the SessionEntry for the sessionId.

Returns:
com.ibm.dse.SessionEntry
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

getSessionForTID

public static java.lang.String getSessionForTID(java.lang.String tid)
                                         throws DSEInvalidRequestException,
                                                DSEObjectNotFoundException
Returns the session id that a TID has associated or null if there is no session id associated with the passed TID.

Parameters:
tid - java.lang.String
Returns:
sessionId java.lang.String
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

getSessionObjectForSession

public static java.lang.Object getSessionObjectForSession(java.lang.String aSession)
                                                   throws DSEInvalidRequestException,
                                                          DSEObjectNotFoundException
Returns the Session Object for the specified sessionId.

Parameters:
aSession - java.lang.String
Returns:
Object
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

getSessionTable

public static SessionTable getSessionTable()
                                    throws DSEInvalidRequestException
Returns the sessionTable.

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

getTagName

public java.lang.String getTagName()
Returns a String used by the externalizer.

Returns:
java.lang.String

getTIDForSession

public static java.lang.String getTIDForSession(java.lang.String aSession)
                                         throws DSEInvalidRequestException,
                                                DSEObjectNotFoundException
Returns the client workstation TID for the sessionId.

Parameters:
aSession - java.lang.String
Returns:
java.lang.String
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

getTimeStampForSession

public static java.lang.Long getTimeStampForSession(java.lang.String aSession)
                                             throws DSEInvalidRequestException,
                                                    DSEObjectNotFoundException
Returns the timeStamp of the last operation executed for the sessionId.

Parameters:
aSession - java.lang.String
Returns:
java.lang.Long
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

getType

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

Returns:
com.ibm.dse.base.Hashtable.

getTypeForSession

public static java.lang.String getTypeForSession(java.lang.String aSession)
                                          throws DSEInvalidRequestException,
                                                 DSEObjectNotFoundException
Returns the client workstation type for the sessionId.

Parameters:
aSession - java.lang.String
Returns:
java.lang.String
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

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()
Returns true if this context has any children.


hasNotifiers

public boolean hasNotifiers()
Returns true if this context has any notifier.


hasServices

public boolean hasServices()
Returns true if this context has any service.


initializeContextFrom

public java.lang.Object initializeContextFrom(Tag aContextTag)
                                       throws java.io.IOException
Initializes a DataField with the aTag attributes.

Parameters:
aContextTag - com.ibm.dse.base.Tag
Throws:
java.io.IOException

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException
Initializes a Context with the Tag attributes.

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

initializeKeyedCollectionFrom

public java.lang.Object initializeKeyedCollectionFrom(Tag aTag)
                                               throws java.io.IOException
Initializes the context KeyedCollection.

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

initializeKeyedCollectionValueFrom

public java.lang.Object initializeKeyedCollectionValueFrom(Tag aTag)
                                                    throws java.io.IOException
Initializes a collection of values from aTag.

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

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

initializeTypeFrom

public java.lang.Object initializeTypeFrom(Tag aTag)
                                    throws java.io.IOException
Initializes the context's KeyedCollection with a new instance created by the Types Externalizer.

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

isAddToDynamicKColl

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

Returns:
boolean - The current value of addToDynamicKColl

isChained

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


isContext

public static boolean isContext(java.lang.String aContextName)
                         throws DSEInvalidRequestException
Returns true if there is at least one context in the context tree that has a name that matches aContextName.

Throws:
DSEInvalidRequestException

isRoot

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


occurrencesNamed

public static int occurrencesNamed(java.lang.String aContextName)
                            throws DSEInvalidRequestException
Returns the number of contexts in the context tree that have names that match aContextName.

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

readObject

public static java.lang.Object readObject(java.lang.String name)
                                   throws java.io.IOException
Instantiates a Context called name from an XML source.

Parameters:
name - java.lang.String
Returns:
java.lang.Object
Throws:
java.io.IOException

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.

Throws:
DSEObjectNotFoundException
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

removeNotifier

public void removeNotifier(java.lang.String aNotifierName)
                    throws DSEObjectNotFoundException,
                           DSEException
Removes a notifier from the context.

Throws:
DSEObjectNotFoundException
DSEException

removeService

public void removeService(java.lang.String aServiceName)
                   throws DSEObjectNotFoundException,
                          DSEException
Remove a service from the context.

Throws:
DSEObjectNotFoundException
DSEException

removeSession

public static void removeSession(java.lang.String aSession)
                          throws DSEObjectNotFoundException,
                                 DSEInvalidArgumentException,
                                 DSEInvalidRequestException
Removes an entry in the session table using the remove method of SessionEntry for safety.

Parameters:
aSession - java.lang.String
Throws:
DSEObjectNotFoundException
DSEInvalidArgumentException
DSEInvalidRequestException

removeSession

public static void removeSession(java.lang.String aSession,
                                 java.lang.String anApplication)
                          throws DSEObjectNotFoundException,
                                 DSEInvalidArgumentException,
                                 DSEInvalidRequestException
Removes an sub session entry in the session table for a given session id and application id. This method uses the remove method of SessionEntry for safety.

Parameters:
aSession - java.lang.String
anApplication - java.lang.String
Throws:
DSEObjectNotFoundException
DSEInvalidArgumentException
DSEInvalidRequestException

reset

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

Throws:
DSEException

setAddToDynamicKColl

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

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

setAsCurrentChild

public void setAsCurrentChild()
                       throws DSEInvalidRequestException
Sets this context as currentChild in the parent Context.

Throws:
DSEInvalidRequestException

setAsCurrentContext

public void setAsCurrentContext()
                         throws DSEInvalidRequestException
Sets this context as currentChild in all its parent Contexts until the root.

Throws:
DSEInvalidRequestException

setChildren

public void setChildren(Vector aChildrenCollection)
Sets the children property.


setCurrentContextForSession

public static void setCurrentContextForSession(java.lang.String aSession,
                                               Context aContext)
                                        throws DSEObjectNotFoundException,
                                               DSEInvalidArgumentException,
                                               DSEInvalidRequestException
Sets the specified Context for the specified sessionId.

Parameters:
aSession - java.lang.String
aContext - com.ibm.dse.base.Context
Throws:
DSEObjectNotFoundException
DSEInvalidArgumentException
DSEInvalidRequestException

setCurrentContextForSession

public static void setCurrentContextForSession(java.lang.String aSession,
                                               java.lang.String anApplication,
                                               Context aContext)
                                        throws DSEObjectNotFoundException,
                                               DSEInvalidArgumentException,
                                               DSEInvalidRequestException
Sets the Context for the specified sessionId and applicationId.

Parameters:
aSession - java.lang.String
anApplication - java.lang.String
aContext - com.ibm.dse.base.Context
Throws:
DSEObjectNotFoundException
DSEInvalidArgumentException
DSEInvalidRequestException

setExternalizer

public static void setExternalizer(Externalizer anExternalizer)
Sets the externalizer.


setKeyedCollection

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


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

setServices

public void setServices(Hashtable aHashtable)
Sets the service property of this context.

Parameters:
aHashtable - com.ibm.dse.base.Hashtable

setSessionObjectForSession

public static void setSessionObjectForSession(java.lang.String aSession,
                                              java.lang.Object aSessionObject)
                                       throws DSEObjectNotFoundException,
                                              DSEInvalidArgumentException,
                                              DSEInvalidRequestException
Sets the specified Session Object for the specified sessionId.

Parameters:
aSession - java.lang.String
aSessionObject - Object
Throws:
DSEObjectNotFoundException
DSEInvalidArgumentException
DSEInvalidRequestException

setTimeStampForSession

public static void setTimeStampForSession(java.lang.String aSession,
                                          java.lang.Long aTimeStamp)
                                   throws DSEInvalidArgumentException,
                                          DSEInvalidRequestException,
                                          DSEObjectNotFoundException
Sets the timeStamp for the sessionId.

Parameters:
aSession - java.lang.String
aTimeStamp - java.lang.Long
Throws:
DSEInvalidArgumentException
DSEInvalidRequestException
DSEObjectNotFoundException

setType

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


setTypeForSession

public static void setTypeForSession(java.lang.String aSession,
                                     java.lang.String aType)
                              throws DSEInvalidArgumentException,
                                     DSEInvalidRequestException,
                                     DSEObjectNotFoundException
Sets the client type for the sessionId.

Parameters:
aSession - java.lang.String
Throws:
DSEInvalidArgumentException
DSEInvalidRequestException
DSEObjectNotFoundException

setValueAt

public void setValueAt(java.lang.String aCompositeKey,
                       java.lang.Object aDataValue)
                throws DSEInvalidArgumentException,
                       DSEObjectNotFoundException
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

stopNotifiers

public void stopNotifiers()
Stops all notifiers in the context invoking the terminate notifier's method.


stopNotifiersInChildren

public void stopNotifiersInChildren()
Stops all notifiers in this context and all its children.


stopServices

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


stopServicesInChildren

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


terminateServices

public void terminateServices()
                       throws DSEException
Looks for all the services in the context and removes them.

Throws:
DSEException

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:
com.ibm.dse.base.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:
com.ibm.dse.base.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.


tryGetNotifier

public Notifier tryGetNotifier(java.lang.String aNotifierName)
Returns the first notifier named aNotifierName found by searching over this context branch in the upper direction. Returns null if the element is not found or if it is found but has a null value.


tryGetNotifierByType

public Notifier tryGetNotifierByType(java.lang.String aNotifierType)
Returns the first notifier that has a type that matches aNotifierType found by searching over this context branch in the upper direction. Returns null if the element is not found or if it is found but has a null value.


tryGetService

public Service tryGetService(java.lang.String aServiceName)
Returns the first service named aServiceName, by searching over this context branch in the upper direction. Returns null if the element is not found or if it is found but has a null value.


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.


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

getIpAddressAndPortForTID

public static java.util.Vector getIpAddressAndPortForTID(java.lang.String tid)
                                                  throws DSEInvalidRequestException,
                                                         DSEObjectNotFoundException
Returns a vector with two integers: the ipAddress and port that a TID has associated or null if there is no ipAddress and port associated with the passed TID. Also null if TID doesn't exist.

Parameters:
tid - java.lang.String
Returns:
sessionId java.lang.String
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

getApplicationSession

public static SessionEntry getApplicationSession(java.lang.String sessionId,
                                                 java.lang.String applicationId)
                                          throws DSEObjectNotFoundException,
                                                 DSEInvalidRequestException
Returns the SessionEntry for the applicationId.

Parameters:
sessionId - - The session identifier
applicationId - - The application identifier
Returns:
SessionEntry - The session entry associated to the applicationId
Throws:
DSEObjectNotFoundException
DSEInvalidRequestException

setTimeStampForApplicationSession

public static void setTimeStampForApplicationSession(java.lang.String sessionId,
                                                     java.lang.String applicationId,
                                                     java.lang.Long timeStamp)
                                              throws DSEObjectNotFoundException,
                                                     DSEInvalidRequestException,
                                                     DSEInvalidArgumentException
Sets the timeStamp for the applicationId.

Parameters:
sessionId - - The session identifier
applicationId - - The application identifier
timeStamp - - The timeStamp
Throws:
DSEObjectNotFoundException
DSEInvalidRequestException
DSEInvalidArgumentException

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005