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 2013/01/14 20:49:01 UTC

svn commit: r1433080 - in /karaf/cellar/trunk: ./ bundle/src/main/java/org/apache/karaf/cellar/bundle/ config/src/main/java/org/apache/karaf/cellar/config/ core/src/main/java/org/apache/karaf/cellar/core/ core/src/main/java/org/apache/karaf/cellar/core...

Author: jbonofre
Date: Mon Jan 14 19:49:00 2013
New Revision: 1433080

URL: http://svn.apache.org/viewvc?rev=1433080&view=rev
Log:
[KARAF-1981] Upgrade to Felix ConfigAdmin 1.6.0

Modified:
    karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
    karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java
    karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java
    karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
    karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java
    karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java
    karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java
    karaf/cellar/trunk/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java
    karaf/cellar/trunk/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java
    karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java
    karaf/cellar/trunk/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java
    karaf/cellar/trunk/pom.xml

Modified: karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java (original)
+++ karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java Mon Jan 14 19:49:00 2013
@@ -183,10 +183,10 @@ public class BundleSynchronizer extends 
 
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.GROUP);
-            Dictionary<String, String> properties = configuration.getProperties();
+            Dictionary<String, Object> properties = configuration.getProperties();
             if (properties != null) {
                 String propertyKey = groupName + Configurations.SEPARATOR + Constants.CATEGORY + Configurations.SEPARATOR + Configurations.SYNC;
-                String propertyValue = properties.get(propertyKey);
+                String propertyValue = (String) properties.get(propertyKey);
                 result = Boolean.parseBoolean(propertyValue);
             }
         } catch (IOException e) {

Modified: karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java (original)
+++ karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java Mon Jan 14 19:49:00 2013
@@ -81,7 +81,7 @@ public class ConfigurationEventHandler e
                             localDictionary = new Properties();
                         localDictionary = filter(localDictionary);
                         if (!equals(distributedDictionary, localDictionary)) {
-                            conf.update(distributedDictionary);
+                            conf.update((Dictionary) distributedDictionary);
                             persistConfiguration(configurationAdmin, pid, distributedDictionary);
                         }
                     }

