You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/07/10 15:07:34 UTC

[1/3] git commit: [KARAF-1560] config:update throws ClassCastException when used on a Configuration with boolean fields created in the web console Use generics for configuration Dictionary

Repository: karaf
Updated Branches:
  refs/heads/karaf-2.x 892528f48 -> 22614b2a3


[KARAF-1560] config:update throws ClassCastException when used on a Configuration with boolean fields created in the web console
Use generics for configuration Dictionary


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

Branch: refs/heads/karaf-2.x
Commit: 22614b2a3e295119739b291321e818e16f8055df
Parents: 728cbec
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Thu Jul 10 15:07:14 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Thu Jul 10 15:07:27 2014 +0200

----------------------------------------------------------------------
 .../shell/config/ConfigCommandSupport.java      | 22 +++++++++++---------
 .../config/ConfigPropertyCommandSupport.java    | 10 +++++----
 .../apache/karaf/shell/config/EditCommand.java  |  5 +++--
 .../karaf/shell/config/PropAppendCommand.java   |  2 +-
 .../karaf/shell/config/PropDelCommand.java      |  2 +-
 .../karaf/shell/config/PropListCommand.java     |  6 +++---
 .../karaf/shell/config/PropSetCommand.java      |  2 +-
 .../karaf/shell/config/UpdateCommand.java       |  2 +-
 8 files changed, 28 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/22614b2a/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigCommandSupport.java
----------------------------------------------------------------------
diff --git a/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigCommandSupport.java b/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigCommandSupport.java
index c972033..111bcf7 100644
--- a/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigCommandSupport.java
+++ b/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigCommandSupport.java
@@ -69,8 +69,8 @@ public abstract class ConfigCommandSupport extends OsgiCommandSupport {
         return null;
     }
 
