nbi.xmlsec.xacml.profile.rbac
Class RBACTarget

java.lang.Object
  extended bynbi.xmlsec.xacml.profile.rbac.RBACTarget

public class RBACTarget
extends Object

This class RBACTarget administers target sets in the RBAC context. It stores any kind of object in the subject, resource or action set and provides methods to handle these sets. Furthermore a Target representation can be generated.

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

Field Summary
private  HashSet actions
          Set of action elements of this target.
private  TargetMatchBuilderFactory builderFactory
          Factory to generate TargetMatchBuilders for the target match elements.
private static Logger logger
           
private  TargetMatchParserFactory parserFactory
          Factory to generate TargetMatches for the target match elements.
private  HashSet resources
          Set of resource elements of this target.
private  HashSet subjects
          Set of subject elements of this target.
 
Constructor Summary
protected RBACTarget()
           
protected RBACTarget(TargetMatchBuilderFactory builderFactory, TargetMatchParserFactory parserFactory)
          Creates an instance.
 
Method Summary
protected  Iterator actionIterator()
          Returns an iterator over the action elements.
protected  boolean add(Object obj, int setId)
          Adds any object to the target's set of subjects, actions or resources.
 boolean add(RBACTarget target)
          Adds any subject, resource and action to the target's set of subjects, resources and actions.
protected  boolean add(Set objSet, int setId)
          Adds any set of objects to the target's set of subjects, actions or resources.
 boolean addAction(Object obj)
          Adds any object to the target's set of actions.
 boolean addAction(Set objSet)
          Adds any object set to the target's set of actions.
 boolean addResource(Object obj)
          Adds any object to the target's set of resources.
 boolean addResource(Set objSet)
          Adds any object set to the target's set of resources.
 boolean addSubject(Object obj)
          Adds any object to the target's set of subject.
 boolean addSubject(Set objSet)
          Adds any object set to the target's set of subjects.
 void clearActions()
          Removes all elements from the subjects.
 void clearAll()
          Removes all elements from all sets.
 void clearResources()
          Removes all elements from the subjects.
 void clearSubjects()
          Removes all elements from the subjects.
 boolean equals(Object obj)
          Compares the specified object with this target.
 boolean equalsActions(Object obj)
          Compares the specified object with the action set of this target.
 boolean equalsResources(Object obj)
          Compares the specified object with the resource set of this target.
 boolean equalsSubjects(Object obj)
          Compares the specified object with the subject set of this target.
 HashSet getActions()
          Gets the actions of this target.
 HashSet getResources()
          Gets the resources of this target.
 HashSet getSubjects()
          Gets the subjects of this target.
protected  Iterator iterator(int setId)
          Returns an iterator over the elements of the given set.
 void parse(Target target)
          Parses an RBACTarget from its Targetrepresentation.
protected  boolean remove(Object obj, int setId)
          Removes any object from the target's set of subjects, actions or resources.
 boolean remove(RBACTarget target)
          Removes any subject, resource and action to the target's set of subjects, resources and actions.
protected  boolean remove(Set objSet, int setId)
          Removes any object set from the target's set of subjects, actions or resources.
 boolean removeAction(Object obj)
          Removes any object from the target's set of subjects.
 boolean removeAction(Set objSet)
          Removes any object set from the target's set of actions.
 boolean removeResource(Object obj)
          Removes any object from the target's set of subjects.
 boolean removeResource(Set objSet)
          Removes any object set from the target's set of resources.
 boolean removeSubject(Object obj)
          Removes any object from the target's set of subjects.
 boolean removeSubject(Set objSet)
          Adds any object set to the target's set of subjects.
protected  Iterator resourceIterator()
          Returns an iterator over the resource elements.
protected  Iterator subjectIterator()
          Returns an iterator over the subject elements.
protected  StringBuffer targetSetToStringBuffer(int setId)
           
 String toString()
           
 Target toTarget()
          Returns the Targetrepresentation of the RBACTarget.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static final Logger logger

subjects

private HashSet subjects
Set of subject elements of this target.


resources

private HashSet resources
Set of resource elements of this target.


actions

private HashSet actions
Set of action elements of this target.


builderFactory

private TargetMatchBuilderFactory builderFactory
Factory to generate TargetMatchBuilders for the target match elements.


parserFactory

private TargetMatchParserFactory parserFactory
Factory to generate TargetMatches for the target match elements.

Constructor Detail

RBACTarget

protected RBACTarget()

RBACTarget

protected RBACTarget(TargetMatchBuilderFactory builderFactory,
                     TargetMatchParserFactory parserFactory)
Creates an instance.

Parameters:
builderFactory - Factory to generate TargetMatchBuilders for the target match elements
parserFactory - Factory to generate TargetMatchParsers for the target match elements
Method Detail

add

protected boolean add(Object obj,
                      int setId)
Adds any object to the target's set of subjects, actions or resources.

Parameters:
obj - The object to add.
setId - The id of the set to add the object to ( SUBJECT, RESOURCEor ACTION).
Returns:
true if the object has been added succesfully, false otherwise.

add

protected boolean add(Set objSet,
                      int setId)
Adds any set of objects to the target's set of subjects, actions or resources.

Parameters:
objSet - The object to add.
setId - The id of the set to add the object to ( SUBJECT, RESOURCEor ACTION).
Returns:
true if the object set has been added succesfully, false otherwise.

add

public boolean add(RBACTarget target)
Adds any subject, resource and action to the target's set of subjects, resources and actions.

Parameters:
target - The target to add.
Returns:
true if any of the target objects has been added succesfully, false otherwise.

remove

