Category Archives: architecture

Devoxx 2012 impressions

Once more I enjoyed my week at Devoxx. Some of my notes:

Some interesting figures presented by Kirk Knoernschild in his architecture talks (koskinen):

  • 50% of software development time is understanding the code
  • 90% of time is maintenance

I saw a university session and presentation from him. While not new, he did make some interesting points about about architecture being are about what can easily be changed – or not – and explicitly making that choice.
In the university session, he made a case for really making the application modular by splitting in modules == jar files. These jars files should each have their own packages. This is especially important for OSGi (which interests me less at the moment), but is a best practice.

I also saw a university session about thucydides, a tool that helps for reporting on your acceptance tests. I want to look into this further. It helps you for creating your tests. You can mark some of them as not yet implemented yet, and produces many nice reports about your tests. Unfortunately, it was sometimes unclear that tests had failed (the junit test’s progress bar was green though not everything had passed). I would also like to see an integration with cucumber-jvm (apparently this is in progress). Two interesting tips :

  • Use tags, for example to indicate iteration to see difference between current work and regression testing.
  • Use PageObject extensions in your WebDriver test. This allow you to write an API for your user interface.

From the performance testing session:

  • Use mpstat to see CPU activity (inc IO wait states).
  • For IO wait state evaluation, use iostat to see usage of your drives.

From the maven puzzlers talk, use maven enforcer, see here. While I do not agree with all the comments on Maven and I did learn more than I expected and and was especially interesting to see that maven dependency resolution is not always what you would expect (especially regarding dependencyManagement in parent poms).

During one of the keynotes, Google said they just want us all to get online. Thay also want us to do so safely. They rightly said we should all use https. They also want us to use more OAuth2 en OpenId to assure that users don’t need to manage credentials. For OAuth2 I fully understand this, this is a a good way to integrate web applications. For OpenId I am more sceptic. Yes, managing identities this way is a good idea and can help against identity theft. However, this also means that the identity provider known exactly which applications you use and how often. I am not sure I want that. It can be a good option though. When not used, it should be stressed that applications should store passwords in a suitable way (for example using bcrypt).
When using OpenID, there is now a good solution to help you support many identity providers: accountchooser.

I saw a devops oriented talk which was too detailed about the language differences between Puppet and Chef. However, I picked up that I should look at Vagrant (just enough operating system) for setup and control of virtual machines. veewee can help building the images. Chef or puppet can be used to control how to extend these machines to what is needed, providing repeatable install scripts). There are also tools to revert engineer an existing setup, building the install scripts after the fact.

In a JavaFX session I saw, they gave some references to interesting sites which may help with your site design:

Last but not least, there were two session which really impressed me.

The first was about greenfoot, a tool for teaching young adults (14+) programming. It basically allows you put put objects in a 2D world and control these object. Each object can have an image, a (graphical) location and a rotation. You can control the objects using a little Java code and easily build fun and/or useful small applications. There is also an interesting integration with the Kinect as can also be seen here. It can be used to build games, for simulations etc. The environment allows you to upload your program to the greenfoot community for feedback. A thumbs up from someone else really helps for motivation.

Another exhilarating session was about AngularJS. This is a framework which does data binding in JavaScript and allows you to build reusable components. This can really make your forms much more expressive. The demo looked to me like using something like Tapestry in the browser. Way cool. They also allow good junit testing using Jasmine and testacular as test runner. The data binding was spectacular. There is also navigation support, though this looked less impressive at first sight (not demoed that extensive). I wonder if components can also be extended. This looks like a good addition to Tapestry for building web applications in Java+JavaScript (actually for the upcoming Tapestry 5.4 there seems to be some integration in progress for backbone which is a library which also does some of the data binding).

Shame Devoxx 2012 has finished. Ready for the next one…

Activiti BPM first steps

After many years of following what is happening in the BPM world, I have gotten round to properly integrating BPM in a real project. This is a project which includes an approval process including spatial evaluations. The plan was to build it around Activiti and Geomajas. Because of budget restrictions, they two parts are conceived as independent applications which use mutual links to connect the two parts.

The good news is that it all worked. There are some things I would do differently if I knew what I know now.

I started building the process in the Activiti modeler. This is a very nice web application which allows you to easily build your process diagram. There is nothing to install (apart from Activiti itself) and it works really nice and is user-friendly. Until you want to make your process runnable that is. The process I built could not be loaded by Activiti. So I switched to the Activiti designer application. This is supposed to import the models from the Activiti modeler without problem. Apparently not. You are better of immediately starting with the Activiti Designer. It takes a bit of getting used to if you are not used to Eclipse but the application itself is really nice and works well.

On to the next step, building the BPM dashboard. The plan was to reuse and customize the Activiti explorer. I expected to be able to download the application and use that as war overlay. Don’t work. So I copied (should I say forked) the original project to customize, trying to build one war for the front-end. Turned out to be a lot of work (meaning I gave up). As an end result, I just copied the Activiti Explorer and Activiti REST wars produced by the Activiti installer and explained what changes are necessary to make it fit in our environment. Previously, in their pre-Activiti days, I heard some of the Activiti developers claim that there is no need to develop your own BPM user interface. It seems they are no longer going that path.

Once the initial hurdles were taken, it was more straightforward. The process was running nicely. What remains is connecting the two applications. From the BPM dashboard, you need to be able to go to the mapping application to investigate some data. In some cases, the actual work is done in the mapping application and the “finish task” should actually be handled there instead of in the BPM dashboard.

