A document has been updated: http://cocoon.zones.apache.org/daisy/documentation/1506.html
Document ID: 1506 Branch: main Language: default Name: JCRQueryTransformer (unchanged) Document Type: Sitemap Component (unchanged) Updated on: 8/18/08 1:33:08 PM Updated by: Lukas Lang A new version has been created, state: draft Parts ===== Long description ---------------- This part has been added. Mime type: text/xml File name: null Size: 1884 bytes Content: <html> <body> <p>The JCRQueryTransformer performs a query on a JCR server. It expects a "query" element without namespace containing the query to execute, either in XPath or SQL, and eventually the properties to fetch (since JSR-170 does not define a standard for specifying them in xpath queries). It will then replace it with a "result" element containing the query results in elements named "node". Please keep in mind, namespace awareness depends on the JCR repository used and is not supported by Jackrabbit yet, as we use the Jackrabbit repository in the sample.</p> <h3>Example</h3> <p>Imagine, the following template was defined for sending queries through a pipe:</p> <pre><query language="xpath" xmlns:jcr="http://www.jcp.org/jcr/1.0"> <jcr:encoding /> <jcr:isCheckedOut />${cocoon.parameters.QUERY}</query></pre> <p>By adding a query transformer to a sitemap's pipeline match, the completed query is sent to the repository:</p> <pre><map:match pattern="query"> <map:generate type="jx" src="querytemplate.xml"> <map:parameter name="QUERY" value="{request-param:query}" /> </map:generate> <map:transform type="JCRQuery" /> <map:serialize type="xml" /> </map:match></pre> <p>If you point your browser at</p> <pre>http://localhost:8888/cocoon-jcr-sample/it/query?query=/jcr:root/cocoon/*</pre> <p>all resources under <em>cocoon </em>will be returned. It is possitlbe to specify any arbitrary XPath query.</p> <h3>Configuration</h3> <p>JCRQueryTransformer is configured, using Spring. A JCR repository must be provided.</p> <pre> <bean name="org.apache.cocoon.transformation.Transformer/JCRQuery" class="org.apache.cocoon.jcr.transforming.JCRQueryTransformer"> <property name="repo" ref="javax.jcr.Repository" /> </bean></pre> </body> </html> Fields ====== CocoonComponentReference: Transformer (new field) CocoonBlock: jcr (new field) FQ Java class: org.apache.cocoon.jcr.transforming.JCRQueryTransformer (new field)