You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by az...@apache.org on 2007/05/25 18:35:52 UTC

svn commit: r541719 - in /webservices/axis2/trunk/java/modules: clustering/src/org/apache/axis2/clustering/context/ clustering/src/org/apache/axis2/clustering/context/commands/ clustering/src/org/apache/axis2/clustering/control/ clustering/src/org/apac...

Author: azeez
Date: Fri May 25 09:35:51 2007
New Revision: 541719

URL: http://svn.apache.org/viewvc?view=rev&rev=541719
Log:
When a new node starts up Obtain the current state from a randomly selected member

Modified:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/CreateServiceContextCommand.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateCommand.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateResponseCommand.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesControlCommandProcessor.java
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ConfigurationManagerTest.java
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ManageContextTest.java
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/UpdateStateTest.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/context/ContextManager.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java Fri May 25 09:35:51 2007
@@ -33,15 +33,24 @@
 
     private static final Log log = LogFactory.getLog(ContextClusteringCommandFactory.class);
 
+    /**
+     * @param context
+     * @param excludedPropertyPatterns
+     * @param includeAllProperties     True - Include all properties,
+     *                                 False - Include only property differences
+     * @return ContextClusteringCommand
+     */
     public static ContextClusteringCommand getUpdateCommand(AbstractContext context,
-                                                            Map excludedPropertyPatterns) {
+                                                            Map excludedPropertyPatterns,
+                                                            boolean includeAllProperties) {
 
         ContextClusteringCommand cmd = null;
         if (context instanceof ConfigurationContext) {
             cmd = new UpdateConfigurationContextCommand();
             fillProperties((UpdateContextCommand) cmd,
                            context,
-                           excludedPropertyPatterns);
+                           excludedPropertyPatterns,
+                           includeAllProperties);
         } else if (context instanceof ServiceGroupContext) {
             ServiceGroupContext sgCtx = (ServiceGroupContext) context;
             cmd = new UpdateServiceGroupContextCommand();
@@ -52,7 +61,8 @@
             updateSgCmd.setServiceGroupContextId(sgCtx.getId());
             fillProperties((UpdateContextCommand) cmd,
                            context,
-                           excludedPropertyPatterns);
+                           excludedPropertyPatterns,
+                           includeAllProperties);
         } else if (context instanceof ServiceContext) {
             ServiceContext serviceCtx = (ServiceContext) context;
             cmd = new UpdateServiceContextCommand();
@@ -63,7 +73,8 @@
             updateServiceCmd.setServiceName(serviceCtx.getAxisService().getName());
             fillProperties((UpdateContextCommand) cmd,
                            context,
-                           excludedPropertyPatterns);
+                           excludedPropertyPatterns,
+                           includeAllProperties);
         }
         if (cmd != null && ((UpdateContextCommand) cmd).isPropertiesEmpty()) {
             cmd = null;
@@ -72,21 +83,45 @@
         return cmd;
     }
 
