dk.netarkivet.common.utils.archive
Class HeritrixArchiveHeaderWrapper

java.lang.Object
  extended by dk.netarkivet.common.utils.archive.ArchiveHeaderBase
      extended by dk.netarkivet.common.utils.archive.HeritrixArchiveHeaderWrapper

public class HeritrixArchiveHeaderWrapper
extends ArchiveHeaderBase

Heritrix wrapper implementation of the abstract archive header interface.


Field Summary
protected  java.text.DateFormat arcDateFormat
          Reuse the same ARC DateFormat object.
protected  org.archive.io.ArchiveRecordHeader header
          Original Heritrix header object.
protected  java.util.Map<java.lang.String,java.lang.Object> headerFields
          Map of header fields extracted from the Heritrix header.
protected  HeritrixArchiveRecordWrapper recordWrapper
          Wrapper Heritrix header.
protected  java.text.DateFormat warcDateFormat
          Reuse the sme WARC DateFormat object.
 
Fields inherited from class dk.netarkivet.common.utils.archive.ArchiveHeaderBase
bIsArc, bIsWarc
 
Constructor Summary
HeritrixArchiveHeaderWrapper()
           
 
Method Summary
 java.lang.String getArcDateStr()
          Return the header date in the ARC string format for use in CDX output.
 java.io.File getArchiveFile()
          Return the archive File
 java.util.Date getDate()
          Return the header date as a Date object.
 java.util.Set<java.lang.String> getHeaderFieldKeys()
          Return a Set of header keys.
 java.util.Map<java.lang.String,java.lang.Object> getHeaderFields()
          Return a Map of all header key/value pairs.
 java.lang.String getHeaderStringValue(java.lang.String key)
          Return a header value string.
 java.lang.Object getHeaderValue(java.lang.String key)
          Return a header value object.
 java.lang.String getIp()
          Get the IP-Address from the header.
 long getLength()
          Get the record length from the header.
 java.lang.String getMimetype()
          Get the content-type from the header and not the payload.
 long getOffset()
          Get record offset.
 java.lang.String getReaderIdentifier()
          Return the reader identifier.
 java.lang.String getRecordIdentifier()
          Return the record identifier.
 java.lang.String getUrl()
          Get the URL from the header.
 java.lang.String getVersion()
          Get record version.
static HeritrixArchiveHeaderWrapper wrapArchiveHeader(HeritrixArchiveRecordWrapper recordWrapper, org.archive.io.ArchiveRecord record)
          Construct a Heritrix record header wrapper object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

warcDateFormat

protected java.text.DateFormat warcDateFormat
Reuse the sme WARC DateFormat object.


arcDateFormat

protected java.text.DateFormat arcDateFormat
Reuse the same ARC DateFormat object.


recordWrapper

protected HeritrixArchiveRecordWrapper recordWrapper
Wrapper Heritrix header.


header

protected org.archive.io.ArchiveRecordHeader header
Original Heritrix header object.


headerFields

protected java.util.Map<java.lang.String,java.lang.Object> headerFields
Map of header fields extracted from the Heritrix header. Only difference is that the keys are normalized to lower case.

Constructor Detail

HeritrixArchiveHeaderWrapper

public HeritrixArchiveHeaderWrapper()
Method Detail

wrapArchiveHeader

public static HeritrixArchiveHeaderWrapper wrapArchiveHeader(HeritrixArchiveRecordWrapper recordWrapper,
                                                             org.archive.io.ArchiveRecord record)
Construct a Heritrix record header wrapper object.

Parameters:
recordWrapper - wrapped Heritrix header
record - original Heritrix record
Returns:
wrapped Heritrix record header

getHeaderValue

public java.lang.Object getHeaderValue(java.lang.String key)
Description copied from class: ArchiveHeaderBase
Return a header value object.

Specified by:
getHeaderValue in class ArchiveHeaderBase
Parameters:
key - header key
Returns:
header value object

getHeaderStringValue

public java.lang.String getHeaderStringValue(java.lang.String key)
Description copied from class: ArchiveHeaderBase
Return a header value string.

Specified by:
getHeaderStringValue in class ArchiveHeaderBase
Parameters:
key - header key
Returns:
header value string

getHeaderFieldKeys

public java.util.Set<java.lang.String> getHeaderFieldKeys()
Description copied from class: ArchiveHeaderBase
Return a Set of header keys.

Specified by:
getHeaderFieldKeys in class ArchiveHeaderBase
Returns:
Set of header keys.

getHeaderFields

public java.util.Map<java.lang.String,java.lang.Object> getHeaderFields()
Description copied from class: ArchiveHeaderBase
Return a Map of all header key/value pairs.

Specified by:
getHeaderFields in class ArchiveHeaderBase
Returns:
Map of all header key/value pairs.

getVersion

public java.lang.String getVersion()
Description copied from class: ArchiveHeaderBase
Get record version.

Specified by:
getVersion in class ArchiveHeaderBase
Returns:
record version

getReaderIdentifier

public java.lang.String getReaderIdentifier()
Description copied from class: ArchiveHeaderBase
Return the reader identifier.

Specified by:
getReaderIdentifier in class ArchiveHeaderBase
Returns:
reader identifier

getRecordIdentifier

public java.lang.String getRecordIdentifier()
Description copied from class: ArchiveHeaderBase
Return the record identifier.

Specified by:
getRecordIdentifier in class ArchiveHeaderBase
Returns:
record identifier

getUrl

public java.lang.String getUrl()
Description copied from class: ArchiveHeaderBase
Get the URL from the header.

Specified by:
getUrl in class ArchiveHeaderBase
Returns:
the URL from the header

getIp

public java.lang.String getIp()
Description copied from class: ArchiveHeaderBase
Get the IP-Address from the header.

Specified by:
getIp in class ArchiveHeaderBase
Returns:
the IP-Address from the header

getOffset

public long getOffset()
Description copied from class: ArchiveHeaderBase
Get record offset.

Specified by:
getOffset in class ArchiveHeaderBase
Returns:
record offset

getLength

public long getLength()
Description copied from class: ArchiveHeaderBase
Get the record length from the header.

Specified by:
getLength in class ArchiveHeaderBase
Returns:
the record length

getDate

public java.util.Date getDate()
Description copied from class: ArchiveHeaderBase
Return the header date as a Date object.

Specified by:
getDate in class ArchiveHeaderBase
Returns:
header date as a Date object

getArcDateStr

public java.lang.String getArcDateStr()
Description copied from class: ArchiveHeaderBase
Return the header date in the ARC string format for use in CDX output.

Specified by:
getArcDateStr in class ArchiveHeaderBase
Returns:
header date in the ARC string format

getMimetype

public java.lang.String getMimetype()
Description copied from class: ArchiveHeaderBase
Get the content-type from the header and not the payload.

Specified by:
getMimetype in class ArchiveHeaderBase
Returns:
the content-type from the header

getArchiveFile

public java.io.File getArchiveFile()
Description copied from class: ArchiveHeaderBase
Return the archive File
Specified by:
getArchiveFile in class ArchiveHeaderBase
Returns:
archive File