| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.harvard.hul.ois.jhove.HandlerBase
public abstract class HandlerBase
Abstract base class for Jhove output handlers. Output handlers should normally subclass HandlerBase.
| Nested Class Summary | |
|---|---|
| static class | HandlerBase.SynchronizedDateFormatA DateFormat class to address an issue of thread safety. | 
| Field Summary | |
|---|---|
| protected  App | _appThe application object | 
| protected  JhoveBase | _baseThe Jhove engine | 
| protected  java.util.Date | _dateHandler last modification date | 
| protected  java.util.List<java.lang.String> | _defaultParamsList of default parameters. | 
| protected  java.lang.String | _encodingCharacter encoding for writer | 
| protected  java.lang.String | _initInitialization value. | 
| protected  JhoveBase | _jeJHOVE engine. | 
| protected  int | _levelIndentation level | 
| protected  java.util.logging.Logger | _loggerLogger for a handler class. | 
| protected  java.lang.String | _nameHandler name | 
| protected  java.lang.String | _noteHandler note | 
| protected  java.lang.String | _paramHandler-specific parameter. | 
| protected  java.lang.String | _releaseHandler release description. | 
| protected  java.lang.String | _rightsCopyright notice | 
| protected  java.util.List<Document> | _specificationHandler specification document list | 
| protected  Agent | _vendorHandler vendor | 
| protected  java.io.PrintWriter | _writerWriter for doing output | 
| static HandlerBase.SynchronizedDateFormat | dateA DateFormat for representing a Date in yyyy-MM-dd (e.g., 2003-07-31) format. | 
| static HandlerBase.SynchronizedDateFormat | dateTimeA DateFormat for representing a Date in yyyy-MM-dd HH:mm:ss z (e.g., 2003-07-31 15:31:12 EDT) format. | 
| static HandlerBase.SynchronizedDateFormat | iso8601A DateFormat for representing a Date in ISO 8601 (e.g., 2003-07-31T15:31:12-0400) format. | 
| Constructor Summary | |
|---|---|
| protected  | HandlerBase(java.lang.String name,
            java.lang.String release,
            int[] date,
            java.lang.String note,
            java.lang.String rights)Constructors of all subclasses of HandlerBase should call this as a superconstructor. | 
| Method Summary | |
|---|---|
|  void | analyze(RepInfo info)Callback allowing post-parse, pre-show analysis of object representation information. | 
|  void | applyDefaultParams()Applies the default parameters. | 
|  void | close()Close the writer after all output has been done. | 
| protected static java.lang.String | doctype(java.lang.String root,
        java.lang.String uri)Return the XML DOCTYPE instruction. | 
| protected static java.lang.String | doctype(java.lang.String root,
        java.lang.String name,
        java.lang.String uri)Return the XML DOCTYPE instruction. | 
| protected static java.lang.String | doubleArray(double[] darray)Return String representation of an array of double. | 
| protected static java.lang.String | element(java.lang.String tag)Returns, as a String, an empty XML. | 
| protected static java.lang.String | element(java.lang.String tag,
        java.lang.String content)Returns, as a String, an XML element with a given tag and content | 
| protected static java.lang.String | element(java.lang.String tag,
        java.lang.String[][] attrs)Returns, as a String, an XML element with a given tag and attributes | 
| protected static java.lang.String | element(java.lang.String tag,
        java.lang.String[][] attrs,
        java.lang.String content)Returns, as a String, an XML element with a given tag, content and attributes | 
| protected static java.lang.String | elementEnd(java.lang.String tag)Returns, as a String, the closing tag of an element. | 
| protected static java.lang.String | elementStart(java.lang.String tag)Returns, as a String, the opening tag of an element. | 
| protected static java.lang.String | elementStart(java.lang.String tag,
             java.lang.String[][] attrs)Returns, as a String, the opening tag of an element with specified attributes. | 
|  void | endDirectory()Callback indicating a directory is finished being processed. | 
|  java.util.Date | getDate()Return the last modification date of this OutputHandler, as a Java Date object | 
|  java.lang.String | getEncoding()Returns this handler's encoding. | 
| protected static java.lang.String | getIndent(int level)Returns a String containing a number of spaces equal to the current indent level. | 
|  java.lang.String | getName()Return the OutputHandler name | 
|  java.lang.String | getNote()Return the OutputHandler note | 
|  java.lang.String | getRelease()Return the release identifier | 
|  java.lang.String | getRights()Return the copyright information string | 
|  java.util.List<Document> | getSpecification()Returns a list of Documentobjects (one for each 
  specification document). | 
|  Agent | getVendor()Return the vendor information | 
|  void | init(java.lang.String init)Per-instantiation initialization. | 
| protected static java.lang.String | integerArray(int[] iarray)Return String representation of an integer array. | 
| protected static java.lang.String | integerArray(int[] iarray,
             char separator)Return String representation of an integer array with specified separator. | 
| protected static java.lang.String | longArray(long[] larray)Return String representation of an array of long with space separator. | 
|  boolean | okToProcess(java.lang.String filepath)Callback to give the handler the opportunity to decide whether or not to process a file. | 
|  void | param(java.lang.String param)Per-action initialization. | 
| protected static java.lang.String | rationalArray(Rational[] rarray)Return String representation of an array of Rational, each evaluated as a double, with space separator. | 
| protected static java.lang.String | rationalArray10(Rational[] rarray)Return String representation of an array of Rational, each as two integers, with space separator. | 
|  void | reset()Reset the handler. | 
|  void | resetParams()Reset parameter settings. | 
|  void | setApp(App app)Pass the associated App object to this Module. | 
|  void | setBase(JhoveBase je)Assigns the JHOVE engine object to provide services to this handler | 
|  void | setDefaultParams(java.util.List<java.lang.String> params)Set a a List of default parameters for the module. | 
|  void | setEncoding(java.lang.String encoding)Assigns the encoding to be used by this OutputHandler | 
|  void | setWriter(java.io.PrintWriter writer)Assigns a PrintWriter to do output for this OutputHandler | 
| abstract  void | show()Outputs minimal information about the application | 
| abstract  void | show(App app)Outputs detailed information about the application, including configuration, available modules and handlers, etc. | 
| abstract  void | show(Module module)Outputs information about a Module | 
| abstract  void | show(OutputHandler handler)Outputs information about the OutputHandler specified in the parameter | 
| abstract  void | show(RepInfo info)Outputs the information contained in a RepInfo object | 
| abstract  void | showFooter()Do the final output. | 
| abstract  void | showHeader()Do the initial output. | 
|  void | startDirectory(java.lang.String directory)Callback indicating a new directory is being processed. | 
| protected  java.lang.String | toDateTime(java.util.Date date) | 
| protected static java.lang.String | xmlDecl()Return a canonical XML declaration with default encoding. | 
| protected static java.lang.String | xmlDecl(java.lang.String encoding)Return a canonical XML declaration with specified encoding. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static HandlerBase.SynchronizedDateFormat date
public static HandlerBase.SynchronizedDateFormat dateTime
public static HandlerBase.SynchronizedDateFormat iso8601
protected App _app
protected JhoveBase _base
protected java.util.Date _date
protected java.lang.String _encoding
protected java.lang.String _init
protected java.util.List<java.lang.String> _defaultParams
protected JhoveBase _je
protected int _level
protected java.lang.String _name
protected java.lang.String _note
protected java.lang.String _release
protected java.lang.String _param
protected java.lang.String _rights
protected java.util.List<Document> _specification
protected Agent _vendor
protected java.io.PrintWriter _writer
protected java.util.logging.Logger _logger
| Constructor Detail | 
|---|
protected HandlerBase(java.lang.String name,
                      java.lang.String release,
                      int[] date,
                      java.lang.String note,
                      java.lang.String rights)
super constructor.
name - Name of the handlerrelease - Release identifierdate - Last modification date of the handler code,
                          in the form of an array of three numbers.
                          date[0] is the year, 
                          date[1] the month, and
                          date[2] the day.note - Additional information about the handler
                          (may be null)rights - Copyright notice for the handler| Method Detail | 
|---|
public void reset()
reset in interface OutputHandlerpublic void setDefaultParams(java.util.List<java.lang.String> params)
setDefaultParams in interface OutputHandlerparams - A List whose elements are Strings.
                     May be empty.
public void applyDefaultParams()
                        throws java.lang.Exception
applyDefaultParams in interface OutputHandlerjava.lang.Exception
public void resetParams()
                 throws java.lang.Exception
resetParams in interface OutputHandlerjava.lang.Exception
public void init(java.lang.String init)
          throws java.lang.Exception
init in interface OutputHandlerinit - Initialization parameter.  This is typically obtained
                from the configuration file.
java.lang.Exception
public void param(java.lang.String param)
           throws java.lang.Exception
param in interface OutputHandlerparam - Initialization parameter.
java.lang.Exceptionpublic final java.util.Date getDate()
getDate in interface OutputHandlerpublic final java.lang.String getName()
getName in interface OutputHandlerpublic final java.lang.String getNote()
getNote in interface OutputHandlerpublic final java.lang.String getRelease()
getRelease in interface OutputHandlerpublic final java.lang.String getRights()
getRights in interface OutputHandlerpublic final java.util.List<Document> getSpecification()
Document objects (one for each 
  specification document).  The specification
  list is generated by the OutputHandler, and specifications cannot
  be added by callers.
getSpecification in interface OutputHandlerDocumentpublic final Agent getVendor()
getVendor in interface OutputHandlerpublic java.lang.String getEncoding()
getEncoding in interface OutputHandlerpublic final void setApp(App app)
setApp in interface OutputHandlerpublic final void setBase(JhoveBase je)
setBase in interface OutputHandlerpublic void setEncoding(java.lang.String encoding)
setEncoding in interface OutputHandlerpublic final void setWriter(java.io.PrintWriter writer)
setWriter in interface OutputHandlerpublic void analyze(RepInfo info)
analyze in interface OutputHandlerinfo - Object representation informationpublic void endDirectory()
endDirectory in interface OutputHandlerpublic boolean okToProcess(java.lang.String filepath)
okToProcess in interface OutputHandlerfilepath - File pathnamepublic abstract void show(Module module)
show in interface OutputHandlerpublic abstract void show(RepInfo info)
show in interface OutputHandlerpublic abstract void show(OutputHandler handler)
show in interface OutputHandlerpublic abstract void show()
show in interface OutputHandlerpublic abstract void show(App app)
show in interface OutputHandlerpublic abstract void showHeader()
showHeader in interface OutputHandlerpublic abstract void showFooter()
showFooter in interface OutputHandlerpublic void close()
close in interface OutputHandlerpublic void startDirectory(java.lang.String directory)
startDirectory in interface OutputHandlerdirectory - Directory path
protected static java.lang.String doctype(java.lang.String root,
                                          java.lang.String uri)
root - Root element of the DTDuri - URI of the DTD
protected static java.lang.String doctype(java.lang.String root,
                                          java.lang.String name,
                                          java.lang.String uri)
root - Root element of the DTDname - Public name of the DTDuri - URI of the DTDprotected static java.lang.String element(java.lang.String tag)
tag - XML tag
protected static java.lang.String element(java.lang.String tag,
                                          java.lang.String content)
tag - An XML tagcontent - Content string.  Characters requiring
                  conversion to entitites will be converted.
protected static java.lang.String element(java.lang.String tag,
                                          java.lang.String[][] attrs)
tag - An XML tagattrs - An array of String[2] elements, where for each
                  element, attrs[i][0] is the attribute key and
                  attrs[i][1] is the attribute value.
                  Null values are skipped.
protected static java.lang.String element(java.lang.String tag,
                                          java.lang.String[][] attrs,
                                          java.lang.String content)
tag - An XML tagcontent - Content string.  Characters requiring
                  conversion to entitites will be converted.attrs - An array of String[2] elements, where for each
                  element, attrs[i][0] is the attribute key and
                  attrs[i][1] is the attribute value.
                  Null values are skipped.protected static java.lang.String elementEnd(java.lang.String tag)
tag - An XML tagprotected static java.lang.String elementStart(java.lang.String tag)
tag - An XML tag
protected static java.lang.String elementStart(java.lang.String tag,
                                               java.lang.String[][] attrs)
tag - An XML tagattrs - An array of String[2] elements, where for each
                  element, attrs[i][0] is the attribute key and
                  attrs[i][1] is the attribute value.protected static java.lang.String xmlDecl()
protected static java.lang.String xmlDecl(java.lang.String encoding)
protected static java.lang.String getIndent(int level)
protected static java.lang.String integerArray(int[] iarray)
protected static java.lang.String integerArray(int[] iarray,
                                               char separator)
protected static java.lang.String longArray(long[] larray)
protected static java.lang.String rationalArray(Rational[] rarray)
protected static java.lang.String rationalArray10(Rational[] rarray)
protected static java.lang.String doubleArray(double[] darray)
protected java.lang.String toDateTime(java.util.Date date)
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||