com.wles.blm
Class BLMRuleManager

java.lang.Object
  |
  +--com.wles.blm.BLMRuleManager

public class BLMRuleManager
extends java.lang.Object

Manages operations on rules. Rules are used to controll a subjects access to a resource. Rules can either GRANT, DENY, or DELEGATE rights on resoruces. Both privilege and role access can be managed via rules. Rules have the following format: effect(action(s), resource(s), subject(s) [,delegator]) if constraint; where effect may be GRANT, DENY, DELEGATE, action may be one or more privilges or roles, resource can be one or more resources, and subjects can be one or more users, groups, or roles. The constaint is a series of boolean operations over attribute values which can be used to further limit the applicability of the rule. You may make use of the wles.util.RuleParser to construct and parse rules using Java objects rather then directly dealing with the above format. Use a BLMContextManager to obtain an instance of a BLMRuleManager.

See Also:
BLMContextManager, RuleParser

Field Summary
static java.lang.String EFFECT_TYPE_ALL
          Specifies rules with any effect.
static java.lang.String EFFECT_TYPE_DELEGATE
          Specifies rules with a DELEGATE effect.
static java.lang.String EFFECT_TYPE_DENY
          Specifies rules with a DENY effect.
static java.lang.String EFFECT_TYPE_GRANT
          Specifies rules with a GRANT effect.
static java.lang.String FILTER_OPERATOR_AND
          Specifies a filter search operator of AND.
static java.lang.String FILTER_OPERATOR_OR
          Specifies a filter search operator of OR.
 
Method Summary
 void createRule(java.lang.String text)
          Create rule from rule text.
 java.lang.String filter(RuleTypeEnum ruleType, java.lang.String effectType, java.lang.String[] actions, java.lang.String[] resources, java.lang.String[] subjects, java.lang.String[] delegators, java.lang.String conditionPattern, java.lang.String filterSearchOperator)
          Finds rules according to the selection criteria.
 boolean findRule(java.lang.String cID, java.lang.String ruleText)
          Searches for a rule in a rule collection.
 int getCount(java.lang.String cID)
          Gets the size of a rule collection.
 java.lang.String[] getReport(java.lang.String cID)
          Returns a report on a rule collection.
 java.lang.String[] getReport(java.lang.String cID, int iStart, int iCount)
          Returns a report on a subset of a rule collection.
 void modifyRule(java.lang.String oldRuleText, java.lang.String newRuleText)
          Modifies a rule by rule text.
 void release(java.lang.String cID)
          Releases a rule collection.
 void removeRule(java.lang.String ruleText)
          Removes a rule by rule text.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EFFECT_TYPE_ALL

public static final java.lang.String EFFECT_TYPE_ALL
Specifies rules with any effect.

See Also:
Constant Field Values

EFFECT_TYPE_DELEGATE

public static final java.lang.String EFFECT_TYPE_DELEGATE
Specifies rules with a DELEGATE effect.

See Also:
Constant Field Values

EFFECT_TYPE_DENY

public static final java.lang.String EFFECT_TYPE_DENY
Specifies rules with a DENY effect.

See Also:
Constant Field Values

EFFECT_TYPE_GRANT

public static final java.lang.String EFFECT_TYPE_GRANT
Specifies rules with a GRANT effect.

See Also:
Constant Field Values

FILTER_OPERATOR_AND

public static final java.lang.String FILTER_OPERATOR_AND
Specifies a filter search operator of AND.

See Also:
Constant Field Values

FILTER_OPERATOR_OR

public static final java.lang.String FILTER_OPERATOR_OR
Specifies a filter search operator of OR.

See Also:
Constant Field Values
Method Detail

createRule

public void createRule(java.lang.String text)
                throws BLMException,
                       RuleParser.ParsingException
Create rule from rule text.

Parameters:
text - text of the Rule
Throws:
BLMException
RuleParser.ParsingException
See Also:
RuleParser.ParsedRule.generateRuleText()

filter

