2 Replies Latest reply on Sep 15, 2012 4:02 PM by Guillaume Grossetie

    [Proposal] Resolve expression values on system properties

    Guillaume Grossetie Newbie



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


      Example :

              <property name="my.image.dir" value="${jboss.server.data.dir}/image"/>


      Sure I can do the work on my code but I don't want to reference jboss system property :

              <property name="my.image.dir" value="image"/>
      System.getProperty("jboss.server.data.dir") + "/" + System.getProperty("my.image.dir");


      If we use StringPropertyReplacer we can also do sometthing like :

              <property name="my.dir" value="/my/dir"/>
              <property name="my.image.dir" value="${my.dir:/home}/image"/>


      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 ?