IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.base
Class ContextFactory

java.lang.Object
  extended by com.ibm.btt.base.ContextFactory

public class ContextFactory
extends java.lang.Object

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.


Constructor Summary
ContextFactory()
           
 
Method Summary
static Context convertToContext(byte[] serializedObj)
          Takes the byte array retrieved from the database and returns an object.
static Context createContext()
          This constructor creates a local context object without name.
static Context createContext(java.lang.String contextName)
          This constructor creates a distributed Context object or a local context according to the value of the parameter isDistributed.
static Context createContext(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.
static Context createContext(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.
static Context createContext(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.
static Context createContext(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.
static Context createContext(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.
static Context createContext(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.
static Context currentContext()
          Returns the context set as the currentContext from the root.
static boolean getAutoChainToParentContext()
           
static Context getContextByInstanceID(java.lang.String anInstanceID)
          Returns the distributed context that matches the parameter: instanceID.
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.
static CSClientService getCSClient()
          Obtains the first instance of the CSClient service.
static CSServerService getCSServer()
          Returns the instance of CSServer.
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.
static Context getRoot()
          Returns the root context of the context tree.
static boolean isRemoteMode()
           
static java.lang.Object linkServiceToContext(Context ctx, Tag aTag)
          link the services to the context.
static void reset()
          Deletes all context instances.
static void setAutoChainToParentContext(boolean value)
          set the flag if to chain to parent context automatically when parent attribute is defined in cotext XML definition
static void setExternalizer(Externalizer anExternalizer)
          Sets the externalizer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextFactory

public ContextFactory()
Method Detail

createContext

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

Throws:
ContextCreateException
DSEInvalidRequestException
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.SecurityException

createContext

public static Context createContext(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 context.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
ContextCreateException

createContext

public static Context createContext(java.lang.String contextName)
                             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 context.xml stored in CHA server.

Parameters:
contextName -
Throws:
DSEInvalidRequestException
ContextCreateException

createContext

public static Context createContext(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

createContext

public static Context createContext(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

createContext

public static Context createContext(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

createContext

public static Context createContext(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 context.xml. If isDistributed = false, create a predefined local context. The context specified by parameter contextName must be defined in context.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 context.xml file.

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

createContext

public static Context createContext(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 context.xml. If isDistributed = false, create a predefined local context. The context specified by parameter contextName must be defined in context.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 context.xml file.

Parameters:
contextName -
typeName -
parentContext -
aKeyedCollection -
isDistributed -
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

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

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

getExternalizer

public static Externalizer getExternalizer()
Gets the externalizer.

Returns:

getRoot

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

Returns:
Throws:
DSEInvalidRequestException
DSEInvalidRequestException

reset

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

Throws:
DSEException

setExternalizer

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

Parameters:
anExternalizer -

convertToContext

public static Context convertToContext(byte[] serializedObj)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException
Takes the byte array retrieved from the database and returns an object.

Parameters:
serializedObj - The Object to rebuild
Returns:
Object The Object Reconstructed.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

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

linkServiceToContext

public static java.lang.Object linkServiceToContext(Context ctx,
                                                    Tag aTag)
                                             throws java.io.IOException
link the services to the context.

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

getCSClient

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

Returns:
com.ibm.btt.clientserver.CSClient

currentContext

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


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.btt.clientserver.CSServer

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

isRemoteMode

public static boolean isRemoteMode()

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011