Interface ProviderRegistry
-
- All Known Implementing Classes:
ProviderRegistryImpl
public interface ProviderRegistry
The implementation of the factory registry used to store the bundle registrations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 classesList<Object>
getServices(String providerId)
Locate all services that match a given provider id and create instances.Class<?>
locate(String factoryId)
Locate a class by its factory id indicator.List<Class<?>>
locateAll(String factoryId)
Locate all class files that match a given factory id.
-
-
-
Method Detail
-
locate
Class<?> locate(String factoryId)
Locate a class by its factory id indicator. .- Parameters:
factoryId
- The factory id (generally, a fully qualified class name).- Returns:
- The Class corresponding to this factory id. Returns null if this is not registered or the indicated class can't be loaded.
-
locateAll
List<Class<?>> locateAll(String factoryId)
Locate all class files that match a given factory id.- Parameters:
factoryId
- The target factory identifier.- Returns:
- A List containing the class objects corresponding to the factory identifier. Returns an empty list if no matching classes can be located.
-
getService
Object getService(String providerId) throws Exception
Locate and instantiate an instance of a service provider defined in the META-INF/services directory of tracked bundles.- 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
List<Object> getServices(String providerId)
Locate all services that match a given provider id and create instances.- 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
-
getServiceClass
Class<?> getServiceClass(String providerId) throws ClassNotFoundException
Locate and return the class for a service provider defined in the META-INF/services directory of tracked bundles.- 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
-
getServiceClasses
List<Class<?>> getServiceClasses(String providerId)
Locate all services that match a given provider id and return the implementation classes- 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.
-
-