Moin.

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>

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

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.

Manfred.
RCS file: 
/home/cvspublic/jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/config/ConfigRuleSet.java,v
retrieving revision 1.5
diff -r1.5 ConfigRuleSet.java
67a68
>     private String className= "org.apache.commons.chain.impl.ChainBase";
143a145,161
>     
>     /**
>      * Return the classname that will use to instanciate chains. 
>      * @return Returns the classeName.
>      */
>     public String getClassName() {
>         return className;
>     }
> 
>     
>     /**
>      * Sets the classname that will use to instanciate chains.
>      * @param classeName The classeName to set.
>      */
>     public void setClassName(String classeName) {
>         this.className = classeName;
>     }
161c179
<                                  "org.apache.commons.chain.impl.ChainBase",
---
>                                  getClassName(),

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to