karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [2/3] git commit: [KARAF-2776] Startup bundles are installed our of order Use felix/karaf Properties instead of the java.util one in Main to keep the order of bundles
Date Thu, 06 Mar 2014 09:08:25 GMT
[KARAF-2776] Startup bundles are installed our of order
Use felix/karaf Properties instead of the java.util one in Main to keep the order of bundles


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/9a1909bc
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/9a1909bc
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/9a1909bc

Branch: refs/heads/karaf-3.0.x
Commit: 9a1909bc24ebf0b0f240257fd65ff308f92a0495
Parents: c9d5de0
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Fri Feb 21 18:09:41 2014 +0100
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Thu Mar 6 09:55:28 2014 +0100

----------------------------------------------------------------------
 .../core/internal/InstanceServiceImpl.java      |  20 +--
 .../org/apache/karaf/main/ConfigProperties.java |   2 +-
 .../org/apache/karaf/main/InstanceHelper.java   |   4 +-
 .../main/java/org/apache/karaf/main/Main.java   |   6 +-
 .../org/apache/karaf/main/PropertiesLoader.java |  32 ++---
 .../apache/karaf/main/lock/DefaultJDBCLock.java |   2 +-
 .../apache/karaf/main/lock/DerbyJDBCLock.java   |   2 +-
 .../apache/karaf/main/lock/GenericJDBCLock.java |   2 +-
 .../org/apache/karaf/main/lock/LockFactory.java |   2 +-
 .../apache/karaf/main/lock/MySQLJDBCLock.java   |   2 +-
 .../apache/karaf/main/lock/OracleJDBCLock.java  |   2 +-
 .../karaf/main/lock/PostgreSQLJDBCLock.java     |   2 +-
 .../karaf/main/lock/SQLServerJDBCLock.java      |   2 +-
 .../apache/karaf/main/lock/SimpleFileLock.java  |   2 +-
 .../karaf/main/util/BootstrapLogManager.java    |   6 +-
 .../org/apache/karaf/main/util/SubstHelper.java | 141 -------------------
 .../java/org/apache/karaf/main/MockLock.java    |   2 +-
 .../main/lock/BaseJDBCLockIntegrationTest.java  |   2 +-
 .../karaf/main/lock/BaseJDBCLockTest.java       |   4 +-
 .../lock/DefaultJDBCLockIntegrationTest.java    |   2 +-
 .../karaf/main/lock/DefaultJDBCLockTest.java    |   2 +-
 .../main/lock/DerbyJDBCLockIntegrationTest.java |   2 +-
 .../karaf/main/lock/DerbyJDBCLockTest.java      |   2 +-
 .../main/lock/MySQLJDBCLockIntegrationTest.java |   2 +-
 .../karaf/main/lock/MySQLJDBCLockTest.java      |   2 +-
 .../lock/OracleJDBCLockIntegrationTest.java     |   2 +-
 .../karaf/main/lock/OracleJDBCLockTest.java     |   2 +-
 .../lock/PostgreSQLJDBCLockIntegrationTest.java |   2 +-
 .../karaf/main/lock/PostgreSQLJDBCLockTest.java |   2 +-
 .../main/util/BootstrapLogManagerTest.java      |   2 +-
 .../apache/karaf/util/locks/FileLockUtils.java  |   2 +-
 31 files changed, 58 insertions(+), 203 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
b/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
index 1d3e922..32326ba 100644
--- a/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
+++ b/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
@@ -110,7 +110,7 @@ public class InstanceServiceImpl implements InstanceService {
         this.stopTimeout = stopTimeout;
     }
 
