com.ace.moab.api.acl
Class ACLRule

java.lang.Object
  extended by com.ace.moab.api.acl.ACLRule
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ACLRule>

public class ACLRule
extends java.lang.Object
implements java.lang.Comparable<ACLRule>, java.io.Serializable

This class represents a rule that can be in Moab's access control list (ACL) mechanism.

The basic ACLRule information is the object's name and type. The type directly maps to a CredentialType value. The default mechanism Moab uses to check the ACL for a particular item is if the user or object coming in has ANY of the values in the ACL, then the user or object is given access. If no values match the user or object in question, the user or object is rejected access.

More advanced features are included such as affinity and advanced ACL checking.

Affinity can be positive, neutral or negative. This is useful for attracting (positive affinity) or repelling (negative affinity) access to something with an ACL. This information is represented as an ACLAffinity enum value.

Advanced ACL checking is dependent upon ACL modifiers that cause Moab to check access based on more advanced features. These features include denying service based on ACLRules' specifications, requiring ACLRules, exclusively ORing ACLRules in an ACL, and others. This information is represented as a Set of ACLModifier enum values.

Author:
Brady Kimball
See Also:
Serialized Form

Constructor Summary
ACLRule(com.moab.api.scheduler.MoabObject object)
          Creates a new ACLRule describing the MoabObject with a default comparison operator of ComparisonOperator.LEXIGRAPHIC_EQUAL.
ACLRule(com.moab.api.scheduler.MoabObject object, com.moab.api.util.ComparisonOperator operator)
          Creates a new ACLRule describing the MoabObject being compared by the ComparisonOperator.
 
Method Summary
 int compareTo(ACLRule o)
          
 boolean equals(java.lang.Object o)
          
 ACLAffinity getAffinity()
          Returns the affinity of the ACL object.
 com.moab.api.util.ComparisonOperator getComparisonOperator()
          Returns the type of comparison to make against the ACL object.
 java.util.Set<ACLModifier> getModifiers()
          Returns the set of advanced modifiers for this particular ACLRule description.
 java.lang.String getName()
          Returns the name of the object that this ACL object describes.
 com.moab.api.scheduler.MoabObject getObject()
          Returns the object to compare against.
 com.moab.api.scheduler.MoabObjectType getType()
          Returns the type of the object that this ACL object describes.
 double getValue()
           Returns the numerical value that is used in conjunction with the comparison operator and MoabObject.
 boolean hasModifier(ACLModifier modifier)
          Returns true if this ACLRule has the modifier the is passed as an argument.
 boolean matchesCredential(Credential cred)
          Returns true if the access control rule represents the specified credential.
 void setAffinity(ACLAffinity affinity)
          Sets the affinity of the ACL object.
 void setComparisonOperator(com.moab.api.util.ComparisonOperator comparisonOperator)
          Sets the type of comparison to make against the ACL object.
 void setModifiers(java.util.Set<ACLModifier> modifiers)
           Sets the set of advanced modifiers for this particular ACLRule description.
 void setObject(com.moab.api.scheduler.MoabObject object)
          Sets the object to compare against.
 void setValue(double value)
          Sets the numerical value that is used in conjunction with the comparison operator and MoabObject.
 java.lang.String toCondensedString()
          Creates a human readable representation of this ACL object for use in GUI components.
 java.lang.String toMoabVPCCommandString()
           Builds a string representation of the VPC ACL object for use in Moab commands.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ACLRule

public ACLRule(com.moab.api.scheduler.MoabObject object)
        throws InvalidMoabArgumentException
Creates a new ACLRule describing the MoabObject with a default comparison operator of ComparisonOperator.LEXIGRAPHIC_EQUAL.

Parameters:
object - the object to compare against.
Throws:
InvalidMoabArgumentException - thrown if the object is null.

ACLRule

public ACLRule(com.moab.api.scheduler.MoabObject object,
               com.moab.api.util.ComparisonOperator operator)
        throws InvalidMoabArgumentException
