AdventNet CLI 2.0 API Specification

com.adventnet.cli.terminal
Interface TranslationHandler

All Known Implementing Classes:
TranslationHandlerImpl

public interface TranslationHandler

This interface is used for performing Translation of terminal data. The user has to implement the method for reading the translation tables, perform the translation.


Method Summary
 java.lang.String[] getTranslationTableNames()
          This method returns the table names that are present in the Translation table list.
 byte inverseTranslate(byte code)
          This method is called to perform the opposite of translation.
 void readTranslationTables(java.lang.String fileName)
          This method reads the translation tables (e.g in a XML file or a simple Text file).
 byte translate(byte code)
          This method is called to perform the actual translation.
 void useTranslationTable(java.lang.String tableName)
          This method sets the Translation Table to use among the different tables read.
 

Method Detail

readTranslationTables

public void readTranslationTables(java.lang.String fileName)
                           throws TerminalException
This method reads the translation 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.
Parameters:
fileName - the file in which the Table entries are present
Throws:
TerminalException - thrown when an error occurs during reading of the file.

useTranslationTable

public void useTranslationTable(java.lang.String tableName)
                         throws TerminalException
This method sets the Translation Table to use among the different tables read. The translation table is identified by the table name.
Parameters:
tableName - the table name indicates the table which should be used for the translation.
Throws:
TerminalException - thrown when an error occurs during setting the Translation table

translate

public byte translate(byte code)
               throws TerminalException
This method is called to perform the actual translation. It takes the untranslated terminal code in a byte and returns the translated code after performing look up operations in the table.
Parameters:
code - the terminal code to be translated
Returns:
the translated code
Throws:
TerminalException - thrown when an error occurs during the translation operation

inverseTranslate

public byte inverseTranslate(byte code)
                      throws TerminalException
This method is called to perform the opposite of translation. It takes the code in a byte and returns a code after performing a reverse lookup operation in the translation table.
Parameters:
code - the terminal code to be inverse translated
Returns:
the inverse translated code
Throws:
TerminalException - thrown when an error occurs during the inverse translation operation

getTranslationTableNames

public java.lang.String[] getTranslationTableNames()
                                            throws TerminalException
This method returns the table names that are present in the Translation table list. Typical implementation of this method should return the list of names of all the various tables defined.
Returns:
the list of table names defined.
Throws:
TerminalExcption - thrown when an error occurs while retreiving the table names.

AdventNet CLI 2.0 API Specification