org.apache.lenya.cms.ac
Class DocumentPolicyManagerWrapper

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.cms.ac.DocumentPolicyManagerWrapper
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, InheritingPolicyManager, PolicyManager

public class DocumentPolicyManagerWrapper
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements InheritingPolicyManager, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Disposable

A PolicyManager which is capable of mapping all URLs of a document to the appropriate canonical URL, e.g. /foo/bar_de.print.html is mapped to /foo/bar.


Field Summary
 
Fields inherited from interface org.apache.lenya.ac.PolicyManager
ROLE
 
Constructor Summary
DocumentPolicyManagerWrapper()
          Ctor.
 
Method Summary
 void accreditableAdded(AccreditableManager manager, Accreditable accreditable)
          Called when an accreditable was added.
 void accreditableRemoved(AccreditableManager manager, Accreditable accreditable)
          Called when an accreditable was removed.
 DefaultPolicy buildSubtreePolicy(AccreditableManager controller, java.lang.String url)
          Builds a subtree policy from a file.
 DefaultPolicy buildURLPolicy(AccreditableManager controller, java.lang.String url)
          Builds the URL policy for a URL from a file.
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void dispose()
           
 DefaultPolicy[] getPolicies(AccreditableManager controller, java.lang.String url)
          Returns the existing policies for all URL steps, beginning with the root policy.
 Policy getPolicy(AccreditableManager controller, java.lang.String url)
          Returns the policy for a given page.
 InheritingPolicyManager getPolicyManager()
           
protected  java.lang.String getPolicyURL(java.lang.String webappUrl)
          Returns the URI which is used to obtain the policy for a webapp URL.
protected  Publication getPublication(java.lang.String url)
          Returns the publication for a certain URL.
protected  org.apache.avalon.framework.service.ServiceManager getServiceManager()
          Returns the service manager.
 void saveSubtreePolicy(java.lang.String url, DefaultPolicy policy)
          Saves a Subtree policy.
 void saveURLPolicy(java.lang.String url, DefaultPolicy policy)
          Saves a URL policy.
 void service(org.apache.avalon.framework.service.ServiceManager manager)
           
 void setPolicyManager(InheritingPolicyManager policyManager)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentPolicyManagerWrapper

public DocumentPolicyManagerWrapper()
Ctor.

Method Detail

getPolicyURL

protected java.lang.String getPolicyURL(java.lang.String webappUrl)
                                 throws AccessControlException
Returns the URI which is used to obtain the policy for a webapp URL.

Parameters:
webappUrl - The webapp URL.
Returns:
A string.
Throws:
AccessControlException - when something went wrong.

getPublication

protected Publication getPublication(java.lang.String url)
                              throws AccessControlException
Returns the publication for a certain URL.

Parameters:
url - The webapp url.
Returns:
A publication.
Throws:
AccessControlException - when the publication could not be created.

getServiceManager

protected org.apache.avalon.framework.service.ServiceManager getServiceManager()
Returns the service manager.

Returns:
A service manager.

service

