<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to override the implementation of a service in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-override-the-implementation-of-a-service/m-p/327635#M14636</link>
    <description>&lt;P&gt;As it turns out, I had a typo in the contribution of the third bundle, and that was the reason why it didn't work. So, using different implementations with &lt;STRONG&gt;require&lt;/STRONG&gt;s actually works in my case.&lt;/P&gt;
&lt;P&gt;Sorry for the mistake!&lt;/P&gt;</description>
    <pubDate>Wed, 26 Apr 2017 12:59:41 GMT</pubDate>
    <dc:creator>ioihanguren_</dc:creator>
    <dc:date>2017-04-26T12:59:41Z</dc:date>
    <item>
      <title>How to override the implementation of a service</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-override-the-implementation-of-a-service/m-p/327634#M14635</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a component that declares a service. The service has different implementations provided in separate bundles:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;BaseBundle:
&lt;UL&gt;
&lt;LI&gt;ServiceInterface&lt;/LI&gt;
&lt;LI&gt;BaseServiceImpl&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;SecondBundle:
&lt;UL&gt;
&lt;LI&gt;SecondServiceImpl&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;ThirdBundle:
&lt;UL&gt;
&lt;LI&gt;ThirdServiceImpl&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The service and implementations are declared in a contribution in each bundle, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;// BaseBundle
&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;component name="BaseBundleComponent"&amp;gt;
  &amp;lt;implementation class="org.example.service.impl.BaseServiceImpl"/&amp;gt;
  &amp;lt;service&amp;gt;
    &amp;lt;provide interface="org.example.service.ServiceInterface"/&amp;gt;
  &amp;lt;/service&amp;gt;
&amp;lt;/component&amp;gt;


// SecondBundle
&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;component name="SecondBundleComponent"&amp;gt;
&amp;lt;require&amp;gt;BaseBundleComponent&amp;lt;/require&amp;gt;
&amp;lt;implementation class="org.example.service.impl.SecondServiceImpl"/&amp;gt;
&amp;lt;service&amp;gt;
&amp;lt;provide interface="org.example.service.ServiceInterface"/&amp;gt;
&amp;lt;/service&amp;gt;
&amp;lt;/component&amp;gt;



// ThirdBundle
&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;component name="ThirdBundleComponent"&amp;gt;
&amp;lt;require&amp;gt;SecondBundleComponent&amp;lt;/require&amp;gt;
&amp;lt;implementation class="org.example.service.impl.ThirdServiceImpl"/&amp;gt;
&amp;lt;service&amp;gt;
&amp;lt;provide interface="org.example.service.ServiceInterface"/&amp;gt;
&amp;lt;/service&amp;gt;
&amp;lt;/component&amp;gt;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So, the SecondBundle requires the BaseBundle (because it extends BaseBundle implementation). And the ThirdBundle requires the SecondBundle (for the same reason). I thought that with the &lt;STRONG&gt;require&lt;/STRONG&gt;s I would be able to override the implementation of ServiceInterface:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If I load Base + Second, the implementation should be SecondServiceImpl&lt;/LI&gt;
&lt;LI&gt;If I load Base + Second + Third, the implementation should be ThirdServiceImpl&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;But I've seen that it is not that way.&lt;/P&gt;
&lt;P&gt;So what is the correct way to override the implementation of a service depending on the bundles that are loaded? Is it possible?&lt;/P&gt;
&lt;P&gt;Thank you in advance,&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 15:29:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-override-the-implementation-of-a-service/m-p/327634#M14635</guid>
      <dc:creator>ioihanguren_</dc:creator>
      <dc:date>2017-04-25T15:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to override the implementation of a service</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-override-the-implementation-of-a-service/m-p/327635#M14636</link>
      <description>&lt;P&gt;As it turns out, I had a typo in the contribution of the third bundle, and that was the reason why it didn't work. So, using different implementations with &lt;STRONG&gt;require&lt;/STRONG&gt;s actually works in my case.&lt;/P&gt;
&lt;P&gt;Sorry for the mistake!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:59:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-override-the-implementation-of-a-service/m-p/327635#M14636</guid>
      <dc:creator>ioihanguren_</dc:creator>
      <dc:date>2017-04-26T12:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to override the implementation of a service</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-override-the-implementation-of-a-service/m-p/327636#M14637</link>
      <description>&lt;P&gt;Ok good to know thanks, that was surprising to me.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 13:01:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-override-the-implementation-of-a-service/m-p/327636#M14637</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2017-04-26T13:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to override the implementation of a service</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-override-the-implementation-of-a-service/m-p/327637#M14638</link>
      <description>&lt;P&gt;Thanks! It's good to know.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 13:08:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-override-the-implementation-of-a-service/m-p/327637#M14638</guid>
      <dc:creator>ioihanguren_</dc:creator>
      <dc:date>2017-04-26T13:08:32Z</dc:date>
    </item>
  </channel>
</rss>

