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

PolicyEntry

public class PolicyEntry extends Object
This class represents an elementary block of a security policy. It associates a CodeSource of an executable code, Principals allowed to execute the code, and a set of granted Permissions.
see
org.apache.harmony.security.fortress.DefaultPolicy

Fields Summary
private final CodeSource
cs
private final Principal[]
principals
private final Collection
permissions
Constructors Summary
public PolicyEntry(CodeSource cs, Collection prs, Collection permissions)
Constructor with initialization parameters. Passed collections are not referenced directly, but copied.

        this.cs = cs;
        this.principals = (prs == null || prs.isEmpty()) ? null
                : (Principal[]) prs.toArray(new Principal[prs.size()]);
        this.permissions = (permissions == null || permissions.isEmpty()) ? null
                : Collections.unmodifiableCollection(permissions);
    
Methods Summary
public java.util.CollectiongetPermissions()
Returns unmodifiable collection of permissions defined by this PolicyEntry, may be null.

        return permissions;
    
public booleanimpliesCodeSource(java.security.CodeSource codeSource)
Checks if passed CodeSource matches this PolicyEntry. Null CodeSource of PolicyEntry implies any CodeSource; non-null CodeSource forwards to its imply() method.

        return (cs == null) ? true : cs.implies(codeSource);
    
public booleanimpliesPrincipals(java.security.Principal[] prs)
Checks if specified Principals match this PolicyEntry. Null or empty set of Principals of PolicyEntry implies any Principals; otherwise specified array must contain all Principals of this PolicyEntry.

        return PolicyUtils.matchSubset(principals, prs);
    
public booleanisVoid()
Returns true if this PolicyEntry defines no Permissions, false otherwise.

        return permissions == null || permissions.size() == 0;