Creates a new ACLRule describing the MoabObject being compared by the ComparisonOperator.

Parameters:
object - the object to compare against.
operator - the type of comparison to make against the object.
Throws:
InvalidMoabArgumentException - thrown if either parameter is null.
Method Detail

compareTo

public int compareTo(ACLRule o)

Specified by:
compareTo in interface java.lang.Comparable<ACLRule>

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

getAffinity

public ACLAffinity getAffinity()
Returns the affinity of the ACL object.

Returns:
the affinity of the ACL object.

getComparisonOperator

public com.moab.api.util.ComparisonOperator getComparisonOperator()
Returns the type of comparison to make against the ACL object.

Returns:
the type of comparison to make against the ACL object.

getModifiers

public java.util.Set<ACLModifier> getModifiers()
Returns the set of advanced modifiers for this particular ACLRule description.

Returns:
the set of advanced modifiers for this particular ACLRule description.

getName

public java.lang.String getName()
Returns the name of the object that this ACL object describes.

Returns:
the name of the object that this ACL object describes.

getObject

public com.moab.api.scheduler.MoabObject getObject()
Returns the object to compare against.

Returns:
the object to compare against.

getType

public com.moab.api.scheduler.MoabObjectType getType()
Returns the type of the object that this ACL object describes.

Returns:
the type of the object that this ACL object describes.

getValue

public double getValue()

Returns the numerical value that is used in conjunction with the comparison operator and MoabObject.

The comparison operator should not be a lexigraphic comparison.

Returns:
the numerical value that is used in conjunction with the comparison operator and MoabObject.

hasModifier

public boolean hasModifier(ACLModifier modifier)
Returns true if this ACLRule has the modifier the is passed as an argument.

Parameters:
modifier -
Returns:
true if this ACLRule matcheds the modifier argument, false otherwise

matchesCredential

public boolean matchesCredential(Credential cred)
Returns true if the access control rule represents the specified credential.

Parameters:
cred - the credential in question.
Returns:
true if the specified credential matches the ACL rule.

setAffinity

public void setAffinity(ACLAffinity affinity)
Sets the affinity of the ACL object.

Parameters:
affinity - the affinity of the ACL object.

setComparisonOperator

public void setComparisonOperator(com.moab.api.util.ComparisonOperator comparisonOperator)
                           throws InvalidMoabArgumentException
Sets the type of comparison to make against the ACL object.

Parameters:
comparisonOperator - the type of comparison to make against the ACL object.
Throws:
InvalidMoabArgumentException - thrown if the comparison operator is null.

setModifiers

public void setModifiers(java.util.Set<ACLModifier> modifiers)

Sets the set of advanced modifiers for this particular ACLRule description.

The set can be null.

Parameters:
modifiers - the set of advanced modifiers for this particular ACLRule description.

setObject

public void setObject(com.moab.api.scheduler.MoabObject object)
               throws InvalidMoabArgumentException
Sets the object to compare against.

Parameters:
object - the object to compare against.
Throws:
InvalidMoabArgumentException - thrown if the object is null.

setValue

public void setValue(double value)
Sets the numerical value that is used in conjunction with the comparison operator and MoabObject.

Parameters:
value - the numerical value that is used in conjunction with the comparison operator and MoabObject.

toCondensedString

public java.lang.String toCondensedString()
Creates a human readable representation of this ACL object for use in GUI components. Omits overly verbose and often unused data like value and comparison.

Returns:
a human readable representation of this ACL object

toMoabVPCCommandString

public java.lang.String toMoabVPCCommandString()

Builds a string representation of the VPC ACL object for use in Moab commands.

Returns the ACL object in a simple format of <object_type>:<object_id>

Returns:
a string representation of the VPC ACL object for use in Moab commands.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object


Copyright © 2001-2009 Cluster Resources, Inc. All Rights Reserved.