com.novell.java.security
Class IdentityScope

java.lang.Object
  |
  +--com.novell.java.security.Identity
        |
        +--com.novell.java.security.IdentityScope

public abstract class IdentityScope
extends Identity

Represents a scope for identities. It is an identity itself, and therefore has a name, can have a scope, and can optionally have a public key and associated certificates.

An IdentityScope can contain identity objects of all kinds, including signers. All types of identity objects can be retrieved, added, and removed using the same methods. Note that it is possible, and in fact expected, that different types of identity scopes will apply different policies for their various operations on the various types of identities.

There is a one-to-one mapping between keys and identities, and there can be only one copy of one key per scope. For example, suppose Acme Software, Inc is a software publisher known to a user. Suppose it is an Identity, that is, it has a public key and a set of associated certificates. It is named in the scope using the name Acme Software. No other named identity in the scope has the same public key or the same name.

See Also:
Identity, Principal, Key

Constructor Summary
IdentityScope(java.lang.String name)
          Constructs a new identity scope with the specified name.
IdentityScope(java.lang.String name, IdentityScope scope)
          Constructs a new IdentityScope with the specified name and scope.
 
Method Summary
abstract  void addIdentity(Identity identity)
          Adds an identity to this IdentityScope.
 Identity getIdentity(Principal principal)
          Retrieves the identity whose name is the same as that of the specified Principal, or NULL if there are no identities of the same name in this scope.
abstract  Identity getIdentity(PublicKey key)
          Retrieves the identity with the specified PublicKey.
abstract  Identity getIdentity(java.lang.String name)
          Returns the identity of the specified name in this scope, or NULL if there are no identities named.
static IdentityScope getSystemScope()
          Returns the system's IdentityScope.
abstract  java.util.Enumeration identities()
          Returns an enumeration of all identities in this IdentityScope.
abstract  void removeIdentity(Identity identity)
          Removes an identity from this IdentityScope.
abstract  int size()
          Returns the number of identities within this IdentityScope.
 java.lang.String toString()
          Generates a short String representation of this IdentityScope, including its name, its scope name, and the number of identities included.
 
Methods inherited from class com.novell.java.security.Identity
addCertificate, equals, getCertificates, getInfo, getName, getPublicKey, getScope, hashCode, removeCertificate, setInfo, setPublicKey, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IdentityScope

public IdentityScope(java.lang.String name)
Constructs a new identity scope with the specified name.
Parameters:
The - name of the scope.

IdentityScope

public IdentityScope(java.lang.String name,
                     IdentityScope scope)
              throws KeyManagementException
Constructs a new IdentityScope with the specified name and scope.
Parameters:
name - The name of the IdentityScope.
scope - The scope for the new IdentityScope.
Throws:
KeyManagementException - Thrown if there is already an identity with the same name in the scope.
Method Detail

getSystemScope

public static IdentityScope getSystemScope()
Returns the system's IdentityScope. See the System Identity Scope section in Sun's Java Cryptography Architecture API Specification & Reference documentation.
Returns:
The system's IdentityScope.

size

public abstract int size()
Returns the number of identities within this IdentityScope.
Returns:
The number of identities within this IdentityScope.

getIdentity

public abstract Identity getIdentity(java.lang.String name)
Returns the identity of the specified name in this scope, or NULL if there are no identities named.
Parameters:
name - The name of the identity to be retrieved.
Returns:
The identity of the specified name or NULL.

getIdentity

public Identity getIdentity(Principal principal)
Retrieves the identity whose name is the same as that of the specified Principal, or NULL if there are no identities of the same name in this scope. Note that Identity implements Principal.
Parameters:
principal - The Principal corresponding to the identity to be retrieved.
Returns:
The identity whose name is the same as that of the principal, or NULL.

getIdentity

public abstract Identity getIdentity(PublicKey key)
Retrieves the identity with the specified PublicKey.
Parameters:
key - The PublicKey for the identity to be returned.
Returns:
The identity for the specified PublicKey, or NULL if there are no identities in this scope with that key.

addIdentity

public abstract void addIdentity(Identity identity)
                          throws KeyManagementException
Adds an identity to this IdentityScope.
Parameters:
The - Identity to be added to this IdentityScope.
Throws:
KeyManagementException - Thrown if the identity is not valid, a name conflict occurs, another identity has the same public key as the identity being added, or another exception occurs.

removeIdentity

public abstract void removeIdentity(Identity identity)
                             throws KeyManagementException
Removes an identity from this IdentityScope.
Parameters:
identity - The Identity to be removed.
Throws:
KeyManagementException - Thrown if the identity is missing, or another exception occurs.

identities

public abstract java.util.Enumeration identities()
Returns an enumeration of all identities in this IdentityScope.
Returns:
An enumeration of all identities in this IdentityScope.

toString

public java.lang.String toString()
Generates a short String representation of this IdentityScope, including its name, its scope name, and the number of identities included. The returned string, which textually represents the object, should be a concise but informative representation that is easy to read.
Returns:
A String containing information about this IdentityScope.
Overrides:
toString in class Identity