cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti-OSGi and custom FormType

ronnybr
Champ in-the-making
Champ in-the-making
Hello everyone,

I am trying to convert my kinda monolitic Activiti-application to an OSGI-based one.
In my process definition I use a custom formtype for URLs.
When trying to deploy the bundle/process I get an exception, that Activiti doesn't know about the formtype "url".

This makes sense to me, because when using the StandaloneProcessEngineConfiguration I had to register my formtype like this:

   <bean id="processEngineConfiguration"
[…]
      <property name="customFormTypes">
         <bean class="de.data.experts.activiti.transfer.UrlFormType"/>
      </property>
   </bean>


And that's my question: is there a way to tell the ConfigurationFactory, ProcessEngineFactory, ProcessEngineConfiguration, BluePrintELResolver or anyone else about my formtype, so that the Engine will find it during deployment?
4 REPLIES 4

ronnybr
Champ in-the-making
Champ in-the-making
Well, I was hoping for some more responses.
In the meantime I tried subclassing ConfigurationFactory and some other things but nothing worked.

Maybe that's a sign that ConfigurationFactory could be improved to support custom formtypes.

frederikherema1
Star Contributor
Star Contributor
The ConfigurationFactory exposes a StandaloneProcessEngineConfiguration… Use that to call setCustomFormTypes BEFORE the process-engine has been initialized, or call getFormTypes.add() AFTER the process-engine has been initialized to get the custom types picked up…

ronnybr
Champ in-the-making
Champ in-the-making
Thank you for your answer Frederik.
I suppose adding formtypes before the initialization of the process-engine won't work with blueprint, because my blueprint-wrapper-bundle gets started before my process-bundle.

I tried to add my custom formtype after creation with a bundle activator and it worked, you can see the code here: https://gist.github.com/anonymous/6137726

I know I gotta change the thing with Thread.sleep() but I am happy so far, that it's working.
Maybe I'll find a way to make it more blueprint-like and put the lookup into a content.xml.

frederikherema1
Star Contributor
Star Contributor
Glad to see it working. Feel free to share a better/cleaner approach.