org.apache.imperius.spl.manager.impl
Class PolicyManagerImpl

java.lang.Object
  extended by org.apache.imperius.spl.manager.impl.PolicyManagerImpl
All Implemented Interfaces:
PolicyManager

public class PolicyManagerImpl
extends java.lang.Object
implements PolicyManager


Constructor Summary
PolicyManagerImpl(DataCollector dc, Actuator ac)
           
 
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 instances)
          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 policyName)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolicyManagerImpl

public PolicyManagerImpl(DataCollector dc,
                         Actuator ac)
Method Detail

init

public void init(DataCollector dc,
                 Actuator ac)
Description copied from interface: PolicyManager
Initializes the instance wit the given DataCollector and Actuator

Specified by:
init in interface PolicyManager

getAllPolicies

public java.util.Map getAllPolicies()
                             throws SPLException
Description copied from interface: PolicyManager
Returns a map (policyName -> policy String) of all policies stored in the repository

Specified by:
getAllPolicies in interface PolicyManager
Returns:
Throws:
SPLException

getAllPolicyNames

public java.util.List getAllPolicyNames()
                                 throws SPLException
Description copied from interface: PolicyManager
Gets a list of names of all policies in the system

Specified by:
getAllPolicyNames in interface PolicyManager
Returns:
Throws:
SPLException

getPolicy

public java.lang.String getPolicy(java.lang.String policyName)
                           throws SPLException
Description copied from interface: PolicyManager
Returns the policy as a String

Specified by:
getPolicy in interface PolicyManager
Returns:
Throws:
SPLException

shutdown

public void shutdown()
Description copied from interface: PolicyManager
Shutdown this instance. Evaluation requests made after this call and before another call to PolicyManager.init(DataCollector, Actuator) may cause exceptions.

Specified by:
shutdown in interface PolicyManager

updatePolicy

public void updatePolicy(java.lang.String policyName,
                         java.lang.String policyString)
                  throws SPLException
Description copied from interface: PolicyManager
Updates the policy with the given name with the provided string.

Specified by:
updatePolicy in interface PolicyManager
Throws:
SPLException

createPolicy

public boolean createPolicy(java.lang.String policyName,
                            java.lang.String policyString)
                     throws SPLException
Description copied from interface: PolicyManager
Creates a policy with the specified name and string

Specified by:
createPolicy in interface PolicyManager
Returns:
Throws:
SPLException

deletePolicy

public void deletePolicy(java.lang.String policyName)
                  throws SPLException
Description copied from interface: PolicyManager
Deletes the policy with the given name

Specified by:
deletePolicy in interface PolicyManager
Throws:
SPLException

evaluatePolicy

public java.lang.Object evaluatePolicy(java.lang.String policyName,
                                       java.util.Map instances)
                                throws SPLException
Description copied from interface: PolicyManager
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

Specified by:
evaluatePolicy in interface PolicyManager
Returns:
Throws:
SPLException

getPolicyInfo

public PolicyInfo getPolicyInfo(java.lang.String policyName)
                         throws SPLException
Description copied from interface: PolicyManager
Returns a policyInfo object that contains the anchor class names and qualifiers.

Specified by:
getPolicyInfo in interface PolicyManager
Returns:
Throws:
SPLException

evaluatePolicyString

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

Specified by:
evaluatePolicyString in interface PolicyManager
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

public void enableLogging(boolean enableOrDisable)
Description copied from interface: PolicyManager
Set the whether logging should be on or off.

Specified by:
enableLogging in interface PolicyManager

validatePolicyString

public boolean validatePolicyString(java.lang.String policyString)
                             throws SPLException
Description copied from interface: PolicyManager
Determine if the given policy string is properly formatted and parsable.

Specified by:
validatePolicyString in interface PolicyManager
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?