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
      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 factoryId)
      Locate a class by its factory id indicator.
      java.util.List<java.lang.Class<?>> locateAll​(java.lang.String factoryId)
      Locate all class files that match a given factory id.
    • Method Detail

      • locate

        java.lang.Class<?> locate​(java.lang.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

        java.util.List<java.lang.Class<?>> locateAll​(java.lang.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

        java.lang.Object getService​(java.lang.String providerId)
                             throws java.lang.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:
        java.lang.Exception - Any classloading or other exceptions thrown during the process of creating this service instance.
      • getServices

        java.util.List<java.lang.Object> getServices​(java.lang.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

        java.lang.Class<?> getServiceClass​(java.lang.String providerId)
                                    throws java.lang.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:
        java.lang.Exception - Any classloading or other exceptions thrown during the process of loading this service provider class.
        java.lang.ClassNotFoundException
      • getServiceClasses

        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
        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.