|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.xacml.finder.PolicyFinderModule
eu.xtreemos.xosd.security.vops.xacml.utils.XmlPolicyModule
public class XmlPolicyModule
This module represents a collection of files containing polices, each of which will be searched through when trying to find a policy that is applicable to a specific request.
Note: this module is provided only as an example and for testing purposes. It is not part of the standard, and it should not be relied upon for production systems. In the future, this will likely be moved into a package with other similar example and testing code.
Field Summary | |
---|---|
private com.sun.xacml.finder.PolicyFinder |
finder
|
static java.lang.String |
JAXP_SCHEMA_LANGUAGE
|
static java.lang.String |
JAXP_SCHEMA_SOURCE
|
private static java.util.logging.Logger |
logger
|
private java.util.Set |
policies
|
private java.util.Set |
policiesSource
|
static java.lang.String |
POLICY_SCHEMA_PROPERTY
The property which is used to specify the schema file to validate against (if any) |
private java.io.File |
schemaFile
|
static java.lang.String |
W3C_XML_SCHEMA
|
Constructor Summary | |
---|---|
XmlPolicyModule()
Constructor which retrieves the schema file to validate policies against from the POLICY_SCHEMA_PROPERTY. |
|
XmlPolicyModule(java.io.File schemaFile)
Constructor that uses the specified input as the schema file to validate policies against. |
|
XmlPolicyModule(java.util.List policies)
Constructor that specifies a set of initial policy files to use. |
Method Summary | |
---|---|
boolean |
addPolicy(java.lang.String policyString)
Adds a string (containing a policy) to the collection of policy strings (sources) associated with this module. |
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. |
com.sun.xacml.finder.PolicyFinderResult |
findPolicy(com.sun.xacml.EvaluationCtx context)
Finds a policy based on a request's context. |
java.util.Set |
getPolicies()
|
void |
init(com.sun.xacml.finder.PolicyFinder finder)
Initializes the FilePolicyModule by loading
the policies contained in the collection of files associated
with this module. |
boolean |
isRequestSupported()
Indicates whether this module supports finding policies based on a request (target matching). |
static com.sun.xacml.AbstractPolicy |
loadPolicy(java.lang.String policySource,
com.sun.xacml.finder.PolicyFinder finder)
Loads a policy from the specified string and uses the specified PolicyFinder to help with instantiating PolicySets. |
static com.sun.xacml.AbstractPolicy |
loadPolicy(java.lang.String policySource,
com.sun.xacml.finder.PolicyFinder finder,
java.io.File schemaFile,
org.xml.sax.ErrorHandler handler)
Loads a policy from the specified filename, using the specified PolicyFinder to help with instantiating PolicySets,
and using the specified input as the schema file to validate
policies against. |
static com.sun.xacml.AbstractPolicy |
loadPolicyFromString(java.lang.String policySource,
com.sun.xacml.finder.PolicyFinder finder,
java.io.File schemaFile,
org.xml.sax.ErrorHandler handler)
Loads a policy from the specified string, using the specified PolicyFinder to help with instantiating PolicySets,
and using the specified input as the schema file to validate
policies against. |
void |
warning(org.xml.sax.SAXParseException exception)
Standard handler routine for the XML parsing. |
Methods inherited from class com.sun.xacml.finder.PolicyFinderModule |
---|
findPolicy, getIdentifier, invalidateCache, isIdReferenceSupported |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String POLICY_SCHEMA_PROPERTY
public static final java.lang.String JAXP_SCHEMA_LANGUAGE
public static final java.lang.String W3C_XML_SCHEMA
public static final java.lang.String JAXP_SCHEMA_SOURCE
private com.sun.xacml.finder.PolicyFinder finder
private java.io.File schemaFile
private java.util.Set policiesSource
private java.util.Set policies
private static final java.util.logging.Logger logger
Constructor Detail |
---|
public XmlPolicyModule()
public XmlPolicyModule(java.io.File schemaFile)
schemaFile
- the schema file to validate policies against,
or null if schema validation is not desired.public XmlPolicyModule(java.util.List policies)
fileNames
- a List
of String
s that
policiesMethod Detail |
---|
public boolean isRequestSupported()
isRequestSupported
in class com.sun.xacml.finder.PolicyFinderModule
public void init(com.sun.xacml.finder.PolicyFinder finder)
FilePolicyModule
by loading
the policies contained in the collection of files associated
with this module. This method also uses the specified
PolicyFinder
to help in instantiating PolicySets.
init
in class com.sun.xacml.finder.PolicyFinderModule
finder
- a PolicyFinder used to help in instantiating PolicySetspublic boolean addPolicy(java.lang.String policyString)
filename
- the file to add to this module's collection of filespublic static com.sun.xacml.AbstractPolicy loadPolicy(java.lang.String policySource, com.sun.xacml.finder.PolicyFinder finder)
PolicyFinder
to help with instantiating PolicySets.
policySource
- the string to load the policy fromfinder
- a PolicyFinder used to help in instantiating PolicySets
public static com.sun.xacml.AbstractPolicy loadPolicyFromString(java.lang.String policySource, com.sun.xacml.finder.PolicyFinder finder, java.io.File schemaFile, org.xml.sax.ErrorHandler handler)
PolicyFinder
to help with instantiating PolicySets,
and using the specified input as the schema file to validate
policies against. If schema validation is not desired, a null
value should be used for schemaFile
policySource
- the source string to load the policy fromfinder
- a PolicyFinder used to help in instantiating PolicySetsschemaFile
- the schema file to validate policies against, or
null if schema validation is not desiredhandler
- an error handler used to print warnings and errors
during parsing
public static com.sun.xacml.AbstractPolicy loadPolicy(java.lang.String policySource, com.sun.xacml.finder.PolicyFinder finder, java.io.File schemaFile, org.xml.sax.ErrorHandler handler)
PolicyFinder
to help with instantiating PolicySets,
and using the specified input as the schema file to validate
policies against. If schema validation is not desired, a null
value should be used for schemaFile
filename
- the file to load the policy fromfinder
- a PolicyFinder used to help in instantiating PolicySetsschemaFile
- the schema file to validate policies against, or
null if schema validation is not desiredhandler
- an error handler used to print warnings and errors
during parsing
public com.sun.xacml.finder.PolicyFinderResult findPolicy(com.sun.xacml.EvaluationCtx context)
findPolicy
in class com.sun.xacml.finder.PolicyFinderModule
context
- the representation of the request data
public void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
exception
- information on what caused the problem
org.xml.sax.SAXException
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
exception
- information on what caused the problem
org.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.ErrorHandler
exception
- information on what caused the problem
org.xml.sax.SAXException
- always to halt parsing on errorspublic java.util.Set getPolicies()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |