org.exist.cocoon
Class XQueryGenerator

java.lang.Object
  extended byServiceableGenerator
      extended byorg.exist.cocoon.XQueryGenerator

public class XQueryGenerator
extends ServiceableGenerator

A generator for Cocoon which reads an XQuery script, executes it and passes the results into the Cocoon pipeline. The following optional attributes are accepted on the component declaration as default eXist settings:

  • collection: identifies the XML:DB root collection used to process the request
  • user
  • password
  • create-session: if set to "true", indicates that an HTTP session should be created upon the first invocation.
  • expand-xincludes
  • cache-validity: if specified, the XQuery content is cached until the specified delay expressed in milliseconds is elapsed or until the XQuery file is modified. The identity of the cached content is computed using the XQuery file URI and the list of all parameters passed to the XQuery.
  • The component also accept default parameters that will be declared as implicit variables in the XQuery. See below an example declaration of the XQueryGenerator component with default eXist settings, and an extra user-defined parameter: These settings and parameters can be overriden on a per-pipeline basis with sitemap parameters, see below with default values and the extra user-defined parameter:
      <map:parameter name="collection" value="xmldb:exist:///db"/>
      <map:parameter name="user" value="guest"/>
      <map:parameter name="password" value="guest"/>
      <map:parameter name="create-session" value="false"/>
      <map:parameter name="expand-xincludes" value="false"/>
      <map:parameter name="cache-validity" value="-1quot;/>
      <map:parameter name="myProjectURI" value="/db/myproject"/>
     
    The last sitemap parameter overrides the value of the XQuery variable defined in the component parameters, whereas others override the default eXist settings defined on the component attributes.

    Author:
    wolf
    See Also:
    Serialized Form

    Field Summary
    static java.lang.String DRIVER
               
     
    Constructor Summary
    XQueryGenerator()
               
     
    Method Summary
     void configure(Configuration config)
               
     void generate()
               
     java.io.Serializable getKey()
               
     SourceValidity getValidity()
               
     void parameterize(Parameters params)
               
     void recycle()
               
     void setup(SourceResolver resolver, java.util.Map objectModel, java.lang.String source, Parameters parameters)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    DRIVER

    public static final java.lang.String DRIVER
    See Also:
    Constant Field Values
    Constructor Detail

    XQueryGenerator

    public XQueryGenerator()
    Method Detail

    setup

    public void setup(SourceResolver resolver,
                      java.util.Map objectModel,
                      java.lang.String source,
                      Parameters parameters)
               throws ProcessingException,
                      org.xml.sax.SAXException,
                      java.io.IOException
    Throws:
    ProcessingException
    org.xml.sax.SAXException
    java.io.IOException

    recycle

    public void recycle()

    generate

    public void generate()
                  throws java.io.IOException,
                         org.xml.sax.SAXException,
                         ProcessingException
    Throws:
    java.io.IOException
    org.xml.sax.SAXException
    ProcessingException

    configure

    public void configure(Configuration config)
                   throws ConfigurationException
    Throws:
    ConfigurationException
    See Also:
    org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)

    parameterize

    public void parameterize(Parameters params)
                      throws ParameterException
    Throws:
    ParameterException
    See Also:
    org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)

    getKey

    public java.io.Serializable getKey()

    getValidity

    public SourceValidity getValidity()


    <oXygen/> XML Editor provides support for editing and debugging XQuery expressions against the eXist XML Database.