Hi,

You can export service by this way (in an xml placed in OSGI-INF/blueprint), 
note that the dataSourceDerbyBean is also declared as your 
'resourceNameCompleter' bean:
[code]
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";><service 
ref="dataSourceDerby" interface="javax.sql.DataSource"/>

                
</blueprint>
[/code]

Then, referencing it in an other xml (placed in an other OSGI-INF/blueprint 
folder, or the same :p)
[code]
<blueprint
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
        xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0";
  xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"; 
  >
 <reference id="dataSource" interface="javax.sql.DataSource"/>
 </blueprint>
[/code]
> From: [email protected]
> Date: Mon, 26 Mar 2012 13:02:46 +0200
> Subject: Re: referencing a bean from another blueprint core.xml
> To: [email protected]
> 
> Hi,
> 
> I've been googling this for a while without finding an answer. I hope
> you can point me to what I'm missing.
> 
> I've several bundles on a karaf servicemix osg container. One of the
> bundles defines (and uses) <bean>'s for the command completers:
> 
> <bean id="resourceNameCompleter" class="org.bundle.a.ResourceNameCompleter"/>
> 
> <command name="resource/start">
>        <action 
> class="org.opennaas.core.resources.shell.StartResourceCommand"/>
>        <completers>
>                <ref component-id="resourceNameCompleter"/>
>                <null/>
>        </completers>
> </command>
> 
> On another bundle, I want to use the same completer. Using a bean id
> with the same class="" doesn't work, although the class is exported in
> the original bundle. Not specifing a <bean> with a matching id doesn't
> work either.
> 
> Is there a way to reference the original bean from another core.xml?
> 
> Thanks!
> 
> Best regards,
> Pau
> 
> -- 
> Distributed Applications and Networks Area (DANA)
> Fundació i2CAT, Internet i Innovació Digital a Catalunya, Barcelona, Spain
> T: +34 935 679 927 - http://dana.i2cat.net/
                                          

Reply via email to