public class ProviderRegistryImpl extends java.lang.Object implements ProviderRegistry
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXPORT_PROVIDER_HEADER |
static java.lang.String |
OPT_IN_HEADER |
Constructor and Description |
---|
ProviderRegistryImpl(Activator activator) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
addBundle(org.osgi.framework.Bundle bundle)
Add a bundle to the provider registry.
|
java.lang.Object |
getService(java.lang.String providerId)
Locate and instantiate an instance of a service provider
defined in the META-INF/services directory of tracked bundles.
|
java.lang.Class<?> |
getServiceClass(java.lang.String providerId)
Locate and return the class for a service provider
defined in the META-INF/services directory of tracked bundles.
|
java.util.List<java.lang.Class<?>> |
getServiceClasses(java.lang.String providerId)
Locate all services that match a given provider id and return the implementation
classes
|
java.util.List<java.lang.Object> |
getServices(java.lang.String providerId)
Locate all services that match a given provider id and create instances.
|
java.lang.Class<?> |
locate(java.lang.String providerId)
Locate a class by its provider id indicator.
|
java.util.List<java.lang.Class<?>> |
locateAll(java.lang.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,
java.lang.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 java.lang.String OPT_IN_HEADER
public static final java.lang.String EXPORT_PROVIDER_HEADER
public ProviderRegistryImpl(Activator activator)
public java.lang.Object addBundle(org.osgi.framework.Bundle bundle)
bundle
- The source bundle.public void removeBundle(org.osgi.framework.Bundle bundle, java.lang.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 java.lang.Class<?> locate(java.lang.String providerId)
locate
in interface ProviderRegistry
providerId
- The provider id (generally, a fully qualified class name).public java.util.List<java.lang.Class<?>> locateAll(java.lang.String providerId)
locateAll
in interface ProviderRegistry
providerId
- The target provider identifier.public java.lang.Object getService(java.lang.String providerId) throws java.lang.Exception
getService
in interface ProviderRegistry
providerId
- The name of the target interface class.java.lang.Exception
- Any classloading or other exceptions thrown during
the process of creating this service instance.public java.util.List<java.lang.Object> getServices(java.lang.String providerId)
getServices
in interface ProviderRegistry
providerId
- The target provider identifier.public java.util.List<java.lang.Class<?>> getServiceClasses(java.lang.String providerId)
getServiceClasses
in interface ProviderRegistry
providerId
- The target provider identifier.public java.lang.Class<?> getServiceClass(java.lang.String providerId) throws java.lang.ClassNotFoundException
getServiceClass
in interface ProviderRegistry
providerId
- The name of the target interface class.java.lang.Exception
- Any classloading or other exceptions thrown during
the process of loading this service provider class.java.lang.ClassNotFoundException