-    protected Dictionary getEditedProps() throws Exception {
-        return (Dictionary) this.session.get(PROPERTY_CONFIG_PROPS);
+    protected Dictionary<String, Object> getEditedProps() throws Exception {
+        return (Dictionary<String, Object>) this.session.get(PROPERTY_CONFIG_PROPS);
     }
 
     protected ConfigurationAdmin getConfigurationAdmin() {
@@ -134,7 +134,7 @@ public abstract class ConfigCommandSupport extends OsgiCommandSupport {
      * @param bypassStorage
      * @throws IOException
      */
-    protected void update(ConfigurationAdmin admin, String pid, Dictionary props, boolean bypassStorage) throws IOException {
+    protected void update(ConfigurationAdmin admin, String pid, Dictionary<String, Object> props, boolean bypassStorage) throws IOException {
         if (!bypassStorage && storage != null) {
             persistConfiguration(admin, pid, props);
         } else {
@@ -150,7 +150,7 @@ public abstract class ConfigCommandSupport extends OsgiCommandSupport {
      * @param props
      * @throws IOException
      */
-    protected void persistConfiguration(ConfigurationAdmin admin, String pid, Dictionary props) throws IOException {
+    protected void persistConfiguration(ConfigurationAdmin admin, String pid, Dictionary<String, Object> props) throws IOException {
         File storageFile = new File(storage, pid + ".cfg");
         Configuration cfg = admin.getConfiguration(pid, null);
         if (cfg != null && cfg.getProperties() != null) {
@@ -170,22 +170,24 @@ public abstract class ConfigCommandSupport extends OsgiCommandSupport {
             }
         }
         Properties p = new Properties(storageFile);
-        for (Enumeration keys = props.keys(); keys.hasMoreElements(); ) {
-            Object key = keys.nextElement();
+        for (Enumeration<String> keys = props.keys(); keys.hasMoreElements(); ) {
+            String key = keys.nextElement();
             if (!Constants.SERVICE_PID.equals(key)
                     && !ConfigurationAdmin.SERVICE_FACTORYPID.equals(key)
                     && !FILEINSTALL_FILE_NAME.equals(key)) {
-                p.put((String) key, (String) props.get(key));
+                if (props.get(key) != null) {
+                    p.put(key, props.get(key).toString());
+                }
             }
         }
         // remove "removed" properties from the file
         ArrayList<String> propertiesToRemove = new ArrayList<String>();
-        for (Object key : p.keySet()) {
+        for (String key : p.keySet()) {
             if (props.get(key) == null
                     && !Constants.SERVICE_PID.equals(key)
                     && !ConfigurationAdmin.SERVICE_FACTORYPID.equals(key)
                     && !FILEINSTALL_FILE_NAME.equals(key)) {
-                propertiesToRemove.add(key.toString());
+                propertiesToRemove.add(key);
             }
         }
         for (String key : propertiesToRemove) {
@@ -225,7 +227,7 @@ public abstract class ConfigCommandSupport extends OsgiCommandSupport {
      * @param props
      * @throws IOException
      */
-    public void updateConfiguration(ConfigurationAdmin admin, String pid, Dictionary props) throws IOException {
+    public void updateConfiguration(ConfigurationAdmin admin, String pid, Dictionary<String, Object> props) throws IOException {
         Configuration cfg = admin.getConfiguration(pid, null);
         if (cfg.getProperties() == null) {
             String[] pids = parsePid(pid);

http://git-wip-us.apache.org/repos/asf/karaf/blob/22614b2a/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigPropertyCommandSupport.java
----------------------------------------------------------------------
diff --git a/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigPropertyCommandSupport.java b/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigPropertyCommandSupport.java
index b4dfada..e69a8f7 100644
--- a/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigPropertyCommandSupport.java
+++ b/shell/config/src/main/java/org/apache/karaf/shell/config/ConfigPropertyCommandSupport.java
@@ -21,6 +21,8 @@ package org.apache.karaf.shell.config;
 import java.util.Dictionary;
 
 import org.apache.felix.gogo.commands.Option;
+
+import java.util.Hashtable;
 import java.util.Properties;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
@@ -38,7 +40,7 @@ public abstract class ConfigPropertyCommandSupport extends ConfigCommandSupport
 
 
     protected void doExecute(ConfigurationAdmin admin) throws Exception {
-        Dictionary props = getEditedProps();
+        Dictionary<String, Object> props = getEditedProps();
         if (bypassStorage && pid == null) {
         	System.err.println("Warning: option -b does not have any effect unless -p is also specified.");
         }
@@ -46,7 +48,7 @@ public abstract class ConfigPropertyCommandSupport extends ConfigCommandSupport
             System.err.println("No configuration is being edited--run the edit command first");
         } else {
             if (props == null) {
-                props = new Properties();
+                props = new Hashtable<String, Object>();
             }
             propertyAction(props);
             if(requiresUpdate(pid)) {
@@ -59,7 +61,7 @@ public abstract class ConfigPropertyCommandSupport extends ConfigCommandSupport
      * Perform an action on the properties.
      * @param props
      */
-    protected abstract void propertyAction(Dictionary props);
+    protected abstract void propertyAction(Dictionary<String, Object> props);
 
     /**
      * Checks if the configuration requires to be updated.
@@ -82,7 +84,7 @@ public abstract class ConfigPropertyCommandSupport extends ConfigCommandSupport
      * @throws Exception
      */
     @Override
-    protected Dictionary getEditedProps() throws Exception {
+    protected Dictionary<String, Object> getEditedProps() throws Exception {
         if(pid != null) {
             ConfigurationAdmin configurationAdmin = getConfigurationAdmin();
             if (configurationAdmin != null) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/22614b2a/shell/config/src/main/java/org/apache/karaf/shell/config/EditCommand.java
----------------------------------------------------------------------
diff --git a/shell/config/src/main/java/org/apache/karaf/shell/config/EditCommand.java b/shell/config/src/main/java/org/apache/karaf/shell/config/EditCommand.java
index ae43af9..96dc866 100644
--- a/shell/config/src/main/java/org/apache/karaf/shell/config/EditCommand.java
+++ b/shell/config/src/main/java/org/apache/karaf/shell/config/EditCommand.java
@@ -17,6 +17,7 @@
 package org.apache.karaf.shell.config;
 
 import java.util.Dictionary;
+import java.util.Hashtable;
 import java.util.Properties;
 
 import org.apache.felix.gogo.commands.Argument;
@@ -43,7 +44,7 @@ public class EditCommand extends ConfigCommandSupport {
             System.err.println("Another config is being edited.  Cancel / update first, or use the --force option");
             return;
         }
-	    Dictionary props;
+	    Dictionary<String, Object> props;
 
 	    //User selected to use file instead.
         if (useFile) {
@@ -58,7 +59,7 @@ public class EditCommand extends ConfigCommandSupport {
             Configuration configuration = admin.getConfiguration(pid, null);
             props = configuration.getProperties();
             if (props == null) {
-                props = new Properties();
+                props = new Hashtable<String, Object>();
             }
         }
         this.session.put(PROPERTY_CONFIG_PID, pid);

http://git-wip-us.apache.org/repos/asf/karaf/blob/22614b2a/shell/config/src/main/java/org/apache/karaf/shell/config/PropAppendCommand.java
----------------------------------------------------------------------
diff --git a/shell/config/src/main/java/org/apache/karaf/shell/config/PropAppendCommand.java b/shell/config/src/main/java/org/apache/karaf/shell/config/PropAppendCommand.java
index 39272a7..9a7c628 100644
--- a/shell/config/src/main/java/org/apache/karaf/shell/config/PropAppendCommand.java
+++ b/shell/config/src/main/java/org/apache/karaf/shell/config/PropAppendCommand.java
@@ -33,7 +33,7 @@ public class PropAppendCommand extends ConfigPropertyCommandSupport {
     String value;
 
     @Override
-    public void propertyAction(Dictionary props) {
+    public void propertyAction(Dictionary<String, Object> props) {
         final Object currentValue = props.get(prop);
         if (currentValue == null) {
             props.put(prop, value);

http://git-wip-us.apache.org/repos/asf/karaf/blob/22614b2a/shell/config/src/main/java/org/apache/karaf/shell/config/PropDelCommand.java
----------------------------------------------------------------------
diff --git a/shell/config/src/main/java/org/apache/karaf/shell/config/PropDelCommand.java b/shell/config/src/main/java/org/apache/karaf/shell/config/PropDelCommand.java
index c8a5d11..a11c1f2 100644
--- a/shell/config/src/main/java/org/apache/karaf/shell/config/PropDelCommand.java
+++ b/shell/config/src/main/java/org/apache/karaf/shell/config/PropDelCommand.java
@@ -27,7 +27,7 @@ public class PropDelCommand extends ConfigPropertyCommandSupport {
     String prop;
 
     @Override
-    public void propertyAction(Dictionary props) {
+    public void propertyAction(Dictionary<String, Object> props) {
         props.remove(prop);
     }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/22614b2a/shell/config/src/main/java/org/apache/karaf/shell/config/PropListCommand.java
----------------------------------------------------------------------
diff --git a/shell/config/src/main/java/org/apache/karaf/shell/config/PropListCommand.java b/shell/config/src/main/java/org/apache/karaf/shell/config/PropListCommand.java
index ed2f45b..328ae9d 100644
--- a/shell/config/src/main/java/org/apache/karaf/shell/config/PropListCommand.java
+++ b/shell/config/src/main/java/org/apache/karaf/shell/config/PropListCommand.java
@@ -24,9 +24,9 @@ import org.apache.felix.gogo.commands.Command;
 public class PropListCommand extends ConfigPropertyCommandSupport {
 
     @Override
-    public void propertyAction(Dictionary props) {
-        for (Enumeration e = props.keys(); e.hasMoreElements(); ) {
-            Object key = e.nextElement();
+    public void propertyAction(Dictionary<String, Object> props) {
+        for (Enumeration<String> e = props.keys(); e.hasMoreElements(); ) {
+            String key = e.nextElement();
             System.out.println("   " + key + " = " + props.get(key));
         }
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/22614b2a/shell/config/src/main/java/org/apache/karaf/shell/config/PropSetCommand.java
----------------------------------------------------------------------
diff --git a/shell/config/src/main/java/org/apache/karaf/shell/config/PropSetCommand.java b/shell/config/src/main/java/org/apache/karaf/shell/config/PropSetCommand.java
index 245340a..ba25eb5 100644
--- a/shell/config/src/main/java/org/apache/karaf/shell/config/PropSetCommand.java
+++ b/shell/config/src/main/java/org/apache/karaf/shell/config/PropSetCommand.java
@@ -32,7 +32,7 @@ public class PropSetCommand extends ConfigPropertyCommandSupport {
     String value;
 
     @Override
-    public void propertyAction(Dictionary props) {
+    public void propertyAction(Dictionary<String, Object> props) {
         props.put(prop, value);
     }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/22614b2a/shell/config/src/main/java/org/apache/karaf/shell/config/UpdateCommand.java
----------------------------------------------------------------------
diff --git a/shell/config/src/main/java/org/apache/karaf/shell/config/UpdateCommand.java b/shell/config/src/main/java/org/apache/karaf/shell/config/UpdateCommand.java
index 6c99e12..0525a8b 100644
--- a/shell/config/src/main/java/org/apache/karaf/shell/config/UpdateCommand.java
+++ b/shell/config/src/main/java/org/apache/karaf/shell/config/UpdateCommand.java
@@ -31,7 +31,7 @@ public class UpdateCommand extends ConfigCommandSupport {
     protected boolean bypassStorage;
     
     protected void doExecute(ConfigurationAdmin admin) throws Exception {
-        Dictionary props = getEditedProps();
+        Dictionary<String, Object> props = getEditedProps();
         if (props == null) {
             System.err.println("No configuration is being edited--run the edit command first");
             return;


[2/3] git commit: Add missing karaf.admin.role system property

Posted by gn...@apache.org.
Add missing karaf.admin.role system property


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

Branch: refs/heads/karaf-2.x
Commit: 728cbec8d03fb43fbbfbcb12d80951bd52f80416
Parents: 28376d9
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Thu Jul 10 14:17:16 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Thu Jul 10 15:07:27 2014 +0200

----------------------------------------------------------------------
 .../main/distribution/text/etc/system.properties    | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/728cbec8/assemblies/apache-karaf/src/main/distribution/text/etc/system.properties
----------------------------------------------------------------------
diff --git a/assemblies/apache-karaf/src/main/distribution/text/etc/system.properties b/assemblies/apache-karaf/src/main/distribution/text/etc/system.properties
index 99ce56d..1b3dace 100644
--- a/assemblies/apache-karaf/src/main/distribution/text/etc/system.properties
+++ b/assemblies/apache-karaf/src/main/distribution/text/etc/system.properties
@@ -56,6 +56,20 @@ karaf.shell.init.script = ${karaf.etc}/shell.init.script
 # karaf.shell.history.maxSize = 0
 
 #
+# Default role name used for console authorization (JMX, SSH and WEB)
+# The syntax is the following:
+#   [classname:]principal
+# where classname is the class name of the principal object
+# (defaults to org.apache.karaf.jaas.modules.RolePrincipal)
+# and principal is the name of the principal of that class
+# (defaults to admin).
+#
+# Note that this value can be overriden using the various ConfigAdmin
+# configurations for JMX, SSH or the WebConsole.
+#
+karaf.admin.role = admin
+
+#
 # Roles to use when logging into a local Karaf console.
 # The syntax is the following:
 #   [classname:]principal
@@ -64,7 +78,7 @@ karaf.shell.init.script = ${karaf.etc}/shell.init.script
 # and principal is the name of the principal of that class
 # (defaults to admin).
 #
-karaf.local.roles=admin,manager,viewer
+karaf.local.roles = admin,manager,viewer
 
 #
 # Set this empty property to avoid errors when validating xml documents.


[3/3] git commit: [KARAF-3108] Fix webconsole CSS

Posted by gn...@apache.org.
[KARAF-3108] Fix webconsole CSS


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

Branch: refs/heads/karaf-2.x
Commit: 28376d97f6834d9fdac9e2b2bc1980bda46d9cda
Parents: 892528f
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Thu Jul 10 11:48:02 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Thu Jul 10 15:07:27 2014 +0200

----------------------------------------------------------------------
 .../main/resources/res/karaf/ui/webconsole.css  | 30 ++++++++++++++++----
 1 file changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/28376d97/webconsole/branding/src/main/resources/res/karaf/ui/webconsole.css
----------------------------------------------------------------------
diff --git a/webconsole/branding/src/main/resources/res/karaf/ui/webconsole.css b/webconsole/branding/src/main/resources/res/karaf/ui/webconsole.css
index a31e6bc..03fa9dd 100644
--- a/webconsole/branding/src/main/resources/res/karaf/ui/webconsole.css
+++ b/webconsole/branding/src/main/resources/res/karaf/ui/webconsole.css
@@ -66,6 +66,24 @@
 	white-space: nowrap;
 }
 
+/* New Category Based Navigation Tree (FELIX-3769) */
+#navmenu {
+     width: auto;
+}
+
+#navmenu li.ui-menu-item {
+     width: auto;
+}
+
+#navmenu li.navMenuItem-0 {
+    display: inline-block;
+}
+
+/* Don't display caret on top-level menu (FELIX-3841) */
+#navmenu li.navMenuItem-0 > a > span {
+    display: none;
+}
+
 /* CENTRAL CONTENT AREA STYLING */
 #content, .ui-widget, .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-size: 8pt }
 
@@ -119,16 +137,16 @@ table.nicetable th, table.nicetable td {
 
 /* tablesorter styling */
 tr .header {
-	background-image: url(../lib/bg.gif);
-	background-repeat: no-repeat;
-	background-position: center right;
-	cursor: pointer;
+	background-image: url(../lib/bg.gif) !important;
+	background-repeat: no-repeat !important;
+	background-position: center right !important;
+	cursor: pointer !important;
 }
 tr .headerSortUp {
-	background-image: url(../lib/asc.gif);
+	background-image: url(../lib/asc.gif) !important;
 }
 tr .headerSortDown {
-	background-image: url(../lib/desc.gif);
+	background-image: url(../lib/desc.gif) !important;
 }
 
 /* status line */