org.cip4.jdflib.validate
Class JDFValidator

java.lang.Object
  extended by org.cip4.jdflib.validate.JDFValidator

public class JDFValidator
extends Object

this is the non-commandline part of the original checkJDF and used both by the JDF Editor and checkJDF Refactored JDFValidator to be non-static in order to make it thread compatible. Previously, only one thread at a time could call JDFValidator from within the same JVM. Now an instance of JDFValidator and the the method validate should be called. JDFValidator can still be called from the command line in the same way as before. TODO Break out validation error handling logging so that new error handlers can easily be registered. For example, there should be an error handler for logging to the XML log file and an error handler for logging to the sysOut. Perhaps org.xml.sax.ErrorHandler could be used?

Version:
2008-01-02
Author:
Claes Buckwalter (clabu@itn.liu.se)

Nested Class Summary
protected static class JDFValidator.MySysOut
          This is just a quick and dirty class to centrally switch print on and off
 
Field Summary
 VString allFiles
           
 boolean bMultiID
           
protected  boolean bPrintNameSpace
           
 boolean bQuiet
           
 boolean bTiming
           
 boolean bValidate
           
 boolean bWarnDanglingURL
          if true, warn on URL attributes that point to Nirvana
protected  boolean bWarning
           
 String devCapFile
           
 JDFElement.EnumValidationLevel level
           
protected  XMLDoc pOut
           
 String proxyHost
           
 String proxyPort
           
 String schemaLocation
           
protected  JDFValidator.MySysOut sysOut
           
 JDFBaseDataTypes.EnumFitsValue testlists
           
protected  String translation
           
 VString vBadID
           
protected static String version
           
 VString vMultiID
           
 String xmlOutputName
           
 String xslStyleSheet
           
 
Constructor Summary
JDFValidator()
           
 
Method Summary
 void addFile(String xmlFile)
           
 boolean isBWarning()
           
 boolean isValid(JDFDoc doc)
          process a single document as specified by doc if doc==null, reprocess the currently stored document
 XMLDoc processAllFiles()
          processes all files that have been placed into the public VString member JDFValidator.allFiles
 XMLDoc processMimeStream(InputStream inStream)
          process a mime file
 XMLDoc processSingleDocument(JDFDoc doc)
          process a single document as specified by doc if doc==null, reprocess the currently stored document
 XMLDoc processSingleFile(InputStream inStream, String url, String xmlFile)
          Deprecated. - use either processSingleDoc, processSingleStream or processSinglFile(String) this will be made private
protected  XMLDoc processSingleFile(InputStream inStream, String url, String xmlFile, javax.mail.BodyPart bp)
          processes a single file
 XMLDoc processSingleFile(String fileName)
          process a single file document as specified by fileName
 XMLDoc processSingleStream(InputStream stream, String fileName, javax.mail.BodyPart bp)
          process a single document as specified by doc
 XMLDoc processSingleURLStream(InputStream stream, String url)
          process a single document as specified by doc
 XMLDoc processZipFile(File argFile)
          we may want to create something similar for a zip stream
protected  void setAllFiles(MyArgs args)
           
 void setDoc(JDFDoc d)
          set the JDFDoc (JDF or JMF) to set
 void setIgnorePrivate(boolean bIgnore)
          if bI
 void setJDFSchemaLocation(File _schemaLocation)
           
 void setJDFSchemaLocation(String _schemaLocation)
          Deprecated. use setJDFSchemaLocation(File)
 void setPrint(boolean b)
          sets the System.out print on or off
 void setValidatorFactory(ICheckValidatorFactory pvalidatorFactory)
           
 void setWarning(boolean warning)
           
static String toMessageString(KElement checkOut)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vBadID

public VString vBadID

vMultiID

public VString vMultiID

pOut

protected XMLDoc pOut

translation

protected String translation

bTiming

public boolean bTiming

bWarning

protected boolean bWarning

bQuiet

public boolean bQuiet

bPrintNameSpace

protected boolean bPrintNameSpace

bValidate

public boolean bValidate

bWarnDanglingURL

public boolean bWarnDanglingURL
if true, warn on URL attributes that point to Nirvana


