org.dspace.app.mediafilter
Interface FormatFilter

All Known Implementing Classes:
BrandedPreviewJPEGFilter, HTMLFilter, JPEGFilter, MediaFilter, PDFFilter, WordFilter, XPDF2Text, XPDF2Thumbnail

public interface FormatFilter

Public interface for any class which transforms or converts content/bitstreams from one format to another. This interface should be implemented by any class which defines a "filter" to be run by the MediaFilterManager.


Method Summary
 String getBundleName()
           
 String getDescription()
           
 InputStream getDestinationStream(InputStream source)
           
 String getFilteredName(String sourceName)
          Get a filename for a newly created filtered bitstream
 String getFormatString()
           
 void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream)
          Perform any post-processing of the generated bitstream *after* this filter has already been run.
 boolean preProcessBitstream(Context c, Item item, Bitstream source)
          Perform any pre-processing of the source bitstream *before* the actual filtering takes place in MediaFilterManager.processBitstream().
 

Method Detail

getFilteredName

String getFilteredName(String sourceName)
Get a filename for a newly created filtered bitstream

Parameters:
sourceName - name of source bitstream
Returns:
filename generated by the filter - for example, document.pdf becomes document.pdf.txt

getBundleName

String getBundleName()
Returns:
name of the bundle this filter will stick its generated Bitstreams

getFormatString

String getFormatString()
Returns:
name of the bitstream format (say "HTML" or "Microsoft Word") returned by this filter look in the bitstream format registry or mediafilter.cfg for valid format strings.

getDescription

String getDescription()
Returns:
string to describe the newly-generated Bitstream's - how it was produced is a good idea

getDestinationStream

InputStream getDestinationStream(InputStream source)
                                 throws Exception
Parameters:
source - input stream
Returns:
result of filter's transformation, written out to a bitstream
Throws:
Exception

preProcessBitstream

boolean preProcessBitstream(Context c,
                            Item item,
                            Bitstream source)
                            throws Exception
Perform any pre-processing of the source bitstream *before* the actual filtering takes place in MediaFilterManager.processBitstream().

Return true if pre-processing is successful (or no pre-processing is necessary). Return false if bitstream should be skipped for any reason.

Parameters:
c - context
item - item containing bitstream to process
source - source bitstream to be processed
Returns:
true if bitstream processing should continue, false if this bitstream should be skipped
Throws:
Exception

postProcessBitstream

void postProcessBitstream(Context c,
                          Item item,
                          Bitstream generatedBitstream)
                          throws Exception
Perform any post-processing of the generated bitstream *after* this filter has already been run.

Return true if pre-processing is successful (or no pre-processing is necessary). Return false if bitstream should be skipped for some reason.

Parameters:
c - context
item - item containing bitstream to process
generatedBitstream - the bitstream which was generated by this filter.
Throws:
Exception


Copyright © 2010 DuraSpace. All Rights Reserved.