org.apache.lenya.ac.impl
Class PolicyBuilder

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

public class PolicyBuilder
extends java.lang.Object
implements InputStreamBuilder

Builds policies from input streams.

Version:
$Id: PolicyBuilder.java 473841 2006-11-12 00:46:38Z gregor $

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 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(AccreditableManager accreditableManager)
          Ctor.
 
Method Summary
 java.lang.Object build(java.io.InputStream stream)
          Builds an object from an input stream.
 DefaultPolicy buildPolicy(org.w3c.dom.Document document)
          Builds a policy from an XML document.
 DefaultPolicy buildPolicy(java.io.InputStream stream)
          Builds a policy from an input stream.
protected  Accreditable getAccreditable(java.lang.String elementName, java.lang.String id)
          Creates an accredtiable for an element.
 AccreditableManager getAccreditableManager()
          Returns the accreditable manager.
protected static org.w3c.dom.Element save(Accreditable accreditable, NamespaceHelper helper)
          Saves an accreditable to an XML element.
static org.w3c.dom.Document savePolicy(DefaultPolicy 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
Constructor Detail

PolicyBuilder

public PolicyBuilder(AccreditableManager accreditableManager)
Ctor.

Parameters:
accreditableManager - An accreditable manager.
Method Detail

getAccreditableManager

public AccreditableManager getAccreditableManager()
Returns the accreditable manager.

Returns:
An accreditable manager.

buildPolicy

public DefaultPolicy buildPolicy(java.io.InputStream stream)
                          throws AccessControlException
Builds a policy from an input stream.

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

buildPolicy

public DefaultPolicy buildPolicy(org.w3c.dom.Document document)
                          throws AccessControlException
Builds a policy from an XML document.

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

getAccreditable

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

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

savePolicy

public static org.w3c.dom.Document savePolicy(DefaultPolicy policy)
                                       throws AccessControlException
Saves a policy to an XML document.

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

save

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

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

build

public java.lang.Object build(java.io.InputStream stream)
                       throws BuildException
Description copied from interface: InputStreamBuilder
Builds an object from an input stream.

Specified by:
build in interface InputStreamBuilder
Parameters:
stream - An input stream.
Returns:
An object.
Throws:
BuildException - when building the object failed.
See Also:
InputStreamBuilder.build(java.io.InputStream)


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