com.ibm.dse.base
Class Externalizer

java.lang.Object
  |
  +--com.ibm.dse.base.Externalizer
Direct Known Subclasses:
ContextExternalizer, DataExternalizer, FormatExternalizer, OperationExternalizer, ProcessorExternalizer, ServiceExternalizer, ViewExternalizer

public abstract class Externalizer
extends java.lang.Object

This class manages the externalization of any Framework objects. Subclasses deal with the particularities of the different elements such as different tags and different references. See also the class TagInputStream.


Field Summary
 Hashtable tagClassTable
           
 TagInputStream tagInputStream
           
static java.lang.String TYPE_CONTEXT
           
static java.lang.String TYPE_DATA
           
static java.lang.String TYPE_FORMAT
           
static java.lang.String TYPE_OPERATION
           
static java.lang.String TYPE_PROCESSOR
           
static java.lang.String TYPE_SERVICE
           
static java.lang.String TYPE_SETTINGS
           
static java.lang.String TYPE_TYPE
           
static java.lang.String TYPE_UNKNOWN
           
static java.lang.String TYPE_VIEW
           
 
Constructor Summary
Externalizer()
          This constructor creates a Externalizer object.
Externalizer(java.lang.String option, java.io.BufferedInputStream aIniFile, java.lang.String kind)
          This constructor initializes an Externalizer object.
Externalizer(java.lang.String option, java.lang.String pathAndFile, java.lang.String kind)
          This constructor creates an Externalizer object.
Externalizer(java.net.URL aURL, java.lang.String kind)
          This constructor creates an Externalizer object that works with SGML code.
 
Method Summary
 java.lang.Object convertTagToObject(Tag aTag)
          Converts a tag to an Object.
abstract  void end()
          Abstract method that must be implemented by subclasses to release resources from the Externalizer.
 java.util.Enumeration getClasses()
          Returns the classes that this externalizer can instantiate.
 Hashtable getTagClassTable()
          Returns a Hashtable with the classes that this Externalizer can instantiate.
 TagInputStream getTagInputStream()
          Returns a special stream that is able to read tags.
 TagOutputStream getTagOutputStream()
          Returns a special stream that is able to output tags.
static boolean isRunTime()
          Returns the value of the isRunTime property.
 void makeTagClassTable()
          This method should be overridden by subclasses to make their own tables of tags and classes.
 java.lang.Object readObject(int index)
          Reads the Object defined by its index in the SGML file owned by the externalizer's stream.
 java.lang.Object readObject(java.lang.String aString)
          When an application wants to internalize an instance of an Externalizable class, it calls this method.
 Tag readTag(int index)
          Asks to the tagInputStream for the Tag with a given index
static void setRunTime(boolean aBoolean)
          Sets the value of the isRunTime property.
 void setTagClassTable(Hashtable aHashtable)
          Sets the value of tagClassTable.
 void setTagInputStream(TagInputStream aTagInputStream)
          Sets the tagInputStream.
 Vector tagList()
          Returns the tags in the generic operation stream of this externalizer.
 Tag tagWithId(java.lang.String aString)
          Returns a Tag with an ID in the generic operation stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tagInputStream

public TagInputStream tagInputStream

tagClassTable

public Hashtable tagClassTable

TYPE_SETTINGS

public static final java.lang.String TYPE_SETTINGS

TYPE_DATA

public static final java.lang.String TYPE_DATA

TYPE_FORMAT

public static final java.lang.String TYPE_FORMAT

TYPE_SERVICE

public static final java.lang.String TYPE_SERVICE

TYPE_CONTEXT

public static final java.lang.String TYPE_CONTEXT

TYPE_OPERATION

public static final java.lang.String TYPE_OPERATION

TYPE_PROCESSOR

public static final java.lang.String TYPE_PROCESSOR

TYPE_VIEW

public static final java.lang.String TYPE_VIEW

TYPE_TYPE

public static final java.lang.String TYPE_TYPE

TYPE_UNKNOWN

public static final java.lang.String TYPE_UNKNOWN
Constructor Detail

Externalizer

public Externalizer()
This constructor creates a Externalizer object.

Externalizer

public Externalizer(java.lang.String option,
                    java.io.BufferedInputStream aIniFile,
                    java.lang.String kind)
             throws java.io.IOException
This constructor initializes an Externalizer object. The option parameter should be "memory" or "file". Memory indicates that all tags are to be stored in memory. This is the recommended option for small tag files. File indicates that the tag file is read each time a tag is needed. This is the recommended option for large tag files.
Parameters:
option - java.lang.String
aIniFile - java.io.BufferedInputStream

Externalizer

public Externalizer(java.lang.String option,
                    java.lang.String pathAndFile,
                    java.lang.String kind)
             throws java.io.IOException
This constructor creates an Externalizer object. The option parameter should be "memory" or "file". Memory indicates that all tags are to be stored in memory. This is the recommended option for small tag files. File indicates that the tag file is read each time a tag is needed. This is the recommended option for large tag files.
Parameters:
option - java.lang.String
pathAndFile - java.lang.String

Externalizer

public Externalizer(java.net.URL aURL,
                    java.lang.String kind)
             throws java.io.IOException
This constructor creates an Externalizer object that works with SGML code.
Parameters:
aURL - java.net.URL
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.
Parameters:
aTag - Tag

end

public abstract void end()
Abstract method that must be implemented by subclasses to release resources from the Externalizer.

getClasses

public java.util.Enumeration getClasses()
Returns the classes that this externalizer can instantiate.
Returns:
Enumeration

getTagClassTable

public Hashtable getTagClassTable()
Returns a Hashtable with the classes that this Externalizer can instantiate.
Returns:
java.util.Hashtable

getTagInputStream

public TagInputStream getTagInputStream()
Returns a special stream that is able to read tags.
Returns:
TagInputStream

getTagOutputStream

public TagOutputStream getTagOutputStream()
Returns a special stream that is able to output tags. This is used only in edit-time.
Returns:
TagOutputStream

isRunTime

public static boolean isRunTime()
Returns the value of the isRunTime property. This property determines the behavior of the Externalizer. This method is used by the SGML editor.
Returns:
boolean

makeTagClassTable

public void makeTagClassTable()
This method should be overridden by subclasses to make their own tables of tags and classes.

readObject

public java.lang.Object readObject(int index)
                            throws java.io.IOException
Reads the Object defined by its index in the SGML file owned by the externalizer's stream. The returned Object is an instance of any of the classes in the TagClassTable and always implements Externalizable.
Parameters:
int - index
Returns:
java.lang.Object

readObject

public java.lang.Object readObject(java.lang.String aString)
                            throws java.io.IOException
When an application wants to internalize an instance of an Externalizable class, it calls this method. The parameter is the identification of a tag whose type matches the class of the element. The instance is initialized with the attributes found in the tag. This method returns a null if the parameter is not found in any 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)

Parameters:
aString - java.lang.String
Returns:
java.lang.Object

readTag

public Tag readTag(int index)
            throws java.io.IOException
Asks to the tagInputStream for the Tag with a given index
Parameters:
index - int
Returns:
Tag

setRunTime

public static void setRunTime(boolean aBoolean)
Sets the value of the isRunTime property. This property determines the behavior of the Externalizer. This method is used by the SGML editor.
Parameters:
aBoolean - boolean

setTagClassTable

public void setTagClassTable(Hashtable aHashtable)
Sets the value of tagClassTable. This table contains all of the classes that this Externalizer is able to instantiate.
Parameters:
aHashtable - java.util.Hashtable

setTagInputStream

public void setTagInputStream(TagInputStream aTagInputStream)
Sets the tagInputStream. This stream is used to read tags.
Parameters:
aTagInputStream - TagInputStream

tagList

public Vector tagList()
Returns the tags in the generic operation stream of this externalizer.
Returns:
Vector

tagWithId

public Tag tagWithId(java.lang.String aString)
              throws java.io.IOException
Returns a Tag with an ID in the generic operation stream.
Parameters:
aString - java.lang.String
Returns:
Tag
Throws:
java.io.IOException. -