|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exist.security.xacml.XACMLUtil
This class contains utility methods for working with XACML in eXist.
| Field Summary |
| Fields inherited from interface org.exist.storage.UpdateListener |
ADD, REMOVE, UPDATE |
| Method Summary | |
void |
close()
Performs any necessary cleanup operations. |
void |
debug()
|
void |
documentUpdated(DocumentImpl document,
int event)
This method is called by the NotificationService
when documents are updated in the databases. |
static PolicyFinderResult |
errorResult(java.lang.String message,
java.lang.Throwable t)
Convenience method for errors occurring while processing. |
AbstractPolicy |
findPolicy(DBBroker broker,
java.net.URI idReference,
int type)
Gets the policy (or policy set) specified by the given id. |
static java.lang.String |
getEscape(char c)
Escapes characters that are not allowed in various places in XML. |
static QName |
getIdAttributeQName(int type)
Gets the name of the attribute that specifies the policy (if type == PolicyReference.POLICY_REFERENCE) or the policy set (if type == PolicyReference.POLICYSET_REFERENCE). |
static Collection |
getPolicyCollection(DBBroker broker)
Gets the policy collection or creates it if it does not exist. |
DocumentImpl |
getPolicyDocument(DBBroker broker,
QName attributeQName,
java.net.URI attributeValue)
Returns the single policy (or policy set) document that has the attribute specified by attributeQName with the value attributeValue, null if none match, or throws a ProcessingException if more than one match. |
AbstractPolicy |
getPolicyDocument(DocumentImpl policyDoc)
Obtains a parsed representation of the specified XACML Policy or PolicySet document. |
static DocumentSet |
getPolicyDocuments(DBBroker broker,
boolean recursive)
This method returns all policy documents in the policies collection. |
DocumentSet |
getPolicyDocuments(DBBroker broker,
QName attributeQName,
java.net.URI attributeValue)
Gets all policy (or policy set) documents that have the attribute specified by attributeQName with the value attributeValue. |
protected void |
initializePolicyCollection()
|
static boolean |
inPolicyCollection(DocumentImpl document)
Returns true if the specified document is in the policy collection. |
AbstractPolicy |
parsePolicyDocument(org.w3c.dom.Document policyDoc)
Parses a DOM representation of a policy document into an AbstractPolicy. |
static java.lang.String |
serialize(PolicyTreeElement element,
boolean indent)
Serializes the specified PolicyTreeElement to a
String as XML. |
static void |
storeDefaultPolicies(DBBroker broker)
Stores the default policies |
static void |
storePolicy(DBBroker broker,
java.lang.String docPath)
Stores the resource at docPath into the policies collection. |
static java.lang.String |
toString(java.io.InputStream in)
Reads an InputStream into a string. |
static java.lang.String |
XMLEscape(java.lang.String in)
Escapes characters that are not allowed in various places in XML by replacing all invalid characters with getEscape(c). |
static void |
XMLEscape(java.lang.StringBuffer buffer)
Escapes characters that are not allowed in various places in XML by replacing all invalid characters with getEscape(c). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
protected void initializePolicyCollection()
public void documentUpdated(DocumentImpl document,
int event)
NotificationService
when documents are updated in the databases. If a document
is removed or updated from the policy collection, it is removed
from the policy cache.
documentUpdated in interface UpdateListenerdocument - event - public static boolean inPolicyCollection(DocumentImpl document)
document - The document in question
public void close()
public AbstractPolicy findPolicy(DBBroker broker,
java.net.URI idReference,
int type)
throws ParsingException,
ProcessingException,
XPathException
type - The type of id reference:
PolicyReference.POLICY_REFERENCE for a policy reference
or PolicyReference.POLICYSET_REFERENCE for a policy set
reference.idReference - The id of the policy (or policy set) to
retrievebroker - the broker to use to access the database
ProcessingException - if there is an error finding
the policy (or policy set).
XPathException
ParsingException
public static DocumentSet getPolicyDocuments(DBBroker broker,
boolean recursive)
broker - the broker to use to access the databaserecursive - true if policies in subcollections should be
returned as well
public static Collection getPolicyCollection(DBBroker broker)
broker - The broker to use to access the database.
Collection object for the policy collection.
public DocumentImpl getPolicyDocument(DBBroker broker,
QName attributeQName,
java.net.URI attributeValue)
throws ProcessingException,
XPathException
ProcessingException if more than one match. This is
performed by a QName range index lookup and so it requires a range
index to be given on the attribute.
attributeQName - The name of the attributeattributeValue - The value of the attributebroker - the broker to use to access the database
ProcessingException - if there is an error finding
the policy (or policy set) documents.
XPathException - if there is an error performing
the index lookup
public DocumentSet getPolicyDocuments(DBBroker broker,
QName attributeQName,
java.net.URI attributeValue)
throws ProcessingException,
XPathException
attributeQName - The name of the attributeattributeValue - The value of the attributebroker - the broker to use to access the database
ProcessingException - if there is an error finding
the policy (or policy set) documents.
XPathException - if there is an error performing the
index lookuppublic static QName getIdAttributeQName(int type)
type - The type of id reference:
PolicyReference.POLICY_REFERENCE for a policy reference
or PolicyReference.POLICYSET_REFERENCE for a policy set
reference.
public static PolicyFinderResult errorResult(java.lang.String message,
java.lang.Throwable t)
PolicyFinderResult is
generated with Status.STATUS_PROCESSING_ERROR as the error condition
and the message as the message.
message - The message describing the error.t - The cause of the error, may be null
PolicyFinderResult representing the error.
public AbstractPolicy getPolicyDocument(DocumentImpl policyDoc)
throws ParsingException
AbstractPolicy. Otherwise, it unmarshals the document into
an AbstractPolicy and caches it.
policyDoc - the policy (or policy set) document
for which a parsed representation should be obtained
ParsingException - if an error occurs while parsing the specified document
public AbstractPolicy parsePolicyDocument(org.w3c.dom.Document policyDoc)
throws ParsingException
AbstractPolicy.
policyDoc - The DOM Document representing
the XACML policy or policy set.
ParsingException - if there is an error parsing the documentpublic static void XMLEscape(java.lang.StringBuffer buffer)
getEscape(c).
buffer - The StringBuffer containing
the text to escape in place.public static java.lang.String getEscape(char c)
c - The character to escape.
String representing the
escaped character or null if the character does
not need to be escaped.public static java.lang.String XMLEscape(java.lang.String in)
getEscape(c).
in - The String containing
the text to escape in place.
public static java.lang.String serialize(PolicyTreeElement element,
boolean indent)
PolicyTreeElement to a
String as XML. The XML is indented if indent
is true.
element - The PolicyTreeElement to serializeindent - If the XML should be indented
public static void storeDefaultPolicies(DBBroker broker)
broker - The broker with which to access the database
public static void storePolicy(DBBroker broker,
java.lang.String docPath)
throws EXistException,
java.io.IOException
broker - The broker with which to access the databasedocPath - The location of the resource
EXistException
java.io.IOException
public static java.lang.String toString(java.io.InputStream in)
throws java.io.IOException
InputStream into a string.
in - The stream to read into a string.
java.io.IOExceptionpublic void debug()
debug in interface UpdateListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||