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 az...@apache.org on 2007/04/06 12:14:10 UTC
svn commit: r526112 - in /webservices/axis2/trunk/java/modules: clustering/
clustering/src/org/apache/axis2/cluster/tribes/
clustering/src/org/apache/axis2/cluster/tribes/configuration/
clustering/src/org/apache/axis2/cluster/tribes/context/ clustering...
Author: azeez
Date: Fri Apr 6 03:13:53 2007
New Revision: 526112
URL: http://svn.apache.org/viewvc?view=rev&rev=526112
Log:
1. ConfigurationManager & ContextManager extends ParameterInclude so that configuration & context specific parameters can be included in the axis2.xml
2. s/loadServiceGroup/loadServiceGroups
3. s/unloadServiceGroup/unloadServiceGroups
2 & 3 handle multiple service groups
Modified:
webservices/axis2/trunk/java/modules/clustering/project.xml
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/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/configuration/TribesConfigurationManager.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java
webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationEvent.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java
Modified: webservices/axis2/trunk/java/modules/clustering/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/project.xml?view=diff&rev=526112&r1=526111&r2=526112
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/project.xml (original)
+++ webservices/axis2/trunk/java/modules/clustering/project.xml Fri Apr 6 03:13:53 2007
@@ -21,7 +21,7 @@
<extend>../../etc/project.xml</extend>
<name>Apache Axis 2.0 - Cluster</name>
- <id>axis2-cluster</id>
+ <id>axis2-clustering</id>
<groupId>org.apache.axis2</groupId>
<description>Clustering Support for Axis 2.0</description>
@@ -64,49 +64,49 @@
<properties>
<module>true</module>
</properties>
- </dependency>
- <dependency>
- <groupId>${stax.impl.groupid}</groupId>
- <artifactId>${stax.impl.artifactid}</artifactId>
- <version>${stax.impl.version}</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>${commons.httpclient.version}</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- <version>${wsdl4j.version}</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-java2wsdl</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ws.commons.schema</groupId>
- <artifactId>XmlSchema</artifactId>
- <version>${XmlSchema.version}</version>
- </dependency>
- <dependency>
- <groupId>annogen</groupId>
- <artifactId>annogen</artifactId>
- <version>${annogen.version}</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>${stax.impl.groupid}</groupId>
+ <artifactId>${stax.impl.artifactid}</artifactId>
+ <version>${stax.impl.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>${commons.httpclient.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>${wsdl4j.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>${XmlSchema.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>${annogen.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
<dependency>
<groupId>org.apache.tomcat.juli</groupId>
<artifactId>juli</artifactId>
@@ -114,22 +114,22 @@
<properties>
<module>true</module>
</properties>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.tribes</groupId>
- <artifactId>tribes</artifactId>
- <version>${tomcat.tribes.version}</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>org.apache.neethi</groupId>
- <artifactId>neethi</artifactId>
- <version>${neethi.version}</version>
- <properties>
- <module>true</module>
- </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.tribes</groupId>
+ <artifactId>tribes</artifactId>
+ <version>${tomcat.tribes.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>${neethi.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
</dependency>
</dependencies>
<build/>
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=526112&r1=526111&r2=526112
==============================================================================
--- 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 Fri Apr 6 03:13:53 2007
@@ -37,162 +37,159 @@
public class ChannelListener implements org.apache.catalina.tribes.ChannelListener {
- ContextUpdater updater = null;
- TribesContextManager contextManager = null;
- TribesConfigurationManager configurationManager = null;
-
+ ContextUpdater updater = null;
+ TribesContextManager contextManager = null;
+ TribesConfigurationManager configurationManager = null;
+
private static final Log log = LogFactory.getLog(ChannelListener.class);
-
- public ChannelListener (TribesConfigurationManager configurationManager, TribesContextManager contextManager) {
- this.configurationManager = configurationManager;
- this.contextManager = contextManager;
- }
-
- public void setContextManager(TribesContextManager contextManager) {
- this.contextManager = contextManager;
- }
-
- public void setConfigurationManager(TribesConfigurationManager configurationManager) {
- 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) {
-
-
- 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");
- }
- }
-
- if (msg instanceof ConfigurationCommand) {
-
- ConfigurationCommand command = (ConfigurationCommand) msg;
- if (command.getCommandType() == CommandType.LOAD_SERVICE_GROUP) {
-
- ConfigurationEvent event = new ConfigurationEvent();
- event.setConfigurationName(command.getSgcName());
- configurationManager.notifyListeners(command.getCommandType(), event);
- } else if (command.getCommandType() == CommandType.UNLOAD_SERVICE_GROUP) {
-
- ConfigurationEvent event = new ConfigurationEvent ();
- event.setConfigurationName(command.getSgcName());
- configurationManager.notifyListeners(command.getCommandType(), event);
- } else if (command.getCommandType() == CommandType.APPLY_POLICY) {
-
- ConfigurationEvent event = new ConfigurationEvent ();
- event.setConfigurationName(command.getSgcName());
- event.setPolicyId(command.getPolicyId());
- configurationManager.notifyListeners(command.getCommandType(), event);
- } else if (command.getCommandType() == CommandType.PREPARE) {
-
- ConfigurationEvent event = new ConfigurationEvent ();
- event.setConfigurationName(command.getSgcName());
- configurationManager.notifyListeners(command.getCommandType(), event);
- } else if (command.getCommandType() == CommandType.COMMIT) {
-
- ConfigurationEvent event = new ConfigurationEvent ();
- configurationManager.notifyListeners(command.getCommandType(), event);
- } else if (command.getCommandType() == CommandType.ROLLBACK) {
-
- ConfigurationEvent event = new ConfigurationEvent ();
- configurationManager.notifyListeners(command.getCommandType(), event);
- } else if (command.getCommandType() == CommandType.RELOAD_CONFIGURATION) {
-
- ConfigurationEvent event = new ConfigurationEvent ();
- configurationManager.notifyListeners(command.getCommandType(), event);
- } else {
- log.error("TribesClusterManager received an unknown Configuration Command");
- }
-
- }
- }
-
+
+ public ChannelListener(TribesConfigurationManager configurationManager,
+ TribesContextManager contextManager) {
+ this.configurationManager = configurationManager;
+ this.contextManager = contextManager;
+ }
+
+ public void setContextManager(TribesContextManager contextManager) {
+ this.contextManager = contextManager;
+ }
+
+ public void setConfigurationManager(TribesConfigurationManager configurationManager) {
+ 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) {
+
+
+ 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");
+ }
+ } else if (msg instanceof ConfigurationCommand) {
+
+ ConfigurationCommand command = (ConfigurationCommand) msg;
+ ConfigurationEvent event = new ConfigurationEvent();
+ int commandType = command.getCommandType();
+ switch (commandType) {
+ case CommandType.LOAD_SERVICE_GROUPS:
+ event.setServiceGroupNames(command.getServiceGroupNames());
+ configurationManager.notifyListeners(commandType, event);
+ break;
+ case CommandType.UNLOAD_SERVICE_GROUPS:
+ event.setServiceGroupNames(command.getServiceGroupNames());
+ configurationManager.notifyListeners(commandType, event);
+ break;
+ case CommandType.RELOAD_CONFIGURATION:
+ configurationManager.notifyListeners(commandType, event);
+ break;
+ case CommandType.APPLY_POLICY:
+ event.setServiceGroupName(command.getServiceGroupName());
+ event.setPolicyId(command.getPolicyId());
+ configurationManager.notifyListeners(commandType, event);
+ break;
+ case CommandType.PREPARE:
+ configurationManager.notifyListeners(commandType, event);
+ break;
+ case CommandType.COMMIT:
+ configurationManager.notifyListeners(commandType, event);
+ break;
+ case CommandType.ROLLBACK:
+ configurationManager.notifyListeners(commandType, event);
+ break;
+ default:
+ log.error("TribesClusterManager received an unknown Configuration Command");
+ }
+ }
+ }
}
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=526112&r1=526111&r2=526112
==============================================================================
--- 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 Fri Apr 6 03:13:53 2007
@@ -145,7 +145,6 @@
for (Iterator it=parameters.keySet().iterator();it.hasNext();) {
list.add(parameters.get(it.next()));
}
-
return list;
}
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=526112&r1=526111&r2=526112
==============================================================================
--- 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 Fri Apr 6 03:13:53 2007
@@ -20,8 +20,9 @@
public class ConfigurationCommand extends CommandMessage {
- String policyId;
- String sgcName;
+ private String policyId;
+ private String serviceGroupName;
+ private String[] serviceGroupNames;
public ConfigurationCommand (int commandType) {
super (commandType);
@@ -35,12 +36,19 @@
this.policyId = policyId;
}
- public String getSgcName() {
- return sgcName;
+ public String[] getServiceGroupNames() {
+ return serviceGroupNames;
}
- public void setSgcName(String sgcName) {
- this.sgcName = sgcName;
+ public void setServiceGroupNames(String[] serviceGroupNames) {
+ this.serviceGroupNames = serviceGroupNames;
}
-
+
+ public String getServiceGroupName() {
+ return serviceGroupName;
+ }
+
+ public void setServiceGroupName(String serviceGroupName) {
+ this.serviceGroupName = serviceGroupName;
+ }
}
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=526112&r1=526111&r2=526112
==============================================================================
--- 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 Fri Apr 6 03:13:53 2007
@@ -23,20 +23,22 @@
import org.apache.axis2.cluster.configuration.ConfigurationManagerListener;
import org.apache.axis2.cluster.tribes.ChannelSender;
import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.AxisFault;
import org.apache.catalina.tribes.Channel;
import org.apache.catalina.tribes.ChannelException;
import org.apache.catalina.tribes.Member;
import org.apache.neethi.Policy;
+import org.apache.axiom.om.OMElement;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
public class TribesConfigurationManager implements ConfigurationManager {
private List listeners = null;
private ChannelSender sender = null;
private ConfigurationContext configurationContext = null;
+ private Map parameters = new HashMap();
public TribesConfigurationManager() {
listeners = new ArrayList();
@@ -52,7 +54,7 @@
public void applyPolicy(String serviceGroupName, Policy policy) throws ClusteringFault {
ConfigurationCommand command = new ConfigurationCommand(CommandType.APPLY_POLICY);
- command.setSgcName(serviceGroupName);
+ command.setServiceGroupName(serviceGroupName);
command.setPolicyId(policy.getId());
send(command);
}
@@ -66,9 +68,9 @@
send(throwable);
}
- public void loadServiceGroup(String serviceGroupName) throws ClusteringFault {
- ConfigurationCommand command = new ConfigurationCommand(CommandType.LOAD_SERVICE_GROUP);
- command.setSgcName(serviceGroupName);
+ public void loadServiceGroups(String[] serviceGroupNames) throws ClusteringFault {
+ ConfigurationCommand command = new ConfigurationCommand(CommandType.LOAD_SERVICE_GROUPS);
+ command.setServiceGroupNames(serviceGroupNames);
send(command);
}
@@ -87,9 +89,9 @@
send(command);
}
- public void unloadServiceGroup(String serviceGroupName) throws ClusteringFault {
- ConfigurationCommand command = new ConfigurationCommand(CommandType.UNLOAD_SERVICE_GROUP);
- command.setSgcName(serviceGroupName);
+ public void unloadServiceGroups(String[] serviceGroupNames) throws ClusteringFault {
+ ConfigurationCommand command = new ConfigurationCommand(CommandType.UNLOAD_SERVICE_GROUPS);
+ command.setServiceGroupNames(serviceGroupNames);
send(command);
}
@@ -120,15 +122,15 @@
for (Iterator it = listeners.iterator(); it.hasNext();) {
ConfigurationManagerListener listener = (ConfigurationManagerListener) it.next();
- if (CommandType.LOAD_SERVICE_GROUP == command) {
- listener.serviceGroupLoaded(event);
- } else if (CommandType.UNLOAD_SERVICE_GROUP == command) {
- listener.serviceGroupUnloaded(event);
+ if (CommandType.LOAD_SERVICE_GROUPS == command) {
+ listener.serviceGroupsLoaded(event);
+ } else if (CommandType.UNLOAD_SERVICE_GROUPS == command) {
+ listener.serviceGroupsUnloaded(event);
} else if (CommandType.APPLY_POLICY == command) {
listener.policyApplied(event);
} else if (CommandType.RELOAD_CONFIGURATION == command) {
listener.configurationReloaded(event);
- } else if (CommandType.PREPARE == command) {
+ } else if (CommandType.PREPARE == command) {
listener.prepareCalled(event);
} else if (CommandType.COMMIT == command) {
listener.commitCalled(event);
@@ -144,5 +146,33 @@
ConfigurationManagerListener listener = (ConfigurationManagerListener) it.next();
listener.setConfigurationContext(configurationContext);
}
+ }
+
+ public void addParameter(Parameter param) throws AxisFault {
+ parameters.put(param.getName(), param);
+ }
+
+ public void removeParameter(Parameter param) throws AxisFault {
+ parameters.remove(param.getName());
+ }
+
+ public Parameter getParameter(String name) {
+ return (Parameter) parameters.get(name);
+ }
+
+ public ArrayList getParameters() {
+ ArrayList list = new ArrayList();
+ for (Iterator iter = parameters.keySet().iterator(); iter.hasNext();) {
+ list.add(parameters.get(iter.next()));
+ }
+ return list;
+ }
+
+ public boolean isParameterLocked(String parameterName) {
+ return getParameter(parameterName).isLocked();
+ }
+
+ public void deserializeParameters(OMElement parameterElement) throws AxisFault {
+ throw new UnsupportedOperationException();
}
}
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=526112&r1=526111&r2=526112
==============================================================================
--- 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 Fri Apr 6 03:13:53 2007
@@ -30,6 +30,10 @@
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.axis2.AxisFault;
+import org.apache.axiom.om.OMElement;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -46,6 +50,7 @@
private List addedServiceGrpCtxs = new ArrayList();
private List addedServiceCtxs = new ArrayList();
private List listeners = null;
+ private Map parameters = new HashMap();
private ChannelSender sender;
@@ -80,7 +85,7 @@
}
public void addContext(AbstractContext context) throws ClusteringFault {
- ContextCommandMessage comMsg = null;
+ ContextCommandMessage comMsg;
String contextId = getContextID(context);
String parentContextId = getContextID(context.getParent());
@@ -163,15 +168,6 @@
}
}
- /*
- * public void addProperty(AbstractContext ctx,String contextId, String
- * parentId, String propertyName, Object propertyValue) { if (ctx instanceof
- * ServiceContext){ ctxManager.addPropToServiceContext(parentId, contextId,
- * propertyName, propertyValue); }else{
- * ctxManager.addPropToServiceGroupContext(contextId, propertyName,
- * propertyValue); } }
- */
-
public void removeContext(AbstractContext context) throws ClusteringFault {
ContextCommandMessage comMsg = null;
@@ -192,14 +188,6 @@
send(comMsg);
}
- /*
- * public void removeProperty(AbstractContext ctx, String contextId, String
- * parentId, String propertyName) { if (ctx instanceof ServiceContext){
- * ctxManager.removePropFromServiceContext(parentId, contextId,
- * propertyName); }else{
- * ctxManager.removePropFromServiceGroupContext(contextId, propertyName); } }
- */
-
public void updateState(AbstractContext context) throws ClusteringFault {
String contextId = getContextID(context);
@@ -299,5 +287,33 @@
private void send(CommandMessage command) throws ClusteringFault {
sender.send(command);
+ }
+
+ public void addParameter(Parameter param) throws AxisFault {
+ parameters.put(param.getName(), param);
+ }
+
+ public void removeParameter(Parameter param) throws AxisFault {
+ parameters.remove(param.getName());
+ }
+
+ public Parameter getParameter(String name) {
+ return (Parameter) parameters.get(name);
+ }
+
+ public ArrayList getParameters() {
+ ArrayList list = new ArrayList();
+ for (Iterator iter = parameters.keySet().iterator(); iter.hasNext();) {
+ list.add(parameters.get(iter.next()));
+ }
+ return list;
+ }
+
+ public boolean isParameterLocked(String parameterName) {
+ return getParameter(parameterName).isLocked();
+ }
+
+ public void deserializeParameters(OMElement parameterElement) throws AxisFault {
+ throw new UnsupportedOperationException();
}
}
Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java?view=diff&rev=526112&r1=526111&r2=526112
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java Fri Apr 6 03:13:53 2007
@@ -48,7 +48,7 @@
ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
assertNotNull(event);
- assertEquals(event.getConfigurationName(), serviceGroupName);
+ assertEquals(event.getServiceGroupNames(), serviceGroupName);
}
public void testUnloadServiceGroup () throws ClusteringFault {
@@ -70,7 +70,7 @@
ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
assertNotNull(event);
- assertEquals(event.getConfigurationName(), serviceGroupName);
+ assertEquals(event.getServiceGroupNames(), serviceGroupName);
}
public void testApplyPolicy () throws ClusteringFault {
@@ -96,7 +96,7 @@
assertEquals(eventList.size(), 1);
ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
assertNotNull(event);
- assertEquals(event.getConfigurationName(), serviceGroupName);
+ assertEquals(event.getServiceGroupNames(), serviceGroupName);
assertEquals(event.getPolicyId(), policyID);
}
Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java?view=diff&rev=526112&r1=526111&r2=526112
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java Fri Apr 6 03:13:53 2007
@@ -24,8 +24,8 @@
public class TestConfigurationManagerListener implements ConfigurationManagerListener {
- ArrayList eventList = null;
- private ConfigurationContext configurationContext = null;
+ private ArrayList eventList;
+ private ConfigurationContext configurationContext;
public TestConfigurationManagerListener() {
eventList = new ArrayList();
@@ -63,11 +63,11 @@
eventList.add(event);
}
- public void serviceGroupLoaded(ConfigurationEvent event) {
+ public void serviceGroupsLoaded(ConfigurationEvent event) {
eventList.add(event);
}
- public void serviceGroupUnloaded(ConfigurationEvent event) {
+ public void serviceGroupsUnloaded(ConfigurationEvent event) {
eventList.add(event);
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java?view=diff&rev=526112&r1=526111&r2=526112
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java Fri Apr 6 03:13:53 2007
@@ -30,10 +30,10 @@
public static int UPDATE_STATE_MAP_ENTRY = 6;
- public static int LOAD_SERVICE_GROUP = 7;
-
- public static int UNLOAD_SERVICE_GROUP = 8;
-
+ public static int LOAD_SERVICE_GROUPS = 7;
+
+ public static int UNLOAD_SERVICE_GROUPS = 8 ;
+
public static int APPLY_POLICY = 9;
public static int RELOAD_CONFIGURATION = 10;
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationEvent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationEvent.java?view=diff&rev=526112&r1=526111&r2=526112
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationEvent.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationEvent.java Fri Apr 6 03:13:53 2007
@@ -18,33 +18,33 @@
public class ConfigurationEvent {
- String configurationName;
- String parentConfigurationName;
- int configurationType;
- String policyId = null;
+ private String[] serviceGroupNames;
+ private String serviceGroupName;
+ private int configurationType;
+ private String policyId;
- public String getConfigurationName() {
- return configurationName;
+ public String[] getServiceGroupNames() {
+ return serviceGroupNames;
}
- public void setConfigurationName(String configurationName) {
- this.configurationName = configurationName;
+ public void setServiceGroupNames(String[] serviceGroupNames) {
+ this.serviceGroupNames = serviceGroupNames;
}
- public int getConfigurationType() {
+ public String getServiceGroupName() {
+ return serviceGroupName;
+ }
+
+ public void setServiceGroupName(String serviceGroupName) {
+ this.serviceGroupName = serviceGroupName;
+ }
+
+ public int getConfigurationType() {
return configurationType;
}
public void setConfigurationType(int configurationType) {
this.configurationType = configurationType;
- }
-
- public String getParentConfigurationName() {
- return parentConfigurationName;
- }
-
- public void setParentConfigurationName(String parentConfigurationName) {
- this.parentConfigurationName = parentConfigurationName;
}
public String getPolicyId() {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java?view=diff&rev=526112&r1=526111&r2=526112
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java Fri Apr 6 03:13:53 2007
@@ -17,18 +17,19 @@
package org.apache.axis2.cluster.configuration;
import org.apache.axis2.cluster.ClusteringFault;
-import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.ParameterInclude;
import org.apache.neethi.Policy;
-public interface ConfigurationManager {
+public interface ConfigurationManager extends ParameterInclude {
/*
* Configuration management methods
*/
- void loadServiceGroup(String serviceGroupName) throws ClusteringFault;
- void unloadServiceGroup(String serviceGroupName) throws ClusteringFault;
+ void loadServiceGroups(String[] serviceGroupNames) throws ClusteringFault;
+
+ void unloadServiceGroups(String[] serviceGroupNames) throws ClusteringFault;
void applyPolicy(String serviceGroupName, Policy policy) throws ClusteringFault;
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java?view=diff&rev=526112&r1=526111&r2=526112
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java Fri Apr 6 03:13:53 2007
@@ -16,17 +16,25 @@
package org.apache.axis2.cluster.configuration;
-import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.context.ConfigurationContext;
public interface ConfigurationManagerListener {
- void serviceGroupLoaded(ConfigurationEvent event);
- void serviceGroupUnloaded(ConfigurationEvent event);
+
+ void serviceGroupsLoaded(ConfigurationEvent event);
+
+ void serviceGroupsUnloaded(ConfigurationEvent event);
+
void policyApplied(ConfigurationEvent event);
- void configurationReloaded (ConfigurationEvent event);
- void prepareCalled (ConfigurationEvent event);
- void rollbackCalled (ConfigurationEvent event);
- void commitCalled (ConfigurationEvent event);
+
+ void configurationReloaded(ConfigurationEvent event);
+
+ void prepareCalled(ConfigurationEvent event);
+
+ void rollbackCalled(ConfigurationEvent event);
+
+ void commitCalled(ConfigurationEvent event);
+
void handleException(Throwable throwable);
- void setConfigurationContext (ConfigurationContext configurationContext);
+
+ void setConfigurationContext(ConfigurationContext configurationContext);
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java?view=diff&rev=526112&r1=526111&r2=526112
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java Fri Apr 6 03:13:53 2007
@@ -19,12 +19,18 @@
import org.apache.axis2.cluster.ClusteringFault;
import org.apache.axis2.context.AbstractContext;
import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.ParameterInclude;
-public interface ContextManager {
+public interface ContextManager extends ParameterInclude {
public void addContext(AbstractContext context) throws ClusteringFault;
+
public void removeContext(AbstractContext context) throws ClusteringFault;
+
public void updateState(AbstractContext context) throws ClusteringFault;
- public boolean isContextClusterable (AbstractContext context) throws ClusteringFault;
- public void addContextManagerListener (ContextManagerListener listener);
- public void setConfigurationContext (ConfigurationContext configurationContext);
+
+ public boolean isContextClusterable(AbstractContext context) throws ClusteringFault;
+
+ public void addContextManagerListener(ContextManagerListener listener);
+
+ public void setConfigurationContext(ConfigurationContext configurationContext);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org