IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.base.types
Class DSETypeExternalizer

java.lang.Object
  extended bycom.ibm.btt.base.types.DSETypeExternalizer
All Implemented Interfaces:
TypeConstants, TypeExternalizer

public class DSETypeExternalizer
extends java.lang.Object
implements TypeExternalizer, TypeConstants

This class provides an implementation of the TypeExternalizer interface and is responsible for maintaining a registry of all known Types indexed by name.


Field Summary
 
Fields inherited from interface com.ibm.btt.base.types.TypeConstants
amended, CONV_TYPE_DEFAULT, CONV_TYPE_HOST, CONV_TYPE_OUTPUT, CONV_TYPE_SER, CONV_TYPE_XML, disabled, hidden, isAmended, isDisabled, isHidden, isMandatory, isOmitted, isReadOnly, mandatory, omitted, readOnly, TYPE_DEFAULT, TYPE_REGISTRY_INIT_SIZE
 
Constructor Summary
DSETypeExternalizer()
          This constructor creates a DSETypeExternalizer.
DSETypeExternalizer(java.lang.String option, java.io.BufferedInputStream aIniFile)
          This constructor creates a DSETypeExternalizer given a BufferedInputStream.
DSETypeExternalizer(java.lang.String option, java.lang.String pathAndFile)
          This constructor creates a DSETypeExternalizer given the path and file name of the externalized file.
DSETypeExternalizer(java.net.URL aURL)
          This constructor creates a DSETypeExternalizer from the given URL.
 
Method Summary
 Type addType(Type newType)
          Adds the Type passed as an argument to the registry of Types known to the TypeExternalizer and, if successful, returns the added Type.
 void augment(java.net.URL aURL)
          Augments the TypeExternalizer with the Type definitions contained in the URL passed as an argument.
 AbstractConverter createConverter(Tag convTag)
          Creates a converter object initialized with the information stored in the passed tag.
 java.lang.Object createDataFromType(Tag dataTag)
          Creates a typed data element from the data tag.
protected  Externalizer createNewExternalizer()
          Returns a new externalizer for the generic type file.
 AbstractPropertyDescriptor createPropDescriptor(Tag theTag, java.lang.String enclosingType, boolean creatingType)
          Creates a Property Descriptor object initialized with the information stored in the passed tag.
 void createType(Tag typeTag)
          Creates a DSEType object initialized with the information stored in the passed Tag.
protected  Type createTypeInstance(Tag typeTag)
          Returns a new DSEType instance initialized with the information stored in the typeTag.
 AbstractValidator createValidator(Tag valTag)
          Creates a validator object initialized with the information stored in the valTag.
 void end()
          Releases resources from this Externalizer.
 java.lang.Class findPDescriptorClass(java.lang.String tagName)
          Finds the full class name of a descriptor by using its tag name and returns the class.
static DataExternalizer getHelperExternalizer()
          Returns the instance of the helperExternalizer.
 Type getType(java.lang.String name)
          Returns the Type with the name passed as an argument.
 java.util.Enumeration getTypes()
          Returns an Enumeration of all Types known to the TypeExternalizer.
 void initializeExternalizer()
          creates the Types, the PropertyDescriptors, the Validators, and the Converters.
protected  void modifyTypeDefinition(Type oldType, Tag newTypeTag)
          Modifies an old Type instance with the definitions included in a newTypeTag.
 java.lang.String[] parseConvTypes(java.lang.String tempConvTypes)
          Takes the convTypes string, parses it into substrings, and places them into a String array.
 java.lang.Object readObject(java.lang.String name)
          Returns a business object for the Type with the name passed as an argument.
protected  void removeType(java.lang.String typeId)
          Removes the Type.
 void reset()
          Resets all the tags definitions and their associated type instances by reloading the Types file.
 void reset(java.util.Enumeration listTagId)
          Resets the declaration of the tags whose tag ID appears in listTagId.
 void reset(java.lang.String tagId)
          Resets the declaration of the tag with the tagId.
 void reset(java.lang.String tagId, Externalizer newExternalizer)
          Resets the declaration of the tag with id tagId.
 void resetErrorMsgsDynaInfoDelimiters()
          Resets the shareDataDescriptors flag defined in the dse.ini.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSETypeExternalizer

public DSETypeExternalizer()
This constructor creates a DSETypeExternalizer.


DSETypeExternalizer

