admin

 

In my diploma thesis I tried to integrate a Complex Event Processing (CEP) System namely Esper with a Workflow Mangement System. Generally this is no technical problem. But there are some fundamental problems with current CEP systems. Especially with modeling CEP rules.

CEP is a very powerful paradigm to process high-speed, high-volume data. As Gartner is predicting with “The transition in application architectures, which began with service-oriented architecture several years ago, continues to accelerate, as SOA and Web architecture mature, event-driven systems become more common and cloud architectures begin to appear”, the amount of such high-speed, high-volume data will increase.

I am of the opinion that CEP has a very high potential to enhance workflow management (WfM). Many companies neither have highly automated nor well specified processes. In future more and more companies will make effort to well define and increase the level of automation of their processes. But meanwhile more and more sensors and subsystems that publish state-messages and other fine-granular information in the form of events become part of the companies software-landscapes. Processes will increasingly need to use this event-like data to (automatically) determine which action to take. Workflow Management Systems (WfMS) are not made for processing a huge amount of events. CEP systems are made especially to achieve this.

I think CEP can only be successful and unfold its whole potential if it is well integrated with WfM. CEP will not be successful as isolated system. But both together CEP and WfM form a very powerful integration base for company-wide event integration. A system combining WfM and CEP is able to realize something like an SOA for asynchronous event-like data.

But there is one important point to improve before CEP can be well used in conjunction with WfMSs. Modeling and creation of CEP rules/patterns is too complex. As example I studied Esper as a CEP platform that is very compelling. The Esper Processing Language (EPL) is very powerful but it is also very complex and it is hard to model situations (I call Complex Events, situations, if they have a meaning in a higher-level way).

Finally I think CEP and a combination of CEP/WFMS will only be successful if theres is a way of modeling situations, Events or Rules in such an easy way as BPMN or BPEL in case of Business Processes.

 

My diploma-thesis is ready. Last Tuesday i handed in my thesis.  The only thing that is missing, is a short presentation of what I have worked on. So I will have some time to write a new blog-post about my thesis within the next days.

 

By default JAXWS generates the corresponding datamodel for the generated stubs and skeletons. This has some disadvantages. You cannot reuse the model with diefferent WebServices. In addition if you change the WebService you have to regenerate the model. This is bad particulalry if you manually changed the model.

But there is a solution. There is a concept of so-called binding-files.

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:ext="http://java.sun.com/xml/ns/jaxb/xjc"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:e="http://www.mydomain.com/Entity">
    <jaxb:bindings schemaLocation="./Entity.xsd" namespace="http://www.mydomain.com/Entity" node="/*">
    	<jaxb:bindings scd="~e:Entity">
        	<jaxb:class ref="com.mydomain.model.Entity" />
    	</jaxb:bindings>
</jaxb:bindings>

The wsimport-utility will use the declared class Entity (e.g. generated with JAXB) if you use this switches:

wsimport -Xnocompile -b xml/bindings-file.xml -s src/main/ xml/your.wsdl

 

Some days ago I produced a deadlock on Tomcat-startup. I deployed a class implementing ServletContextListener that instantiates a WebService clientstub object. The problem was that the endpoint was an WebService deployed on the same Tomcat instance.

Everything works fine till restart of Tomcat. On startup Tomcat locks the connector since all web-applications are deployed. Tomcat accepts incoming connections but waits until deployment of all web-applications  is completed. What happens is that the ServletContextListener implementation wants to download the WSDL of the WebService but Tomcat is waiting until all applications are deployed but the deployment-process cannot be completed until the WSDL can be reached.

The consequence is that you shouldn’t access any of the web-applications, in any methods executed on the deployment-phase, deployed on the same tomcat.

 

For my diploma-thesis I need to unmarshall a xml-string. In principle this is no problem, but the xml-string represents a JAXB-Entity that is not annotated with @XmlRootElement. This causes an exception during unmarshalling. Nevertheless you can unmarshall xml using JAXBElement-class.

