[ 
https://issues.apache.org/jira/browse/ARIES-1411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14899894#comment-14899894
 ] 

Gary Hodgson edited comment on ARIES-1411 at 9/20/15 12:23 PM:
---------------------------------------------------------------

Hi Christian,  Using @Named sounds like a reasonable way to resolve the 
problem.  However when I attempt this it seems that the references are not 
correctly created:
{code}
   @OsgiService(filter = "(path=/echo/simple)")
    @Named("simple")
    @Inject
    private EchoService echoService;
    
    @OsgiService(filter = "(path=/echo/reverse)")
    @Named("reverse")
    @Inject
    private EchoService reverseEchoService;
{code}
{code:xml}
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; 
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"; 
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"; 
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.1.0";>
  
  <bean id="echoRoute" 
class="com.tup.spa.demo.wms.tupspa.examples.echo.routes.EchoRoute" 
ext:field-injection="true">
      <property name="echoService" ref="simple"/>
      <property name="reverseEchoService" ref="reverse"/>
  </bean>
  
  <reference id="echoService" 
interface="com.tup.spa.demo.wms.tupspa.examples.echo.service.api.EchoService" 
filter="(path=/echo/simple)"/>
  
  <service ref="echoRoute" interface="org.apache.camel.builder.RouteBuilder"/>
  
</blueprint>
{code}



was (Author: g.hodgson):
Hi Christian,  Using @Named sounds like a reasonable way to resolve the 
problem.  However when I attempt this it seems that the references are not 
correctly created:

{code:xml}
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; 
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"; 
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"; 
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.1.0";>
  
  <bean id="echoRoute" 
class="com.tup.spa.demo.wms.tupspa.examples.echo.routes.EchoRoute" 
ext:field-injection="true">
      <property name="echoService" ref="simple"/>
      <property name="reverseEchoService" ref="reverse"/>
  </bean>
  
  <reference id="echoService" 
interface="com.tup.spa.demo.wms.tupspa.examples.echo.service.api.EchoService" 
filter="(path=/echo/simple)"/>
  
  <service ref="echoRoute" interface="org.apache.camel.builder.RouteBuilder"/>
  
</blueprint>
{code}


> Blueprint Annotations: Missing service when two services with the same type 
> are annotated
> -----------------------------------------------------------------------------------------
>
>                 Key: ARIES-1411
>                 URL: https://issues.apache.org/jira/browse/ARIES-1411
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: blueprint-maven-plugin-1.1.0
>            Reporter: Gary Hodgson
>            Assignee: Christian Schneider
>            Priority: Minor
>             Fix For: blueprint-maven-plugin-1.2.0
>
>
> If I have a class with two services of the same type, differentiated via 
> filters, it seems that only one reference is created in autowire.xml.  E.g.
> {code}
> @Singleton
> @OsgiServiceProvider(classes = {RouteBuilder.class})
> public class EchoRoute extends RouteBuilder {
>     @OsgiService(filter = "(path=/echo/reverse)")
>     @Inject
>     private EchoService reverseEchoService;
>     @OsgiService(filter = "(path=/echo/simple)")
>     @Inject
>     private EchoService echoService;
> ...
> {code}
> produces the following:
> {code:xml}
> <?xml version="1.0" ?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; 
> xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"; 
> xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"; 
> xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.1.0";>
>   <bean id="echoRoute" 
> class="com.tup.spa.demo.wms.tupspa.examples.echo.routes.EchoRoute" 
> ext:field-injection="true">
>       <property name="echoService" ref="echoService"/>
>       <property name="reverseEchoService" ref="echoService"/>
>   </bean>
>   <reference id="echoService" 
> interface="com.tup.spa.demo.wms.tupspa.examples.echo.service.api.EchoService" 
> filter="(path=/echo/reverse)"/>
>   <service ref="echoRoute" interface="org.apache.camel.builder.RouteBuilder"/>
>   
> </blueprint>
> {code}
> I would expect the following:
> {code:xml}
> <bean id="echoRoute" 
> class="com.tup.spa.demo.wms.tupspa.examples.echo.routes.EchoRoute" 
> ext:field-injection="true">
>       <property name="echoService" ref="echoService"/>
>       <property name="reverseEchoService" ref="reverseEchoService"/>
>   </bean>
>   <reference id="echoService" 
> interface="com.tup.spa.demo.wms.tupspa.examples.echo.service.api.EchoService" 
> filter="(path=/echo/simple)"/>
>   <reference id="reverseEchoService" 
> interface="com.tup.spa.demo.wms.tupspa.examples.echo.service.api.EchoService" 
> filter="(path=/echo/reverse)"/>
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to