IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.base
Class ContextImpl

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

public abstract class ContextImpl
extends java.lang.Object
implements Context

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  boolean addToDynamicKColl
          The value of addToDynamicKColl tag attribute *
protected  int bufferSize
           
protected  Vector childInstanceIDs
          The instanceIDs of the children of the current context instance
protected  Vector children
           
protected  Context currentChild
           
static int DEFAULT_BUFFER_SIZE
           
static byte DEFAULT_COMPRESSION
           
protected  boolean dirty
           
protected static Externalizer externalizer
           
protected  java.lang.String instanceID
          The instanceID of the context instance
protected  KeyedCollection keyedCollection
           
protected  java.lang.String level
          We devide the remote contexts into three levels: root, normal
protected  java.lang.Boolean localCall
          If the current context can use EJB local interface, it can always use it
protected  int mode
          The mode of the context instance
protected  java.lang.String name
           
protected  Context parent
           
protected  java.lang.String parentInstanceID
          The instanceID of the parent of the current context instance
protected  java.lang.String parentName
           
protected  boolean readOnly
          if readOnly = "true", it indicates that this context can be catched in client side.
protected static Context rootContext
           
protected  int serializableLevel
          When a local context is transfered from one JVM to another JVM, not only the current context but also its local parent chain and its local children chain will be transfered if serializeParentsAndChildren = true.
protected  boolean serializeParentsAndChildren
          When the local context will be serialized, if serializeParentsAndChildren = true, the parents and children of the local context will be serialized.
protected  java.lang.String type
           
 
Constructor Summary
ContextImpl()
           
 
Method Summary
protected static void checkObject(java.lang.Object obj, java.lang.String infoDescription)
          Check if the object parameter is null or not.
protected static void checkString(java.lang.String targetString, java.lang.String infoDescription)
          Check if the string parameter is valid or not.
 byte[] convertToByte()
          Convert this context as an array of bytes.
static Context convertToContext(byte[] serializedObj)
          Takes the byte array retrieved from the database and returns an object.
 Externalizer externalizer()
          Returns the externalizer instance of this class.
static Externalizer getExternalizer()
          Gets the externalizer.
 java.lang.String getInstanceID()
          Returns the instanceID.
 int getMode()
          Returns the mode.
 java.lang.String getTagName()
          Returns a String used by the externalizer.
protected  int read(byte[] baf, int off, int len, java.io.InputStream in, java.util.zip.Inflater inf, byte[] buf)
           
static void reset()
          Deletes all context instances.
static void setExternalizer(Externalizer anExternalizer)
          Sets the externalizer.
 void setMode(int mode)
          Deprecated.
 void setSerializableLevel(int i)
          Set the value of variable serializableLevel.
 void setSerializeParentsAndChildren(boolean b)
          Set the value of variable serializeParentsAndChildren When the local context will be serialized, if serializeParentsAndChildren = true, the parents and children of the local context will be serialized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.btt.base.Context
addChild, addElement, addNotifier, addService, chainTo, clearKeyedCollection, clearKeyedCollection, commit, containsChild, fields, getAncestorByName, getChildInstanceIDs, getChildren, getChildrenAtAnyLevel, getContextByType, getElementAt, getKeyedCollection, getLevel, getName, getNextContextHorizontal, getNextContextVertical, getNotifier, getNotifierByType, getParent, getParentInstanceID, getParentName, getService, getServices, getType, getValueAt, hasChildren, initializeFrom, isAddToDynamicKColl, isChained, isDirty, isReadOnly, isRoot, prune, readExternal, readExternal, readExternal, readFromStream, removeAt, removeAtAnyLevel, removeChild, removeChild, removeExternal, removeInstance, removeNotifier, setAddToDynamicKColl, setChildren, setDirty, setInstanceID, setKCollDynamic, setKeyedCollection, setName, setParentInstanceID, setReadOnly, setRemote, setType, setValueAt, setValueAt, stopNotifiers, stopNotifiersInChildren, stopServices, stopServicesInChildren, toString, toStrings, toTags, tryGetElementAt, tryGetNotifier, tryGetNotifierByType, tryGetService, tryGetValueAt, trySetElementAt, unchain, writeExternal, writeExternal, writeToStream
 