private YourClass unmarshallFromString(String s) throws JAXBException {
{
    JAXBElement<YourClass> ret = null;
    JAXBContext jaxbCtx = JAXBContext.newInstance(YourClass.class.getPackage().getName());
    Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller();
    //Throw exception if problems occur during parsing
    unmarshaller.setEventHandler(new ValidationEventHandler() {
       public boolean handleEvent(ValidationEvent event) {
         throw new RuntimeException(event.getMessage(), event.getLinkedException());
       }
    });
    Source src = new StreamSource(new StringReader(s));
    ret = unmarshaller.unmarshal(src, EventSources.class);
    return (YourClass) ret.getValue();
}
 

Activiti is a Workflow Mangement System (WfMS) that is completely written in Java. Activiti is a opensource-project initiated by alfresco. Activiti is based on a Process Virtual Machine (PVM). Simplified the PVM can execute graphs consisting of nodes and transitions. Based on this abstraction several graph-based languages can be implemented. Activiti implements BPMN 2.0 and is therefore one of the first Worflow-Engines that is able to execute BPMN 2.0.

Activiti is very flexible and can be easily extended to fit custom needs. One important customization can be done by creating an ActivityBehavior. ActivityBehaviors reflect the behavior of nodes executed by the PVM. The so called ServiceTask-activity has an attribute in its xml-representation that specifies the behavior of this Activity. It looks like this:

<serviceTask activiti:class="MyImplementation" ... >

The class MyImplementation.class or a jar containing the class have to be in {TOMCAT_HOME}/webapps/activiti-rest/WEB-INF/lib/. During runtime Activiti instantiates this class by reflection. But lets continue on how to implement the MyImplementation class.

The implementation should extend org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior. The activiti-engine executes public void execute(ActivityExecution execution) during runtime so if you want to realize custom behavior you have to override this method. At the end you should call leave(ActivityExecution execution) that tells the Engine that the activity is completed.

Some details on the concept “PVM” can be found here

You will be surprised to read about jBPM while I talked about Activiti above. jBPM 4 is also based on a PVM. The lead-architect of the Activiti-Engine is Tom Baeyens. He was a developer of jBPM before he started the work on Activiti. I think he is the/one father of the PVM-abstraction.

http://docs.jboss.com/jbpm/pvm/article/

 

If you want store variables without custom configuration you can store objects or simple-types of type

  • null
  • String
  • Boolean
  • Short
  • Integer
  • Long
  • Date
  • Double
  • ByteArray
  • Serializeable

For the types String to Double not only the object-types but also the corresponding simple-types (http://download.oracle.com/javase/6/docs/api/javax/management/openmbean/SimpleType.html) are supported. The easiest way to store your custom objects is to make them Serializeable. In most cases you only have to add implements java.util.Serializeable to your class definition. Internally Activiti creates a byte-array (byte[]) out of your object and stores this byte-array. If you retrieve this object you will get an object of type java.lang.Object.

 

JAXB stands for Java Architecture for XML-Binding. JAXB maps xml-types to java-classes and vice-versa.
The reference implementation of this java specification causes some problems when used with current Java 6. Java 6 ships with its own JAXB 2.0 implementation that is not compatible to the most current versions JAXB 2.1 and 2.2.
If you use this versions in your applications you have to put the jaxb-api.jar into the JAVA_HOME/lib/endorsed folder of your Java Runtime Environment (JRE). An alternative is to launch your java-application with the runtime-property “java.endorsed.dirs” set to the location of the jaxb-api.jar. For both alternatives you need to ship the implementation jars (e.g. jaxb-impl.jar, …) with your application.

I encountered an additional problem when switching from JAXB 2.1 to 2.2. There was a fix in JAXB 2.1 that improved parsing of abstract xml-types. This enables JAXB to parse xsi:type attribute which allows to use abstract XML-Types that are mapped on an abstract Java-Classes. The concrete type will be declared using xsi:type attribute. This fix was disabled in JAXB 2.2 for some reason. And it have to be enabled using the JAXBContext property com.sun.xml.bind.improvedXsiTypeHandling . The corresponding Bug can be found here: http://java.net/jira/browse/JAXB-620.

You have to set JAXBContext property com.sun.xml.bind.improvedXsiTypeHandling to true.

How to set properties
If you want to set properties on startup of JVM you need to use the switch -D (e.g. java -Djava.endorsed.dirs={path_to_lib} …)

Example of how to use abstract xml-types mapped on abstract classes in java using JAXB

<xsi:complexType name="Animal" abstract="true">
  <xsi:sequence>
    <xsi:element name="name" type="xsi:string"/>
  </xsi:sequence>
</xsi:complexType>
<xsi:complexType name="Fish">
  <complexContent>
     <xsi:extension base="a:animal">
       <sequence>
         <element name="amountOfFins" type="xsi:integer" />
       </sequence>
     </xsi:extension>
  </xsi:complexContent>
</xsi:complexType>
<xsi:complexType name="Mammal">
  <complexContent>
     <xsi:extension base="a:animal">
       <sequence>
         <element name="amountOfLegs" type="xsi:integer" />
       </sequence>
     </xsi:extension>
  </xsi:complexContent>
</xsi:complexType>
<xsi:element name="animalInstance" type="a:animal"/>

An instance of an animal could look like this:

<?xml version="1.0"?>
<animalInstance xsi:type="a:Mammal" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://....../Animal">
  <a:name>Dog</a:name>
  <a:amountOfLegs>4</a:amountOfLegs>
</anInstance>

JAXB is able to unmarshal this instance correctly and create a mammal Java-object. Marshalling is also no problem. So you are able to write generic methods for animals. This is useful especially for WebServices (e.g. using JAXWS). So you don’t have to implement a WebService-operation for every subtype. One operation handling the abstract animal-type is sufficient.

More information on JAXB 2.0

http://jaxb.java.net/guide/Migrating_JAXB_2_0_applications_to_JavaSE_6.html

 

Hello world! Almost always the first lines of code presented in books or courses on programming languages for beginners contain this phrase. I decided to switch the way of publishing content on my homepage. I do not use a new programming language but I switched from mediawiki to wordpress. This reflects the change of manner how I will publish content. It is very hard to publish coherent and complete articles to a topic in a good quality in spare time. While it was hard enough to do this alongside studying at university I will not be able to continue my work on the wiki when I start to work for a company. But I don’t want to completely stop sharing my questions, answers, and ideas with you. In future I will use this blog to publish my experience. Generally this experience will not be coherent and complete. It will reflect my daily work with and on software. I decided to continue my homepage in English which is in fact the IT-Language.

The Softwareengineering-WIKI is still reachable at: http://sr-it.eu/se/

My old site is not reachable anymore.

© 2011 Softwareengineering in practise Suffusion theme by Sayontan Sinha