fedora.server.validation
Class DOValidatorSchematron

java.lang.Object
  extended byfedora.server.validation.DOValidatorSchematron

public class DOValidatorSchematron
extends java.lang.Object

Title: DOValidatorSchematron.java

Description: Schematron validation for fedora objects encoded in schematron schema for Fedora. The schematron schema (metsExtRules1-0.xml) expresses a set of rules using XPATH that enable us to check for things that are either not expressed in the METS XML schema, or that cannot be expressed with XML Schema language. Generally we will look for things that are requirements of Fedora objects, which are not requirements for METS objects in general.

-----------------------------------------------------------------------------

License and Copyright: The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/.

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The entire file consists of original code. Copyright © 2002-2005 by The Rector and Visitors of the University of Virginia and Cornell University. All rights reserved.

-----------------------------------------------------------------------------

Version:
$Id: DOValidatorSchematron.java,v 1.17 2005/01/11 20:06:09 cwilper Exp $
Author:
payette@cs.cornell.edu

Constructor Summary
DOValidatorSchematron(java.lang.String schemaPath, java.lang.String preprocessorPath, java.lang.String phase)
          Constructs a DOValidatorSchematron instance with a Schematron preprocessor that is provided by the calling class.
 
Method Summary
static javax.xml.transform.stream.StreamSource fileToStreamSource(java.io.File file)
           
static javax.xml.transform.stream.StreamSource fileToStreamSource(java.lang.String str)
          Generates a StreamSource from a file name.
 void validate(java.io.File objectAsFile)
          Run the Schematron validation on a Fedora object.
 void validate(java.io.InputStream objectAsStream)
          Run the Schematron validation on a Fedora object.
 void validate(javax.xml.transform.stream.StreamSource objectSource)
          Run the Schematron validation on a Fedora object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOValidatorSchematron

public DOValidatorSchematron(java.lang.String schemaPath,
                             java.lang.String preprocessorPath,
                             java.lang.String phase)
                      throws ObjectValidityException
Constructs a DOValidatorSchematron instance with a Schematron preprocessor that is provided by the calling class. This will allow the DOValidator module to pass in the preprocessor that is configured with the Fedora repository.

Parameters:
schemaPath - the URL of the Schematron schema
preprocessorPath - the location of the Schematron preprocessor
phase - the phase in the fedora object lifecycle to which validation should pertain. (Currently options are "ingest" and "store"
Throws:
ObjectValidityException
Method Detail

validate

public void validate(java.io.File objectAsFile)
              throws ServerException
Run the Schematron validation on a Fedora object.

Parameters:
objectAsFile - the Fedora object as a File
Throws:
ServerException

validate

public void validate(java.io.InputStream objectAsStream)
              throws ServerException
Run the Schematron validation on a Fedora object.

Parameters:
objectAsStream - the Fedora object as an Inputstream
Throws:
ServerException

validate

public void validate(javax.xml.transform.stream.StreamSource objectSource)
              throws ServerException
Run the Schematron validation on a Fedora object.

Parameters:
objectSource - the Fedora object as an StreamSource
Throws:
ServerException

fileToStreamSource

public static javax.xml.transform.stream.StreamSource fileToStreamSource(java.lang.String str)
Generates a StreamSource from a file name.


fileToStreamSource

public static javax.xml.transform.stream.StreamSource fileToStreamSource(java.io.File file)