dinsdag 13 maart 2012

Code Like an Egyptian

Last week I went to Cairo in Egypt to present at the JDC 2012 conference.

What a Country

It was my first time in Egypt as well as my first time on the African continent and I have to say that it was a very good experience. My parents are both Egypt enthusiast and they had already told me many good things about this country but the reality beat my expectations by far. Egyptians are truly optimistic and very friendly and helpful people. Also they are rightfully very proud about their magnificent culture and their rich history. Even though I was only there for two full days, I escaped for 4 hours to go and see the pyramid complex of Giza. Pictures don't do this any good, in reality the site is even more mind-blowing!


Open Source to the Rescue

Of course, because of the recent political events, the economical situation is not that great at this time as a lot of tourists avoid Egypt. Nevertheless everybody that I spoke to was confident that things would be turned around. Also it turns out that open source can play an important role in this evolution. A lot of Egyptian startups start off using open source projects with minimal investments. When their business takes off and becomes profitable, they can then proceed to buy subscriptions for the corresponding products. Consequently a lot of developers I spoke with were very happy with the JBoss presence at the JDC conference as many of them use JBoss technology.


What a Conference

As for the conference itself, it was an example of how all conferences should be organized: great venue, motivated volunteers, good food and of course exciting presentations and a very interested crowd. Myself, I had three presentations:
Except for the last session, which was scheduled in the last slot of the last day, the talks were very well attended with lots of interesting questions afterwards. There was also professional media coverage from TechEgypt who recorded the sessions. I was told the recordings would be published by the end of March. In the meantime you will have to do with an interview TechEgypt did with me. They already published that one yesterday as you can see below.


It is nice to see how the Java community is growing strong in Egypt. I was told that so far JDC is the only Java conference in the Middle East and Africa combined. But I am sure that its success will lead to a better presence of this side of the world on the Java map.

I want to thank the organizers and the attendees of the conference once again for this great event. Way to go guys!

Cheers,
Koen

woensdag 9 februari 2011

Business Rules and New Icons

Mauricio asked me some time ago if it would be possible to add Business Rules to the BPMN 2 editor I have created. I promised him that I would do this since it was not that of a daunting task. So I spent one Sunday afternoon and this last evening doing that as well as adding the new BPMN 2 icons that were created in the meantime. A screenshot of the result is shown below.


Everybody will admit that it looks way nicer, isn't it? I for my part have to admit that I needed to cut some GMF corners to make the task icons show up in the right upper corner. But hey, it is only a prototype editor after all. If you want to try it, you can download it here and install it as shown in the previous post.

Cheers,
Koen

dinsdag 14 december 2010

Eclipsing BPMN 2.0

Most of us that are following the BPM area are aware of the BPMN 2.0 standard that was finalized recently. This new version of the standard has received a lot of attention and is a candidate that has a good chance to be able to unify the fractioned landscape of BPM. The standard specifies among others the notation to use to model processes and choreographies, the format to use when serializing them and how the models are to behave when they are executed by a BPMN engine.

The first of these goals implies that a BPMN 2.0 practitioner can use a tool to create the BPMN 2.0 models that uses the specified notation. During the last months I have worked intensively to create such a graphical BPMN 2.0 editor that would produce models that can be executed on the brand new jBPM 5 runtime. Today I am happy to present you the fruit of this hard work. The focus of this article is user-centric. I will shine a light on the implementation hurdles I encountered in another post.

Overview

As the title of the article implies, the editor comes as a series of Eclipse plugins. The screenshot below shows a general impression of the result after recreating the 'evaluation' example from the jBPM 5 documentation.


Installation

You can download the installable archive from our development community pages. The downloaded file is an archived repository that you can install into Eclipse using the familiar 'Help->Install New Software...' mechanism. The procedure is illustrated on the next two screenshots.


Make sure that the checkbox 'Group items by category' is unchecked as you will not see any features to install on the next screen otherwise. If all is going well, you should see two 'BPMN 2.0 Tools' items on the next page. The first item of these contains the binaries of the plugins that will be installed, the second contains the source code bundles. Just select both of them and push the 'Next' button.


