org.restlet.ext.lucene
Class TikaRepresentation

java.lang.Object
  extended by org.restlet.representation.Variant
      extended by org.restlet.representation.RepresentationInfo
          extended by org.restlet.representation.Representation
              extended by org.restlet.representation.CharacterRepresentation
                  extended by org.restlet.representation.WriterRepresentation
                      extended by org.restlet.ext.xml.XmlRepresentation
                          extended by org.restlet.ext.xml.SaxRepresentation
                              extended by org.restlet.ext.lucene.TikaRepresentation
All Implemented Interfaces:
NamespaceContext

public class TikaRepresentation
extends SaxRepresentation

Representation that parses another wrapped representation using Lucene Tika metadata extraction engine. Tika can be configured to indicates a specific parser to used, otherwise a special auto-detect parser is used. Tike metadata can also be customized if wanted.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class org.restlet.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
TikaRepresentation(Representation representation)
          Constructor.
TikaRepresentation(Representation representation, TikaConfig tikaConfig)
          Constructor.
TikaRepresentation(Representation representation, TikaConfig tikaConfig, Parser tikaParser)
          Constructor.
 
Method Summary
 Metadata getMetadata()
          Returns the Tika metadata used for both input and output.
 TikaConfig getTikaConfig()
          Returns the optional Tika configuration.
 Parser getTikaParser()
          Returns the optional Tika parser.
 void parse(ContentHandler contentHandler)
          Parsed the wrapped representation with Tika to extract the useful metadata and produce structural SAX events (in XHTML format) and send them to the given SAX content handler.
 void setMetadata(Metadata metadata)
          The Tika metadata used for both input and output.
 void setTikaConfig(TikaConfig tikaConfig)
          Sets the optional Tika configuration.
 void setTikaParser(Parser tikaParser)
          Sets the optional Tika parser.
 
Methods inherited from class org.restlet.ext.xml.SaxRepresentation
getInputSource, getSaxSource, isSecureProcessing, release, setSaxSource, setSecureProcessing, write, write
 
Methods inherited from class org.restlet.ext.xml.XmlRepresentation
evaluate, getBoolean, getDocument, getDocumentBuilder, getDomSource, getEntityResolver, getErrorHandler, getNamespaces, getNamespaceURI, getNode, getNodes, getNumber, getPrefix, getPrefixes, getSaxSource, getSchema, getStreamSource, getText, isCoalescing, isExpandingEntityRefs, isIgnoringComments, isIgnoringExtraWhitespaces, isNamespaceAware, isValidatingDtd, isXIncludeAware, setCoalescing, setEntityResolver, setErrorHandler, setExpandingEntityRefs, setIgnoringComments, setIgnoringExtraWhitespaces, setNamespaceAware, setNamespaces, setSchema, setSchema, setValidatingDtd, setXIncludeAware, validate, validate, validate, validate
 
Methods inherited from class org.restlet.representation.WriterRepresentation
getReader
 
Methods inherited from class org.restlet.representation.CharacterRepresentation
getChannel, getStream, write, write
 
Methods inherited from class org.restlet.representation.Representation
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
 
Methods inherited from class org.restlet.representation.RepresentationInfo
getModificationDate, getTag, setModificationDate, setTag
 
Methods inherited from class org.restlet.representation.Variant
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TikaRepresentation

public TikaRepresentation(Representation representation)
Constructor.

Parameters:
representation - The wrapped representation to analyze.

TikaRepresentation

public TikaRepresentation(Representation representation,
                          TikaConfig tikaConfig)
Constructor.

Parameters:
representation - The wrapped representation to analyze.
tikaConfig - The optional Tika configuration.

TikaRepresentation

public TikaRepresentation(Representation representation,
                          TikaConfig tikaConfig,
                          Parser tikaParser)
Constructor.

Parameters:
representation - The wrapped representation to analyze.
tikaConfig - The optional Tika configuration.
tikaParser - The optional Tika parser.
Method Detail

getMetadata

public Metadata getMetadata()
Returns the Tika metadata used for both input and output.

Returns:
The Tika metadata used for both input and output.

getTikaConfig

public TikaConfig getTikaConfig()
Returns the optional Tika configuration.

Returns:
The Tika configuration or null.

getTikaParser

public Parser getTikaParser()
Returns the optional Tika parser.

Returns:
The Tika parser or null.

parse

public void parse(ContentHandler contentHandler)
           throws IOException
Parsed the wrapped representation with Tika to extract the useful metadata and produce structural SAX events (in XHTML format) and send them to the given SAX content handler.

Overrides:
parse in class SaxRepresentation
Parameters:
contentHandler - The target SAX handler.
Throws:
IOException

setMetadata

public void setMetadata(Metadata metadata)
The Tika metadata used for both input and output.

Parameters:
metadata - The Tika metadata.

setTikaConfig

public void setTikaConfig(TikaConfig tikaConfig)
Sets the optional Tika configuration.

Parameters:
tikaConfig - The Tika configuration.

setTikaParser

public void setTikaParser(Parser tikaParser)
Sets the optional Tika parser.

Parameters:
tikaParser - The Tika parser.


Copyright © 2005-2013 Restlet.