Hi Clement!
Thank you very much! You and Richard are solving a lot of problems to me!
:-)
I did what you suggest and it worked fine. But there is one more step for it
to work: As I am using the <requires from="..."> in the RequestAnalyzer
component declaration, for it to be bound with the right instance, just
export the right service was not enough. I had also to name the instance of
my composite with the name I used in the <requires from="..."> as in the
example below:
<composite name="RD">
<instance component="RH" />
<instance
component="org.apache.comanche.requestDispatcher.RequestDispatcher"
name="RequestDispatcher"/>
<provides action="export"
specification="org.apache.comanche.services.RequestHandler"
filter="(instance.name=RequestDispatcher)" />
</composite>
<composite name="comanche">
<instance component="RD" name="RequestDispatcher"/>
<instance
component="org.apache.comanche.requestAnalyzer.RequestAnalyzer"
name="RequestAnalyzer"/>
<instance component="org.apache.comanche.basicLogger.BasicLogger"/>
<instance
component="org.apache.comanche.multiThreadScheduler.MultiThreadScheduler"/>
<instance
component="org.apache.comanche.sequentialScheduler.SequentialScheduler"/>
<instance
component="org.apache.comanche.requestReceiver.RequestReceiver"
name="RequestReceiver"/>
</composite>
I'm writing this here just for a matter of documentation, as other people
may have the same problem I had.
One last question: I have mentioned the Reference Card for composite because
it could have solved my problem without having to ask you directly. I know
documenting is the boring part, but do you have anything else besides the
composite tutorial that teaches us the details of ipojo composite model? I
have searched internet but so far I found nothing as detailed as the
composite tutorial.
Thanks a lot for your valuable help!
Fabio
clement escoffier wrote:
>
> 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]
>
>
>
--
View this message in context:
http://old.nabble.com/Different-components-using-the-same-interface-inside-a-composite-tp33645498p33648701.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]