|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.netarkivet.harvester.harvesting.metadata.MetadataFileWriter
public abstract class MetadataFileWriter
Abstract base class for Metadata file writer. Implementations must extend this class.
Field Summary | |
---|---|
protected static int |
MDF_ARC
Constant representing the ARC format. |
protected static int |
MDF_WARC
Constant representing the WARC format. |
protected static int |
metadataFormat
Constant representing the metadata Format. |
Constructor Summary | |
---|---|
MetadataFileWriter()
|
Method Summary | |
---|---|
abstract void |
close()
Close the metadatafile Writer. |
static MetadataFileWriter |
createWriter(java.io.File metadataArchiveFile)
Create a writer that writes data to the given archive file. |
abstract java.io.File |
getFile()
|
static java.lang.String |
getMetadataArchiveFileName(java.lang.String jobID,
java.lang.Long harvestID)
Generates a name for an archive(ARC/WARC) file containing metadata regarding a given job. |
protected static void |
initializeMetadataFormat()
Initialize the used metadata format from settings. |
void |
insertFiles(java.io.File parentDir,
java.io.FilenameFilter filter,
java.lang.String mimetype,
IngestableFiles files)
Append the files contained in the directory to the metadata archive file, but only if the filename matches the supplied filter. |
static void |
resetMetadataFormat()
Reset the metadata format. |
abstract void |
write(java.lang.String uri,
java.lang.String contentType,
java.lang.String hostIP,
long fetchBeginTimeStamp,
byte[] payload)
Write a record to the archive file. |
abstract void |
writeFileTo(java.io.File file,
java.lang.String uri,
java.lang.String mime)
Write the given file to the metadata file. |
abstract boolean |
writeTo(java.io.File fileToArchive,
java.lang.String URL,
java.lang.String mimetype)
Writes a File to an ARCWriter, if available, otherwise logs the failure to the class-logger. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int MDF_ARC
protected static final int MDF_WARC
protected static int metadataFormat
Constructor Detail |
---|
public MetadataFileWriter()
Method Detail |
---|
protected static void initializeMetadataFormat()
public static java.lang.String getMetadataArchiveFileName(java.lang.String jobID, java.lang.Long harvestID) throws ArgumentNotValid
jobID
- The number of the job that generated the archive file.harvestID
- the harvest ID of the job. Can be null.
ArgumentNotValid
- if any parameter was null.public static MetadataFileWriter createWriter(java.io.File metadataArchiveFile)
metadataArchiveFile
- The archive file to write to.
public abstract void close()
public abstract java.io.File getFile()
public abstract void writeFileTo(java.io.File file, java.lang.String uri, java.lang.String mime)
file
- A given file with metadata to write to the metadata archive file.uri
- The uri associated with the piece of metadatamime
- The mimetype associated with the piece of metadatapublic abstract boolean writeTo(java.io.File fileToArchive, java.lang.String URL, java.lang.String mimetype)
fileToArchive
- the File to archiveURL
- the URL with which it is stored in the arcfilemimetype
- The mimetype of the File-contents
public abstract void write(java.lang.String uri, java.lang.String contentType, java.lang.String hostIP, long fetchBeginTimeStamp, byte[] payload) throws java.io.IOException
uri
- record URIcontentType
- content-type of recordhostIP
- resource ip-addressfetchBeginTimeStamp
- record datetimepayload
- A byte array containing the payload
java.io.IOException
ARCWriter.write(String uri, String contentType, String hostIP,
long fetchBeginTimeStamp, long recordLength, InputStream in)
public void insertFiles(java.io.File parentDir, java.io.FilenameFilter filter, java.lang.String mimetype, IngestableFiles files)
parentDir
- directory containing the files to append to metadatafilter
- filter describing which files to accept and which to ignoremimetype
- The content-type to write along with the files in the metadata outputpublic static void resetMetadataFormat()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |