You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by wanggang1 <wa...@gmail.com> on 2012/09/29 15:07:51 UTC

camel-veloccity property configuration

Hi,

I would like to config camel-velocity the same way as Apache Velocity, using
property configration like:

*resource.loader=file
file.resource.loader.class=org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path=/tmp/Apache_Velocity/
file.resource.loader.cache=true
file.resource.loader.modificationCheckInterval=5*

I'm most interested in *file.resource.loader.path *and
*file.resource.loader.modificationCheckInterval*.  Is this possible with
camel-veloccity?

Thanks in advance!



--
View this message in context: http://camel.465427.n5.nabble.com/camel-veloccity-property-configuration-tp5720235.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-veloccity property configuration

Posted by wanggang1 <wa...@gmail.com>.
Tried set loaderCache=false and contentCache=false, still could not get the
propertiesFile to work.  

But now I consistently see error "...java.io.FileNotFoundException:
/myfolder/dummy.vm (The system cannot find the file specified)...", not
previouse stated that couid not find file from classpath.  I don't know why
now that "CamelVelocityResourceUri" was not looked at at all.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-veloccity-property-configuration-tp5720235p5720324.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-veloccity property configuration

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Oct 1, 2012 at 5:07 PM, wanggang1 <wa...@gmail.com> wrote:
> Thanks for all your timely replies.
>
> I loaded template file from disk instead from classpath by using URI
> "velocity:file://myfolder/my_template.vm?propertiesFile=velocity/velocity.properties".
> But I have to use the full path to the template file.  I could not seem to
> get the Velocity property "file.resource.loader.path=/myfolder/" in the
> propertiesFile to work.
>

Can you try setting the loaderCache=false and contentCache=false.
http://camel.apache.org/velocity


> The most critical issue to me is that I could not dynamically change the
> template in the runtime if the templates are stored in file system.  I could
> do this dynamic swapping template file when I load templates from classpath
> by setting "CamelVelocityResourceUri" in the Message Header.  If the
> templates are stored in file system, whenever the "CamelVelocityResourceUri"
> header kicks into effect(that's when Camel could not load
> "velocity:file://myfolder/dummy.vm?propertiesFile=velocity/velocity.properties"),
> Camel try to load it from classpath, and "java.io.FileNotFoundException:
> Cannot find resource in classpath for URI: /myfolder/xyz.vm" is thrown.
>
> Is some where my setting not correct?  Please advice.
>
> Thanks
> Gang
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-veloccity-property-configuration-tp5720235p5720314.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: camel-veloccity property configuration

Posted by wanggang1 <wa...@gmail.com>.
Thanks for all your timely replies.

I loaded template file from disk instead from classpath by using URI
"velocity:file://myfolder/my_template.vm?propertiesFile=velocity/velocity.properties". 
But I have to use the full path to the template file.  I could not seem to
get the Velocity property "file.resource.loader.path=/myfolder/" in the
propertiesFile to work.

The most critical issue to me is that I could not dynamically change the
template in the runtime if the templates are stored in file system.  I could
do this dynamic swapping template file when I load templates from classpath
by setting "CamelVelocityResourceUri" in the Message Header.  If the
templates are stored in file system, whenever the "CamelVelocityResourceUri"
header kicks into effect(that's when Camel could not load
"velocity:file://myfolder/dummy.vm?propertiesFile=velocity/velocity.properties"),
Camel try to load it from classpath, and "java.io.FileNotFoundException:
Cannot find resource in classpath for URI: /myfolder/xyz.vm" is thrown.

Is some where my setting not correct?  Please advice.

Thanks
Gang





--
View this message in context: http://camel.465427.n5.nabble.com/camel-veloccity-property-configuration-tp5720235p5720314.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-veloccity property configuration

Posted by Willem jiang <wi...@gmail.com>.
Hi,

Current camel-velocity doesn't support to check the property configuration file periodically, 
It only load it when the camel-velocity endpoint is started, and will not reload it per request.

-- 
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang





On Saturday, September 29, 2012 at 9:36 PM, wanggang1 wrote:

> Hi Claus,
> 
> First, thanks for the reply.
> 
> I overlooked the URI option section, I thought the configuration should be a
> one time thing. Now it brings to another question. Does camel-velocity
> evaluate these options on every request? Let say if content of
> propertiesFile changes camel-velocity will pickup on the next request?
> 
> Thanks!
> Gang
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-veloccity-property-configuration-tp5720235p5720242.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: camel-veloccity property configuration

Posted by wanggang1 <wa...@gmail.com>.
Hi Claus,

First, thanks for the reply.

I overlooked the URI option section, I thought the configuration should be a
one time thing.  Now it brings to another question.  Does camel-velocity
evaluate these options on every request?  Let say if content of
propertiesFile changes camel-velocity will pickup on the next request?

Thanks!
Gang



--
View this message in context: http://camel.465427.n5.nabble.com/camel-veloccity-property-configuration-tp5720235p5720242.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-veloccity property configuration

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Have you read the documentation? There is a properties file option.
http://camel.apache.org/velocity

I would assume its what you are looking for.


On Sat, Sep 29, 2012 at 3:07 PM, wanggang1 <wa...@gmail.com> wrote:
> Hi,
>
> I would like to config camel-velocity the same way as Apache Velocity, using
> property configration like:
>
> *resource.loader=file
> file.resource.loader.class=org.apache.velocity.runtime.resource.loader.FileResourceLoader
> file.resource.loader.path=/tmp/Apache_Velocity/
> file.resource.loader.cache=true
> file.resource.loader.modificationCheckInterval=5*
>
> I'm most interested in *file.resource.loader.path *and
> *file.resource.loader.modificationCheckInterval*.  Is this possible with
> camel-veloccity?
>
> Thanks in advance!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-veloccity-property-configuration-tp5720235.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen