All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.security.provider.IdentityDatabase

java.lang.Object
   |
   +----java.security.Identity
           |
           +----java.security.IdentityScope
                   |
                   +----sun.security.provider.IdentityDatabase

public class IdentityDatabase
extends IdentityScope
implements Serializable
An implementation of IdentityScope as a persistent identity database.

See Also:
Identity, Key

Constructor Index

 o IdentityDatabase(File)
Construct a new, empty database with a specified source file.
 o IdentityDatabase(String)
Construct a new, empty database.

Method Index

 o addIdentity(Identity)
Adds an identity to the database.
 o fromFile(File)
Initialize an IdentityDatabase from file.
 o fromStream(InputStream)
Initialize an identity database from a stream.
 o getIdentity(PublicKey)
Get an identity by key.
 o getIdentity(String)
 o identities()
 o removeIdentity(Identity)
Removes an identity to the database.
 o save()
Saves the database to the default source file.
 o save(OutputStream)
Save the database in its current state to an output stream.
 o size()
 o toString()

Constructors

 o IdentityDatabase
 public IdentityDatabase(File file) throws InvalidParameterException
Construct a new, empty database with a specified source file.

Parameters:
file - the source file.
 o IdentityDatabase
 public IdentityDatabase(String name) throws InvalidParameterException
Construct a new, empty database.

Methods

 o fromStream
 public static IdentityDatabase fromStream(InputStream is) throws IOException
Initialize an identity database from a stream. The stream should contain data to initialized a serialized IdentityDatabase object.

Parameters:
is - the input stream from which to restore the database.
Throws: IOException
if a stream IO exception occurs
 o fromFile
 public static IdentityDatabase fromFile(File f) throws IOException
Initialize an IdentityDatabase from file.

Parameters:
f - the filename where the identity database is stored.
Throws: IOException
a file-related exception occurs (e.g. the directory of the file passed does not exists, etc.
 o size
 public int size()
Returns:
the number of identities in the database.
Overrides:
size in class IdentityScope
 o getIdentity
 public Identity getIdentity(String name)
Parameters:
name - the name of the identity to be retrieved.
Returns:
the identity named name, or null if there are no identities named name in the database.
Overrides:
getIdentity in class IdentityScope
 o getIdentity
 public Identity getIdentity(PublicKey key)
Get an identity by key.

Parameters:
name - the key of the identity to be retrieved.
Returns:
the identity with a given key, or null if there are no identities with that key in the database.
Overrides:
getIdentity in class IdentityScope
 o addIdentity
 public void addIdentity(Identity identity) throws KeyManagementException
Adds an identity to the database.

Parameters:
identity - the identity to be added.
Throws: KeyManagementException
if a name or key clash occurs, or if another exception occurs.
Overrides:
addIdentity in class IdentityScope
 o removeIdentity
 public void removeIdentity(Identity identity) throws KeyManagementException
Removes an identity to the database.

Parameters:
identity - the identity to be removed.
Throws: KeyManagementException
if the identity is missing, or another exception occurs.
Overrides:
removeIdentity in class IdentityScope
 o identities
 public Enumeration identities()
Returns:
an enumeration of all identities in the database.
Overrides:
identities in class IdentityScope
 o save
 public void save(OutputStream os) throws IOException
Save the database in its current state to an output stream.

Parameters:
os - the output stream to which the database should be serialized.
Throws: IOException
if an IO exception is raised by stream operations.
 o save
 public void save() throws IOException
Saves the database to the default source file.

Throws: IOException
when there is no default source file specified for this database.
 o toString
 public String toString()
Overrides:
toString in class IdentityScope

All Packages  Class Hierarchy  This Package  Previous  Next  Index