At 08:28 PM 1/5/2005, you wrote:
Instead of
actionData.nestedComponent =
Loader.loadClass(className).newInstance();
-
+ if(actionData.nestedComponent instanceof Component) {
+ ((Component)
actionData.nestedComponent).setLoggerRepository(this.repository);
+ }
Could you do something like:
actionData.nestedComponent = this.repository.createComponent(className);
that does not look too difficult:
public class Hierarchy implements LoggerRepository {
...
public Object createComponent(String className) {
Object o = Loader.loadClass(className).newInstance();
if(o instanceof Component) {
((Component) o).setLoggerRepository(this);
}
}
}
The only major issue with this approach occurs when the repository is
null, the repository.createComponent(className) call would bomb while
ActionBase.getLogger() would return valid ULogger even when the
repository is not set (i.e. null).
My basic working assumption has been that owning repository is allowed
to be left blank. To be honest, I am quite happy with the current
approach. It is well aligned with the current component initialization
pattern prevalent in log4j code, that is:
Component c = new Component();
c.setOption1(...);
c.setOption2(...);
c.activateOptions();
This pattern has the advantage of malleability. It has proven to be
highly tolerant of future extensions. Having said that, I welcome any
suggestions for objective improvements.
--
Ceki G�lc�
The complete log4j manual: http://www.qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]