Use the MessageFormatter.java file under <AppServer location>\repra\sample\client (Windows) or <AppServer location>/repra/sample/client (UNIX) directory as a sample of the customized message formatter. The sample uses the DBEventParser utility to retrieve data and metadata from the replication event. For detailed information about DBEventParser, see “Using the DBEventParserFactory”.
Compiling the customized formatter processor
To compile your formatter processor.
Go to the directory where your formatter processor is located.
On Windows:
cd c:\work\custom
On UNIX:
cd /work/custom
Use the Java compiler, the -classpath parameter, and the required libraries to compile your customized class.
On Windows:
md customclasses c:\jdk141\bin\javac -classpath .;c:\sybase\EAServer\repra\lib\ repraconn.jar \ -d customclasses com\mycompany\SampleFormatter.java
On UNIX:
mkdir customclasses /usr/jdk141/bin/javac -classpath.:/opt/sybase/EAServer/repra/ lib/repraconn.jar\ -d customclasses com/mycompany/SampleFormatter.java
Verify the compilation.
When the compilation finishes without any error messages, go to the customclasses directory to see if the SampleFormatter.class is under com\mycompany (Windows) or com/mycompany (UNIX).
Building the runtime environment for the customized formatter processor
To include the customized formatter processor in a jar file, go to the customclasses directory and use the jar command to build a jar format from the com directory. Otherwise, you can use the directory path for setting up your environment.
Sybase recommends that you use the jar file format for your customization.
Build a jar file
On Windows:
cd C:\work\custom\customclasses C:\jdk141\bin\jar -cf mycustom.jar com
On UNIX:
cd /work/custom/customclasses /usr/jdk141/bin/jar -cf mycustom.jar com
Shut down and restart your application server.
For EAServer:
Copy the jar file, or the directory structure containing the Java classes created from the previous step, to the EAServer java\classes (Windows) or java/classes (UNIX) directory.
Run EAServer and connect to it from EAServer Manager.
If you are using the jar file, go to the Servers/<your server> directory and select Server Properties. From the pop-up, select the Java Classes tab. Click Add to add the name of the jar file, such as mycustom.jar, and click OK.
Shut down the EAServer, and then restart it to activate the new environment change.
For WebLogic:
Shut down the application server if it is running.
Add the full path of mycustom.jar or the customclasses directory to CLASSPATH at the end of the CLASSPATH definition in %BEA_HOME%\repra\bin\repra_env.bat (Windows) or $BEA_HOME/repra/bin/repra_env.sh (UNIX):
On Windows:
set CLASSPATH=C:\work\custom\customclasses;%CLASSPATH% or set CLASSPATH=C:\work\custom\customclasses\mycustom.jar;%CLASSPATH%
On UNIX:
set CLASSPATH=/work/custom/customclasses:$CLASSPATH or set CLASSPATH=/work/custom/customclasses/mycustom.jar;$CLASSPATH
Start the WebLogic Server to activate the new environment change.