cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: JCRQueryTransformer
Date Mon, 18 Aug 2008 13:33:16 GMT
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>&lt;query language="xpath" xmlns:jcr="http://www.jcp.org/jcr/1.0"&gt;
  &lt;jcr:encoding /&gt;
  &lt;jcr:isCheckedOut /&gt;${cocoon.parameters.QUERY}&lt;/query&gt;</pre>

<p>By adding a query transformer to a sitemap's pipeline match, the completed
query is sent to the repository:</p>

<pre>&lt;map:match pattern="query"&gt;
  &lt;map:generate type="jx" src="querytemplate.xml"&gt;
    &lt;map:parameter name="QUERY" value="{request-param:query}" /&gt;
  &lt;/map:generate&gt;
  &lt;map:transform type="JCRQuery" /&gt;
  &lt;map:serialize type="xml" /&gt;
&lt;/map:match&gt;</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>  &lt;bean name="org.apache.cocoon.transformation.Transformer/JCRQuery"
    class="org.apache.cocoon.jcr.transforming.JCRQueryTransformer"&gt;
    &lt;property name="repo" ref="javax.jcr.Repository" /&gt;
  &lt;/bean&gt;</pre>

</body>
</html>


Fields
======
CocoonComponentReference: Transformer (new field)
CocoonBlock: jcr (new field)
FQ Java class: org.apache.cocoon.jcr.transforming.JCRQueryTransformer (new field)

Mime
View raw message