cancel
Showing results for 
Search instead for 
Did you mean: 

I've implemented an extensible BPMN parser for Activiti

iravanchi
Champ in-the-making
Champ in-the-making
As a part of my project, I needed to extend BPMN parser to support my own activities in the process definition.
I imported a few of the source codes of Activiti into my project and implemented the following solution:

BpmnParser supports multiple xmlns definitions, and each element / attribute is delegated to a handler class depending on its xmlns. Handlers can be added in the BpmnParseListener implementations. So, by implementing custom deployers, a developer can easily extend the activities and BPMN notation.

I refactored the current parser to my new design, and it passes the initial tests. I think it's pretty good support for extensibility. It passed the few tests that I did. For example, I could successfully run the following process:

<definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
          xmlns:activiti="http://activiti.org/bpmn-extensions"
          xmlns:io="http://my/custom/namespace"
             xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 BPMN20.xsd"
             typeLanguage="http://www.w3.org/2001/XMLSchema"
             expressionLanguage="http://www.w3.org/1999/XPath"
             targetNamespace="http://www.activiti.org/bpmn2.0">

   <process id="fileCopyTest" name="File Copy Test">

      <startEvent id="theStart"/>

      <sequenceFlow id="flow1" sourceRef="theStart" targetRef="readFromSource"/>

      <io:readFile id="readFromSource" sourceFile="D:\new.txt" targetVariable="fileContent" />
      
      <sequenceFlow id="flow2" sourceRef="readFromSource" targetRef="writeToTarget" />
      
      <io:writeFile id="writeToTarget" sourceVariable="fileContent" targetFile="D:\new-copied.txt" />

      <sequenceFlow id="flow3" sourceRef="writeToTarget" targetRef="theEnd" />

      <endEvent id="theEnd"/>

   </process>
</definitions>

Now I want to contribute the code to the original project, so that I can give you a hand, and plus if the custom code is included in the JAR files, the maintenance would be easier for me too. I have already created the accounts, and will send the form to you too, but here are a few questions:
1. What's your idea about the whole thing?
2. Do you think that it can be included in the 5.0.rc? or GA? (I think a few other people are waiting for this feature too)
3. I have different coding style setup, and my code will look a bit different. Should I change it, or can you reformat the code to match yours when merging with Trunk?

-Hamed
20 REPLIES 20

iravanchi
Champ in-the-making
Champ in-the-making
Anyone reading / following this thread, please note that I'm continuing discussion about extending the BPMN parser in a different thread here:
http://forums.activiti.org/en/viewtopic.php?f=4&t=371