You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ychawla <pr...@yahoo.com> on 2010/02/24 18:24:30 UTC

Environment Variables using Simple language

Hello All,
I was unable to get the simple language to read from my environment
variables in Windows.  I did find a workaround for this that might be
helpful.  I use the Spring property place holder configurer which I believe
has more functionality in Camel 2.3.

Here is my workaround.  I wanted to test an windows ENV variable in a simple
test so I created a bean like this:

       <context:property-placeholder/>

	<bean id="monitorApps" class="java.lang.String">
		<constructor-arg><value>${MONITOR}</value></constructor-arg>
	</bean>

and then was able to use it in tests like this:

<simple>${bean:monitorApps.trim} == 'true'</simple>

I was unable to get syntax like this to work:

<simple>${sys.monitorApps} == 'true'</simple>

Hopefully this will help someone out who is looking to do something similar. 

Cheers,
Yogesh

I was unable to get <simple>${bean:monitorApps.trim} == 'true'</simple>
-- 
View this message in context: http://old.nabble.com/Environment-Variables-using-Simple-language-tp27714257p27714257.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Environment Variables using Simple language

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

Thanks for sharing.
Let me take a look at this to see if there is a bug in there.


On Wed, Feb 24, 2010 at 6:24 PM, ychawla <pr...@yahoo.com> wrote:
>
> Hello All,
> I was unable to get the simple language to read from my environment
> variables in Windows.  I did find a workaround for this that might be
> helpful.  I use the Spring property place holder configurer which I believe
> has more functionality in Camel 2.3.
>
> Here is my workaround.  I wanted to test an windows ENV variable in a simple
> test so I created a bean like this:
>
>       <context:property-placeholder/>
>
>        <bean id="monitorApps" class="java.lang.String">
>                <constructor-arg><value>${MONITOR}</value></constructor-arg>
>        </bean>
>
> and then was able to use it in tests like this:
>
> <simple>${bean:monitorApps.trim} == 'true'</simple>
>
> I was unable to get syntax like this to work:
>
> <simple>${sys.monitorApps} == 'true'</simple>
>
> Hopefully this will help someone out who is looking to do something similar.
>
> Cheers,
> Yogesh
>
> I was unable to get <simple>${bean:monitorApps.trim} == 'true'</simple>
> --
> View this message in context: http://old.nabble.com/Environment-Variables-using-Simple-language-tp27714257p27714257.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Environment Variables using Simple language

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

Ticket created
https://issues.apache.org/activemq/browse/CAMEL-2503

And the new feature has been implemented.
You can now use sysenv to refer to a system environment variable.


On Fri, Feb 26, 2010 at 2:05 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Ah sys in simple language is JVM System Properties, eg the one you have -D with.
> What you want is the OS environment variables, eg like JAVA_HOME etc.
>
> I will crete a ticket to add sysenv to the simple language.
>
>
>
> On Wed, Feb 24, 2010 at 6:24 PM, ychawla <pr...@yahoo.com> wrote:
>>
>> Hello All,
>> I was unable to get the simple language to read from my environment
>> variables in Windows.  I did find a workaround for this that might be
>> helpful.  I use the Spring property place holder configurer which I believe
>> has more functionality in Camel 2.3.
>>
>> Here is my workaround.  I wanted to test an windows ENV variable in a simple
>> test so I created a bean like this:
>>
>>       <context:property-placeholder/>
>>
>>        <bean id="monitorApps" class="java.lang.String">
>>                <constructor-arg><value>${MONITOR}</value></constructor-arg>
>>        </bean>
>>
>> and then was able to use it in tests like this:
>>
>> <simple>${bean:monitorApps.trim} == 'true'</simple>
>>
>> I was unable to get syntax like this to work:
>>
>> <simple>${sys.monitorApps} == 'true'</simple>
>>
>> Hopefully this will help someone out who is looking to do something similar.
>>
>> Cheers,
>> Yogesh
>>
>> I was unable to get <simple>${bean:monitorApps.trim} == 'true'</simple>
>> --
>> View this message in context: http://old.nabble.com/Environment-Variables-using-Simple-language-tp27714257p27714257.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Environment Variables using Simple language

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

Ah sys in simple language is JVM System Properties, eg the one you have -D with.
What you want is the OS environment variables, eg like JAVA_HOME etc.

I will crete a ticket to add sysenv to the simple language.



On Wed, Feb 24, 2010 at 6:24 PM, ychawla <pr...@yahoo.com> wrote:
>
> Hello All,
> I was unable to get the simple language to read from my environment
> variables in Windows.  I did find a workaround for this that might be
> helpful.  I use the Spring property place holder configurer which I believe
> has more functionality in Camel 2.3.
>
> Here is my workaround.  I wanted to test an windows ENV variable in a simple
> test so I created a bean like this:
>
>       <context:property-placeholder/>
>
>        <bean id="monitorApps" class="java.lang.String">
>                <constructor-arg><value>${MONITOR}</value></constructor-arg>
>        </bean>
>
> and then was able to use it in tests like this:
>
> <simple>${bean:monitorApps.trim} == 'true'</simple>
>
> I was unable to get syntax like this to work:
>
> <simple>${sys.monitorApps} == 'true'</simple>
>
> Hopefully this will help someone out who is looking to do something similar.
>
> Cheers,
> Yogesh
>
> I was unable to get <simple>${bean:monitorApps.trim} == 'true'</simple>
> --
> View this message in context: http://old.nabble.com/Environment-Variables-using-Simple-language-tp27714257p27714257.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus