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/13 11:54:34 UTC

[Agila] configuring nodes / tasks in the XML

Here's a few proposals rolled into one which are simple to implement  
but make the Agila XML much more useful and powerful...

Configuring Tasks/Nodes
====================

I'd be really cool to be able to have reusable tasks for Agila then 
configure them on a per workflow basis. e.g. lots of tasks for user 
centric workflows are often pretty much the same logic, just different 
configuration data. So rather than having, say, a Java class for every 
data entry screen; it'd be great to have reusable tasks/nodes and just 
configure them with static data in the workflow.

e.g. something like this - using Spring-esque style configuration...

<node id="foo" class="com.acme.MyAssignTask">
     <property name="screenName" value="EnterCheeseSelection.jsp"/>
     <property name="workGroup" value="PointyHairedBosses"/>
</node>

This translates to the pseudo code

     foo = new MyAssignTask();
     foo.setScreenName("EnterCheeseSelection.jsp");
     foo.setWorkGroup("PointyHairedBosses");


Using Dependency Injection containers
===============================

A nice-to-have is to also allow a Dependency Injection container to be 
used to configure heavy-weight properties such as email systems, JDBC 
database connections and so forth. To do this we could introduce a 
'ref' attribute like Spring uses...

<node id="foo" class="com.acme.JmsSendTask">
     <property name="jmsConnectionFactory" ref="myJmsFactory"/>
</node>

Where the 'ref' attribute forces the use of an InjectionService...

public interface InjectionService {
   public Object getBean(String ref);
}

so in pseudo code the above XML means

     foo = new JmsSendTask();
     Object o = injectionService.getBean("myJmsFactory");
     foo.setJmsConnectionFactory(o);

Then various InjectionService implementations could be used such as 
JNDI, JMX, Spring, Pico, HiveMind, Geronimo etc.


Using well known Aliases to simplify the XML
===================================

For many of the workflow's I'm gonna be using on a system there really 
are 4 types - start, stop, assignTask, approve. To avoid having to type 
(and maybe mis-type) class names; it'd be nice to be able to use 
aliases in the XML.

One simple approach is to just use an alias attribute...

<node id="foo" class="org.apache.agila.whatnot.StartNode">...

turns into

<node id="foo" alias="startNode">

then we just have a properties file which assoicates 'startNode' to the 
full class name we need.


All of the above would absolutely rock. However one more suggestion, 
which is based on use of Spring and wishing to define extended XML 
languages to include domain specific enhancements - is to consider the 
possibility of extending the XML language with user defined XML 
elements, which can be considered 'macros' which can be fully validated 
via an XSD.

e.g.

<startNode id="foo"/>

<stopNode id="bar"/>

<!-- going back to the first example.... -->
<assignTask screenName="EnterCheeseSelection.jsp" 
workGroup="PointyHairedBosses"/>


The benefit is, much more concise XML which can be explicitly validated 
for people wishing to write extended schemas to match their workflow 
ontologies. The nice thing about all of this for Agila is that the core 
can pretty much stay exactly as it does right now but allowing node 
based property-configurations and then others can use a derived XML 
language which can trivially transform down to the core Agila XML.

Thoughts?

James
-------
http://radio.weblogs.com/0112098/


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@incubator.apache.org
For additional commands, e-mail: general-help@incubator.apache.org