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

All Known Implementing Classes:
AbstractPolicyStore, FedoraPolicyStore

public interface PolicyStore

This class provides a CRUD interface for Policy Stores. Policy Stores 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. See PolicyIndex for a query interface to policies.

Author:
nishen@melcoe.mq.edu.au

Method Summary
 String addPolicy(File f)
          Generates a policy using the File provided.
 String addPolicy(File f, String name)
          Generates a policy using the File and name provided and adds it to the Policy Store.
 String addPolicy(String document)
          Generates a policy based on the string data provided.
 String addPolicy(String document, String name)
          Generates a policy based on the string data provided and the name.
 boolean contains(File policy)
          Check if the policy in the file exists in the policy store.
 boolean contains(String policy)
          Check if the policy identified by policyName exists.
 boolean deletePolicy(String name)
          Removes the policy given by name from the data store.
 byte[] getPolicy(String name)
          Obtains the policy with the provided name from the Policy Store.
 void init()
          Initialize this PolicyStore with the bootstrap policies
 List<String> listPolicies()
          Obtains a list of stored policies.
 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.
 

Method Detail

getPolicy

byte[] getPolicy(String name)
                 throws PolicyStoreException
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

addPolicy

String addPolicy(File f,
                 String name)
                 throws PolicyStoreException
Generates a policy using the File and name provided and adds it to the Policy Store.

Parameters:
f - the policy as a File
name - the name to assign the policy
Returns:
the name of the policy
Throws:
{@link - PolicyStoreException}
PolicyStoreException

addPolicy

String addPolicy(File f)
                 throws PolicyStoreException
Generates a policy using the File provided. The name is automatically generated based on the PolicyId attribute of the Policy. The policy is then added to the Policy Store.

Parameters:
f - the policy as a File
Returns:
the name of the added policy
Throws:
{@link - PolicyStoreException}
PolicyStoreException

addPolicy

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

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

addPolicy

String addPolicy(String document)
                 throws PolicyStoreException
Generates a policy based on the string data provided. The name is automatically generated based on the PolicyId attribute of the Policy. The policy is then added to the Policy Store.

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

deletePolicy

boolean deletePolicy(String name)
                     throws PolicyStoreException
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

updatePolicy

boolean updatePolicy(String name,
                     String newDocument)
                     throws PolicyStoreException
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

listPolicies

List<String> listPolicies()
                          throws PolicyStoreException
Obtains a list of stored policies.

Returns:
a list containing the names of all the policies in the store.
Throws:
PolicyStoreException

contains

boolean contains(String policy)
                 throws PolicyStoreException
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

contains

boolean contains(File policy)
                 throws PolicyStoreException
Check if the policy in the file exists in the policy store.

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

init

void init()
          throws PolicyStoreException,
                 FileNotFoundException
Initialize this PolicyStore with the bootstrap policies

Throws:
PolicyStoreException
FileNotFoundException


Copyright © 2012 DuraSpace. All Rights Reserved.