Hi,
On 06.04.2012, at 22:49, Fabio Fonseca wrote:
>
> Hi All!
>
> I'm trying to make the Comanche SCA example to work with iPOJO. This example
> application is a very simple web server and is used everywhere with SCA. The
> problem is that different components of this application implements the same
> java interface.
>
> In the SCA + Fractal component model world (Frascatti), this is not a
> problem, since the software can be assembled by direct referencing the
> desired instance. But this is a problem with OSGi/iPOJO, since, as far as I
> know, the bind is done automatically and the key for this mechanism is the
> unicity of the interface implemented by the component, which identifies the
> component.
>
> When not using composites, I found a workaround for this problem by
> specifying a name for a instance and using this name in the component
> declaration, in the '<requires from="RequestDispatcher"...' key.
>
> However, I'm facing a problem trying to use composite to assemble the
> Comanche application. I'm trying to build a composite who encapsulates 3
> components that implement the same interface. This composite has to export
> one specific instance to be used by the parent scope. To accomplish this, I
> did the following XML:
>
> <composite name="RH">
> <instance component="FileRH" name="FileRH-Instance"/>
> <instance component="ErrorRH" name="ErrorRH-Instance"/>
> <instance
> component="org.apache.comanche.requestDispatcher.RequestDispatcher"
> name="RequestDispatcher"/>
> <provides action="export"
> specification="org.apache.comanche.services.RequestHandler"/>
> </composite>
>
> The problem is: since all three components implements the same
> RequestHandler interface, how can I tell the composite to export the
> specific RequestDispatcher instance? I tried to use the "name" workaround,
> explained above, but it did not work. How can I do it?
The <provides/> element can have a 'filter' attribute indicating which service
you want to export:
<composite:provides action="export"
specification="..."
filter="(instance.name=RequestDispatcher)" />
>
> Also, I miss a Reference Card like the one found in
> (http://felix.apache.org/site/ipojo-reference-card.html) enlightening the
> possibilities with composites. Do anyone plan to create something like that?
>
It's planed, but hard to say when….
Regards,
Clement
> Thanks in advance!
> Fabio
> --
> View this message in context:
> http://old.nabble.com/Different-components-using-the-same-interface-inside-a-composite-tp33645498p33645498.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]