You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Gary Hodgson (JIRA)" <ji...@apache.org> on 2015/09/19 22:35:04 UTC

[jira] [Updated] (ARIES-1411) Blueprint Annotations: Missing service when two services with the same type are annotated

     [ https://issues.apache.org/jira/browse/ARIES-1411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Hodgson updated ARIES-1411:
--------------------------------
    Description: 
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}

  was:
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}


> 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
>            Priority: Minor
>
> 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)