You use the method described here if you do not want to extend the JVM for user-defined character sets as described in Custom Charset Provider but instead the extension is only to apply to BeanConnect.
If the predefined code tables do not satisfy your requirements, you can create code tables of your own. A Java sample source for a user-defined code table is supplied with the product. You will find this example in the JavaDoc for the package net.fsc.beanta.encoding
in the Encoding.CustomEncoder
class.
To avoid problems with the class loaders when using the classes of your own code tables, you should add the classes to the file BeanConnect.rar
.
You select the required code table at deployment time as follows:
In the configuration property
encoding
, specify the name of the required code table usingcustom:<my-code-table>
.Set the configuration property
encodingActive
totrue
to activate it.
You select the required code table at runtime as follows:
In the Java program activate the required code table with the
setEncoding()
method of theEISConnection
or theOltpMessageContext
interface as follows:OwnTable myTable = new OwnTable(); connection.setEncoding(new Encoding.CustomEncoder(myTable)); connection.setEncodingActive(true);
For compatibility reasons, not only the procedure described for using customer-defined code tables is supported, but also the following procedure for utilizing user-defined code tables in which conversion is implemented with two Java programs:
OwnTable_ByteToChar myTableByteToChar = new OwnTable_ByteToChar(); OwnTable_CharToByte myTableCharToByte = new OwnTable_CharToByte(); setEncoding(new Encoding.Custom(myTableByteToChar, myTableCharToByte));
These code tables only support 1-byte encoding. This means that the encoding source and destination for one char
can only be one byte. If you need 2-byte code tables, we recommend the use of a custom charset which provides all options of code conversion.