java.security
Class Provider.Service

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.security.Provider.Service
Enclosing class:
Provider sample code for java.security.Provider definition code for java.security.Provider

public static class Provider.Service
extends Object sample code for java.lang.Object definition code for java.lang.Object

The description of a security service. It encapsulates the properties of a service and contains a factory method to obtain new implementation instances of this service.

Each service has a provider that offers the service, a type, an algorithm name, and the name of the class that implements the service. Optionally, it also includes a list of alternate algorithm names for this service (aliases) and attributes, which are a map of (name, value) String pairs.

This class defines the methods supportsParameter() sample code for java.security.Provider.Service.supportsParameter(java.lang.Object) definition code for java.security.Provider.Service.supportsParameter(java.lang.Object) and newInstance() sample code for java.security.Provider.Service.newInstance(java.lang.Object) definition code for java.security.Provider.Service.newInstance(java.lang.Object) which are used by the Java security framework when it searches for suitable services and instantes them. The valid arguments to those methods depend on the type of service. For the service types defined within J2SE, see the Java Cryptography Architecture API Specification & Reference for the valid values. Note that components outside of J2SE can define additional types of services and their behavior.

Instances of this class are immutable.

Since:
1.5

Constructor Summary
Provider.Service sample code for java.security.Provider.Service.Provider.Service(java.security.Provider, java.lang.String, java.lang.String, java.lang.String, java.util.List, java.util.Map) definition code for java.security.Provider.Service.Provider.Service(java.security.Provider, java.lang.String, java.lang.String, java.lang.String, java.util.List, java.util.Map) (Provider sample code for java.security.Provider definition code for java.security.Provider  provider, String sample code for java.lang.String definition code for java.lang.String  type, String sample code for java.lang.String definition code for java.lang.String  algorithm, String sample code for java.lang.String definition code for java.lang.String  className, List sample code for java.util.List definition code for java.util.List <String sample code for java.lang.String definition code for java.lang.String > aliases, Map sample code for java.util.Map definition code for java.util.Map <String sample code for java.lang.String definition code for java.lang.String ,String sample code for java.lang.String definition code for java.lang.String > attributes)
          Construct a new service.
 
