org.apache.jackrabbit.core.query.lucene
Class TextExtractorFilter

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.TextExtractorFilter
All Implemented Interfaces:
TextFilter
Direct Known Subclasses:
TextPlainTextFilter

public class TextExtractorFilter
extends Object
implements TextFilter

Utility base class for migrating functionality from existing implementations of the deprecated TextFilter interface to the new TextExtractor interface. Once the functionality of an existing TextFilter has been copied to a new TextExtractor, the original class can be replaced with the following template to keep backwards compatibility while avoiding the burden of maintaining duplicate code:

 public class SomeTextFilter extends TextExtractorFilter {
     public SomeTextFilter() {
         super(new SomeTextExtractor());
     }
 }
 


Constructor Summary
TextExtractorFilter(TextExtractor extractor)
          Creates a text filter adapter for the given text extractor.
 
Method Summary
 boolean canFilter(String mimeType)
          Returns true if the adapted text extractor supports the given content type.
 Map doFilter(PropertyState data, String encoding)
          Extracts text content of the given binary property using the adapted text extractor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextExtractorFilter

public TextExtractorFilter(TextExtractor extractor)
Creates a text filter adapter for the given text extractor.

Parameters:
extractor - adapted text extractor
Method Detail

canFilter

public boolean canFilter(String mimeType)
Returns true if the adapted text extractor supports the given content type.

Specified by:
canFilter in interface TextFilter
Parameters:
mimeType - content type
Returns:
true if the content type is supported, false otherwise

doFilter

public Map doFilter(PropertyState data,
                    String encoding)
             throws RepositoryException
Extracts text content of the given binary property using the adapted text extractor.

Specified by:
doFilter in interface TextFilter
Parameters:
data - binary property
encoding - character encoding, or null
Returns:
map that contains a reader for the extracted text as the FieldNames.FULLTEXT entry
Throws:
RepositoryException - if the binary property can not be read


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.