Package org.verapdf.policy
Class PolicyChecker
java.lang.Object
org.verapdf.policy.PolicyChecker
The veraPDF policy checker which is simply an abstraction that makes applying
XML schematron to veraPDF reports straightforward.
- Version:
- 0.1 Created 12 Dec 2016:17:51:12
- Author:
- Carl Wilson carlwilson AT github
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyPolicy(File policy, InputStream xmlReport, OutputStream policyReport) Apply a veraPDF policy expressed as schematron to a veraPDF report.static voidapplyPolicy(InputStream policy, InputStream xmlReport, OutputStream policyReport, boolean isXsl) Apply a veraPDF policy expressed as schematron to a veraPDF report.static voidinsertPolicyReport(File policyReport, File mrrReport, OutputStream mergedReport) Adds a policy report to a veraPDF machine readable report instance, effectively a merge carried out by an XSLT transform.static booleanisAllowedExtension(String ext) Check if an extenstion is an allowed policy file extensionstatic booleanisFilenameAllowedExtension(String filename) Check if a filename has an allowed policy file extension
-
Field Details
-
SCHEMA_EXT
- See Also:
-
XSL_EXT
- See Also:
-
XSLT_EXT
- See Also:
-
allowedExtensions
AListof allowed extensions for the passed schmeatron rules. These can be:- .sch which is a raw, uncompiled schematron file which will be compiled to the appropriate XSL by the policy checker.
- .xsl which is a pre-compiled schematron represented as an XSLT file.
- .xslt the longer form of the .xsl extension, again a pre-compiled schematron file.
-
-
Method Details
-
insertPolicyReport
public static void insertPolicyReport(File policyReport, File mrrReport, OutputStream mergedReport) throws VeraPDFException Adds a policy report to a veraPDF machine readable report instance, effectively a merge carried out by an XSLT transform.- Parameters:
policyReport- the XML policy reportFileto add to the machine readable report.mrrReport- the XML machine readable reportFileto add the policy report tomergedReport- andOutputStreamdestination for the merged report.- Throws:
VeraPDFException- when there's an error merging the reports.
-
applyPolicy
public static void applyPolicy(File policy, InputStream xmlReport, OutputStream policyReport) throws VeraPDFException Apply a veraPDF policy expressed as schematron to a veraPDF report. Note that the schematron can be a "raw" schematron file- Parameters:
policy- aFilethat is either a raw schematron file (.sch extenstion) or pre-compiled schematron file (.xsl or .xslt extenstion), seeallowedExtensionsxmlReport- anInputStreamfor the veraPDF XML report to apply policy topolicyReport- anOutputStreamto which the ouptut policy file will be written- Throws:
VeraPDFException- when there's a problem applying the policy schematron rules.
-
isFilenameAllowedExtension
Check if a filename has an allowed policy file extension- Parameters:
filename- the filename to check- Returns:
- true if the filename has a recognised policy extension
-
isAllowedExtension
Check if an extenstion is an allowed policy file extension- Parameters:
ext- the extension to check- Returns:
- true if the extension is a recognised policy extension
-
applyPolicy
public static void applyPolicy(InputStream policy, InputStream xmlReport, OutputStream policyReport, boolean isXsl) throws VeraPDFException Apply a veraPDF policy expressed as schematron to a veraPDF report. Note that the schematron can be a "raw" schematron file- Parameters:
policy- anInputStreamfor either raw schematron or pre-compiled schematron XSL.xmlReport- anInputStreamfor the veraPDF XML report to apply policy topolicyReport- anOutputStreamto which the ouptut policy file will be writtenisXsl- settrueif thepolicystream is a pre-compiled XSL policy document, false if it's a raw Schematron document.- Throws:
VeraPDFException- when there's a problem applying the policy schematron rules.
-