You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2007/03/13 08:15:23 UTC

svn commit: r517569 - in /webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes: ./ configuration/ context/

Author: chamikara
Date: Tue Mar 13 00:15:22 2007
New Revision: 517569

URL: http://svn.apache.org/viewvc?view=rev&rev=517569
Log:
Moved the listening and sending logic to ChannelListener and ChannelSender

Added:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/ConfigurationCommand.java
Modified:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java

Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java?view=auto&rev=517569
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java Tue Mar 13 00:15:22 2007
@@ -0,0 +1,119 @@
+package org.apache.axis2.cluster.tribes;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.axis2.cluster.context.ContextEvent;
+import org.apache.axis2.cluster.tribes.context.ContextCommandMessage;
+import org.apache.axis2.cluster.tribes.context.ContextListenerEventType;
+import org.apache.axis2.cluster.tribes.context.ContextType;
+import org.apache.axis2.cluster.tribes.context.ContextUpdateEntryCommandMessage;
+import org.apache.axis2.cluster.tribes.context.ContextUpdater;
+import org.apache.axis2.cluster.tribes.context.TribesContextManager;
+import org.apache.catalina.tribes.Member;
+
+
+public class ChannelListener implements org.apache.catalina.tribes.ChannelListener {
+
+	ContextUpdater updater = null;
+	TribesContextManager contextManager = null;
+	
+	public void setContextManager(TribesContextManager contextManager) {
+		this.contextManager = contextManager;
+	}
+
+	public void setUpdater(ContextUpdater updater) {
+		this.updater = updater;
+	}
+
+	public boolean accept(Serializable msg, Member sender) {
+		return true;
+	}
+
+	public void messageReceived(Serializable msg, Member sender) {
+
+		if (!(msg instanceof ContextCommandMessage)) {
+			return;
+		}
+
+		ContextCommandMessage comMsg = (ContextCommandMessage) msg;
+
+		// TODO make sure to remove from the duplicate lists when remove is
+		// requested for both service group and service contexts
+		// TODO fix this to support scopes other than SOAP Session.
+
+		if (comMsg.getCommandName().equals(CommandType.CREATE_SERVICE_GROUP_CONTEXT)) {
+
+			// add to the duplicate list to prevent cyclic replication
+			contextManager.addToDuplicateServiceGroupContexts(comMsg.getContextId());
+			updater.addServiceGroupContext(comMsg.getContextId());
+
+			ContextEvent event = new ContextEvent();
+			event.setContextType(ContextType.SERVICE_GROUP_CONTEXT);
+			event.setContextID(comMsg.getContextId());
+			event.setParentContextID(comMsg.getParentId());
+			event.setDescriptionID(comMsg.getAxisDescriptionName());
+
+			contextManager.notifyListeners(event, ContextListenerEventType.ADD_CONTEXT);
+
+		} else if (comMsg.getCommandName().equals(CommandType.CREATE_SERVICE_CONTEXT)) {
+
+			// add to the duplicate list to prevent cyclic replication
+			contextManager.addToDuplicateServiceContexts(comMsg.getParentId()
+					+ comMsg.getContextId());
+			updater.addServiceContext(comMsg.getParentId(), comMsg.getContextId());
+
+			ContextEvent event = new ContextEvent();
+			event.setContextType(ContextType.SERVICE_CONTEXT);
+			event.setContextID(comMsg.getContextId());
+			event.setParentContextID(comMsg.getParentId());
+			event.setDescriptionID(comMsg.getAxisDescriptionName());
+
+			contextManager.notifyListeners(event, ContextListenerEventType.ADD_CONTEXT);
+
+		} else if (comMsg.getCommandName().equals(CommandType.UPDATE_STATE)) {
+
+			if (comMsg.getContextType() == ContextType.SERVICE_GROUP_CONTEXT) {
+
+				ContextEvent event = new ContextEvent();
+				event.setContextType(ContextType.SERVICE_GROUP_CONTEXT);
+				event.setContextID(comMsg.getContextId());
+				event.setParentContextID(comMsg.getParentId());
+				event.setDescriptionID(comMsg.getAxisDescriptionName());
+
+				contextManager.notifyListeners(event, ContextListenerEventType.UPDATE_CONTEXT);
+
+			} else if (comMsg.getContextType() == ContextType.SERVICE_CONTEXT) {
+
+				ContextEvent event = new ContextEvent();
+				event.setContextType(ContextType.SERVICE_CONTEXT);
+				event.setContextID(comMsg.getContextId());
+				event.setParentContextID(comMsg.getParentId());
+				event.setDescriptionID(comMsg.getAxisDescriptionName());
+
+				contextManager.notifyListeners(event, ContextListenerEventType.UPDATE_CONTEXT);
+
+			}
+
+		} else if (comMsg.getCommandName().equals(CommandType.UPDATE_STATE_MAP_ENTRY)) {
+
+			ContextUpdateEntryCommandMessage mapEntryMsg = (ContextUpdateEntryCommandMessage) comMsg;
+			if (mapEntryMsg.getCtxType() == ContextUpdateEntryCommandMessage.SERVICE_GROUP_CONTEXT) {
+				Map props = updater.getServiceGroupProps(comMsg.getContextId());
+				if (mapEntryMsg.getOperation() == ContextUpdateEntryCommandMessage.ADD_OR_UPDATE_ENTRY) {
+					props.put(mapEntryMsg.getKey(), mapEntryMsg.getValue());
+				} else {
+					props.remove(mapEntryMsg.getKey());
+				}
+			} else if (mapEntryMsg.getCtxType() == ContextUpdateEntryCommandMessage.SERVICE_CONTEXT) {
+				Map props = updater.getServiceProps(comMsg.getParentId(), comMsg.getContextId());
+				if (mapEntryMsg.getOperation() == ContextUpdateEntryCommandMessage.ADD_OR_UPDATE_ENTRY) {
+					props.put(mapEntryMsg.getKey(), mapEntryMsg.getValue());
+				} else {
+					props.remove(mapEntryMsg.getKey());
+				}
+			}
+		}
+	}
+	
+}

Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java?view=auto&rev=517569
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java Tue Mar 13 00:15:22 2007
@@ -0,0 +1,52 @@
+package org.apache.axis2.cluster.tribes;
+
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.cluster.tribes.context.ContextCommandMessage;
+import org.apache.axis2.cluster.tribes.context.TribesContextManager;
+import org.apache.catalina.tribes.Channel;
+import org.apache.catalina.tribes.ChannelException;
+import org.apache.catalina.tribes.Member;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ChannelSender {
+
+	private Channel channel;
+	
+    private static final Log log = LogFactory.getLog(ChannelSender.class);
+    
+	public void send(ContextCommandMessage msg) throws ClusteringFault {
+		Member[] group = channel.getMembers();
+		log.debug("Group size " + group.length);
+		// send the message
+
+		for (int i=0;i<group.length;i++) {
+			printMember(group[i]);
+		}
+
+		try {
+			channel.send(group, msg, 0);
+		} catch (ChannelException e) {
+			log.error("" + msg, e);
+			String message = "Error sending command message : " + msg;
+			throw new ClusteringFault (message, e);
+		}
+	}
+
+	public Channel getChannel() {
+		return channel;
+	}
+
+	public void setChannel(Channel channel) {
+		this.channel = channel;
+	}
+	
+	private void printMember(Member member) {
+		member.getUniqueId();
+		log.debug("\n===============================");
+		log.debug("Member Name " + member.getName());
+		log.debug("Member Host" + member.getHost());
+		log.debug("Member Payload" + member.getPayload());
+		log.debug("===============================\n");
+	}
+}

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java?view=diff&rev=517569&r1=517568&r2=517569
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java Tue Mar 13 00:15:22 2007
@@ -16,22 +16,14 @@
 
 package org.apache.axis2.cluster.tribes;
 
