public class ProviderRegistryImpl extends Object implements ProviderRegistry
Modifier and Type | Field and Description |
---|---|
static String |
EXPORT_PROVIDER_HEADER |
static String |
OPT_IN_HEADER |
Constructor and Description |
---|
ProviderRegistryImpl(Activator activator) |
Modifier and Type | Method and Description |
---|---|
Object |
addBundle(org.osgi.framework.Bundle bundle)
Add a bundle to the provider registry.
|
Object |
getService(String providerId)
Locate and instantiate an instance of a service provider
defined in the META-INF/services directory of tracked bundles.
|
Class<?> |
getServiceClass(String providerId)
Locate and return the class for a service provider
defined in the META-INF/services directory of tracked bundles.
|
List<Class<?>> |
getServiceClasses(String providerId)
Locate all services that match a given provider id and return the implementation
classes
|
List<Object> |
getServices(String providerId)
Locate all services that match a given provider id and create instances.
|
Class<?> |
locate(String providerId)
Locate a class by its provider id indicator.
|
List<Class<?>> |
locateAll(String providerId)
Locate all class files that match a given provider id.
|
protected void |
registerProvider(org.apache.geronimo.osgi.registry.ProviderRegistryImpl.BundleProviderLoader provider)
Register an individual provivider item by its provider identifier.
|
protected void |
registerService(org.apache.geronimo.osgi.registry.ProviderRegistryImpl.BundleProviderLoader provider)
Register an individual provivider item by its provider identifier.
|
void |
removeBundle(org.osgi.framework.Bundle bundle,
Object obj)
Remove a bundle from the registry.
|
protected void |
unregisterProvider(org.apache.geronimo.osgi.registry.ProviderRegistryImpl.BundleProviderLoader provider)
Removed a provider registration for a named provider id.
|
protected void |
unregisterService(org.apache.geronimo.osgi.registry.ProviderRegistryImpl.BundleProviderLoader provider)
Removed a provider registration for a named provider id.
|
public static final String OPT_IN_HEADER
public static final String EXPORT_PROVIDER_HEADER
public ProviderRegistryImpl(Activator activator)
public Object addBundle(org.osgi.framework.Bundle bundle)
bundle
- The source bundle.public void removeBundle(org.osgi.framework.Bundle bundle, Object obj)
bundle
- The target bundle.protected void registerProvider(org.apache.geronimo.osgi.registry.ProviderRegistryImpl.BundleProviderLoader provider)
id
- The provider id.provider
- The loader used to resolve the provider class.protected void unregisterProvider(org.apache.geronimo.osgi.registry.ProviderRegistryImpl.BundleProviderLoader provider)
id
- The target idprovider
- The provider registration instanceprotected void registerService(org.apache.geronimo.osgi.registry.ProviderRegistryImpl.BundleProviderLoader provider)
id
- The provider id.provider
- The loader used to resolve the provider class.protected void unregisterService(org.apache.geronimo.osgi.registry.ProviderRegistryImpl.BundleProviderLoader provider)
id
- The target idprovider
- The provider registration instancepublic Class<?> locate(String providerId)
locate
in interface ProviderRegistry
providerId
- The provider id (generally, a fully qualified class name).public List<Class<?>> locateAll(String providerId)
locateAll
in interface ProviderRegistry
providerId
- The target provider identifier.public Object getService(String providerId) throws Exception
getService
in interface ProviderRegistry
providerId
- The name of the target interface class.Exception
- Any classloading or other exceptions thrown during
the process of creating this service instance.public List<Object> getServices(String providerId)
getServices
in interface ProviderRegistry
providerId
- The target provider identifier.public List<Class<?>> getServiceClasses(String providerId)
getServiceClasses
in interface ProviderRegistry
providerId
- The target provider identifier.public Class<?> getServiceClass(String providerId) throws ClassNotFoundException
getServiceClass
in interface ProviderRegistry
providerId
- The name of the target interface class.Exception
- Any classloading or other exceptions thrown during
the process of loading this service provider class.ClassNotFoundException
Copyright © 2014. All Rights Reserved.