You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/06/20 13:44:35 UTC

DO NOT REPLY [Bug 29697] New: - [chain] Make the impl. class of chainbase configurable

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29697>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29697

[chain] Make the impl. class of chainbase configurable

           Summary: [chain] Make the impl. class of chainbase configurable
           Product: Commons
           Version: 1.0 Alpha
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Sandbox
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: mail@manfred-wolff.de


Unfortunaly in the class that have to be instanciated
(org.apache.commons.chain.impl.ChainBase) is hard coded in the ConfigRuleSet
class. I contribute a patch, where you can configure the concrete instance,
that will be instanciated.

-----> patch

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(),


-----> concrete

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.

Thanks a lot.

Manfred.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org