IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.services.ldap
Class MapFormat

java.lang.Object
  extended by com.ibm.btt.base.FormatElement
      extended by com.ibm.btt.services.ldap.MapFormat
All Implemented Interfaces:
Cacheable, java.io.Externalizable, java.io.Serializable

public class MapFormat
extends FormatElement

This class represents a pseudo format. It specifies a set of data mappings between one context and another. For each mapping defined in the map, an additional format can be specified. Given an externalized mapping definition:

 <map source=contextA target=contextB>
                <mapping source=userName target=UN> <fString>
 </map>
 
Calling format on the map will, for the above 1) Create the format corresponding to the fString tag, and set the name of its data element to be userName 2) Call format(Context) on the format and store the string value returned in the data element named UN in contextB.

See Also:
Serialized Form

Field Summary
protected static java.lang.String endingTagName
           
 
Fields inherited from class com.ibm.btt.base.FormatElement
dataElementName
 
Constructor Summary
MapFormat()
          This constructor creates a Map object.
 
Method Summary
 void addMapping(Mapping mapping)
          Adds supplied mapping to this map.
 void addMapping(java.lang.Object key, Mapping aMapping)
          Adds a mapping to this map.
 java.lang.String convertMapToString(Context sourceContext, Context targetContext)
           
 void deRegisterFormat(Mapping mapping)
          Removes the format defined for the supplied mapping, if it exists.
 void deRegisterFormat(java.lang.Object key)
          Removes the format defined for the supplied key, if it exists.
 java.lang.String format()
          Performs functionally equivalent task as calling format(Context, Context), except that the function will obtain the source and target context from the source and target context attributes of this class.
 java.lang.String format(Context sourceContext)
          Performs functionally equivalent task as calling format(Context, Context), except that the function will obtain the target context from the target context attribute of this class.
 java.lang.String format(Context sourceContext, Context targetContext)
          Causes the transfer of data values from the source context to the target context.
 java.lang.String format(DataElement element)
          The traditional format(DataElement) method.
protected  FormatElement getFormat(java.lang.String name)
          Obtains a format instance depending on the supplied name.
 Mapping getMapping(java.lang.Object key)
          Returns the mapping associated with the given key.
 java.lang.String getName()
          Returns the name of this format element.
 Context getSourceContext()
          Returns the source context attribute of this format element.
 java.lang.String getSourceContextName()
          Returns the source context name attribute of this format element.
 java.lang.String getSourcePrefix()
          Returns the source prefix attribute of this format element.
 Context getTargetContext()
          Returns the target context attribute of this format element.
 java.lang.String getTargetContextName()
          Returns the target context name attribute of this format element.
 java.lang.String getTargetPrefix()
          Returns the target prefix attribute of this format element.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes the state of this format element from externalized data.
 java.util.Enumeration keys()
          Returns the keys of this Map.
 void registerFormat(Mapping mapping, FormatElement format)
          Registers the supplied format to the supplied mapping.
 void registerFormat(java.lang.Object key, FormatElement format)
          Registers the supplied format to the supplied key.
 void removeMapping(Mapping mapping)
          Removes this mapping from the map.
 void removeMapping(java.lang.Object key)
          Removes this mapping from the map.
 void setName(java.lang.String newName)
          Sets the name of this format element.
 void setSourceContext(Context newSourceContext)
          Sets the source context attribute of this format element.
 void setSourceContextName(java.lang.String newSourceContextName)
          Sets the source context name attribute of this format element.
 void setSourcePrefix(java.lang.String newSourcePrefix)
          Sets the source prefix attribute of this format element.
 void setTargetContext(Context newTargetContext)
          Sets the target context attribute of this format element.
 void setTargetContextName(java.lang.String newTargetContextName)
          Sets the target context name attribute of this format element.
 void setTargetPrefix(java.lang.String newTargetPrefix)
          Sets the target prefix attribute of this format element.
 Vector toStrings()
          Returns a vector containing the string representation of the SGML tags used to externalize this object.
 DataElement unformat(java.lang.String str, DataElement element)
          This method is unused.
 
Methods inherited from class com.ibm.btt.base.FormatElement
checkIndexes, exceptionInfo, externalizer, extract, getDataElementName, getExternalizer, getTagName, isCacheable, isConstant, isItConstant, isNull, readExternal, readExternal, readObject, reinitialize, removeExternal, rootDecorated, setDataElementName, setExternalizer, setSize, toString, toTags, unformat, unformat, unformat, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

