com.ibm.dse.base
Class DynamicXMLFormat

java.lang.Object
  |
  +--com.ibm.dse.base.FormatElement
        |
        +--com.ibm.dse.base.KeyedCollectionFormat
              |
              +--com.ibm.dse.base.DynamicXMLFormat

public class DynamicXMLFormat
extends KeyedCollectionFormat

The DynamicXMLFormat class formats a KeyedCollection into an XML compliant format. >P>You can specify a DataElement from another parent context. When formatted, the DataElement is included in the formatted string. When unformatted, the DataElement is unformatted to the specified context.

See Also:
Serialized Form

Fields inherited from class com.ibm.dse.base.FormatElement
dataElementName, name
 
Constructor Summary
DynamicXMLFormat()
           
 
Method Summary
protected  java.util.Date createDate(java.lang.String aString)
          Creates a date from aString with dataConverter "dd/MM/yy/hh/mm/ss"
protected  java.lang.Object createNumber(java.lang.String aString, char type)
          Creates a number from aString and type char
 java.lang.String[] extractElement(java.lang.String elementName, java.lang.String aString)
          Extracts the element from aString named elementName.
 java.lang.String formatContext(Context aContext)
          Formats a Context into an XML compliant format.
protected  java.lang.String formatDateXml(java.util.Date aDate)
          Formats a Date with the pattern: "dd/MM/yy/hh/mm/ss".
 java.lang.String formatHashtableXml(java.util.Hashtable aHashtable)
          Formats a KeyedCollection into an XML compliant format.
 java.lang.String formatKeyedCollection(KeyedCollection aKeyedCollection)
          Formats a KeyedCollection into an XML compliant format.
protected  java.lang.String formatNumberXml(java.lang.Number aNumber)
          Formats a Number into the default format of the number .
 java.lang.String formatVectorXml(java.util.Vector aVector)
          Formats a Vector into an XML compliant format.
 Context getContext(java.lang.String aString)
          Extracts the ContextName attribute from a Tag and returns this context if it exists.
 java.lang.String getCreateOnUnformat()
          Obtains createOnUnformat attribute.
protected  java.lang.String getElementName(java.lang.String aString)
          Obtains element name .
 java.lang.String getInsertOnFormat()
          Obtains insertOnFormat
 java.util.Vector getPointers()
          Obtains the DataPointers
protected  java.lang.String getPostDataFieldTag(DataField data)
          Constructs the tag after each dataField .
protected  java.lang.String getPostIndexedCollectionTag(IndexedCollection data)
          Constructs the tag after each IndexedCollection.
protected  java.lang.String getPostKeyedCollectionTag(KeyedCollection data)
          Constructs the tag after each KeyedCollection.
protected  java.lang.String getPreDataFieldTag(DataField data)
          Constructs the tag before each DataField.
protected  java.lang.String getPreIndexedCollectionTag(IndexedCollection data)
          Constructs the tag before each IndexedCollection.
protected  java.lang.String getPreKeyedCollectionTag(KeyedCollection data)
          Constructs the tag before each KeyedCollection.
protected  java.lang.String getType(java.lang.String aString)
          Obtains the type of this field.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes an XMLFormat with the Tag attributes..
 boolean insertKCollOnFormat()
          Returns true if the insertKCollOnFormat is set to yes
protected  boolean isDate(java.lang.String aString)
          Identifies a Date.
protected  boolean isHashtable(java.lang.String aString)
          Identifies a java.util.Hashtable.
 boolean isIndexedCollection(java.lang.String aString)
          Identifies an IndexedCollection.
 boolean isKeyedCollection(java.lang.String aString)
          Identifies a KeyedCollection.
protected  boolean isNull(java.lang.String aString)
          Identifies a null.
 boolean isNumber(java.lang.String aString)
          Identifies a number.
protected  boolean isString(java.lang.String aString)
          Identifies a String.
protected  boolean isVector(java.lang.String aString)
          Identifies a java.util.Vector.
