org.fcrepo.server.security.xacml.pdp.data
Interface PolicyIndex

All Known Implementing Classes:
DbXmlPolicyIndex, ExistPolicyIndex, PolicyIndexBase, XPathPolicyIndex

public interface PolicyIndex

This class provides an interface for a Policy Index. Policy Indexes can be implemented in whatever way they wish using any kind of backend from database to filesystem as long as they adhere to this interface. A Policy Index is an index over a Policy Store (see PolicyStore). A PolicyIndex is used by the PolicyFinder to locate matching policies. Policy Indexes must be kept synchronised with Policy Stores. See org.fcrepo.server.security.xacml.pdp.decorator.DbXmlPolicyCacheInvocationHandler for synchronisation of the dbxml cache with the Fedora policy store If the Policy Index does not contain the complete policy documents then the implementation will need to include a PolicyStore instance for retrieving the actual matching policies.

Author:
stephen.bayliss

Field Summary
static String XACML_RESOURCE_ID
           
static String XACML20_POLICY_NS
           
 
Method Summary
 String addPolicy(String name, String document)
          Generates a policy based on the string data provided and the name.
 boolean clear()
          Clear the policy index completely
 boolean contains(String policyName)
          Check if the policy identified by policyName exists.
 boolean deletePolicy(String name)
          Removes the policy given by name from the data store.
 Map<String,com.sun.xacml.AbstractPolicy> getPolicies(com.sun.xacml.EvaluationCtx eval, com.sun.xacml.finder.PolicyFinder policyFinder)
          Extracts a list of policies from the Policy Index that are relevant to the given Evaluation Context.
 com.sun.xacml.AbstractPolicy getPolicy(String name, com.sun.xacml.finder.PolicyFinder policyFinder)
          Obtains the policy with the provided name from the Policy Store.
 boolean updatePolicy(String name, String newDocument)
          Generates a new policy based for the given policy name and replaces the old policy in the Policy Store with it.
 

Field Detail

XACML20_POLICY_NS

static final String XACML20_POLICY_NS
See Also:
Constant Field Values

XACML_RESOURCE_ID

static final String XACML_RESOURCE_ID
See Also:
Constant Field Values
Method Detail

getPolicies

Map<String,com.sun.xacml.AbstractPolicy> getPolicies(com.sun.xacml.EvaluationCtx eval,
                                                     com.sun.xacml.finder.PolicyFinder policyFinder)
                                                     throws PolicyIndexException
Extracts a list of policies from the Policy Index that are relevant to the given Evaluation Context. Note that this returns a set that still has to be further filtered by the PolicyFinder to find policies that match 100%. This merely eliminates the need to match every policy, just the most likely ones to apply.

Parameters:
eval - the Evaluation Context from which to match policies against
Returns:
the List of potential policies
Throws:
PolicyIndexException

getPolicy

com.sun.xacml.AbstractPolicy getPolicy(String name,
                                       com.sun.xacml.finder.PolicyFinder policyFinder)
                                       throws PolicyIndexException
Obtains the policy with the provided name from the Policy Store.

Parameters:
name - the name of the policy to return
Returns:
the policy as an array of bytes
Throws:
PolicyStoreException
PolicyIndexException

addPolicy

String addPolicy(String name,
                 String document)
                 throws PolicyIndexException
Generates a policy based on the string data provided and the name. The policy is then added to the Policy Store.

Parameters:
name -
document - the policy as a String
Returns:
the name of the added policy
Throws:
{@link - PolicyStoreException}
PolicyIndexException

deletePolicy

boolean deletePolicy(String name)
                     throws PolicyIndexException
Removes the policy given by name from the data store.

Parameters:
name - the name of the policy
Returns:
true if policy was deleted
Throws:
PolicyStoreException
PolicyIndexException

updatePolicy

boolean updatePolicy(String name,
                     String newDocument)
                     throws PolicyIndexException
Generates a new policy based for the given policy name and replaces the old policy in the Policy Store with it. An exception is thrown if the policy with the given name cannot be found.

Parameters:
name - the name of the policy to update
newDocument - the new policy as a String
Returns:
true if policy was updated
Throws:
PolicyStoreException
PolicyIndexException

contains

boolean contains(String policyName)
                 throws PolicyIndexException
Check if the policy identified by policyName exists.

Parameters:
policy -
Returns:
true iff the policy store contains a policy with the same PolicyId
Throws:
PolicyStoreException
PolicyIndexException

clear

boolean clear()
              throws PolicyIndexException
Clear the policy index completely

Returns:
Throws:
PolicyIndexException


Copyright © 2012 DuraSpace. All Rights Reserved.