The rest of the installation is pretty straightforward. You only have to accept all the defaults as you work yourself through the wizards.

BPMN 2.0 in Perspective

After installing the plugins and restarting Eclipse, you can do a first verification if all went well by trying to switch to the BPMN 2.0 perspective. To do this you can push on the 'Open Perspective' button in the top right location of your Eclipse workbench, select 'Others...' as illustrated below and choose the 'BPMN 2.0' entry in the list that opens.


As you can see, the workbench has now a number of opened views such as the 'BPMN 2.0 Definitions' view and the 'BPMN 2.0 Details' view which you might not yet be familiar with. We will explain shortly what purpose they serve. Next to these views, the usual 'Package Explorer' view, 'Property' view and 'Outline' view are open.

Working Towards the Flow

Before we can start creating our first BPMN 2.0 process, we need to create a project. In this case any simple project will do, so we will create a resource project called 'foo'. By bringing up the context menu when this project is selected and selecting 'New->BPMN2 Diagram' we can create our new process.


We choose for example the name 'bar.jbpm' for our process resource and the BPMN 2.0 process diagram editor opens.


Hello, BPMN 2.0 World

Let's create a simple three node "hello, world" like process that is started off by the reception of a message and subsequently writes out the message. I have recorded a little screencast of the creation of this process to show you some of the more advanced features that the editor inherits by being based on the Eclipse Graphical Modeling Framework (GMF): the popup toolbar, the connection handles and the layouting mechanism.


As you can see this goes really smoothly. Of course I knew where on the toolbar and in the dropdown menu the different tools that I needed were placed. Also you might not be very impressed with the bareboned icons. These icons are inherited from the underlying Eclipse BPMN 2.0 Model project that was used as the base for the editor. The good news is that it is not so hard to replace these icons and that the creation of nice icons is in the hands of the real specialists in this area (see this JIRA issue). And even if you don't know exactly where on the toolbar you need to click, you are still free to use the palette...

The Source is With You

As I have mentioned before, one of the particularities of the BPMN 2.0 specification is that it describes by means of a number of xsd's how to serialize the modeled processes. Also the serialization of the graphical information is handled by the specification. The solution I present here to you is completely in line with this specification. The semantic model and the graphical information are serialized in one single file in a way that is compliant with the specification.

You can see the serialized XML by saving the work we did until now and opening the 'bar.jbpmn' file by choosing 'Open With->Text Editor'. The result should be similar to what is shown below.


One of the obvious feature requests that you could think about is to integrate the BPMN 2.0 graphical editor with an XML editor to provide a source page in a multipage editor.

Making the Flow Work

The process now is what is called underspecified. If you would deploy it on a compliant engine this engine would not be able to execute it. To make it executable, we have to provide some details. One of the ways to do this would be to edit the XML source in your preferred text editor, but luckily the BPMN 2.0 Diagram Editor provides a complete solution that makes adding these details a breeze. The two key elements that enable this are the BPMN 2.0 Definitions View and the BPMN 2.0 Details View.

The screencast below shows how the Definitions View is used to add two item definitions and one message. The Definitions View contains elements that are global for the entire BPMN file. Next the Details View is used to add a property to the process, to specify the output set, data output and data output associations for the start event as well as the script property for the script task. The Details View, as its name implies, provides a way of specifying details for the currently selected graphical element in the editor.


These additions should make the process executable and fully specified. Showing how to execute this process on the jBPM 5 runtime would make this entry too long, so I will save it for later.

Knowing the Issues

While the editor is fully usable to create executable BPMN 2.0 files, there is definitely room for improvement and for additional features. The following list contains some of the known problems that are must haves to make the editor really complete from a BPM 2.0 point of view:
  • As already mentioned, the graphical icons should be made more attractive. Luckily the hard part of this is actually designing the icons and this is exactly the task that we leave into the hands of our specialist graphical designers.
  • There are issues with the bendpoints. These are not always reproduced at the same location after closing and reopening the editor. The way how GMF determines bendpoints and anchor points is not yet completely clear to me. Any input in this area is greatly appreciated.
  • Attached events are not yet supported. Luckily again, this is just a matter of enriching the GMF model and regenerating the graphical part of the editor.
  • Swimlanes are not yet supported.
