What are steps to build Java External Action Blocks (EAB) in CA Gen

Document ID : KB000027818
Last Modified Date : 14/02/2018
Show Technical Document Details

Question:

What are steps to build Java External Action Blocks (EAB) in CA Gen

 

Answer:

This document gives an example based on the instructions in the CA Gen wiki section:Distributed Processing > Working With Enterprise JavaBeans > External Action Blocks in Java

 

Setting up the build directory for the EABs:

1. Create a directory under the sample.ief root directory giving it a name of your choice. For e.g. javaeabs

2. Under the new directory create a directory with the short model name. For e.g. javaeabs\sample

(Optional Step) If you had specified a Java Package Name under the Model Generation Properties in the toolset, then instead of the short model name you should create a directory structure according to the Java Package Name under the directory created in step 1. See example below.

Imgc

Based on the above package name you would create javaeabs\com\ca

 

Customizing the EAB java file:

3. Copy and paste all the EAB related java files (e.g. MYEAB*.java) from the sample.ief\java\sample folder into the sample.ief\javaeabs\sample folder.

4. Customize the MYEAB.java file in the javaeabs\sample folder with your own java code. Following is just an example:

    //    User-written code should be inserted here

    w_oa.export_division_number.setShort(w_ia.import_division_number.getShort());

    w_oa.export_division_name.setString( "Hello from the EAB" );

     

    Compiling the customized EAB java files:

    5. Open a Windows Command Windows and change to the sample directory under the javaeabs folder. Enter the following java command to compile the java files:

    javac -classpath <drive>:\cool\gen\sample.ief\java\deploy\genrt.85.jar MYEAB*.java

    Executing the above command will produce class files in the javaeabs\sample folder.

    Note: In order to compile successfully the java EAB files need to reference the Gen runtimes (genrt.85.jar) which would need to be in the system classpath or can be referenced in the javac command with a -classpath entry as in the example on previous page.

     

    Creating the JAR file:

    6. We need to place all the class files into a jar file which in turn will be included in the assembled application EAR file. From a Windows Command Prompt change directory to the sample.ief\javaeabs folder and execute the following command:

    jar -cvf myeabs.jar sample\*.class

    That will create a new jar file myeabs.jar in the \javaeabs folder containing all the class files from the javaeabs\sample folder

     

    Deploy the EABs in the EAR during the Assemble step

    7. In the Build Tool EAR File Assemble Details dialog choose Additional File & click the Add button to display a file chooser dialog. Navigate to the directory holding the myeabs.jar file, select it and click Open. Then complete the assemble & deployment process