Preparing the development sandbox for the Java Embedding activity code in JDeveloper

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.

How to do it…

Here are the steps we need to take to prepare the development sandbox for the Java Embedding activity code in JDeveloper:

  1. We start by creating an application workspace in JDeveloper. Inside the application workspace, create a new Java project (JavaEmbeddDevel).
  2. Add the library that contains the BPEL runtime execution classes. Right-click on the project node and select the Project Properties… option. The Project Properties dialog opens.
    How to do it…
  3. Select Libraries and Classpath from the options tree. Click on the AddLibrary… button to add libraries to the project. The Add Library dialog opens where we can find a number of libraries under the Extension node.
    How to do it…
  4. From the list we select the BPEL Runtime library and click on the OK button to close all the dialogs.
  5. Create the Java class to be used for the development in the Java project. We name the class (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.
    How to do it…

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.

How to do it…

How it works…

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.

Tip

Note that we are not able to run the code, since there is no BPEL runtime environment present. To really test the code in runtime, we have to copy the code into the Java Embedding activity inside the BPEL process and run it.

See also

When we have code ready to be used in the BPEL process, it is time to move into the real BPEL process. In the upcoming two recipes (Using the Java code placeholder in BPEL process and Invoking Java code from the BPEL process), we address the use of Java code inside the BPEL process.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset