Package edu.harvard.hul.ois.jhove
Class ConfigHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
edu.harvard.hul.ois.jhove.ConfigHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
SAX Parser for the configuration file.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBufferThe list of handler parameters.protected booleanprotected booleanprotected booleanThe list of module parameters.protected List<ModuleInfo>The list of modules. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) SAX parser callback method.voidendElement(String namespaceURI, String localName, String rawName) SAX parser callback method.intReturns the buffer size specified in the config file.Returns the character encoding specified by the config file.Returns the List of OutputHandlers specified by the config file.Returns the List of handler parameters specified by the config file.Returns the path to the application's home directory, with final path separator.Returns the name of the desired log level.Returns the MIX schema version specified by the config file.Returns the List of Modules specified by the config file.Returns the List of module parameters specified by the config file.intReturns 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.Returns the temporary directory path specified by the config file, with final path separator.resolveEntity(String publicId, String systemId) EntityResolver designed to locate the config schema.voidstartElement(String namespaceURI, String localName, String rawName, Attributes atts) SAX parser callback method.Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
_content
-
_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
The list of modules. Each element in the List is an array of two Strings representing the class and the initialization 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
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
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 bygetModuleParams()are in one-to-one correspondence with those return bygetModule(). -
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 bygetHandlerParams()are in one-to-one correspondence with those return bygetHandler(). -
getHandler
Returns the List of OutputHandlers specified by the config file.- See Also:
-
getTempDir
Returns the temporary directory path specified by the config file, with final path separator. -
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
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
Returns the path to the application's home directory, with final path separator. -
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
- Returns:
- a language code if set
-
startElement
SAX parser callback method.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler
-
characters
public void characters(char[] ch, int start, int length) SAX parser callback method.- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
endElement
SAX parser callback method.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler
-
resolveEntity
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:
resolveEntityin interfaceEntityResolver- Overrides:
resolveEntityin classDefaultHandler- Throws:
SAXExceptionIOException
-