You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@incubator.apache.org by ja...@mac.com on 2004/11/30 11:58:32 UTC

[PATCH][Agila] support for setting properties on Nodes in a DI style

Attached is a patch which adds Spring-style dependency injection to the 
configuration of Nodes/Tasks in the Agila XML using a <property> 
element.

e.g.

             <node id="3" type="activity" 
class="org.apache.agila.example.LeaveApplicationTask" 
display_name="Leave Application">
                 <property name="foo" value="hello"/>
                 <property name="bar">123</property>

                 <actors>
                     <actor name="Self"/>
                 </actors>
                 <bindings>
                     <binding name="numdays" type="el" datatype="String" 
value="numdays" input="true" output="true"/>
                     <binding name="reason" type="el" datatype="String" 
value="reason" input="true" output="true"/>
                 </bindings>
             </node>

Currently only primitive type properties are supported.

Later on we could add a 'ref' attribute as an alternative to 'value', 
like Spring, to allow a full dependency injection container like 
Spring, Pico, HiveMind or even GBeans to be used to lookup some named 
object to be set as a property on a task. e.g. if a Task has to do some 
JDBC / email / JMS operations - we should use a real DI container for 
configuring those services and just refer to them from inside the Agila 
XML.

e.g.

<!--- look  up some DataSource in the current ResolverService instance 
which could be Spring / JNDI / JMX etc -->
<property name="dataSource" ref="myCustomerDatabase"/>


But for now, the use of primitive types should be enough.