|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fcrepo.server.security.xacml.pdp.data.PolicyIndexBase
org.fcrepo.server.security.xacml.pdp.data.XPathPolicyIndex
org.fcrepo.server.security.xacml.pdp.data.ExistPolicyIndex
public class ExistPolicyIndex
A PolicyIndex based on an XPath XML database. This implementation only tested on eXist, but as only generic xmldb API methods have been used it should work with some customisation on other XML databases that support the xmldb API. Customisations will be required for driver configuration, indexing, and potentially organisation of collections (eg root collection name). Concurrency handled with a ReentrantReadWriteLock (although eXist does natively have some concurrency support).
| Field Summary | |
|---|---|
protected org.xmldb.api.base.Collection |
m_collection
|
| Fields inherited from class org.fcrepo.server.security.xacml.pdp.data.PolicyIndexBase |
|---|
ACTION_KEY, ENVIRONMENT_KEY, indexed, indexMap, m_policyReader, METADATA_POLICY_NS, namespaces, RESOURCE_KEY, SUBJECT_KEY |
| Fields inherited from interface org.fcrepo.server.security.xacml.pdp.data.PolicyIndex |
|---|
XACML_RESOURCE_ID, XACML20_POLICY_NS |
| Constructor Summary | |
|---|---|
protected |
ExistPolicyIndex(PolicyReader policyReader)
|
| 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 |
void |
close()
|
boolean |
contains(String policyName)
Check if the policy identified by policyName exists. |
protected org.xmldb.api.base.Collection |
createCollectionPath(String collectionPath,
org.xmldb.api.base.Collection rootCollection)
Create a collection given a full path to the collection. |
protected static Document |
createDocument(String document)
|
protected void |
deleteCollection()
delete the policy collection from the database |
boolean |
deletePolicy(String name)
Removes the policy given by name from the data store. |
protected org.xmldb.api.base.ResourceSet |
doQuery(String query,
Map<String,String> variables)
|
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. |
protected static String |
IdToName(String Id)
|
void |
init()
|
protected void |
initCollection()
|
void |
initDatabase()
|
protected static String |
nameToId(String name)
|
protected static byte[] |
nodeToByte(Node node)
get XML document supplied as w3c dom Node as bytes |
void |
setCollectionName(String collectionName)
|
void |
setDatabaseURI(String databaseURI)
|
void |
setPassword(String password)
|
void |
setUser(String user)
|
protected static String[] |
sortDescending(String[] s)
sorts a string array in descending order of length |
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.XPathPolicyIndex |
|---|
getXpath, getXpathVariables |
| Methods inherited from class org.fcrepo.server.security.xacml.pdp.data.PolicyIndexBase |
|---|
getAttributeMap, handleDocument, makeComponents, setActionAttributes, setAttributeMap, setEnvironmentAttributes, setResourceAttributes, setSubjectAttributes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.xmldb.api.base.Collection m_collection
| Constructor Detail |
|---|
protected ExistPolicyIndex(PolicyReader policyReader)
throws PolicyIndexException
PolicyIndexException| Method Detail |
|---|
public String addPolicy(String name,
String document)
throws PolicyIndexException
PolicyIndex
addPolicy in interface PolicyIndexdocument - the policy as a String
PolicyIndexException
public boolean clear()
throws PolicyIndexException
PolicyIndex
clear in interface PolicyIndexPolicyIndexException
public boolean contains(String policyName)
throws PolicyIndexException
PolicyIndex
contains in interface PolicyIndexPolicyIndexException
public boolean deletePolicy(String name)
throws PolicyIndexException
PolicyIndex
deletePolicy in interface PolicyIndexname - the name of the policy
PolicyIndexException
public Map<String,com.sun.xacml.AbstractPolicy> getPolicies(com.sun.xacml.EvaluationCtx eval,
com.sun.xacml.finder.PolicyFinder policyFinder)
throws PolicyIndexException
PolicyIndex
getPolicies in interface PolicyIndexeval - the Evaluation Context from which to match policies against
PolicyIndexException
public com.sun.xacml.AbstractPolicy getPolicy(String name,
com.sun.xacml.finder.PolicyFinder policyFinder)
throws PolicyIndexException
PolicyIndex
getPolicy in interface PolicyIndexname - the name of the policy to return
PolicyIndexException
public boolean updatePolicy(String name,
String newDocument)
throws PolicyIndexException
PolicyIndex
updatePolicy in interface PolicyIndexname - the name of the policy to updatenewDocument - the new policy as a String
PolicyIndexException
protected static byte[] nodeToByte(Node node)
throws PolicyIndexException
node -
PolicyIndexExceptionprotected static String nameToId(String name)
protected static String IdToName(String Id)
protected static String[] sortDescending(String[] s)
s -
protected org.xmldb.api.base.ResourceSet doQuery(String query,
Map<String,String> variables)
throws PolicyIndexException
PolicyIndexException
protected org.xmldb.api.base.Collection createCollectionPath(String collectionPath,
org.xmldb.api.base.Collection rootCollection)
throws PolicyIndexException
collectionPath - rootCollection -
PolicyIndexExceptionpublic void setDatabaseURI(String databaseURI)
public void setCollectionName(String collectionName)
public void setUser(String user)
public void setPassword(String password)
public void init()
throws PolicyIndexException
PolicyIndexException
public void initDatabase()
throws PolicyIndexException
PolicyIndexException
protected void initCollection()
throws PolicyIndexException
PolicyIndexException
protected void deleteCollection()
throws PolicyIndexException
PolicyIndexException
protected static Document createDocument(String document)
throws PolicyIndexException
PolicyIndexExceptionpublic void close()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||