Method Summary
 String sample code for java.lang.String definition code for java.lang.String getAlgorithm sample code for java.security.Provider.Service.getAlgorithm() definition code for java.security.Provider.Service.getAlgorithm() ()
          Return the name of the algorithm of this service.
 String sample code for java.lang.String definition code for java.lang.String getAttribute sample code for java.security.Provider.Service.getAttribute(java.lang.String) definition code for java.security.Provider.Service.getAttribute(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Return the value of the specified attribute or null if this attribute is not set for this Service.
 String sample code for java.lang.String definition code for java.lang.String getClassName sample code for java.security.Provider.Service.getClassName() definition code for java.security.Provider.Service.getClassName() ()
          Return the name of the class implementing this service.
 Provider sample code for java.security.Provider definition code for java.security.Provider getProvider sample code for java.security.Provider.Service.getProvider() definition code for java.security.Provider.Service.getProvider() ()
          Return the Provider of this service.
 String sample code for java.lang.String definition code for java.lang.String getType sample code for java.security.Provider.Service.getType() definition code for java.security.Provider.Service.getType() ()
          Get the type of this service.
 Object sample code for java.lang.Object definition code for java.lang.Object newInstance sample code for java.security.Provider.Service.newInstance(java.lang.Object) definition code for java.security.Provider.Service.newInstance(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  constructorParameter)
          Return a new instance of the implementation described by this service.
 boolean supportsParameter sample code for java.security.Provider.Service.supportsParameter(java.lang.Object) definition code for java.security.Provider.Service.supportsParameter(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  parameter)
          Test whether this Service can use the specified parameter.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.security.Provider.Service.toString() definition code for java.security.Provider.Service.toString() ()
          Return a String representation of this service.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

Provider.Service sample code for java.security.Provider.Service(java.security.Provider, java.lang.String, java.lang.String, java.lang.String, java.util.List<java.lang.String>, java.util.Map<java.lang.String, java.lang.String>) definition code for java.security.Provider.Service(java.security.Provider, java.lang.String, java.lang.String, java.lang.String, java.util.List<java.lang.String>, java.util.Map<java.lang.String, java.lang.String>)

public Provider.Service(Provider sample code for java.security.Provider definition code for java.security.Provider  provider,
                        String sample code for java.lang.String definition code for java.lang.String  type,
                        String sample code for java.lang.String definition code for java.lang.String  algorithm,
                        String sample code for java.lang.String definition code for java.lang.String  className,
                        List sample code for java.util.List definition code for java.util.List <String sample code for java.lang.String definition code for java.lang.String > aliases,
                        Map sample code for java.util.Map definition code for java.util.Map <String sample code for java.lang.String definition code for java.lang.String ,String sample code for java.lang.String definition code for java.lang.String > attributes)
Construct a new service.

Parameters:
provider - the provider that offers this service
type - the type of this service
algorithm - the algorithm name
className - the name of the class implementing this service
aliases - List of aliases or null if algorithm has no aliases
attributes - Map of attributes or null if this implementation has no attributes
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if provider, type, algorithm, or className is null
Method Detail

getType sample code for java.security.Provider.Service.getType() definition code for java.security.Provider.Service.getType()

public final String sample code for java.lang.String definition code for java.lang.String  getType()
Get the type of this service. For example, MessageDigest.

Returns:
the type of this service

getAlgorithm sample code for java.security.Provider.Service.getAlgorithm() definition code for java.security.Provider.Service.getAlgorithm()

public final String sample code for java.lang.String definition code for java.lang.String  getAlgorithm()
Return the name of the algorithm of this service. For example, SHA-1.

Returns:
the algorithm of this service

getProvider sample code for java.security.Provider.Service.getProvider() definition code for java.security.Provider.Service.getProvider()

public final Provider sample code for java.security.Provider definition code for java.security.Provider  getProvider()
Return the Provider of this service.

Returns:
the Provider of this service

getClassName sample code for java.security.Provider.Service.getClassName() definition code for java.security.Provider.Service.getClassName()

public final String sample code for java.lang.String definition code for java.lang.String  getClassName()
Return the name of the class implementing this service.

Returns:
the name of the class implementing this service

getAttribute sample code for java.security.Provider.Service.getAttribute(java.lang.String) definition code for java.security.Provider.Service.getAttribute(java.lang.String)

public final String sample code for java.lang.String definition code for java.lang.String  getAttribute(String sample code for java.lang.String definition code for java.lang.String  name)
Return the value of the specified attribute or null if this attribute is not set for this Service.

Parameters:
name - the name of the requested attribute
Returns:
the value of the specified attribute or null if the attribute is not present
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if name is null

newInstance sample code for java.security.Provider.Service.newInstance(java.lang.Object) definition code for java.security.Provider.Service.newInstance(java.lang.Object)

public Object sample code for java.lang.Object definition code for java.lang.Object  newInstance(Object sample code for java.lang.Object definition code for java.lang.Object  constructorParameter)
                   throws NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException 
Return a new instance of the implementation described by this service. The security provider framework uses this method to construct implementations. Applications will typically not need to call it.

The default implementation uses reflection to invoke the standard constructor for this type of service. Security providers can override this method to implement instantiation in a different way. For details and the values of constructorParameter that are valid for the various types of services see the Java Cryptography Architecture API Specification & Reference.

Parameters:
constructorParameter - the value to pass to the constructor, or null if this type of service does not use a constructorParameter.
Returns:
a new implementation of this service
Throws:
InvalidParameterException sample code for java.security.InvalidParameterException definition code for java.security.InvalidParameterException - if the value of constructorParameter is invalid for this type of service.
NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException - if instantation failed for any other reason.

supportsParameter sample code for java.security.Provider.Service.supportsParameter(java.lang.Object) definition code for java.security.Provider.Service.supportsParameter(java.lang.Object)

public boolean supportsParameter(Object sample code for java.lang.Object definition code for java.lang.Object  parameter)
Test whether this Service can use the specified parameter. Returns false if this service cannot use the parameter. Returns true if this service can use the parameter, if a fast test is infeasible, or if the status is unknown.

The security provider framework uses this method with some types of services to quickly exclude non-matching implementations for consideration. Applications will typically not need to call it.

For details and the values of parameter that are valid for the various types of services see the top of this class and the Java Cryptography Architecture API Specification & Reference. Security providers can override it to implement their own test.

Parameters:
parameter - the parameter to test
Returns:
false if this this service cannot use the specified parameter; true if it can possibly use the parameter
Throws:
InvalidParameterException sample code for java.security.InvalidParameterException definition code for java.security.InvalidParameterException - if the value of parameter is invalid for this type of service or if this method cannot be used with this type of service

toString sample code for java.security.Provider.Service.toString() definition code for java.security.Provider.Service.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Return a String representation of this service.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a String representation of this service.