public DSETypeExternalizer(java.lang.String option,
                           java.io.BufferedInputStream aIniFile)
                    throws java.io.IOException
This constructor creates a DSETypeExternalizer given a BufferedInputStream.


DSETypeExternalizer

public DSETypeExternalizer(java.lang.String option,
                           java.lang.String pathAndFile)
                    throws java.io.IOException
This constructor creates a DSETypeExternalizer given the path and file name of the externalized file.


DSETypeExternalizer

public DSETypeExternalizer(java.net.URL aURL)
                    throws java.io.IOException
This constructor creates a DSETypeExternalizer from the given URL.

Method Detail

addType

public Type addType(Type newType)
             throws DSETypeException
Adds the Type passed as an argument to the registry of Types known to the TypeExternalizer and, if successful, returns the added Type.

Specified by:
addType in interface TypeExternalizer
Parameters:
newType - Type
Throws:
DSETypeException - - Name of the Type to add is either null or a duplicate

augment

public void augment(java.net.URL aURL)
             throws DSETypeException
Augments the TypeExternalizer with the Type definitions contained in the URL passed as an argument.

Specified by:
augment in interface TypeExternalizer
Parameters:
aURL - URL
Throws:
DSETypeException - - Augmentation was unsuccessful

createConverter

public AbstractConverter createConverter(Tag convTag)
                                  throws DSETypeException
Creates a converter object initialized with the information stored in the passed tag.

Parameters:
convTag - - The tag containning the converter attributes
Returns:
com.ibm.btt.base.types.AbstractConverter - The new converter
Throws:
DSETypeException

createDataFromType

public java.lang.Object createDataFromType(Tag dataTag)
                                    throws DSETypeException,
                                           DSEObjectNotFoundException,
                                           java.io.IOException
Creates a typed data element from the data tag.

Returns:
java.lang.Object - The typed data element
Throws:
DSETypeException
DSEObjectNotFoundException
java.io.IOException

createNewExternalizer

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

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

createPropDescriptor

public AbstractPropertyDescriptor createPropDescriptor(Tag theTag,
                                                       java.lang.String enclosingType,
                                                       boolean creatingType)
                                                throws DSETypeException
Creates a Property Descriptor object initialized with the information stored in the passed tag. The enclosingType is used in the case where the refType of the property descriptor is null and thus assumed to be pointing to the enclosing type.

Parameters:
theTag - - The tag containning the descriptor attriubtes
enclosingType - - The type were the descriptor which is being created belongs
creatingType - - A boolean indicator that is true if we are creating a type
Returns:
com.ibm.btt.base.types.AbstractPropertyDescriptor
Throws:
DSETypeException

createType

public void createType(Tag typeTag)
                throws DSETypeException
Creates a DSEType object initialized with the information stored in the passed Tag.

Parameters:
typeTag - - The Tag containing all the type's information
Throws:
DSETypeException

createTypeInstance

protected Type createTypeInstance(Tag typeTag)
                           throws DSETypeException
Returns a new DSEType instance initialized with the information stored in the typeTag.

Parameters:
typeTag - - The tag containing the type information
Returns:
com.ibm.btt.base.types.DSEType - The new type
Throws:
DSETypeException

createValidator

public AbstractValidator createValidator(Tag valTag)
                                  throws DSETypeException
Creates a validator object initialized with the information stored in the valTag.

Parameters:
valTag - - The tag containing the validator attributes
Returns:
com.ibm.btt.base.types.AbstractValidator - The new validator
Throws:
DSETypeException

end

public void end()
Releases resources from this Externalizer.


findPDescriptorClass

public java.lang.Class findPDescriptorClass(java.lang.String tagName)
                                     throws DSETypeException
Finds the full class name of a descriptor by using its tag name and returns the class. This method first tries to get the class name from the default descriptor of the Type named with the prefix of the tag name passed (without the "Descriptor"). For example, if the tagName is DateDescriptor, the method first tries to get the class name from the default descriptor of the Type named Date. If this type is not defined, the method takes the prefix of tagName and concatenates it with PropertyDescriptor. For example, if the tagName is DateDescriptor, the method extracts the prefix Date and concatenates it with PropertyDescriptor to yield DatePropertyDescriptor. The method uses this information to find the find the class and create and return a class instance.

Parameters:
tagName - - The tag name
Returns:
java.lang.Class - The class representing the descriptor
Throws:
DSETypeException

