public class PolicyReader
extends java.lang.Object
implements org.xml.sax.ErrorHandler
InputStreams, Files, and URL
s. It can optionally schema validate the policies.
Note: some of this functionality was previously provided in
org.jboss.security.xacml.sunxacml.finder.impl.FilePolicyModule, but as of the 2.0
release, that class has been removed. This new PolicyReader
class provides much better functionality for loading policies.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
POLICY_SCHEMA_PROPERTY
The property which is used to specify the schema file to validate against
(if any).
|
| Constructor and Description |
|---|
PolicyReader()
Creates a
PolicyReader that does not schema-validate
policies. |
PolicyReader(java.io.File schemaFile)
Creates a
PolicyReader that may schema-validate policies. |
| Modifier and Type | Method and Description |
|---|---|
void |
error(org.xml.sax.SAXParseException exception)
Standard handler routine for the XML parsing.
|
void |
fatalError(org.xml.sax.SAXParseException exception)
Standard handler routine for the XML parsing.
|
org.w3c.dom.Document |
readPolicy(byte[] input) |
org.w3c.dom.Document |
readPolicy(java.io.File file)
Tries to read an XACML policy or policy set from the given file.
|
org.w3c.dom.Document |
readPolicy(java.io.InputStream input)
Tries to read an XACML policy or policy set from the given stream.
|
org.w3c.dom.Document |
readPolicy(java.net.URL url)
Tries to read an XACML policy or policy set based on the given URL.
|
void |
warning(org.xml.sax.SAXParseException exception)
Standard handler routine for the XML parsing.
|
public static final java.lang.String POLICY_SCHEMA_PROPERTY
PolicyReader
, but is referenced by many classes that use this class to load policies.public PolicyReader()
PolicyReader that does not schema-validate
policies.finder - a PolicyFinder that is used by policy sets, which may
be null only if no references are usedpublic PolicyReader(java.io.File schemaFile)
PolicyReader that may schema-validate policies.schemaFile - the schema file used to validate policies, or null if schema
validation is not desiredpublic org.w3c.dom.Document readPolicy(java.io.File file)
throws org.jboss.security.xacml.sunxacml.ParsingException
file - the file containing the policy to readorg.jboss.security.xacml.sunxacml.ParsingException - if an error occurs while reading or parsing the policypublic org.w3c.dom.Document readPolicy(java.io.InputStream input)
throws org.jboss.security.xacml.sunxacml.ParsingException
input - the stream containing the policy to readorg.jboss.security.xacml.sunxacml.ParsingException - if an error occurs while reading or parsing the policypublic org.w3c.dom.Document readPolicy(byte[] input)
throws org.jboss.security.xacml.sunxacml.ParsingException
org.jboss.security.xacml.sunxacml.ParsingExceptionpublic org.w3c.dom.Document readPolicy(java.net.URL url)
throws org.jboss.security.xacml.sunxacml.ParsingException
url - a URL pointing to the policy to readorg.jboss.security.xacml.sunxacml.ParsingException - if an error occurs while reading or parsing the policy, or if the
URL can't be resolvedpublic void warning(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXException
warning in interface org.xml.sax.ErrorHandlerexception - information on what caused the problemorg.xml.sax.SAXExceptionpublic void error(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXException
error in interface org.xml.sax.ErrorHandlerexception - information on what caused the problemorg.xml.sax.SAXException - always to halt parsing on errorspublic void fatalError(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXException
fatalError in interface org.xml.sax.ErrorHandlerexception - information on what caused the problemorg.xml.sax.SAXException - always to halt parsing on errorsCopyright © 2014 DuraSpace. All Rights Reserved.