Class ProviderRegistryImpl
java.lang.Object
org.apache.geronimo.osgi.registry.ProviderRegistryImpl
- All Implemented Interfaces:
ProviderRegistry
The implementation of the provider registry used to store
the bundle registrations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Holder class for located services information.private class
private class
Holder class for information about a given collection of id to provider mappings. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Activator
static final String
static final String
private ProviderRegistryImpl.SPIRegistry
private ProviderRegistryImpl.SPIRegistry
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBundle
(org.osgi.framework.Bundle bundle) Add a bundle to the provider registry.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.getServiceClasses
(String providerId) Locate all services that match a given provider id and return the implementation classesgetServices
(String providerId) Locate all services that match a given provider id and create instances.Class
<?> Locate a class by its provider id indicator.Locate all class files that match a given provider id.private void
private void
protected void
Register an individual provivider item by its provider identifier.protected void
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
Removed a provider registration for a named provider id.protected void
Removed a provider registration for a named provider id.
-
Field Details
-
OPT_IN_HEADER
- See Also:
-
EXPORT_PROVIDER_HEADER
- See Also:
-
providers
-
serviceProviders
-
activator
-
-
Constructor Details
-
ProviderRegistryImpl
-
-
Method Details
-
addBundle
Add a bundle to the provider registry. This searches for services information in the OSGI-INF/providers directory of the bundle and registers this information in a provider registry. Bundles that need to locate class instances can use the provider registry to locate classes that might reside in other bundles.- Parameters:
bundle
- The source bundle.- Returns:
- A map of the located registrations. Returns null if this bundle does not contain any providers.
-
removeBundle
Remove a bundle from the registry.- Parameters:
bundle
- The target bundle.
-
registerProvider
Register an individual provivider item by its provider identifier.- Parameters:
provider
- The loader used to resolve the provider class.id
- The provider id.
-
unregisterProvider
Removed a provider registration for a named provider id.- Parameters:
provider
- The provider registration instanceid
- The target id
-
registerService
Register an individual provivider item by its provider identifier.- Parameters:
provider
- The loader used to resolve the provider class.id
- The provider id.
-
unregisterService
Removed a provider registration for a named provider id.- Parameters:
provider
- The provider registration instanceid
- The target id
-
locate
Locate a class by its provider id indicator. .- Specified by:
locate
in interfaceProviderRegistry
- Parameters:
providerId
- The provider id (generally, a fully qualified class name).- Returns:
- The Class corresponding to this provider id. Returns null if this is not registered or the indicated class can't be loaded.
-
locateAll
Locate all class files that match a given provider id.- Specified by:
locateAll
in interfaceProviderRegistry
- Parameters:
providerId
- The target provider identifier.- Returns:
- A List containing the class objects corresponding to the provider identifier. Returns an empty list if no matching classes can be located.
-
getService
Locate and instantiate an instance of a service provider defined in the META-INF/services directory of tracked bundles.- Specified by:
getService
in interfaceProviderRegistry
- Parameters:
providerId
- The name of the target interface class.- Returns:
- The service instance. Returns null if no service defintions can be located.
- Throws:
Exception
- Any classloading or other exceptions thrown during the process of creating this service instance.
-
getServices
Locate all services that match a given provider id and create instances.- Specified by:
getServices
in interfaceProviderRegistry
- Parameters:
providerId
- The target provider identifier.- Returns:
- A List containing the instances corresponding to the provider identifier. Returns an empty list if no matching classes can be located or created
-
getServiceClasses
Locate all services that match a given provider id and return the implementation classes- Specified by:
getServiceClasses
in interfaceProviderRegistry
- Parameters:
providerId
- The target provider identifier.- Returns:
- A List containing the classes corresponding to the provider identifier. Returns an empty list if no matching classes can be located.
-
getServiceClass
Locate and return the class for a service provider defined in the META-INF/services directory of tracked bundles.- Specified by:
getServiceClass
in interfaceProviderRegistry
- Parameters:
providerId
- The name of the target interface class.- Returns:
- The provider class. Returns null if no service defintions can be located.
- Throws:
Exception
- Any classloading or other exceptions thrown during the process of loading this service provider class.ClassNotFoundException
-
log
-
log
-