You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by tr...@units.it on 2007/05/17 17:47:38 UTC
ServiceSelector: it's possible to get an Enumeration?
Hi to all,
I'm writing a class whitch implements CronJob for use with the
cocoon-cron-block.
In the execute method I have to perform a select for any datasource
defined in cocoon.xconf.
I've written:
public void execute(String name) {
ServiceSelector selector=null;
try {
selector = (ServiceSelector)
manager.lookup(DataSourceComponent.ROLE+"Selector");
/* I NEED HELP HERE */
this.manager.release(selector);
} catch (ServiceException e) {
e.printStackTrace();
}
}
selector is really an instance of WrapperServiceSelector. Inside the
object there is an ExtendedComponentSelector where a HashTable has an
entry for each datasource deined in cocoon.xconf.
But I do not find any way to get the keys out. If I know the
datasource name I can perform a select, of course. But I *do not* know
the datasource names!
Can anybody help me?
Otherwise I could define datasources in a separate xml file, include
it in cocoon.xconf, read the same file form my class with an
InputStream to get the datasource names and finally select the
connection. But I don't like this "solution" very much.
Thank's for any help,
bye
romano
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: ServiceSelector: it's possible to get an Enumeration?
Posted by Joerg Heinicke <jo...@gmx.de>.
On 17.05.2007 17:47, trampus@units.it wrote:
> selector is really an instance of WrapperServiceSelector. Inside the
> object there is an ExtendedComponentSelector where a HashTable has an
> entry for each datasource deined in cocoon.xconf.
>
> But I do not find any way to get the keys out.
Neither ServiceSelector [1] nor the older ComponentSelector [2] (the
actual interfaces) support this feature. You probably need to extend the
classes in use yourself or try to work with introspection. If you have a
look at the super class of ExtendedComponentSelector, the
ExcaliburComponentSelector [3, 4], you can see a protected method
getComponentHandlers(). The keys in this map are the actual hints used
for ComponentSelector.select(hint).
Hope this helps,
Joerg
[1]
http://excalibur.apache.org/apidocs/org/apache/avalon/framework/service/ServiceSelector.html
[2]
http://excalibur.apache.org/apidocs/org/apache/avalon/framework/component/ComponentSelector.html
[3]
http://excalibur.apache.org/apidocs/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.html
[4]
http://svn.apache.org/viewvc/excalibur/trunk/deprecated/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java?revision=506259&view=markup
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org