本文整理了Java中java.security.Provider.getService()
方法的一些代码示例,展示了Provider.getService()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Provider.getService()
方法的具体详情如下:
包路径:java.security.Provider
类名称:Provider
方法名:getService
[英]Get the service of the specified type
[中]获取指定类型的服务
代码示例来源:origin: robovm/robovm
public Provider.Service getService(Provider p, String type) {
return p.getService(type);
}
}
代码示例来源:origin: wildfly/wildfly
/**
* 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);
}
代码示例来源:origin: robovm/robovm
/**
* 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);
}
代码示例来源:origin: wildfly/wildfly
/**
* 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();
}
代码示例来源:origin: wildfly/wildfly
/**
* 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;
}
代码示例来源:origin: wildfly/wildfly
/**
* 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);
}
代码示例来源:origin: wildfly/wildfly
/**
* 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);
}
代码示例来源:origin: MobiVM/robovm
public Provider.Service getService(Provider p, String type) {
return p.getService(type);
}
}
代码示例来源:origin: ibinti/bugvm
public Provider.Service getService(Provider p, String type) {
return p.getService(type);
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
public Provider.Service getService(Provider p, String type) {
return p.getService(type);
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
public Provider.Service getService(Provider p, String type) {
return p.getService(type);
}
}
代码示例来源:origin: poreid/poreid
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;
}
代码示例来源:origin: apache/felix
@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);
}
}
代码示例来源:origin: org.apache.felix/org.apache.felix.jaas
@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);
}
}
代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-common
public Service getService(String type, String algorithm) {
Provider p = getProvider();
if (p != null) {
return p.getService(type, algorithm);
} else {
return null;
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* 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);
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron
/**
* 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);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* 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);
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron-credential
/**
* 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);
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron
/**
* 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);
}
内容来源于网络,如有侵权,请联系作者删除!