org.apache.cocoon.transformation
Class LuceneIndexTransformerOptimized

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.apache.cocoon.transformation.LuceneIndexTransformerOptimized
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.transformation.Transformer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer, org.apache.excalibur.xml.sax.XMLConsumer, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler

public class LuceneIndexTransformerOptimized
extends org.apache.cocoon.transformation.AbstractTransformer
implements org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.service.Serviceable

A lucene index creation transformer.

See LuceneIndexTransformer documentation on the Cocoon Wiki.

TODO: Write more documentation.

Author:
Vadim Gritsenko , Conal Tuohy , Nicolas Maisonneuve

Field Summary
static java.lang.String ANALYZER_CLASSNAME_CONFIG
           
static java.lang.String ANALYZER_CLASSNAME_DEFAULT
           
static java.lang.String ANALYZER_CLASSNAME_PARAMETER
           
static java.lang.String CDATA
           
static java.lang.String DIRECTORY_CONFIG
           
static java.lang.String DIRECTORY_DEFAULT
           
static java.lang.String DIRECTORY_PARAMETER
           
static java.lang.String LUCENE_DOCUMENT_ELEMENT
           
static java.lang.String LUCENE_DOCUMENT_URL_ATTRIBUTE
           
static java.lang.String LUCENE_ELAPSED_TIME_ATTRIBUTE
           
static java.lang.String LUCENE_ELEMENT_ATTR_STORE_VALUE
           
static java.lang.String LUCENE_ELEMENT_ATTR_TO_TEXT_ATTRIBUTE
           
static java.lang.String LUCENE_QUERY_ANALYZER_ATTRIBUTE
           
static java.lang.String LUCENE_QUERY_CREATE_ATTRIBUTE
           
static java.lang.String LUCENE_QUERY_DIRECTORY_ATTRIBUTE
           
static java.lang.String LUCENE_QUERY_ELEMENT
           
static java.lang.String LUCENE_QUERY_MERGE_FACTOR_ATTRIBUTE
           
static java.lang.String LUCENE_URI
           
static java.lang.String MERGE_FACTOR_CONFIG
           
static int MERGE_FACTOR_DEFAULT
           
static java.lang.String MERGE_FACTOR_PARAMETER
           
protected  java.io.File workDir
           
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
LuceneIndexTransformerOptimized()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Configure the transformer.
 void contextualize(org.apache.avalon.framework.context.Context context)
          Contextualize this class
 void endDocument()
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 void endPrefixMapping(java.lang.String prefix)
          End the scope of a prefix-URI mapping.
 java.io.Serializable getKey()
          Generate the unique key.
 org.apache.excalibur.source.SourceValidity getValidity()
          Generate the validity object.
 void recycle()
           
 void service(org.apache.avalon.framework.service.ServiceManager manager)
           
 void setup(org.apache.cocoon.environment.SourceResolver resolver, java.util.Map objectModel, java.lang.String src, org.apache.avalon.framework.parameters.Parameters parameters)
          Setup the transformer.
 void startDocument()
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Begin the scope of a prefix-URI Namespace mapping.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
comment, endCDATA, endDTD, endEntity, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntity
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

ANALYZER_CLASSNAME_CONFIG

public static final java.lang.String ANALYZER_CLASSNAME_CONFIG
See Also:
Constant Field Values

ANALYZER_CLASSNAME_PARAMETER

public static final java.lang.String ANALYZER_CLASSNAME_PARAMETER
See Also:
Constant Field Values

ANALYZER_CLASSNAME_DEFAULT

public static final java.lang.String ANALYZER_CLASSNAME_DEFAULT
See Also:
Constant Field Values

DIRECTORY_CONFIG

public static final java.lang.String DIRECTORY_CONFIG
See Also:
Constant Field Values

DIRECTORY_PARAMETER

public static final java.lang.String DIRECTORY_PARAMETER
See Also:
Constant Field Values

DIRECTORY_DEFAULT

public static final java.lang.String DIRECTORY_DEFAULT
See Also:
Constant Field Values

MERGE_FACTOR_CONFIG

public static final java.lang.String MERGE_FACTOR_CONFIG
See Also:
Constant Field Values

MERGE_FACTOR_PARAMETER

public static final java.lang.String MERGE_FACTOR_PARAMETER
See Also:
Constant Field Values

MERGE_FACTOR_DEFAULT

public static final int MERGE_FACTOR_DEFAULT
See Also:
Constant Field Values

LUCENE_URI

public static final java.lang.String LUCENE_URI
See Also:
Constant Field Values

LUCENE_QUERY_ELEMENT

