IBM Branch Transformation Toolkit Javadoc

com.ibm.dse.gui
Class ViewExternalizer

java.lang.Object
  extended bycom.ibm.dse.base.Externalizer
      extended bycom.ibm.dse.gui.ViewExternalizer
All Implemented Interfaces:
Cache

public class ViewExternalizer
extends Externalizer

This Externalizer reads views. The generic views definition file must be specified in the DSE.INI file (in the settings.files.view path) and the self-defined view files must be specified in the DSE.INI file (in the settings.files.views path). The packages that contain the classes must be specified in the DSE.INI file (in the settings.packages.views).


Field Summary
 
Fields inherited from class com.ibm.dse.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
ViewExternalizer()
          This is the default constructor used to create an ViewExternalizer object.
ViewExternalizer(java.lang.String option, java.io.BufferedInputStream aIniStream)
          This constructor creates a new instance of the ViewExternalizer class, Option can be Memory or File.
ViewExternalizer(java.lang.String option, java.lang.String pathAndFile)
          This constructor creates a new instance of the ViewExternalizer class, Option can be Memory or File.
 
Method Summary
static void addType(Tag aTag)
          This method creates a Type object and initializes it with the information stored in the Tag.
 java.lang.Object convertTagToObject(Tag aTag)
          Converts a tag to an Object.
 void end()
          Releases resources from this Externalizer
static java.util.Date getDateCreationFileByFileName(java.lang.String aViewFileName)
          Returns the date the self-defined view file aViewFileName was created or modified.
static java.util.Date getDateCreationFileByViewName(java.lang.String aViewName)
          Returns the date the file containing the self-defined view aViewName was created or modified.
 TagInputStream getSelfDefinedViewTagInputStream(java.lang.String aViewFileName)
          Returns the TagInputStream to which the specified aViewFileName key is mapped.
 java.util.Hashtable getSelfDefinedViewTagInputStreams()
          Returns the Hashtable containing the self-defined views file names as keys and the corresponding TagInputStreams as values.
 TagOutputStream getSelfDefinedViewTagOutputStream(java.lang.String aViewFileName)
          Returns the tagOutputStream of a self-defined view.
 java.lang.Object[] getSgmlSelfDefinedViewFileName(java.lang.String aViewId)
          Returns the self-defined view file name corresponding to the aViewId parameter.
static java.util.Enumeration getViewFileList()
          Returns the list of the self-defined view file.
static void linkContext(Tag parentTag, TagInputStream theTagInputStream)
          This method will add to parentTag (context tag), a subtag that is the parent context.
static void linkOperationContext(Tag parentTag, TagInputStream theTagInputStream)
          This method will add to parentTag (operation tag), a subtag that is the operation context.
static void linkRefData(Tag parentTag, Tag grandParentTag, TagInputStream theTagInputStream, int parentRefTagIndex)
          This method replaces parentTag ("refData" tag) with its corresponding real tag.
static void linkReferences(Tag grandParentTag, Tag parentTag, int parentRefTagIndex, int recursiveDepth, TagInputStream theTagInputStream)
          This method alters the tag structure of the tagInputStream for view files (either DSEVIEWS, or a self defined file) by linking all references to their real tags.
static void linkRefFmt(Tag parentTag, Tag grandParentTag, TagInputStream theTagInputStream, int parentRefTagIndex)
          This method replaces parentTag ("refFmt" tag) with its corresponding real tag.
static void linkRefFormat(Tag parentTag, TagInputStream theTagInputStream)
          This method will add the real corresponding format tag as a subtag to parentTag ("refFormat" tag).
static void linkRefKColl(Tag parentTag, TagInputStream theTagInputStream)
          This method will add the real corresponding tag as a subtag to parentTag ("refKColl" tag).
static void linkRefOpSteps(Tag parentTag, TagInputStream theTagInputStream)
          This method will add the real corresponding tag as a subtag to parentTag ("refOpSteps" tag).
static void linkRefService(Tag parentTag, TagInputStream theTagInputStream)
          This method will add the real corresponding tag as a subtag to parentTag ("refService" tag).
static void linkView(Tag parentTag, TagInputStream theTagInputStream)
          This method will add to parentTag (view tag), a subtag that is the view context and a subtag that is the default operation.