-import java.io.Serializable;
-import java.util.Map;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.cluster.ClusterManager;
 import org.apache.axis2.cluster.ClusteringFault;
 import org.apache.axis2.cluster.configuration.ConfigurationManager;
-import org.apache.axis2.cluster.context.ContextEvent;
 import org.apache.axis2.cluster.context.ContextManager;
 import org.apache.axis2.cluster.tribes.configuration.TribesConfigurationManager;
-import org.apache.axis2.cluster.tribes.context.ContextListenerEventType;
-import org.apache.axis2.cluster.tribes.context.ContextType;
 import org.apache.axis2.cluster.tribes.context.ContextUpdater;
-import org.apache.axis2.cluster.tribes.context.ContextCommandMessage;
 import org.apache.axis2.cluster.tribes.context.TribesContextManager;
-import org.apache.axis2.cluster.tribes.context.ContextUpdateEntryCommandMessage;
 import org.apache.axis2.cluster.tribes.info.TransientTribesChannelInfo;
 import org.apache.axis2.cluster.tribes.info.TransientTribesMemberInfo;
 import org.apache.axis2.context.ConfigurationContext;
@@ -39,19 +31,16 @@
 import org.apache.axis2.rpc.receivers.RPCMessageReceiver;
 import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.ChannelException;
-import org.apache.catalina.tribes.ChannelListener;
-import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.group.GroupChannel;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class TribesClusterManager implements ClusterManager, ChannelListener {
+public class TribesClusterManager implements ClusterManager {
 
 
-	TribesConfigurationManager descriptionManager = null;
+	TribesConfigurationManager configurationManager = null;
 	TribesContextManager contextManager = null;
 	ConfigurationContext configContext = null;
-	private Channel channel;
 	private ContextUpdater updater;
 	private static long timeout = 1000L; // this should be configured in the axis2.xml
 	
@@ -59,7 +48,7 @@
     
     public TribesClusterManager () {
 		contextManager = new TribesContextManager ();
-		descriptionManager = new TribesConfigurationManager ();
+		configurationManager = new TribesConfigurationManager ();
     }
 	
 	public ContextManager getContextManager() {
@@ -67,34 +56,45 @@
 	}
 
 	public ConfigurationManager getConfigurationManager() {
-		return descriptionManager;
+		return configurationManager;
 	}
 
 	public void init(ConfigurationContext context) throws ClusteringFault {
 		log.debug("initializing tibes");
 
+		this.configContext = context;
+		contextManager.setConfigContext(context);
+		
+		ChannelSender sender = new ChannelSender ();
+		ChannelListener listener = new ChannelListener ();
+
+		TransientTribesChannelInfo channelInfo = new TransientTribesChannelInfo();
+		TransientTribesMemberInfo memberInfo = new TransientTribesMemberInfo();
+
+		configContext.setProperty("MEMBER_INFO", memberInfo);
+		configContext.setProperty("CHANNEL_INFO", channelInfo);
+
+		contextManager.setSender(sender);
+		configurationManager.setSender(sender);
+		
 		try {
-			this.configContext = context;
-
-			TransientTribesChannelInfo channelInfo = new TransientTribesChannelInfo();
-			TransientTribesMemberInfo memberInfo = new TransientTribesMemberInfo();
-
-			configContext.setProperty("MEMBER_INFO", memberInfo);
-			configContext.setProperty("CHANNEL_INFO", channelInfo);
-
-			channel = new GroupChannel();
-			channel.addChannelListener(this);
+			Channel channel = new GroupChannel();
+			channel.addChannelListener (listener);
 			channel.addChannelListener(channelInfo);
 			channel.addMembershipListener(memberInfo);
 			channel.start(Channel.DEFAULT);
-			updater = new ContextUpdater (channel, TribesClusterManager.timeout, context.getAxisConfiguration()
-					.getSystemClassLoader());
+			sender.setChannel(channel);
+			contextManager.setSender(sender);
+			configurationManager.setSender(sender);
 			
-			contextManager.setChannel(channel);
+			updater = new ContextUpdater ();
 			contextManager.setUpdater(updater);
-			contextManager.setConfigContext(context);
+			
+			listener.setUpdater(updater);
+			listener.setContextManager(contextManager);
 			
 			registerTribesInfoService(configContext);
+
 		} catch (ChannelException e) {
 			String message = "Error starting Tribes channel";
 			throw new ClusteringFault (message, e);
@@ -112,97 +112,6 @@
 			String message = "Unable to create Tribes info web service";
 			throw new ClusteringFault (message, e);
 		}
-	}
-
-	public void messageReceived(Serializable msg, Member sender) {
-
-		if (!(msg instanceof ContextCommandMessage)) {
-			return;
-		}
-
-		ContextCommandMessage comMsg = (ContextCommandMessage) msg;
-
-		// TODO make sure to remove from the duplicate lists when remove is
-		// requested for both service group and service contexts
-		// TODO fix this to support scopes other than SOAP Session.
-
-		if (comMsg.getCommandName().equals(CommandType.CREATE_SERVICE_GROUP_CONTEXT)) {
-
-			// add to the duplicate list to prevent cyclic replication
-			contextManager.addToDuplicateServiceGroupContexts(comMsg.getContextId());
-			updater.addServiceGroupContext(comMsg.getContextId());
-
-			ContextEvent event = new ContextEvent();
-			event.setContextType(ContextType.SERVICE_GROUP_CONTEXT);
-			event.setContextID(comMsg.getContextId());
-			event.setParentContextID(comMsg.getParentId());
-			event.setDescriptionID(comMsg.getAxisDescriptionName());
-
-			contextManager.notifyListeners(event, ContextListenerEventType.ADD_CONTEXT);
-
-		} else if (comMsg.getCommandName().equals(CommandType.CREATE_SERVICE_CONTEXT)) {
-
-			// add to the duplicate list to prevent cyclic replication
-			contextManager.addToDuplicateServiceContexts(comMsg.getParentId()
-					+ comMsg.getContextId());
-			updater.addServiceContext(comMsg.getParentId(), comMsg.getContextId());
-
-			ContextEvent event = new ContextEvent();
-			event.setContextType(ContextType.SERVICE_CONTEXT);
-			event.setContextID(comMsg.getContextId());
-			event.setParentContextID(comMsg.getParentId());
-			event.setDescriptionID(comMsg.getAxisDescriptionName());
-
-			contextManager.notifyListeners(event, ContextListenerEventType.ADD_CONTEXT);
-
-		} else if (comMsg.getCommandName().equals(CommandType.UPDATE_STATE)) {
-
-			if (comMsg.getContextType() == ContextType.SERVICE_GROUP_CONTEXT) {
-
-				ContextEvent event = new ContextEvent();
-				event.setContextType(ContextType.SERVICE_GROUP_CONTEXT);
-				event.setContextID(comMsg.getContextId());
-				event.setParentContextID(comMsg.getParentId());
-				event.setDescriptionID(comMsg.getAxisDescriptionName());
-
-				contextManager.notifyListeners(event, ContextListenerEventType.UPDATE_CONTEXT);
-
-			} else if (comMsg.getContextType() == ContextType.SERVICE_CONTEXT) {
-
-				ContextEvent event = new ContextEvent();
-				event.setContextType(ContextType.SERVICE_CONTEXT);
-				event.setContextID(comMsg.getContextId());
-				event.setParentContextID(comMsg.getParentId());
-				event.setDescriptionID(comMsg.getAxisDescriptionName());
-
-				contextManager.notifyListeners(event, ContextListenerEventType.UPDATE_CONTEXT);
-
-			}
-
-		} else if (comMsg.getCommandName().equals(CommandType.UPDATE_STATE_MAP_ENTRY)) {
-
-			ContextUpdateEntryCommandMessage mapEntryMsg = (ContextUpdateEntryCommandMessage) comMsg;
-			if (mapEntryMsg.getCtxType() == ContextUpdateEntryCommandMessage.SERVICE_GROUP_CONTEXT) {
-				Map props = updater.getServiceGroupProps(comMsg.getContextId());
-				if (mapEntryMsg.getOperation() == ContextUpdateEntryCommandMessage.ADD_OR_UPDATE_ENTRY) {
-					props.put(mapEntryMsg.getKey(), mapEntryMsg.getValue());
-				} else {
-					props.remove(mapEntryMsg.getKey());
-				}
-			} else if (mapEntryMsg.getCtxType() == ContextUpdateEntryCommandMessage.SERVICE_CONTEXT) {
-				Map props = updater.getServiceProps(comMsg.getParentId(), comMsg.getContextId());
-				if (mapEntryMsg.getOperation() == ContextUpdateEntryCommandMessage.ADD_OR_UPDATE_ENTRY) {
-					props.put(mapEntryMsg.getKey(), mapEntryMsg.getValue());
-				} else {
-					props.remove(mapEntryMsg.getKey());
-				}
-			}
-		}
-	}
-
-	public boolean accept(Serializable msg, Member sender) {
-		// return msg instanceof TribesCommandMessage;
-		return true;
 	}
 
 }

Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/ConfigurationCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/ConfigurationCommand.java?view=auto&rev=517569
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/ConfigurationCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/ConfigurationCommand.java Tue Mar 13 00:15:22 2007
@@ -0,0 +1,42 @@
+package org.apache.axis2.cluster.tribes.configuration;
+
+import java.io.Serializable;
+
+public class ConfigurationCommand implements Serializable {
+	final static int COMMAND_LOAD_SERVICE_GROUP = 1;
+	final static int COMMAND_UNLOAD_SERVICE_GROUP = 2;
+	final static int COMMAND_APPLY_POLICY = 3;
+	final static int COMMAND_RELOAD_CONFIGURATION = 4;
+	final static int COMMAND_PREPARE = 5;
+	final static int COMMAND_COMMIT = 6;
+	final static int COMMAND_ROLLBACK = 7;
+	
+	int commandType;
+	String policy;
+	String sgcName;
+	
+	public int getCommandType() {
+		return commandType;
+	}
+	
+	public void setCommandType(int commandType) {
+		this.commandType = commandType;
+	}
+	
+	public String getPolicy() {
+		return policy;
+	}
+	
+	public void setPolicy(String policy) {
+		this.policy = policy;
+	}
+	
+	public String getSgcName() {
+		return sgcName;
+	}
+	
+	public void setSgcName(String sgcName) {
+		this.sgcName = sgcName;
+	}
+	
+}

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java?view=diff&rev=517569&r1=517568&r2=517569
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java Tue Mar 13 00:15:22 2007
@@ -16,14 +16,25 @@
 
 package org.apache.axis2.cluster.tribes.configuration;
 
+import java.util.ArrayList;
+
 import org.apache.axis2.cluster.configuration.ConfigurationManager;
 import org.apache.axis2.cluster.configuration.ConfigurationManagerListener;
+import org.apache.axis2.cluster.tribes.ChannelSender;
 import org.apache.neethi.Policy;
 
 public class TribesConfigurationManager implements ConfigurationManager {
 
+	private ArrayList listeners = null;
+	private ChannelSender sender = null;
+	
+	
+	public TribesConfigurationManager () {
+		listeners = new ArrayList ();
+	}
+	
 	public void addConfigurationManagerListener(ConfigurationManagerListener listener) {
-		throw new UnsupportedOperationException ();
+		listeners.add(listener);
 	}
 
 	public void applyPolicy(String serviceGroupName, Policy policy) {
@@ -31,27 +42,54 @@
 	}
 
 	public void commit() {
-		throw new UnsupportedOperationException ();
+		ConfigurationCommand command = new ConfigurationCommand ();
+		command.setCommandType(ConfigurationCommand.COMMAND_COMMIT);
+		
+		send (command);
 	}
 
 	public void loadServiceGroup(String serviceGroupName) {
-		throw new UnsupportedOperationException ();
+		ConfigurationCommand command = new ConfigurationCommand ();
+		command.setCommandType(ConfigurationCommand.COMMAND_LOAD_SERVICE_GROUP);
+		command.setSgcName(serviceGroupName);
+		
+		send (command);
 	}
 
 	public void prepare() {
-		throw new UnsupportedOperationException ();		
+		ConfigurationCommand command = new ConfigurationCommand ();
+		command.setCommandType(ConfigurationCommand.COMMAND_PREPARE);
+		
+		send (command);
 	}
 
 	public void reloadConfiguration() {
-		throw new UnsupportedOperationException ();		
+		ConfigurationCommand command = new ConfigurationCommand ();
+		command.setCommandType(ConfigurationCommand.COMMAND_RELOAD_CONFIGURATION);
+		
+		send (command);		
 	}
 
 	public void rollback() {
-		throw new UnsupportedOperationException ();		
+		ConfigurationCommand command = new ConfigurationCommand ();
+		command.setCommandType(ConfigurationCommand.COMMAND_ROLLBACK);
+		
+		send (command);			
 	}
 
 	public void unloadServiceGroup(String serviceGroupName) {
-		throw new UnsupportedOperationException ();		
+		ConfigurationCommand command = new ConfigurationCommand ();
+		command.setCommandType(ConfigurationCommand.COMMAND_LOAD_SERVICE_GROUP);
+		command.setSgcName(serviceGroupName);
+		
+		send (command);
 	}
 
+	private void send (ConfigurationCommand command) {
+		throw new UnsupportedOperationException ();
+	}
+
+	public void setSender(ChannelSender sender) {
+		this.sender = sender;
+	}
 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java?view=diff&rev=517569&r1=517568&r2=517569
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java Tue Mar 13 00:15:22 2007
@@ -26,16 +26,9 @@
 import java.util.Set;
 
 import org.apache.axis2.cluster.tribes.CommandType;
-import org.apache.catalina.tribes.Channel;
 
 public class ContextUpdater {
 
-	private Channel channel;
-
-	private long timeout = 1000;
-
-	private ClassLoader classLoader;
-
 	private Map serviceCtxProps = null;
 	private Map serviceGrpCtxProps = null;
 
@@ -47,44 +40,28 @@
 		return serviceGrpCtxProps;
 	}
 
-	public ContextUpdater(Channel channel, long timeout, ClassLoader classLoader) {
-		this.channel = channel;
-		this.timeout = timeout;
-		this.classLoader = classLoader;
+	public ContextUpdater() {
 		serviceCtxProps = new HashMap ();
 		serviceGrpCtxProps = new HashMap ();
 	}
 
 	public void addServiceContext(String parentId, String serviceCtxName) {
 		String key = parentId + "_" + serviceCtxName;
-		/*
-		 * serviceCtxProps.put(key,new ReplicatedMap(this, channel, timeout,
-		 * key, new ClassLoader[]{classLoader} ));
-		 */
-
 		serviceCtxProps.put(key, new HashMap());
 	}
 
 	public void addServiceGroupContext(String groupId) {
 		String key = groupId;
-		/*
-		 * serviceGrpCtxProps.put(key,new ReplicatedMap(this, channel, timeout,
-		 * key, new ClassLoader[]{classLoader} ));
-		 */
 		serviceGrpCtxProps.put(key, new HashMap());
 	}
 
 	public void removeServiceContext(String parentId, String serviceCtxName) {
 		String key = parentId + "_" + serviceCtxName;
-		HashMap map = (HashMap) serviceCtxProps.get(key);
-		// map.breakdown();
 		serviceCtxProps.remove(key);
 	}
 
 	public void removeServiceGroupContext(String groupId) {
 		String key = groupId;
-		HashMap map = (HashMap) serviceGrpCtxProps.get(key);
-		// map.breakdown();
 		serviceGrpCtxProps.remove(key);
 	}
 
@@ -189,7 +166,6 @@
 							(Serializable) value,
 							ContextUpdateEntryCommandMessage.SERVICE_CONTEXT,
 							ContextUpdateEntryCommandMessage.ADD_OR_UPDATE_ENTRY));
-					// oldProps.replicate(paramKey, true);
 				}
 			}
 
@@ -204,10 +180,8 @@
 						ContextUpdateEntryCommandMessage.SERVICE_CONTEXT,
 						ContextUpdateEntryCommandMessage.REMOVE_ENTRY));
 
-				// oldProps.replicate(paramKey, true);
 			}
 		} catch (RuntimeException e) {
-			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
 

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java?view=diff&rev=517569&r1=517568&r2=517569
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java Tue Mar 13 00:15:22 2007
@@ -28,6 +28,7 @@
 import org.apache.axis2.cluster.context.ContextManager;
 import org.apache.axis2.cluster.context.ContextManagerListener;
 import org.apache.axis2.cluster.handlers.ReplicationHandler;
+import org.apache.axis2.cluster.tribes.ChannelSender;
 import org.apache.axis2.cluster.tribes.CommandType;
 import org.apache.axis2.context.AbstractContext;
 import org.apache.axis2.context.ConfigurationContext;
@@ -46,7 +47,6 @@
     private static final Log log = LogFactory.getLog(TribesContextManager.class);
     
 	private ConfigurationContext configContext;
-	private Channel channel;
 	private ContextUpdater updater;
 
 	private Map orphanedServiceCtxs = new HashMap ();
@@ -54,10 +54,15 @@
 	private ArrayList addedServiceCtxs = new ArrayList ();
 	private ArrayList listeners = null;
 	
-	public TribesContextManager (ConfigurationContext configurationContext, Channel channel, ContextUpdater updater) {
+	private ChannelSender sender;
+	
+	public void setSender(ChannelSender sender) {
+		this.sender = sender;
+	}
+
+	public TribesContextManager (ConfigurationContext configurationContext, ContextUpdater updater) {
 		this ();
 		this.configContext = configurationContext;
-		this.channel = channel;
 		this.updater = updater;
 	}
 	
@@ -65,7 +70,6 @@
 		listeners = new ArrayList ();
 	}
 	
-	
 	public void notifyListeners(ContextEvent event, int eventType) {
 
 		for (Iterator it = listeners.iterator(); it.hasNext();) {
@@ -99,7 +103,7 @@
 				updater.addServiceContext(parentContextId, contextId);
 				comMsg = new ContextCommandMessage(CommandType.CREATE_SERVICE_CONTEXT,
 						parentContextId, contextId, contextId, ContextType.SERVICE_CONTEXT);
-				send(comMsg);
+				sender.send(comMsg);
 			} else {
 				// put in the queue until the service group context is created
 				// with an id
@@ -135,7 +139,7 @@
 					contextId, srvGrpCtx.getDescription().getServiceGroupName(),
 					ContextType.SERVICE_GROUP_CONTEXT);
 
-			send(comMsg);
+			sender.send(comMsg);
 
 			// now iterate through the list of service contexts and replicate them
 			List list = (List) orphanedServiceCtxs.get(srvGrpCtx.getDescription()
@@ -148,7 +152,7 @@
 					updater.addServiceContext(contextId, command.getContextId());
 					command.setParentId(contextId);
 
-					send(command);
+					sender.send(command);
 
 				}
 
@@ -183,7 +187,7 @@
 							.getServiceGroupName(), ContextType.SERVICE_CONTEXT);
 		}
 
