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

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

public class FedoraPolicyStore
extends AbstractPolicyStore
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
           
 
Fields inherited from class org.fcrepo.server.security.xacml.pdp.data.AbstractPolicyStore
LOGGER, policiesLoaded, policyNames
 
Constructor Summary
FedoraPolicyStore(Server server)
           
 
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.
 void init()
          Initialize this PolicyStore with the bootstrap policies
 List<String> listPolicies()
          Obtains a list of stored policies.
 void setCollection(String collection)
           
 void setCollectionRelationship(String collectionRelationship)
           
 void setContentModel(String contentModel)
           
 void setDatastreamControlGroup(String datastreamControlGroup)
           
 void setPidNamespace(String pidNamespace)
           
 void setSchemaLocations(Map<String,String> schemaLocation)
          Map policy schema URIs to locations for the schema document
 void setSchemaValidation(boolean validate)
           
 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 org.fcrepo.server.security.xacml.pdp.data.AbstractPolicyStore
addDocuments, addDocuments, reloadPolicies
 
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

public FedoraPolicyStore(Server server)
                  throws PolicyStoreException
Throws:
PolicyStoreException
Method Detail

init

public void init()
          throws PolicyStoreException,
                 FileNotFoundException
Description copied from interface: PolicyStore
Initialize this PolicyStore with the bootstrap policies

Specified by:
init in interface PolicyStore
Overrides:
init in class AbstractPolicyStore
Throws:
PolicyStoreException
FileNotFoundException

setPidNamespace

public void setPidNamespace(String pidNamespace)

setContentModel

public void setContentModel(String contentModel)

setDatastreamControlGroup

public void setDatastreamControlGroup(String datastreamControlGroup)

setCollection

public void setCollection(String collection)

setCollectionRelationship

public void setCollectionRelationship(String collectionRelationship)

setSchemaValidation

public void setSchemaValidation(boolean validate)

setSchemaLocations

public void setSchemaLocations(Map<String,String> schemaLocation)
                        throws IOException,
                               SAXException
Map policy schema URIs to locations for the schema document

Parameters:
schemaLocation -
Throws:
IOException
SAXException

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 © 2012 DuraSpace. All Rights Reserved.