com.ibm.dse.base
Class DataExternalizer

java.lang.Object
  |
  +--com.ibm.dse.base.Externalizer
        |
        +--com.ibm.dse.base.DataExternalizer

public class DataExternalizer
extends Externalizer

The DataExternalizer class reads data elements. The definition file must be specified in DSE.INI, in the path settings.files.data. The tags must be in settings.tags.data.


Fields inherited from class com.ibm.dse.base.Externalizer
tagClassTable, tagInputStream, TYPE_CONTEXT, TYPE_DATA, TYPE_FORMAT, TYPE_OPERATION, TYPE_PROCESSOR, TYPE_SERVICE, TYPE_SETTINGS, TYPE_TYPE, TYPE_UNKNOWN, TYPE_VIEW
 
Constructor Summary
DataExternalizer()
          This constructor creates a DataExternalizer object.
DataExternalizer(java.lang.String option, java.io.BufferedInputStream aIniStream, java.lang.String kind)
          This constructor creates a new instance of the DataExternalizer class.
DataExternalizer(java.lang.String option, java.lang.String pathAndFile, java.lang.String kind)
          This constructor creates a new instance of the DataExternalizer class.
DataExternalizer(java.net.URL aURL, java.lang.String kind)
          This constructor initializes an externalizer.
 
Method Summary
 java.lang.Object convertTagToObject(Tag aTag)
          Converts a tag to an Object.
protected  Externalizer createNewExternalizer()
          Returns a new externalizer for the generic data file.
 void end()
          Releases resources from this Externalizer.
static void linkRefData(Tag parentTag, Tag grandParentTag, int parentRefTagIndex)
          Deprecated. Replaced by linkRefData(Tag, Tag, int, TagInputStream).
static void linkRefData(Tag parentTag, Tag grandParentTag, int parentRefTagIndex, TagInputStream aTagInputStream)
          This method replaces parentTag ("refData" tag) with its corresponding real tag located at the TagInputStream passed by parameter.
static void linkReferences(Tag grandParentTag, Tag parentTag, int parentRefTagIndex)
          This method alters the tag structure of the tagInputStream for DSEDATA by linking all references to their real tags.
protected static void linkReferences(Tag grandParentTag, Tag parentTag, int parentRefTagIndex, TagInputStream aTagInputStream)
          This method alters the tag structure of the grandParentTag by linking all references to their real tags.
 void makeTagClassTable()
          Makes the tagClassTable with the values in DSE.INI path: settings.tags.data
static Tag overrideTagAttributes(Tag childTag, Vector subTags)
          Overrides a given tag with the attributes specified as param subtags in the given list of subtags
 void reset()
          Sets a new data externalizer to DataElement.
 void reset(java.util.Enumeration listTagId)
          Resets the definition of tags 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 data entity with id equals to tagId.
 
Methods inherited from class com.ibm.dse.base.Externalizer
getClasses, getTagClassTable, getTagInputStream, getTagOutputStream, isRunTime, readObject, readObject, readTag, 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

DataExternalizer

public DataExternalizer()
This constructor creates a DataExternalizer object.

DataExternalizer

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

DataExternalizer

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

DataExternalizer

public DataExternalizer(java.net.URL aURL,
                        java.lang.String kind)
                 throws java.io.IOException
This constructor initializes an externalizer. The URL is where the definition file is.
Method Detail

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 class with the same name as the supplied tag. Note: to work properly the class providing the instance must have a constructor with no arguements.
Overrides:
convertTagToObject in class Externalizer
Parameters:
aTag - Tag

createNewExternalizer

protected Externalizer createNewExternalizer()
                                      throws java.io.IOException,
                                             DSEObjectNotFoundException
Returns a new externalizer for the generic data file.
Returns:
com.ibm.dse.base.Externalizer
Throws:
java.io.IOException -  
DSEObjectNotFoundException -  

end

public void end()
Releases resources from this Externalizer.
Overrides:
end in class Externalizer

linkRefData

public static void linkRefData(Tag parentTag,
                               Tag grandParentTag,
                               int parentRefTagIndex)
                        throws java.io.IOException,
                               DSEObjectNotFoundException
Deprecated. Replaced by linkRefData(Tag, Tag, int, TagInputStream).

This method replaces parentTag ("refData" tag) with its corresponding real tag.

linkRefData

public static void linkRefData(Tag parentTag,
                               Tag grandParentTag,
                               int parentRefTagIndex,
                               TagInputStream aTagInputStream)
                        throws java.io.IOException,
                               DSEObjectNotFoundException
This method replaces parentTag ("refData" tag) with its corresponding real tag located at the TagInputStream passed by parameter.

linkReferences

public static void linkReferences(Tag grandParentTag,
                                  Tag parentTag,
                                  int parentRefTagIndex)
                           throws java.io.IOException,
                                  DSEObjectNotFoundException
This method alters the tag structure of the tagInputStream for DSEDATA by linking all references to their real tags. This method replaces all refData tags from DSEDATA with their corresponding real tags. 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.
Parameters:
grandParentTag - com.ibm.dse.base.Tag
parentTag - com.ibm.dse.base.Tag
parentRefTagIndex - int
Throws:
java.io.IOException -  
DSEObjectNotFoundException -  

linkReferences

protected static void linkReferences(Tag grandParentTag,
                                     Tag parentTag,
                                     int parentRefTagIndex,
                                     TagInputStream aTagInputStream)
                              throws java.io.IOException,
                                     DSEObjectNotFoundException
This method alters the tag structure of the grandParentTag by linking all references to their real tags. This method replaces all refData tags with their corresponding real tags located at the TagInputStream passed by parameter. 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 aTagInputStream is the input stream where references are searched.
Parameters:
grandParentTag - com.ibm.dse.base.Tag
parentTag - com.ibm.dse.base.Tag
parentRefTagIndex - int
aTagInputStream - com.ibm.dse.base.TagInputStream
Throws:
java.io.IOException -  
DSEObjectNotFoundException -  

makeTagClassTable

public void makeTagClassTable()
Makes the tagClassTable with the values in DSE.INI path: settings.tags.data
Overrides:
makeTagClassTable in class Externalizer

overrideTagAttributes

public static Tag overrideTagAttributes(Tag childTag,
                                        Vector subTags)
Overrides a given tag with the attributes specified as param subtags in the given list of subtags
Parameters:
childTag - com.ibm.dse.base.Tag
subTags - com.ibm.dse.base.Vector
Returns:
com.ibm.dse.base.Tag

reset

public void reset()
           throws java.io.IOException,
                  DSEObjectNotFoundException
Sets a new data externalizer to DataElement.
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 data 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.dse.base.TagInputStream
Throws:
java.io.IOException -  

reset

public void reset(java.util.Enumeration listTagId)
           throws java.io.IOException,
                  DSEObjectNotFoundException
Resets the definition of tags which tag id appears in listTagId. The new definition are 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 -