-    private State loadData(org.apache.felix.utils.properties.Properties storage) {
+    private State loadData(org.apache.karaf.util.properties.Properties storage) {
         State state = new State();
         int count = getInt(storage, "count", 0);
         state.defaultSshPortStart = getInt(storage, "ssh.port", state.defaultSshPortStart);
@@ -142,7 +142,7 @@ public class InstanceServiceImpl implements InstanceService {
         return state;
     }
 
-    private void saveData(State state, org.apache.felix.utils.properties.Properties storage)
{
+    private void saveData(State state, org.apache.karaf.util.properties.Properties storage)
{
         storage.put("ssh.port", Integer.toString(state.defaultSshPortStart));
         storage.put("rmi.registry.port", Integer.toString(state.defaultRmiRegistryPortStart));
         storage.put("rmi.server.port", Integer.toString(state.defaultRmiServerPortStart));
@@ -166,7 +166,7 @@ public class InstanceServiceImpl implements InstanceService {
         }
     }
 
-    private boolean getBool(org.apache.felix.utils.properties.Properties storage, String
name, boolean def) {
+    private boolean getBool(org.apache.karaf.util.properties.Properties storage, String name,
boolean def) {
         Object value = storage.get(name);
         if (value != null) {
             return Boolean.parseBoolean(value.toString());
@@ -175,7 +175,7 @@ public class InstanceServiceImpl implements InstanceService {
         }
     }
 
-    private int getInt(org.apache.felix.utils.properties.Properties storage, String name,
int def) {
+    private int getInt(org.apache.karaf.util.properties.Properties storage, String name,
int def) {
         Object value = storage.get(name);
         if (value != null) {
             return Integer.parseInt(value.toString());
@@ -184,7 +184,7 @@ public class InstanceServiceImpl implements InstanceService {
         }
     }
 
-    private String getString(org.apache.felix.utils.properties.Properties storage, String
name, String def) {
+    private String getString(org.apache.karaf.util.properties.Properties storage, String
name, String def) {
         Object value = storage.get(name);
         return value != null ? value.toString() : def;
     }
@@ -209,7 +209,7 @@ public class InstanceServiceImpl implements InstanceService {
             }
             try {
                 return FileLockUtils.execute(storageFile, new FileLockUtils.CallableWithProperties<T>()
{
-                    public T call(org.apache.felix.utils.properties.Properties properties)
throws IOException {
+                    public T call(org.apache.karaf.util.properties.Properties properties)
throws IOException {
                         State state = loadData(properties);
                         T t = callback.call(state);
                         saveData(state, properties);
@@ -355,14 +355,14 @@ public class InstanceServiceImpl implements InstanceService {
 
     void addFeaturesFromSettings(File featuresCfg, final InstanceSettings settings) throws
IOException {
         FileLockUtils.execute(featuresCfg, new FileLockUtils.RunnableWithProperties() {
-            public void run(org.apache.felix.utils.properties.Properties properties) throws
IOException {
+            public void run(org.apache.karaf.util.properties.Properties properties) throws
IOException {
                 appendToPropList(properties, "featuresBoot", settings.getFeatures());
                 appendToPropList(properties, "featuresRepositories", settings.getFeatureURLs());
             }
         });
     }
 
-    private void appendToPropList(org.apache.felix.utils.properties.Properties p, String
key, List<String> elements) {
+    private void appendToPropList(org.apache.karaf.util.properties.Properties p, String key,
List<String> elements) {
         if (elements == null) {
             return;
         }
@@ -708,7 +708,7 @@ public class InstanceServiceImpl implements InstanceService {
         File f = new File(instance.loc, path);
         try {
             return FileLockUtils.execute(f, new FileLockUtils.CallableWithProperties<Integer>()
{
-                public Integer call(org.apache.felix.utils.properties.Properties properties)
throws IOException {
+                public Integer call(org.apache.karaf.util.properties.Properties properties)
throws IOException {
                     return Integer.parseInt(properties.get(key).toString());
                 }
             });
@@ -730,7 +730,7 @@ public class InstanceServiceImpl implements InstanceService {
                 }
                 File f = new File(instance.loc, path);
                 FileLockUtils.execute(f, new FileLockUtils.RunnableWithProperties() {
-                    public void run(org.apache.felix.utils.properties.Properties properties)
throws IOException {
+                    public void run(org.apache.karaf.util.properties.Properties properties)
throws IOException {
                         properties.put(key, Integer.toString(port));
                     }
                 });

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/ConfigProperties.java b/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
index 1bec6b1..25f19b6 100644
--- a/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
+++ b/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
@@ -22,7 +22,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.lock.SimpleFileLock;
 import org.apache.karaf.main.util.Utils;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/InstanceHelper.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/InstanceHelper.java b/main/src/main/java/org/apache/karaf/main/InstanceHelper.java
index 31329e5..01f08c5 100644
--- a/main/src/main/java/org/apache/karaf/main/InstanceHelper.java
+++ b/main/src/main/java/org/apache/karaf/main/InstanceHelper.java
@@ -19,7 +19,6 @@
 package org.apache.karaf.main;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
@@ -28,7 +27,6 @@ import java.lang.management.ManagementFactory;
 import java.lang.management.RuntimeMXBean;
 import java.net.InetAddress;
 import java.net.ServerSocket;
-import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -62,7 +60,7 @@ public class InstanceHelper {
                     }
                 }
                 FileLockUtils.execute(propertiesFile, new FileLockUtils.RunnableWithProperties()
{
-                    public void run(org.apache.felix.utils.properties.Properties props) throws
IOException {
+                    public void run(org.apache.karaf.util.properties.Properties props) throws
IOException {
                         if (props.isEmpty()) {
                             if (isRoot) {
                                 props.setProperty("count", "1");

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/Main.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/Main.java b/main/src/main/java/org/apache/karaf/main/Main.java
index 296c965..bc3e3d4 100644
--- a/main/src/main/java/org/apache/karaf/main/Main.java
+++ b/main/src/main/java/org/apache/karaf/main/Main.java
@@ -31,7 +31,7 @@ import java.security.Security;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -363,10 +363,8 @@ public class Main {
     
     public List<BundleInfo> readBundlesFromStartupProperties(File startupPropsFile)
{
         Properties startupProps = PropertiesLoader.loadPropertiesOrFail(startupPropsFile);
-        Enumeration<Object> keyIt = startupProps.keys();
         List<BundleInfo> bundeList = new ArrayList<BundleInfo>();
-        while (keyIt.hasMoreElements()) {
-            String key = (String) keyIt.nextElement();
+        for (String key : startupProps.keySet()) {
             try {
                 BundleInfo bi = new BundleInfo();
                 bi.uri = new URI(key);

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/PropertiesLoader.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/PropertiesLoader.java b/main/src/main/java/org/apache/karaf/main/PropertiesLoader.java
index fc036c9..750241e 100644
--- a/main/src/main/java/org/apache/karaf/main/PropertiesLoader.java
+++ b/main/src/main/java/org/apache/karaf/main/PropertiesLoader.java
@@ -26,12 +26,13 @@ import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Enumeration;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 import java.util.StringTokenizer;
 
-import org.apache.karaf.main.util.SubstHelper;
 import org.apache.karaf.main.util.Utils;
 
+import static org.apache.karaf.util.properties.InterpolationHelper.substVars;
+
 public class PropertiesLoader {
 
     private static final String INCLUDES_PROPERTY = "${includes}"; // mandatory includes
@@ -71,13 +72,14 @@ public class PropertiesLoader {
 
         Properties configProps = loadPropertiesFile(configPropURL, false);
         copySystemProperties(configProps);
+        configProps.substitute();
 
         // Perform variable substitution for system properties.
-        for (Enumeration<?> e = configProps.propertyNames(); e.hasMoreElements();)
{
-            String name = (String) e.nextElement();
-            configProps.setProperty(name,
-                    SubstHelper.substVars(configProps.getProperty(name), name, null, configProps));
-        }
+//        for (Enumeration<?> e = configProps.propertyNames(); e.hasMoreElements();)
{
+//            String name = (String) e.nextElement();
+//            configProps.setProperty(name,
+//                    SubstHelper.substVars(configProps.getProperty(name), name, null, configProps));
+//        }
 
         return configProps;
     }
@@ -100,7 +102,7 @@ public class PropertiesLoader {
      * @throws IOException
      */
     static void loadSystemProperties(File file) throws IOException {
-        Properties props = new Properties();
+        Properties props = new Properties(false);
         try {
             InputStream is = new FileInputStream(file);
             props.load(is);
@@ -114,10 +116,10 @@ public class PropertiesLoader {
 			if (name.startsWith(OVERRIDE_PREFIX)) {
 				String overrideName = name.substring(OVERRIDE_PREFIX.length());
 				String value = props.getProperty(name);
-				System.setProperty(overrideName, SubstHelper.substVars(value, name, null, props));
+				System.setProperty(overrideName, substVars(value, name, null, props));
 			} else {
 				String value = System.getProperty(name, props.getProperty(name));
-				System.setProperty(name, SubstHelper.substVars(value, name, null, props));
+				System.setProperty(name, substVars(value, name, null, props));
 			}
         }
     }
@@ -144,7 +146,7 @@ public class PropertiesLoader {
     }
 
     private static Properties loadPropertiesFile(URL configPropURL, boolean failIfNotFound)
throws Exception {
-        Properties configProps = new Properties();
+        Properties configProps = new Properties(null, false);
         InputStream is = null;
         try {
             is = configPropURL.openConnection().getInputStream();
@@ -198,12 +200,8 @@ public class PropertiesLoader {
     }
 
     private static void trimValues(Properties configProps) {
-        for (Enumeration<?> e = configProps.propertyNames(); e.hasMoreElements();)
{
-            Object key = e.nextElement();
-            if (key instanceof String) {
-                String v = configProps.getProperty((String) key);
-                configProps.put(key, v.trim());
-            }
+        for (String key : configProps.keySet()) {
+            configProps.put(key, configProps.get(key).trim());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/lock/DefaultJDBCLock.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/lock/DefaultJDBCLock.java b/main/src/main/java/org/apache/karaf/main/lock/DefaultJDBCLock.java
index 53358d1..1b624a6 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/DefaultJDBCLock.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/DefaultJDBCLock.java
@@ -24,7 +24,7 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/lock/DerbyJDBCLock.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/lock/DerbyJDBCLock.java b/main/src/main/java/org/apache/karaf/main/lock/DerbyJDBCLock.java
index 722bdce..9b7027d 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/DerbyJDBCLock.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/DerbyJDBCLock.java
@@ -19,7 +19,7 @@
 package org.apache.karaf.main.lock;
 
 import java.sql.Connection;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 /**
  * Represents an exclusive lock on a database,

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/lock/GenericJDBCLock.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/lock/GenericJDBCLock.java b/main/src/main/java/org/apache/karaf/main/lock/GenericJDBCLock.java
index d989315..a31bd3c 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/GenericJDBCLock.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/GenericJDBCLock.java
@@ -24,7 +24,7 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/lock/LockFactory.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/lock/LockFactory.java b/main/src/main/java/org/apache/karaf/main/lock/LockFactory.java
index 6507e26..6b11f9d 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/LockFactory.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/LockFactory.java
@@ -18,7 +18,7 @@
  */
 package org.apache.karaf.main.lock;
 
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 public class LockFactory {
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/lock/MySQLJDBCLock.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/lock/MySQLJDBCLock.java b/main/src/main/java/org/apache/karaf/main/lock/MySQLJDBCLock.java
index 597491c..6000b85 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/MySQLJDBCLock.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/MySQLJDBCLock.java
@@ -19,7 +19,7 @@
 package org.apache.karaf.main.lock;
 
 import java.sql.Connection;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 /**
  * Represents an exclusive lock on a database,

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/lock/OracleJDBCLock.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/lock/OracleJDBCLock.java b/main/src/main/java/org/apache/karaf/main/lock/OracleJDBCLock.java
index 6e11127..b2a41c2 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/OracleJDBCLock.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/OracleJDBCLock.java
@@ -20,7 +20,7 @@ package org.apache.karaf.main.lock;
 
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 /**
  * Represents an exclusive lock on a database,

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/lock/PostgreSQLJDBCLock.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/lock/PostgreSQLJDBCLock.java b/main/src/main/java/org/apache/karaf/main/lock/PostgreSQLJDBCLock.java
index c3da0b4..c73e568 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/PostgreSQLJDBCLock.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/PostgreSQLJDBCLock.java
@@ -18,7 +18,7 @@
  */
 package org.apache.karaf.main.lock;
 
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 /**
  * Represents an exclusive lock on a database,

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java b/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java
index e9d388b..d14f9c0 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java
@@ -18,7 +18,7 @@
  */
 package org.apache.karaf.main.lock;
 
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 /**
  * Represents an exclusive lock on a database,

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/lock/SimpleFileLock.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/lock/SimpleFileLock.java b/main/src/main/java/org/apache/karaf/main/lock/SimpleFileLock.java
index 16dd599..3cb43ab 100644
--- a/main/src/main/java/org/apache/karaf/main/lock/SimpleFileLock.java
+++ b/main/src/main/java/org/apache/karaf/main/lock/SimpleFileLock.java
@@ -22,7 +22,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.channels.FileLock;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 import java.util.logging.Logger;
 
 import org.apache.karaf.main.util.BootstrapLogManager;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/util/BootstrapLogManager.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/util/BootstrapLogManager.java b/main/src/main/java/org/apache/karaf/main/util/BootstrapLogManager.java
index ceb1725..e46b50f 100644
--- a/main/src/main/java/org/apache/karaf/main/util/BootstrapLogManager.java
+++ b/main/src/main/java/org/apache/karaf/main/util/BootstrapLogManager.java
@@ -24,7 +24,9 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
+import org.apache.karaf.util.properties.InterpolationHelper;
+
 import java.util.logging.Handler;
 import java.util.logging.LogRecord;
 import java.util.logging.StreamHandler;
@@ -70,7 +72,7 @@ public class BootstrapLogManager {
         }
         
         String filename = getLogFilePath();
-        filename = SubstHelper.substVars(filename, LOG4J_APPENDER_FILE, null, configProps);
+        filename = InterpolationHelper.substVars(filename, LOG4J_APPENDER_FILE, null, configProps);
         File logFile = new File(filename);
         try {
 			return new SimpleFileHandler(logFile);

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/main/java/org/apache/karaf/main/util/SubstHelper.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/util/SubstHelper.java b/main/src/main/java/org/apache/karaf/main/util/SubstHelper.java
deleted file mode 100644
index c1ae08c..0000000
--- a/main/src/main/java/org/apache/karaf/main/util/SubstHelper.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.karaf.main.util;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-public class SubstHelper {
-    private static final String DELIM_START = "${";
-    private static final String DELIM_STOP = "}";
-
-    /**
-     * <p>
-     * This method performs property variable substitution on the
-     * specified value. If the specified value contains the syntax
-     * <tt>${&lt;prop-name&gt;}</tt>, where <tt>&lt;prop-name&gt;</tt>
-     * refers to either a configuration property or a system property,
-     * then the corresponding property value is substituted for the variable
-     * placeholder. Multiple variable placeholders may exist in the
-     * specified value as well as nested variable placeholders, which
-     * are substituted from inner most to outer most. Configuration
-     * properties override system properties.
-     * </p>
-     *
-     * @param val         The string on which to perform property substitution.
-     * @param currentKey  The key of the property being evaluated used to
-     *                    detect cycles.
-     * @param cycleMap    Map of variable references used to detect nested cycles.
-     * @param configProps Set of configuration properties.
-     * @return The value of the specified string after system property substitution.
-     * @throws IllegalArgumentException If there was a syntax error in the
-     *                                  property placeholder syntax or a recursive variable
reference.
-     */
-    public static String substVars(String val, String currentKey,
-                                    Map<String, String> cycleMap, Properties configProps)
-            throws IllegalArgumentException {
-        // If there is currently no cycle map, then create
-        // one for detecting cycles for this invocation.
-        if (cycleMap == null) {
-            cycleMap = new HashMap<String, String>();
-        }
-    
-        // Put the current key in the cycle map.
-        cycleMap.put(currentKey, currentKey);
-    
-        // Assume we have a value that is something like:
-        // "leading ${foo.${bar}} middle ${baz} trailing"
-    
-        // Find the first ending '}' variable delimiter, which
-        // will correspond to the first deepest nested variable
-        // placeholder.
-        int stopDelim = val.indexOf(DELIM_STOP);
-    
-        // Find the matching starting "${" variable delimiter
-        // by looping until we find a start delimiter that is
-        // greater than the stop delimiter we have found.
-        int startDelim = val.indexOf(DELIM_START);
-        while (stopDelim >= 0) {
-            int idx = val.indexOf(DELIM_START, startDelim + DELIM_START.length());
-            if ((idx < 0) || (idx > stopDelim)) {
-                break;
-            } else if (idx < stopDelim) {
-                startDelim = idx;
-            }
-        }
-    
-        // If we do not have a start or stop delimiter, then just
-        // return the existing value.
-        if ((startDelim < 0) && (stopDelim < 0)) {
-            return val;
-        }
-        // At this point, we found a stop delimiter without a start,
-        // so throw an exception.
-        else if (((startDelim < 0) || (startDelim > stopDelim))
-                && (stopDelim >= 0)) {
-            throw new IllegalArgumentException(
-                    "stop delimiter with no start delimiter: "
-                            + val);
-        }
-    
-        // At this point, we have found a variable placeholder so
-        // we must perform a variable substitution on it.
-        // Using the start and stop delimiter indices, extract
-        // the first, deepest nested variable placeholder.
-        String variable =
-                val.substring(startDelim + DELIM_START.length(), stopDelim);
-    
-        // Verify that this is not a recursive variable reference.
-        if (cycleMap.get(variable) != null) {
-            throw new IllegalArgumentException(
-                    "recursive variable reference: " + variable);
-        }
-    
-        // Get the value of the deepest nested variable placeholder.
-        // Try to configuration properties first.
-        String substValue = (configProps != null)
-                ? configProps.getProperty(variable, null)
-                : null;
-        if (substValue == null) {
-            // Ignore unknown property values.
-            substValue = System.getProperty(variable, "");
-        }
-    
-        // Remove the found variable from the cycle map, since
-        // it may appear more than once in the value and we don't
-        // want such situations to appear as a recursive reference.
-        cycleMap.remove(variable);
-    
-        // Append the leading characters, the substituted value of
-        // the variable, and the trailing characters to get the new
-        // value.
-        val = val.substring(0, startDelim)
-                + substValue
-                + val.substring(stopDelim + DELIM_STOP.length(), val.length());
-    
-        // Now perform substitution again, since there could still
-        // be substitutions to make.
-        val = substVars(val, currentKey, cycleMap, configProps);
-    
-        // Return the value.
-        return val;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/MockLock.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/MockLock.java b/main/src/test/java/org/apache/karaf/main/MockLock.java
index 4bc9ab3..176d8bb 100644
--- a/main/src/test/java/org/apache/karaf/main/MockLock.java
+++ b/main/src/test/java/org/apache/karaf/main/MockLock.java
@@ -1,6 +1,6 @@
 package org.apache.karaf.main;
 
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 import java.util.logging.Logger;
 
 import org.apache.karaf.main.lock.Lock;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockIntegrationTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockIntegrationTest.java
b/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockIntegrationTest.java
index 17fc99f..dc29b70 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockIntegrationTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockIntegrationTest.java
@@ -23,7 +23,7 @@ import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 import java.util.logging.Logger;
 
 import org.apache.karaf.main.util.BootstrapLogManager;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockTest.java b/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockTest.java
index a45c4a2..0fd32f3 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/BaseJDBCLockTest.java
@@ -28,7 +28,7 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.util.BootstrapLogManager;
 import org.easymock.EasyMock;
@@ -81,7 +81,7 @@ public abstract class BaseJDBCLockTest {
         props.put("karaf.lock.jdbc.password", password);
         props.put("karaf.lock.jdbc.table", tableName);
         props.put("karaf.lock.jdbc.clustername", clustername);
-        props.put("karaf.lock.jdbc.timeout", timeout);
+        props.put("karaf.lock.jdbc.timeout", Integer.toString(timeout));
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockIntegrationTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockIntegrationTest.java
b/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockIntegrationTest.java
index eef782a..91c5bc8 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockIntegrationTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockIntegrationTest.java
@@ -20,7 +20,7 @@ package org.apache.karaf.main.lock;
 
 import static org.junit.Assert.assertTrue;
 
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.lock.DefaultJDBCLock;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockTest.java b/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockTest.java
index eaafe3d..5705033 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/DefaultJDBCLockTest.java
@@ -21,7 +21,7 @@ package org.apache.karaf.main.lock;
 import static org.junit.Assert.assertEquals;
 
 import java.sql.Connection;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.lock.DefaultJDBCLock;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockIntegrationTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockIntegrationTest.java
b/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockIntegrationTest.java
index d8fb55e..6cbedb9 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockIntegrationTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockIntegrationTest.java
@@ -20,7 +20,7 @@ package org.apache.karaf.main.lock;
 
 import static org.junit.Assert.assertTrue;
 
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.lock.DefaultJDBCLock;
 import org.apache.karaf.main.lock.DerbyJDBCLock;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockTest.java b/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockTest.java
index bd6fcec..26cae64 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/DerbyJDBCLockTest.java
@@ -21,7 +21,7 @@ package org.apache.karaf.main.lock;
 import static org.junit.Assert.assertEquals;
 
 import java.sql.Connection;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.lock.DerbyJDBCLock;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockIntegrationTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockIntegrationTest.java
b/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockIntegrationTest.java
index 4bb126d..e22ef09 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockIntegrationTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockIntegrationTest.java
@@ -22,7 +22,7 @@ package org.apache.karaf.main.lock;
 import static org.junit.Assert.assertFalse;
 
 import java.sql.Connection;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.lock.MySQLJDBCLock;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockTest.java b/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockTest.java
index c49e434..842f4e1 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/MySQLJDBCLockTest.java
@@ -21,7 +21,7 @@ package org.apache.karaf.main.lock;
 import static org.junit.Assert.assertEquals;
 
 import java.sql.Connection;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.lock.MySQLJDBCLock;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java
b/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java
index e2b0ce6..80f105c 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java
@@ -22,7 +22,7 @@ package org.apache.karaf.main.lock;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.lock.OracleJDBCLock;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockTest.java b/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockTest.java
index a2242a1..20a8198 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockTest.java
@@ -26,7 +26,7 @@ import static org.junit.Assert.*;
 
 import java.sql.Connection;
 import java.sql.SQLException;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import org.apache.karaf.main.lock.OracleJDBCLock;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockIntegrationTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockIntegrationTest.java
b/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockIntegrationTest.java
index dea5ebb..76a9dbc 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockIntegrationTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockIntegrationTest.java
@@ -22,7 +22,7 @@ import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import static org.junit.Assert.assertTrue;
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockTest.java b/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockTest.java
index 20aba82..818aafe 100644
--- a/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockTest.java
+++ b/main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockTest.java
@@ -23,7 +23,7 @@ import org.junit.Test;
 
 import java.sql.Connection;
 import java.sql.SQLException;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 import static org.easymock.EasyMock.*;
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/main/src/test/java/org/apache/karaf/main/util/BootstrapLogManagerTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/util/BootstrapLogManagerTest.java b/main/src/test/java/org/apache/karaf/main/util/BootstrapLogManagerTest.java
index d9e203c..7eb468a 100644
--- a/main/src/test/java/org/apache/karaf/main/util/BootstrapLogManagerTest.java
+++ b/main/src/test/java/org/apache/karaf/main/util/BootstrapLogManagerTest.java
@@ -19,7 +19,7 @@
 package org.apache.karaf.main.util;
 
 import java.io.File;
-import java.util.Properties;
+import org.apache.karaf.util.properties.Properties;
 import java.util.logging.Handler;
 
 import junit.framework.Assert;

http://git-wip-us.apache.org/repos/asf/karaf/blob/9a1909bc/util/src/main/java/org/apache/karaf/util/locks/FileLockUtils.java
----------------------------------------------------------------------
diff --git a/util/src/main/java/org/apache/karaf/util/locks/FileLockUtils.java b/util/src/main/java/org/apache/karaf/util/locks/FileLockUtils.java
index b64639b..b3d1c32 100644
--- a/util/src/main/java/org/apache/karaf/util/locks/FileLockUtils.java
+++ b/util/src/main/java/org/apache/karaf/util/locks/FileLockUtils.java
@@ -24,7 +24,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.channels.FileLock;
-import org.apache.felix.utils.properties.Properties;
+import org.apache.karaf.util.properties.Properties;
 
 public final class FileLockUtils {
 


Mime
View raw message