public java.lang.String filter(RuleTypeEnum ruleType,
                               java.lang.String effectType,
                               java.lang.String[] actions,
                               java.lang.String[] resources,
                               java.lang.String[] subjects,
                               java.lang.String[] delegators,
                               java.lang.String conditionPattern,
                               java.lang.String filterSearchOperator)
                        throws BLMException
Finds rules according to the selection criteria. Returns a rule collection ID.

Parameters:
ruleType - rule type, one of: RuleTypeEnum.Policy, RuleTypeEnum.RoleMapping
effectType - one of: EFFECT_TYPE_GRANT, EFFECT_TYPE_DENY, EFFECT_TYPE_DELEGATE, EFFECT_TYPE_ALL
actions - array of privilege or role names as strings. An empty or null array is allowed and will match any action.
resources - array of resources as strings. An empty or null array is allowed and will match any resource.
subjects - array of subjects as strings. An empty or null array is allowed and will match any subject.
delegators - array of delegators as strings (cannot be more than one for AND search). An empty or null array is allowed and will match any delegator.
conditionPattern - condition String. Unlike the other fields in the filter method, the condition filed supports pattern matching, with the use of the * character. An empty or null value is allowed, and will match any condition.
filterSearchOperator - one of: FILTER_OPERATOR_OR, FILTER_OPERATOR_AND
Returns:
Collection ID
Throws:
BLMException
See Also:
getReport(String cID), getReport(String cID, int iStart, int iCount), getCount(String CID), release(String cID), findRule(String cID, String name), EFFECT_TYPE_GRANT, EFFECT_TYPE_DENY, EFFECT_TYPE_DELEGATE, FILTER_OPERATOR_OR, FILTER_OPERATOR_AND

findRule

public boolean findRule(java.lang.String cID,
                        java.lang.String ruleText)
                 throws BLMException,
                        RuleParser.ParsingException
Searches for a rule in a rule collection.

Parameters:
cID - collection ID of the rule collection
ruleText - text of rule
Returns:
boolean found = true
Throws:
BLMException
RuleParser.ParsingException
See Also:
RuleParser.ParsedRule.generateRuleText()

getCount

public int getCount(java.lang.String cID)
             throws BLMException
Gets the size of a rule collection.

Parameters:
cID - ID of the collection
Returns:
the count in the collection
Throws:
BLMException

getReport

public java.lang.String[] getReport(java.lang.String cID)
                             throws BLMException
Returns a report on a rule collection.

Parameters:
cID - ID of the collection
Returns:
A String array of rules in text format from the collection.
Throws:
BLMException
See Also:
RuleParser.parseRule(String ruleText)

getReport

public java.lang.String[] getReport(java.lang.String cID,
                                    int iStart,
                                    int iCount)
                             throws BLMException
Returns a report on a subset of a rule collection.

Parameters:
cID - ID of the collection
iStart - index of the start of the subset
iCount - size of the subset
Returns:
A String array of rules in text format from the collection.
Throws:
BLMException
See Also:
RuleParser.parseRule(String ruleText)

modifyRule

public void modifyRule(java.lang.String oldRuleText,
                       java.lang.String newRuleText)
                throws BLMException,
                       RuleParser.ParsingException
Modifies a rule by rule text.

Parameters:
oldRuleText - the old rule
newRuleText - the new rule
Throws:
BLMException
RuleParser.ParsingException
See Also:
RuleParser.ParsedRule.generateRuleText()

release

public void release(java.lang.String cID)
             throws BLMException
Releases a rule collection. Supplying a null collection id will cause all held collections to be released.

Parameters:
cID - ID of the collection
Returns:
void
Throws:
BLMException

removeRule

public void removeRule(java.lang.String ruleText)
                throws BLMException,
                       RuleParser.ParsingException
Removes a rule by rule text.

Parameters:
ruleText - the rule text for the rule remove
Returns:
void
Throws:
BLMException
RuleParser.ParsingException
See Also:
RuleParser.ParsedRule.generateRuleText()


Copyright © 2005 BEA Systems Inc. All Rights Reserved.