public abstract class

Provider

extends Properties
java.lang.Object
   ↳ java.util.Dictionary<K, V>
     ↳ java.util.Hashtable<K, V>
       ↳ java.util.Properties
         ↳ java.security.Provider
Known Direct Subclasses

Class Overview

Provider is the abstract superclass for all security providers in the Java security infrastructure.

Summary

Nested Classes
public abstract class Provider.Service Service represents a service in the Java Security infrastructure. 
[Expand]
Inherited Fields
From class java.util.Properties
Protected Constructors
Provider(String name, double version, String info)
Constructs a new instance of Provider with its name, version and description.
Public Methods
synchronized void clear()
Clears all properties used to look up services implemented by this Provider.
synchronized Set<Entry<ObjectObject>> entrySet()
Returns a set of the mappings contained in this Hashtable.
String getInfo()
Returns a description of the services being provided.
String getName()
Returns the name of this provider.
synchronized Provider.Service getService(String type, String algorithm)
Returns the service with the specified type implementing the specified algorithm, or null if no such implementation exists.
synchronized Set<Provider.Service> getServices()
Returns an unmodifiable Set of all services registered by this provider.
double getVersion()
Returns the version number for the services being provided.
Set<Object> keySet()
Returns a set of the keys contained in this Hashtable.
synchronized void load(InputStream inStream)
Loads properties from the specified InputStream.
synchronized Object put(Object key, Object value)
Maps the specified key property name to the specified value.
synchronized void putAll(Map<?, ?> t)
Copies all from the provided map to this Provider.
synchronized Object remove(Object key)
Removes the specified key and its associated value from this Provider.
String toString()
Returns a string containing a concise, human-readable description of this Provider including its name and its version.
Collection<Object> values()
Returns a collection of the values contained in this Hashtable.
Protected Methods
synchronized void putService(Provider.Service s)
Adds a Service to this Provider.
synchronized void removeService(Provider.Service s)
Removes a previously registered Service from this Provider.
[Expand]
Inherited Methods
From class java.util.Properties
From class java.util.Hashtable
From class java.util.Dictionary
From class java.lang.Object
From interface java.util.Map

Protected Constructors

protected Provider (String name, double version, String info)

Constructs a new instance of Provider with its name, version and description.

Parameters
name the name of the provider.
version the version of the provider.
info a description of the provider.

Public Methods

public synchronized void clear ()

Clears all properties used to look up services implemented by this Provider.

If a SecurityManager is installed, code calling this method needs the SecurityPermission clearProviderProperties.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Throws
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method.

public synchronized Set<Entry<ObjectObject>> entrySet ()

Returns a set of the mappings contained in this Hashtable. Each element in the set is a Map.Entry. The set is backed by this Hashtable so changes to one are reflected by the other. The set does not support adding.

Returns
  • a set of the mappings.

public String getInfo ()

Returns a description of the services being provided.

Returns
  • a description of the services being provided.

public String getName ()

Returns the name of this provider.

Returns
  • the name of this provider.

public synchronized Provider.Service getService (String type, String algorithm)

Returns the service with the specified type implementing the specified algorithm, or null if no such implementation exists.

If two services match the requested type and algorithm, the one added with the putService(Service) is returned (as opposed to the one added via put(Object, Object).

Parameters
type the type of the service (for example KeyPairGenerator)
algorithm the algorithm name (case insensitive)
Returns
  • the requested service, or null if no such implementation exists

public synchronized Set<Provider.Service> getServices ()

Returns an unmodifiable Set of all services registered by this provider.

Returns
  • an unmodifiable Set of all services registered by this provider

public double getVersion ()

Returns the version number for the services being provided.

Returns
  • the version number for the services being provided.

public Set<Object> keySet ()

Returns a set of the keys contained in this Hashtable. The set is backed by this Hashtable so changes to one are reflected by the other. The set does not support adding.

Returns
  • a set of the keys.

public synchronized void load (InputStream inStream)

Loads properties from the specified InputStream. The encoding is ISO8859-1. The Properties file is interpreted according to the following rules:

  • Empty lines are ignored.
  • Lines starting with either a "#" or a "!" are comment lines and are ignored.
  • A backslash at the end of the line escapes the following newline character ("\r", "\n", "\r\n"). If there's a whitespace after the backslash it will just escape that whitespace instead of concatenating the lines. This does not apply to comment lines.
  • A property line consists of the key, the space between the key and the value, and the value. The key goes up to the first whitespace, "=" or ":" that is not escaped. The space between the key and the value contains either one whitespace, one "=" or one ":" and any number of additional whitespaces before and after that character. The value starts with the first character after the space between the key and the value.
  • Following escape sequences are recognized: "\ ", "\\", "\r", "\n", "\!", "\#", "\t", "\b", "\f", and "\uXXXX" (unicode character).

Parameters
inStream the InputStream.
Throws
IOException

public synchronized Object put (Object key, Object value)

Maps the specified key property name to the specified value.

If a SecurityManager is installed, code calling this method needs the SecurityPermission putProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Parameters
key the name of the property.
value the value of the property.
Returns
  • the value that was previously mapped to the specified key ,or null if it did not have one.
Throws
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method.

public synchronized void putAll (Map<?, ?> t)

Copies all from the provided map to this Provider.

If a SecurityManager is installed, code calling this method needs the SecurityPermission putProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Parameters
t the mappings to copy to this provider.
Throws
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method.

public synchronized Object remove (Object key)

Removes the specified key and its associated value from this Provider.

If a SecurityManager is installed, code calling this method needs the SecurityPermission removeProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Parameters
key the name of the property
Returns
  • the value that was mapped to the specified key ,or null if no mapping was present
Throws
SecurityException if a SecurityManager is installed and the caller does not have the permission to invoke this method.

public String toString ()

Returns a string containing a concise, human-readable description of this Provider including its name and its version.

Returns
  • a printable representation for this Provider.

public Collection<Object> values ()

Returns a collection of the values contained in this Hashtable. The collection is backed by this Hashtable so changes to one are reflected by the other. The collection does not support adding.

Returns
  • a collection of the values.

Protected Methods

protected synchronized void putService (Provider.Service s)

Adds a Service to this Provider. If a service with the same name was registered via this method, it is replace.

If a SecurityManager is installed, code calling this method needs the SecurityPermission putProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Parameters
s the Service to register
Throws
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method

protected synchronized void removeService (Provider.Service s)

Removes a previously registered Service from this Provider.

If a SecurityManager is installed, code calling this method needs the SecurityPermission removeProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Parameters
s the Service to remove
Throws
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method
NullPointerException if s is null