static void linkViewContext(Tag parentTag, TagInputStream theTagInputStream, java.lang.String tagId)
          This method will add to parentTag (view tag), a subtag that is the view context.
static void linkViewOperation(Tag parentTag, TagInputStream theTagInputStream, java.lang.String tagId)
          This method will add to parentTag (view tag), a subtag that is the view default operation.
 java.lang.Object readObject(java.lang.String aViewId)
          When an application wants to internalize an instance of a view (generic or self-defined), it calls this method.
 Tag readTag(int index, java.lang.String aViewFileName)
          Returns the Tag with a given index to the tagInputStream corresponding to a self-defined view file.
static void resetViewFileNamed(java.lang.String aViewFileName)
          Resets all the self-defined views contained in the file aViewFileName and then removes the TagInputStream corresponding to the self-defined view file aViewFileName from the Hashtable.
static void resetViewNamed(java.lang.String aViewName)
          Resets the self-defined view aViewName.
 void setSelfDefinedViewTagInputStream(java.lang.String aFileViewName)
          Creates and sets a TagInputStream corresponding to the aFileViewName file.
 void setSelfDefinedViewTagInputStream(java.lang.String aFileViewName, java.lang.String aPathFile)
          Creates and sets a TagInputStream corresponding to the aFileViewName file.
 void setSelfDefinedViewTagInputStream(java.lang.String aKey, TagInputStream aTagInputStream)
          Sets aTagInputStream in the hashtable with the key aKey.
 java.util.Vector tagList(java.lang.String aViewFileName)
          Returns the tags in the stream corresponding to the self-defined view file aViewFileName.
 Tag tagWithId(java.lang.String aString, java.lang.String aViewFileName)
          Returns the Tag with the ID in the stream corresponding to the self-defined view file aViewFileName.
 
Methods inherited from class com.ibm.dse.base.Externalizer
addEntryInTagClassTable, clearCacheTable, getCachePolicyToApply, getCacheTable, getClasses, getFromCacheTable, getNumberOfObjects, getObjectsMaxNum, getObjectsPerTypeMaxNum, getObjectTypesMaxNum, getTagClassTable, getTagInputStream, getTagOutputStream, isCachingEnabled, isRunTime, makeTagClassTable, putIntoCacheTable, 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

ViewExternalizer

public ViewExternalizer()
This is the default constructor used to create an ViewExternalizer object.


ViewExternalizer

public ViewExternalizer(java.lang.String option,
                        java.io.BufferedInputStream aIniStream)
                 throws java.io.IOException
This constructor creates a new instance of the ViewExternalizer 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

ViewExternalizer

public ViewExternalizer(java.lang.String option,
                        java.lang.String pathAndFile)
                 throws java.io.IOException
This constructor creates a new instance of the ViewExternalizer 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
Method Detail

addType

public static void addType(Tag aTag)
                    throws java.io.IOException
This method creates a Type object and initializes it with the information stored in the Tag. Then it adds this object to the DSETypeExternalizer's list of types.

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

convertTagToObject

public java.lang.Object convertTagToObject(Tag aTag)
                                    throws java.io.IOException
Converts a tag to an Object. This method is needed to create an instance of the view class using the classname supplied in the implClass tag attribute. Note: to work properly the class providing the instance must have a constructor with no arguements.

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

end

public void end()
Releases resources from this Externalizer

Specified by:
end in class Externalizer

getDateCreationFileByFileName

public static java.util.Date getDateCreationFileByFileName(java.lang.String aViewFileName)
Returns the date the self-defined view file aViewFileName was created or modified.

Parameters:
aViewFileName - java.lang.String the self-defined view file name.
Returns:
java.util.Date.

getDateCreationFileByViewName

public static java.util.Date getDateCreationFileByViewName(java.lang.String aViewName)
Returns the date the file containing the self-defined view aViewName was created or modified.

Parameters:
aViewName - java.lang.String the self-defined view name (id).
Returns:
java.util.Date.

getSelfDefinedViewTagInputStream

public TagInputStream getSelfDefinedViewTagInputStream(java.lang.String aViewFileName)
Returns the TagInputStream to which the specified aViewFileName key is mapped.

