You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Ted Kirby (JIRA)" <ji...@apache.org> on 2007/01/25 15:03:49 UTC

[jira] Updated: (GERONIMO-2735) Add property substitution capability in the config.xml and plan files

     [ https://issues.apache.org/jira/browse/GERONIMO-2735?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ted Kirby updated GERONIMO-2735:
--------------------------------

    Attachment: JIRA2735.1.1.1.patch

Here is a patch for 1.1.1 based on Rev447393 code.

Here is the approach, from dev list discussion:

Substitution is performed by the new substituteVariables method of GBeanOverride, which is invoked in setAttribute.  Any values with substituted text are saved in a new unsubstitutedAttribute Map.  These raw, unsubstituted values are then saved to config.xml by a change in writeXML.

Support for a properties file is added in LocalAttributeManager.  A propertiesFile attribute is added to this GBean.  It works like configFile, relative to GERONIMO_HOME.  The default properties file name is var/config/geronimo.properties, set in the j2ee-system module, like config.xml. 

The substitution value hierarchy, as specified in the new GBeanOverride. getVariableValue method, is:
1.	system properties
2.	environment variables
3.	properties file

Nested/indirect variables, such as ${var{$number}},  are not supported, but would make for an interesting enhancement.

GBeanOverride.substituteVariables uses a static LocalAttributeManager.getProperty() method to interrogate the properties loaded from the properties file.  I think this is a bit of hack, and solicit input on a better approach.  I supposed a reference could be passed in through ServerOverride and ConfigurationOverride.

I will now port this work to AG20, and post a patch for it subsequently.


> Add property substitution capability in the config.xml and plan files
> ---------------------------------------------------------------------
>
>                 Key: GERONIMO-2735
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-2735
>             Project: Geronimo
>          Issue Type: New Feature
>      Security Level: public(Regular issues) 
>    Affects Versions: 1.1.1, 1.1.x, 2.0-M1
>         Environment: All
>            Reporter: Ted Kirby
>            Priority: Minor
>         Attachments: JIRA2735.1.1.1.patch
>
>
> Allow property substitution as it works in maven, Spring, and JBoss.
> Allow a geronimo.properties type file.  In that file, allow something like this:
> tomcat.port=9090
> tomcat.listen.ip=10.0.0.7
> In the config.xml, then allow the following:
> ...
> <module name="...">
>     <gbean name="TomcatConnector">
>         <attribute name="port">${tomcat.port}</attribute>
>         <attribute name="host">${tomcat.listen.ip}</attribute>
>    </gbean>
> </module>
> The server reads the property file on boot (if one exists).  When the config.xml is processed, it substitutes the declared property.
> Properties might also come from a GBean.

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