Olaf Bergner wrote:
I finally managed to get an embedded merlin kernel up and running. Wasn't that hard after al ;) What's more, I think I can see how I can access components managed by merlin:
final Appliance app = kernel.locate("/container-name/component-name"); final Object component = app.resolve();
Is this the way to go?
Yep!
I currently have a minimal setup where one SampleComponent implementing the
work interface Sample is managed inside merlin. Calling app.resolve()
returns a DynamicProxy wrapping SampleComponent as revealed by calling
toString() on it (-> [EMAIL PROTECTED]). What puzzles me is that
I cannot cast this proxy to the Sample.
Does that component type declare that it exports the service .. ie:
@avalon.service type="whatever.Sample"
The relevant code in merlin (mostly
in DefaultAppliance, I think) seems to be pretty straightforward. Still, the
proxy does not implement any interfaces.
The proxy is supplied with the interfaces that the component exports (according to the <services> suite) and automatically supports these services (or more correctly - automatically isolates the component down to these interfaces).
Smells like a configuration problem, yet I double checked SampleComponent.xinfo, sample.block and even looked inside the jar. What am I doing wrong here?
Based on what you describe below - then a locate on "/org.merlinaop.samples/sample" will return the appliance managing SampleComponent. You can invoke resolve() against this appliance and you should get a proxy that is narrowable to the Sample interface.
Steve.
Cheers,
Olaf
samples.SampleComponent.xinfo:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE type PUBLIC "-//AVALON/Type DTD Version 1.0//EN" "http://avalon.apache.org/dtds/meta/type_1_1.dtd" >
<type> <info> <name>sample</name> <version>1.0.0</version> <lifestyle>singleton</lifestyle> </info> <services> <service type="samples.Sample"/> </services> </type>
sample.block:
<container name="org.merlinaop.samples">
<classloader> <classpath> <repository> <resource id="avalon-framework:avalon-framework-impl" version="4.1.5"/> <resource id="merlin-aop/samples:merlin-aop-samples" version="0.1"/> <resource id="merlin-aop/aspects:merlin-aop-aspects" version="0.1"/> </repository> </classpath> </classloader>
<component name="sample" class="samples.SampleComponent"/>
</container>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Stephen J. McConnell mailto:[EMAIL PROTECTED]
|------------------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org/merlin | | http://dpml.net/ | |------------------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
