KARAF-3054 - remove dep on felix so client can load on AIX

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

Branch: refs/heads/karaf-2.x
Commit: 7b117ab133e15a9d8251f9174017d670b78d5791
Parents: 72d1c71
Author: Jonathan Anstey <[email protected]>
Authored: Tue Jun 17 12:09:56 2014 -0230
Committer: Jonathan Anstey <[email protected]>
Committed: Tue Jun 17 12:09:56 2014 -0230

----------------------------------------------------------------------
 client/pom.xml                                  |  1 -
 .../main/java/org/apache/karaf/client/Main.java | 29 ++++++++++++++++++--
 2 files changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/7b117ab1/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index a42e578..9bdb7cc 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -75,7 +75,6 @@
                         <Bundle-Description>Shell client bundle for Apache 
Karaf.</Bundle-Description>
                         <Private-Package>
                             
org.apache.karaf.client;-split-package:=merge-first,
-                            
org.apache.felix.utils.properties;-split-package:=merge-first,
                             org.slf4j;-split-package:=merge-first,
                             org.slf4j.spi;-split-package:=merge-first,
                             org.slf4j.helpers;-split-package:=merge-first,

http://git-wip-us.apache.org/repos/asf/karaf/blob/7b117ab1/client/src/main/java/org/apache/karaf/client/Main.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/karaf/client/Main.java 
b/client/src/main/java/org/apache/karaf/client/Main.java
index d6b8150..27624e8 100644
--- a/client/src/main/java/org/apache/karaf/client/Main.java
+++ b/client/src/main/java/org/apache/karaf/client/Main.java
@@ -21,11 +21,12 @@ import java.net.URL;
 import java.nio.charset.Charset;
 import java.security.KeyPair;
 import java.util.Locale;
+import java.util.Properties;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
 
 import jline.Terminal;
-import org.apache.felix.utils.properties.Properties;
+
 import org.apache.karaf.shell.console.jline.TerminalFactory;
 import org.apache.sshd.ClientChannel;
 import org.apache.sshd.ClientSession;
@@ -47,7 +48,7 @@ public class Main {
     private static final String ROLE_DELIMITER = ",";
 
     public static void main(String[] args) throws Exception {
-        Properties shellCfg = new Properties(new 
File(System.getProperty("karaf.etc"), "org.apache.karaf.shell.cfg"));
+        Properties shellCfg = loadProps(new 
File(System.getProperty("karaf.etc"), "org.apache.karaf.shell.cfg"));
 
         String host = shellCfg.getProperty("sshHost", "localhost");
         int port = Integer.parseInt(shellCfg.getProperty("sshPort", "8101"));
@@ -60,7 +61,7 @@ public class Main {
         String password = null;
         StringBuilder command = new StringBuilder();
 
-        Properties usersCfg = new Properties(new 
File(System.getProperty("karaf.etc"), "users.properties"));
+        Properties usersCfg = loadProps(new 
File(System.getProperty("karaf.etc"), "users.properties"));
         if (!usersCfg.isEmpty()) {
             user = (String) usersCfg.keySet().iterator().next();
             password = (String) usersCfg.getProperty(user);
@@ -225,6 +226,28 @@ public class Main {
         System.exit(exitStatus);
     }
 
+    private static Properties loadProps(File file) {
+        Properties props = new Properties();
+        FileInputStream is = null;
+        try {
+            is = new FileInputStream(file);
+            if (is != null) {
+                props.load(is);
+            }
+        } catch (Exception e) {
+            System.err.println("Could not load properties from: " + file + ", 
Reason: " + e.getMessage());
+        } finally {
+            if (is != null) {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                    // Ignore
+                }
+            }
+        }
+        return props;
+    }
+
     protected static SshAgent startAgent(String user) {
         try {
             SshAgent local = new AgentImpl();

Reply via email to