I'm in the process of porting an application to Merlin (version 3.2.5 in
this case), and I'm trying to figure out the classloader relationship
for nested block xmls.
The scenario:
I have DAO component that uses cornerstone-datasources to get it's DB
connection. Ideally, I'd like to have in my block.xml something like:
<classloader>
<classpath>
<repository>
<resource id="myGroupId:myComponent" version="1.0"/>
</repository>
</classpath>
</classloader>
<include name="dataSource"
id="cornerstone-datasources:cornerstone-datasources-impl" version="1.0">
<target name="/manager">
<configuration/> <!-- specific JdbcConnectionPool setup here -->
</target>
</include>
<!-- uses DataSource: -->
<component name="myComponent" class="bar.foo.myComponent"/>
This allows me to not have to figure out all the dependencies of
cornerstone-datasources and include them in the classloader section of
my outer block.xml.
The problem:
Since myComponent uses cornerstone-datasources it needs to be able to
load the API class from cornerstone-datasources-api. This is no
problem, I can add that to the classpath (and it makes sense for me to
do so). Next problem - DataSourceSelector returns a DataSourceComponent
(from excalibur-datasource) so that class has to be available to
myComponent. However, if I add excalibur-datasource to the classpath,
it now fails because of unresolvable dependencies of
excalibur-datasource (excalibur-pool, commons-collections, etc). Now
I'm back to the situation of having to figure out all the dependencies
for cornerstone-datasources.
It seems like once the classloading mechanism has resolved a class from
one classloader, any dependent classes have to be resolved from the same
or parent classloader.
Maybe cornerstone-datasources is a bad example, since its api is really
a combination of cornerstone-datasources-api + excalibur-datasource, and
excalibur-datasource is a fairly heavy jar.
Anyhow, I bring this up because I'd like to package my components in
such a way that I don't have to track down their dependencies when I
want to assemble an application. The component contains a block.xml and
classloader section for all its dependencies, and a user of that
component just imports its api and includes its impl in its block.xml.
I'm wondering if there is a better approach than I've taken so far.
Regards,
-Cameron
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]