IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.base
Class ContextExternalizer

java.lang.Object
  extended by com.ibm.btt.base.Externalizer
      extended by com.ibm.btt.base.ContextExternalizer
All Implemented Interfaces:
Cache

public class ContextExternalizer
extends Externalizer

The ContextExternalizer class reads contexts. The XML file must be specified in btt.xml in the path settings.files.context. The tags must be in settings.tags.contexts.


Field Summary
 
Fields inherited from class com.ibm.btt.base.Externalizer
numberOfObjects, tagClassTable, tagInputStream, TYPE_CONTEXT, TYPE_DATA, TYPE_FORMAT, TYPE_OPERATION, TYPE_PROCESSOR, TYPE_SERVICE, TYPE_SETTINGS, TYPE_TYPE, TYPE_UNKNOWN, TYPE_VIEW
 
Constructor Summary
ContextExternalizer()
          This constructor creates a ContextExternalizer object.
ContextExternalizer(java.lang.String option, java.io.BufferedInputStream aIniStream)
          This constructor creates a new instance of the ContextExternalizer class.
ContextExternalizer(java.lang.String option, java.lang.String pathAndFile)
          This constructor creates a new instance of the ContextExternalizer class.
 
Method Summary
 java.lang.Object convertTagToObject(Tag aTag)
          Converts a tag to an object and initializes the object's attributes.
protected  Externalizer createNewExternalizer()
          Returns a new externalizer for the generic context file.
 void end()
          Releases resources from this externalizer
static void linkContext(Tag parentTag)
          Deprecated. Replaced by linkContext(Tag, TagInputStream).
static void linkContext(Tag parentTag, TagInputStream aTagInputStream)
          This method will add to parentTag (context tag), a subtag that is the parent context.
static void linkReferences(Tag parentTag)
          This method alters the tag structure of the tagInputStream for DSECTXT by linking all references to their real tags.
protected static void linkReferences(Tag parentTag, TagInputStream aTagInputStream)
          This method alters the tag structure of the tagInputStream for DSECTXT by linking all references to their real tags.
static void linkRefKColl(Tag parentTag)
          This method will add the real corresponding tag as a subtag to parentTag (refKColl tag).
static void linkRefService(Tag parentTag)
          This method will add the real corresponding tag as a subtag to parentTag (refService tag).
 void reset()
          Sets a new context externalizer to Context.
 void reset(java.util.Enumeration listTagId)
          Resets the definition of tags in which tag id appears in listTagId.
 void reset(java.lang.String tagId)
          Resets the definition of the tag with id tagId.
protected  void reset(java.lang.String tagId, TagInputStream aTagInputStream)
          Resets the definition of the context entity with id equals to tagId.
 
Methods inherited from class com.ibm.btt.base.Externalizer
addEntryInTagClassTable, clearCacheTable, getCachePolicyToApply, getCacheTable, getClasses, getFromCacheTable, getNumberOfObjects, getObjectsMaxNum, getObjectsPerTypeMaxNum, getObjectTypesMaxNum, getTagClassTable, getTagInputStream, getTagOutputStream, isCachingEnabled, isRunTime, putIntoCacheTable, readObject, readObject, readTag, rebuildCacheTable, setCachingEnabled, setNumberOfObjects, setObjectsMaxNum, setObjectsPerTypeMaxNum, setObjectTypesMaxNum, setRunTime, setTagClassTable, setTagInputStream, tagList, tagWithId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextExternalizer

public ContextExternalizer()
This constructor creates a ContextExternalizer object.


ContextExternalizer

public ContextExternalizer(java.lang.String option,
                           java.io.BufferedInputStream aIniStream)
                    throws java.io.IOException
This constructor creates a new instance of the ContextExternalizer class. Option can be Memory or File."Memory" means that all tags are stored in memory. This is recommended with small files."File" means that the file is read everytime you need a tag. This is recommended with large files.

Parameters:
option - java.lang.String
aIniStream - java.io.BufferedInputStream
Throws:
java.io.IOException

ContextExternalizer

public ContextExternalizer(java.lang.String option,
                           java.lang.String pathAndFile)
                    throws java.io.IOException
This constructor creates a new instance of the ContextExternalizer class. Option can be Memory or File. "Memory" means that all tags are stored in memory. This is recommended with small files. "File" means that the file is read everytime you need a tag. This is recommended with large files.

Parameters:
option - java.lang.String
pathAndFile - java.lang.String
Throws:
java.io.IOException
Method Detail

convertTagToObject

public java.lang.Object convertTagToObject(Tag aTag)
                                    throws java.io.IOException
Converts a tag to an object and initializes the object's attributes. Users can specify where to find the Context using the full package name in the Context tag, in the initialization file, or using the "implClass" attribute. To work properly, the class that provides the instance must have a constructor with no arguments.

Overrides:
convertTagToObject in class Externalizer
Parameters:
aTag - Tag
Returns:
Object
Throws:
java.io.IOException

createNewExternalizer