A list of features that would be nice to have is also not very difficult to come up with:
  • Add a generic activity type mechanism that users can use to add domain specific extensions.
  • Provide a way to annotate nodes on the diagram so that the editor can be used in 'debugging mode' or simply can show errors.
  • Add support for multiple process diagrams in one file by providing one tab for each process in the file.
  • Add a optional source tab.
  • Create a choreography diagram editor.
  • ...
Most of these features should not be that difficult to add.

Conclusion

While the BPMN 2.0 process diagram editor in its current state is far from perfect, I think it provides already enough features to create fully specified processes that can be executed on BPMN 2.0 engines that provide execution compliance. If you are a BPM practioner and/or developer, I encourage you to make use of it and provide us with your feedback!

Best regards,
Koen


dinsdag 3 november 2009

Combining jBPM and JSF

Last week the team was getting ready for the jBPM 4.2 release. As usual this mainly consists of doing manual testing in order to prevent our dear users from having really nasty surprises when, full of hope, they download and install their brand new toy. One of my tests consisted in developing a very simple, one page application that shows how to get started with jBPM in combination with JSF. In this post I will describe the development of this small application.

The Idea

The main purpose of the application is to show a list of all the processes that are deployed in a default jBPM installation. The result is shown in the image below.

Setting up jBPM

If you are a have not the first thing to do is download jBPM archive and extract it to your favorite location. To complete the installation, just use the 'demo.setup.tomcat' target of the 'build.xml' script in the 'install' folder.

As documented in the User Guide this script will:
  • Download and install Tomcat into ${jbpm.home}/apache-tomat-6.0.20
  • Install jBPM into that Tomcat installation
  • Install the HSQLDB and start it in the background
  • Create the DB schema
  • Start Tomcat in the background
  • Create an examples.bar business archive and deploy it
  • Load the example users and groups
  • Download and install Eclipse into ${jbpm-home}/eclipse
  • Install the jBPM web console
  • Install the Signavio web modeler
If all went well, you should be able to navigate to 'http://localhost:8080/jbpm-console' and behold our beautiful console. After this is done, we are ready to get started with our real task at hand.

Create the Project

Just launch Eclipse if it is not already running and create a new project in your workspace. The initial layout of this project is illustrated above. As you can see there is a 'JavaSource' folder and a 'WebContent' folder. The target folder for the compiled Java class files is set to be 'WebContent/WEB-INF/classes'. In addition I created the following build.xml file.


Getting Ready for JSF

I want to show how to use JSF so let's add the needed boilerplate elements for this technology:
  1. web.xml in the WEB-INF folder:

  2. faces-config.xml in the WEB-INF folder:

  3. jsf-api.jar, jsp-impl.jar and jstl-1.2.jar in the WEB-INF/lib folder:
    You also could add these files to the lib folder of your Tomcat installation. In case you are wondering where these libraries come from, I used the jsf-api.jar and jsp-impl.jar that are included in the latest release of the Mojarra project. Likewise the JSTL library can be downloaded here.
The layout of the WebContent folder after performing these steps is shown above.

Adding two pages

Let's add some minimal content to our application and deploy it to check whether we did everything right:
  1. Create a images folder in the WebContent folder and add a nice image called jbpm.png:

  2. Create a pages folder in the WebContent folder and create the definitions.jsp file:

  3. Create a file called index.jsp in the WebContent folder:
The resulting layout of these previous steps is shown below.

Now we can deploy our application by executing the 'deploy' target of our build file. After this is done we can navigate to http://localhost:8080/HelloMyJbpm/ and the resulting image should be similar to the one below.

Use the jBPM API in a Managed Bean

