Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
29697
Description
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()
>
>
> /**
> * Sets the classname that will use to instanciate chains.
> * @param classeName The classeName to set.
> */
> public void setClassName(String 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.