org.fcrepo.server.security.xacml.pdp.data
Class FedoraPolicyStore

java.lang.Object
  extended by org.fcrepo.server.security.xacml.pdp.data.FedoraPolicyStore
All Implemented Interfaces:
PolicyStore

public class FedoraPolicyStore
extends Object
implements PolicyStore

A PolicyStore for managing policies stored as Fedora digital objects. Mainly used by the initial load of the bootstrap policies and by the rebuilder. For searching for policies see PolicyIndex.java and its implementations.

Version:
$Id$
Author:
Stephen Bayliss

Field Summary
protected  Access apiAService
           
protected  Management apiMService
           
protected  Server fedoraServer
           
static String FESL_BOOTSTRAP_POLICY_NAMESPACE
           
static String FESL_POLICY_DATASTREAM
           
 
Constructor Summary
protected FedoraPolicyStore()
           
 
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 identified by policyName exists.
 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.
 byte[] getPolicy(String name)
          Obtains the policy with the provided name from the Policy Store.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FESL_POLICY_DATASTREAM

public static final String FESL_POLICY_DATASTREAM
See Also:
Constant Field Values

FESL_BOOTSTRAP_POLICY_NAMESPACE

public static String FESL_BOOTSTRAP_POLICY_NAMESPACE

fedoraServer

protected Server fedoraServer

apiMService

protected Management apiMService

apiAService

protected Access apiAService
Constructor Detail

FedoraPolicyStore

protected FedoraPolicyStore()
                     throws PolicyStoreException
Throws:
PolicyStoreException
Method Detail

addPolicy

public String addPolicy(File f)
                 throws PolicyStoreException
Description copied from interface: PolicyStore
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.

Specified by:
addPolicy in interface PolicyStore
Parameters:
f - the policy as a File
Returns:
the name of the added policy
Throws:
PolicyStoreException

addPolicy

public String addPolicy(File f,
                        String name)
                 throws PolicyStoreException
Description copied from interface: PolicyStore
Generates a policy using the File and name provided and adds it to the Policy Store.

Specified by:
addPolicy in interface PolicyStore
Parameters:
f - the policy as a File
name - the name to assign the policy
Returns:
the name of the policy
Throws:
PolicyStoreException

addPolicy

public String addPolicy(String document)
                 throws PolicyStoreException
Description copied from interface: PolicyStore
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.

Specified by:
addPolicy in interface PolicyStore
Parameters:
document - the policy as a String
Returns:
the name of the added policy
Throws:
PolicyStoreException

addPolicy

public String addPolicy(String document,
                        String name)
                 throws PolicyStoreException
Description copied from interface: PolicyStore
Generates a policy based on the string data provided and the name. The policy is then added to the Policy Store.

Specified by:
addPolicy in interface PolicyStore
Parameters:
document - the policy as a String
Returns:
the name of the added policy
Throws:
PolicyStoreException

deletePolicy

public boolean deletePolicy(String name)
                     throws PolicyStoreException
Description copied from interface: PolicyStore
Removes the policy given by name from the data store.

Specified by:
deletePolicy in interface PolicyStore
Parameters:
name - the name of the policy
Returns:
true if policy was deleted
Throws:
PolicyStoreException

updatePolicy

public boolean updatePolicy(String name,
                            String newDocument)
                     throws PolicyStoreException
Description copied from interface: PolicyStore
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.

Specified by:
updatePolicy in interface PolicyStore
Parameters:
name - the name of the policy to update
newDocument - the new policy as a String
Returns:
true if policy was updated
Throws:
PolicyStoreException

getPolicy

public byte[] getPolicy(String name)
                 throws PolicyStoreException
Description copied from interface: PolicyStore
Obtains the policy with the provided name from the Policy Store.

Specified by:
getPolicy in interface PolicyStore
Parameters:
name - the name of the policy to return
Returns:
the policy as an array of bytes
Throws:
PolicyStoreException

contains

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

Specified by:
contains in interface PolicyStore
Parameters:
policyName -
Returns:
true iff the policy store contains a policy identified as policyName
Throws:
PolicyStoreException

contains

public boolean contains(File policy)
                 throws PolicyStoreException
Check if the policy identified by policyName exists.

Specified by:
contains in interface PolicyStore
Parameters:
policy -
Returns:
true iff the policy store contains a policy with the same PolicyId
Throws:
PolicyStoreException

listPolicies

public List<String> listPolicies()
                          throws PolicyStoreException
Description copied from interface: PolicyStore
Obtains a list of stored policies.

Specified by:
listPolicies in interface PolicyStore
Returns:
a list containing the names of all the policies in the store.
Throws:
PolicyStoreException


Copyright © 2011 DuraSpace. All Rights Reserved.