commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manfred Wolff <>
Subject [commons-chain] Configuration of the ChainBase class
Date Thu, 17 Jun 2004 18:23:40 GMT

Short description: We use commons-chain in a productive project for 
configuring strategies and filters. The user itsself should be able to 
customize the chains and brings the right order in chains (commands, 
filters ...). Some commands has dependencies to other commands so it 
might be the situation, that a command b can only be executed if a 
command a is still executed in the same chain. At runtime it is no 
problem to check such dependencies (b can look into the context if a has 
done his work). But because of the posibility of configuration the 
chains by customer it might be a good idea to do a check at the start of 
the app so configuration errors might not come into being at runtime.

For that I have subclassed the Command, the ChainBase etc. Unfortunaly 
in the class that have to be instanciated 
(org.apache.commons.chain.impl.ChainBase) is hard coded in the 
ConfigRuleSet class. So I have subclassed the RuleSet, the ConfigParser 
... I think it make no sense to subclass all classes of a framework so I 
like to contribute a solution for generic instanciation support. For me 
it is enough to make the instanciaten class configurable (see my diff 
patchConfigRuleSet.txt). So I can subclass the ConfgParser and set the 
className attribute if needed. I have still some other solutions 
expanding the configuration file. All is possible by subclassing.

A new feature were good: It might be possible to configure chains in 
chains like that:

  <chain name="single">
      <command className="org.strutsit.chain.CommandForTestSomething"/>
      <command className="org.strutsit.chain.CommandForTestAnything"/>

  <chain name="depend">
      <chain refid=single"/>
      <command className="org.strutsit.chain.CommandForTestFalse"/>
      <command className="org.strutsit.chain.CommandForTestTrueDepend"/>

In the moment I have no knowledge how to configure a digester to do such 
things. If anybody has please contact me. I will implement the rest and 
contribute it too.

Thanks a lot.


View raw message