joelkoz
Apr 14th, 2006, 05:17 PM
I've been working with the jBPM 3.1 intetegration code, and I came across an issue. I've submitted a JIRA issue (MOD-115) (http://opensource.atlassian.com/projects/spring/browse/MOD-115), along with patch, but I thought others here may be interested so I'm posting in the forum:
The original purpose of jBPM's "action delegate" functionality was to allow properties in an action handler to be set to values specified in the process definition. The Spring-Jbpm integration takes advantage of this to specify the Spring bean name the JbpmHandler delegates to. However, this moves the "wiring" of action handler properties exclusively to Spring. It is sometimes desireable to allow the PROCESS DEFINITION to specify the values of certain properties of an action handler. This allows, among other things, the creation of reusable handler components, where the process definition specifies certain parameters to handler.
I have created a patch that re-enables the process definition to pass in parameters IN ADDITION to using Spring IoC, giving us the best of both worlds. Spring IoC can be used to wire the handler with infrastructure code (like data access objects, service objects, etc.). The Process Definition can contribute to the handler by specifying certain run-time parameters.
The patch centers around adding an optional <targetProperties> to the action handler definition. An action can now optionally be defined such as this:
<action config-type="bean" class="org.springframework.workflow.jbpm.JbpmHandler">
<beanName>SpringJbpmAction</beanName>
<factoryKey>myFactoryInstance<factoryName>
<targetProperties>
<somePropertyInSpringJbpmAction>the new value for the property</somePropertyInSpringJbpmAction>
<someIntegerProperty>5</someIntegerProperty>
...
</targetProperties>
</action>
The JbpmHandler implements <targetProperties> by passing the contents of <targetProperties> to the jBPM code that normally handles "action delegate" configuration as described in section 16.2.3 of the jBPM docs (http://docs.jboss.com/jbpm/v3/userguide/jpdl.html#configurationofdelegations). Thus, anything that formerly could have been specified for the configuration of an action delegate can now be specified by putting the configuration inside of <targetProperties>
Use of this feature requires that the target handler (in the example, "SpringJbpmAction") NOT be declared as a singleton, since each instance can have a different configuration (that is the whole purpose of the patch!)
The original purpose of jBPM's "action delegate" functionality was to allow properties in an action handler to be set to values specified in the process definition. The Spring-Jbpm integration takes advantage of this to specify the Spring bean name the JbpmHandler delegates to. However, this moves the "wiring" of action handler properties exclusively to Spring. It is sometimes desireable to allow the PROCESS DEFINITION to specify the values of certain properties of an action handler. This allows, among other things, the creation of reusable handler components, where the process definition specifies certain parameters to handler.
I have created a patch that re-enables the process definition to pass in parameters IN ADDITION to using Spring IoC, giving us the best of both worlds. Spring IoC can be used to wire the handler with infrastructure code (like data access objects, service objects, etc.). The Process Definition can contribute to the handler by specifying certain run-time parameters.
The patch centers around adding an optional <targetProperties> to the action handler definition. An action can now optionally be defined such as this:
<action config-type="bean" class="org.springframework.workflow.jbpm.JbpmHandler">
<beanName>SpringJbpmAction</beanName>
<factoryKey>myFactoryInstance<factoryName>
<targetProperties>
<somePropertyInSpringJbpmAction>the new value for the property</somePropertyInSpringJbpmAction>
<someIntegerProperty>5</someIntegerProperty>
...
</targetProperties>
</action>
The JbpmHandler implements <targetProperties> by passing the contents of <targetProperties> to the jBPM code that normally handles "action delegate" configuration as described in section 16.2.3 of the jBPM docs (http://docs.jboss.com/jbpm/v3/userguide/jpdl.html#configurationofdelegations). Thus, anything that formerly could have been specified for the configuration of an action delegate can now be specified by putting the configuration inside of <targetProperties>
Use of this feature requires that the target handler (in the example, "SpringJbpmAction") NOT be declared as a singleton, since each instance can have a different configuration (that is the whole purpose of the patch!)