protected  java.lang.String parseDataElementAsXml(java.lang.Object data)
          Selects the method to invoke depending on the argument data class .
protected  java.lang.String parseDataFieldAsXml(DataField data)
          Converts a dataField to an XML format
protected  java.lang.String parseIndexedCollectionAsXml(IndexedCollection data)
          Converts IndexedCollection to an XML format.
protected  java.lang.String parseKeyedCollectionAsXml(KeyedCollection data)
          Converts KeyedCollection to an XML format.
protected  java.lang.String parseOtherDataAsXml(java.lang.Object data)
          Prepares Parser for other data.
protected  java.lang.String parsePointerAsXml(java.lang.Object data, java.lang.String ContextName)
          Selects the method to invoke depending on the argument data class .
 void setCreateOnUnformat(java.lang.String aString)
          Sets the createOnUnformat property value.
 void setInsertOnFormat(java.lang.String aString)
          Sets the insertOnFormat property value.
 void setPointers(java.util.Vector v)
          Sets the pointers property (Vector) value.
 java.lang.String toString()
          Returns a String representating the format.
 Vector toStrings()
          Returns a visual representation of this format.
 DataElement unformatContext(java.lang.String aString, Context aContext)
          Unformats a XML String and stores it in the context aContext.
 KeyedCollection unformatKeyedCollection(java.lang.String aString, KeyedCollection aKeyedCollection)
          Unformats an XML String and stores it in aKeyedCollection.
 
Methods inherited from class com.ibm.dse.base.KeyedCollectionFormat
add, addElementAt, addFirst, at, format, format, getElements, getEnumeration, removeAll, removeAt, setElements, size, unformat, unformat
 
Methods inherited from class com.ibm.dse.base.FormatElement
exceptionInfo, externalizer, extract, format, getDataElementName, getExternalizer, getName, getTagName, isCacheable, isConstant, readExternal, readExternal, readObject, reinitialize, removeExternal, rootDecorated, setDataElementName, setExternalizer, setName, setSize, toTags, unformat, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DynamicXMLFormat

public DynamicXMLFormat()
Method Detail

createDate

protected java.util.Date createDate(java.lang.String aString)
                             throws DSEInvalidRequestException
Creates a date from aString with dataConverter "dd/MM/yy/hh/mm/ss"
Parameters:
aString - java.lang.String
Returns:
java.util.Date

createNumber

protected java.lang.Object createNumber(java.lang.String aString,
                                        char type)
Creates a number from aString and type char
Parameters:
aString - java.lang.String
Returns:
java.util.Date

extractElement

public java.lang.String[] extractElement(java.lang.String elementName,
                                         java.lang.String aString)
Extracts the element from aString named elementName.
Parameters:
elementName - java.lang.String
aString - java.lang.String

formatContext

public java.lang.String formatContext(Context aContext)
                               throws DSEInvalidClassException,
                                      DSEInvalidRequestException,
                                      DSEInvalidArgumentException
Formats a Context into an XML compliant format.
Overrides:
formatContext in class KeyedCollectionFormat
Parameters:
aContext - java.lang.String
Returns:
java.lang.String

formatDateXml

protected java.lang.String formatDateXml(java.util.Date aDate)
Formats a Date with the pattern: "dd/MM/yy/hh/mm/ss".
Parameters:
aDate - java.util.Date
Returns:
java.lang.String

formatHashtableXml

public java.lang.String formatHashtableXml(java.util.Hashtable aHashtable)
                                    throws DSEInvalidArgumentException
Formats a KeyedCollection into an XML compliant format.
Parameters:
aHashtable - java.util.Hashtable
Returns:
java.lang.String

formatKeyedCollection

public java.lang.String formatKeyedCollection(KeyedCollection aKeyedCollection)
                                       throws DSEInvalidClassException,
                                              DSEInvalidRequestException,
                                              DSEInvalidArgumentException
Formats a KeyedCollection into an XML compliant format.
Overrides:
formatKeyedCollection in class KeyedCollectionFormat
Parameters:
aKeyedCollection - java.lang.String
Returns:
java.lang.String

