FileDocCategorySizeDatePackage
DBPrincipal.javaAPI DocExample1034Thu Mar 08 22:18:44 GMT 2001javasec.samples.ch15

DBPrincipal

public class DBPrincipal extends Object implements Serializable, PrincipalComparator, Principal

Fields Summary
private String
name
Constructors Summary
public DBPrincipal(String name)

        this.name = name;
    
Methods Summary
public booleanequals(java.lang.Object o)

        if (!(o instanceof DBPrincipal))
            return false;
        return ((DBPrincipal) o).name.equals(name);
    
public java.lang.StringgetName()

        return name;
    
public booleanimplies(javax.security.auth.Subject s)

        Set set = s.getPrincipals(DBPrincipal.class);
        Iterator i = set.iterator();
        if (i.hasNext() && name.equals("DBA"))
            return true;
        try {
            while (true) {
                DBPrincipal p = (DBPrincipal) i.next();
                if (p.equals(this))
                    return true;
            }
        } catch (NoSuchElementException nsee) {
            return false;
        }