protected Externalizer createNewExternalizer()
                                      throws java.io.IOException,
                                             DSEObjectNotFoundException
Returns a new externalizer for the generic context file.

Returns:
com.ibm.btt.base.Externalizer
Throws:
java.io.IOException
DSEObjectNotFoundException

end

public void end()
Releases resources from this externalizer

Specified by:
end in class Externalizer

linkContext

public static void linkContext(Tag parentTag)
                        throws java.io.IOException,
                               DSEObjectNotFoundException
Deprecated. Replaced by linkContext(Tag, TagInputStream).

This method will add to parentTag (context tag), a subtag that is the parent context.

Throws:
java.io.IOException
DSEObjectNotFoundException

linkContext

public static void linkContext(Tag parentTag,
                               TagInputStream aTagInputStream)
                        throws java.io.IOException,
                               DSEObjectNotFoundException
This method will add to parentTag (context tag), a subtag that is the parent context.

Throws:
java.io.IOException
DSEObjectNotFoundException

linkReferences

public static void linkReferences(Tag parentTag)
                           throws java.io.IOException,
                                  DSEObjectNotFoundException
This method alters the tag structure of the tagInputStream for DSECTXT by linking all references to their real tags. This method will add the real corresponding tag as a subtag to all refKColl, and refService tags. This method will also add, to each context, a subtag that is the parent context. The parentTag and all its subtags will have their names checked for context, refKColl, or refService tag.

Parameters:
parentTag - com.ibm.btt.base.Tag
Throws:
java.io.IOException
DSEObjectNotFoundException

linkReferences

protected static void linkReferences(Tag parentTag,
                                     TagInputStream aTagInputStream)
                              throws java.io.IOException,
                                     DSEObjectNotFoundException
This method alters the tag structure of the tagInputStream for DSECTXT by linking all references to their real tags. This method will add the real corresponding tag as a subtag to all refKColl, and refService tags. This method will also add, to each context, a subtag that is the parent context. The parentTag and all its subtags will have their names checked for context, refKColl, or refService tag. The aTagInputStream is the input stream where references are searched.

Parameters:
parentTag - com.ibm.btt.base.Tag
Throws:
java.io.IOException
DSEObjectNotFoundException

linkRefKColl

public static void linkRefKColl(Tag parentTag)
                         throws java.io.IOException,
                                DSEObjectNotFoundException
This method will add the real corresponding tag as a subtag to parentTag (refKColl tag).

Throws:
java.io.IOException
DSEObjectNotFoundException

linkRefService

public static void linkRefService(Tag parentTag)
                           throws java.io.IOException,
                                  DSEObjectNotFoundException
This method will add the real corresponding tag as a subtag to parentTag (refService tag).

Throws:
java.io.IOException
DSEObjectNotFoundException

reset

public void reset()
           throws java.io.IOException,
                  DSEObjectNotFoundException
Sets a new context externalizer to Context.

Throws:
java.io.IOException
DSEObjectNotFoundException

reset

public void reset(java.lang.String tagId)
           throws java.io.IOException,
                  DSEObjectNotFoundException
Resets the definition of the tag with id tagId. The new definition is read and its references solved from the file associated with this externalizer. If the tag doesn't exist in the file but exists in memory, then memory definition is deleted. If the tag doesn't exist neither in the file nor in memory, then an exception is thrown. If the tag exists in the file but doesn't exist in memory, then the new definition is added to memory. If the tag exists both in the file and in memory, then the memory definition is updated with the file definition.

Parameters:
tagId - java.lang.String The id of the tag to reset.
Throws:
java.io.IOException
DSEObjectNotFoundException

reset

protected void reset(java.lang.String tagId,
                     TagInputStream aTagInputStream)
              throws java.io.IOException
Resets the definition of the context entity with id equals to tagId. The new definition is obtained from the TagInputStream passed by parameter. If the tag doesn't exist in the TagInputStream but exists in memory then memory definition is deleted. If the tag doesn't exist neither in the TagInputStream nor in memory then an exception is thrown. If the tag exists in the TagInputStream but doesn't exist in memory then the new definition is added to memory. If the tag exists both in the TagInputStream and in memory then the memory definition is updated with the TagInputStream definition.

Parameters:
tagId - java.lang.String
aTagInputStream - com.ibm.btt.base.TagInputStream
Throws:
java.io.IOException

reset

public void reset(java.util.Enumeration listTagId)
           throws java.io.IOException,
                  DSEObjectNotFoundException
Resets the definition of tags in which tag id appears in listTagId. The new definition is read and its references solved from the file associated with this externalizer. If the tag doesn't exist in the file but exists in memory, then memory definition is deleted. If the tag doesn't exist neither in the file nor in memory, then an exception is thrown. If the tag exists in the file but doesn't exist in memory, then the new definition is added to memory. If the tag exists both in the file and in memory, then the memory definition is updated with the file definition.

Parameters:
listTagId - java.util.Enumeration
Throws:
java.io.IOException
DSEObjectNotFoundException

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011