camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregor Zurowski <gre...@zurowski.org>
Subject Re: Camel JCR examples?
Date Thu, 05 Jun 2014 03:30:12 GMT
Hi Vivek:

>         from
> ("jcr://admin:admin@repository/default/b").setHeader(JcrConstants.JCR_OPERATION,
> constant(JcrConstants.JCR_GET_BY_ID))
>         .setBody(constant("modeshape_logo.jpg")).to("stream:out");

As described in my previous post, the current camel-jcr consumer
implements an event listener. Therefore, you cannot use the consumer
(as in your "from" DSL method) to query the repository for specific
nodes. Although the producer supports this using the CamelJcrGetById
operation, it expects node identifiers (UUIDs) instead of node names
(see http://camel.apache.org/jcr.html).

To implement your use case, you would probably need some query
functionality that currently does not exist in camel-jcr. Please feel
free to log a JIRA ticket to request this for a future Camel release.

In the meantime, you could mount the Jackrabbit repository as a WebDAV
share and treat it like a regular path in your local file system. Then
you could use the File2 component
(https://camel.apache.org/file2.html) to copy files from the WebDAV
share to another path. To mount the repository using Linux, you can
use the following command (note that you must have the davfs2 package
installed):

$ sudo mount -t davfs http://localhost:8080/repository/default /target/path

Please let us know if you have any further questions.

Gregor


On Tue, Jun 3, 2014 at 11:26 AM, vivekrao001 <vivekrao001@gmail.com> wrote:
> Hi Gregor,
>
> I'm trying to copy all the files (nt:file) under a node. And i'm not waiting
> for lsiterner to listen. I need to copy all the files when ever needed.
>
> I couldn't get the exact syntax anywhere. It would be great help, if you
> give me some direction.
>
> I'm trying with the following syntax to get a jpeg file
>
> ---
>  <bean id="repository"
> class="org.apache.jackrabbit.rmi.repository.URLRemoteRepository">
>          <constructor-arg
> value="http://localhost:8080/jackrabbit-webapp-2.6.0/rmi"/>
>     </bean>
> -----
> ApplicationContext Appcontext = new
> ClassPathXmlApplicationContext("springContext.xml");
>  CamelContext context = SpringCamelContext.springCamelContext(Appcontext);
>     context.addRoutes(new RouteBuilder()
>       {
>       public void configure()
>         {
>         // Set up the route — from the intput directory, to
>
>
>         from
> ("jcr://admin:admin@repository/default/b").setHeader(JcrConstants.JCR_OPERATION,
> constant(JcrConstants.JCR_GET_BY_ID))
>         .setBody(constant("modeshape_logo.jpg")).to("stream:out");
>
>          //from
> ("jcr://admin:admin@repository/default/b").setHeader(JcrConstants.JCR_OPERATION,
> constant(JcrConstants.JCR_GET_BY_ID))
>         //.setBody(constant("modeshape_logo.jpg")).to("file:\\tmp\\out");
>
>         }
>       });
>     //
>     // Start the Camel route
>     context.start();
> ----
> with Node path : /b/b
> and properties :
> {
>         "jcr:createdBy" : "admin",
>         "jcr:created" : "2014-06-02T16:50:07.770-05:00",
>         "jcr:primaryType" : "nt:folder",
>         "modeshape_logo.jpg" : {
>                 "jcr:createdBy" : "admin",
>                 "jcr:created" : "2014-06-02T16:50:07.772-05:00",
>                 "jcr:primaryType" : "nt:file",
>                 "jcr:content" : {
>                         "jcr:lastModifiedBy" : "admin",
>                         "jcr:uuid" : "1eac10e8-f245-4148-bc90-9a01727adba0",
>                         "jcr:lastModified" : "2014-06-02T16:50:07.773-05:00",
>                         "jcr:primaryType" : "nt:resource"
>                 }
>         }
> }
>
> -------
>
> Thanks,
> Vivek.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-JCR-examples-tp5746406p5751848.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message