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/19 11:04:23 UTC
svn commit: r539716 [1/2] - in /webservices/axis2/trunk/java/modules:
clustering/src/org/apache/axis2/cluster/handlers/
clustering/src/org/apache/axis2/cluster/listeners/
clustering/src/org/apache/axis2/cluster/tribes/
clustering/src/org/apache/axis2/c...
Author: azeez
Date: Sat May 19 02:04:21 2007
New Revision: 539716
URL: http://svn.apache.org/viewvc?view=rev&rev=539716
Log:
Making the necessary change to make clustering work. Properties in the config ctx are properly getting replicated now.
Added:
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceGroupContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateSessionContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceGroupContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceGroupContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandMessage.java
- copied, changed from r538503, webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/CommandMessage.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextCommandMessage.java
- copied, changed from r538503, webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessage.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/PropertyDifference.java
Removed:
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/CommandMessage.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessage.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdateEntryCommandMessage.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextEvent.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextType.java
Modified:
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/handlers/ReplicationHandler.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java
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/TribesClusterManager.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/ConfigurationCommand.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/info/TransientTribesChannelInfo.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManagerListener.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ServiceGroupContext.java
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/handlers/ReplicationHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/handlers/ReplicationHandler.java?view=diff&rev=539716&r1=539715&r2=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/handlers/ReplicationHandler.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/handlers/ReplicationHandler.java Sat May 19 02:04:21 2007
@@ -32,57 +32,64 @@
public class ReplicationHandler extends AbstractHandler {
private static final Log log = LogFactory.getLog(ReplicationHandler.class);
-
- public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
-
- replicateState(msgContext);
-
- return InvocationResponse.CONTINUE;
- }
-
- public void flowComplete(MessageContext msgContext) {
- super.flowComplete(msgContext);
-
- try {
- replicateState(msgContext);
- } catch (ClusteringFault e) {
- String message = "Could not replicate the state";
- log.error(message);
- }
- }
-
- private void replicateState(MessageContext message) throws ClusteringFault {
-
- ConfigurationContext configurationContext = message.getConfigurationContext();
- AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
- ClusterManager clusterManager = axisConfiguration.getClusterManager();
-
- if (clusterManager != null) {
-
- ContextManager contextManager = clusterManager.getContextManager();
- if (contextManager==null) {
- if (log.isDebugEnabled()) {
- String msg = "Cannot replicate contexts since the ClusterManager has not defined a ContextManager";
- log.error(msg);
- }
- }
-
- ServiceContext serviceContext = message.getServiceContext();
- ServiceGroupContext serviceGroupContext = message.getServiceGroupContext();
-
-
- contextManager.updateContext(configurationContext);
-
- if (serviceGroupContext != null) {
- contextManager.updateContext(serviceGroupContext);
- }
-
- if (serviceContext != null) {
- contextManager.updateContext(serviceContext);
- }
-
- }
-
- }
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+ replicateState(msgContext);
+ return InvocationResponse.CONTINUE;
+ }
+
+ public void flowComplete(MessageContext msgContext) {
+ super.flowComplete(msgContext);
+ try {
+ System.err.println("############ Going to replicate state on flow complete");
+ replicateState(msgContext);
+ System.err.println("########### Replicated state ");
+ } catch (Exception e) {
+ String message = "Could not replicate the state";
+ log.error(message, e);
+ }
+ }
+
+ private void replicateState(MessageContext message) throws ClusteringFault {
+
+ ConfigurationContext configurationContext = message.getConfigurationContext();
+ AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
+ ClusterManager clusterManager = axisConfiguration.getClusterManager();
+
+ if (clusterManager != null) {
+
+ ContextManager contextManager = clusterManager.getContextManager();
+ if (contextManager == null) {
+ String msg = "Cannot replicate contexts since " +
+ "ContextManager is not specified in the axis2.xml file.";
+ log.error(msg);
+ return;
+ }
+
+ // Replicate state stored in ConfigurationContext
+ if (!configurationContext.getPropertyDifferences().isEmpty()) {
+ contextManager.updateContext(configurationContext);
+ }
+
+ // Replicate state stored in ServiceGroupContext
+ ServiceGroupContext serviceGroupContext = message.getServiceGroupContext();
+ if (serviceGroupContext != null) {
+ if (!serviceGroupContext.getPropertyDifferences().isEmpty()) {
+ contextManager.updateContext(serviceGroupContext);
+ }
+ }
+
+ // Replicate state stored in ServiceContext
+ ServiceContext serviceContext = message.getServiceContext();
+ if (serviceContext != null) {
+ if (!serviceContext.getPropertyDifferences().isEmpty()) {
+ contextManager.updateContext(serviceContext);
+ }
+ }
+ } else {
+ String msg = "Cannot replicate contexts since " +
+ "ClusterManager is not specified in the axis2.xml file.";
+ throw new ClusteringFault(msg);
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java?view=diff&rev=539716&r1=539715&r2=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java Sat May 19 02:04:21 2007
@@ -16,118 +16,37 @@
package org.apache.axis2.cluster.listeners;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.cluster.context.ContextEvent;
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.cluster.context.ContextCommandMessage;
import org.apache.axis2.cluster.context.ContextManagerListener;
-import org.apache.axis2.cluster.tribes.context.ContextType;
-import org.apache.axis2.cluster.tribes.context.ContextUpdater;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class DefaultContextManagerListener implements ContextManagerListener {
- ContextUpdater updater = null;
- ConfigurationContext configurationContext = null;
- private static final Log log = LogFactory.getLog(DefaultContextManagerListener.class);
-
- public ContextUpdater getUpdater() {
- return updater;
- }
-
- public void setUpdater(ContextUpdater updater) {
- this.updater = updater;
- }
-
- public void contextAdded(ContextEvent event) {
-
- if (log.isDebugEnabled())
- log.debug("Enter: DefaultContextManagerListener::contextAdded");
-
- try {
-
- if (event.getContextType()==ContextType.SERVICE_GROUP_CONTEXT) {
- AxisServiceGroup axisServiceGroup = configurationContext.getAxisConfiguration()
- .getServiceGroup(event.getDescriptionID());
- ServiceGroupContext ctx = new ServiceGroupContext(configurationContext, axisServiceGroup);
- ctx.setId(event.getContextID());
- configurationContext.registerServiceGroupContextintoSoapSessionTable(ctx);
- } else if (event.getContextType()==ContextType.SERVICE_CONTEXT) {
- AxisService axisService = configurationContext.getAxisConfiguration().
- getService(event.getContextID ());
- ServiceGroupContext srvGrpCtx = configurationContext.getServiceGroupContext(event
- .getParentContextID ());
- // This will create service context if one is not available
- srvGrpCtx.getServiceContext(axisService);
- }
-
- } catch (AxisFault e) {
- e.printStackTrace();
- }
-
- if (log.isDebugEnabled())
- log.debug("Exit: DefaultContextManagerListener::contextAdded");
- }
-
- public void contextRemoved(ContextEvent event) {
-
- }
-
- public void contextUpdated(ContextEvent event) {
-
- if (log.isDebugEnabled())
- log.debug("Enter: DefaultContextManagerListener::contextUpdated");
-
- if (event.getContextType()==ContextType.SERVICE_GROUP_CONTEXT) {
-
- ServiceGroupContext srvGrpCtx = configurationContext.getServiceGroupContext(
- event.getContextID());
- Map props = updater.getServiceGroupProps(event.getContextID());
- if (props != null)
- srvGrpCtx.setProperties(props);
-
- } else if (event.getContextType() == ContextType.SERVICE_CONTEXT) {
-
- ServiceGroupContext srvGrpCtx = configurationContext.getServiceGroupContext
- (event.getParentContextID ());
- Iterator iter = srvGrpCtx.getServiceContexts();
- String serviceCtxName = event.getDescriptionID();
- ServiceContext serviceContext = null;
- while (iter.hasNext()) {
- ServiceContext serviceContext2 = (ServiceContext) iter.next();
- if (serviceContext2.getName() != null
- && serviceContext2.getName().equals(serviceCtxName))
- serviceContext = serviceContext2;
- }
-
- if (serviceContext != null) {
-
- Map srvProps = updater.getServiceProps(event.getParentContextID(), event.getContextID());
-
- if (srvProps != null) {
- serviceContext.setProperties(srvProps);
- }
-
- } else {
- String message = "Cannot find the ServiceContext with the ID:" + serviceCtxName;
- log.error(message);
- }
-
- }
-
- if (log.isDebugEnabled())
- log.debug("Exit: DefaultContextManagerListener::contextUpdated");
- }
-
- public void setConfigurationContext(ConfigurationContext configurationContext) {
- this.configurationContext = configurationContext;
- }
+ private ConfigurationContext configurationContext;
+ private static final Log log = LogFactory.getLog(DefaultContextManagerListener.class);
+ public void contextAdded(ContextCommandMessage message) throws ClusteringFault {
+ log.debug("Enter: DefaultContextManagerListener::contextAdded");
+ message.execute(configurationContext);
+ log.debug("Exit: DefaultContextManagerListener::contextAdded");
+ }
+
+ public void contextRemoved(ContextCommandMessage message) throws ClusteringFault {
+ log.debug("Enter: DefaultContextManagerListener::contextRemoved");
+ message.execute(configurationContext);
+ log.debug("Exit: DefaultContextManagerListener::contextRemoved");
+ }
+
+ public void contextUpdated(ContextCommandMessage message) throws ClusteringFault {
+ log.debug("Enter: DefaultContextManagerListener::contextRemoved");
+ message.execute(configurationContext);
+ log.debug("Exit: DefaultContextManagerListener::contextRemoved");
+ }
+
+ public void setConfigurationContext(ConfigurationContext configurationContext) {
+ this.configurationContext = configurationContext;
+ }
}
Modified: 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=diff&rev=539716&r1=539715&r2=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java Sat May 19 02:04:21 2007
@@ -16,30 +16,24 @@
package org.apache.axis2.cluster.tribes;
-import java.io.Serializable;
-import java.util.Map;
-
+import org.apache.axis2.cluster.ClusteringFault;
import org.apache.axis2.cluster.CommandType;
import org.apache.axis2.cluster.configuration.ConfigurationEvent;
-import org.apache.axis2.cluster.context.ContextEvent;
+import org.apache.axis2.cluster.context.ContextCommandMessage;
import org.apache.axis2.cluster.tribes.configuration.ConfigurationCommand;
import org.apache.axis2.cluster.tribes.configuration.TribesConfigurationManager;
-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;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.io.Serializable;
+
public class ChannelListener implements org.apache.catalina.tribes.ChannelListener {
- ContextUpdater updater = null;
- TribesContextManager contextManager = null;
- TribesConfigurationManager configurationManager = null;
+ private TribesContextManager contextManager = null;
+ private TribesConfigurationManager configurationManager = null;
private static final Log log = LogFactory.getLog(ChannelListener.class);
@@ -57,104 +51,19 @@
this.configurationManager = configurationManager;
}
- public void setUpdater(ContextUpdater updater) {
- this.updater = updater;
- }
-
public boolean accept(Serializable msg, Member sender) {
return true;
}
public void messageReceived(Serializable msg, Member sender) {
-
-
+ System.err.println("####### Message received " + msg);
if (msg instanceof ContextCommandMessage) {
-
- 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.getCommandType() == 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.getCommandType() == 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.getCommandType() == 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.getCommandType() == 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());
- }
- }
- } else {
- log.error("TribesClusterManager received an unknown Context Command");
+ try {
+ ContextCommandMessage comMsg = (ContextCommandMessage) msg;
+ contextManager.notifyListeners(comMsg);
+ } catch (ClusteringFault e) {
+ // TODO: Handle this
+ log.error(e);
}
} else if (msg instanceof ConfigurationCommand) {
Modified: 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=diff&rev=539716&r1=539715&r2=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java Sat May 19 02:04:21 2007
@@ -17,6 +17,7 @@
package org.apache.axis2.cluster.tribes;
import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.cluster.CommandMessage;
import org.apache.catalina.tribes.Channel;
import org.apache.catalina.tribes.ChannelException;
import org.apache.catalina.tribes.Member;
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=539716&r1=539715&r2=539716
==============================================================================
--- 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 Sat May 19 02:04:21 2007
@@ -23,7 +23,6 @@
import org.apache.axis2.cluster.configuration.ConfigurationManager;
import org.apache.axis2.cluster.context.ContextManager;
import org.apache.axis2.cluster.tribes.configuration.TribesConfigurationManager;
-import org.apache.axis2.cluster.tribes.context.ContextUpdater;
import org.apache.axis2.cluster.tribes.context.TribesContextManager;
import org.apache.axis2.cluster.tribes.info.TransientTribesChannelInfo;
import org.apache.axis2.cluster.tribes.info.TransientTribesMemberInfo;
@@ -81,8 +80,6 @@
configurationManager.setSender(sender);
try {
- ContextUpdater updater = new ContextUpdater();
- contextManager.setUpdater(updater);
ManagedChannel channel = new GroupChannel();
this.channel = channel;
@@ -99,7 +96,6 @@
Member[] members = channel.getMembers();
TribesUtil.printMembers(members);
- listener.setUpdater(updater);
listener.setContextManager(contextManager);
} catch (ChannelException e) {
Modified: 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=diff&rev=539716&r1=539715&r2=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/ConfigurationCommand.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/ConfigurationCommand.java Sat May 19 02:04:21 2007
@@ -16,33 +16,33 @@
package org.apache.axis2.cluster.tribes.configuration;
-import org.apache.axis2.cluster.tribes.CommandMessage;
+import org.apache.axis2.cluster.CommandMessage;
public class ConfigurationCommand extends CommandMessage {
-
- private String policy;
+
+ private String policy;
private String serviceName;
private String[] serviceGroupNames;
-
- public ConfigurationCommand (int commandType) {
- super (commandType);
- }
-
- public String getPolicy() {
- return policy;
- }
-
- public void setPolicy(String policy) {
- this.policy = policy;
- }
-
- public String[] getServiceGroupNames() {
- return serviceGroupNames;
- }
-
- public void setServiceGroupNames(String[] serviceGroupNames) {
- this.serviceGroupNames = serviceGroupNames;
- }
+
+ public ConfigurationCommand (int commandType) {
+ super (commandType);
+ }
+
+ public String getPolicy() {
+ return policy;
+ }
+
+ public void setPolicy(String policy) {
+ this.policy = policy;
+ }
+
+ public String[] getServiceGroupNames() {
+ return serviceGroupNames;
+ }
+
+ public void setServiceGroupNames(String[] serviceGroupNames) {
+ this.serviceGroupNames = serviceGroupNames;
+ }
public String getServiceName() {
return serviceName;
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextCommandMessageFactory.java Sat May 19 02:04:21 2007
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context;
+
+import org.apache.axis2.cluster.context.ContextCommandMessage;
+import org.apache.axis2.cluster.tribes.context.messages.*;
+import org.apache.axis2.context.*;
+
+import java.util.Map;
+import java.util.Iterator;
+import java.io.Serializable;
+
+/**
+ *
+ */
+public final class ContextCommandMessageFactory {
+ public static final int CREATE = 0;
+ public static final int UPDATE = 1;
+ public static final int DELETE = 2;
+
+ public static ContextCommandMessage getMessage(AbstractContext abstractContext,
+ int operationType) {
+ if (abstractContext instanceof ConfigurationContext && operationType == UPDATE) {
+ UpdateConfigurationContextCommand cmd = new UpdateConfigurationContextCommand();
+ Map diffs = abstractContext.getPropertyDifferences();
+ for (Iterator iter = diffs.keySet().iterator(); iter.hasNext();) {
+ String key = (String) iter.next();
+ Object prop = abstractContext.getProperty(key);
+// if (prop instanceof Serializable) { //TODO: Handling only Strings now
+ if (prop instanceof String || prop instanceof Integer) { //TODO: Handling only Strings now
+ System.err.println("..................... sending prop=" + key + "-" + prop);
+ PropertyDifference diff = (PropertyDifference) diffs.get(key);
+ diff.setValue(prop);
+
+ // TODO: Before adding it here, exclude all the properties with names matching the exclude patterns
+ cmd.addConfigurationContextProperty(diff);
+ }
+ }
+ abstractContext.clearPropertyDifferences(); // Once we send the diffs, we should clear the diffs
+ return cmd;
+ } else if (abstractContext instanceof ServiceGroupContext) {
+ ServiceGroupContext sgCtx = (ServiceGroupContext) abstractContext;
+ ServiceGroupContextCommand cmd;
+ switch (operationType) {
+ case CREATE:
+ cmd = new CreateServiceGroupContextCommand();
+ break;
+ case UPDATE:
+ cmd = new UpdateServiceGroupContextCommand();
+
+ // TODO: Need to get a diff between old & new properties
+ // TODO call UpdateServiceGroupContextCommand#addServiceGroupContextProperty
+ break;
+ case DELETE:
+ cmd = new DeleteServiceGroupContextCommand();
+ break;
+ default:
+ return null;
+ }
+ cmd.setServiceGroupName(sgCtx.getDescription().getServiceGroupName());
+ cmd.setServiceGroupContextId(sgCtx.getId());
+ return cmd;
+ } else if (abstractContext instanceof ServiceContext) {
+ ServiceContext serviceCtx = (ServiceContext) abstractContext;
+ ServiceContextCommand cmd;
+ switch (operationType) {
+ case CREATE:
+ cmd = new CreateServiceContextCommand();
+ ServiceGroupContext parent = (ServiceGroupContext)serviceCtx.getParent();
+ if (parent != null) {
+ ((CreateServiceContextCommand) cmd).setServiceGroupContextId(parent.getId());
+ }
+ break;
+ case UPDATE:
+ return new UpdateServiceContextCommand();
+ case DELETE:
+ return new DeleteServiceContextCommand();
+ default:
+ return null;
+ }
+ cmd.setServiceGroupName(serviceCtx.getGroupName());
+ cmd.setServiceName(serviceCtx.getAxisService().getName());
+ return cmd;
+ }
+ return null;
+ }
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/PropertyUpdater.java Sat May 19 02:04:21 2007
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context;
+
+import org.apache.axis2.context.AbstractContext;
+import org.apache.axis2.context.PropertyDifference;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ *
+ */
+public class PropertyUpdater implements Serializable{
+
+ private Map properties;
+
+ public void updateProperties(AbstractContext abstractContext) {
+ for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) {
+ String key = (String) iter.next();
+ PropertyDifference propDiff =
+ (PropertyDifference) properties.get(key);
+ if (propDiff.isRemoved()) {
+ abstractContext.removePropertyNonReplicable(key);
+ } else { // it is updated/added
+ abstractContext.setNonReplicableProperty(key, propDiff.getValue());
+ System.err.println("........ added prop=" + key);
+ }
+ }
+ }
+/*
+ public void addContextProperty(String key, Object value, int updateStatus) {
+ properties.put(key, new PropertyDifference(key, value, updateStatus));
+ }*/
+
+ public void addContextProperty(PropertyDifference diff) {
+ properties.put(diff.getKey(), diff);
+ }
+
+ public void setProperties(Map properties){
+ this.properties = properties;
+ }
+
+ public Map getProperties() {
+ return properties;
+ }
+}
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=539716&r1=539715&r2=539716
==============================================================================
--- 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 Sat May 19 02:04:21 2007
@@ -19,19 +19,14 @@
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.cluster.ClusteringFault;
-import org.apache.axis2.cluster.CommandType;
-import org.apache.axis2.cluster.context.ContextEvent;
+import org.apache.axis2.cluster.context.ContextCommandMessage;
import org.apache.axis2.cluster.context.ContextManager;
import org.apache.axis2.cluster.context.ContextManagerListener;
-import org.apache.axis2.cluster.listeners.DefaultContextManagerListener;
import org.apache.axis2.cluster.tribes.ChannelSender;
-import org.apache.axis2.cluster.tribes.CommandMessage;
import org.apache.axis2.context.AbstractContext;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.description.Parameter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -43,9 +38,7 @@
private static final Log log = LogFactory.getLog(TribesContextManager.class);
private ConfigurationContext configContext;
- private ContextUpdater updater;
- private Map orphanedServiceCtxs = new HashMap();
private List listeners = new ArrayList();
private Map parameters = new HashMap();
@@ -60,15 +53,24 @@
}
public void addContext(final AbstractContext context) throws ClusteringFault {
- processor.process(new AddContextCommand(), context);
+ ContextCommandMessage message =
+ ContextCommandMessageFactory.getMessage(context,
+ ContextCommandMessageFactory.CREATE);
+ processor.process(message);
}
public void removeContext(AbstractContext context) throws ClusteringFault {
- processor.process(new RemoveContextCommand(), context);
+ ContextCommandMessage message =
+ ContextCommandMessageFactory.getMessage(context,
+ ContextCommandMessageFactory.DELETE);
+ processor.process(message);
}
public void updateContext(AbstractContext context) throws ClusteringFault {
- processor.process(new UpdateContextCommand(), context);
+ ContextCommandMessage message =
+ ContextCommandMessageFactory.getMessage(context,
+ ContextCommandMessageFactory.UPDATE);
+ processor.process(message);
}
public boolean isContextClusterable(AbstractContext context) {
@@ -77,39 +79,27 @@
(context instanceof ServiceGroupContext);
}
- public void notifyListeners(ContextEvent event, int eventType) {
+ public void notifyListeners(ContextCommandMessage command) throws ClusteringFault {
- for (Iterator it = listeners.iterator(); it.hasNext();) {
- ContextManagerListener listener = (ContextManagerListener) it.next();
- if (eventType == ContextListenerEventType.ADD_CONTEXT) {
- listener.contextAdded(event);
- } else if (eventType == ContextListenerEventType.REMOVE_CONTEXT) {
- listener.contextRemoved(event);
- } else if (eventType == ContextListenerEventType.UPDATE_CONTEXT) {
- listener.contextUpdated(event);
+ for (Iterator iter = listeners.iterator(); iter.hasNext();) {
+ ContextManagerListener listener = (ContextManagerListener) iter.next();
+ switch (command.getMessageType()) {
+ case ContextCommandMessage.CREATE_SERVICE_CONTEXT_MSG:
+ case ContextCommandMessage.CREATE_SERVICE_GROUP_CONTEXT_MSG:
+ listener.contextAdded(command);
+ break;
+ case ContextCommandMessage.UPDATE_SERVICE_CONTEXT_MSG:
+ case ContextCommandMessage.UPDATE_SERVICE_GROUP_CONTEXT_MSG:
+ case ContextCommandMessage.UPDATE_CONFIGURATION_CONTEXT_MSG:
+ listener.contextUpdated(command);
+ break;
+ case ContextCommandMessage.DELETE_SERVICE_CONTEXT_MSG:
+ case ContextCommandMessage.DELETE_SERVICE_GROUP_CONTEXT_MSG:
+ listener.contextRemoved(command);
}
}
}
- private String getContextID(AbstractContext context) {
- String id = null;
- if (context instanceof ServiceContext) {
- AxisService axisService = ((ServiceContext) context).getAxisService();
- return axisService.getName();
- } else if (context instanceof ServiceGroupContext) {
- return ((ServiceGroupContext) context).getId();
- }
- return id;
- }
-
- public void addToDuplicateServiceGroupContexts(String id) {
-
- }
-
- public void addToDuplicateServiceContexts(String id) {
-
- }
-
public void addContextManagerListener(ContextManagerListener listener) {
if (configContext != null) {
listener.setConfigurationContext(configContext);
@@ -117,16 +107,6 @@
listeners.add(listener);
}
- public void setUpdater(ContextUpdater updater) {
- this.updater = updater;
-
- //updating the listeners
- for (Iterator it = listeners.iterator(); it.hasNext();) {
- DefaultContextManagerListener listener = (DefaultContextManagerListener) it.next();
- listener.setUpdater(updater);
- }
- }
-
public void setConfigurationContext(ConfigurationContext configurationContext) {
this.configContext = configurationContext;
@@ -139,10 +119,7 @@
}
}
- private void send(CommandMessage command) throws ClusteringFault {
- sender.send(command);
- }
-
+ // ---------------------- Methods from ParameterInclude ----------------------------------------
public void addParameter(Parameter param) throws AxisFault {
parameters.put(param.getName(), param);
}
@@ -170,209 +147,173 @@
public void deserializeParameters(OMElement parameterElement) throws AxisFault {
throw new UnsupportedOperationException();
}
+ // ---------------------------------------------------------------------------------------------
- private interface ContextCommand {
- void execute(AbstractContext context) throws ClusteringFault;
- }
-
- private class AddContextCommand implements ContextCommand {
-
- public void execute(AbstractContext context) throws ClusteringFault {
- if (log.isDebugEnabled()) {
- log.debug("Enter: TribesContextManager::addContext");
- }
- ContextCommandMessage comMsg;
-
- String contextId = getContextID(context);
- String parentContextId = getContextID(context.getParent());
-
- // The ServiceContex does not define a contextId
- // therefore the service name is used
- if (context instanceof ServiceContext) {
-
- if (log.isDebugEnabled()) {
- log.debug("Exit: TribesContextManager::addContext");
- }
-
- if (updater.getServiceGroupProps(parentContextId) != null) {
- updater.addServiceContext(parentContextId, contextId);
- comMsg = new ContextCommandMessage(CommandType.CREATE_SERVICE_CONTEXT,
- parentContextId,
- contextId,
- contextId,
- ContextType.SERVICE_CONTEXT);
- send(comMsg);
- } else {
- // put in the queue until the service group context is created
- // with an id
- comMsg = new ContextCommandMessage(CommandType.CREATE_SERVICE_CONTEXT,
- parentContextId,
- contextId,
- contextId,
- ContextType.SERVICE_CONTEXT);
-
- AxisServiceGroup serviceGroupDesc = ((ServiceContext) context)
- .getServiceGroupContext().getDescription();
- List list = (List) orphanedServiceCtxs.get(serviceGroupDesc
- .getServiceGroupName());
- if (list == null) {
- list = new ArrayList();
- orphanedServiceCtxs.put(serviceGroupDesc.getServiceGroupName(), list);
- }
- list.add(comMsg);
- }
- } else if (context instanceof ServiceGroupContext) {
-
- if (log.isDebugEnabled()) {
- log.debug("Exit: TribesContextManager::addContext");
- }
+/* private class AddContextCommand implements ContextCommand {
- ServiceGroupContext srvGrpCtx = (ServiceGroupContext) context;
+ public void execute(AbstractContext context) throws ClusteringFault {
+ if (log.isDebugEnabled()) {
+ log.debug("Enter: TribesContextManager::addContext");
+ }
+ ContextCommand comMsg;
- // The new serialization code sets the service group name as it's id initially
- if (srvGrpCtx.getId().equals(srvGrpCtx.getDescription().getServiceGroupName())) {
+ String contextId = getContextID(context);
+ String parentContextId = getContextID(context.getParent());
- if (log.isDebugEnabled()) {
- log.debug("Exit: TribesContextManager::addContext");
- }
-
- return;
- }
+ // The ServiceContex does not define a contextId
+ // therefore the service name is used
+ if (context instanceof ServiceContext) {
- updater.addServiceGroupContext(contextId);
+ if (log.isDebugEnabled()) {
+ log.debug("Exit: TribesContextManager::addContext");
+ }
- comMsg = new ContextCommandMessage(CommandType.CREATE_SERVICE_GROUP_CONTEXT,
- "",
- contextId,
- srvGrpCtx.getDescription().getServiceGroupName(),
- ContextType.SERVICE_GROUP_CONTEXT);
+ if (updater.getServiceGroupProps(parentContextId) != null) {
+ updater.addServiceContext(parentContextId, contextId);
+ public ContextCommandMessage(
+ int commandType,
+ String parentId,
+ String contextId,
+ String axisDescriptionName,
+ int contextType)
+
+ comMsg = new ContextCommand(CommandType.CREATE_SERVICE_CONTEXT,
+ parentContextId,
+ contextId,
+ contextId,
+ ContextType.SERVICE_CONTEXT);
send(comMsg);
-
- // now iterate through the list of service contexts and replicate them
- List list = (List) orphanedServiceCtxs.get(srvGrpCtx.getDescription()
+ } else {
+ // put in the queue until the service group context is created
+ // with an id
+ comMsg = new ContextCommand(CommandType.CREATE_SERVICE_CONTEXT,
+ parentContextId,
+ contextId,
+ contextId,
+ ContextType.SERVICE_CONTEXT);
+
+ AxisServiceGroup serviceGroupDesc = ((ServiceContext) context)
+ .getServiceGroupContext().getDescription();
+ List list = (List) orphanedServiceCtxs.get(serviceGroupDesc
.getServiceGroupName());
-
- if (list != null) {
- for (Iterator it = list.iterator(); it.hasNext();) {
-
- ContextCommandMessage command = (ContextCommandMessage) it.next();
- updater.addServiceContext(contextId, command.getContextId());
- command.setParentId(contextId);
-
- send(command);
-
- }
- orphanedServiceCtxs.remove(srvGrpCtx.getDescription().getServiceGroupName());
+ if (list == null) {
+ list = new ArrayList();
+ orphanedServiceCtxs.put(serviceGroupDesc.getServiceGroupName(), list);
}
+ list.add(comMsg);
}
-
- if (log.isDebugEnabled()) {
- log.debug("Exit: TribesContextManager::addContext");
- }
+ } else if (context instanceof ServiceGroupContext) {
+ log.debug("Exit: TribesContextManager::addServiceGroupContext");
+ ServiceGroupContext sgCtx = (ServiceGroupContext) context;
+ CreateServiceGroupContextCommand cmd =
+ new CreateServiceGroupContextCommand();
+ cmd.setServiceGroupName(sgCtx.getDescription().getServiceGroupName());
+ send(cmd);
+ log.debug("Exit: TribesContextManager::addContext");
}
}
+}
- private class RemoveContextCommand implements ContextCommand {
+private class RemoveContextCommand implements ContextCommand {
- public void execute(AbstractContext context) throws ClusteringFault {
- if (log.isDebugEnabled()) {
- log.debug("Enter: TribesContextManager::removeContext");
- }
+ public void execute(AbstractContext context) throws ClusteringFault {
+ if (log.isDebugEnabled()) {
+ log.debug("Enter: TribesContextManager::removeContext");
+ }
- ContextCommandMessage comMsg = null;
+ ContextCommand comMsg = null;
- String contextId = getContextID(context);
- String parentContextId = getContextID(context.getParent());
+ String contextId = getContextID(context);
+ String parentContextId = getContextID(context.getParent());
- if (context instanceof ServiceContext) {
- updater.removeServiceContext(parentContextId, contextId);
- comMsg = new ContextCommandMessage(CommandType.CREATE_SERVICE_GROUP_CONTEXT,
- parentContextId,
- contextId,
- contextId,
- ContextType.SERVICE_CONTEXT);
- } else if (context instanceof ServiceGroupContext) {
- updater.removeServiceGroupContext(contextId);
- comMsg = new ContextCommandMessage(CommandType.REMOVE_SERVICE_GROUP_CONTEXT,
- "",
- contextId,
- ((ServiceGroupContext) context).getDescription().getServiceGroupName(),
- ContextType.SERVICE_CONTEXT);
- }
+ if (context instanceof ServiceContext) {
+ updater.removeServiceContext(parentContextId, contextId);
+ comMsg = new ContextCommand(CommandType.CREATE_SERVICE_GROUP_CONTEXT,
+ parentContextId,
+ contextId,
+ contextId,
+ ContextType.SERVICE_CONTEXT);
+ } else if (context instanceof ServiceGroupContext) {
+ updater.removeServiceGroupContext(contextId);
+ comMsg = new ContextCommand(CommandType.REMOVE_SERVICE_GROUP_CONTEXT,
+ "",
+ contextId,
+ ((ServiceGroupContext) context).getDescription().getServiceGroupName(),
+ ContextType.SERVICE_CONTEXT);
+ }
- send(comMsg);
+ send(comMsg);
- if (log.isDebugEnabled()) {
- log.debug("Exit: TribesContextManager::removeContext");
- }
+ if (log.isDebugEnabled()) {
+ log.debug("Exit: TribesContextManager::removeContext");
}
}
+}
- private class UpdateContextCommand implements ContextCommand {
+private class UpdateContextCommand implements ContextCommand {
- public void execute(AbstractContext context) throws ClusteringFault {
+ public void execute(AbstractContext context) throws ClusteringFault {
- if (log.isDebugEnabled()) {
- log.debug("Enter: TribesContextManager::updateState");
- }
+ if (log.isDebugEnabled()) {
+ log.debug("Enter: TribesContextManager::updateState");
+ }
- String contextId = getContextID(context);
- String parentContextId = getContextID(context.getParent());
+ String contextId = getContextID(context);
+ String parentContextId = getContextID(context.getParent());
- Map props = context.getProperties();
+ Map props = context.getProperties();
- List mapEntryMsgs = null;
+ List mapEntryMsgs = null;
- int contextType = 0;
- if (context instanceof ServiceContext) {
- contextType = ContextType.SERVICE_CONTEXT;
- mapEntryMsgs = updater
- .updateStateOnServiceContext(parentContextId, contextId, props);
- } else if (context instanceof ServiceGroupContext) {
- contextType = ContextType.SERVICE_GROUP_CONTEXT;
- mapEntryMsgs = updater.updateStateOnServiceGroupContext(contextId, props);
- }
+ int contextType = 0;
+ if (context instanceof ServiceContext) {
+ contextType = ContextType.SERVICE_CONTEXT;
+ mapEntryMsgs = updater
+ .updateStateOnServiceContext(parentContextId, contextId, props);
+ } else if (context instanceof ServiceGroupContext) {
+ contextType = ContextType.SERVICE_GROUP_CONTEXT;
+ mapEntryMsgs = updater.updateStateOnServiceGroupContext(contextId, props);
+ }
- if (mapEntryMsgs != null) {
- for (Iterator it = mapEntryMsgs.iterator(); it.hasNext();) {
- ContextUpdateEntryCommandMessage msg = (ContextUpdateEntryCommandMessage) it.next();
- send(msg);
- }
+ if (mapEntryMsgs != null) {
+ for (Iterator it = mapEntryMsgs.iterator(); it.hasNext();) {
+ ContextUpdateEntryCommandMessage msg = (ContextUpdateEntryCommandMessage) it.next();
+ send(msg);
}
+ }
- ContextCommandMessage comMsg = new ContextCommandMessage(CommandType.UPDATE_STATE,
- parentContextId,
- contextId,
- contextId,
- contextType);
+ ContextCommand comMsg = new ContextCommand(CommandType.UPDATE_STATE,
+ parentContextId,
+ contextId,
+ contextId,
+ contextType);
- send(comMsg);
+ send(comMsg);
- if (log.isDebugEnabled()) {
- log.debug("Exit: TribesContextManager::updateState");
- }
+ if (log.isDebugEnabled()) {
+ log.debug("Exit: TribesContextManager::updateState");
}
}
+}*/
private class ContextReplicationProcessor {
- public void process(final ContextCommand cmd,
- final AbstractContext context) throws ClusteringFault {
+ public void process(final ContextCommandMessage cmd) throws ClusteringFault {
- // If the updater is NULL, it means the TribesClusterManager is still being initailized
+ // If the sender is NULL, it means the TribesClusterManager is still being initialized
// So we need to busy wait.
- if (updater == null) {
+ if (sender == null) {
Thread processorThread = new Thread("ProcessorThread") {
public void run() {
- while (updater == null) {
+ do {
try {
- Thread.sleep(1000);
+ Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
- }
+ } while (sender == null);
try {
- cmd.execute(context);
+ sender.send(cmd);
} catch (ClusteringFault clusteringFault) {
throw new RuntimeException(clusteringFault);
}
@@ -380,7 +321,7 @@
};
processorThread.start();
} else {
- cmd.execute(context);
+ sender.send(cmd);
}
}
}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.context.ServiceContext;
+
+/**
+ *
+ */
+public class CreateServiceContextCommand extends ServiceContextCommand {
+ private String serviceGroupContextId;
+
+ public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+ /*AxisService axisService =
+ configurationContext.getAxisConfiguration().
+ getService(message.getContextID());
+ ServiceGroupContext sgCtx =
+ configurationContext.getServiceGroupContext(message.getParentContextID());
+ // This will create service context if one is not available
+ sgCtx.getServiceContext(axisService);*/
+
+ // TODO: Implementation
+ ServiceGroupContext sgCtx =
+ configurationContext.getServiceGroupContext(serviceGroupContextId);
+ AxisService axisService;
+ try {
+ axisService = configurationContext.getAxisConfiguration().getService(serviceName);
+ } catch (AxisFault axisFault) {
+ throw new ClusteringFault(axisFault);
+ }
+ String scope = axisService.getScope();
+ if (sgCtx == null) {
+ sgCtx = new ServiceGroupContext(configurationContext,
+ configurationContext.getAxisConfiguration().
+ getServiceGroup(serviceGroupName));
+ sgCtx.setId(serviceGroupContextId);
+ if (scope.equals(Constants.SCOPE_APPLICATION)) {
+ configurationContext.
+ addServiceGroupContextintoApplicatoionScopeTable(sgCtx);
+ } else if (scope.equals(Constants.SCOPE_SOAP_SESSION)) {
+ configurationContext.
+ registerServiceGroupContextintoSoapSessionTable(sgCtx);
+ }
+ }
+ try {
+ sgCtx.getServiceContext(axisService, false);
+ } catch (AxisFault axisFault) {
+ throw new ClusteringFault(axisFault);
+ }
+ }
+
+ public void setServiceGroupContextId(String serviceGroupContextId) {
+ this.serviceGroupContextId = serviceGroupContextId;
+ }
+
+ public int getMessageType() {
+ return CREATE_SERVICE_CONTEXT_MSG;
+ }
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceGroupContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceGroupContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceGroupContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateServiceGroupContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.description.AxisServiceGroup;
+
+/**
+ *
+ */
+public class CreateServiceGroupContextCommand extends ServiceGroupContextCommand {
+
+ public void execute(ConfigurationContext configContext) throws ClusteringFault {
+ AxisServiceGroup axisServiceGroup =
+ configContext.getAxisConfiguration()
+ .getServiceGroup(serviceGroupName);
+ ServiceGroupContext ctx = new ServiceGroupContext(configContext, axisServiceGroup);
+ ctx.setId(serviceGroupContextId);
+ configContext.registerServiceGroupContextintoSoapSessionTable(ctx);
+ }
+
+ public int getMessageType() {
+ return CREATE_SERVICE_GROUP_CONTEXT_MSG;
+ }
+
+ public void setServiceGroupName(String serviceGroupName) {
+ this.serviceGroupName = serviceGroupName;
+ }
+
+ public void setServiceGroupContextId(String serviceGroupContextId) {
+ this.serviceGroupContextId = serviceGroupContextId;
+ }
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateSessionContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateSessionContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateSessionContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/CreateSessionContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.cluster.context.ContextCommandMessage;
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.context.ConfigurationContext;
+
+/**
+ *
+ */
+public class CreateSessionContextCommand extends ContextCommandMessage {
+ public void execute(ConfigurationContext configContext) throws ClusteringFault {
+ //TODO: Method implementation
+
+ }
+
+ public int getMessageType() {
+ //TODO: Method implementation
+ return 0;
+ }
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.context.ConfigurationContext;
+
+/**
+ *
+ */
+public class DeleteServiceContextCommand extends ServiceContextCommand {
+ public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+ // TODO: Implementation
+ }
+
+ public int getMessageType() {
+ return DELETE_SERVICE_CONTEXT_MSG;
+ }
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceGroupContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceGroupContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceGroupContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/DeleteServiceGroupContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.context.ConfigurationContext;
+
+/**
+ *
+ */
+public class DeleteServiceGroupContextCommand extends ServiceGroupContextCommand {
+ public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+ // TODO: Implementation
+ }
+
+ public int getMessageType() {
+ return DELETE_SERVICE_GROUP_CONTEXT_MSG;
+ }
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.cluster.context.ContextCommandMessage;
+
+/**
+ *
+ */
+public abstract class ServiceContextCommand extends ContextCommandMessage {
+ protected String serviceGroupName;
+ protected String serviceName;
+
+ public void setServiceGroupName(String serviceGroupName) {
+ this.serviceGroupName = serviceGroupName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceGroupContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceGroupContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceGroupContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/ServiceGroupContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.cluster.context.ContextCommandMessage;
+
+/**
+ *
+ */
+public abstract class ServiceGroupContextCommand extends ContextCommandMessage {
+
+ protected String serviceGroupName;
+ protected String serviceGroupContextId;
+
+ public String getServiceGroupName() {
+ return serviceGroupName;
+ }
+
+ public void setServiceGroupName(String serviceGroupName) {
+ this.serviceGroupName = serviceGroupName;
+ }
+
+ public String getServiceGroupContextId() {
+ return serviceGroupContextId;
+ }
+
+ public void setServiceGroupContextId(String serviceGroupContextId) {
+ this.serviceGroupContextId = serviceGroupContextId;
+ }
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateConfigurationContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.cluster.context.ContextCommandMessage;
+import org.apache.axis2.cluster.tribes.context.PropertyUpdater;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.PropertyDifference;
+
+import java.util.HashMap;
+
+/**
+ *
+ */
+public class UpdateConfigurationContextCommand extends ContextCommandMessage {
+ private PropertyUpdater propertyUpdater = new PropertyUpdater();
+
+ public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+ propertyUpdater.updateProperties(configurationContext);
+ }
+
+ public int getMessageType() {
+ return UPDATE_CONFIGURATION_CONTEXT_MSG;
+ }
+
+ /*public void addConfigurationContextProperty(String key, Object value, int updateStatus) {
+ if (propertyUpdater.getProperties() == null) {
+ propertyUpdater.setProperties(new HashMap());
+ }
+ propertyUpdater.addContextProperty(key, value, updateStatus);
+ }*/
+
+ public void addConfigurationContextProperty(PropertyDifference diff) {
+ if (propertyUpdater.getProperties() == null) {
+ propertyUpdater.setProperties(new HashMap());
+ }
+ propertyUpdater.addContextProperty(diff);
+ }
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.cluster.tribes.context.PropertyUpdater;
+import org.apache.axis2.context.ConfigurationContext;
+
+/**
+ *
+ */
+public class UpdateServiceContextCommand extends ServiceContextCommand {
+ private PropertyUpdater propertyUpdater = new PropertyUpdater();
+
+ public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+ //TODO: Impl
+// ServiceGroupContext sgCtx =
+// configurationContext.getServiceGroupContext(serviceGroupContextId);
+// propertyUpdater.updateProperties(sgCtx);
+
+ /*ServiceGroupContext srvGrpCtx = configurationContext.getServiceGroupContext
+ (event.getParentContextID());
+ Iterator iter = srvGrpCtx.getServiceContexts();
+ String serviceCtxName = event.getDescriptionID();
+ ServiceContext serviceContext = null;
+ while (iter.hasNext()) {
+ ServiceContext serviceContext2 = (ServiceContext) iter.next();
+ if (serviceContext2.getName() != null
+ && serviceContext2.getName().equals(serviceCtxName)) {
+ serviceContext = serviceContext2;
+ }
+ }
+
+ if (serviceContext != null) {
+
+ Map srvProps = updater.getServiceProps(event.getParentContextID(), event.getContextID());
+
+ if (srvProps != null) {
+ serviceContext.setProperties(srvProps);
+ }
+
+ } else {
+ String message = "Cannot find the ServiceContext with the ID:" + serviceCtxName;
+ log.error(message);
+ }*/
+
+ }
+
+ public int getMessageType() {
+ return UPDATE_SERVICE_CONTEXT_MSG;
+ }
+
+ /* public void addServiceGroupContextProperty(String key, Object value, int updateStatus) {
+ propertyUpdater.addContextProperty(key, value, updateStatus);
+ }*/
+}
Added: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java?view=auto&rev=539716
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/messages/UpdateServiceGroupContextCommand.java Sat May 19 02:04:21 2007
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.axis2.cluster.tribes.context.messages;
+
+import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.cluster.tribes.context.PropertyUpdater;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ServiceGroupContext;
+
+/**
+ *
+ */
+public class UpdateServiceGroupContextCommand extends ServiceGroupContextCommand {
+
+ private PropertyUpdater propertyUpdater = new PropertyUpdater();
+
+ public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+ ServiceGroupContext sgCtx =
+ configurationContext.getServiceGroupContext(serviceGroupContextId);
+ propertyUpdater.updateProperties(sgCtx);
+ }
+
+ public int getMessageType() {
+ return UPDATE_SERVICE_GROUP_CONTEXT_MSG;
+ }
+
+ /*public void addServiceGroupContextProperty(String key, Object value, int updateStatus) {
+ propertyUpdater.addContextProperty(key, value, updateStatus);
+ }*/
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org