|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.hul.ois.jhove.JhoveBase
public class JhoveBase
The JHOVE engine, providing all base services necessary to build an application. More than one JhoveBase may be instantiated and process files in concurrent threads. Any one instance must not be multithreaded.
Field Summary | |
---|---|
protected boolean |
_abort
Flag for aborting activity. |
protected int |
_bufferSize
Buffer size for buffered I/O. |
protected boolean |
_checksum
|
protected java.lang.String |
_configFile
Configuration file pathname. |
protected java.net.URLConnection |
_conn
Current URL connection. |
protected java.lang.Thread |
_currentThread
Thread currently parsing a document. |
protected java.lang.String |
_encoding
Selected encoding. |
protected java.util.Map<java.lang.String,java.lang.String> |
_extensions
Associate map of configution extensions. |
protected java.util.List<OutputHandler> |
_handlerList
Ordered list of output handlers. |
protected java.util.Map<java.lang.String,OutputHandler> |
_handlerMap
Map of output handlers (for fast access by name). |
protected java.lang.String |
_jhoveHome
JHOVE home directory. |
protected java.util.logging.Logger |
_logger
Logger for this class. |
protected java.lang.String |
_logLevel
Logger resource bundle. |
protected java.lang.String |
_mixVsn
MIX version. |
protected java.util.List<Module> |
_moduleList
Ordered list of modules. |
protected java.util.Map<java.lang.String,Module> |
_moduleMap
Map of modules (for fast access by name). |
static java.lang.String |
_name
|
protected long |
_nByte
Byte count for digital object |
protected java.lang.String |
_outputFile
|
static java.lang.String |
_release
|
protected java.io.File |
_saveDir
Directory for saving files. |
protected java.lang.String |
_saxClass
SAX parser class. |
protected boolean |
_showRaw
|
protected int |
_sigBytes
Number of bytes for fake signature checking. |
protected boolean |
_signature
|
protected java.lang.String |
_tempDir
Temporary directory. |
static int[] |
DATE
|
Constructor Summary | |
---|---|
JhoveBase()
Instantiate a JhoveBase object. |
Method Summary | |
---|---|
void |
abort()
Aborts an activity. |
java.io.File |
connToTempFile(java.net.URLConnection conn,
RepInfo info)
Saves a URLConnection's data stream to a temporary file. |
void |
dispatch(App app,
Module module,
OutputHandler aboutHandler,
OutputHandler handler,
java.lang.String outputFile,
java.lang.String[] dirFileOrUri)
Processes a file or directory, or outputs information. |
boolean |
getAbort()
Returns the abort flag. |
int |
getBufferSize()
Returns buffer size. |
boolean |
getChecksumFlag()
Returns true if checksumming is requested. |
java.lang.String |
getConfigFile()
Returns the configuration file. |
static java.lang.String |
getConfigFileFromProperties()
Uses the user.home property to locate the configuration file. |
java.util.Date |
getDate()
Returns the engine date (the date at which this instance was created). |
java.lang.String |
getEncoding()
Returns the output encoding. |
java.util.Map<java.lang.String,java.lang.String> |
getExtension()
Return the JHOVE configuration extensions. |
java.lang.String |
getExtension(java.lang.String name)
Return the JHOVE configuration extension by name. |
static java.lang.String |
getFromProperties(java.lang.String name)
Returns a named value from the properties file. |
OutputHandler |
getHandler(java.lang.String name)
Return a handler by name. |
java.util.List<OutputHandler> |
getHandlerList()
Returns the list of handlers. |
java.util.Map<java.lang.String,OutputHandler> |
getHandlerMap()
Returns map of handler names to handlers. |
java.lang.String |
getJhoveHome()
Returns the JHOVE home directory. |
java.lang.String |
getMixVersion()
Returns the requested MIX schema version. |
Module |
getModule(java.lang.String name)
Returns a module by name. |
java.util.List |
getModuleList()
Returns the List of modules. |
java.util.Map |
getModuleMap()
Returns the Map of module names to modules. |
java.lang.String |
getName()
Returns the engine name. |
java.lang.String |
getOuputFile()
Returns the output file. |
java.lang.String |
getRelease()
Returns the engine release. |
java.lang.String |
getRights()
Return the engine rights statement |
java.io.File |
getSaveDirectory()
Return the directory designated for saving files. |
java.lang.String |
getSaxClass()
Return the SAX class. |
static java.lang.String |
getSaxClassFromProperties()
Returns the value of the property edu.harvard.hul.ois.jhove.saxClass ,
which should be the name of the main SAX class. |
boolean |
getShowRawFlag()
Returns true if raw output is requested. |
int |
getSigBytes()
Return the maximum number of bytes to check, for modules that look for an indefinitely positioned signature or check the first sigBytes bytes in lieu of a signature |
boolean |
getSignatureFlag()
Returns the "check signature only" flag. |
java.lang.String |
getTempDirectory()
Return the temporary directory. |
void |
init(java.lang.String configFile,
java.lang.String saxClass)
Initialize the JHOVE engine. |
protected static java.io.PrintWriter |
makeWriter(java.lang.String outputFile,
java.lang.String encoding)
Creates an output PrintWriter. |
java.io.File |
newTempFile()
Creates a temporary file with a unique name. |
boolean |
process(App app,
Module module,
OutputHandler handler,
java.lang.String dirFileOrUri)
|
boolean |
processFile(App app,
Module module,
boolean verbose,
java.io.File file,
RepInfo info)
|
void |
resetAbort()
Resets the abort flag. |
void |
setBufferSize(int bufferSize)
Sets the buffer size. |
void |
setCallback(Callback callback)
Sets a callback object for tracking progress. |
void |
setChecksumFlag(boolean checksum)
Sets the value to be returned by doChecksum() . |
void |
setCurrentThread(java.lang.Thread t)
Sets the current thread for parsing. |
void |
setEncoding(java.lang.String encoding)
Sets the output encoding. |
void |
setLogLevel(java.lang.String level)
Sets the log level. |
void |
setSaveDirectory(java.io.File dir)
Sets the default directory for subsequent save operations. |
void |
setShowRawFlag(boolean raw)
Sets the value to be returned by getShowRawFlag () ,
which determines if only raw numeric values should be output. |
void |
setSignatureFlag(boolean signature)
Sets the "check signature only" flag. |
void |
setTempDirectory(java.lang.String tempDir)
Sets the temporary directory path. |
java.io.File |
tempFile()
Creates a temporary file with a unique name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String _name
public static final java.lang.String _release
public static final int[] DATE
protected boolean _abort
protected int _bufferSize
protected boolean _checksum
protected java.lang.String _configFile
protected java.lang.String _encoding
protected java.util.Map<java.lang.String,java.lang.String> _extensions
protected java.util.List<OutputHandler> _handlerList
protected java.util.Map<java.lang.String,OutputHandler> _handlerMap
protected java.lang.String _jhoveHome
protected java.util.List<Module> _moduleList
protected java.util.Map<java.lang.String,Module> _moduleMap
protected java.lang.String _outputFile
protected java.lang.String _saxClass
protected boolean _showRaw
protected boolean _signature
protected java.lang.String _tempDir
protected java.lang.String _mixVsn
protected int _sigBytes
protected java.io.File _saveDir
protected long _nByte
protected java.net.URLConnection _conn
protected java.lang.Thread _currentThread
protected java.util.logging.Logger _logger
protected java.lang.String _logLevel
Constructor Detail |
---|
public JhoveBase() throws JhoveException
JhoveException
- If invoked with JVM lower than 1.5Method Detail |
---|
public void init(java.lang.String configFile, java.lang.String saxClass) throws JhoveException
configFile
- Configuration file pathname
JhoveException
public void setCallback(Callback callback)
public void dispatch(App app, Module module, OutputHandler aboutHandler, OutputHandler handler, java.lang.String outputFile, java.lang.String[] dirFileOrUri) throws java.lang.Exception
dirFileOrUri
is null, Does one of the following:
aboutHandler
is non-null,
provides information about that handler.
app
- The App object for the applicationmodule
- The module to be usedaboutHandler
- If specified, the handler about which info is requestedhandler
- The handler for processing the outputoutputFile
- Name of the file to which output should godirFileOrUri
- One or more file names or URI's to be analyzed
java.lang.Exception
public boolean process(App app, Module module, OutputHandler handler, java.lang.String dirFileOrUri) throws java.lang.Exception
java.lang.Exception
public java.io.File connToTempFile(java.net.URLConnection conn, RepInfo info) throws java.io.IOException
abort ()
, in which case it will delete
the temporary file and return null
.
java.io.IOException
public void abort()
public boolean processFile(App app, Module module, boolean verbose, java.io.File file, RepInfo info) throws java.lang.Exception
java.lang.Exception
public java.io.File tempFile() throws java.io.IOException
java.io.IOException
public boolean getAbort()
public int getBufferSize()
public java.lang.String getConfigFile()
public java.util.Date getDate()
public java.lang.String getEncoding()
public java.util.Map<java.lang.String,java.lang.String> getExtension()
public java.lang.String getExtension(java.lang.String name)
public OutputHandler getHandler(java.lang.String name)
public java.util.Map<java.lang.String,OutputHandler> getHandlerMap()
public java.util.List<OutputHandler> getHandlerList()
public java.lang.String getJhoveHome()
public Module getModule(java.lang.String name)
public java.util.Map getModuleMap()
public java.util.List getModuleList()
public java.lang.String getName()
public java.lang.String getOuputFile()
public java.lang.String getRelease()
public java.lang.String getRights()
public java.lang.String getSaxClass()
public java.lang.String getTempDirectory()
public int getSigBytes()
public java.io.File getSaveDirectory()
public boolean getChecksumFlag()
true
if checksumming is requested.
public boolean getShowRawFlag()
true
if raw output is requested.
Raw output means numeric rather than symbolic output;
its exact interpretation is up to the module, but generally
applies to named flags.
public boolean getSignatureFlag()
public java.lang.String getMixVersion()
public void setBufferSize(int bufferSize)
public void setEncoding(java.lang.String encoding)
public void setTempDirectory(java.lang.String tempDir)
public void setLogLevel(java.lang.String level)
public void setChecksumFlag(boolean checksum)
doChecksum()
.
public void setShowRawFlag(boolean raw)
getShowRawFlag ()
,
which determines if only raw numeric values should be output.
public void setSignatureFlag(boolean signature)
public void setSaveDirectory(java.io.File dir)
public void setCurrentThread(java.lang.Thread t)
public void resetAbort()
public static java.lang.String getConfigFileFromProperties()
jhove.conf
. Returns null
if no such file is found.
public static java.lang.String getSaxClassFromProperties()
edu.harvard.hul.ois.jhove.saxClass
,
which should be the name of the main SAX class.
Returns null
if no such property
has been set up.
public static java.lang.String getFromProperties(java.lang.String name)
protected static java.io.PrintWriter makeWriter(java.lang.String outputFile, java.lang.String encoding) throws JhoveException
outputFile
- Output filepath. If null, writer goes to System.out.encoding
- Character encoding. Must not be null.
JhoveException
public java.io.File newTempFile() throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |