|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.exist.security.xacml.XACMLUtil
public class 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(String message,
Throwable t)
Convenience method for errors occurring while processing. |
AbstractPolicy |
findPolicy(DBBroker broker,
URI idReference,
int type)
Gets the policy (or policy set) specified by the given id. |
static 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,
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,
URI attributeValue)
Gets all policy (or policy set) documents that have the attribute specified by attributeQName with the value attributeValue. |
static boolean |
inPolicyCollection(DocumentImpl document)
Returns true if the specified document is in the policy collection. |
void |
nodeMoved(NodeId oldNodeId,
StoredNode newNode)
nodeMoved is called after a defragmentation run occurred for a document during which the address and the nodeId of a node may have changed. |
AbstractPolicy |
parsePolicyDocument(Document policyDoc)
Parses a DOM representation of a policy document into an AbstractPolicy. |
static String |
serialize(Apply apply,
boolean indent)
Serializes the specified Apply to a
String as XML. |
static String |
serialize(PolicyTreeElement element,
boolean indent)
Serializes the specified PolicyTreeElement to a
String as XML. |
static String |
serialize(Target target,
boolean indent)
Serializes the specified Target to a
String as XML. |
static void |
storeDefaultPolicies(DBBroker broker)
Stores the default policies |
static void |
storePolicy(DBBroker broker,
XmldbURI docPath)
Stores the resource at docPath into the policies collection. |
static String |
toString(InputStream in)
Reads an InputStream into a string. |
void |
unsubscribe()
Called when the listener is removed from the notification service |
static String |
XMLEscape(String in)
Escapes characters that are not allowed in various places in XML by replacing all invalid characters with getEscape(c). |
static void |
XMLEscape(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 |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
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 UpdateListener
public void nodeMoved(NodeId oldNodeId,
StoredNode newNode)
UpdateListener
nodeMoved in interface UpdateListenerpublic void unsubscribe()
UpdateListener
unsubscribe in interface UpdateListenerpublic static boolean inPolicyCollection(DocumentImpl document)
document - The document in question
public void close()
public AbstractPolicy findPolicy(DBBroker broker,
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,
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,
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(String message,
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(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(StringBuffer buffer)
getEscape(c).
buffer - The StringBuffer containing
the text to escape in place.public static 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 String XMLEscape(String in)
getEscape(c).
in - The String containing
the text to escape in place.
public static 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 String serialize(Target target,
boolean indent)
Target to a
String as XML. The XML is indented if indent
is true.
target - The Target to serializeindent - If the XML should be indented
public static String serialize(Apply apply,
boolean indent)
Apply to a
String as XML. The XML is indented if indent
is true.
apply - The Apply 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,
XmldbURI docPath)
throws EXistException,
IOException
broker - The broker with which to access the databasedocPath - The location of the resource
EXistException
IOException
public static String toString(InputStream in)
throws IOException
InputStream into a string.
in - The stream to read into a string.
IOExceptionpublic void debug()
debug in interface UpdateListener
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||