endingTagName

protected static final java.lang.String endingTagName
See Also:
Constant Field Values
Constructor Detail

MapFormat

public MapFormat()
This constructor creates a Map object.

Method Detail

addMapping

public void addMapping(Mapping mapping)
Adds supplied mapping to this map. This is equivalent to calling addMapping(Object key, Mapping mapping), with the key being the target attribute of the mapping

Parameters:
mapping - com.ibm.btt.services.ldap.Mapping

addMapping

public void addMapping(java.lang.Object key,
                       Mapping aMapping)
Adds a mapping to this map. Map entries are organized by key, with the key being the mapping target value. Caveats: since the underlying store for a Map is a hashtable, the ordering of mapping entries will be lost on storage. This is remedied by storing copies of mapping keys in a separate vector , and returning an enumeration of this when the method keys() is called on a Map object.

Parameters:
key - java.lang.Object
mapping - com.ibm.btt.services.ldap.Mapping

convertMapToString

public java.lang.String convertMapToString(Context sourceContext,
                                           Context targetContext)
                                    throws DSEInvalidRequestException
Throws:
DSEInvalidRequestException

deRegisterFormat

public void deRegisterFormat(Mapping mapping)
Removes the format defined for the supplied mapping, if it exists.

Parameters:
mapping - com.ibm.btt.services.ldap.Mapping

deRegisterFormat

public void deRegisterFormat(java.lang.Object key)
Removes the format defined for the supplied key, if it exists.

Parameters:
key - java.lang.Object

format

public java.lang.String format()
                        throws DSEInvalidRequestException,
                               DSEInvalidClassException,
                               DSEInvalidArgumentException
Performs functionally equivalent task as calling format(Context, Context), except that the function will obtain the source and target context from the source and target context attributes of this class.

Returns:
java.lang.String
Throws:
DSEInvalidRequestException
DSEInvalidClassException
com.ibm.btt.baseDSEInvalidArgumentException
DSEInvalidArgumentException

format

public java.lang.String format(Context sourceContext)
                        throws DSEInvalidRequestException,
                               DSEInvalidClassException,
                               DSEInvalidArgumentException
Performs functionally equivalent task as calling format(Context, Context), except that the function will obtain the target context from the target context attribute of this class.

Overrides:
format in class FormatElement
Parameters:
sourceContext - com.ibm.btt.base.Context
Returns:
java.lang.String
Throws:
DSEInvalidRequestException
DSEInvalidClassException
com.ibm.btt.baseDSEInvalidArgumentException
DSEInvalidArgumentException

format

public java.lang.String format(Context sourceContext,
                               Context targetContext)
                        throws DSEInvalidRequestException,
                               DSEInvalidClassException,
                               DSEInvalidArgumentException
Causes the transfer of data values from the source context to the target context. The value transferred is not garaunteed to be the same as the value in the source context, as formats may be defined for each mapping. If a format is defined for a particular source->target mapping, the format is used to format the source value before it is stored in the target context.

Parameters:
sourceContext - com.ibm.btt.base.Context
targetContext - com.ibm.btt.base.Context
Returns:
java.lang.String
Throws:
DSEInvalidRequestException
DSEInvalidClassException
com.ibm.btt.baseDSEInvalidArgumentException
DSEInvalidArgumentException

format

public java.lang.String format(DataElement element)
                        throws DSEInvalidClassException,
                               DSEInvalidRequestException,
                               DSEInvalidArgumentException
The traditional format(DataElement) method. It is not implemented for this class.

Specified by:
format in class FormatElement
Parameters:
element - com.ibm.btt.base.DataElement
Returns:
java.lang.String
Throws:
DSEInvalidClassException
DSEInvalidRequestException
DSEInvalidArgumentException

getFormat

protected FormatElement getFormat(java.lang.String name)
Obtains a format instance depending on the supplied name. This function utilizes CBTF's global tag table to identify which class to instantiate for the format.

Parameters:
name - java.lang.String
Returns:
com.ibm.btt.base.FormatElement

getMapping

public Mapping getMapping(java.lang.Object key)
Returns the mapping associated with the given key.

