public Provider.Service getService(Provider p, String type) { return p.getService(type); } }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param provider the provider to use * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static CredentialStore getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { final Provider.Service service = provider.getService(CREDENTIAL_STORE_TYPE, algorithm); if (service == null) throw new NoSuchAlgorithmException(algorithm); return new CredentialStore(provider, (CredentialStoreSpi) service.newInstance(null), algorithm); }
/** * Finds the appropriate service implementation and returns and * instance of the class that implements corresponding Service * Provider Interface. */ public Object getInstance(String algorithm, Provider provider, Object param) throws NoSuchAlgorithmException { if (algorithm == null) { throw new NoSuchAlgorithmException("algorithm == null"); } Provider.Service service = provider.getService(serviceName, algorithm); if (service == null) { throw notFound(serviceName, algorithm); } return service.newInstance(param); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providers supplier of provider instances to search. * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static CredentialStore getInstance(String algorithm, Supplier<Provider[]> providers) throws NoSuchAlgorithmException { checkNotNullParam("providers", providers); for (Provider provider : providers.get()) { final Provider.Service service = provider.getService(CREDENTIAL_STORE_TYPE, algorithm); if (service != null) { return new CredentialStore(provider, (CredentialStoreSpi) service.newInstance(null), algorithm); } } throw new NoSuchAlgorithmException(); }
/** * 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. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider service, or {@code null} if none is found */ public static Provider.Service findProviderService(Supplier<Provider[]> providerSupplier, String providerName, String serviceType, String algorithm) { Assert.checkNotNullParam("providerSupplier", providerSupplier); Assert.checkNotNullParam("serviceType", serviceType); Assert.checkNotNullParam("algorithm", algorithm); for (Provider provider : providerSupplier.get()) { if (providerName == null || providerName.equals(provider.getName())) { Provider.Service providerService = provider.getService(serviceType, algorithm); if (providerService != null) { return providerService; } } } return null; }
/** * Get a password factory instance. The returned password factory object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providerSupplier the provider supplier to search * @return a password factory instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static PasswordFactory getInstance(String algorithm, Supplier<Provider[]> providerSupplier) throws NoSuchAlgorithmException { for (Provider provider : providerSupplier.get()) { final Provider.Service service = provider.getService("PasswordFactory", algorithm); if (service != null) { return new PasswordFactory((PasswordFactorySpi) service.newInstance(null), provider, algorithm); } } throw log.noSuchAlgorithmInvalidAlgorithm(algorithm); }
/** * Get a password factory instance. The returned password factory object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param provider the provider to use * @return a password factory instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static PasswordFactory getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { final Provider.Service service = provider.getService("PasswordFactory", algorithm); if (service == null) throw log.noSuchAlgorithmInvalidAlgorithm(algorithm); return new PasswordFactory((PasswordFactorySpi) service.newInstance(null), provider, algorithm); }
public Provider.Service getService(Provider p, String type) { return p.getService(type); } }
public Provider.Service getService(Provider p, String type) { return p.getService(type); } }
public Provider.Service getService(Provider p, String type) { return p.getService(type); } }
public Provider.Service getService(Provider p, String type) { return p.getService(type); } }
public static Service getService(String type, String algorithm, Provider provider) throws NoSuchAlgorithmException { if (provider == null) { throw new IllegalArgumentException("missing provider"); } Service s = provider.getService(type, algorithm); if (s == null) { throw new NoSuchAlgorithmException("no such algorithm: " + algorithm + " for provider " + provider.getName()); } return s; }
@Override public synchronized Service getService(String type, String algorithm) { if (TYPE_CONFIGURATION.equals(type) && JAAS_CONFIG_ALGO_NAME.equals(algorithm)) { return new ConfigurationService(this); } return super.getService(type, algorithm); } }
@Override public synchronized Service getService(String type, String algorithm) { if (TYPE_CONFIGURATION.equals(type) && JAAS_CONFIG_ALGO_NAME.equals(algorithm)) { return new ConfigurationService(this); } return super.getService(type, algorithm); } }
public Service getService(String type, String algorithm) { Provider p = getProvider(); if (p != null) { return p.getService(type, algorithm); } else { return null; } }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param provider the provider to use * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static CredentialStore getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { final Provider.Service service = provider.getService(CREDENTIAL_STORE_TYPE, algorithm); if (service == null) throw new NoSuchAlgorithmException(algorithm); return new CredentialStore(provider, (CredentialStoreSpi) service.newInstance(null), algorithm); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param provider the provider to use * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static CredentialStore getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { final Provider.Service service = provider.getService(CREDENTIAL_STORE_TYPE, algorithm); if (service == null) throw new NoSuchAlgorithmException(algorithm); return new CredentialStore(provider, (CredentialStoreSpi) service.newInstance(null), algorithm); }
/** * Get a password factory instance. The returned password factory object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param provider the provider to use * @return a password factory instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static PasswordFactory getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { final Provider.Service service = provider.getService("PasswordFactory", algorithm); if (service == null) throw log.noSuchAlgorithmInvalidAlgorithm(algorithm); return new PasswordFactory((PasswordFactorySpi) service.newInstance(null), provider, algorithm); }
/** * Get a password factory instance. The returned password factory object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param provider the provider to use * @return a password factory instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static PasswordFactory getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { final Provider.Service service = provider.getService("PasswordFactory", algorithm); if (service == null) throw log.noSuchAlgorithmInvalidAlgorithm(algorithm); return new PasswordFactory((PasswordFactorySpi) service.newInstance(null), provider, algorithm); }
/** * Get a password factory instance. The returned password factory object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param provider the provider to use * @return a password factory instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static PasswordFactory getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { final Provider.Service service = provider.getService("PasswordFactory", algorithm); if (service == null) throw log.noSuchAlgorithmInvalidAlgorithm(algorithm); return new PasswordFactory((PasswordFactorySpi) service.newInstance(null), provider, algorithm); }