You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by anakin59490 <je...@voila.fr> on 2013/02/13 12:17:23 UTC

How add a property ?

hello,

I would like to add a property in the file which is defined in my
camelContext :

<propertyPlaceholder id="properties" 
             
location="classpath:META-INF/camel/configuration_dev.properties,classpath:META-INF/camel/filtersDefinition_dev.properties"/>

In my filtersDefinition_dev.properties file, i wrote :
sepa.splitter=test

and i would like to add a new property : sepa.splitter2=test2

I try to do that in a bean :

@Resource(name="properties")
protected CamelPropertyPlaceholderDefinition filters;


but i don't find the equivalent of setProperty (java.util.Properties)
method.


Why do i want to add it in filterDefinition_dev.properties ?

Because i would like to use this new property in a camel route like this :

from("direct:transformXML")
     .beanRef("myClass", "myMethod")  -> create the new property
(sepa.splitter2=test2) 
     .split().tokenizeXML("{{sepa.splitter2}"}


I don't find example on the web

Can you help me ?












--
View this message in context: http://camel.465427.n5.nabble.com/How-add-a-property-tp5727488.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How add a property ?

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Feb 13, 2013 at 12:17 PM, anakin59490 <je...@voila.fr> wrote:
> hello,
>
> I would like to add a property in the file which is defined in my
> camelContext :
>

So you want to add a property to a file? And you cannot just do that
by opening the file in an editor and add the text?
If not you can use Java API to append to the file.

If you use camel-test kit you can use the function -
useOverridePropertiesWithPropertiesComponent - to add the property
from your unit test source code. See more details at the following
links
http://camel.apache.org/camel-test.html
http://camel.apache.org/properties.html


> <propertyPlaceholder id="properties"
>
> location="classpath:META-INF/camel/configuration_dev.properties,classpath:META-INF/camel/filtersDefinition_dev.properties"/>
>
> In my filtersDefinition_dev.properties file, i wrote :
> sepa.splitter=test
>
> and i would like to add a new property : sepa.splitter2=test2
>
> I try to do that in a bean :
>
> @Resource(name="properties")
> protected CamelPropertyPlaceholderDefinition filters;
>
>
> but i don't find the equivalent of setProperty (java.util.Properties)
> method.
>
>
> Why do i want to add it in filterDefinition_dev.properties ?
>
> Because i would like to use this new property in a camel route like this :
>
> from("direct:transformXML")
>      .beanRef("myClass", "myMethod")  -> create the new property
> (sepa.splitter2=test2)
>      .split().tokenizeXML("{{sepa.splitter2}"}
>
>
> I don't find example on the web
>
> Can you help me ?
>
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-add-a-property-tp5727488.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