Parameters:
key - java.lang.Object
Returns:
java.util.Vector

getName

public java.lang.String getName()
Returns the name of this format element.

Specified by:
getName in interface Cacheable
Overrides:
getName in class FormatElement
Returns:
java.lang.String

getSourceContext

public Context getSourceContext()
Returns the source context attribute of this format element.

Returns:
com.ibm.btt.base.Context

getSourceContextName

public java.lang.String getSourceContextName()
Returns the source context name attribute of this format element.

Returns:
java.lang.String

getSourcePrefix

public java.lang.String getSourcePrefix()
Returns the source prefix attribute of this format element.

Returns:
java.lang.String

getTargetContext

public Context getTargetContext()
Returns the target context attribute of this format element.

Returns:
com.ibm.btt.base.Context

getTargetContextName

public java.lang.String getTargetContextName()
Returns the target context name attribute of this format element.

Returns:
java.lang.String

getTargetPrefix

public java.lang.String getTargetPrefix()
Returns the target prefix attribute of this format element.

Returns:
java.lang.String

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException
Initializes the state of this format element from externalized data.

Specified by:
initializeFrom in class FormatElement
Parameters:
aTag - com.ibm.btt.base.Tag
Returns:
java.lang.Object
Throws:
java.io.IOException
DSEException

keys

public java.util.Enumeration keys()
Returns the keys of this Map. Keys are returned matching the order in which they were added to the Map.

Returns:
java.util.Enumeration

registerFormat

public void registerFormat(Mapping mapping,
                           FormatElement format)
Registers the supplied format to the supplied mapping.

Parameters:
mapping - com.ibm.btt.services.ldap.Mapping
format - com.ibm.btt.base.FormatElement

registerFormat

public void registerFormat(java.lang.Object key,
                           FormatElement format)
Registers the supplied format to the supplied key.

Parameters:
key - java.lang.Object
format - com.ibm.btt.base.FormatElement

removeMapping

public void removeMapping(Mapping mapping)
Removes this mapping from the map. It is equivalent to calling removeMapping(Object key, Mapping mapping), with the key being the

hashcode

attribute of the mapping.

Parameters:
mapping - com.ibm.btt.services.ldap.Mapping

removeMapping

public void removeMapping(java.lang.Object key)
Removes this mapping from the map.

Parameters:
mapping - com.ibm.btt.services.ldap.Mapping

setName

public void setName(java.lang.String newName)
Sets the name of this format element.

Overrides:
setName in class FormatElement
Parameters:
newName - java.lang.String

setSourceContext

public void setSourceContext(Context newSourceContext)
Sets the source context attribute of this format element.

Parameters:
newSourceContext - com.ibm.btt.base.Context

setSourceContextName

public void setSourceContextName(java.lang.String newSourceContextName)
Sets the source context name attribute of this format element.

Parameters:
newSourceContextName - java.lang.String

setSourcePrefix

public void setSourcePrefix(java.lang.String newSourcePrefix)
Sets the source prefix attribute of this format element.

Parameters:
newSourcePrefix - java.lang.String

setTargetContext

public void setTargetContext(Context newTargetContext)
Sets the target context attribute of this format element.

Parameters:
newTargetContext - com.ibm.btt.base.Context

setTargetContextName

public void setTargetContextName(java.lang.String newTargetContextName)
Sets the target context name attribute of this format element.

Parameters:
newTargetContextName - java.lang.String

setTargetPrefix

public void setTargetPrefix(java.lang.String newTargetPrefix)
Sets the target prefix attribute of this format element.

Parameters:
newTargetPrefix - java.lang.String

toStrings

public Vector toStrings()
Returns a vector containing the string representation of the SGML tags used to externalize this object.

Overrides:
toStrings in class FormatElement
Returns:
com.ibm.btt.base.Vector

unformat

public DataElement unformat(java.lang.String str,
                            DataElement element)
                     throws DSEInvalidRequestException,
                            DSEInvalidArgumentException
This method is unused.

Specified by:
unformat in class FormatElement
Parameters:
str - java.lang.String
element - com.ibm.btt.base.DataElement
Returns:
com.ibm.btt.base.DataElement
Throws:
DSEInvalidRequestException
DSEInvalidArgumentException

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009