FileDocCategorySizeDatePackage
SystemScope.javaAPI DocAndroid 1.5 API4685Wed May 06 22:41:06 BST 2009org.apache.harmony.security

SystemScope

public class SystemScope extends IdentityScope
see
java.security.IdentityScope

Fields Summary
private static final long
serialVersionUID
private Hashtable
names
private Hashtable
keys
Constructors Summary
public SystemScope()

see
java.security.IdentityScope#IdentityScope()


           
      
        super();
    
public SystemScope(String name)

see
java.security.IdentityScope#IdentityScope(String)

        super(name);
    
public SystemScope(String name, IdentityScope scope)

see
java.security.IdentityScope#IdentityScope(String, IdentityScope)

        super(name, scope);
    
Methods Summary
public synchronized voidaddIdentity(java.security.Identity identity)

see
java.security.IdentityScope#addIdentity(java.security.Identity)

        if (identity == null) {
            throw new NullPointerException(Messages.getString("security.92")); //$NON-NLS-1$
        }

        String name = identity.getName();
        if (names.containsKey(name)) {
            throw new KeyManagementException(Messages.getString("security.93", name)); //$NON-NLS-1$
        }

        PublicKey key = identity.getPublicKey();
        if (key != null && keys.containsKey(key)) {
            throw new KeyManagementException(Messages.getString("security.94", key)); //$NON-NLS-1$
        }

        names.put(name, identity);
        if (key != null) {
            keys.put(key, identity);
        }
    
public synchronized java.security.IdentitygetIdentity(java.lang.String name)

see
java.security.IdentityScope#getIdentity(java.lang.String)

        if (name == null) {
            throw new NullPointerException();
        }
        return (Identity) names.get(name);
    
public synchronized java.security.IdentitygetIdentity(java.security.PublicKey key)

see
java.security.IdentityScope#getIdentity(java.security.PublicKey)

        if (key == null) {
            return null;
        }
        return (Identity) keys.get(key);
    
public java.util.Enumerationidentities()

see
java.security.IdentityScope#identities()

        return names.elements();
    
public synchronized voidremoveIdentity(java.security.Identity identity)

see
java.security.IdentityScope#removeIdentity(java.security.Identity)


        //Exception caught = null;
        if (identity == null) {
            throw new NullPointerException(Messages.getString("security.92")); //$NON-NLS-1$
        }

        String name = identity.getName();
        if (name == null) {
            throw new NullPointerException(Messages.getString("security.95")); //$NON-NLS-1$
        }

        boolean contains = names.containsKey(name);
        names.remove(name);

        PublicKey key = identity.getPublicKey();
        
        if (key != null) {
            contains = contains || keys.containsKey(key);
            keys.remove(key);
        }
        
        if (!contains) {
            throw new KeyManagementException(Messages.getString("security.96")); //$NON-NLS-1$
        }
    
public intsize()

see
java.security.IdentityScope#size()

        return names.size();