org.exist.cocoon
Class XMLDBTransformer

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.AbstractSAXTransformer
                      extended by org.exist.cocoon.XMLDBTransformer
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.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, 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, ContentHandler, LexicalHandler

public class XMLDBTransformer
extends org.apache.cocoon.transformation.AbstractSAXTransformer
implements org.apache.avalon.excalibur.pool.Poolable

Transformer component for querying an XML database using the XMLDB API. This component provides a limited set of tags to query collections in the database.

Author:
wolf

Field Summary
static String COLLECTION_ELEMENT
           
static String CURRENT_NODE_ELEMENT
           
 String DEFAULT_DRIVER
           
 String DEFAULT_PASSWORD
           
 String DEFAULT_USER
           
static String ERRMSG_ELEMENT
           
static String ERROR_ELEMENT
           
static String FATAL_ERROR
           
static String FOR_EACH_ELEMENT
           
static int IN_COLLECTION
           
static int IN_QUERY
           
static String INFO
           
static String NAMESPACE
           
static String PREFIX
           
static String RESULT_SET_ELEMENT
           
static String SELECT_NODE
           
static String STACKTRACE_ELEMENT
           
static String WARNING
           
static String XUPDATE_ELEMENT
           
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
XMLDBTransformer()
           
 
Method Summary
 void characters(char[] p0, int p1, int p2)
           
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Try to read configuration parameters from the component setup.
 void endElement(String uri, String loc, String raw)
           
 void endPrefixMapping(String prefix)
           
 void recycle()
           
 void setup(org.apache.cocoon.environment.SourceResolver resolver, Map map, String src, org.apache.avalon.framework.parameters.Parameters parameters)
          Setup the component.
 void startElement(String uri, String localName, String qname, Attributes attribs)
           
 void startPrefixMapping(String prefix, String namespaceURI)
           
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
comment, endCDATA, endDocument, endDTD, endEntity, endParametersRecording, endParametersRecording, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, endTransformingElement, ignorableWhitespace, processingInstruction, sendEndElementEvent, sendEndElementEventNS, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendTextEvent, service, setDocumentLocator, setupTransforming, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startParametersRecording, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording, startTransformingElement
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

DEFAULT_DRIVER

public String DEFAULT_DRIVER

DEFAULT_USER

public String DEFAULT_USER

DEFAULT_PASSWORD

public String DEFAULT_PASSWORD

NAMESPACE

public static final String NAMESPACE
See Also:
Constant Field Values

COLLECTION_ELEMENT

public static final String COLLECTION_ELEMENT
See Also:
Constant Field Values

FOR_EACH_ELEMENT

public static final String FOR_EACH_ELEMENT
See Also:
Constant Field Values

CURRENT_NODE_ELEMENT

public static final String CURRENT_NODE_ELEMENT
See Also:
Constant Field Values

SELECT_NODE

public static final String SELECT_NODE
See Also:
Constant Field Values

RESULT_SET_ELEMENT

public static final String RESULT_SET_ELEMENT
See Also:
Constant Field Values

XUPDATE_ELEMENT

public static final String XUPDATE_ELEMENT
See Also:
Constant Field Values

ERROR_ELEMENT

public static final String ERROR_ELEMENT
See Also:
Constant Field Values

ERRMSG_ELEMENT

public static final String ERRMSG_ELEMENT
See Also:
Constant Field Values

STACKTRACE_ELEMENT

public static final String STACKTRACE_ELEMENT
See Also:
Constant Field Values

PREFIX

public static final String PREFIX
See Also:
Constant Field Values

FATAL_ERROR

public static final String FATAL_ERROR
See Also:
Constant Field Values

WARNING

public static final String WARNING
See Also:
Constant Field Values

INFO

public static final String INFO
See Also:
Constant Field Values

IN_COLLECTION

public static final int IN_COLLECTION
See Also:
Constant Field Values

IN_QUERY

public static final int IN_QUERY
See Also:
Constant Field Values
Constructor Detail

XMLDBTransformer

public XMLDBTransformer()
Method Detail

setup

public void setup(org.apache.cocoon.environment.SourceResolver resolver,
                  Map map,
                  String src,
                  org.apache.avalon.framework.parameters.Parameters parameters)
           throws org.apache.cocoon.ProcessingException,
                  SAXException,
                  IOException
Setup the component. Accepts parameters "driver", "user" and "password". If specified, those parameters override the default- settings or the settings specified during component setup. Example: <map:transform type="xmldb"> <map:parameter name="driver" value="org.exist.xmldb.DatabaseImpl"/> <map:parameter name="user" value="guest"/> <map:parameter name="password" value="guest"/> </map:transform>

Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Overrides:
setup in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
org.apache.cocoon.ProcessingException
SAXException
IOException
See Also:
SitemapModelComponent.setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)

startElement

public void startElement(String uri,
                         String localName,
                         String qname,
                         Attributes attribs)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
SAXException

endElement

public void endElement(String uri,
                       String loc,
                       String raw)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
SAXException

recycle

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

characters

public void characters(char[] p0,
                       int p1,
                       int p2)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
SAXException

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Try to read configuration parameters from the component setup. Example: <map:transformer name="xmldb" src="org.exist.cocoon.XMLDBTransformer"> <driver>org.exist.xmldb.DatabaseImpl</driver> <user>guest</user> <password>guest</password> </map:transformer> will set the default driver, user and password. Note that these values may also be set as parameters in the pipeline.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String namespaceURI)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
SAXException


Copyright (C) Wolfgang Meier. All rights reserved.