public void service(org.apache.avalon.framework.service.ServiceManager manager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

getPolicyManager

public InheritingPolicyManager getPolicyManager()
Returns:
Returns the policyManager.

setPolicyManager

public void setPolicyManager(InheritingPolicyManager policyManager)
Parameters:
policyManager - The policyManager to set.

buildURLPolicy

public DefaultPolicy buildURLPolicy(AccreditableManager controller,
                                    java.lang.String url)
                             throws AccessControlException
Description copied from interface: InheritingPolicyManager
Builds the URL policy for a URL from a file. When the file is not present, an empty policy is returned.

Specified by:
buildURLPolicy in interface InheritingPolicyManager
Parameters:
controller - The access controller to use.
url - The URL inside the web application.
Returns:
A policy.
Throws:
AccessControlException - when something went wrong.
See Also:
InheritingPolicyManager.buildURLPolicy(org.apache.lenya.ac.AccreditableManager, java.lang.String)

buildSubtreePolicy

public DefaultPolicy buildSubtreePolicy(AccreditableManager controller,
                                        java.lang.String url)
                                 throws AccessControlException
Description copied from interface: InheritingPolicyManager
Builds a subtree policy from a file. When the file is not present, an empty policy is returned.

Specified by:
buildSubtreePolicy in interface InheritingPolicyManager
Parameters:
controller - The access controller to use.
url - The URL inside the web application.
Returns:
A policy.
Throws:
AccessControlException - when something went wrong.
See Also:
InheritingPolicyManager.buildSubtreePolicy(org.apache.lenya.ac.AccreditableManager, java.lang.String)

getPolicies

public DefaultPolicy[] getPolicies(AccreditableManager controller,
                                   java.lang.String url)
                            throws AccessControlException
Description copied from interface: InheritingPolicyManager
Returns the existing policies for all URL steps, beginning with the root policy.

Specified by:
getPolicies in interface InheritingPolicyManager
Parameters:
controller - The accreditable manager to use.
url - The URL inside the web application.
Returns:
An array of policies.
Throws:
AccessControlException - when something went wrong.
See Also:
InheritingPolicyManager.getPolicies(org.apache.lenya.ac.AccreditableManager, java.lang.String)

saveURLPolicy

public void saveURLPolicy(java.lang.String url,
                          DefaultPolicy policy)
                   throws AccessControlException
Description copied from interface: InheritingPolicyManager
Saves a URL policy.

Specified by:
saveURLPolicy in interface InheritingPolicyManager
Parameters:
url - The URL to save the policy for.
policy - The policy to save.
Throws:
AccessControlException - when something went wrong.
See Also:
InheritingPolicyManager.saveURLPolicy(java.lang.String, org.apache.lenya.ac.impl.DefaultPolicy)

saveSubtreePolicy

public void saveSubtreePolicy(java.lang.String url,
                              DefaultPolicy policy)
                       throws AccessControlException
Description copied from interface: InheritingPolicyManager
Saves a Subtree policy.

Specified by:
saveSubtreePolicy in interface InheritingPolicyManager
Parameters:
url - The url to save the policy for.
policy - The policy to save.
Throws:
AccessControlException - when something went wrong.
See Also:
InheritingPolicyManager.saveSubtreePolicy(java.lang.String, org.apache.lenya.ac.impl.DefaultPolicy)

getPolicy

public Policy getPolicy(AccreditableManager controller,
                        java.lang.String url)
                 throws AccessControlException
Description copied from interface: PolicyManager
Returns the policy for a given page.

Specified by:
getPolicy in interface PolicyManager
Parameters:
controller - The access controller.
url - The url inside the web application.
Returns:
The policy.
Throws:
AccessControlException - when something went wrong.
See Also:
PolicyManager.getPolicy(org.apache.lenya.ac.AccreditableManager, java.lang.String)

accreditableRemoved

public void accreditableRemoved(AccreditableManager manager,
                                Accreditable accreditable)
                         throws AccessControlException
Description copied from interface: PolicyManager
Called when an accreditable was removed. Used to clean up the policies and to remove the admin interface policy.

Specified by:
accreditableRemoved in interface PolicyManager
Parameters:
manager - The accreditable manager the accreditable belonged to.
accreditable - The accreditable that was removed.
Throws:
AccessControlException - when something went wrong.
See Also:
PolicyManager.accreditableRemoved(org.apache.lenya.ac.AccreditableManager, org.apache.lenya.ac.Accreditable)

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
Disposable.dispose()

accreditableAdded

public void accreditableAdded(AccreditableManager manager,
                              Accreditable accreditable)
                       throws AccessControlException
Description copied from interface: PolicyManager
Called when an accreditable was added. Used to create the admin interface policy.

Specified by:
accreditableAdded in interface PolicyManager
Parameters:
manager - The accreditable manager the accreditable belonged to.
accreditable - The accreditable that was removed.
Throws:
AccessControlException - when something went wrong.
See Also:
PolicyManager.accreditableAdded(org.apache.lenya.ac.AccreditableManager, org.apache.lenya.ac.Accreditable)


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