Re: dynamic property access

2004-11-01 Thread Ben Anderson
Thanks Alex - that works!  However, I've realized I don't really need to do
this.  If anyone cares, here's my resolution that lets me add tokens to
property files dynamically w/out requiring a change in my maven.xml.  Nothing
special here - I just think it's pretty neat.

  
.${env}

  
  


  

  
${prop.key.substring(0, prop.key.indexOf(envDir))}
  
  


  

  

  

  


environment.properties
--
server.name.qa=myQABox
server.name.prod=myProdBox
server.port=80

Some properties file to be filtered
---
[EMAIL PROTECTED]@
[EMAIL PROTECTED]

now I can run:
maven -Denv=qa|prod someGoal

-Ben


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: dynamic property access

2004-10-30 Thread Alex Karasulu
Alex Karasulu wrote:
Ben Anderson wrote:
Hi,
I want to dynamically set which property I access.  Is this possible? 
Obviously the below code won't work, but you get the idea.  I thought
maybe that the  tag might help, but it doesn't seem to do
anything.

   
   
   
   ${${colorKey}}
   
Any ideas?
 

Maybe if I'm right hehe - try this and if it makes things work:

or rather this would return "red":

${context.getVariable(colorKey)}

You could chain these calls too in the JEXL expression too if you had 
multiple levels of indirection.

Well guess it does not fit exactly this example which you point out 
further down in this thread.  However I'm thinking what you want to do 
is dynamically assemble a key value by resolving anther key.  I do 
this for properties that associate values of an object like so:

a.b.c.name=someobj
a.b.c.class=CLI
a.b.c.package=org.apache.maven
a.b.c.interfaces=.
You know I totally messed this up here are the correct property keys i 
was refering to above:

a.b.c.name=someobj
a.b.c.class.somebody=CLI
a.b.c.package.somebody=org.apache.maven
a.b.c.interfaces.somebody=.
I assemble these keys and look up their respective values using this 
technique.

Cheers,
Alex
Thanks,
Ben
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: dynamic property access

2004-10-30 Thread Alex Karasulu
Ben Anderson wrote:
Hi,
I want to dynamically set which property I access.  Is this possible? 
Obviously the below code won't work, but you get the idea.  I thought
maybe that the  tag might help, but it doesn't seem to do
anything.

   
   
   
   ${${colorKey}}
   
Any ideas?
 

Maybe if I'm right hehe - try this and if it makes things work:

or rather this would return "red":

${context.getVariable(colorKey)}

You could chain these calls too in the JEXL expression too if you had 
multiple levels of indirection.

Well guess it does not fit exactly this example which you point out 
further down in this thread.  However I'm thinking what you want to do 
is dynamically assemble a key value by resolving anther key.  I do this 
for properties that associate values of an object like so:

a.b.c.name=someobj
a.b.c.class=CLI
a.b.c.package=org.apache.maven
a.b.c.interfaces=.
I assemble these keys and look up their respective values using this 
technique.

Cheers,
Alex
Thanks,
Ben
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: dynamic property access

2004-10-29 Thread Brett Porter



or



I'm not 100% certain the latter works.

- Brett

