org.apache.lenya.ac.impl
Class URLPolicy

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

public class URLPolicy
extends java.lang.Object
implements Policy

A policy at a certain URL. The final policy is computed by merging the subtree policies of all ancestor-or-self directories with the URL policy of the actual URL.


Constructor Summary
URLPolicy(AccreditableManager controller, java.lang.String url, InheritingPolicyManager manager)
          Returns the resulting policy for a certain URL.
 
Method Summary
protected  void addRoles(Policy policy, Identity identity, java.util.Set roles)
          Adds the roles of an identity of a policy to a role set.
 AccreditableManager getAccreditableManager()
          Returns the access controller.
static Role getAdministratorRole(AccreditableManager manager)
          Returns the administrator role.
static Role getAuthorRole(AccreditableManager manager)
          Returns the author role.
 InheritingPolicyManager getPolicyManager()
          Returns the policy builder.
 Role[] getRoles(Identity identity)
          Returns all roles of a certain identity.
 java.lang.String getUrl()
          Returns the URL of this policy.
static Role getVisitorRole(AccreditableManager manager)
          Returns the visitor role.
 boolean isEmpty()
          Returns if the policy is empty.
 boolean isSSLProtected()
          The URL policy requires SSL protection if one of its member policies requires SSL protection.
protected  void obtainPolicies()
          Obtains the policies from the policy manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLPolicy

public URLPolicy(AccreditableManager controller,
                 java.lang.String url,
                 InheritingPolicyManager manager)
Returns the resulting policy for a certain URL.

Parameters:
controller - The acccess controller.
url - The URL.
manager - The policy manager.
Method Detail

obtainPolicies

protected void obtainPolicies()
                       throws AccessControlException
Obtains the policies from the policy manager. This method is expensive and therefore only called when needed.

Throws:
AccessControlException - when something went wrong.

getRoles

public Role[] getRoles(Identity identity)
                throws AccessControlException
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.
Throws:
AccessControlException - when something went wrong.
See Also:
Policy.getRoles(org.apache.lenya.ac.Identity)

getVisitorRole

public static Role getVisitorRole(AccreditableManager manager)
                           throws AccessControlException
Returns the visitor role.

Parameters:
manager - The accreditable manager.
Returns:
A role.
Throws:
AccessControlException - when something went wrong.

getAdministratorRole

public static Role getAdministratorRole(AccreditableManager manager)
                                 throws AccessControlException
Returns the administrator role.

Parameters:
manager - The accreditable manager.
Returns:
A role.
Throws:
AccessControlException - when something went wrong.

getAuthorRole

public static Role getAuthorRole(AccreditableManager manager)
                          throws AccessControlException
Returns the author role.

Parameters:
manager - The accreditable manager.
Returns:
A role.
Throws:
AccessControlException - when something went wrong.

addRoles

protected void addRoles(Policy policy,
                        Identity identity,
                        java.util.Set roles)
                 throws AccessControlException
Adds the roles of an identity of a policy to a role set.

Parameters:
policy - The policy.
identity - The identity.
roles - The role set.
Throws:
AccessControlException - when something went wrong.

getUrl

public java.lang.String getUrl()
Returns the URL of this policy.

Returns:
The URL of this policy.

getPolicyManager

public InheritingPolicyManager getPolicyManager()
Returns the policy builder.

Returns:
A policy builder.

getAccreditableManager

public AccreditableManager getAccreditableManager()
Returns the access controller.

Returns:
An access controller.

isSSLProtected

public boolean isSSLProtected()
                       throws AccessControlException
The URL policy requires SSL protection if one of its member policies requires SSL protection.

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

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()


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