The Camel property placeholder / component
http://camel.apache.org/using-propertyplaceholder.html

is not the same as context.getProperties. The latter is seldom used
but allows configuring arbitrary options that can be retrieved from
the context. Though there is only a few options usually to set some
logging restrictions or max cache sizes on templates.

As its just java code, then you can just use string concat to set the
decrypted password.
For example you can use String.format placeholders, and have %s in the uri

source.endpoint.1=ftp://${user.name}:%s@xxxxxx//echange/MassPayment/IN/?noop=false&initialDelay=0&idempotent=true&stepwise=false

And then use fromF to pass in the password

.fromF("{{source.endpoint.1}}", decryptedPwd);



On Fri, Nov 29, 2013 at 6:16 PM, anakin59490 <jerome.duboi...@voila.fr> wrote:
> Hi,
>
> I wrote this route :
>
> @Component
> public class MassPaymentInRoute extends SpringRouteBuilder {
>     @Value("${user.password}")
>     String cryptedPwd;
>
>     String decryptedPwd;
>
>     @Override
>            public void configure() {
>
>
>               Cipher cs = new Cipher();
>                try {
>                         decryptedPwd = cs.decrypt(cryptedPwd);
>                         getContext().getProperties().put("*decPwd*", 
> decryptedPwd);
>
>                         // getContext().
>                 } catch (Exception e) {
>                         // TODO Auto-generated catch block
>                         e.printStackTrace();
>                 }
>
>             .from("{{source.endpoint.1}}")
> etc.....
>
>
> The value {{source.endpoint.1}} is defined in a properties file :
>
> source.endpoint.1=ftp://${user.name}:${properties:{{decPwd}}@xxxxxx//echange/MassPayment/IN/?noop=false&initialDelay=0&idempotent=true&stepwise=false
>
>
>
> but when i run it , i get this message :
> "Property with key [decPwd] not found in properties from text"
>
>
> I also try to use the function decrypt directly in the properties file, like
> this :
> source.endpoint.1=ftp://${user.name}:#{cipher.decrypt('${user.password}')}@xxxxxx//echange/MassPayment/IN/?noop=false&initialDelay=0&idempotent=true&stepwise=false
>
> cipher is defined in the camel context
>
> but it doesn't work...
>
>
> What is the best way to get my password decrypted ?
>
> thank's in advance
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/set-property-before-starting-tp5744088.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to