org.apache.cocoon.transformation
Class DASLTransformer

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.apache.cocoon.transformation.DASLTransformer
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, Configurable, LogEnabled, Serviceable, CacheableProcessingComponent, SitemapModelComponent, Transformer, XMLPipe, XMLProducer, XMLConsumer, ContentHandler, LexicalHandler

public class DASLTransformer
extends AbstractSAXTransformer
implements CacheableProcessingComponent

This transformer performs DASL queries on DASL-enabled WebDAV servers. It expects a "query" element in the "http://cocoon.apache.org/webdav/dasl/1.0" namespace containing the DASL query to execute, with a "target" attribute specifiyng the webdav:// or http:// URL for the target WebDAV server. It will then replace it with a "query-result" element containing the WebDAV results. Each result will be contained in a "result" element with a "path" attribute pointing at it and all WebDAV properties presented as (namespaced) children elements. Sample invocation: lt;dasl:query xmlns:dasl="http://cocoon.apache.org/webdav/dasl/1.0" target="webdav://localhost/repos/"gt; lt;D:searchrequest xmlns:D="DAV:"gt; lt;D:basicsearchgt; lt;D:selectgt; lt;D:allprop/gt; lt;/D:selectgt; lt;D:fromgt; lt;D:scopegt; lt;D:hrefgt;/repos/lt;/D:hrefgt; lt;D:depthgt;infinitylt;/D:depthgt; lt;/D:scopegt; lt;/D:fromgt; lt;D:wheregt; lt;D:eqgt; lt;D:propgt;lt;D:getcontenttype/gt;lt;/D:propgt; lt;D:literalgt;text/htmllt;/D:literalgt; lt;/D:eqgt; lt;/D:wheregt; lt;D:orderbygt; lt;D:ordergt; lt;D:propgt; lt;D:getcontentlength/gt; lt;/D:propgt; lt;D:ascending/gt; lt;/D:ordergt; lt;D:ordergt; lt;D:propgt; lt;D:href/gt; lt;/D:propgt; lt;D:ascending/gt; lt;/D:ordergt; lt;/D:orderbygt; lt;/D:basicsearchgt; lt;/D:searchrequestgt; lt;/dasl:querygt; Features - Substitution of a value: with this feature it's possible to pass value from sitemap that are substituted into a query. sitemap example: lt;map:transformer type="dasl"gt; lt;parameter name="repos" value="/repos/"gt; lt;/map:transformergt; query example: .... lt;D:hrefgt;lt;substitute-value name="repos"/gt;lt;/D:hrefgt; .... This feature is like substitute-value of SQLTransformer TODO: the SWCL Search method doesn't preserve the result order, which makes order-by clauses useless. TODO: *much* better error handling.

Version:
$Id: DASLTransformer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Gianugo Rabellino,
Field Summary
protected static String PATH_NODE_NAME
           
protected static String RESOURCE_NODE_NAME
           
 
Fields inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
context, defaultNamespaceURI, EMPTY_ATTRIBUTES, emptyAttributes, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, ignoreWhitespaces, manager, namespaceURI, objectModel, parameters, recorderStack, request, resolver, response, source, stack
 
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
DASLTransformer()
           
 
Method Summary
 void endElement(String uri, String name, String raw)
          Intercept the end tag, convert buffered input to a String, build and execute the DASL query.
 Serializable getKey()
          generates the cachekey, which is the classname plus any possible COCOON parameters
 SourceValidity getValidity()
          returns the validity which will be filled during processing of the requests
protected  void performSearchMethod(String query)
           
 void recycle()
          Forget about previous aggregated validity object
 void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
          Set the SourceResolver, objectModel Map, the source and sitemap Parameters used to process the request.
 void startElement(String uri, String name, String raw, Attributes attr)
          Intercept the start tag.
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
addRecorder, characters, comment, configure, dispose, endCDATA, endDocument, endDTD, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, endTransformingElement, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, service, setDocumentLocator, setupTransforming, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startParametersRecording, startPrefixMapping, 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, 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.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

PATH_NODE_NAME

protected static final String PATH_NODE_NAME
See Also:
Constant Field Values

RESOURCE_NODE_NAME

protected static final String RESOURCE_NODE_NAME
See Also:
Constant Field Values
Constructor Detail

DASLTransformer

public DASLTransformer()
Method Detail

startElement

public void startElement(String uri,
                         String name,
                         String raw,
                         Attributes attr)
                  throws SAXException
Intercept the start tag.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class AbstractSAXTransformer
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
attr - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(String uri,
                       String name,
                       String raw)
                throws SAXException
Intercept the end tag, convert buffered input to a String, build and execute the DASL query.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class AbstractSAXTransformer
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
Throws:
SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

performSearchMethod

protected void performSearchMethod(String query)
                            throws SAXException
Throws:
SAXException

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws ProcessingException,
                  SAXException,
                  IOException
Description copied from interface: SitemapModelComponent
Set the SourceResolver, objectModel Map, the source and sitemap Parameters used to process the request.

Specified by:
setup in interface SitemapModelComponent
Overrides:
setup in class AbstractSAXTransformer
Throws:
ProcessingException
SAXException
IOException

recycle

public void recycle()
Forget about previous aggregated validity object

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractSAXTransformer

getKey

public Serializable getKey()
generates the cachekey, which is the classname plus any possible COCOON parameters

Specified by:
getKey in interface CacheableProcessingComponent
Returns:
The generated key or null if the component is currently not cacheable.

getValidity

public SourceValidity getValidity()
returns the validity which will be filled during processing of the requests

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


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.