On Fri, 29 Oct 2004 14:17:46 -0400, Eric Giguere
<[EMAIL PROTECTED]> wrote:
> Ah, I see
> 
> I'm not sure if this is feasible...
> One thing sure, you cannot put an expression in an expression (
> ${...${}}. It just does not work with jelly.
> I've done a couple of tests with dynamic property names without success.
> 
> Eric.
> 
> 
> 
> 
> Ben Anderson wrote:
> 
> >yes, that's a solution for the example I gave, but not what I'm looking for.
> >Let me give the real example:
> >
> >config.properties
> >-
> >servername.qa=qaServer
> >servername.prod=prodServer
> >
> >maven.xml
> >-
> >
> >
> >   >tofile="${build.dir}/WEB-INF/web.xml"
> >overwrite="true">
> >
> >  
> >
> >
> >actually, this is probably a bit much.  Is there a way to solve the original
> >example w/out modifying the  tags?
> >
> >Thanks,
> >Ben
> >
> >Quoting Eric Giguere <[EMAIL PROTECTED]>:
> >
> >
> >
> >>Hello Ben
> >>Yep, try this:
> >>
> >>
> >>
> >>
> >>${colorKey}
> >>
> >>
> >>
> >>Hope it helps
> >>Eric.
> >>
> >>Ben Anderson wrote:
> >>
> >>
> >>
> >>>Hi,
> >>>I want to dynamically set which property I access.  Is this possible?
> >>>Obviously the below code won't work, but you get the idea.  I thought
> >>>maybe that the  tag might help, but it doesn't seem to do
> >>>anything.
> >>>
> >>>   
> >>>   
> >>>   
> >>>   ${${colorKey}}
> >>>   
> >>>
> >>>Any ideas?
> >>>
> >>>Thanks,
> >>>Ben
> >>>
> >>>-
> >>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>-
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> 
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: dynamic property access

2004-10-29 Thread Eric Giguere
Ah, I see
I'm not sure if this is feasible...
One thing sure, you cannot put an expression in an expression ( 
${...${}}. It just does not work with jelly.
I've done a couple of tests with dynamic property names without success.

Eric.
Ben Anderson wrote:
yes, that's a solution for the example I gave, but not what I'm looking for. 
Let me give the real example:

config.properties
-
servername.qa=qaServer
servername.prod=prodServer
maven.xml
-


 
   
 
actually, this is probably a bit much.  Is there a way to solve the original
example w/out modifying the  tags?
Thanks,
Ben
Quoting Eric Giguere <[EMAIL PROTECTED]>:
 

Hello Ben
Yep, try this:
   
   
   
   ${colorKey}
   
Hope it helps
Eric.
Ben Anderson wrote:
   

Hi,
I want to dynamically set which property I access.  Is this possible?
Obviously the below code won't work, but you get the idea.  I thought
maybe that the  tag might help, but it doesn't seem to do
anything.
  
  
  
  ${${colorKey}}
  
Any ideas?
Thanks,
Ben
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: dynamic property access

2004-10-29 Thread Ben Anderson
yes, that's a solution for the example I gave, but not what I'm looking for. 
Let me give the real example:

config.properties
-
servername.qa=qaServer
servername.prod=prodServer

maven.xml
-


  

  


actually, this is probably a bit much.  Is there a way to solve the original
example w/out modifying the  tags?

Thanks,
Ben

Quoting Eric Giguere <[EMAIL PROTECTED]>:

> Hello Ben
> Yep, try this:
>
> 
> 
> 
> ${colorKey}
> 
>
>
> Hope it helps
> Eric.
>
> Ben Anderson wrote:
>
> >Hi,
> >I want to dynamically set which property I access.  Is this possible?
> >Obviously the below code won't work, but you get the idea.  I thought
> >maybe that the  tag might help, but it doesn't seem to do
> >anything.
> >
> >
> >
> >
> >${${colorKey}}
> >
> >
> >Any ideas?
> >
> >Thanks,
> >Ben
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: dynamic property access

2004-10-29 Thread Eric Giguere
Hello Ben
Yep, try this:
   
   
   
   ${colorKey}
   
Hope it helps
Eric.
Ben Anderson wrote:
Hi,
I want to dynamically set which property I access.  Is this possible? 
Obviously the below code won't work, but you get the idea.  I thought
maybe that the  tag might help, but it doesn't seem to do
anything.

   
   
   
   ${${colorKey}}
   
Any ideas?
Thanks,
Ben
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


dynamic property access

2004-10-29 Thread Ben Anderson
Hi,
I want to dynamically set which property I access.  Is this possible? 
Obviously the below code won't work, but you get the idea.  I thought
maybe that the  tag might help, but it doesn't seem to do
anything.




${${colorKey}}


Any ideas?

Thanks,
Ben

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]