Using the Eclipse STP BPMN Modeler
The STP BPMN Modeler is quite easy to use. You can model just about anything with a simple drag and drop, which is what you'll get to try out in this section. First, you'll learn how to create a BPMN diagram to model visitors purchasing toys on your Web site. Then you'll learn about a few activity types you'll be using in the model. And finally, you'll see how to ultimately model your business process using the BPMN Modeler.
Time to start up the Eclipse STP. Because the BPMN Modeler isn't project-based, you're just going to start it off in a generic project.
To create your new project, click File > New > Project. Next, expand the General folder and select Project.
Figure 2. Creating a generic project
Click Next and type in a project name, STPbpmn.
Figure 3. Naming your project
You should now see your new project in the Package Explorer pane. Select it and click File > New > Other. Expand the SOA Tools folder and select Bpmn Diagram.
Figure 4. Creating a new BPMN Diagram
Click Next and enter a file name in the File name space:
Figure 5. Naming your BPMN diagram
Click Finish to create the BPMN diagram. Your project should now be set up as shown below.
Figure 6. Your project window
Excellent! Now you're ready to being learning about a few activity types, elements shown in the palette on the right.
There are various activity types you can use to model your business process. Here are five you'll be using to model yours. Empty Start, under Start Events.
Figure 7. Empty Start event
This activity starts the flow process, the empty circle on the left side of Figure 1. Next is a task, as shown below.
Figure 8. Tasks
Tasks are commands like invoking a Web service. The next two are a couple gateways that allow a process to split into to different directions, exclusively or in parallel. First is the exclusive data-based gateway.
Figure 9. Exclusive data-based gateway
You'll see more of how this works later. In short, it's used to branch the business process into two paths, one for if the order failed and another if the order was a success. Next is the parallel gateway.
Figure 10. Parallel gateway
You can use this gateway to define two tasks that can be executed in parallel, such as sending an invoice to a customer and queuing an order in the shipping department after an order successfully processed. The last activity you'll check out is the Empty End event, an event that terminates the business process.
Figure 11. Empty End event
This is the empty circle on the right side of Figure 1, terminating the business process flow.
Now you finally get to model your business process. To begin, click the Empty Start
activity and click a spot in the blue flow panel. Then double-click it and label it
Figure 12. Labeling the
Click the task activity type, place it to the right of the start circle,
double-click it and label it
Figure 13. Labeling a task
Next, you'll create a new arc from the start circle to the
addToyToCart task. Hover over the right border of the start circle
until a dark solid arrow appears to the right of it, as shown in Figure 14. Click on
the small square box to the right of the solid arrow and drag it to the
Figure 14. Creating a new arc
Let go of the mouse button over the
addToyToCart task, and a
new arc should appear, linking the two together.
Figure 15. A new arc created
There, you've created your first arc. Your business process is coming together. Continue modeling your business process.
Figure 16. Continuing to model the business process
With the aid of the above figure, you should be able to create a new task,
viewCart, and two exclusive data-based gateways that comprise the
while loop. Note that you can also label arcs, as shown in
the two arcs coming out of the gateway labeled while2. Simply double-click them, type
in a desired label, click Enter, then drag the label to where you want it.
Continue modeling, as shown below.
Figure 17. Continuing modeling
Here you see the checkout and
shippingEstimator tasks you
can create and hook up as shown. Note that there is an edge going from
shippingEstimator back to the gateway labelled while1: This
ultimately becomes the
while loop you saw in Listing 2. After
the checkout task, you see the equivalent of an
statement with the gateway labeled
orderCheck. If the order
failed, flow moves to the
orderFailed task, and if
successful, you'll move to the parallel gateway labelled
orderTasks. Continue modeling the last bit of the business process.
Figure 18. Finalizing the business process model
Note how the two tasks,
shippingQueue are within the parallel gateways. They will be executed
in parallel since their flow does not matter. The parallel flow then meets back up at
orderTasks2 and again at
orderCheck2, with the business process terminating at an Empty
You can now examine the resulting BPMN corresponding to your diagram by double-clicking
the mybiz_flow.bpmn file in your package explorer file. Here, you can see all the
sequenceEdges that describe the business process you just modeled.
Congratulations! You've successfully modeled a business process using the BPMN Modeler. Next, you'll begin the transformations to convert the BPMN to BPEL.
With BPMN in hand, you're ready to convert it to BPEL. To do so, you're going to employ the help of the Eclipse ATL project and tools from BABEL. This conversion process is necessary so you have an executable (BPEL) to work with before deployment to Apache ODE. The role of Eclipse ATL is to perform a transformation on the BPMN to a BPMN format readable by the BABEL tools, which convert the final BPMN to BPEL. You'll begin by creating your first Eclipse ATL project.
To create your Eclipse ATL project so you can perform a STP BPMN to BABEL BPMN, you need to create a new project within the Eclipse ATL. Start up the ATL (ATL_project/eclipse.exe). Note there are two pre-existing projects: Families2Persons and Tree2List. You can ignore these or delete them altogether since you won't be using them.
Now you'll create a new project to house the transformation rules you're going to set up. Click File > New > ATL Project.
Figure 19. Creating an ATL project
Next, a window pops up asking for a name. Name the project STPbpmnTObabelBPMN, as shown below, then click Finish.
Figure 20. Naming your ATL project
Your ATL project is now created, but more remains. You need to grab a few files from the tutorial download in the Download section. Once you've got the download, extract three files and copy them to your ATL project.
- An EMF file defining the structure for BABEL BPMN files.
- The EMF file defining the structure for STP BPMN files.
- This is an ATL file defining the transformation from STP BPMN to BABEL BPMN.
Also, copy the mybiz_flow.bpmn file generated from your Eclipse STP project to your Eclipse ATL project. Your package explorer for your ATL project should now look like Figure 21.
Figure 21. Package Explorer view for ATL project with files copied over
Note that the bpmn2babel.asm file is auto-generated by Eclipse ATL when it compiles the bpmn2babel.atl file.
At this point, your ATL project is created and you're ready to proceed to the transformation.
Now it's time to transform the BPMN output from the Eclipse STP BPMN Modeler to a BPMN format readable by the BABEL tools. Before performing the transformation. However, there is one last thing you need to do. As of the current version of the Eclipse STP, there is a bug in the output of the BPMN (it does not conform to the corresponding stpmodel.ecore). To fix, open up the mybiz_flow.bpmn file by double-clicking it in the package explorer window (see Figure 21).
Replace all instances of the following:
Exclusive Data-based Gatewaywith
Empty Start Eventwith
Empty End Eventwith
The BPMN is ready for transformation. To proceed, click Run > Open Run Dialog. In the left-hand column, right-click ATL Transformation, and click New. Name the launch configuration STPbpmnTObabelBPMN, and in the project pane select your project in the name (STPbpmnTObabelBPMN) and the bpmn2babel.atl file in your project, as shown in Figure 22. Then you can select the BPMN and BABEL Ecore metamodels in the metamodels pane by typing in the path to each Ecore file, or by selecting the appropriate workspace button and browsing for it.
Figure 22. Configuring the ATL launch configuration
Then, again shown in Figure 22, you need to choose a source model (mybiz_flow.bpmn) by
entering it directly or clicking Workspace and browsing for the right file in
your project. Since the target model doesn't exist yet (this is the file that gets
generated by Eclipse ATL), you're going to copy the source model file to the target
model file, and type
BABEL_ as the prefix to it (see the
source and target model panes in Figure 22).
Quite a lot of information so far, hunh? And there's just one more thing left to do: add a library. To do so, click Add library (shown in bottom left of Figure 22), a window will pop up asking for the name, accept the default, and just click OK. A library will then appear in the Libraries pane (to the right of the Target Models pane in Figure 22). Click the Workspace button, shown below.
Figure 23. Entering the library file to your ATL launch configuration
Browse for the file in your projects transformation directory.
Figure 24. Entering a library
Click OK. Finally! The launch configuration is ready to roll. Make sure to click Apply in the bottom right of the window to save your changes.
To launch to the configuration and perform the transformation, click Run on the bottom right of the window, and voila! You should now notice a new file in the models folder in your ATL project, as shown in Figure 25. This is the BABEL BPMN intermediary format.
Figure 25. Generating BABEL BPMN
To perform the transformation, copy the BABEL_mybiz_flow.bpmn from your Eclipse ATL project to the babelBPMNtoBPEL directory you created earlier when you installed the BABEL tools.
Before proceeding with the remaining transformation, there's one last edit you need to
make to the BABEL_mybiz_flow.bpmn file. First: Notice there are two
<babelBpmn:DocumentRoot> children elements. Remove one of them
(you can compare your file to the one in the babelBPMNtoBPEL directory of the code you
downloaded from the Download section).
Open a console, and change your directory to the babelBPMNtoBPEL containing the
BPMN2BPEL.jar file and the BABEL BPMN file you just created (BABEL_mybiz_flow.bpmn).
Type the following to create BPEL:
java -jar BPMN2BPEL.jar BABEL_mybiz_flow.bpmn.
The last few lines from running the above tool creates the following output, as shown in Listing 3, creating a new file, BPEL_BABEL_mybiz_flow.bpmn.bpel.
Listing 3. Transforming from BABEL BPMN to BPEL
328 [main] DEBUG controller.BPMN2BPEL - Step 5: Build the BPEL-Tree. 328 [main] DEBUG controller.BPMN2BPEL - Output the BPEL-XML into a File. 343 [main] DEBUG model.backEnd.EmitterBPEL4BPMN - ChildLIST:1 343 [main] DEBUG controller.BPMN2BPEL - Directory : 343 [main] DEBUG controller.BPMN2BPEL - File : BPEL_BABEL_mybiz_flow.bpmn.bpel
Rename BPEL_BABEL_mybiz_flow.bpmn.bpel to mybiz_flow.bpel and copy it to another
directory: apacheODE_process/mybiz_flow/. Open the BPEL file and notice the
while loop, as
<while condition="while_ok"> <invoke name="shippingEstimator" partnerLink="local" portType="localPT" operation="shippingEstimator" inputVariable="shippingEstimator_data_in" outputVariable="shippingEstimator_data_out" /> </while>
Here, you can compare the
while loop created here to the one
you'll end up with in Listing 2. Note that the syntax of the two are different. This is
because the auto-generated version creates an excellent starting place for BPEL
development, a bonus to creating BPEL from scratch.
In the next section, you'll prepare your business process for deployment on Apache ODE.