You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ron (JIRA)" <ji...@apache.org> on 2009/09/06 10:06:57 UTC

[jira] Created: (CONFIGURATION-395) groovy for interpolation and expression engine

groovy for interpolation and expression engine
----------------------------------------------

                 Key: CONFIGURATION-395
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-395
             Project: Commons Configuration
          Issue Type: Improvement
          Components: Expression engine, Interpolation
            Reporter: ron
            Priority: Minor


Currently the expression engine can be set but not the interpolation.
This patch proposes the ability to set a user specified interpolation engine.
It includes a groovy interpolation engine. Groovy comes naturally as an expressions and interpolation language in the java environment

API usage:

		AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
		c.setInterpolator(new GInterpolator(c));
		System.out.println(c.getString("test"));

Configuration examples:

library.path.1=${ if  ("${System.getProperty{('os.name')}".toLowerCase().startsWith("windows")) "libw.dll"; else "libl" }
password=${println 'enter password'; readln}

I think that this is more feature rich than JEXL and is easier to use for java programmers.

- Ron


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CONFIGURATION-395) groovy for interpolation and expression engine

Posted by "ron (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ron updated CONFIGURATION-395:
------------------------------

    Attachment: GInterpolator.java
                ConfigurationBinding.java
                AbstractConfiguration.patch

> groovy for interpolation and expression engine
> ----------------------------------------------
>
>                 Key: CONFIGURATION-395
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-395
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: Expression engine, Interpolation
>            Reporter: ron
>            Priority: Minor
>         Attachments: AbstractConfiguration.patch, ConfigurationBinding.java, GInterpolator.java
>
>
> Currently the expression engine can be set but not the interpolation.
> This patch proposes the ability to set a user specified interpolation engine.
> It includes a groovy interpolation engine. Groovy comes naturally as an expressions and interpolation language in the java environment
> API usage:
> 		AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
> 		c.setInterpolator(new GInterpolator(c));
> 		System.out.println(c.getString("test"));
> Configuration examples:
> library.path.1=${ if  ("${System.getProperty{('os.name')}".toLowerCase().startsWith("windows")) "libw.dll"; else "libl" }
> password=${println 'enter password'; readln}
> I think that this is more feature rich than JEXL and is easier to use for java programmers.
> - Ron

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CONFIGURATION-395) groovy for interpolation and expression engine

Posted by "ron (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ron updated CONFIGURATION-395:
------------------------------

    Attachment: GInterpolator.java

> groovy for interpolation and expression engine
> ----------------------------------------------
>
>                 Key: CONFIGURATION-395
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-395
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: Expression engine, Interpolation
>            Reporter: ron
>            Priority: Minor
>         Attachments: AbstractConfiguration.patch, ConfigurationBinding.java, GInterpolator.java, GInterpolator.java, Interpolator.java
>
>
> Currently the expression engine can be set but not the interpolation.
> This patch proposes the ability to set a user specified interpolation engine.
> It includes a groovy interpolation engine. Groovy comes naturally as an expressions and interpolation language in the java environment
> API usage:
> 		AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
> 		c.setInterpolator(new GInterpolator(c));
> 		System.out.println(c.getString("test"));
> Configuration examples:
> library.path.1=${ if  ("${System.getProperty{('os.name')}".toLowerCase().startsWith("windows")) "libw.dll"; else "libl" }
> password=${println 'enter password'; readln}
> I think that this is more feature rich than JEXL and is easier to use for java programmers.
> - Ron

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CONFIGURATION-395) groovy for interpolation and expression engine

Posted by "ron (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ron updated CONFIGURATION-395:
------------------------------

    Attachment: Interpolator.java

> groovy for interpolation and expression engine
> ----------------------------------------------
>
>                 Key: CONFIGURATION-395
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-395
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: Expression engine, Interpolation
>            Reporter: ron
>            Priority: Minor
>         Attachments: AbstractConfiguration.patch, ConfigurationBinding.java, GInterpolator.java, Interpolator.java
>
>
> Currently the expression engine can be set but not the interpolation.
> This patch proposes the ability to set a user specified interpolation engine.
> It includes a groovy interpolation engine. Groovy comes naturally as an expressions and interpolation language in the java environment
> API usage:
> 		AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
> 		c.setInterpolator(new GInterpolator(c));
> 		System.out.println(c.getString("test"));
> Configuration examples:
> library.path.1=${ if  ("${System.getProperty{('os.name')}".toLowerCase().startsWith("windows")) "libw.dll"; else "libl" }
> password=${println 'enter password'; readln}
> I think that this is more feature rich than JEXL and is easier to use for java programmers.
> - Ron

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CONFIGURATION-395) groovy for interpolation and expression engine

