IBM Bank Transformation Toolkit Javadoc

com.ibm.btt.format.impl
Class XMLDecorator

java.lang.Object
  extended by com.ibm.btt.format.AbstractFormatElement
      extended by com.ibm.btt.format.BaseDecorator
          extended by com.ibm.btt.format.impl.XMLDecorator
All Implemented Interfaces:
FormatDecorator, FormatElement

public class XMLDecorator
extends BaseDecorator


Field Summary
 
Fields inherited from class com.ibm.btt.format.AbstractFormatElement
dataName, tagName, TOSTRINGS_MARGIN
 
Constructor Summary
XMLDecorator()
           
 
Method Summary
protected  Message addDecoration(Message message)
           
static Message escape(Message msg, java.lang.String encoding)
          Replace special characters with XML escapes:
 Message[] extract(Message message)
          Extracts (strips) the subMessage corresponding to the FormatElement from the input Message and returns it and the remaining Message as the elements of an array.
 Message format(ReadAdapter dataWrapper)
          This method is attended to be called by client code of FormatElement
protected static byte[] getBytes(java.lang.String str, java.lang.String encoding)
           
 java.lang.String getDataName()
          return the corresponding data element name to this IFormatElment.
protected  Message getPostTag(java.lang.String aName)
          Returns the tag that follows each DataElement.
protected  Message getPreTag(java.lang.String aName)
          Returns the tag that preceeds each DataElement.
protected static java.lang.String getStr(byte[] bytes, java.lang.String encoding)
           
protected  Message removeDecoration(Message message)
           
static Message unescape(Message msg, java.lang.String encoding)
          Replace special characters with XML escapes:
 void unformat(Message message, WriteAdapter dataAdapter)
          This method is attended to be called by client code of FormatElement
 
Methods inherited from class com.ibm.btt.format.BaseDecorator
attributes, getDecorated, isContainer, rootDecorated, setDecorated, toStrings
 
Methods inherited from class com.ibm.btt.format.AbstractFormatElement
setDataName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLDecorator

public XMLDecorator()
Method Detail

extract

public Message[] extract(Message message)
                  throws ExtractException
Description copied from interface: FormatElement
Extracts (strips) the subMessage corresponding to the FormatElement from the input Message and returns it and the remaining Message as the elements of an array.
The returned array of Message should always contain two elements.

Take Message 1FCD2639FE for example. The returned array of Message may be {1FCD, 2639FE}, the first element 1FCD is the Message required by this FormatElement, while the second element 2639FE is the remaining Message.

This method is not attended to be called by client code of FormatElement
This method is called by the unformat() method of the composite formats such as com.ibm.btt.format.impl.RecordFormat and com.ibm.btt.format.impl.IndexedFormat.

Specified by:
extract in interface FormatElement
Overrides:
extract in class BaseDecorator
Returns:
Throws:
ExtractException

addDecoration

protected Message addDecoration(Message message)
                         throws FormatException
Specified by:
addDecoration in class BaseDecorator
Throws:
FormatException

getDataName

public java.lang.String getDataName()
Description copied from interface: FormatElement
return the corresponding data element name to this IFormatElment.

Specified by:
getDataName in interface FormatElement
Overrides:
getDataName in class BaseDecorator
Returns:

format

public Message format(ReadAdapter dataWrapper)
               throws FormatException
Description copied from interface: FormatElement
This method is attended to be called by client code of FormatElement

Specified by:
format in interface FormatElement
Overrides:
format in class BaseDecorator
Returns:
Throws:
FormatException

unformat

public void unformat(Message message,
                     WriteAdapter dataAdapter)
              throws UnformatException
Description copied from interface: FormatElement
This method is attended to be called by client code of FormatElement

Specified by:
unformat in interface FormatElement
Overrides:
unformat in class BaseDecorator
Throws:
UnformatException

removeDecoration

protected Message removeDecoration(Message message)
                            throws UnformatException
Specified by:
removeDecoration in class BaseDecorator
Throws:
UnformatException

getPostTag

protected Message getPostTag(java.lang.String aName)
Returns the tag that follows each DataElement.

Parameters:
aName - java.lang.String
Returns:
java.lang.String
Throws:
java.io.UnsupportedEncodingException

getPreTag

protected Message getPreTag(java.lang.String aName)
Returns the tag that preceeds each DataElement.

Parameters:
aName - java.lang.String
Returns:
java.lang.String
Throws:
java.io.UnsupportedEncodingException

escape

public static Message escape(Message msg,
                             java.lang.String encoding)
                      throws java.io.UnsupportedEncodingException
Replace special characters with XML escapes:

Parameters:
string - The string to be escaped.
Returns:
The escaped string.
Throws:
java.io.UnsupportedEncodingException

unescape

public static Message unescape(Message msg,
                               java.lang.String encoding)
                        throws java.io.UnsupportedEncodingException
Replace special characters with XML escapes:

Parameters:
string - The string to be escaped.
Returns:
The escaped string.
Throws:
java.io.UnsupportedEncodingException

getStr

protected static java.lang.String getStr(byte[] bytes,
                                         java.lang.String encoding)
                                  throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

getBytes

protected static byte[] getBytes(java.lang.String str,
                                 java.lang.String encoding)
                          throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

IBM Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2008