David Bernard wrote:
Hi Stephen,
You can do some stuff within a component declared as a container byMay I'm stupid, but I don't find how to access to sub-component of a container. Could you provide some examples.
getting the context classloader - however - this is very likely to
change in favour of some sort of declared appliance listener. Can you
give me some more information on what you want to do?
in block.xml something like :
<container name="foo" class="MyContainer"> <component name="subbar-a" class="BarClass"/> <component name="subtoto-b" class="TotoBClass"/> <component name="subtoto-c" class="TotoCClass"/> </container>
where TotoBClass and TotoCClass implement TotoInterface (and service).
in MyContainer, I need a way to have instance "subbar-a", "subtoto-b",
"subtoto-c" when they were ready.
foo depends of subxxx, when stuff is requested to foo, foo use subxxx to do
stuff. foo is like a facade for sibbling component.
If I understand correctly, everyting you want is alredy done for you if you use an included block instread of <container/>. For example - consider the following block definition - it imports another block defined in a file name facard.xml. The imported block looks like a component to the other components at the same level as the import.
block.xml
<block>
<implementation>
<!-- declare a classloader containing the api so we
can import a service --> <classloader>
<classpath>
<repository>
<resource id="david:facard-api"/>
</repository>
</classpath>
</classloader> <!-- import the the composite component (will appear
as a component providing service expressed in the
block services directive --> <include name="facard">
<source path="facard.xml"/>
</include> <!-- declare a component that will consume a
service exported by facard.xml --><componet type="MyFacardConsumer" name="consumer"/>
</implementation>
</block>
Inside facard.xml you declare a simulated component by exporting a seb-set of services and declaring the implementation strategy. The exported services are exposed into the containment space in which the facade.xml is included. Merlin will automate the construction of a proxy that handles redirection of calls from the exposed virtual service interface to the implementation components defined in facard.xml.
<block>
<!-- declare the services that should be exported -->
<services>
<service type="MyContainer">
<source>manager</source>
</service>
</services><!-- declare the implementation strategy -->
<implementation>
<classloader>
<classpath>
<repository>
<resource id="david:facard-api"/>
<resource id="david:facard-impl"/>
</repository>
</classpath>
</classloader><component name="subbar-a" class="BarClass"/> <component name="subtoto-b" class="TotoBClass"/> <component name="subtoto-c" class="TotoCClass"/> <component name="manager" class="MyAggregatorComponent"/>
</implementation>
</block>
Is it possible to find component with its path (partitionName)?
Yes, providing you have access to a parent appliance.
snippet of code, please.
Hopefully the above XML should do what you want.
Cheers, Steve.
--
Stephen J. McConnell mailto:[EMAIL PROTECTED] http://www.osm.net
Sent via James running under Merlin as an NT service. http://avalon.apache.org/sandbox/merlin
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