Posted by "ron (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ron updated CONFIGURATION-395:
------------------------------

    Attachment:     (was: GInterpolator.java)

> groovy for interpolation and expression engine
> ----------------------------------------------
>
>                 Key: CONFIGURATION-395
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-395
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: Expression engine, Interpolation
>            Reporter: ron
>            Priority: Minor
>         Attachments: AbstractConfiguration.patch, ConfigurationBinding.java, GInterpolator.java, Interpolator.java
>
>
> Currently the expression engine can be set but not the interpolation.
> This patch proposes the ability to set a user specified interpolation engine.
> It includes a groovy interpolation engine. Groovy comes naturally as an expressions and interpolation language in the java environment
> API usage:
> 		AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
> 		c.setInterpolator(new GInterpolator(c));
> 		System.out.println(c.getString("test"));
> Configuration examples:
> library.path.1=${ if  ("${System.getProperty{('os.name')}".toLowerCase().startsWith("windows")) "libw.dll"; else "libl" }
> password=${println 'enter password'; readln}
> I think that this is more feature rich than JEXL and is easier to use for java programmers.
> - Ron

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CONFIGURATION-395) groovy for interpolation and expression engine

Posted by "ron (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ron updated CONFIGURATION-395:
------------------------------

    Description: 
Currently the expression engine can be set but not the interpolation.
This patch proposes the ability to set a user specified interpolation engine.
It includes a groovy interpolation engine. Groovy comes naturally as an expressions and interpolation language in the java environment

API usage:

		AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
		c.setInterpolator(new GInterpolator(c));
		System.out.println(c.getString("test"));

Configuration examples:

library.path.1=${ if  ("${System.getProperty{('os.name')}".toLowerCase().startsWith("windows")) "libw.dll"; else "libl" }
password=${println 'enter password'; readln}

I think that this is more feature rich than JEXL and is easier to use for java programmers.

- Ron




  was:
Currently the expression engine can be set but not the interpolation.
This patch proposes the ability to set a user specified interpolation engine.
It includes a groovy interpolation engine. Groovy comes naturally as an expressions and interpolation language in the java environment

API usage:

		AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
		c.setInterpolator(new GInterpolator(c));
		System.out.println(c.getString("test"));

Configuration examples:

library.path.1=${ if  ("${System.getProperty{('os.name')}".toLowerCase().startsWith("windows")) "libw.dll"; else "libl" }
password=${println 'enter password'; readln}

I think that this is more feature rich than JEXL and is easier to use for java programmers.

- Ron



PS: I have added some more features:

I have extended this to enable caching and add custom imports.
thus in the example below query(..) will be executed only once.
custom imports can be predefined, so that they do not have to be included in the configuration.

API:

AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
c.setInterpolator(new GInterpolator(c, true, new String[]{"util.Utils"}));
System.out.println(c.getString("password"));
System.out.println(c.getString("password"));

configuration example:

password=${Utils.query('enter password')}


> groovy for interpolation and expression engine
> ----------------------------------------------
>
>                 Key: CONFIGURATION-395
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-395
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: Expression engine, Interpolation
>            Reporter: ron
>            Priority: Minor
>         Attachments: AbstractConfiguration.patch, ConfigurationBinding.java, GInterpolator.java, GInterpolator.java, Interpolator.java
>
>
> Currently the expression engine can be set but not the interpolation.
> This patch proposes the ability to set a user specified interpolation engine.
> It includes a groovy interpolation engine. Groovy comes naturally as an expressions and interpolation language in the java environment
> API usage:
> 		AbstractConfiguration c = new PropertiesConfiguration("conf/test.conf");
> 		c.setInterpolator(new GInterpolator(c));
> 		System.out.println(c.getString("test"));
> Configuration examples:
> library.path.1=${ if  ("${System.getProperty{('os.name')}".toLowerCase().startsWith("windows")) "libw.dll"; else "libl" }
> password=${println 'enter password'; readln}
> I think that this is more feature rich than JEXL and is easier to use for java programmers.
> - Ron

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.