Parameters:
aViewFileName - java.lang.String
Returns:
com.ibm.dse.base.TagInputStream

getSelfDefinedViewTagInputStreams

public java.util.Hashtable getSelfDefinedViewTagInputStreams()
Returns the Hashtable containing the self-defined views file names as keys and the corresponding TagInputStreams as values.

Returns:
com.ibm.dse.base.Hashtable

getSelfDefinedViewTagOutputStream

public TagOutputStream getSelfDefinedViewTagOutputStream(java.lang.String aViewFileName)
                                                  throws java.io.IOException
Returns the tagOutputStream of a self-defined view. This is used only in edit-time.

Parameters:
aViewFileName - String
Returns:
TagOutputStream
Throws:
java.io.IOException

getSgmlSelfDefinedViewFileName

public java.lang.Object[] getSgmlSelfDefinedViewFileName(java.lang.String aViewId)
Returns the self-defined view file name corresponding to the aViewId parameter.

Parameters:
aViewId - java.lang.String
Returns:
java.lang.Object[] Object[0] => Boolean indicating whether the self-defined view is defined in the .INI file or not Object[1] => file name of the self-defined view Object[2] => path of the self-defined view file

getViewFileList

public static java.util.Enumeration getViewFileList()
Returns the list of the self-defined view file.

Returns:
java.util.Enumeration

linkContext

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

Throws:
java.io.IOException

linkOperationContext

public static void linkOperationContext(Tag parentTag,
                                        TagInputStream theTagInputStream)
                                 throws java.io.IOException
This method will add to parentTag (operation tag), a subtag that is the operation context.

Throws:
java.io.IOException

linkRefData

public static void linkRefData(Tag parentTag,
                               Tag grandParentTag,
                               TagInputStream theTagInputStream,
                               int parentRefTagIndex)
                        throws java.io.IOException
This method replaces parentTag ("refData" tag) with its corresponding real tag.

Throws:
java.io.IOException

linkReferences

public static void linkReferences(Tag grandParentTag,
                                  Tag parentTag,
                                  int parentRefTagIndex,
                                  int recursiveDepth,
                                  TagInputStream theTagInputStream)
                           throws java.io.IOException,
                                  DSEObjectNotFoundException
This method alters the tag structure of the tagInputStream for view files (either DSEVIEWS, or a self defined file) by linking all references to their real tags. All real tags are looked for first in the self defined view file tag stream, and then in the corresponding file tag stream (either data, formats, services, contexts, or operations). The grandParentTag has the parentTag as one of its subtags. The parentTag is the tag that is currently being checked for references. The parentRefTagIndex is the index of the parentTag in the subtags vector of grandParentTag. The recursiveDepth describes the nesting level of the tag. Any base level tags have recursiveDepth of 1. The theTagInputStream is the input stream which will have its references linked. It can be either the generic view file (DSEVIEWS) or a self-defined view.

Parameters:
grandParentTag - com.ibm.dse.base.Tag
parentTag - com.ibm.dse.base.Tag
parentRefTagIndex - int
recursiveDepth - int
theTagInputStream - com.ibm.dse.base.TagInputStream
Throws:
java.io.IOException
DSEObjectNotFoundException

linkRefFmt

public static void linkRefFmt(Tag parentTag,
                              Tag grandParentTag,
                              TagInputStream theTagInputStream,
                              int parentRefTagIndex)
                       throws java.io.IOException
This method replaces parentTag ("refFmt" tag) with its corresponding real tag.

Throws:
java.io.IOException

linkRefFormat

public static void linkRefFormat(Tag parentTag,
                                 TagInputStream theTagInputStream)
                          throws java.io.IOException
This method will add the real corresponding format tag as a subtag to parentTag ("refFormat" tag).

Throws:
java.io.IOException

linkRefKColl

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

Throws:
java.io.IOException

linkRefOpSteps

public static void linkRefOpSteps(Tag parentTag,
                                  TagInputStream theTagInputStream)
                           throws java.io.IOException
This method will add the real corresponding tag as a subtag to parentTag ("refOpSteps" tag).

Throws:
java.io.IOException

linkRefService

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

Throws:
java.io.IOException

linkView

public static void linkView(Tag parentTag,
                            TagInputStream theTagInputStream)
                     throws java.io.IOException
