Package org.jppf.node.policy
Class PolicyParser
java.lang.Object
org.jppf.node.policy.PolicyParser
This class is a parser for XML Execution Policy documents.
- Author:
- Laurent Cohen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidTest of the parser.org.jppf.node.policy.PolicyDescriptorParse an XML document in a reader into a tree of option descriptors.org.jppf.node.policy.PolicyDescriptorParse an XML document in a file into a tree of option descriptors.static ExecutionPolicyparsePolicy(File policyFile) Parse an XML document representing an execution policy from a file path.static ExecutionPolicyparsePolicy(InputStream stream) Parse an XML document representing an execution policy from an input stream.static ExecutionPolicyparsePolicy(Reader reader) Parse an XML document representing an execution policy from a reader.static ExecutionPolicyparsePolicy(String policyContent) Parse an XML document representing an execution policy.static ExecutionPolicyparsePolicyFile(String docPath) Parse an XML document representing an execution policy from a file path.static voidvalidatePolicy(File docPath) Validate an XML document representing an execution policy against the JPPF Execution Policy schema.static voidvalidatePolicy(InputStream stream) Validate an XML document representing an execution policy against the JPPF Execution Policy schema.static voidvalidatePolicy(Reader reader) Validate an XML document representing an execution policy against the JPPF Execution Policy schema.static voidvalidatePolicy(String policyContent) Validate an XML document representing an execution policy against the JPPF Execution Policy schema.static voidvalidatePolicyFile(String docPath) Validate an XML document representing an execution policy against the JPPF Execution Policy schema.
-
Constructor Details
-
PolicyParser
Initialize this parser.- Throws:
Exception- if the DOM parser could not be initialized.
-
-
Method Details
-
parse
Parse an XML document in a file into a tree of option descriptors.- Parameters:
docPath- the path to XML document to parse.- Returns:
- an
OptionDescriptorinstance, root of the generated tree, or null if the document could not be parsed. - Throws:
Exception- if an error occurs while parsing the document.
-
parse
Parse an XML document in a reader into a tree of option descriptors.- Parameters:
reader- the reader providing the XML document.- Returns:
- an
OptionDescriptorinstance, root of the generated tree, or null if the document could not be parsed. - Throws:
Exception- if an error occurs while parsing the document.
-
main
Test of the parser.- Parameters:
args- not used.
-
parsePolicy
Parse an XML document representing an execution policy.- Parameters:
policyContent- an XML string containing the policy.- Returns:
- an
ExecutionPolicyinstance. - Throws:
Exception- if an error occurs during the validation or parsing.
-
parsePolicyFile
Parse an XML document representing an execution policy from a file path.- Parameters:
docPath- path to the XML document file.- Returns:
- an
ExecutionPolicyinstance. - Throws:
Exception- if an error occurs during the validation or parsing.
-
parsePolicy
Parse an XML document representing an execution policy from a file path.- Parameters:
policyFile- abstract path of the XML document file.- Returns:
- an
ExecutionPolicyinstance. - Throws:
Exception- if an error occurs during the validation or parsing.
-
parsePolicy
Parse an XML document representing an execution policy from an input stream.- Parameters:
stream- an input stream from which the XML representation of the policy is read.- Returns:
- an
ExecutionPolicyinstance. - Throws:
Exception- if an error occurs during the validation or parsing.
-
parsePolicy
Parse an XML document representing an execution policy from a reader.- Parameters:
reader- reader from which the XML representation of the policy is read.- Returns:
- an
ExecutionPolicyinstance. - Throws:
Exception- if an error occurs during the validation or parsing.
-
validatePolicy
Validate an XML document representing an execution policy against the JPPF Execution Policy schema.- Parameters:
policyContent- the XML content of the policy document.- Throws:
JPPFException- if there is a validation error. The details of the errors are included in the exception message.Exception- if an error occurs during the validation.
-
validatePolicyFile
Validate an XML document representing an execution policy against the JPPF Execution Policy schema.- Parameters:
docPath- path to the XML document file.- Throws:
JPPFException- if there is a validation error. The details of the errors are included in the exception message.Exception- if an error occurs during the validation.
-
validatePolicy
Validate an XML document representing an execution policy against the JPPF Execution Policy schema.- Parameters:
docPath- abstract path of the XML document file.- Throws:
JPPFException- if there is a validation error. The details of the errors are included in the exception message.Exception- if an error occurs during the validation.
-
validatePolicy
Validate an XML document representing an execution policy against the JPPF Execution Policy schema.- Parameters:
stream- an input stream from which the XML representation of the policy is read.- Throws:
JPPFException- if there is a validation error. The details of the errors are included in the exception message.Exception- if an error occurs during the validation or parsing.
-
validatePolicy
Validate an XML document representing an execution policy against the JPPF Execution Policy schema.- Parameters:
reader- reader from which the XML representation of the policy is read.- Throws:
JPPFException- if there is a validation error. The details of the errors are included in the exception message.Exception- if an error occurs during the validation or parsing.
-