I'm trying to implement a ComponentSelector that manages my datasources. Instead of having to configure all of them in a configuration file I'd like them to be created at runtime. If the select method is called with a hint that not denotes a previously added component a new component should be added to the selector.
Does this concept make sense or would the avalon-way be different?
I tried to extend the ExcaliburComponentSelector by overwriting the select method:
public Component select(Object hint) throws ComponentException {
try {
return super.select(hint);
} catch (ComponentException ce) {
DefaultConfiguration cfg = new DefaultConfiguration("", "-");
// setup configuration
addComponent(hint, MyComponent.class, cfg);
return select(hint);
}
}but the selector refuses to add components to a initialized selector. (org.apache.avalon.framework.component.ComponentException: Cannot add components to an initialized ComponentSelector) Why?
I'm using cocoon and a DBMS with some databases. I want to be able to add databases and use them from cocoon without having to restart cocoon (which would be necessary if I just added them to the cocoon.xcont). I want to use the hint as the database name and provide a template configuration to the selector for other options.
Should I just write my own ComponentSelector and copy the stuff I need from the ExcaliburComponentSelector? (I don't really like the idea... code duplication is evil! ;-)
Thanks for help!
David
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
