You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by altijori <fe...@hotmail.com> on 2012/04/12 20:47:38 UTC

Unregister a service with the same name in a different bundle

I have a unique situation in which we have a platform that is not extensible.
All methods defined in the implementation classes are final. This platform
is bundled as bundle1. 

There is a bundle2 that has a class that implements an interface located in
bundle1. Bundle1 also has a class that implements the same interface from
bundle1. 

Bundle1 class has the following configuration:
/**
 * Bundle1Class
 * 
 * @scr.service
 * @scr.component immediate="true" name="com.bundle1.Bundle1"
 *                description="%vehicledataservice.description"
 * @scr.property name="service.description" value="Data Service."
 * @scr.property name="service.vendor" value="Bundles Corp"
 */

Bundle2 class has the following configuration:
/**
 * Bundle2Class.
 * 
 * @scr.service
 * @scr.component immediate="true" name="com.bundle1.Bundle1"
 *                description="%vehicledataservice.description"
 * @scr.property name="service.description" value="Data Service."
 * @scr.property name="service.vendor" value="Bundle2 Corp"
 */

Bundle1 loads before bundle2. We would like to programatically unregister
the service from bundle1. Please let me know if it is feasible.




--
View this message in context: http://apache-felix.18485.n6.nabble.com/Unregister-a-service-with-the-same-name-in-a-different-bundle-tp4861609p4861609.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Unregister a service with the same name in a different bundle

Posted by Felix Meschberger <fm...@adobe.com>.
Hi,

Am 12.04.2012 um 20:47 schrieb altijori:

> I have a unique situation in which we have a platform that is not extensible.
> All methods defined in the implementation classes are final. This platform
> is bundled as bundle1. 
> 
> There is a bundle2 that has a class that implements an interface located in
> bundle1. Bundle1 also has a class that implements the same interface from
> bundle1. 
> 
> Bundle1 class has the following configuration:
> /**
> * Bundle1Class
> * 
> * @scr.service
> * @scr.component immediate="true" name="com.bundle1.Bundle1"
> *                description="%vehicledataservice.description"
> * @scr.property name="service.description" value="Data Service."
> * @scr.property name="service.vendor" value="Bundles Corp"
> */
> 
> Bundle2 class has the following configuration:
> /**
> * Bundle2Class.
> * 
> * @scr.service
> * @scr.component immediate="true" name="com.bundle1.Bundle1"
> *                description="%vehicledataservice.description"
> * @scr.property name="service.description" value="Data Service."
> * @scr.property name="service.vendor" value="Bundle2 Corp"
> */

This component won't load because its name collides with the one in Bundle1.

> 
> Bundle1 loads before bundle2. We would like to programatically unregister
> the service from bundle1. Please let me know if it is feasible.

The only way to be able to load the component from Bundle 2 would be to stop bundle 1, which might cause bundle 2 to fail.

This is because component descriptors are loaded when bundles are started and the names of components must be unique on a system wide bases. Since the bundle 2 component's name collides with the one of bundle 1 it will be ignored and an error message is logged.

Regards
Felix
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org