public static final java.lang.String LUCENE_QUERY_ELEMENT
See Also:
Constant Field Values

LUCENE_QUERY_ANALYZER_ATTRIBUTE

public static final java.lang.String LUCENE_QUERY_ANALYZER_ATTRIBUTE
See Also:
Constant Field Values

LUCENE_QUERY_DIRECTORY_ATTRIBUTE

public static final java.lang.String LUCENE_QUERY_DIRECTORY_ATTRIBUTE
See Also:
Constant Field Values

LUCENE_QUERY_CREATE_ATTRIBUTE

public static final java.lang.String LUCENE_QUERY_CREATE_ATTRIBUTE
See Also:
Constant Field Values

LUCENE_QUERY_MERGE_FACTOR_ATTRIBUTE

public static final java.lang.String LUCENE_QUERY_MERGE_FACTOR_ATTRIBUTE
See Also:
Constant Field Values

LUCENE_DOCUMENT_ELEMENT

public static final java.lang.String LUCENE_DOCUMENT_ELEMENT
See Also:
Constant Field Values

LUCENE_DOCUMENT_URL_ATTRIBUTE

public static final java.lang.String LUCENE_DOCUMENT_URL_ATTRIBUTE
See Also:
Constant Field Values

LUCENE_ELEMENT_ATTR_TO_TEXT_ATTRIBUTE

public static final java.lang.String LUCENE_ELEMENT_ATTR_TO_TEXT_ATTRIBUTE
See Also:
Constant Field Values

LUCENE_ELEMENT_ATTR_STORE_VALUE

public static final java.lang.String LUCENE_ELEMENT_ATTR_STORE_VALUE
See Also:
Constant Field Values

LUCENE_ELAPSED_TIME_ATTRIBUTE

public static final java.lang.String LUCENE_ELAPSED_TIME_ATTRIBUTE
See Also:
Constant Field Values

CDATA

public static final java.lang.String CDATA
See Also:
Constant Field Values

workDir

protected java.io.File workDir
Constructor Detail

LuceneIndexTransformerOptimized

public LuceneIndexTransformerOptimized()
Method Detail

service

public void service(org.apache.avalon.framework.service.ServiceManager manager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configure the transformer. The configuration parameters are stored as general defaults, which may be over-ridden by parameters specified as parameters in the sitemap pipeline, or by attributes of the query element(s) in the XML input document.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

setup

public void setup(org.apache.cocoon.environment.SourceResolver resolver,
                  java.util.Map objectModel,
                  java.lang.String src,
                  org.apache.avalon.framework.parameters.Parameters parameters)
           throws org.apache.cocoon.ProcessingException,
                  org.xml.sax.SAXException,
                  java.io.IOException
Setup the transformer. Called when the pipeline is assembled. The parameters are those specified as child elements of the <map:transform> element in the sitemap. These parameters are optional: If no parameters are specified here then the defaults are supplied by the component configuration. Any parameters specified here may be over-ridden by attributes of the lucene:index element in the input document.

Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Throws:
org.apache.cocoon.ProcessingException
org.xml.sax.SAXException
java.io.IOException

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Contextualize this class

Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Throws:
org.apache.avalon.framework.context.ContextException

recycle

public void recycle()
Specified by:
recycle in interface org.apache.avalon.excalibur.pool.Recyclable
Overrides:
recycle in class org.apache.cocoon.xml.AbstractXMLProducer

getKey

public java.io.Serializable getKey()
Generate the unique key. This key must be unique inside the space of this component.

Specified by:
getKey in interface org.apache.cocoon.caching.CacheableProcessingComponent
Returns:
The generated key

getValidity

public org.apache.excalibur.source.SourceValidity getValidity()
Generate the validity object.

Specified by:
getValidity in interface org.apache.cocoon.caching.CacheableProcessingComponent
Returns:
The generated validity object or null if the component is currently not cacheable.

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.apache.cocoon.xml.AbstractXMLPipe
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.apache.cocoon.xml.AbstractXMLPipe
Throws:
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Begin the scope of a prefix-URI Namespace mapping.

Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Overrides:
startPrefixMapping in class org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
prefix - The Namespace prefix being declared.
uri - The Namespace URI the prefix is mapped to.
Throws:
org.xml.sax.SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
End the scope of a prefix-URI mapping.

Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Overrides:
endPrefixMapping in class org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
prefix - The prefix that was being mapping.
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.apache.cocoon.xml.AbstractXMLPipe
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.apache.cocoon.xml.AbstractXMLPipe
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.apache.cocoon.xml.AbstractXMLPipe
Throws:
org.xml.sax.SAXException


Copyright $ Apache Software Foundation. All Rights Reserved.