org.apache.any23.extractor
Class SimpleExtractorFactory<T extends Extractor<?>>

java.lang.Object
  extended by org.apache.any23.extractor.SimpleExtractorFactory<T>
Type Parameters:
T - the type of the Extractor served by this factory.
All Implemented Interfaces:
ExtractorDescription, ExtractorFactory<T>

public class SimpleExtractorFactory<T extends Extractor<?>>
extends Object
implements ExtractorFactory<T>

This class is a simple and default-like implementation of ExtractorFactory.


Method Summary
static
<S extends Extractor<?>>
ExtractorFactory<S>
create(String name, Prefixes prefixes, Collection<String> supportedMIMETypes, String exampleInput, Class<S> extractorClass)
          Creates an instance of a ExtractorFactory serving concrete implementation instances of Extractor.
 T createExtractor()
          Creates an extractor instance.
 String getExampleInput()
          An example input file for the extractor, to be used in auto-generated documentation.
 String getExtractorName()
          Returns the name of the extractor.
 Class<T> getExtractorType()
          Returns the extractor type.
 Prefixes getPrefixes()
          An instance defining the prefixes supported by this extractor.
 Collection<MIMEType> getSupportedMIMETypes()
          Supports wildcards, e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static <S extends Extractor<?>> ExtractorFactory<S> create(String name,
                                                                  Prefixes prefixes,
                                                                  Collection<String> supportedMIMETypes,
                                                                  String exampleInput,
                                                                  Class<S> extractorClass)
Creates an instance of a ExtractorFactory serving concrete implementation instances of Extractor.

Type Parameters:
S - the concrete type of the Extractor.
Parameters:
name - of the Extractor.
prefixes - handled Prefixes.
supportedMIMETypes - collection of supported MIME Types.
exampleInput - a string acting as a input example.
extractorClass - concrete implementation class of the Extractor.
Returns:
an ExtractorFactory.

getExtractorName

public String getExtractorName()
Description copied from interface: ExtractorDescription
Returns the name of the extractor.

Specified by:
getExtractorName in interface ExtractorDescription
Returns:
the name of the Extractor

getPrefixes

public Prefixes getPrefixes()
Description copied from interface: ExtractorDescription
An instance defining the prefixes supported by this extractor.

Specified by:
getPrefixes in interface ExtractorDescription
Returns:
the handled Prefixes

getSupportedMIMETypes

public Collection<MIMEType> getSupportedMIMETypes()
Description copied from interface: ExtractorFactory
Supports wildcards, e.g. "*/*" for blind extractors that merely call a web service.

Specified by:
getSupportedMIMETypes in interface ExtractorFactory<T extends Extractor<?>>
Returns:
the supported MIMEType

getExtractorType

public Class<T> getExtractorType()
Description copied from interface: ExtractorFactory
Returns the extractor type.

Specified by:
getExtractorType in interface ExtractorFactory<T extends Extractor<?>>
Returns:
the not null extractor class.

createExtractor

public T createExtractor()
Description copied from interface: ExtractorFactory
Creates an extractor instance.

Specified by:
createExtractor in interface ExtractorFactory<T extends Extractor<?>>
Returns:
an instance of type T concrete implementation of Extractor

getExampleInput

public String getExampleInput()
Description copied from interface: ExtractorFactory
An example input file for the extractor, to be used in auto-generated documentation. For the Extractor.BlindExtractor, this is an arbitrary URI. For extractors that require content, it is the name of a file, relative to the factory's class file's location, it will be opened using factory.getClass().getResourceAsStream(filename). The example should be a short file that produces characteristic output if sent through the extractor. The file will be read as UTF-8, so it should either use that encoding or avoid characters outside of the US-ASCII range.

Specified by:
getExampleInput in interface ExtractorFactory<T extends Extractor<?>>
Returns:
an input example


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.