Author: bdekruijff at gmail.com
Date: Tue Jan 11 14:54:18 2011
New Revision: 594

Log:
[sandbox] fabric: restored configadmin support]

Modified:
   
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/tribes/ClusterChannelCreator.java
   
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/service/FabricManagerServiceImpl.java

Modified: 
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/tribes/ClusterChannelCreator.java
==============================================================================
--- 
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/tribes/ClusterChannelCreator.java
   (original)
+++ 
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/tribes/ClusterChannelCreator.java
   Tue Jan 11 14:54:18 2011
@@ -49,7 +49,7 @@
      * Comma separated list of static members that must be represented in the 
form
      * hostname:port.
      */
-    public static final String PROP_STATICMEMBERS = "static";
+    public static final String PROP_STATICMEMBERS = "staticmembers";
     public static final String PROP_STATICMEMBERS_DEFAULT = "";
 
     /**

Modified: 
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/service/FabricManagerServiceImpl.java
==============================================================================
--- 
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/service/FabricManagerServiceImpl.java
        (original)
+++ 
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/service/FabricManagerServiceImpl.java
        Tue Jan 11 14:54:18 2011
@@ -17,6 +17,7 @@
 package org.amdatu.core.fabric.service;
 
 import java.util.Dictionary;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
@@ -89,33 +90,34 @@
     public synchronized void updated(Dictionary<String, Object> dictionary) 
throws FabricException,
         ConfigurationException {
         if (dictionary != null) {
-            String clusternamesValue = (String) 
dictionary.get("org.amdatu.fabric.groupchannels");
-            if (clusternamesValue != null) {
-                String[] clusterNames = clusternamesValue.split(",");
-                for (String clusterName : clusterNames) {
-                    String clusterGroupId =
-                        (String) dictionary.get("org.amdatu.fabric." + 
clusterName + ".groupchannel");
-                    String clusterMemberId = (String) 
dictionary.get("org.amdatu.fabric." + clusterName + ".memberid");
-                    String args = (String) dictionary.get("org.amdatu.fabric." 
+ clusterName + ".tribes.args");
+            String clusterChannelIdsProperty = (String) 
dictionary.get("clusterchannels");
+            if (clusterChannelIdsProperty != null) {
+                String[] clusterChannelIds = 
clusterChannelIdsProperty.split(",");
+                for (String clusterChannelId : clusterChannelIds) {
+                    clusterChannelId = clusterChannelId.trim();
+                    checkIdParameter(clusterChannelId);
                     Dictionary<String, Object> properties = new 
Hashtable<String, Object>();
-                    properties
-                        
.put(TribesClusterChannelServiceImpl.CLUSTER_TRIBES_ARGS_PROP, args.split(" "));
-
-                    createClusterChannel(clusterGroupId, properties);
+                    Enumeration<String> keys = dictionary.keys();
+                    while (keys.hasMoreElements()) {
+                        String key = keys.nextElement();
+                        if (key.startsWith(clusterChannelId + ".")) {
+                            
properties.put(key.substring(clusterChannelId.length() + 1), 
dictionary.get(key));
+                        }
+                    }
+                    createClusterChannel(clusterChannelId, properties);
                 }
             }
 
-            String remotenamesValue = (String) 
dictionary.get("org.amdatu.fabric.servicegroups");
-            if (remotenamesValue != null) {
-                String[] remoteNames = remotenamesValue.split(",");
-                for (String remoteName : remoteNames) {
-                    String clusterGroupId =
-                        (String) dictionary.get("org.amdatu.fabric." + 
remoteName + ".groupchannel");
-                    String serviceGroupId =
-                        (String) dictionary.get("org.amdatu.fabric." + 
remoteName + ".servicegroup");
-
-                    createDistribution(clusterGroupId, serviceGroupId);
-                    createDiscovery(clusterGroupId, serviceGroupId);
+            String serviceGroupIdsValue = (String) 
dictionary.get("servicegroups");
+            if (serviceGroupIdsValue != null) {
+                String[] serviceGroupIds = serviceGroupIdsValue.split(",");
+                for (String serviceGroupId : serviceGroupIds) {
+                    serviceGroupId = serviceGroupId.trim();
+                    checkIdParameter(serviceGroupId);
+                    String clusterChannelId =
+                        (String) dictionary.get(serviceGroupId + 
".clusterchannel");
+                    createDistribution(clusterChannelId, serviceGroupId);
+                    createDiscovery(clusterChannelId, serviceGroupId);
                 }
             }
         }

Reply via email to