formatNumberXml

protected java.lang.String formatNumberXml(java.lang.Number aNumber)
Formats a Number into the default format of the number .
Parameters:
java.lang.Number - aNumber
Returns:
java.lang.String

formatVectorXml

public java.lang.String formatVectorXml(java.util.Vector aVector)
                                 throws DSEInvalidArgumentException
Formats a Vector into an XML compliant format.

getContext

public Context getContext(java.lang.String aString)
Extracts the ContextName attribute from a Tag and returns this context if it exists.
Parameters:
aString - java.lang.String
Returns:
Context

getCreateOnUnformat

public java.lang.String getCreateOnUnformat()
Obtains createOnUnformat attribute.
Returns:
java.lang.String

getElementName

protected java.lang.String getElementName(java.lang.String aString)
Obtains element name .
Parameters:
aString - java.lang.String
Returns:
java.lang.String

getInsertOnFormat

public java.lang.String getInsertOnFormat()
Obtains insertOnFormat
Returns:
java.lang.String

getPointers

public java.util.Vector getPointers()
Obtains the DataPointers
Returns:
java.util.Vector

getPostDataFieldTag

protected java.lang.String getPostDataFieldTag(DataField data)
Constructs the tag after each dataField .
Parameters:
data - com.ibm.dse.base.DataField
Returns:
java.lang.String

getPostIndexedCollectionTag

protected java.lang.String getPostIndexedCollectionTag(IndexedCollection data)
Constructs the tag after each IndexedCollection.
Parameters:
data - com.ibm.dse.base.IndexedCollection
Returns:
java.lang.String

getPostKeyedCollectionTag

protected java.lang.String getPostKeyedCollectionTag(KeyedCollection data)
Constructs the tag after each KeyedCollection.
Parameters:
data - com.ibm.dse.base.KeyedCollection
Returns:
java.lang.String

getPreDataFieldTag

protected java.lang.String getPreDataFieldTag(DataField data)
Constructs the tag before each DataField.
Parameters:
data - com.ibm.dse.base.DataField
Returns:
java.lang.String

getPreIndexedCollectionTag

protected java.lang.String getPreIndexedCollectionTag(IndexedCollection data)
Constructs the tag before each IndexedCollection.
Parameters:
data - com.ibm.dse.base.IndexedCollection
Returns:
java.lang.String

getPreKeyedCollectionTag

protected java.lang.String getPreKeyedCollectionTag(KeyedCollection data)
Constructs the tag before each KeyedCollection.
Parameters:
data - com.ibm.dse.base.KeyedCollection
Returns:
java.lang.String

getType

protected java.lang.String getType(java.lang.String aString)
Obtains the type of this field.
Parameters:
data - com.ibm.dse.base.DataField
Returns:
java.lang.String

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException
Initializes an XMLFormat with the Tag attributes..
Overrides:
initializeFrom in class FormatElement
Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object
Throws:
java.io.IOException. -  

insertKCollOnFormat

public boolean insertKCollOnFormat()
Returns true if the insertKCollOnFormat is set to yes
Returns:
boolean

isDate

protected boolean isDate(java.lang.String aString)
Identifies a Date.
Parameters:
aString - java.lang.String
Returns:
boolean

isHashtable

protected boolean isHashtable(java.lang.String aString)
Identifies a java.util.Hashtable.
Parameters:
aString - java.lang.String
Returns:
boolean

isIndexedCollection

public boolean isIndexedCollection(java.lang.String aString)
Identifies an IndexedCollection.
Parameters:
aString - java.lang.String
Returns:
boolean

isKeyedCollection

public boolean isKeyedCollection(java.lang.String aString)
Identifies a KeyedCollection.
Parameters:
aString - java.lang.String
Returns:
boolean

isNull

protected boolean isNull(java.lang.String aString)
Identifies a null.
Parameters:
aString - java.lang.String
Returns:
boolean

isNumber

