nbi.xmlsec.xacml.profile.rbac
Class RBACPolicySet

java.lang.Object
  extended bynbi.xmlsec.xacml.profile.rbac.RBACPolicyElement
      extended bynbi.xmlsec.xacml.profile.rbac.RBACPolicy
          extended bynbi.xmlsec.xacml.profile.rbac.RBACPolicySet
Direct Known Subclasses:
PermissionPolicySet, RoleAssignmentPolicySet, RolePolicySet

public class RBACPolicySet
extends RBACPolicy

Base class for all RBACPolicySets.

Since:
Version:
$Revision: 1.6 $
Author:
Lutz Suhrbier

Field Summary
private  int policyRepresentationType
          The policy representation type.
static int REPRESENT_POLICIES_AS_NONE
          Policy Representation Unknown.
static int REPRESENT_POLICIES_AS_POLICY
          Policy Representation Policy.
static int REPRESENT_POLICIES_AS_POLICYREF
          Policy Representation Policy Reference.
 
Fields inherited from class nbi.xmlsec.xacml.profile.rbac.RBACPolicy
elements, logger, permitRule
 
Fields inherited from class nbi.xmlsec.xacml.profile.rbac.RBACPolicyElement
 
Constructor Summary
protected RBACPolicySet()
           
  RBACPolicySet(Identifier id, int type)
          Create an RBACPolicyElement.
  RBACPolicySet(URI id, int type)
          Create an RBACPolicySet.
 
Method Summary
 void encode(File path)
          Encodes this PolicySet and all included RBACPolicy or RBACPolicySet elements into its XML representation and writes them to the file path using the path parameter as parent directory and the identifier's file representation as file name.
 int getPolicyRepresentationType()
          Gets the policyRepresentationType
 void parse(PolicyTreeElement element)
          Not implemented.
protected  void parse(PolicyTreeElement element, Class policyClass, Class policyReferenceClass, Class policySetClass)
          Default method to parse policy sets.
 void setPolicyRepresentationType(int policyRepresentationType)
          Sets policyRepresentationType
 PolicyReference toPolicyRerence()
          Returns the PolicyReference representation of this policy set.
 PolicyTreeElement toPolicyTreeElement()
          Default method to generate the PolicySetrepresentation of this RBACPolicySet.
 
Methods inherited from class nbi.xmlsec.xacml.profile.rbac.RBACPolicy
add, encode, equals, getElements, isPermitRule, parse, remove, search, search, setPermitRule, toPolicyRerence, toPolicyTreeElement
 
Methods inherited from class nbi.xmlsec.xacml.profile.rbac.RBACPolicyElement
getIdentifier, getTarget, hashCode, parse, setIdentifier, setIdentifier, setTarget, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

REPRESENT_POLICIES_AS_NONE

public static final int REPRESENT_POLICIES_AS_NONE
Policy Representation Unknown.

See Also:
Constant Field Values

REPRESENT_POLICIES_AS_POLICYREF

public static final int REPRESENT_POLICIES_AS_POLICYREF
Policy Representation Policy Reference.

See Also:
Constant Field Values

REPRESENT_POLICIES_AS_POLICY

public static final int REPRESENT_POLICIES_AS_POLICY
Policy Representation Policy.

See Also:
Constant Field Values

policyRepresentationType

private int policyRepresentationType
The policy representation type.

Constructor Detail

RBACPolicySet

protected RBACPolicySet()

RBACPolicySet

public RBACPolicySet(URI id,
                     int type)
              throws ParsingException
Create an RBACPolicySet.

Parameters:
id - Identifier of this element (domain:assignment:label).
type - Type of the policyRepresentation REPRESENT_POLICIES_AS_POLICYREF or REPRESENT_POLICIES_AS_POLICY.
Throws:
ParsingException - Indicates a malformed identifier representation.

RBACPolicySet

public RBACPolicySet(Identifier id,
                     int type)
Create an RBACPolicyElement.

Parameters:
id - Identifier of this element (domain:assignment:label).
type - Type of the policyRepresentation REPRESENT_POLICIES_AS_POLICYREF or REPRESENT_POLICIES_AS_POLICY.
Method Detail

parse

protected void parse(PolicyTreeElement element,
                     Class policyClass,
                     Class policyReferenceClass,
                     Class policySetClass)
              throws ParsingException
Default method to parse policy sets.
  • Verifies whether the parsed element is an policy set
  • Sets the identifier of the policy set
  • Calls parse(Target).
  • Adds each child element of the policy set according to its class type Policy,PolicyReferenceor PolicySet, .
  • Sets the policy representation type according to the class type of the first child element
  • According to the class type of the child element, an instance of the related class (policyClass, policyReferenceClass or policySetClass) is created with the child element as single parameter. This instance is added to the set of policy elements. If the related class parameter is null, then a ParsingExceptionis thrown when the related child element type is parsed.

    Parameters:
    element - The policy set to parse.
    policyClass - Class to be instantiated for child elements instances of the (@link Policy Policy} class.
    policyReferenceClass - Class to be instantiated for child elements instances of the (@link PolicyReference PolicyReference} class.
    policySetClass - Class to be instantiated for child elements instances of the (@link PolicySet PolicySet} class.
    Throws:
    ParsingException - If some parsing error occurs.

    parse

    public void parse(PolicyTreeElement element)
               throws ParsingException
    Not implemented. Must be overwritten in subclasses.

    Overrides:
    parse in class RBACPolicy
    Throws:
    ParsingException

    toPolicyTreeElement

    public PolicyTreeElement toPolicyTreeElement()
    Default method to generate the PolicySetrepresentation of this RBACPolicySet. Set the policy algorithm to PermitOverridesPolicyAlg. For each element of the policy set, adds the policy reference or policy representation of the element to the policy set. The representation type for policies is set according to the policy representation type. Policy sets are represented as policy references.

    Overrides:
    toPolicyTreeElement in class RBACPolicy
    Returns:
    The PolicySetrepresentation.
    See Also:
    RBACPolicyElement.toPolicyTreeElement()

    toPolicyRerence

    public PolicyReference toPolicyRerence()
    Returns the PolicyReference representation of this policy set. The default type of the policy reference is set to PolicyReference.POLICYSET_REFERENCE).

    Overrides:
    toPolicyRerence in class RBACPolicy
    Returns:
    The policy element's PolicyReference representation with type set to PolicyReference.POLICY_REFERENCE).

    encode

    public void encode(File path)
                throws IOException
    Encodes this PolicySet and all included RBACPolicy or RBACPolicySet elements into its XML representation and writes them to the file path using the path parameter as parent directory and the identifier's file representation as file name. Creates directories if missing.

    Overrides:
    encode in class RBACPolicy
    Parameters:
    path - Base directory path to the policies.
    Throws:
    IOException

    getPolicyRepresentationType

    public int getPolicyRepresentationType()
    Gets the policyRepresentationType

    Returns:
    Returns the policyRepresentationType.

    setPolicyRepresentationType

    public void setPolicyRepresentationType(int policyRepresentationType)
    Sets policyRepresentationType

    Parameters:
    policyRepresentationType - The policyRepresentationType to set.


    Copyright © 2006 Lutz Suhrbier, Freie Universitšt Berlin. All Rights Reserved.