getHelperExternalizer

public static DataExternalizer getHelperExternalizer()
Returns the instance of the helperExternalizer.

Returns:
DataExternalizer

getType

public Type getType(java.lang.String name)
             throws DSETypeException
Returns the Type with the name passed as an argument.

Specified by:
getType in interface TypeExternalizer
Parameters:
name - String
Returns:
Type
Throws:
DSETypeException - - Type requested is not found

getTypes

public java.util.Enumeration getTypes()
Returns an Enumeration of all Types known to the TypeExternalizer.

Specified by:
getTypes in interface TypeExternalizer
Returns:
Enumeration

initializeExternalizer

public void initializeExternalizer()
                            throws DSETypeException
creates the Types, the PropertyDescriptors, the Validators, and the Converters. This method is called after the helper externalizer has read the Typed Data file into a Tag structure in memory.

Throws:
DSETypeException

modifyTypeDefinition

protected void modifyTypeDefinition(Type oldType,
                                    Tag newTypeTag)
                             throws DSETypeException
Modifies an old Type instance with the definitions included in a newTypeTag.

Parameters:
oldType - com.ibm.btt.base.types.Type
newTypeTag - com.ibm.btt.base.Tag
Throws:
DSETypeException - - If the type can not be modified

parseConvTypes

public java.lang.String[] parseConvTypes(java.lang.String tempConvTypes)
                                  throws DSETypeException
Takes the convTypes string, parses it into substrings, and places them into a String array.

Parameters:
tempConvTypes - - The convTypes string
Returns:
java.lang.String[] - The array of conversion types
Throws:
DSETypeException

readObject

public java.lang.Object readObject(java.lang.String name)
                            throws DSETypeException
Returns a business object for the Type with the name passed as an argument. This method collaborates with the Type to populate this business object with the default data for the requested Type. Compound Types return a KeyedCollection and simple Types return a DataField with a business object as value.

Specified by:
readObject in interface TypeExternalizer
Parameters:
name - String
Returns:
Object
Throws:
DSETypeException - Type requested is not found.

removeType

protected void removeType(java.lang.String typeId)
Removes the Type.

Parameters:
typeId - java.lang.String - The type to be removed

reset

public void reset()
           throws DSETypeException,
                  DSEObjectNotFoundException,
                  java.io.IOException
Resets all the tags definitions and their associated type instances by reloading the Types file.

Throws:
DSETypeException
java.io.IOException
DSEObjectNotFoundException

reset

public void reset(java.lang.String tagId)
           throws java.io.IOException,
                  DSEObjectNotFoundException,
                  DSETypeException
Resets the declaration of the tag with the tagId. This method reads the new declaration from the file associated with this externalizer. If the tag already exists, this method updates it. Otherwise, the method adds the tag. The old type instance associated with this tag is modified according to the new tag. If the type doesn't exist, the new type is created.

Parameters:
tagId - java.lang.String - The id of the tag to reset
Throws:
java.io.IOException
DSEObjectNotFoundException
DSETypeException - - If the Type instance associated to the tagId can not be reset

reset

public void reset(java.lang.String tagId,
                  Externalizer newExternalizer)
           throws java.io.IOException,
                  DSEObjectNotFoundException,
                  DSETypeException
Resets the declaration of the tag with id tagId. This method reads the new declaration from the file associated with the externalizer passed as an argument. If the tag already exists, this method updates it. Otherwise, the method adds the tag. The old type instance associated with this tag is modified according to the new tag. If the type doesn't exist, the new type is created.

Parameters:
tagId - java.lang.String - The id of the tag to reset
Throws:
java.io.IOException
DSEObjectNotFoundException
DSETypeException - - If the Type instance associated to the tagId can not be reset

reset

public void reset(java.util.Enumeration listTagId)
           throws java.io.IOException,
                  DSEObjectNotFoundException,
                  DSETypeException
Resets the declaration of the tags whose tag ID appears in listTagId. If a new tag ID is specified, the corresponding tag is added. If the old type instances associated with those tags exist, this method modifies them with the attributes contained in the new type's tags. If the old type instances do not exist, this method creates them from the new tags.

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

resetErrorMsgsDynaInfoDelimiters

public void resetErrorMsgsDynaInfoDelimiters()
Resets the shareDataDescriptors flag defined in the dse.ini.


IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005