public boolean remove(RBACTarget target)
Removes any subject, resource and action to the target's set of subjects, resources and actions.

Parameters:
target - The target to remove.
Returns:
true if any of the target objects has been removed succesfully, false otherwise.

addSubject

public boolean addSubject(Object obj)
Adds any object to the target's set of subject.

Parameters:
obj - The object to add.
Returns:
true if the object has been added succesfully, false otherwise.

addResource

public boolean addResource(Object obj)
Adds any object to the target's set of resources.

Parameters:
obj - The object to add.
Returns:
true if the object has been added succesfully, false otherwise.

addAction

public boolean addAction(Object obj)
Adds any object to the target's set of actions.

Parameters:
obj - The object to add.
Returns:
true if the object has been added succesfully, false otherwise.

addSubject

public boolean addSubject(Set objSet)
Adds any object set to the target's set of subjects.

Parameters:
objSet - The object set to add.
Returns:
true if the object set has been added succesfully, false otherwise.

addResource

public boolean addResource(Set objSet)
Adds any object set to the target's set of resources.

Parameters:
objSet - The object set to add.
Returns:
true if the object set has been added succesfully, false otherwise.

addAction

public boolean addAction(Set objSet)
Adds any object set to the target's set of actions.

Parameters:
objSet - The object set to add.
Returns:
true if the object set has been added succesfully, false otherwise.

removeSubject

public boolean removeSubject(Object obj)
Removes any object from the target's set of subjects.

Parameters:
obj - The object to remove.
Returns:
true if the object has been removed succesfully, false otherwise.

removeResource

public boolean removeResource(Object obj)
Removes any object from the target's set of subjects.

Parameters:
obj - The object to remove.
Returns:
true if the object has been removed succesfully, false otherwise.

removeAction

public boolean removeAction(Object obj)
Removes any object from the target's set of subjects.

Parameters:
obj - The object to remove.
Returns:
true if the object has been removed succesfully, false otherwise.

removeSubject

public boolean removeSubject(Set objSet)
Adds any object set to the target's set of subjects.

Parameters:
objSet - The object set to remove.
Returns:
true if the object set has been removed succesfully, false otherwise.

removeResource

public boolean removeResource(Set objSet)
Removes any object set from the target's set of resources.

Parameters:
objSet - The object set to remove.
Returns:
true if the object set has been removed succesfully, false otherwise.

removeAction

public boolean removeAction(Set objSet)
Removes any object set from the target's set of actions.

Parameters:
objSet - The object set to remove.
Returns:
true if the object set has been removed succesfully, false otherwise.

remove

protected boolean remove(Object obj,
                         int setId)
Removes any object from the target's set of subjects, actions or resources.

Parameters:
obj - The object to remove.
setId - The id of the set to remove the object from( SUBJECT, RESOURCEor ACTION).
Returns:
true if the object has been removed succesfully, false otherwise.

remove

protected boolean remove(Set objSet,
                         int setId)
Removes any object set from the target's set of subjects, actions or resources.

Parameters:
objSet - The set of objects to remove.
setId - The id of the set to remove the object from( SUBJECT, RESOURCEor ACTION).
Returns:
true if the object has been removed succesfully, false otherwise.

clearSubjects

public void clearSubjects()
Removes all elements from the subjects.


clearResources

public void clearResources()
Removes all elements from the subjects.


clearActions

public void clearActions()
Removes all elements from the subjects.


clearAll

public void clearAll()
Removes all elements from all sets.


iterator

protected Iterator iterator(int setId)
Returns an iterator over the elements of the given set.

Parameters:
setId - The id of the set to return the iterator from( SUBJECT, RESOURCEor ACTION).
Returns:
The iterator or null.

subjectIterator

protected Iterator subjectIterator()
Returns an iterator over the subject elements.

Returns:
The iterator or null.

resourceIterator

protected Iterator resourceIterator()
Returns an iterator over the resource elements.

Returns:
The iterator or null.

actionIterator

protected Iterator actionIterator()
Returns an iterator over the action elements.

Returns:
The iterator or null.

toTarget

public Target toTarget()
Returns the Targetrepresentation of the RBACTarget.

Returns:
The Targetrepresentation.

parse

public void parse(Target target)
           throws ParsingException
Parses an RBACTarget from its Targetrepresentation.

Parameters:
target - The target to parse.
Throws:
ParsingException

getActions

public HashSet getActions()
Gets the actions of this target.

Returns:
Returns the actions.

getResources

public HashSet getResources()
Gets the resources of this target.

Returns:
Returns the resources.

getSubjects

public HashSet getSubjects()
Gets the subjects of this target.

Returns:
Returns the subjects.

equalsSubjects

public boolean equalsSubjects(Object obj)
Compares the specified object with the subject set of this target.

Parameters:
obj - Object to be compared for equality with the subject set.
Returns:
true if the specified Object is equal to the subject set.

equalsResources

public boolean equalsResources(Object obj)
Compares the specified object with the resource set of this target.

Parameters:
obj - Object to be compared for equality with the resource set.
Returns:
true if the specified Object is equal to the resource set.

equalsActions

public boolean equalsActions(Object obj)
Compares the specified object with the action set of this target.

Parameters:
obj - Object to be compared for equality with the action set.
Returns:
true if the specified Object is equal to the action set.

equals

public boolean equals(Object obj)
Compares the specified object with this target. Returns true if the specified object is also a RBACTarget, and if the subject, resource and action set are equal.

Parameters:
obj - Object to be compared for equality with this target.
Returns:
true if the specified Object is equal to this target.

targetSetToStringBuffer

protected StringBuffer targetSetToStringBuffer(int setId)

toString

public String toString()


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