org.apache.imperius.spl.datastore
Interface PolicyDataStore

All Known Implementing Classes:
PolicyDataStoreImpl

public interface PolicyDataStore

Provides the ability manage the storage of policies. 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.


Method Summary
 boolean createPolicy(java.lang.String policyName, java.lang.String policyString)
          Store the given policy and give it the given name.
 SPLPolicy createSPLPolicyObject(java.lang.String policyName, java.lang.String policyString)
          Store the policy using the given name and create the Java object representing a parsed policy.
 void deletePolicy(java.lang.String policyName)
          Remove the named policy from the repository.
 java.util.Map getAllPolicies()
          Get a map of all policies mapped from the name of the policy to the policy string.
 java.util.List getAllPolicyNames()
           
 SPLPolicy getInternalPolicyObject(java.lang.String PolicyRuleName)
          Get the java object representation of the parsed policy associated with the given name.
 java.lang.String getPolicy(java.lang.String policyName)
          Get the policy with the given name.
 PolicyInfo getPolicyInfo(java.lang.String policyName)
          Parse the given policy with the given name and provide the information about the policy.
 void init()
          Initialize the storage.
 void shutdown()
          Signal that the storage is no longer needed.
 void updatePolicy(java.lang.String policyName, java.lang.String policyString)
          Replace the definition of the policy with the given name.
 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 policyName)
                           throws SPLException
Get the policy with the given name.

Parameters:
policyName -
Returns:
a policy string, never null.
Throws:
SPLException

getPolicyInfo

PolicyInfo getPolicyInfo(java.lang.String policyName)
                         throws SPLException
Parse the given policy with the given name and provide the information about the policy.

Parameters:
policyName -
Returns:
Throws:
SPLException

createPolicy

boolean createPolicy(java.lang.String policyName,
                     java.lang.String policyString)
                     throws SPLException
Store the given policy and give it the given name.

Parameters:
policyName -
policyString -
Returns:
true if stored successfully.
Throws:
SPLException

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?

createSPLPolicyObject

SPLPolicy createSPLPolicyObject(java.lang.String policyName,
                                java.lang.String policyString)
                                throws SPLException
Store the policy using the given name and create the Java object representing a parsed policy.

Parameters:
policyName -
policyString -
Returns:
Throws:
SPLException

updatePolicy

void updatePolicy(java.lang.String policyName,
                  java.lang.String policyString)
                  throws SPLException
Replace the definition of the policy with the given name.

Parameters:
policyName -
policyString - new policy definition.
Throws:
SPLException

deletePolicy

void deletePolicy(java.lang.String policyName)
                  throws SPLException
Remove the named policy from the repository.

Parameters:
policyName - name of the policy.
Throws:
SPLException - if the named policy does not exist.

getAllPolicies

java.util.Map getAllPolicies()
                             throws SPLException
Get a map of all policies mapped from the name of the policy to the policy string.

Returns:
Throws:
SPLException

getAllPolicyNames

java.util.List getAllPolicyNames()
                                 throws SPLException
Throws:
SPLException

init

void init()
          throws SPLException
Initialize the storage. Calls to access/add policies before this may throw exceptions or otherwise fail.

Throws:
SPLException

shutdown

void shutdown()
Signal that the storage is no longer needed. Calls to access/add policies after this call and before a call to init() may fail.


getInternalPolicyObject

SPLPolicy getInternalPolicyObject(java.lang.String PolicyRuleName)
                                  throws SPLException
Get the java object representation of the parsed policy associated with the given name.

Parameters:
PolicyRuleName -
Returns:
Throws:
SPLException