commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Soosaiarul <sebastian.soosaia...@gmail.com>
Subject Configurable dispatch command
Date Thu, 13 Dec 2012 03:28:47 GMT
Hi,

 I am new to Commons chain framework and started working on a prototype for
my project. I did some work with 'command' and 'chain' and it worked fine.
But i have a requirement to perform 150 different tasks and those can be
executed by configuring different combination of chains in a catalog.xml
file. In this case, if i use command, i should write 150 classes to perform
those many tasks. As per the requirement all should be independent command.
 We think that it is a huge set of classes for our project just for some
validation.

 So i thought, i can use DispatchCommand. I tried, but it cannot be
configured in *catalog.xml* file instead we should handcode to call a
particular method in our program. If i want to execute series of command,
looks like i should set the test method in dispatch action before executing
some series of commands like below.

We are planning to have all these classes in our own jar file. This results
no option to write any code after building the jar and we should be able to
configure different combinations of chains available commands. And this is
not possible if i use dispatchcommand i believe.


Can dispatch command be configurable in *catalog.xml* file like command by
having one more parameter "methodKey" like below?

*<?xml version="1.0" encoding="UTF-8"?>*
* <catalog name="cat">*
*  <chain name="chain1">*
*   <dispatchcommand className="com.chain.test.ommands.MyClass1"
methodKey="myMethod1"/> *
* <dispatchcommand className="com.chain.test.ommands.MyClass1"
methodKey="myMethod2"/>*
* <dispatchcommand className="com.chain.test.ommands.MyClass1"
methodKey="myMethod3"/>*
* <dispatchcommand className="com.chain.test.ommands.MyClass1"
methodKey="myMethod4"/>*
*  </chain>*
*  *
*  <chain name="chain2">*
*   <dispatchcommand className="com.chain.test.ommands.MyClass2"
methodKey="myMethod2"/>*
* <dispatchcommand className="com.chain.test.ommands.MyClass1"
methodKey="myMethod3"/>*
* <dispatchcommand className="com.chain.test.ommands.MyClass1"
methodKey="myMethod4"/>*
*  </chain>*
*</catalog>*

In this way, i have my own choice of defining different combinations of
chain for methods. I am thinking this doesnt require a code change but just
configuration on catalog.xml.

Can you throw some light on it?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message