Class ProviderUtil


  • public final class ProviderUtil
    extends Object
    Utilities for dealing with security providers.
    Author:
    David M. Lloyd
    • Constructor Detail

      • ProviderUtil

        public ProviderUtil()
    • Method Detail

      • findProvider

        public static Provider findProvider​(Supplier<Provider[]> providerSupplier,
                                            String providerName,
                                            Class<?> serviceType,
                                            String algorithm)
        Find the first provider from the supplier which provides the given service type and algorithm name. The simple name of the service type class is used to identify the service. If a providerName is specified the match will only be tested against providers with the name specified.
        Parameters:
        providerSupplier - the provider supplier (must not be null)
        providerName - the name of the provider, can be null
        serviceType - the service type as a class name (must not be null)
        algorithm - the algorithm name (must not be null)
        Returns:
        the provider, or null if none is found
      • findProvider

        public static Provider findProvider​(Provider[] providers,
                                            String providerName,
                                            Class<?> serviceType,
                                            String algorithm)
        Find the first provider from the supplier which provides the given service type and algorithm name. The simple name of the service type class is used to identify the service. If a providerName is specified the match will only be tested against providers with the name specified.
        Parameters:
        providers - the providers to searchr (must not be null)
        providerName - the name of the provider, can be null
        serviceType - the service type as a class name (must not be null)
        algorithm - the algorithm name (must not be null)
        Returns:
        the provider, or null if none is found
      • findProvider

        public static Provider findProvider​(Supplier<Provider[]> providerSupplier,
                                            String providerName,
                                            String serviceType,
                                            String algorithm)
        Find the first provider from the supplier which provides the given service type and algorithm name. If a providerName is specified the match will only be tested against providers with the name specified.
        Parameters:
        providerSupplier - the provider supplier (must not be null)
        providerName - the name of the provider, can be null
        serviceType - the service type (must not be null)
        algorithm - the algorithm name (must not be null)
        Returns:
        the provider, or null if none is found
      • findProvider

        public static Provider findProvider​(Provider[] providers,
                                            String providerName,
                                            String serviceType,
                                            String algorithm)
        Find the first provider from the supplier which provides the given service type and algorithm name. If a providerName is specified the match will only be tested against providers with the name specified.
        Parameters:
        providers - the providers to search (must not be null)
        providerName - the name of the provider, can be null
        serviceType - the service type (must not be null)
        algorithm - the algorithm name (must not be null)
        Returns:
        the provider, or null if none is found
      • findProviderService

        public static Provider.Service findProviderService​(Supplier<Provider[]> providerSupplier,
                                                           String providerName,
                                                           Class<?> serviceType,
                                                           String algorithm)
        Find a provider service which provides the given service type and algorithm name. If a providerName is specified the match will only be tested against providers with the name specified.
        Parameters:
        providerSupplier - the provider supplier (must not be null)
        providerName - the name of the provider, can be null
        serviceType - the service type (must not be null)
        algorithm - the algorithm name (must not be null)
        Returns:
        the provider service, or null if none is found
      • findProviderService

        public static Provider.Service findProviderService​(Provider[] providers,
                                                           String providerName,
                                                           Class<?> serviceType,
                                                           String algorithm)
        Find a provider service which provides the given service type and algorithm name. If a providerName is specified the match will only be tested against providers with the name specified.
        Parameters:
        providers - the providers to search (must not be null)
        providerName - the name of the provider, can be null
        serviceType - the service type (must not be null)
        algorithm - the algorithm name (must not be null)
        Returns:
        the provider service, or null if none is found
      • findProviderService

        public static Provider.Service findProviderService​(Supplier<Provider[]> providerSupplier,
                                                           String providerName,
                                                           String serviceType,
                                                           String algorithm)
        Find a provider service which provides the given service type and algorithm name. If a providerName is specified the match will only be tested against providers with the name specified.
        Parameters:
        providerSupplier - the provider supplier (must not be null)
        providerName - the name of the provider, can be null
        serviceType - the service type (must not be null)
        algorithm - the algorithm name (must not be null)
        Returns:
        the provider service, or null if none is found
      • findProviderService

        public static Provider.Service findProviderService​(Provider[] providers,
                                                           String providerName,
                                                           String serviceType,
                                                           String algorithm)
        Find a provider service which provides the given service type and algorithm name. If a providerName is specified the match will only be tested against providers with the name specified.
        Parameters:
        providers - the providers to search (must not be null)
        providerName - the name of the provider, can be null
        serviceType - the service type (must not be null)
        algorithm - the algorithm name (must not be null)
        Returns:
        the provider service, or null if none is found
      • findProviderService

        public static Provider.Service findProviderService​(Supplier<Provider[]> providerSupplier,
                                                           Predicate<Provider.Service> matchPredicate)
        Find a provider service which matches the given predicate.
        Parameters:
        providerSupplier - the provider supplier
        matchPredicate - the predicate to test
        Returns:
        the provider service, or null if none is found
      • findProviderService

        public static Provider.Service findProviderService​(Provider[] providers,
                                                           Predicate<Provider.Service> matchPredicate)
        Find a provider service which matches the given predicate.
        Parameters:
        providers - the providers to search
        matchPredicate - the predicate to test
        Returns:
        the provider service, or null if none is found
      • aggregate

        public static Supplier<Provider[]> aggregate​(Supplier<Provider[]>... suppliers)
        Create a Supplier of providers that is an aggregation of the result of multiple suppliers. The aggregation will be performed the first time the supplier is called and the results cached.
        Parameters:
        suppliers - the suppliers to aggregate.
        Returns:
        A supplier which will return an aggregation of all of the suppliers.