org.apache.lenya.ac.impl
Class PolicyBuilder

java.lang.Object
  extended by org.apache.lenya.ac.impl.PolicyBuilder
All Implemented Interfaces:
org.apache.lenya.ac.cache.InputStreamBuilder
Direct Known Subclasses:
RemovedAccreditablePolicyBuilder

public class PolicyBuilder
extends java.lang.Object
implements org.apache.lenya.ac.cache.InputStreamBuilder

Builds policies from input streams.

Version:
$Id: PolicyBuilder.java 603883 2007-12-13 11:01:32Z andreas $

Field Summary
protected static java.lang.String GROUP_ELEMENT
           
protected static java.lang.String ID_ATTRIBUTE
           
protected static java.lang.String IP_RANGE_ELEMENT
           
protected static java.lang.String METHOD_ATTRIBUTE
           
protected static java.lang.String POLICY_ELEMENT
           
protected static java.lang.String ROLE_ELEMENT
           
protected static java.lang.String SSL_ATTRIBUTE
           
protected static java.lang.String USER_ELEMENT
           
protected static java.lang.String WORLD_ELEMENT
           
 
Constructor Summary
PolicyBuilder(org.apache.lenya.ac.AccreditableManager _accreditableManager)
          Ctor.
 
Method Summary
 java.lang.Object build(java.io.InputStream stream)
           
 org.apache.lenya.ac.ModifiablePolicy buildPolicy(org.w3c.dom.Document document)
          Builds a policy from an XML document.
 org.apache.lenya.ac.ModifiablePolicy buildPolicy(java.io.InputStream stream)
          Builds a policy from an input stream.
protected  org.apache.lenya.ac.Accreditable getAccreditable(java.lang.String elementName, java.lang.String id)
          Creates an accredtiable for an element.
 org.apache.lenya.ac.AccreditableManager getAccreditableManager()
          Returns the accreditable manager.
protected static org.w3c.dom.Element save(org.apache.lenya.ac.Accreditable accreditable, org.apache.lenya.xml.NamespaceHelper helper)
          Saves an accreditable to an XML element.
static org.w3c.dom.Document savePolicy(org.apache.lenya.ac.Policy policy)
          Saves a policy to an XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLICY_ELEMENT

protected static final java.lang.String POLICY_ELEMENT
See Also:
Constant Field Values

GROUP_ELEMENT

protected static final java.lang.String GROUP_ELEMENT
See Also:
Constant Field Values

USER_ELEMENT

protected static final java.lang.String USER_ELEMENT
See Also:
Constant Field Values

ROLE_ELEMENT

protected static final java.lang.String ROLE_ELEMENT
See Also:
Constant Field Values

WORLD_ELEMENT

protected static final java.lang.String WORLD_ELEMENT
See Also:
Constant Field Values

IP_RANGE_ELEMENT

protected static final java.lang.String IP_RANGE_ELEMENT
See Also:
Constant Field Values

ID_ATTRIBUTE

protected static final java.lang.String ID_ATTRIBUTE
See Also:
Constant Field Values

SSL_ATTRIBUTE

protected static final java.lang.String SSL_ATTRIBUTE
See Also:
Constant Field Values

METHOD_ATTRIBUTE

protected static final java.lang.String METHOD_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

PolicyBuilder

public PolicyBuilder(org.apache.lenya.ac.AccreditableManager _accreditableManager)
Ctor.

Parameters:
_accreditableManager - An accreditable manager.
Method Detail

getAccreditableManager

public org.apache.lenya.ac.AccreditableManager getAccreditableManager()
Returns the accreditable manager.

Returns:
An accreditable manager.

buildPolicy

public org.apache.lenya.ac.ModifiablePolicy buildPolicy(java.io.InputStream stream)
                                                 throws org.apache.lenya.ac.AccessControlException
Builds a policy from an input stream.

Parameters:
stream - The input stream to read the policy from.
Returns:
A policy.
Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

buildPolicy

public org.apache.lenya.ac.ModifiablePolicy buildPolicy(org.w3c.dom.Document document)
                                                 throws org.apache.lenya.ac.AccessControlException
Builds a policy from an XML document.

Parameters:
document - The XML document.
Returns:
A policy.
Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

getAccreditable

protected org.apache.lenya.ac.Accreditable getAccreditable(java.lang.String elementName,
                                                           java.lang.String id)
                                                    throws org.apache.lenya.ac.AccessControlException
Creates an accredtiable for an element.

Parameters:
elementName - The elment name.
id - The ID of the accreditable.
Returns:
An accreditable.
Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

savePolicy

public static org.w3c.dom.Document savePolicy(org.apache.lenya.ac.Policy policy)
                                       throws org.apache.lenya.ac.AccessControlException
Saves a policy to an XML document.

Parameters:
policy - The policy to save.
Returns:
A DOM document.
Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

save

protected static org.w3c.dom.Element save(org.apache.lenya.ac.Accreditable accreditable,
                                          org.apache.lenya.xml.NamespaceHelper helper)
                                   throws org.apache.lenya.ac.AccessControlException
Saves an accreditable to an XML element.

Parameters:
accreditable - The accreditable.
helper - The namespace helper to be used.
Returns:
An XML element.
Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

build

public java.lang.Object build(java.io.InputStream stream)
                       throws org.apache.lenya.ac.cache.BuildException
Specified by:
build in interface org.apache.lenya.ac.cache.InputStreamBuilder
Throws:
org.apache.lenya.ac.cache.BuildException
See Also:
InputStreamBuilder.build(java.io.InputStream)


Copyright © $ Apache Software Foundation. All Rights Reserved.