public boolean isNumber(java.lang.String aString)
Identifies a number.
Parameters:
aString - java.lang.String
Returns:
boolean

isString

protected boolean isString(java.lang.String aString)
Identifies a String.
Parameters:
aString - java.lang.String
Returns:
boolean

isVector

protected boolean isVector(java.lang.String aString)
Identifies a java.util.Vector.
Parameters:
aString - java.lang.String
Returns:
boolean

parseDataElementAsXml

protected java.lang.String parseDataElementAsXml(java.lang.Object data)
                                          throws DSEInvalidArgumentException

Selects the method to invoke depending on the argument data class .

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

parseDataFieldAsXml

protected java.lang.String parseDataFieldAsXml(DataField data)
                                        throws DSEInvalidArgumentException
Converts a dataField to an XML format
Parameters:
data - com.ibm.dse.base.DataField
Returns:
java.lang.String

parseIndexedCollectionAsXml

protected java.lang.String parseIndexedCollectionAsXml(IndexedCollection data)
                                                throws DSEInvalidArgumentException
Converts IndexedCollection to an XML format.
Parameters:
data - com.ibm.dse.base.IndexedCollection
Returns:
java.lang.String

parseKeyedCollectionAsXml

protected java.lang.String parseKeyedCollectionAsXml(KeyedCollection data)
                                              throws DSEInvalidArgumentException
Converts KeyedCollection to an XML format.
Parameters:
data - com.ibm.dse.base.KeyedCollection
Returns:
java.lang.String

parseOtherDataAsXml

protected java.lang.String parseOtherDataAsXml(java.lang.Object data)
                                        throws DSEInvalidArgumentException
Prepares Parser for other data.
Parameters:
data - java.lang.Object
Returns:
java.lang.String
Throws:
com.ibm.dse.base.DSEInvalidArgumentException. -  

parsePointerAsXml

protected java.lang.String parsePointerAsXml(java.lang.Object data,
                                             java.lang.String ContextName)
                                      throws DSEInvalidArgumentException
Selects the method to invoke depending on the argument data class .
Parameters:
data - java.lang.Object
Returns:
java.lang.String

setCreateOnUnformat

public void setCreateOnUnformat(java.lang.String aString)
Sets the createOnUnformat property value.
Parameters:
aString -  
See Also:
getCreateOnUnformat()

setInsertOnFormat

public void setInsertOnFormat(java.lang.String aString)
Sets the insertOnFormat property value.
Parameters:
aString -  
See Also:
getInsertOnFormat()

setPointers

public void setPointers(java.util.Vector v)
Sets the pointers property (Vector) value.
Parameters:
vector - The new value for the property.
See Also:
getPointers()

toString

public java.lang.String toString()
Returns a String representating the format.
Overrides:
toString in class FormatElement
Returns:
java.lang.String

toStrings

public Vector toStrings()
Returns a visual representation of this format.
Overrides:
toStrings in class FormatElement
Returns:
com.ibm.dse.base.Vector

unformatContext

public DataElement unformatContext(java.lang.String aString,
                                   Context aContext)
                            throws DSEInvalidRequestException,
                                   DSEInvalidArgumentException
Unformats a XML String and stores it in the context aContext.
Overrides:
unformatContext in class KeyedCollectionFormat
Tags copied from class: KeyedCollectionFormat
Parameters:
aString - java.lang.String
aContext - com.ibm.dse.base.Context
Returns:
com.ibm.dse.base.DataElement

unformatKeyedCollection

public KeyedCollection unformatKeyedCollection(java.lang.String aString,
                                               KeyedCollection aKeyedCollection)
                                        throws DSEInvalidRequestException,
                                               DSEInvalidArgumentException
Unformats an XML String and stores it in aKeyedCollection.
Overrides:
unformatKeyedCollection in class KeyedCollectionFormat
Tags copied from class: KeyedCollectionFormat
Parameters:
aString - String
aKeyedCollection - KeyedCollection.
Returns:
KeyedCollection