This method will add to parentTag (view tag), a subtag that is the view context and a subtag that is the default operation.

Throws:
java.io.IOException

linkViewContext

public static void linkViewContext(Tag parentTag,
                                   TagInputStream theTagInputStream,
                                   java.lang.String tagId)
                            throws java.io.IOException
This method will add to parentTag (view tag), a subtag that is the view context.

Throws:
java.io.IOException

linkViewOperation

public static void linkViewOperation(Tag parentTag,
                                     TagInputStream theTagInputStream,
                                     java.lang.String tagId)
                              throws java.io.IOException
This method will add to parentTag (view tag), a subtag that is the view default operation.

Throws:
java.io.IOException

readObject

public java.lang.Object readObject(java.lang.String aViewId)
                            throws java.io.IOException
When an application wants to internalize an instance of a view (generic or self-defined), it calls this method. The parameter is the identification of a tag whose type matches the view class of the element. The instance is initialized with the attributes found in the tag.

If you know the class to be internalized and it implements Externalizable, an alternative way to get the instance is to use:

new MyClass(aString)

Overrides:
readObject in class Externalizer
Parameters:
aViewId - java.lang.String
Returns:
java.lang.Object
Throws:
java.io.IOException.
java.io.IOException

readTag

public Tag readTag(int index,
                   java.lang.String aViewFileName)
            throws java.io.IOException
Returns the Tag with a given index to the tagInputStream corresponding to a self-defined view file.

Parameters:
index - int
aViewFileName - java.lang.String the self-defined view file name where the tag must be searched
Returns:
Tag
Throws:
java.io.IOException

resetViewFileNamed

public static void resetViewFileNamed(java.lang.String aViewFileName)
Resets all the self-defined views contained in the file aViewFileName and then removes the TagInputStream corresponding to the self-defined view file aViewFileName from the Hashtable.


resetViewNamed

public static void resetViewNamed(java.lang.String aViewName)
Resets the self-defined view aViewName. All the views included in the same file as aViewName>/I> are also reset. The method then removes the TagInputStream corresponding to the self-defined view file from the Hashtable.

Parameters:
aViewName - java.lang.String the name of the view to reset

setSelfDefinedViewTagInputStream

public void setSelfDefinedViewTagInputStream(java.lang.String aFileViewName)
                                      throws java.io.IOException
Creates and sets a TagInputStream corresponding to the aFileViewName file. The method then adds the new TagInputStream to the Hashtable containing TagInputStream instances corresponding to the self-defined view files.

Parameters:
aFileViewName - java.lang.String
Throws:
java.io.IOException.
java.io.IOException

setSelfDefinedViewTagInputStream

public void setSelfDefinedViewTagInputStream(java.lang.String aFileViewName,
                                             java.lang.String aPathFile)
                                      throws java.io.IOException
Creates and sets a TagInputStream corresponding to the aFileViewName file. The method then adds the new TagInputStream to the Hashtable containing TagInputStream instances corresponding to the self-defined view files.

Parameters:
aFileViewName - java.lang.String
aPathFile - java.lang.String
Throws:
java.io.IOException.
java.io.IOException

setSelfDefinedViewTagInputStream

public void setSelfDefinedViewTagInputStream(java.lang.String aKey,
                                             TagInputStream aTagInputStream)
                                      throws java.io.IOException
Sets aTagInputStream in the hashtable with the key aKey. This stream can read tags.

Parameters:
aKey - java.lang.String
aTagInputStream - aTagInputStream
Throws:
java.io.IOException.
java.io.IOException

tagList

public java.util.Vector tagList(java.lang.String aViewFileName)
Returns the tags in the stream corresponding to the self-defined view file aViewFileName.

Parameters:
aViewFileName - java.lang.String
Returns:
Vector

tagWithId

public Tag tagWithId(java.lang.String aString,
                     java.lang.String aViewFileName)
              throws java.io.IOException
Returns the Tag with the ID in the stream corresponding to the self-defined view file aViewFileName.

Parameters:
aString - java.lang.String the id of the Tag to search
aViewFileName - java.lang.String the self-defined view file name where the tag must be searched
Returns:
Tag
Throws:
java.io.IOException

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005