Hi,

Sorry for reposting this yet again, and to both lists, but I haven't been able to find a solution to something that I think should work, (at least according to the cocoon wiki, which specifically mentions that one of the uses for mounts having their own cocoon.xxonf files is to define datasources).

The scenario is that I can access components defined in sub-cocoon.xconf files, but only if they don't require a ComponentSelector. If they require a ComponentSelector it can't find the component and I get errors.

On Thursday, October 31, 2002, at 09:38 AM, Justin Fagnani-Bell wrote:

So I still don't know the answer to this question, but while experimenting trying to find the answer I discovered that I can't access any components defined in a sub-cocoon.xconf that require a ComponentSelector, specifically a datasource.

I have one component that's defined in my sub-cocoon.xconf and takes a parameter that's the name of a datasource,
To clarify, it looks like this in cocoon.xconf:

<datasources>
<jdbc name="NodeDB">
<pool-controller min="1" max="5"/>
<dburl>jdbc:mysql:///something</dburl>
<user>someone</user>
<password>somepass</password>
</jdbc>
</datasources>

<node-store class="com.paralian.kompas.SQLNodeStore" pool-max="1" pool-min="1">
<parameter name="datasource" value="NodeDB"/>
</node-store>

The SQLNodeStore loads fine, the following code is in its parameterize method

I get an Excalibur error when that component tries to load the datasource. here's the code:

this.dataSourceName = params.getParameter("datasource","NodeDB");
debug("SQLNodeStore.parameterize(): dataSourceName="+dataSourceName);
ComponentSelector selector = (ComponentSelector) manager.lookup(DataSourceComponent.ROLE + "Selector");
this.datasource = (DataSourceComponent) selector.select(dataSourceName);

and here's the error from the log file:

DEBUG (2002-10-31) 09:24.36:845 [cocoon ](/projects/spectra/) Thread-5/SQLNodeStore: SQLNodeStore.parameterize(): dataSourceName=NodeDB
DEBUG (2002-10-31) 09:24.36:845 [cocoon ](/projects/spectra/) Thread-5/ExcaliburComponentSelector: UnnamedSelector: ComponentSelector could not find the component for hint: NodeDB

This all works fine if the components are defined in the main cocoon.xconf file. I know the sub-cocoon.xconf file is being read because I can load my SQLNodeStore component. I think what's happening is that there's a seperation between the two cocoon.xconf files, and when I load the ComponentSelector I'm getting a ComponentSelector for the main file, which doesn't have a datasource called NodeDB. Is this possible? If so, is this a bug, or do I need to do something > different?

Any help is much appreciated.

Thanks,
Justin


On Tuesday, October 29, 2002, at 01:51 PM, Justin Fagnani-Bell wrote:

Good afternoon (in Cali),

As I mentioned in my last email (anyone figure an answer yet? I haven't), I'm trying to keep all my Cocoon projects running live on my development server via auto mounting sub-sitemaps. The ability for each mount to have it's own cocoon.xconf file seems to be the last piece that makes this possible.

I setup datasources and some custom components in cocoon.xconf. My question is how are name conflicts dealt with if you have components with the same name in the main cocoon.xconf file and the sub cocoon.xconf file?

More specifically, if I have this in my code:

public void compose(ComponentManager manager) throws ComponentException {
super.compose(manager);
if (nodeStore == null) {
this.nodeStore = (NodeStore)manager.lookup(NodeStore.ROLE);
}
}

and I have a NodeStore component defined in both cocoon.xconf files, is there any guarantee which component I will get? (the reason it matters is because my NodeStores are setup up to access different databases)

Thanks,
Justin

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to