Field Detail

mode

protected int mode
The mode of the context instance


instanceID

protected java.lang.String instanceID
The instanceID of the context instance


parentInstanceID

protected java.lang.String parentInstanceID
The instanceID of the parent of the current context instance


childInstanceIDs

protected Vector childInstanceIDs
The instanceIDs of the children of the current context instance


externalizer

protected static Externalizer externalizer

children

protected Vector children

currentChild

protected Context currentChild

keyedCollection

protected KeyedCollection keyedCollection

name

protected java.lang.String name

parent

protected Context parent

type

protected java.lang.String type

addToDynamicKColl

protected boolean addToDynamicKColl
The value of addToDynamicKColl tag attribute *


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

readOnly

protected boolean readOnly
if readOnly = "true", it indicates that this context can be catched in client side. Otherwise, not.*


level

protected java.lang.String level
We devide the remote contexts into three levels: root, normal.*


rootContext

protected static Context rootContext

dirty

protected boolean dirty

localCall

protected java.lang.Boolean localCall
If the current context can use EJB local interface, it can always use it.*


serializeParentsAndChildren

protected boolean serializeParentsAndChildren
When the local context will be serialized, if serializeParentsAndChildren = true, the parents and children of the local context will be serialized. Otherwise, they will not be serialized. The default value of serializeParentsAndChildren is true.


serializableLevel

protected int serializableLevel
When a local context is transfered from one JVM to another JVM, not only the current context but also its local parent chain and its local children chain will be transfered if serializeParentsAndChildren = true. The ServializableLevel of the local context is 0. The ServializableLevels of its local parent and its local parent's parent are 1. The ServializableLevels of its child and child's child are -1.


bufferSize

protected int bufferSize

parentName

protected java.lang.String parentName
Constructor Detail

ContextImpl

public ContextImpl()
Method Detail

externalizer

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

Specified by:
externalizer in interface Context
Returns:
Externalizer

getExternalizer

public static Externalizer getExternalizer()
Gets the externalizer.

Returns:

getTagName

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

Specified by:
getTagName in interface Context
Returns:
java.lang.String

read

protected int read(byte[] baf,
                   int off,
                   int len,
                   java.io.InputStream in,
                   java.util.zip.Inflater inf,
                   byte[] buf)
            throws java.util.zip.DataFormatException
Returns:
int.
Throws:
java.util.zip.DataFormatException

setExternalizer

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

Parameters:
anExternalizer -

reset

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

Throws:
DSEException

getInstanceID

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

Specified by:
getInstanceID in interface Context
Returns:
String

getMode

public int getMode()
Returns the mode.

Specified by:
getMode in interface Context
Returns:
int

setSerializableLevel

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

Specified by:
setSerializableLevel in interface Context
Parameters:
i -
Throws:
DSEInvalidRequestException

setSerializeParentsAndChildren

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

Specified by:
setSerializeParentsAndChildren in interface Context
Parameters:
b -

setMode

public void setMode(int mode)
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.

Specified by:
setMode in interface Context
Parameters:
mode - The mode to set.

convertToByte

public byte[] convertToByte()
                     throws java.io.IOException
Convert this context as an array of bytes.

Specified by:
convertToByte in interface Context
Returns:
Throws:
java.io.IOException

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

checkString

protected static void checkString(java.lang.String targetString,
                                  java.lang.String infoDescription)
                           throws DSEInvalidRequestException
Check if the string parameter is valid or not. If it is null or empty string, it is invalid and throw exception.

Parameters:
targetString -
infoDescription -
Throws:
DSEInvalidRequestException

checkObject

protected static void checkObject(java.lang.Object obj,
                                  java.lang.String infoDescription)
                           throws DSEInvalidRequestException
Check if the object parameter is null or not. If it is null , it is invalid and throw exception.

Parameters:
targetString -
infoDescription -
Throws:
DSEInvalidRequestException

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2010