[jboss-dev-forums] [JBoss AS 7 Development] - [Proposal] Resolve expression values on system properties

Guillaume Grossetie do-not-reply at jboss.com
Sat Sep 15 09:21:06 EDT 2012


Guillaume Grossetie [https://community.jboss.org/people/grossetieg] created the discussion

"[Proposal] Resolve expression values on system properties"

To view the discussion, visit: https://community.jboss.org/message/759709#759709

--------------------------------------------------------------
Hi,

The StringPropertyReplacer class already provide a method #replaceProperties that replace ${expression} value with system properties. I think that it can be useful to resolve expression on system properties with system properties.

Example :
    <system-properties>
        <property name="my.image.dir" value="${jboss.server.data.dir}/image"/>
    </system-properties>


Sure I can do the work on my code but I don't want to reference jboss system property :
    <system-properties>
        <property name="my.image.dir" value="image"/>
    </system-properties>
 
System.getProperty("jboss.server.data.dir") + "/" + System.getProperty("my.image.dir");


If we use StringPropertyReplacer we can also do sometthing like :
    <system-properties>
        <property name="my.dir" value="/my/dir"/>
        <property name="my.image.dir" value="${my.dir:/home}/image"/>
    </system-properties>


The basic idea is to check if the added/removed/changed system property resolve expression :
setSystemProperty("my.image.dir", "${jboss.server.data.dir}/image");
# my.image.dir = "${jboss.server.data.dir}/image"
 
setSystemProperty("jboss.server.data.dir", "/opt/jboss");
# retrieve my.image.dir property, resolve expression and setSystemProperty("my.image.dir", "/opt/jboss/image");
# my.image.dir = /opt/jboss/image


The resolved expression will not be stored on the standalone.xml/domain.xml file.

What do you think ?

Guillaume.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/759709#759709]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120915/c700dbc6/attachment.html 


More information about the jboss-dev-forums mailing list