FileDocCategorySizeDatePackage
AclEntryImpl.javaAPI DocAndroid 1.5 API3661Wed May 06 22:41:06 BST 2009org.apache.harmony.security.tests.support.acl

AclEntryImpl

public class AclEntryImpl extends Object implements AclEntry
Additional class for verification AclEntry interface

Fields Summary
private Principal
user
private Vector
permissionSet
private boolean
negative
Constructors Summary
public AclEntryImpl(Principal principal)

        user = null;
        permissionSet = new Vector(10, 10);
        negative = false;
        user = principal;
    
public AclEntryImpl()

        user = null;
        permissionSet = new Vector(10, 10);
        negative = false;
    
Methods Summary
public booleanaddPermission(Permission permission)

        if(permissionSet.contains(permission)) {
            return false;
        } else {
            permissionSet.addElement(permission);
            return true;
        }
    
public booleancheckPermission(Permission permission)

        return permissionSet.contains(permission);
    
public synchronized java.lang.Objectclone()

        AclEntryImpl aclentryimpl = new AclEntryImpl(user);
        aclentryimpl.permissionSet = (Vector)permissionSet.clone();
        aclentryimpl.negative = negative;
        return aclentryimpl;
    
public java.security.PrincipalgetPrincipal()

        return user;
    
public booleanisNegative()

        return negative;
    
public java.util.Enumerationpermissions()

        return permissionSet.elements();
    
public booleanremovePermission(Permission permission)

        return permissionSet.removeElement(permission);
    
public voidsetNegativePermissions()

        negative = true;
    
public booleansetPrincipal(java.security.Principal principal)

        if(user != null) {
            return false;
        } else {
            user = principal;
            return true;
        }
    
public java.lang.StringtoString()

        StringBuffer stringbuffer = new StringBuffer();
        if(negative)
            stringbuffer.append("-");
        else
            stringbuffer.append("+");
        if(user instanceof Group)
            stringbuffer.append("Group.");
        else
            stringbuffer.append("User.");
        stringbuffer.append((new StringBuilder()).append(user).append("=").toString());
        Enumeration enumeration = permissions();
        do {
            if(!enumeration.hasMoreElements())
                break;
            Permission permission = (Permission)enumeration.nextElement();
            stringbuffer.append(permission);
            if(enumeration.hasMoreElements())
                stringbuffer.append(",");
        } while(true);
        return new String(stringbuffer);