Class ConfigHandler

java.lang.Object
org.xml.sax.helpers.DefaultHandler
edu.harvard.hul.ois.jhove.ConfigHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class ConfigHandler extends DefaultHandler
SAX Parser for the configuration file.
  • Field Details

    • _content

      protected StringBuffer _content
    • _handlerParams

      protected List<List<String>> _handlerParams
      The list of handler parameters. Each element in the List is a List of Strings (which may be empty but not null) representing parameters to be passed to the module. List elements are in one-to-one correspondence with _handler.
    • _isHandler

      protected boolean _isHandler
    • _isLanguage

      protected boolean _isLanguage
    • _isModule

      protected boolean _isModule
    • _module

      protected List<ModuleInfo> _module
      The list of modules. Each element in the List is an array of two Strings representing the class and the initialization string.
    • _modParams

      protected List<List<String>> _modParams
      The list of module parameters. Each element in the List is a List of Strings (which may be empty but not null) representing parameters to be passed to the module. List elements are in one-to-one correspondence with _module.
  • Constructor Details

    • ConfigHandler

      public ConfigHandler()
      Creates a ConfigHandler.
  • Method Details

    • getModule

      public List<ModuleInfo> getModule()
      Returns the List of Modules specified by the config file. Each element of the List is a String[2] whose elements are the module class name and initialization value.
      See Also:
    • getModuleParams

      public List<List<String>> getModuleParams()
      Returns the List of module parameters specified by the config file. Each element of the List is a List (possibly empty) of Strings whose elements are parameters to pass to the module. The values returned by getModuleParams() are in one-to-one correspondence with those return by getModule().
    • getHandlerParams

      public List<List<String>> getHandlerParams()
      Returns the List of handler parameters specified by the config file. Each element of the List is a List (possibly empty) of Strings whose elements are parameters to pass to the output handler. The values returned by getHandlerParams() are in one-to-one correspondence with those return by getHandler().
    • getHandler

      public List<String[]> getHandler()
      Returns the List of OutputHandlers specified by the config file.
      See Also:
    • getTempDir

      public String getTempDir()
      Returns the temporary directory path specified by the config file, with final path separator.
    • getMixVsn

      public String getMixVsn()
      Returns the MIX schema version specified by the config file. Acceptable values are "0.2" and "1.0" and "2.0".
    • getSigBytes

      public int getSigBytes()
      Returns the number of bytes to examine when looking for an indefinitely positioned signature, or checking the first sigBytes bytes of a file in lieu of a signature.
    • getEncoding

      public String getEncoding()
      Returns the character encoding specified by the config file.
    • getBufferSize

      public int getBufferSize()
      Returns the buffer size specified in the config file.
      Returns:
      the buffer size, or -1 if none specified
    • getJhoveHome

      public String getJhoveHome()
      Returns the path to the application's home directory, with final path separator.
    • getLogLevel

      public String getLogLevel()
      Returns the name of the desired log level. This should be the name of one of the predefined values of java.util.logging.Level, e.g., "WARNING", "INFO", "ALL". The default level is SEVERE.
    • getLanguage

      public String getLanguage()
      Returns:
      a language code if set
    • startElement

      public void startElement(String namespaceURI, String localName, String rawName, Attributes atts)
      SAX parser callback method.
      Specified by:
      startElement in interface ContentHandler
      Overrides:
      startElement in class DefaultHandler
    • characters

      public void characters(char[] ch, int start, int length)
      SAX parser callback method.
      Specified by:
      characters in interface ContentHandler
      Overrides:
      characters in class DefaultHandler
    • endElement

      public void endElement(String namespaceURI, String localName, String rawName)
      SAX parser callback method.
      Specified by:
      endElement in interface ContentHandler
      Overrides:
      endElement in class DefaultHandler
    • resolveEntity

      public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
      EntityResolver designed to locate the config schema. It tries to find it as a local resource. It appears that not all SAX implementations will actually call this function for schema resolution, so this isn't a guarantee that the schema in the config file won't be called directly. But hopefully it will cut down on the burden on the server with the official schema copy.
      Specified by:
      resolveEntity in interface EntityResolver
      Overrides:
      resolveEntity in class DefaultHandler
      Throws:
      SAXException
      IOException