I was thinking about a new feature to partition the classpath into
public and private (or api and impl) sections in the block.xml. This
would allow a block.xml that is exporting one or more services to define
the jars for its service's APIs in a public section of the classpath.
Then, if that block.xml or jar was included in a higher level container,
that container would include the public section of the included block's
classpath in it's classpath.
This would ensure is that the classes for a service API would be defined
in the correct classloader so that any client of that service would be
able to access it without running into classloader grief.
A potential complication could arise if a container includes a block,
then exports services from that included block. I haven't fully thought
through how that would work, but it doesn't seem too bad to solve.
My main motivation is to allow me to define groups of components in
jars, and be able to include them into higher level containers without
(preferably) having to modify the classpath of that higher level
container.
Any thoughts or opinions? I'll try to take a stab at an implementation
this weekend to flesh out my example a bit better.
Example: A FooService is specified in the block.xml included in
foo-impl-1.0.jar. FooService's interface is defined in foo-api-1.0.jar,
and it uses a data object defined in foo-bean-1.0.jar. Since these are
defined in the api section of the block's classpath, when the block is
included in the the root container, those artifacts are promoted to the
root container's classpath.
root-block.xml:
<container name="root">
<classpath>
<impl>
<repository>
<resource id="bar:foouser-impl" version="1.0"/>
<!-- ... -->
</repository>
</impl>
</classpath>
<include name="fooService" id="bar:foo-impl" version="1.0"/>
<component name="fooUser" class="com.bar.foouser.impl.FooUserImpl"/>
</container>
nested-block.xml:
<container name="nested">
<services>
<service type="com.bar.foo.FooService">
<source>fooService</source>
</service>
</services>
<classloader>
<api>
<repository>
<resource id="bar:foo-api" version="1.0"/>
<resource id="bar:foo-bean" version="1.0"/>
</repository>
</api>
<impl>
<repository>
<resource id="bar:foo-impl" version="1.0"/>
<!-- ... -->
</repository>
</impl>
</classloader>
<component name="fooService" class="com.bar.foo.impl.FooServiceImpl"/>
</container>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]