cancel
Showing results for 
Search instead for 
Did you mean: 

activiti-osgi BluePrintELResolver and activiti:expression

workflowuser2
Champ in-the-making
Champ in-the-making
Hi,

I have two bundles:
activiti-osgi-karaf that starts process engine, listen for JavaDelegates (ref. Activiti In Action).
activiti-osgi-process: contains process .bpmn20.xml files and java delegates

I am using BluePrintELResolver to resolve OSGi reference of JavaDelegates using the syntax:
<serviceTask id="foo" activiti:delegateExpression=${javaDelegateService} />

The above works (as explained in Activiti In Action book)

I would like to define a bean (not an OSGi service) in the activiti-osgi-process blueprint context xml file:
  <bean id="greetingsBean"
      class="com.dell.pg.merlin.workflow.applyprofile.GreetingsBean" />


I would like to be able to call a particular method on this bean.
In other words, I would want the following to work in the process Service Task definition:
activiti:expression=#{greetingsBean.getFoo()}

However, I am getting error that greetingsBean property could not be resolved.

Do I need to chain another ELResolver to resolve beans in the blueprint context? BlueprintELResolver seems to be resolving only JavaDelegates.

Any help is greatly appreciated.

thanks
activiti-newbie
6 REPLIES 6

frederikherema1
Star Contributor
Star Contributor
In the activiti config, you can define "beans" which are exposed in expressions. This is a map of beans on the config (http://activiti.org/userguide/index.html#exposingConfigurationBeans). If you're in spring-context, all spring-beans are exposed UNLESS you define any value in the ProcessEngineCOnfiguration.beans property.

workflowuser2
Champ in-the-making
Champ in-the-making
In the activiti config, you can define "beans" which are exposed in expressions. This is a map of beans on the config (http://activiti.org/userguide/index.html#exposingConfigurationBeans). If you're in spring-context, all spring-beans are exposed UNLESS you define any value in the ProcessEngineCOnfiguration.beans property.

Hi frederikheremans

I was referring to "blueprint" container managed beans and not Spring container managed.

frederikherema1
Star Contributor
Star Contributor
Sorry, was too quick to respond… The BlueprintELResolver resolves to classes added by the "bindService" method. It would be good if this resolved was aware of the blueprint-context. If you have a suggestion on how to implement this, we're always happy to accept patches for this.

workflowuser2
Champ in-the-making
Champ in-the-making
Sorry, was too quick to respond… The BlueprintELResolver resolves to classes added by the "bindService" method. It would be good if this resolved was aware of the blueprint-context. If you have a suggestion on how to implement this, we're always happy to accept patches for this.

Hi frederikheremans,

I got some ideas from the following post:
http://forums.activiti.org/en/viewtopic.php?f=4&t=896

I have created a patch (attached) that chains two ELResolvers (BluePrintContextELResolver and existing BlueprintELResolver). Let me know your thoughts.
If you would like me to commit these changes, please share instructions to do so.

Next, I had the following questions:
- bundle activiti-osgi-karaf : starts activiti process engine.
- bundle activiti-osgi-process: contains process def.

The above solution resolves OSGi entities available in the blueprint-context within "activiti-osgi-karaf" bundle.

However, we have a use case where a process designer might want to create new beans (to refer into process) and specify them into blueprint-context file under activiti-osgi-process bundle

How can we point EL Resolver to point to activiti-osgi-process osgi container?
It would be good to be able to point to both or selectively one of these two.

The classpath from both bundles are already available.
Thanks again.

Activiti Newbie

frederikherema1
Star Contributor
Star Contributor
Your patch seems to be a fine addition to the existing process-configurations and I could add it to the codebase without any problem I guess, since existing osgi-configuration is not affected.

If you want to contribute yourself, check out http://activiti.org/faq.html#HowToBecomeAContributor, ping me when you're interested, I can follow up this process.

About the other issue (exposing other contexts), can you come up with a solution that allows plugging the context in using a similar approach you suggested for the BluePritnCOntextElResolver? I'm kind of a noob when it come to osgi, but I'm planning on looking into osgi a bit deeper in august.

workflowuser2
Champ in-the-making
Champ in-the-making
frederikheremans,

I will setup my account and ping you when I am ready for the next steps.