Finally! After all the previous steps we come at last to the point where we are going to use jBPM. To do this we are going to create a managed bean.

Before creating our managed bean however we have to make sure that our classpath is correct. We need to add the jBPM library to the classpath for the compilation to succeed. As you may have seen, this was already done in the build.xml file. If you are using Eclipse you might want to add the 'jBPM Libraries' classpath container to your buildpath as it is described in the docs.

The managed bean is a very complicated sounding name for an actually very simple Java class. Take a look at the image below.

You can see that there is not much to the ProcessEngineBean. It has a couple of static fields where a reference to the application wide available ProcessEngine and the RepositoryService are stored. These fields are lazily initialized upon the creation of the first bean. Additionally there is one public method that is called getDeployedProcessDefinitions. In this method the repository service is used to create a ProcessDefinitionQuery that basically returns a list of all the deployed processes in the database in ascending order of their name. Isn't it simple?

Now that we have our managed bean, let's take a look at how we can use this marvellous creation.

Using the ProcessEngineBean

The whole purpose of creating a managed bean is of course to use it in one of the pages of our application. So let's modify the definitions.jsp page that we created earlier to take advantage of the ProcessEngineBean and make sure that we can show something interesting instead of a dull welcome page. The modified page is shown below.

We can see that the datatable element is used to display a list of process definitions. The processEngineBean object that is used in the value expression of this element is in fact the managed bean that we developed in the previous step. But does our page know about this bean. In fact, it doesn't. We still have to register this bean in the faces-config.xml file. To do that we revisit this file and modify it so that it looks like the one below.

Finalization

If we would deploy our application now and navigate to its homepage we would get an exception because the managed bean cannot be created. As a matter of fact to make the application work, we need to provide the jBPM configuration files. This configuration is read the first time a ProcessEngineBean is created. We will provide two more files that will reside as resources on the classpath of our application:
  1. jbpm.cfg.xml
  2. jbpm.hibernate.cfg.xml
The build script will make sure these files are included in the WEB-INF/classes folder of our web application so that they are on the applications classpath.

Hurray! We're done! Just use the build.xml one more time to invoke the deployment and reload the application's landing page at http://localhost:8080/HelloMyJbpm/. The result should look like the image below.

maandag 10 augustus 2009

Process Your Problems



As from the 4.0 release of jBPM, the Graphical Process Designer has been improved in a number of areas. One obvious but nevertheless very helpful feature is the addition of validation of the process definition files. Until now, problems with process definitions could only be captured by writing unit tests and using the process in such a test. The bottom line is that the process had to be deployed before problems with it became apparent.

This way of working has been fixed. A small bug still prevents the validation from being performed in the released 4.0 version, but in the meantime this has been resolved and the feature will be available in the upcoming 4.1 release.

Before validation can be executed, a jBPM runtime needs to be configured. All validation is done using the parser and jBPM classes available for this configured runtime.

Once this is done, the validation is performed automatically each time a process file is saved or manually by selecting 'Validate' from the context menu of the editor.

When the validation result contains errors, all the Eclipse stuff happens as you expect it:
  • The problem message and line number of the problem are shown as an entry in the Eclipse Problems View.
  • In the Package Explorer the file is annotated with the error symbol, indicating the problem discovered in the file.
  • In the source view of the editor the line number is annotated with the error symbol.

As-you-type validation is not yet available. We might add such a feature in the future if compelling reasons should appear. In the meantime we hope you will enjoy the improved validation and problem handling support.

Cheers,
Koen

vrijdag 15 mei 2009

More on BPMN Execution

Just to let everyone know that the people from Eclipse have put my EclipseCon talk online with audio at http://live.eclipse.org/node/707. You are all invited to listen.

Cheers,
Koen

dinsdag 31 maart 2009

Executing BPMN

Last week I was at EclipseCon in Santa Clara, CA. In addition to attending the conference which featured some excellent talks and having a team meeting after the conference, I delivered a talk on BPMN and how we see the execution of BPMN models at jBPM. The slides from this talk are provided below.