org.apache.imperius.spl.manager
Interface PolicyManager

All Known Implementing Classes:
PolicyManagerImpl

public interface PolicyManager

Provides the ability manage the storage of policies and to evaluate policies contained in the container. Before using the container, it must be initialized through a call to init(DataCollector, Actuator). When the container is no longer needed, a call to shutdown() should be made to clear up any resources. Policies are stored in the container with a unique name. Once stored, policies may be evaluated by name.


Method Summary
 boolean createPolicy(java.lang.String policyName, java.lang.String policyString)
          Creates a policy with the specified name and string
 void deletePolicy(java.lang.String policyName)
          Deletes the policy with the given name
 void enableLogging(boolean enableOrDisable)
          Set the whether logging should be on or off.
 java.lang.Object evaluatePolicy(java.lang.String policyName, java.util.Map instance)
          Evaluates the policy with the given name.
 java.lang.Object evaluatePolicyString(java.lang.String policyName, java.lang.String policyString, java.util.Map instances)
          Place the given policy into the container and then evaluate it against the given instance data.
 java.util.Map getAllPolicies()
          Returns a map (policyName -> policy String) of all policies stored in the repository
 java.util.List getAllPolicyNames()
          Gets a list of names of all policies in the system
 java.lang.String getPolicy(java.lang.String name)
          Returns the policy as a String
 PolicyInfo getPolicyInfo(java.lang.String policyName)
          Returns a policyInfo object that contains the anchor class names and qualifiers.
 void init(DataCollector dc, Actuator ac)
          Initializes the instance wit the given DataCollector and Actuator
 void shutdown()
          Shutdown this instance.
 void updatePolicy(java.lang.String policyName, java.lang.String policyString)
          Updates the policy with the given name with the provided string.
 boolean validatePolicyString(java.lang.String policyString)
          Determine if the given policy string is properly formatted and parsable.
 

Method Detail

getPolicy

java.lang.String getPolicy(java.lang.String name)
                           throws SPLException
Returns the policy as a String

Parameters:
name -
Returns:
Throws:
SPLException

getPolicyInfo

PolicyInfo getPolicyInfo(java.lang.String policyName)
                         throws SPLException
Returns a policyInfo object that contains the anchor class names and qualifiers.

Parameters:
policyName -
Returns:
Throws:
SPLException

createPolicy

boolean createPolicy(java.lang.String policyName,
                     java.lang.String policyString)
                     throws SPLException
Creates a policy with the specified name and string

Parameters:
policyName -
policyString -
Returns:
Throws:
SPLException

updatePolicy

void updatePolicy(java.lang.String policyName,
                  java.lang.String policyString)
                  throws SPLException
Updates the policy with the given name with the provided string.

Parameters:
policyName -
policyString -
Throws:
SPLException

deletePolicy

void deletePolicy(java.lang.String policyName)
                  throws SPLException
Deletes the policy with the given name

Parameters:
policyName -
Throws:
SPLException

getAllPolicies

java.util.Map getAllPolicies()
                             throws SPLException
Returns a map (policyName -> policy String) of all policies stored in the repository

Returns:
Throws:
SPLException

getAllPolicyNames

java.util.List getAllPolicyNames()
                                 throws SPLException
Gets a list of names of all policies in the system

Returns:
Throws:
SPLException

evaluatePolicy

java.lang.Object evaluatePolicy(java.lang.String policyName,
                                java.util.Map instance)
                                throws SPLException
Evaluates the policy with the given name. The input map should be of the following format -> List of InstanceInfo objects Where InstanceInfo object contains and an empty object

Parameters:
policyName -
instance -
Returns:
Throws:
SPLException

init

void init(DataCollector dc,
          Actuator ac)
          throws SPLException,
                 java.io.IOException
Initializes the instance wit the given DataCollector and Actuator

Parameters:
dc -
ac -
Throws:
SPLException
java.io.IOException

evaluatePolicyString

java.lang.Object evaluatePolicyString(java.lang.String policyName,
                                      java.lang.String policyString,
                                      java.util.Map instances)
                                      throws SPLException
Place the given policy into the container and then evaluate it against the given instance data.

Parameters:
policyName - name to be assigned in the container
policyString - SPL policy
instances - the instance data to be applied to the policy.
Returns:
TODO
Throws:
SPLException

enableLogging

void enableLogging(boolean enableOrDisable)
Set the whether logging should be on or off.

Parameters:
enableOrDisable -

shutdown

void shutdown()
Shutdown this instance. Evaluation requests made after this call and before another call to init(DataCollector, Actuator) may cause exceptions.


validatePolicyString

boolean validatePolicyString(java.lang.String policyString)
                             throws SPLException
Determine if the given policy string is properly formatted and parsable.

Parameters:
policyString - the SPL policy.
Returns:
true if the the string is parsable, false otherwise.
Throws:
SPLException - // TODO: why do we need to throw an exception here?