-		send(comMsg);
+		sender.send(comMsg);
 	}
 
 	/*
@@ -216,42 +220,14 @@
 		if (mapEntryMsgs != null) {
 			for (Iterator it=mapEntryMsgs.iterator();it.hasNext();) {
 				ContextUpdateEntryCommandMessage msg = (ContextUpdateEntryCommandMessage) it.next();
-				send(msg);
+				sender.send(msg);
 			}
 		}
 
 		ContextCommandMessage comMsg = new ContextCommandMessage(CommandType.UPDATE_STATE,
 				parentContextId, contextId, contextId, contextType);
 
-		send(comMsg);
-	}
-
-
-	private void send(ContextCommandMessage msg) throws ClusteringFault {
-		Member[] group = channel.getMembers();
-		log.debug("Group size " + group.length);
-		// send the message
-
-		for (int i=0;i<group.length;i++) {
-			printMember(group[i]);
-		}
-
-		try {
-			channel.send(group, msg, 0);
-		} catch (ChannelException e) {
-			log.error("" + msg, e);
-			String message = "Error sending command message : " + msg;
-			throw new ClusteringFault (message, e);
-		}
-	}
-	
-	private void printMember(Member member) {
-		member.getUniqueId();
-		log.debug("\n===============================");
-		log.debug("Member Name " + member.getName());
-		log.debug("Member Host" + member.getHost());
-		log.debug("Member Payload" + member.getPayload());
-		log.debug("===============================\n");
+		sender.send(comMsg);
 	}
 
 	public boolean isContextClusterable(AbstractContext context) {
@@ -288,11 +264,6 @@
 
 	public void addContextManagerListener(ContextManagerListener listener) {
 		listeners.add(listener);
-	}
-
-
-	public void setChannel(Channel channel) {
-		this.channel = channel;
 	}
 
 	public void setUpdater(ContextUpdater updater) {



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