org.apache.lenya.ac.impl
Class DefaultPolicy

java.lang.Object
  extended by org.apache.lenya.ac.impl.DefaultPolicy
All Implemented Interfaces:
Policy

public class DefaultPolicy
extends java.lang.Object
implements Policy

A DefaultPolicy is the own policy of a certain URL (not merged).


Constructor Summary
DefaultPolicy()
           
 
Method Summary
 void addCredential(Credential credential)
          Adds a credential to this policy.
 void addRole(Accreditable accreditable, Role role)
          Adds a role to this policy for a certain accreditable and a certain role.
 Credential getCredential(Accreditable accreditable)
          Returns the credential for a certain accreditable.
 Credential[] getCredentials()
          Returns the credentials of this policy.
 Role[] getRoles(Identity identity)
          Returns all roles of a certain identity.
 boolean isEmpty()
          Returns if the policy is empty.
 boolean isSSLProtected()
          Returns if this policy requires SSL protection.
protected  void removeCredential(Credential credential)
          Removes a credential.
 void removeRole(Accreditable accreditable, Role role)
          Removes a role from this policy for a certain accreditable and a certain role.
 void removeRoles(Accreditable accreditable)
          Removes all roles for a certain accreditable.
 void setSSL(boolean ssl)
          Sets if this policy requires SSL protection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPolicy

public DefaultPolicy()
Method Detail

addCredential

public void addCredential(Credential credential)
Adds a credential to this policy.

Parameters:
credential - A credential.

addRole

public void addRole(Accreditable accreditable,
                    Role role)
Adds a role to this policy for a certain accreditable and a certain role. If a credenital exists for the accreditable, the role is added to this credential. Otherwise, a new credential is created.

Parameters:
accreditable - An accreditable.
role - A role.

removeRole

public void removeRole(Accreditable accreditable,
                       Role role)
                throws AccessControlException
Removes a role from this policy for a certain accreditable and a certain role.

Parameters:
accreditable - An accreditable.
role - A role.
Throws:
AccessControlException - if the accreditable-role pair is not contained.

getCredentials

public Credential[] getCredentials()
Returns the credentials of this policy.

Returns:
An array of credentials.

getRoles

public Role[] getRoles(Identity identity)
Description copied from interface: Policy
Returns all roles of a certain identity.

Specified by:
getRoles in interface Policy
Parameters:
identity - The identity.
Returns:
An array of roles.
See Also:
Policy.getRoles(org.apache.lenya.ac.Identity)

getCredential

public Credential getCredential(Accreditable accreditable)
Returns the credential for a certain accreditable.

Parameters:
accreditable - An accreditable.
Returns:
A credential.

isSSLProtected

public boolean isSSLProtected()
                       throws AccessControlException
Description copied from interface: Policy
Returns if this policy requires SSL protection.

Specified by:
isSSLProtected in interface Policy
Returns:
A boolean value.
Throws:
AccessControlException - when something went wrong.
See Also:
Policy.isSSLProtected()

setSSL

public void setSSL(boolean ssl)
Sets if this policy requires SSL protection.

Parameters:
ssl - A boolean value.

isEmpty

public boolean isEmpty()
                throws AccessControlException
Description copied from interface: Policy
Returns if the policy is empty. A policy is empty if it does not contain any credentials.

Specified by:
isEmpty in interface Policy
Returns:
A boolean value.
Throws:
AccessControlException - when something went wrong.
See Also:
Policy.isEmpty()

removeCredential

protected void removeCredential(Credential credential)
                         throws AccessControlException
Removes a credential.

Parameters:
credential - The credential to remove.
Throws:
AccessControlException - If the credential does not exist.

removeRoles

public void removeRoles(Accreditable accreditable)
                 throws AccessControlException
Removes all roles for a certain accreditable.

Parameters:
accreditable - The accreditable to remove all roles for.
Throws:
AccessControlException - If no credential exists for this accreditable.


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.