com.adventnet.cli.terminal
Class TransformationHandlerImpl
java.lang.Object
|
+--com.adventnet.cli.terminal.TransformationHandlerImpl
- public class TransformationHandlerImpl
- extends java.lang.Object
- implements TransformationHandler
This class is the default implementation of the TransformationHandler
interface. It performs the transformation based on a table defined in
an XML. The entries in the table contain the terminal code(s) to be
transformed and the correspoding transformed terminal code(s). The table
is searched for the appropriate matching codes.
|
Method Summary |
java.lang.String[] |
getTransformationTableNames()
This method returns the table names that are present in the
Transformation table list. |
void |
readTransformationTables(java.lang.String fileName)
This method reads the transformation tables (e.g in a XML file or a
simple Text file). |
byte[] |
transform(byte[] data)
This method is called to perform the actual transformation. |
void |
useTransformationTable(java.lang.String tableName)
This method sets the Transformation Table to use among the different
tables read. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
TransformationHandlerImpl
public TransformationHandlerImpl()
- Default constructor. The API user need not instantiate this class since
its loaded by the TerminalIOHandler
readTransformationTables
public void readTransformationTables(java.lang.String fileName)
throws TerminalException
- This method reads the transformation tables (e.g in a XML file or a
simple Text file). The format in which the tables are stored and
read are left to user implementation of this method.
- Specified by:
- readTransformationTables in interface TransformationHandler
- Parameters:
fileName - the file in which the Table entries are present- Throws:
- TerminalException - thrown when an error occurs during reading
of the file.
useTransformationTable
public void useTransformationTable(java.lang.String tableName)
throws TerminalException
- This method sets the Transformation Table to use among the different
tables read. The transformation table is identified by the table name.
- Specified by:
- useTransformationTable in interface TransformationHandler
- Parameters:
tableName - the table name indicates the table which should be
used for the transformation.- Throws:
- TerminalException - thrown when an error occurs during setting
the Transformation table
transform
public byte[] transform(byte[] data)
throws TerminalException
- This method is called to perform the actual transformation. It takes
the untransformed data in a byte array and returns the transformed
data after performing look up operations in the table.
- Specified by:
- transform in interface TransformationHandler
- Parameters:
data - the data to be transformed- Returns:
- the byte array containing the transformed data
- Throws:
- TerminalException - thrown when an error occurs during the
transformation operation
getTransformationTableNames
public java.lang.String[] getTransformationTableNames()
throws TerminalException
- This method returns the table names that are present in the
Transformation table list. Typical implementation of this method
should return the list of names of all the various tables defined.
- Specified by:
- getTransformationTableNames in interface TransformationHandler
- Returns:
- the list of table names defined.
- Throws:
- TerminalExcption - thrown when an error occurs while
retreiving the table names.