public class PolicyParser extends Object
This class also provides a commandline XACML validation utility.
NOTE: Although instances may be re-used, this class is not thread-safe.
Use the copy() method to support concurrent parsing.
| Modifier and Type | Class and Description |
|---|---|
static class |
PolicyParser.ThrowAllErrorHandler
This class is a workaround to some shift in the behavior of anonymous inner classes
|
| Constructor and Description |
|---|
PolicyParser(InputStream schemaStream)
Creates an instance that will validate according to the given schema.
|
| Modifier and Type | Method and Description |
|---|---|
PolicyParser |
copy()
Gets a new instance that uses the same schema as this one.
|
static void |
main(String[] args)
Command-line utility for validating XACML policies.
|
com.sun.xacml.AbstractPolicy |
parse(InputStream policyStream,
boolean schemaValidate)
Parses the given policy and optionally schema validates it.
|
public PolicyParser(InputStream schemaStream) throws IOException, SAXException
schemaStream - the XSD schema to use for schema validationIOException - if the schema can't be readSAXException - if the schema isn't validpublic PolicyParser copy()
public com.sun.xacml.AbstractPolicy parse(InputStream policyStream, boolean schemaValidate) throws ValidationException
policyStream - the serialized XACML policyvalidate - whether to schema validateValidationException - if the given xml is not a valid policy. This will occur if it
is not well-formed XML, its root element is not named
Policy or PolicySet, it triggers
a parse exception in the Sun libraries when constructing an
AbstractPolicy from the DOM, or (if validation
is true) it is not schema-valid.public static void main(String[] args)
Accepts a single argument: the path to the policy instance to validate.
Also requires that the com.sun.xacml.PolicySchema system property points to the XACML schema.
Copyright © 2013 DuraSpace. All Rights Reserved.