To link to the mapping dashboard, a Spring bean was written which knows the URL of the other component and builds a link which includes the necessary query parameters. Unfortunately, tweaking Activiti explorer to use a spring enabled engine is non-trivial. The following steps were needed:

  • I had to replace the ActivitiWebScript and ActivitiStreamingWebScript classes by variants which allow the processEngine to be set using Spring.
  • I had to copy activiti-spring, spring-tx and spring-jdbc into the WEB-INF/lib folder of the Activiti REST application.
  • In Activiti REST’s WEB-INF/classes/web-application-context.xml I inserted the following
    <context:component-scan base-package="mypackage.bpm" />
    <bean id="ktunaxa" class="org.ktunaxa.bpm.KtunaxaConfiguration">
        <property name="mapDashboardBaseUrl" value="http://localhost:8080/map/"/>
        <property name="bpmDashboardBaseUrl" value="http://localhost:8080/activiti-explorer/"/>
    <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
        <property name="driverClass" value="org.postgresql.Driver"/>
        <property name="url" value="jdbc:postgresql://localhost:5432/db"/>
        <property name="username" value="un"/>
        <property name="password" value="pw"/>
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
        <property name="dataSource" ref="dataSource"/>
        <property name="transactionManager" ref="transactionManager">
        <property name="databaseSchemaUpdate" value="true">
        <property name="jobExecutorActivate" value="true">
        <property name="dbCycleUsed" value="true"/>
        <property name="deploymentResources" value="classpath*:diagrams/.*.bpmn20.xml"/>
    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
        <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  • In the same file, for both the activitiWebScript and activitiStreamingWebScript beans, add the following setter
    <property name="processEngine" ref="processEngine"/>
  • To allow using HTML links in the task name or description we had to disable HTML code escaping. This was done in components/tasks/task-list.js in the activiti-explorer webapp. Lines 196 and 197 (Activiti 5.4) contain some $html() which should just be replaced by whatever is insie the brackets.

Building the link to go to the mapping application is done using this code

public String getUrl(DelegateExecution execution) {
    String objectId = (String) execution.getVariable(VAR_OBJECT_ID);
    return mapDashboardBaseUrl + "?" + QUERY_OBJECT_ID + "=" + objectId + "&" + QUERY_TASK_ID + "=" + execution.getId();

This code is in a Spring wired class to allow using it as ${myBean.getUrl(execution)} in the process definition.

When the actual task finishing needs to be done in the mapping component, a form like the following is used

  <p><a href="${myBean.getUrl(execution)}">Object in the mapping component</a></p>

<script type="text/javascript">
window.location = "${myBean.getUrl(execution)}";

Using that execution id in the mapping component to finish the task can be done using code like

Task task = taskService.createTaskQuery().executionId(taskExecutionId).singleResult();
if (task != null) {

The application then redirects back to the BPM dashboard.

Deploying works nicely in the Activiti probe application. I was expecting to be able to have it easier by using the deploymentResources engine configuration. I may have done something wrong, but it unfortunately did not work. It is needed in install the process stuff both as jar in WEB-INF/lib of Activiti REST and deploy it using Activiti Probe. The mapping component uses a plain Spring engine configuration which accesses the same database as the Activiti REST web application.

Conclusion, it works! However, the customer now wants the BPM front-end to be customized (e.g. allowing sorting of issues, reassigning tasks etc). The original effort of trying to figure out how to combine the independent web applications may have been spent better by building my own BPM front-end.

BeJUG Activiti talk notes

BeJUG session about Activiti, Tom Baeyens & Joram Barrez, March 31

Business process
– management view : flow chart
– technical : make it runnable

BPMN 2.0
– OMG standard: shapes, execution, semantics, XML format,…

Large pool of people knowing BPMN
many editors eg Visio, Aris,…

–> executable on Activiti

– 100% java
– open source (APache)
– lightweight
– performant
– embeddable

Diagram as input
API (startProcess etc, and many forms as output)

Manual steps + automatic steps

Developers are crucial for a BPM process
– almost always coding of steps is needed

Custom tasks : implement JavaDelegate (use in a ServiceTask).

Activiti allows unit testing of processes
– @Deployment annotation loads the process (based on test class name etc)

– stop and other process or parallell process

Service bean & spring integration:
– activiti:method-expr=”${loanRequestBean.newLoanRequest(customerName, amount)}”
– activiti:result-variable-name=”loanRequest”
– loanRequestBean is a Spring or CDI bean

CDI/Spring annotations:
– @ProcessScope on class
– @StartProcess on method
– …

Activiti = many parts, including the best BPM engine

Activiti Modeler : web application for modelling BPMN 2.0 processes
Activiti Explorer : see tasks/process, run tasks
Activiti Probe : system administration
Activiti cycle : BPM collaboration done right
Activiti KickStart : allow very easy creation of processes, simple processes or rapid prototyping
Activiti REST API
Activiti Eclipse designer : modelling BPMN 2.0 processes in Eclipse
Mobile Activiti
Android client
Grails integration

Software development problem
– discuss requirements
– bild what they want
– show results
– re-iterate
–> you want faster prototyping

Process engine : combine automatic and manual steps

Automatic steps
– Java or scripting
– WS
– add activiti types automatically in designer
– SAAS, on-premise back-office integration : developer work

Why use process engine
– overview diagram
– rapid prototyping
– fast implementation, many automatic activities
– business benefit: improve communication between business and developers

Why Activiti?
– BPMN .0
– liberal OS license
– large and thriving community

– analyst build abstract process (requirement)
– developer makes that process executable (software)

Activiti cycle
– Collaboration for process solutions, using repositories (Alfresco, svn, jira, …)
– Link and discuss artifacts from different repos
– lifecycle guidance
– revamped in 5.4 (released April 1, no joke)

ACM and BPM, adaptive vs structured, see

Activiti will be integrated in Alfresco. A first development release with embedded Activiti is available now. It will be available in the next community release in August. This should then result in a new enterprise version in November which contains the Activiti integration.

The full talk was recorded and should become available on Parleys soon.