level

public JDFElement.EnumValidationLevel level

allFiles

public VString allFiles

proxyHost

public String proxyHost

proxyPort

public String proxyPort

schemaLocation

public String schemaLocation

xmlOutputName

public String xmlOutputName

xslStyleSheet

public String xslStyleSheet

devCapFile

public String devCapFile

testlists

public JDFBaseDataTypes.EnumFitsValue testlists

bMultiID

public boolean bMultiID

version

protected static final String version

sysOut

protected JDFValidator.MySysOut sysOut
Constructor Detail

JDFValidator

public JDFValidator()
Method Detail

toMessageString

public static String toMessageString(KElement checkOut)
Parameters:
checkOut -
Returns:

setDoc

public void setDoc(JDFDoc d)
set the JDFDoc (JDF or JMF) to set

Parameters:
d - the JDFDoc to set this to

setIgnorePrivate

public void setIgnorePrivate(boolean bIgnore)
if bI

Parameters:
bIgnore -

setPrint

public void setPrint(boolean b)
sets the System.out print on or off

Parameters:
b -

setJDFSchemaLocation

@Deprecated
public void setJDFSchemaLocation(String _schemaLocation)
Deprecated. use setJDFSchemaLocation(File)

Parameters:
_schemaLocation -

setJDFSchemaLocation

public void setJDFSchemaLocation(File _schemaLocation)
Parameters:
_schemaLocation - the schema location

processAllFiles

public XMLDoc processAllFiles()
processes all files that have been placed into the public VString member JDFValidator.allFiles

Returns:
XMLDoc the xml output document

processZipFile

public XMLDoc processZipFile(File argFile)
we may want to create something similar for a zip stream

Parameters:
argFile -
Returns:
XMLDoc the output file

processMimeStream

public XMLDoc processMimeStream(InputStream inStream)
process a mime file

Parameters:
argFile -
Returns:

processSingleDocument

public XMLDoc processSingleDocument(JDFDoc doc)
process a single document as specified by doc if doc==null, reprocess the currently stored document

Parameters:
doc - the parsed document to process
Returns:
the xml output of the validation

isValid

public boolean isValid(JDFDoc doc)
process a single document as specified by doc if doc==null, reprocess the currently stored document

Parameters:
doc - the parsed document to process
Returns:
the xml output of the validation

processSingleURLStream

public XMLDoc processSingleURLStream(InputStream stream,
                                     String url)
process a single document as specified by doc

Parameters:
stream - the input stream
url - the url that the stream is sent to
Returns:
the xml output of the validation

processSingleStream

public XMLDoc processSingleStream(InputStream stream,
                                  String fileName,
                                  javax.mail.BodyPart bp)
process a single document as specified by doc

Parameters:
stream - the input stream
fileName - the fileName that the stream originated from
bp -
Returns:
the xml output of the validation

processSingleFile

public XMLDoc processSingleFile(String fileName)
process a single file document as specified by fileName

Parameters:
fileName - the path of the file to parse and validate
Returns:
the xml output of the validation

processSingleFile

@Deprecated
public XMLDoc processSingleFile(InputStream inStream,
                                           String url,
                                           String xmlFile)
Deprecated. - use either processSingleDoc, processSingleStream or processSinglFile(String) this will be made private

processes a single file

Parameters:
inStream -
url -
xmlFile -
Returns:

processSingleFile

protected XMLDoc processSingleFile(InputStream inStream,
                                   String url,
                                   String xmlFile,
                                   javax.mail.BodyPart bp)
processes a single file

Parameters:
inStream -
url -
xmlFile -
Returns:

setAllFiles

protected void setAllFiles(MyArgs args)

addFile

public void addFile(String xmlFile)

isBWarning

public boolean isBWarning()
Returns:
the bWarning

setWarning

public void setWarning(boolean warning)
Parameters:
warning - the bWarning to set

setValidatorFactory

public void setValidatorFactory(ICheckValidatorFactory pvalidatorFactory)
Parameters:
validatorFactory - the validatorFactory to set


Copyright © 2013. All Rights Reserved.