Modified: karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java (original)
+++ karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java Mon Jan 14 19:49:00 2013
@@ -162,10 +162,10 @@ public class ConfigurationSynchronizer e
 
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.GROUP);
-            Dictionary<String, String> properties = configuration.getProperties();
+            Dictionary<String, Object> properties = configuration.getProperties();
             if (properties != null) {
                 String propertyKey = groupName + Configurations.SEPARATOR + Constants.CATEGORY + Configurations.SEPARATOR + Configurations.SYNC;
-                String propertyValue = properties.get(propertyKey);
+                String propertyValue = (String) properties.get(propertyKey);
                 result = Boolean.parseBoolean(propertyValue);
             }
         } catch (IOException e) {

Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java Mon Jan 14 19:49:00 2013
@@ -50,15 +50,15 @@ public class CellarSupport {
         if (group != null) {
             try {
                 Configuration configuration = configurationAdmin.getConfiguration(Configurations.GROUP);
-                Dictionary<String, String> dictionary = configuration.getProperties();
+                Dictionary<String, Object> dictionary = configuration.getProperties();
                 if (dictionary != null) {
-                    String parent = dictionary.get(group + Configurations.SEPARATOR + Configurations.PARENT);
+                    String parent = (String) dictionary.get(group + Configurations.SEPARATOR + Configurations.PARENT);
                     if (parent != null) {
                         result = getListEntries(listType, parent, category, type);
                     }
 
                     String propertyName = group + Configurations.SEPARATOR + category + Configurations.SEPARATOR + listType + Configurations.SEPARATOR + type.name().toLowerCase();
-                    String propertyValue = dictionary.get(propertyName);
+                    String propertyValue = (String) dictionary.get(propertyName);
                     if (propertyValue != null) {
                         propertyValue = propertyValue.replaceAll("\n","");
                         String[] itemList = propertyValue.split(Configurations.DELIMETER);

Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java Mon Jan 14 19:49:00 2013
@@ -65,7 +65,7 @@ public class ConsumerSwitchCommandHandle
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE);
             if (configuration != null) {
-                Dictionary<String, String> properties = configuration.getProperties();
+                Dictionary<String, Object> properties = configuration.getProperties();
                 if (properties != null) {
                     properties.put(Configurations.CONSUMER, switchStatus.getValue().toString());
                     configuration.update(properties);

Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java Mon Jan 14 19:49:00 2013
@@ -102,7 +102,7 @@ public class ManageHandlersCommandHandle
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE);
             if (configuration != null) {
-                Dictionary<String, String> properties = configuration.getProperties();
+                Dictionary<String, Object> properties = configuration.getProperties();
                 if (properties != null) {
                     properties.put(Configurations.HANDLER + "." + handler, switchStatus.getValue().toString());
                     configuration.update(properties);

Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java Mon Jan 14 19:49:00 2013
@@ -64,7 +64,7 @@ public class ProducerSwitchCommandHandle
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE);
             if (configuration != null) {
-                Dictionary<String, String> properties = configuration.getProperties();
+                Dictionary<String, Object> properties = configuration.getProperties();
                 if (properties != null) {
                     properties.put(Configurations.PRODUCER, switchStatus.getValue().toString());
                     configuration.update(properties);

Modified: karaf/cellar/trunk/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java (original)
+++ karaf/cellar/trunk/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java Mon Jan 14 19:49:00 2013
@@ -1,7 +1,20 @@
+/*
+ * Licensed 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.cellar.core;
 
-
 import java.io.InputStream;
+import java.util.Dictionary;
 import java.util.Properties;
 import org.apache.karaf.cellar.core.event.EventType;
 import org.easymock.EasyMock;
@@ -32,7 +45,8 @@ public class CellarSupportTest {
         props.load(is);
         is.close();
         expect(configurationAdmin.getConfiguration(EasyMock.<String>anyObject())).andReturn(configuration).anyTimes();
-        expect(configuration.getProperties()).andReturn(props).anyTimes();
+        Dictionary propsDictionary = (Dictionary) props;
+        expect(configuration.getProperties()).andReturn(propsDictionary).anyTimes();
         replay(configuration);
         replay(configurationAdmin);
     }

Modified: karaf/cellar/trunk/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java (original)
+++ karaf/cellar/trunk/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java Mon Jan 14 19:49:00 2013
@@ -176,10 +176,10 @@ public class FeaturesSynchronizer extend
 
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.GROUP);
-            Dictionary<String, String> properties = configuration.getProperties();
+            Dictionary<String, Object> properties = configuration.getProperties();
             if (properties != null) {
                 String propertyKey = groupName + Configurations.SEPARATOR + Constants.FEATURES_CATEGORY + Configurations.SEPARATOR + Configurations.SYNC;
-                String propertyValue = properties.get(propertyKey);
+                String propertyValue = (String) properties.get(propertyKey);
                 result = Boolean.parseBoolean(propertyValue);
             }
         } catch (IOException e) {

Modified: karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java (original)
+++ karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java Mon Jan 14 19:49:00 2013
@@ -76,11 +76,11 @@ public class HazelcastGroupManager imple
             // create group stored in configuration admin
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.GROUP);
             if (configuration != null) {
-                Dictionary<String, String> properties = configuration.getProperties();
+                Dictionary<String, Object> properties = configuration.getProperties();
                 if (properties == null) {
-                    properties = new Hashtable<String, String>();
+                    properties = new Hashtable<String, Object>();
                 }
-                String groups = properties.get(Configurations.GROUPS_KEY);
+                String groups = (String) properties.get(Configurations.GROUPS_KEY);
                 Set<String> groupNames = convertStringToSet(groups);
                 if (groupNames != null && !groupNames.isEmpty()) {
                     for (String groupName : groupNames) {
@@ -95,11 +95,11 @@ public class HazelcastGroupManager imple
             // add group membership from configuration
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE);
             if (configuration != null) {
-                Dictionary<String, String> properties = configuration.getProperties();
+                Dictionary<String, Object> properties = configuration.getProperties();
                 if (properties == null) {
-                    properties = new Hashtable<String, String>();
+                    properties = new Hashtable<String, Object>();
                 }
-                String groups = properties.get(Configurations.GROUPS_KEY);
+                String groups = (String) properties.get(Configurations.GROUPS_KEY);
                 Set<String> groupNames = convertStringToSet(groups);
                 if (groupNames != null && !groupNames.isEmpty()) {
                     for (String groupName : groupNames) {
@@ -188,9 +188,9 @@ public class HazelcastGroupManager imple
     private void persist(Map<String, Group> groups) throws Exception {
         Configuration configuration = configurationAdmin.getConfiguration(Configurations.GROUP);
         if (configuration != null) {
-            Dictionary<String, String> properties = configuration.getProperties();
+            Dictionary<String, Object> properties = configuration.getProperties();
             if (properties == null) {
-                properties = new Hashtable<String, String>();
+                properties = new Hashtable<String, Object>();
             }
             properties.put(Configurations.GROUPS_KEY, convertSetToString(groups.keySet()));
             configuration.update(properties);
@@ -350,9 +350,9 @@ public class HazelcastGroupManager imple
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE);
             if (configuration != null) {
-                Dictionary<String, String> properties = configuration.getProperties();
+                Dictionary<String, Object> properties = configuration.getProperties();
                 if (properties != null) {
-                    String groups = properties.get(Configurations.GROUPS_KEY);
+                    String groups = (String) properties.get(Configurations.GROUPS_KEY);
                     if (groups == null || groups.isEmpty()) {
                         groups = groupName;
                     } else {
@@ -442,8 +442,8 @@ public class HazelcastGroupManager imple
         //Remove group from configuration
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE);
-            Dictionary<String, String> properties = configuration.getProperties();
-            String groups = properties.get(Configurations.GROUPS_KEY);
+            Dictionary<String, Object> properties = configuration.getProperties();
+            String groups = (String) properties.get(Configurations.GROUPS_KEY);
             if (groups == null || groups.isEmpty()) {
                 groups = "";
             } else if (groups.contains(groupName)) {

Modified: karaf/cellar/trunk/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java (original)
+++ karaf/cellar/trunk/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java Mon Jan 14 19:49:00 2013
@@ -125,9 +125,9 @@ public class ObrUrlSynchronizer extends 
 
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.GROUP);
-            Dictionary<String, String> properties = configuration.getProperties();
+            Dictionary<String, Object> properties = configuration.getProperties();
             String propertyKey = groupName + Configurations.SEPARATOR + Constants.URLS_CONFIG_CATEGORY + Configurations.SEPARATOR + Configurations.SYNC;
-            String propertyValue = properties.get(propertyKey);
+            String propertyValue = (String) properties.get(propertyKey);
             result = Boolean.parseBoolean(propertyValue);
         } catch (IOException e) {
             LOGGER.error("CELLAR OBR: error while checking if sync is enabled", e);

Modified: karaf/cellar/trunk/pom.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/pom.xml?rev=1433080&r1=1433079&r2=1433080&view=diff
==============================================================================
--- karaf/cellar/trunk/pom.xml (original)
+++ karaf/cellar/trunk/pom.xml Mon Jan 14 19:49:00 2013
@@ -37,7 +37,7 @@
     <properties>
         <easymock.version>3.1</easymock.version>
         <felix.bundlerepository.version>1.6.6</felix.bundlerepository.version>
-        <felix.configadmin.version>1.2.8</felix.configadmin.version>
+        <felix.configadmin.version>1.6.0</felix.configadmin.version>
         <felix.utils.version>1.1.2</felix.utils.version>
         <felix.webconsole.version>3.1.8</felix.webconsole.version>
         <hazelcast.version>2.2</hazelcast.version>