[SMX4KNL-261]Missing system property replacement in feature configurations

git-svn-id: https://svn.apache.org/repos/asf/servicemix/smx4/kernel/trunk@767353 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/RepositoryImpl.java b/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/RepositoryImpl.java
index 037a96e..485c3d4 100644
--- a/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/RepositoryImpl.java
+++ b/gshell/gshell-features/src/main/java/org/apache/servicemix/kernel/gshell/features/internal/RepositoryImpl.java
@@ -21,10 +21,13 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -119,6 +122,7 @@
                         String data = c.getTextContent();
                         Properties properties = new Properties();
                         properties.load(new ByteArrayInputStream(data.getBytes()));
+                        interpolation(properties);
                         Map<String, String> hashtable = new Hashtable<String, String>();
                         for (Object key : properties.keySet()) {
                             String n = key.toString();
@@ -145,4 +149,20 @@
         }
     }
 
+    protected void interpolation(Properties properties) {
+        for (Enumeration e = properties.propertyNames(); e.hasMoreElements();) {
+            String key = (String)e.nextElement();
+            String val = properties.getProperty(key);
+            Matcher matcher = Pattern.compile("\\$\\{([^}]+)\\}").matcher(val);
+            while (matcher.find()) {
+                String rep = System.getProperty(matcher.group(1));
+                if (rep != null) {
+                    val = val.replace(matcher.group(0), rep);
+                    matcher.reset(val);
+                }
+            }
+            properties.put(key, val);
+        }
+    }
+
 }