+    /**
+     * @param updateCmd
+     * @param context
+     * @param excludedPropertyPatterns
+     * @param includeAllProperties     True - Include all properties,
+     *                                 False - Include only property differences
+     */
     private static void fillProperties(UpdateContextCommand updateCmd,
                                        AbstractContext context,
-                                       Map excludedPropertyPatterns) {
-        Map diffs = context.getPropertyDifferences();
-        for (Iterator iter = diffs.keySet().iterator(); iter.hasNext();) {
-            String key = (String) iter.next();
-            Object prop = context.getProperty(key);
-            if (prop instanceof Serializable) { // First check whether it is serializable
-
-                // Next check whether it matches an excluded pattern
-                if (!isExcluded(key, context.getClass().getName(), excludedPropertyPatterns)) {
-                    log.debug("sending property =" + key + "-" + prop);
-                    PropertyDifference diff = (PropertyDifference) diffs.get(key);
-                    diff.setValue(prop);
-                    updateCmd.addProperty(diff);
+                                       Map excludedPropertyPatterns,
+                                       boolean includeAllProperties) {
+        if (!includeAllProperties) {
+            Map diffs = context.getPropertyDifferences();
+            for (Iterator iter = diffs.keySet().iterator(); iter.hasNext();) {
+                String key = (String) iter.next();
+                Object prop = context.getPropertyNonReplicable(key);
+                if (prop instanceof Serializable) { // First check whether it is serializable
+
+                    // Next check whether it matches an excluded pattern
+                    if (!isExcluded(key, context.getClass().getName(), excludedPropertyPatterns)) {
+                        log.debug("sending property =" + key + "-" + prop);
+                        PropertyDifference diff = (PropertyDifference) diffs.get(key);
+                        diff.setValue(prop);
+                        updateCmd.addProperty(diff);
+                    }
+                }
+            }
+        } else {
+            for (Iterator iter = context.getPropertyNames(); iter.hasNext();) {
+                String key = (String) iter.next();
+                Object prop = context.getPropertyNonReplicable(key);
+                if (prop instanceof Serializable) { // First check whether it is serializable
+
+                    // Next check whether it matches an excluded pattern
+                    if (!isExcluded(key, context.getClass().getName(), excludedPropertyPatterns)) {
+                        log.debug("sending property =" + key + "-" + prop);
+                        PropertyDifference diff = new PropertyDifference(key, prop, false);
+                        updateCmd.addProperty(diff);
+                    }
                 }
             }
         }
@@ -143,12 +178,9 @@
         } else if (abstractContext instanceof ServiceContext) {
             ServiceContext serviceCtx = (ServiceContext) abstractContext;
             ServiceContextCommand cmd = new CreateServiceContextCommand();
-            ServiceGroupContext parent = (ServiceGroupContext) serviceCtx.getParent();
-            if (parent != null) {
-                cmd.setServiceGroupContextId(parent.getId());
-            }
-            //TODO: check impl
-            cmd.setServiceGroupName(serviceCtx.getGroupName());
+            ServiceGroupContext sgCtx = (ServiceGroupContext) serviceCtx.getParent();
+            cmd.setServiceGroupContextId(sgCtx.getId());
+            cmd.setServiceGroupName(sgCtx.getDescription().getServiceGroupName());
             cmd.setServiceName(serviceCtx.getAxisService().getName());
             return cmd;
         }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java Fri May 25 09:35:51 2007
@@ -58,7 +58,8 @@
     public void updateContext(AbstractContext context) throws ClusteringFault {
         ContextClusteringCommand message =
                 ContextClusteringCommandFactory.getUpdateCommand(context,
-                                                                 excludedReplicationPatterns);
+                                                                 excludedReplicationPatterns,
+                                                                 false);
         if (message != null) {
             processor.process(message);
         }
@@ -105,6 +106,10 @@
 
     public void setReplicationExcludePatterns(String contextType, List patterns) {
         excludedReplicationPatterns.put(contextType, patterns);
+    }
+
+    public Map getReplicationExcludePatterns(){
+        return excludedReplicationPatterns;
     }
 
     // ---------------------- Methods from ParameterInclude ----------------------------------------

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/CreateServiceContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/CreateServiceContextCommand.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/CreateServiceContextCommand.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/CreateServiceContextCommand.java Fri May 25 09:35:51 2007
@@ -38,6 +38,7 @@
         }
         String scope = axisService.getScope();
         if (sgCtx == null) {
+
             sgCtx = new ServiceGroupContext(configurationContext,
                                             configurationContext.getAxisConfiguration().
                                                     getServiceGroup(serviceGroupName));

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateCommand.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateCommand.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateCommand.java Fri May 25 09:35:51 2007
@@ -16,15 +16,78 @@
 package org.apache.axis2.clustering.control;
 
 import org.apache.axis2.clustering.ClusteringFault;
+import org.apache.axis2.clustering.context.ContextClusteringCommand;
+import org.apache.axis2.clustering.context.ContextClusteringCommandFactory;
+import org.apache.axis2.clustering.context.ContextManager;
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 
  */
 public class GetStateCommand extends ControlCommand {
 
-    public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+    private ContextClusteringCommand[] commands;
+
+    public void execute(ConfigurationContext configCtx) throws ClusteringFault {
+
         //TODO: Method implementation
         System.err.println("####### Going to send state to Member");
+
+
+        ContextManager contextManager =
+                configCtx.getAxisConfiguration().getClusterManager().getContextManager();
+        if (contextManager != null) {
+            Map excludedPropPatterns = contextManager.getReplicationExcludePatterns();
+            List cmdList = new ArrayList();
+
+            // Add the service group contexts, service contexts & their respective properties
+            for (Iterator iter = configCtx.getServiceGroupContexts().keySet().iterator();
+                 iter.hasNext();) {
+                String id = (String) iter.next();
+                ServiceGroupContext sgCtx = configCtx.getServiceGroupContext(id);
+                cmdList.add(ContextClusteringCommandFactory.getCreateCommand(sgCtx));
+                ContextClusteringCommand updateCmd =
+                        ContextClusteringCommandFactory.getUpdateCommand(sgCtx,
+                                                                         excludedPropPatterns,
+                                                                         true);
+                if (updateCmd != null) {
+                    cmdList.add(updateCmd);
+                }
+                for (Iterator iter2 = sgCtx.getServiceContexts(); iter2.hasNext();) {
+                    ServiceContext serviceCtx = (ServiceContext) iter2.next();
+                    cmdList.add(ContextClusteringCommandFactory.getCreateCommand(serviceCtx));
+                    ContextClusteringCommand updateServiceCtxCmd =
+                            ContextClusteringCommandFactory.getUpdateCommand(serviceCtx,
+                                                                             excludedPropPatterns,
+                                                                             true);
+                    if (updateServiceCtxCmd != null) {
+                        cmdList.add(updateServiceCtxCmd);
+                    }
+                }
+            }
+
+            ContextClusteringCommand updateCmd =
+                    ContextClusteringCommandFactory.getUpdateCommand(configCtx,
+                                                                     excludedPropPatterns,
+                                                                     true);
+            if (updateCmd != null) {
+                cmdList.add(updateCmd);
+            }
+            if (!cmdList.isEmpty()) {
+                commands = (ContextClusteringCommand[]) cmdList.
+                        toArray(new ContextClusteringCommand[cmdList.size()]);
+            }
+        }
+    }
+
+    public ContextClusteringCommand[] getCommands() {
+        return commands;
     }
 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateResponseCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateResponseCommand.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateResponseCommand.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/GetStateResponseCommand.java Fri May 25 09:35:51 2007
@@ -17,6 +17,7 @@
 
 import org.apache.axis2.clustering.ClusteringConstants;
 import org.apache.axis2.clustering.ClusteringFault;
+import org.apache.axis2.clustering.context.ContextClusteringCommand;
 import org.apache.axis2.context.ConfigurationContext;
 
 /**
@@ -24,9 +25,19 @@
  */
 public class GetStateResponseCommand extends ControlCommand {
 
+    private ContextClusteringCommand[] commands;
+
     public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
-        //TODO: Method implementation
         configurationContext.
                 setNonReplicableProperty(ClusteringConstants.CLUSTER_INITIALIZED, "true");
+        if (commands != null) {
+            for (int i = 0; i < commands.length; i++) {
+                commands[i].execute(configurationContext);
+            }
+        }
+    }
+
+    public void setCommands(ContextClusteringCommand[] commands) {
+        this.commands = commands;
     }
 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java Fri May 25 09:35:51 2007
@@ -17,13 +17,11 @@
 package org.apache.axis2.clustering.tribes;
 
 import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.clustering.control.ControlCommand;
-import org.apache.axis2.clustering.control.GetStateCommand;
-import org.apache.axis2.clustering.control.GetStateResponseCommand;
 import org.apache.axis2.clustering.configuration.ConfigurationClusteringCommand;
 import org.apache.axis2.clustering.configuration.DefaultConfigurationManager;
 import org.apache.axis2.clustering.context.ContextClusteringCommand;
 import org.apache.axis2.clustering.context.DefaultContextManager;
+import org.apache.axis2.clustering.control.ControlCommand;
 import org.apache.catalina.tribes.Member;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -33,7 +31,7 @@
 
 public class ChannelListener implements org.apache.catalina.tribes.ChannelListener {
     private static final Log log = LogFactory.getLog(ChannelListener.class);
-    
+
     private DefaultContextManager contextManager;
     private DefaultConfigurationManager configurationManager;
     private TribesControlCommandProcessor controlCommandProcessor;
@@ -58,26 +56,31 @@
         return true;
     }
 
-    public void messageReceived(Serializable msg, Member sender) {
+    public void messageReceived(final Serializable msg, final Member sender) {
         log.debug("Message received : " + msg);
-        if (msg instanceof ContextClusteringCommand) {
-            try {
-                contextManager.notifyListener((ContextClusteringCommand) msg);
-            } catch (ClusteringFault e) {
-                log.error("Could not process ContextCommand", e);
-            }
-        } else if (msg instanceof ConfigurationClusteringCommand) {
-            try {
-                configurationManager.notifyListener((ConfigurationClusteringCommand) msg);
-            } catch (ClusteringFault e) {
-                log.error("Could not process ConfigurationCommand", e);
-            }
-        } else if(msg instanceof ControlCommand){
-            try {
-                controlCommandProcessor.process((ControlCommand) msg, sender);
-            } catch (ClusteringFault e) {
-                log.error("Could not process ControlCommand", e);
+        Thread th = new Thread() {
+            public void run() {
+                if (msg instanceof ContextClusteringCommand) {
+                    try {
+                        contextManager.notifyListener((ContextClusteringCommand) msg);
+                    } catch (ClusteringFault e) {
+                        log.error("Could not process ContextCommand", e);
+                    }
+                } else if (msg instanceof ConfigurationClusteringCommand) {
+                    try {
+                        configurationManager.notifyListener((ConfigurationClusteringCommand) msg);
+                    } catch (ClusteringFault e) {
+                        log.error("Could not process ConfigurationCommand", e);
+                    }
+                } else if (msg instanceof ControlCommand) {
+                    try {
+                        controlCommandProcessor.process((ControlCommand) msg, sender);
+                    } catch (ClusteringFault e) {
+                        log.error("Could not process ControlCommand", e);
+                    }
+                }
             }
-        }
+        };
+        th.start();
     }
 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java Fri May 25 09:35:51 2007
@@ -18,7 +18,6 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.clustering.ClusterManager;
 import org.apache.axis2.clustering.ClusteringConstants;
 import org.apache.axis2.clustering.ClusteringFault;
@@ -29,6 +28,7 @@
 import org.apache.axis2.clustering.control.GetStateCommand;
 import org.apache.axis2.clustering.tribes.info.TransientTribesChannelInfo;
 import org.apache.axis2.clustering.tribes.info.TransientTribesMemberInfo;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.Parameter;
 import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.ChannelException;
@@ -52,7 +52,6 @@
 
     private HashMap parameters;
     private ManagedChannel channel;
-    private TribesMembershipListener membershipListener;
     private ConfigurationContext configurationContext;
     private TribesControlCommandProcessor controlCmdProcessor;
 
@@ -119,7 +118,7 @@
             channel.addChannelListener(listener);
             channel.addChannelListener(channelInfo);
             channel.addMembershipListener(memberInfo);
-            membershipListener = new TribesMembershipListener();
+            TribesMembershipListener membershipListener = new TribesMembershipListener();
             channel.addMembershipListener(membershipListener);
             channel.start(Channel.DEFAULT);
             sender.setChannel(channel);
@@ -136,15 +135,14 @@
             int numberOfTries = 0;
             while (members.length > 0 &&
                    configurationContext.
-                           getNonReplicableProperty(ClusteringConstants.CLUSTER_INITIALIZED) == null &&
-                    numberOfTries < 50) { // Don't keep on trying infinitely
+                           getPropertyNonReplicable(ClusteringConstants.
+                                   CLUSTER_INITIALIZED) == null &&
+                                                                numberOfTries < 50){ // Don't keep on trying infinitely
 
                 // While there are members and GetStateResponseCommand is not received do the following
                 try {
                     members = channel.getMembers();
                     int memberIndex = random.nextInt(members.length);
-
-                    System.err.println("###### memberIndex=" + memberIndex);
                     sender.sendToMember(new GetStateCommand(), members[memberIndex]);
                     System.out.println("### WAITING FOR STATE UPDATE");
                     Thread.sleep(200);
@@ -155,8 +153,8 @@
                 numberOfTries ++;
             }
             configurationContext.
-                           setNonReplicableProperty(ClusteringConstants.CLUSTER_INITIALIZED,
-                                                    "true");
+                    setNonReplicableProperty(ClusteringConstants.CLUSTER_INITIALIZED,
+                                             "true");
         } catch (ChannelException e) {
             String message = "Error starting Tribes channel";
             throw new ClusteringFault(message, e);
@@ -206,11 +204,7 @@
     }
 
     public void shutdown() throws ClusteringFault {
-
-        if (log.isDebugEnabled()) {
-            log.debug("Enter: TribesClusterManager::shutdown");
-        }
-
+        log.debug("Enter: TribesClusterManager::shutdown");
         if (channel != null) {
             try {
                 channel.stop(Channel.DEFAULT);
@@ -223,10 +217,7 @@
                 throw new ClusteringFault(e);
             }
         }
-
-        if (log.isDebugEnabled()) {
-            log.debug("Exit: TribesClusterManager::shutdown");
-        }
+        log.debug("Exit: TribesClusterManager::shutdown");
     }
 
     public void setConfigurationContext(ConfigurationContext configurationContext) {

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesControlCommandProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesControlCommandProcessor.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesControlCommandProcessor.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesControlCommandProcessor.java Fri May 25 09:35:51 2007
@@ -51,12 +51,13 @@
             // (i.e. by getting the GetStateResponseCommand), this node cannot send a response
             // to the state requester. So we simply return.
             if (configurationContext.
-                    getNonReplicableProperty(ClusteringConstants.CLUSTER_INITIALIZED) == null) {
+                    getPropertyNonReplicable(ClusteringConstants.CLUSTER_INITIALIZED) == null) {
                 return;
             }
             command.execute(configurationContext);
-            channelSender.sendToMember(new GetStateResponseCommand(),
-                                       sender);
+            GetStateResponseCommand getStateRespCmd = new GetStateResponseCommand();
+            getStateRespCmd.setCommands(((GetStateCommand) command).getCommands());
+            channelSender.sendToMember(getStateRespCmd, sender);
         } else {
             command.execute(configurationContext);
         }

Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java Fri May 25 09:35:51 2007
@@ -47,7 +47,7 @@
     protected AxisService service2 = null;
     protected String serviceName = "testService";
 
-    protected abstract ClusterManager getClusterManager();
+    protected abstract ClusterManager getClusterManager(ConfigurationContext configCtx);
 
     protected boolean skipChannelTests = false;
     protected TestConfigurationManagerListener configurationManagerListener;
@@ -59,11 +59,11 @@
 
         Thread.sleep(3000);
 
-        clusterManager1 = getClusterManager();
-        clusterManager2 = getClusterManager();
-
         configurationContext1 = ConfigurationContextFactory.createDefaultConfigurationContext();
         configurationContext2 = ConfigurationContextFactory.createDefaultConfigurationContext();
+        
+        clusterManager1 = getClusterManager(configurationContext1);
+        clusterManager2 = getClusterManager(configurationContext2);
 
         clusterManager1.getContextManager().setConfigurationContext(configurationContext1);
         clusterManager2.getContextManager().setConfigurationContext(configurationContext2);

Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ConfigurationManagerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ConfigurationManagerTest.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ConfigurationManagerTest.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ConfigurationManagerTest.java Fri May 25 09:35:51 2007
@@ -22,12 +22,14 @@
 import org.apache.axis2.clustering.configuration.DefaultConfigurationManager;
 import org.apache.axis2.clustering.configuration.DefaultConfigurationManagerListener;
 import org.apache.axis2.clustering.tribes.TribesClusterManager;
+import org.apache.axis2.context.ConfigurationContext;
 
 public class ConfigurationManagerTest extends
                                       org.apache.axis2.clustering.configuration.ConfigurationManagerTestCase {
 
-    protected ClusterManager getClusterManager() {
+    protected ClusterManager getClusterManager(ConfigurationContext configCtx) {
         TribesClusterManager tribesClusterManager = new TribesClusterManager();
+        tribesClusterManager.setConfigurationContext(configCtx);
         DefaultConfigurationManager configurationManager = new DefaultConfigurationManager();
         configurationManager.
                 setConfigurationManagerListener(new DefaultConfigurationManagerListener());

Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ManageContextTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ManageContextTest.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ManageContextTest.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ManageContextTest.java Fri May 25 09:35:51 2007
@@ -22,11 +22,13 @@
 import org.apache.axis2.clustering.configuration.DefaultConfigurationManagerListener;
 import org.apache.axis2.clustering.context.DefaultContextManager;
 import org.apache.axis2.clustering.context.DefaultContextManagerListener;
+import org.apache.axis2.context.ConfigurationContext;
 
 public class ManageContextTest extends ManageContextTestCase {
 
-    protected ClusterManager getClusterManager() {
+    protected ClusterManager getClusterManager(ConfigurationContext configCtx) {
         TribesClusterManager tribesClusterManager = new TribesClusterManager();
+        tribesClusterManager.setConfigurationContext(configCtx);
         DefaultConfigurationManager configurationManager = new DefaultConfigurationManager();
         configurationManager.
                 setConfigurationManagerListener(new DefaultConfigurationManagerListener());

Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/UpdateStateTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/UpdateStateTest.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/UpdateStateTest.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/UpdateStateTest.java Fri May 25 09:35:51 2007
@@ -23,11 +23,14 @@
 import org.apache.axis2.clustering.context.DefaultContextManagerListener;
 import org.apache.axis2.clustering.configuration.DefaultConfigurationManager;
 import org.apache.axis2.clustering.configuration.DefaultConfigurationManagerListener;
+import org.apache.axis2.context.ConfigurationContext;
 
 public class UpdateStateTest extends UpdateStateTestCase {
 
-    protected ClusterManager getClusterManager() {
+    protected ClusterManager getClusterManager(ConfigurationContext configCtx) {
         TribesClusterManager tribesClusterManager = new TribesClusterManager();
+        tribesClusterManager.setConfigurationContext(configCtx);
+        tribesClusterManager.setConfigurationContext(configurationContext1);
         DefaultConfigurationManager configurationManager = new DefaultConfigurationManager();
         configurationManager.
                 setConfigurationManagerListener(new DefaultConfigurationManagerListener());

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/context/ContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/context/ContextManager.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/context/ContextManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/context/ContextManager.java Fri May 25 09:35:51 2007
@@ -22,29 +22,40 @@
 import org.apache.axis2.description.ParameterInclude;
 
 import java.util.List;
+import java.util.Map;
 
 public interface ContextManager extends ParameterInclude {
 
-    public void addContext(AbstractContext context) throws ClusteringFault;
+    void addContext(AbstractContext context) throws ClusteringFault;
 
-    public void removeContext(AbstractContext context) throws ClusteringFault;
+    void removeContext(AbstractContext context) throws ClusteringFault;
 
-    public void updateContext(AbstractContext context) throws ClusteringFault;
+    void updateContext(AbstractContext context) throws ClusteringFault;
 
-    public boolean isContextClusterable(AbstractContext context) throws ClusteringFault;
+    boolean isContextClusterable(AbstractContext context) throws ClusteringFault;
 
-    public void setContextManagerListener(ContextManagerListener listener);
+    void setContextManagerListener(ContextManagerListener listener);
 
-    public void setConfigurationContext(ConfigurationContext configurationContext);
+    void setConfigurationContext(ConfigurationContext configurationContext);
 
     /**
      * All properties in the context with type <code>contextType</code> which have
      * names that match the specified pattern will be excluded from replication.
-     *
+     * <p/>
      * Generally, we can use the context class name as the context type.
      *
      * @param contextType
      * @param patterns    The patterns
      */
-    public void setReplicationExcludePatterns(String contextType, List patterns);
+    void setReplicationExcludePatterns(String contextType, List patterns);
+
+    /**
+     * Get all the excluded context property name patterns
+     *
+     * @return All the excluded pattern of all the contexts. The key of the Map is the
+     *         the <code>contextType</code>. See {@link #setReplicationExcludePatterns(String,List)}.
+     *         The values are of type {@link List} of {@link String} Objects,
+     *         which are a collection of patterns to be excluded.
+     */
+    Map getReplicationExcludePatterns();
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java?view=diff&rev=541719&r1=541718&r2=541719
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java Fri May 25 09:35:51 2007
@@ -77,6 +77,9 @@
      * @return Iterator over a collection of keys
      */
     public Iterator getPropertyNames() {
+        if(properties == null){
+            properties = new HashMap();
+        }
         return properties.keySet().iterator();
     }
 
@@ -106,10 +109,10 @@
      * @param key - if not found, will return null
      * @return Returns the property.
      */
-    public Object getNonReplicableProperty(String key) {
+    public Object getPropertyNonReplicable(String key) {
         Object obj = properties == null ? null : properties.get(key);
         if ((obj == null) && (parent != null)) {
-            obj = parent.getNonReplicableProperty(key);
+            obj = parent.getPropertyNonReplicable(key);
         }
         return obj;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org