org.openpipeline.pipeline.docfilter
Class DocFilterFactory

java.lang.Object
  extended by org.openpipeline.pipeline.docfilter.DocFilterFactory

public class DocFilterFactory
extends Object

Returns an instance of a DocFilter object based on a filename.

DocFilterFactory objects should be held in memory and reused by a single thread. They are not multi-threaded. There is an internal cache that *may* hold reusable DocFilter objects. If multiple threads access the getFilter() method, then different threads may get the same DocFilter object at the same time with unpredictable results. So, allocate one DocFilterFactory per thread.


Constructor Summary
DocFilterFactory()
           
DocFilterFactory(XMLConfig config)
          Create a factory which is configured by the specified config object.
 
Method Summary
 List getDocFilters()
          Returns an iterator over all the DocFilters available in the system.
 DocFilter getFilterByFilename(String filename)
          Return an appropriate DocFilter object based on the filename's extension.
 DocFilter getFilterByMimeType(String mimeType)
          Returns the appropriate DocFilter object based on the filename's mimetype.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocFilterFactory

public DocFilterFactory()

DocFilterFactory

public DocFilterFactory(XMLConfig config)
Create a factory which is configured by the specified config object. It's ok if this object is null.

Parameters:
config - the object that contains the config parameters
Method Detail

getDocFilters

public List getDocFilters()
Returns an iterator over all the DocFilters available in the system. Each element returned is a DocFilter object.

Returns:
an iterator over the available DocFilters

getFilterByFilename

public DocFilter getFilterByFilename(String filename)
Return an appropriate DocFilter object based on the filename's extension.

Parameters:
filename - the name of the file to filter.
Returns:
an instance of a DocFilter object, or null if the extension is not found and there is no default filter

getFilterByMimeType

public DocFilter getFilterByMimeType(String mimeType)
Returns the appropriate DocFilter object based on the filename's mimetype.

Parameters:
mimeType - the mimetype of the file
Returns:
an instance of a DocFilter object, or null if the mimetype is not found
Throws:
ClassNotFoundException - if a custom filter class is defined, but not on the class path
InstantiationException - if a custom filter class could not be created
IllegalAccessException - if a custom filter class could not be created