The disadvantage of the Java Embedding activity is a rigid editor for entering the Java code. When preparing Java code for the Java Embedding activity, it is advisable to use more advanced tools (IDE's), which provide at least an auto-complete option. However, with developing the code outside of BPEL environment comes another difficulty, and that is the lack of the Java Embedding activity method support.
This recipe explains how to develop Java code outside of the rigid Java Embedding activity editor and retain the comfort of the BPEL development environment.
Here are the steps we need to take to prepare the development sandbox for the Java Embedding activity code in JDeveloper:
JavaEmbeddDevel
).MyExecLet
), enter the package name (org.packt.execlet
), and enter the class that we need to extend in order to implement the Java Embedding activity (com.collaxa.cube.engine.ext.bpel.v1.nodes.BPELXExecLet
). Click on the OK button to create the class.Open the newly generated class, right-click on the editor pane, and select the Source and Override methods… option. The Override Methods dialog opens where we select the execute method from the list and click on the OK button.
When the BPEL process contains the Java Embedding activity, the Java code is executed inside the BPELXExecLet
class. More precisely, the code is inserted into its execute()
method.
In the recipe, we have added the BPEL Runtime library into the JDeveloper project libraries. By inspecting the content of the BPEL Runtime library more closely, we see that it consists of just one JAR file (orabpel.jar
). Inside the JAR file, there is the BPELXExecLet
class, which we extend in our project. With BPELXExecLet
, we also receive access to all the methods we are able to access from within the Java Embedding activity.
Through the recipe we prepared the development environment, where we are able to prepare syntactically correct code for the Java Embedding activity.