You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2018/03/03 06:30:19 UTC

[karaf-cave] branch master updated (281f15e -> e2e809e)

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cave.git.


    from 281f15e  Fix javadoc
     new 480ffd9  [KARAF-5556] Prevent NPE dealing with Cave Deployer connections
     new e2e809e  [KARAF-5654] Add a default etc/oorrg.apache.karaf.cave.deployer.cfg to store the Cave Deployer connections

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 assembly/src/main/resources/features.xml           |  3 +
 .../cave/deployer/service/impl/DeployerImpl.java   | 66 +++++++++++++---------
 2 files changed, 41 insertions(+), 28 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
jbonofre@apache.org.

[karaf-cave] 01/02: [KARAF-5556] Prevent NPE dealing with Cave Deployer connections

Posted by jb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cave.git

commit 480ffd9581032fb576d22b9976c04ebdc6e236d4
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Sat Mar 3 07:27:25 2018 +0100

    [KARAF-5556] Prevent NPE dealing with Cave Deployer connections
---
 .../cave/deployer/service/impl/DeployerImpl.java   | 66 +++++++++++++---------
 1 file changed, 38 insertions(+), 28 deletions(-)

diff --git a/deployer/service/src/main/java/org/apache/karaf/cave/deployer/service/impl/DeployerImpl.java b/deployer/service/src/main/java/org/apache/karaf/cave/deployer/service/impl/DeployerImpl.java
index 89ec0c8..22d549e 100644
--- a/deployer/service/src/main/java/org/apache/karaf/cave/deployer/service/impl/DeployerImpl.java
+++ b/deployer/service/src/main/java/org/apache/karaf/cave/deployer/service/impl/DeployerImpl.java
@@ -75,6 +75,9 @@ public class DeployerImpl implements Deployer {
     public void registerConnection(Connection connection) throws Exception {
         Configuration configuration = configurationAdmin.getConfiguration(CONFIG_PID);
         Dictionary<String, Object> properties = configuration.getProperties();
+        if (properties == null) {
+            properties = new Hashtable<>();
+        }
         properties.put(connection.getName() + ".jmx", connection.getJmxUrl());
         properties.put(connection.getName() + ".instance", connection.getKarafName());
         properties.put(connection.getName() + ".username", connection.getUser());
@@ -86,11 +89,13 @@ public class DeployerImpl implements Deployer {
     public void deleteConnection(String connection) throws Exception {
         Configuration configuration = configurationAdmin.getConfiguration(CONFIG_PID);
         Dictionary<String, Object> properties = configuration.getProperties();
-        properties.remove(connection + ".jmx");
-        properties.remove(connection + ".instance");
-        properties.remove(connection + ".username");
-        properties.remove(connection + ".password");
-        configuration.update(properties);
+        if (properties != null) {
+            properties.remove(connection + ".jmx");
+            properties.remove(connection + ".instance");
+            properties.remove(connection + ".username");
+            properties.remove(connection + ".password");
+            configuration.update(properties);
+        }
     }
 
     @Override
@@ -99,18 +104,20 @@ public class DeployerImpl implements Deployer {
 
         Configuration configuration = configurationAdmin.getConfiguration(CONFIG_PID);
         Dictionary<String, Object> properties = configuration.getProperties();
-        Enumeration<String> keys = properties.keys();
-        while (keys.hasMoreElements()) {
-            String key = keys.nextElement();
-            if (key.endsWith(".jmx")) {
-                String connectionName = key.substring(0, key.indexOf(".jmx"));
-                Connection connection = new Connection();
-                connection.setName(connectionName);
-                connection.setJmxUrl((String) properties.get(connectionName + ".jmx"));
-                connection.setKarafName((String) properties.get(connectionName + ".instance"));
-                connection.setUser((String) properties.get(connectionName + ".username"));
-                connection.setPassword((String) properties.get(connectionName + ".password"));
-                connections.add(connection);
+        if (properties != null) {
+            Enumeration<String> keys = properties.keys();
+            while (keys.hasMoreElements()) {
+                String key = keys.nextElement();
+                if (key.endsWith(".jmx")) {
+                    String connectionName = key.substring(0, key.indexOf(".jmx"));
+                    Connection connection = new Connection();
+                    connection.setName(connectionName);
+                    connection.setJmxUrl((String) properties.get(connectionName + ".jmx"));
+                    connection.setKarafName((String) properties.get(connectionName + ".instance"));
+                    connection.setUser((String) properties.get(connectionName + ".username"));
+                    connection.setPassword((String) properties.get(connectionName + ".password"));
+                    connections.add(connection);
+                }
             }
         }
 
@@ -121,18 +128,21 @@ public class DeployerImpl implements Deployer {
         Connection connection = new Connection();
         Configuration configuration = configurationAdmin.getConfiguration(CONFIG_PID);
         Dictionary<String, Object> properties = configuration.getProperties();
-        String jmx = (String) properties.get(name + ".jmx");
-        String instance = (String) properties.get(name + ".instance");
-        String username = (String) properties.get(name + ".username");
-        String password = (String) properties.get(name + ".password");
-        if (jmx == null || instance == null) {
-            throw new IllegalArgumentException("No connection found with name " + name);
+        if (properties != null) {
+            String jmx = (String) properties.get(name + ".jmx");
+            String instance = (String) properties.get(name + ".instance");
+            String username = (String) properties.get(name + ".username");
+            String password = (String) properties.get(name + ".password");
+            if (jmx == null || instance == null) {
+                throw new IllegalArgumentException("No connection found with name " + name);
+            }
+            connection.setJmxUrl(jmx);
+            connection.setKarafName(instance);
+            connection.setUser(username);
+            connection.setPassword(password);
+            return connection;
         }
-        connection.setJmxUrl(jmx);
-        connection.setKarafName(instance);
-        connection.setUser(username);
-        connection.setPassword(password);
-        return connection;
+        return null;
     }
 
     @Override

-- 
To stop receiving notification emails like this one, please contact
jbonofre@apache.org.

[karaf-cave] 02/02: [KARAF-5654] Add a default etc/oorrg.apache.karaf.cave.deployer.cfg to store the Cave Deployer connections

Posted by jb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cave.git

commit e2e809e24ac02e000f3a777555bd0eacfbe63632
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Sat Mar 3 07:29:51 2018 +0100

    [KARAF-5654] Add a default etc/oorrg.apache.karaf.cave.deployer.cfg to store the Cave Deployer connections
---
 assembly/src/main/resources/features.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/assembly/src/main/resources/features.xml b/assembly/src/main/resources/features.xml
index 1aafb83..e40a2dc 100644
--- a/assembly/src/main/resources/features.xml
+++ b/assembly/src/main/resources/features.xml
@@ -77,6 +77,9 @@
         <bundle dependency="true">mvn:com.google.inject/guice/3.0</bundle>
         <bundle dependency="true">mvn:com.google.guava/guava/18.0</bundle>
         <bundle>mvn:org.apache.karaf.cave.deployer/org.apache.karaf.cave.deployer.service/${project.version}</bundle>
+        <config name="org.apache.karaf.cave.deployer">
+            # Karaf Cave Deployer connection storage
+        </config>
     </feature>
 
     <feature name="cave-deployer-rest" version="${project.version}">

-- 
To stop receiving notification emails like this one, please contact
jbonofre@apache.org.