org.fcrepo.server.validation
Class DOValidatorImpl

java.lang.Object
  extended by org.fcrepo.server.validation.DOValidatorImpl
All Implemented Interfaces:
DOValidator

public class DOValidatorImpl
extends Object
implements DOValidator

The implementation of the digital object validation module (see DOValidator.class and DOValidatorModule.class). The validator operates on digital object XML files encoded in one of the Fedora-supported encoding formats (i.e., FOXML, Fedora METS, and possibly others in the future). The following types of validation can be run:

   0=VALDIATE_ALL : All validation will be done.
   1=VALIDATE_XML_SCHEMA : the digital object will be validated against
                 the the appropriate XML Schema. An ObjectValidityException
                 will be thrown if the object fails the schema test.
   2=VALIDATE_SCHEMATRON : the digital object will be validated
                 against a set of rules expressed by a Schematron schema.
                 These rules are beyond what can be expressed in XML Schema.
                 The Schematron schema expresses rules for different phases
                 of the object. There are rules appropriate to a digital
                 object when it is first ingested into the repository
                 (ingest phase). There are additional rules that must be met
                 before a digital object is considered valid for permanent
                 storage in the repository (completed phase). These rules
                 pertain to aspects of the object that are system assigned,
                 such as created dates and state codes.
                 An ObjectValidityException will be thrown if the object fails
                 the Fedora rules test.
 

Version:
$Id$
Author:
Sandy Payette

Field Summary
protected static boolean debug
           
protected static String schematronPreprocessorPath
          Configuration variable: schematronPreprocessorPath is the Schematron stylesheet that is used to transform a Schematron schema into a validating stylesheet based on the rules in the schema.
protected static String schematronSchemaPath
          Configuration variable: schematronSchemaPath is the Schematron schema that expresses Fedora-specific validation rules.
protected static String tempDir
          Configuration variable: tempdir is a working area for validation
protected static String xmlSchemaPath
          Configuration variable: xmlSchemaPath is the location of the XML Schema.
 
Fields inherited from interface org.fcrepo.server.validation.DOValidator
PHASE_INGEST, PHASE_STORE, VALIDATE_ALL, VALIDATE_NONE, VALIDATE_SCHEMATRON, VALIDATE_XML_SCHEMA
 
Constructor Summary
DOValidatorImpl(String tempDir, Map<String,String> xmlSchemaMap, String schematronPreprocessorPath, Map<String,String> ruleSchemaMap)
           Constructs a new DOValidatorImpl to support all forms of digital object validation, using specified values for configuration values.
 
Method Summary
 void validate(File objectAsFile, String format, int validationType, String phase)
           Validates a digital object.
 void validate(InputStream objectAsStream, String format, int validationType, String phase)
           Validates a digital object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected static boolean debug

tempDir

protected static String tempDir
Configuration variable: tempdir is a working area for validation


xmlSchemaPath

protected static String xmlSchemaPath
Configuration variable: xmlSchemaPath is the location of the XML Schema.


schematronPreprocessorPath

protected static String schematronPreprocessorPath
Configuration variable: schematronPreprocessorPath is the Schematron stylesheet that is used to transform a Schematron schema into a validating stylesheet based on the rules in the schema.


schematronSchemaPath

protected static String schematronSchemaPath
Configuration variable: schematronSchemaPath is the Schematron schema that expresses Fedora-specific validation rules. It is transformed into a validating stylesheet by the Schematron preprocessing stylesheet.

Constructor Detail

DOValidatorImpl

public DOValidatorImpl(String tempDir,
                       Map<String,String> xmlSchemaMap,
                       String schematronPreprocessorPath,
                       Map<String,String> ruleSchemaMap)
                throws ServerException

Constructs a new DOValidatorImpl to support all forms of digital object validation, using specified values for configuration values.

Any parameter may be given as null, in which case the default value is assumed.

Parameters:
tempDir - Working area for validation, default is temp/
xmlSchemaMap - Location of XML Schemas (W3 Schema) configured with Fedora (see Fedora.fcfg). Current options are xsd/foxml1-1.xsd for FOXML or xsd/mets-fedora-ext1-1.xsd for METS (Fedora extension)
schematronPreprocessorPath - Location of the Schematron pre-processing stylesheet configured with Fedora.
ruleSchemaMap - Location of rule schemas (Schematron), configured with Fedora (see Fedora.fcfg). Current options are schematron/foxmlRules1-0.xml for FOXML or schematron/metsExtRules1-0.xml for METS
Throws:
ServerException - If construction fails for any reason.
Method Detail

validate

public void validate(InputStream objectAsStream,
                     String format,
                     int validationType,
                     String phase)
              throws ObjectValidityException

Validates a digital object.

Specified by:
validate in interface DOValidator
Parameters:
objectAsStream - The digital object provided as a stream.
format - The format URI of the object serialization.
validationType - The level of validation to perform on the digital object. This is an integer from 0-2 with the following meanings: 0 = VALIDATE_ALL (do all validation levels) 1 = VALIDATE_XML_SCHEMA (perform only XML Schema validation) 2 = VALIDATE_SCHEMATRON (perform only Schematron Rules validation)
phase - The stage in the workflow for which the validation should be contextualized. "ingest" = the object is encoded for ingest into the repository "store" = the object is encoded with all final assignments so that it is appropriate for storage as the authoritative serialization of the object.
Throws:
ObjectValidityException - If validation fails for any reason.
GeneralException - If validation fails for any reason.

validate

public void validate(File objectAsFile,
                     String format,
                     int validationType,
                     String phase)
              throws ObjectValidityException,
                     GeneralException

Validates a digital object.

Specified by:
validate in interface DOValidator
Parameters:
objectAsFile - The digital object provided as a file.
validationType - The level of validation to perform on the digital object. This is an integer from 0-2 with the following meanings: 0 = VALIDATE_ALL (do all validation levels) 1 = VALIDATE_XML_SCHEMA (perform only XML Schema validation) 2 = VALIDATE_SCHEMATRON (perform only Schematron Rules validation)
phase - The stage in the work flow for which the validation should be contextualized. "ingest" = the object is in the submission format for the ingest phase "store" = the object is in the authoritative format for the final storage phase
Throws:
ObjectValidityException - If validation fails for any reason.
GeneralException - If validation fails for any reason.


Copyright © 2012 DuraSpace. All Rights Reserved.