[wsas-java-dev] svn commit r1794 - in
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering:
. commands
svn at wso2.org
svn at wso2.org
Fri Apr 6 23:49:49 PDT 2007
Author: azeez
Date: Fri Apr 6 23:49:37 2007
New Revision: 1794
Added:
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/ConfigurationCommand.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/AbstractConfigurationCommand.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/ApplyServicePolicyCommand.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/ConfigurationCommandFactory.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/LoadServiceGroupsCommand.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/ReloadConfigurationCommand.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/UnloadServiceGroupsCommand.java
Modified:
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java
Log:
Improving the code to incorporate command pattern
Added: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/ConfigurationCommand.java
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/ConfigurationCommand.java Fri Apr 6 23:49:37 2007
@@ -0,0 +1,31 @@
+/*
+ * 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.wso2.wsas.clustering;
+
+import org.apache.axis2.context.ConfigurationContext;
+
+/**
+ *
+ */
+public interface ConfigurationCommand {
+ public void prepare();
+
+ public void commit() throws Exception;
+
+ public void setConfiguration(Object configuration);
+
+ public void setConfigurationContext(ConfigurationContext configContext);
+}
Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java (original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java Fri Apr 6 23:49:37 2007
@@ -15,7 +15,6 @@
*/
package org.wso2.wsas.clustering;
-import org.apache.axis2.AxisFault;
import org.apache.axis2.cluster.configuration.ConfigurationEvent;
import org.apache.axis2.cluster.configuration.ConfigurationManagerListener;
import org.apache.axis2.context.ConfigurationContext;
@@ -28,13 +27,13 @@
import org.apache.commons.logging.LogFactory;
import org.wso2.utils.ServerConfiguration;
import org.wso2.wsas.ServerConstants;
+import org.wso2.wsas.clustering.commands.ConfigurationCommandFactory;
import org.wso2.wsas.deployment.ServerConfigurator;
-import org.wso2.wsas.util.Controllable;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
-import java.util.ArrayList;
/**
*
@@ -43,10 +42,10 @@
private static Log log = LogFactory.getLog(WSASConfigManagerListener.class);
- private static final String LOAD_CONFIGURATION_EVENT = "LOAD_CONFIGURATION_EVENT";
- private static final String LOAD_SERVICE_GROUPS_EVENT = "LOAD_SERVICE_GROUPS_EVENT";
- private static final String UNLOAD_SERVICE_GROUPS_EVENT = "UNLOAD_SERVICE_GROUPS_EVENT";
- private static final String APPLY_POLICY_EVENT = "APPLY_POLICY_EVENT";
+// private static final String LOAD_CONFIGURATION_EVENT = "LOAD_CONFIGURATION_EVENT";
+// private static final String LOAD_SERVICE_GROUPS_EVENT = "LOAD_SERVICE_GROUPS_EVENT";
+// private static final String UNLOAD_SERVICE_GROUPS_EVENT = "UNLOAD_SERVICE_GROUPS_EVENT";
+// private static final String APPLY_POLICY_EVENT = "APPLY_POLICY_EVENT";
private ConfigurationContext configurationContext;
@@ -107,7 +106,9 @@
}
if (isOperationSuccessful) {
- pendingCommits.add(new Commit(LOAD_SERVICE_GROUPS_EVENT, axisServiceGroups));
+ ConfigurationCommand cmd = getConfigurationCommand(configurationEvent);
+ cmd.setConfiguration(axisServiceGroups);
+ pendingCommits.add(cmd);
}
// We've finished processing this request, so reset the isProcessing flag to false
@@ -134,13 +135,7 @@
isOperationSuccessful = false;
String msg = "Service group " + sgName + " does not exist";
log.info(msg);
- try {
- notifyFailureToNodeManager();
- axisConfig.getClusterManager().getConfigurationManager().
- exceptionOccurred(new Exception(msg));
- } catch (Exception e) {
- log.error(e);
- }
+ notifyFailure(new Exception(msg));
break;
} else {
log.info("Going to unload service group " + sgName);
@@ -148,7 +143,9 @@
}
}
if (isOperationSuccessful) {
- pendingCommits.add(new Commit(UNLOAD_SERVICE_GROUPS_EVENT, axisServiceGroups));
+ ConfigurationCommand cmd = getConfigurationCommand(configurationEvent);
+ cmd.setConfiguration(axisServiceGroups);
+ pendingCommits.add(cmd);
}
// We've finished processing this request, so reset the isProcessing flag to false
@@ -189,15 +186,15 @@
ConfigurationContext newConfigurationContext =
ConfigurationContextFactory
.createConfigurationContext(ServerConfigurator.getInstance());
- pendingCommits.add(new Commit(LOAD_CONFIGURATION_EVENT, newConfigurationContext));
+ ConfigurationCommand cmd = getConfigurationCommand(configurationEvent);
+ cmd.setConfiguration(newConfigurationContext);
+ pendingCommits.add(cmd);
log.info("New configuration successfully loaded and cached. " +
"Waiting for prepare request...");
} catch (Throwable e) {
try {
- notifyFailureToNodeManager();
- configurationContext.getAxisConfiguration().
- getClusterManager().getConfigurationManager().exceptionOccurred(e);
+ notifyFailure(e);
} catch (Exception e1) {
log.error(e1);
}
@@ -229,31 +226,7 @@
log.info("Preparing to commit...");
prepareReceivedTime = System.currentTimeMillis();
for (Iterator iter = pendingCommits.iterator(); iter.hasNext();) {
- Commit commit = (Commit) iter.next();
- String event = commit.getEvent();
- if (event.equals(LOAD_CONFIGURATION_EVENT)) {
- configurationContext.setProperty(ServerConstants.BLOCK_ALL_REQUESTS,
- Boolean.TRUE);
- break; // No need to continue since all requests are going to be blocked
- } else if (event.equals(LOAD_SERVICE_GROUPS_EVENT)) {
- List axisServiceGroups = (List) commit.getObject();
- for (Iterator iterator = axisServiceGroups.iterator();
- iterator.hasNext();) {
- AxisServiceGroup axisSG = (AxisServiceGroup) iterator.next();
- addBlockAllRequestsParameter(axisSG);
- }
- } else if (event.equals(UNLOAD_SERVICE_GROUPS_EVENT)) {
- List axisServiceGroups = (List) commit.getObject();
- for (Iterator iterator = axisServiceGroups.iterator();
- iterator.hasNext();) {
- AxisServiceGroup axisSG = (AxisServiceGroup) iterator.next();
- addBlockAllRequestsParameter(axisSG);
- }
- } else if (event.equals(APPLY_POLICY_EVENT)) {
- addBlockAllRequestsParameter((AxisServiceGroup) commit.getObject());
- } else {
- log.error("Unknown event, " + event);
- }
+ ((ConfigurationCommand) iter.next()).prepare();
}
isPreparing = false;
}
@@ -280,11 +253,7 @@
remove(ServerConstants.BLOCK_ALL_REQUESTS);
log.info("Commit message not received within " + timeOut +
" ms. Resuming operations.");
- try {
- reinitialize();
- } catch (AxisFault axisFault) {
- log.error(axisFault);
- }
+ reinitialize();
break;
}
try {
@@ -300,19 +269,6 @@
commitTimer.start();
}
- private void addBlockAllRequestsParameter(AxisServiceGroup serviceGroup) {
- if (serviceGroup == null) {
- return;
- }
- Parameter param = new Parameter(ServerConstants.BLOCK_ALL_REQUESTS,
- Boolean.TRUE);
- try {
- serviceGroup.addParameter(param);
- } catch (AxisFault axisFault) {
- log.error("Cannot add parameter to AxisServiceGroup", axisFault);
- }
- }
-
/**
* @param configurationEvent
*/
@@ -327,7 +283,6 @@
}
public void commitCalled(ConfigurationEvent configurationEvent) {
- //TODO: Method implementation
isCommitReceived = true;
Thread commitThread = new Thread() {
public void run() {
@@ -340,47 +295,19 @@
}
// Wait for a few more seconds, since a handleException message could be received
- try {
+ try { //TODO: Do we need this?
Thread.sleep(5000);
} catch (InterruptedException ignored) {
ignored.printStackTrace();
}
log.info("Committing configuration changes...");
- for (Iterator iterator = pendingCommits.iterator(); iterator.hasNext();) {
- Commit commit = (Commit) iterator.next();
- String event = commit.getEvent();
- log.info("Committing " + event);
- if (event.equals(LOAD_CONFIGURATION_EVENT)) {
- Controllable controllable =
- (Controllable) configurationContext.
- getProperty(ServerConstants.WSO2WSAS_INSTANCE);
- try {
- configurationContext.getServiceGroupContexts().clear();
- ConfigurationContext configCtx =
- (ConfigurationContext) commit.getObject();
- controllable.setConfigurationContext(configCtx);
- configurationContext = configCtx;
- } catch (Exception e) {
- log.error("Cannot commit " + LOAD_CONFIGURATION_EVENT, e);
- }
- } else if (event.equals(LOAD_SERVICE_GROUPS_EVENT)) {
- //TODO: impl
- } else if (event.equals(UNLOAD_SERVICE_GROUPS_EVENT)) {
- List serviceGroups = (List) commit.getObject();
- for (Iterator sgIter = serviceGroups.iterator(); sgIter.hasNext();) {
- AxisServiceGroup serviceGroup = (AxisServiceGroup)sgIter.next();
- try {
- configurationContext.getAxisConfiguration().
- removeServiceGroup(serviceGroup.getServiceGroupName());
- } catch (Exception e) {
- log.error("Cannot commit " + UNLOAD_SERVICE_GROUPS_EVENT, e);
- }
- }
- } else if (event.equals(APPLY_POLICY_EVENT)) {
- //TODO: impl
- } else {
- log.error("Invalid event, " + event);
+ for (Iterator iter = pendingCommits.iterator(); iter.hasNext();) {
+ ConfigurationCommand cmd = (ConfigurationCommand) iter.next();
+ try {
+ cmd.commit();
+ } catch (Exception e) {
+ notifyFailure(new Exception("Could not commit " + cmd));
}
}
configurationContext.getProperties().
@@ -393,60 +320,57 @@
}
public void handleException(Throwable throwable) {
- try {
- reinitialize();
- } catch (AxisFault axisFault) {
- log.error(axisFault);
- }
+ reinitialize();
}
public void setConfigurationContext(ConfigurationContext configurationContext) {
this.configurationContext = configurationContext;
}
- private void reinitialize() throws AxisFault {
- pendingCommits.clear();
- isCommitReceived = false;
- isPreparing = false;
- isProcessing = false;
- configurationContext.getProperties().remove(ServerConstants.BLOCK_ALL_REQUESTS);
- for (Iterator iter = configurationContext.getAxisConfiguration().getServiceGroups();
- iter.hasNext();) {
- AxisServiceGroup serviceGroup = (AxisServiceGroup) iter.next();
- Parameter parameter = serviceGroup.getParameter(ServerConstants.BLOCK_ALL_REQUESTS);
- if (parameter != null) {
- serviceGroup.removeParameter(parameter);
+ private void reinitialize() {
+ try {
+ pendingCommits.clear();
+ isCommitReceived = false;
+ isPreparing = false;
+ isProcessing = false;
+ configurationContext.getProperties().remove(ServerConstants.BLOCK_ALL_REQUESTS);
+ for (Iterator iter = configurationContext.getAxisConfiguration().getServiceGroups();
+ iter.hasNext();) {
+ AxisServiceGroup serviceGroup = (AxisServiceGroup) iter.next();
+ Parameter parameter = serviceGroup.getParameter(ServerConstants.BLOCK_ALL_REQUESTS);
+ if (parameter != null) {
+ serviceGroup.removeParameter(parameter);
+ }
}
+ } catch (Exception e) {
+ log.error(e);
}
}
- private void notifyFailureToNodeManager() throws AxisFault {
- AxisService axisService =
- configurationContext.getAxisConfiguration().
- getService(ServerConstants.NODE_MANAGER_SERVICE);
- if (axisService != null) {
- axisService.addParameter(new Parameter(NodeManager.OPERATION_FAILED, "true"));
- }
+ private ConfigurationCommand getConfigurationCommand(ConfigurationEvent configurationEvent) {
+ ConfigurationCommand cmd = ConfigurationCommandFactory.
+ getConfigurationCommand(configurationEvent.getConfigurationType());
+ cmd.setConfigurationContext(configurationContext);
+ return cmd;
}
- /**
- * This object represents a cached commit event.
- */
- private class Commit {
- private String event;
- private Object object;
-
- public Commit(String event, Object object) {
- this.event = event;
- this.object = object;
- }
+ private void notifyFailure(Throwable e) {
- public String getEvent() {
- return event;
- }
+ try {
+ // Notify NodeManager service
+ AxisService axisService =
+ configurationContext.getAxisConfiguration().
+ getService(ServerConstants.NODE_MANAGER_SERVICE);
+ if (axisService != null) {
+ axisService.addParameter(new Parameter(NodeManager.OPERATION_FAILED, "true"));
+ }
- public Object getObject() {
- return object;
+ // Notify other nodes
+ configurationContext.getAxisConfiguration().
+ getClusterManager().getConfigurationManager().exceptionOccurred(e);
+ } catch (Exception e2) {
+ log.error(e2);
}
}
+
}
Added: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/AbstractConfigurationCommand.java
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/AbstractConfigurationCommand.java Fri Apr 6 23:49:37 2007
@@ -0,0 +1,55 @@
+/*
+ * 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.wso2.wsas.clustering.commands;
+
+import org.wso2.wsas.clustering.ConfigurationCommand;
+import org.wso2.wsas.ServerConstants;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ */
+public abstract class AbstractConfigurationCommand implements ConfigurationCommand {
+ protected static Log log = LogFactory.getLog(AbstractConfigurationCommand.class);
+ protected Object configuration;
+ protected ConfigurationContext configContext;
+
+ public void setConfiguration(Object configuration) {
+ this.configuration = configuration;
+ }
+
+ public void setConfigurationContext(ConfigurationContext configContext) {
+ this.configContext = configContext;
+ }
+
+ protected void addBlockAllRequestsParameter(AxisServiceGroup serviceGroup) {
+ if (serviceGroup == null) {
+ return;
+ }
+ Parameter param = new Parameter(ServerConstants.BLOCK_ALL_REQUESTS,
+ Boolean.TRUE);
+ try {
+ serviceGroup.addParameter(param);
+ } catch (AxisFault axisFault) {
+ log.error("Cannot add parameter to AxisServiceGroup", axisFault);
+ }
+ }
+}
Added: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/ApplyServicePolicyCommand.java
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/ApplyServicePolicyCommand.java Fri Apr 6 23:49:37 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.wso2.wsas.clustering.commands;
+
+import org.apache.axis2.description.AxisServiceGroup;
+
+/**
+ *
+ */
+public class ApplyServicePolicyCommand extends AbstractConfigurationCommand {
+
+ public void prepare() {
+ addBlockAllRequestsParameter((AxisServiceGroup) configuration); //TODO: this may be AxisService
+ }
+
+ public void commit() throws Exception {
+ //TODO: Method implementation
+ }
+
+ public String toString() {
+ return "APPLY_SERVICE_POLICY";
+ }
+}
+
Added: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/ConfigurationCommandFactory.java
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/ConfigurationCommandFactory.java Fri Apr 6 23:49:37 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.wso2.wsas.clustering.commands;
+
+import org.wso2.wsas.clustering.ConfigurationCommand;
+import org.apache.axis2.cluster.CommandType;
+
+/**
+ *
+ */
+public class ConfigurationCommandFactory {
+ public static ConfigurationCommand getConfigurationCommand(int commandType){
+ ConfigurationCommand cmd = null;
+ switch(commandType){
+ case CommandType.RELOAD_CONFIGURATION:
+ cmd = new ReloadConfigurationCommand();
+ break;
+ case CommandType.LOAD_SERVICE_GROUPS:
+ cmd = new LoadServiceGroupsCommand();
+ break;
+ case CommandType.UNLOAD_SERVICE_GROUPS:
+ cmd = new UnloadServiceGroupsCommand();
+ break;
+ case CommandType.APPLY_POLICY:
+ cmd = new ApplyServicePolicyCommand();
+ break;
+ }
+ return cmd;
+ }
+}
Added: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/LoadServiceGroupsCommand.java
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/LoadServiceGroupsCommand.java Fri Apr 6 23:49:37 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.wso2.wsas.clustering.commands;
+
+import org.apache.axis2.description.AxisServiceGroup;
+
+import java.util.List;
+import java.util.Iterator;
+
+/**
+ *
+ */
+public class LoadServiceGroupsCommand extends AbstractConfigurationCommand {
+
+ public void prepare() {
+ List axisServiceGroups = (List) configuration;
+ for (Iterator iterator = axisServiceGroups.iterator();
+ iterator.hasNext();) {
+ AxisServiceGroup axisSG = (AxisServiceGroup) iterator.next();
+ addBlockAllRequestsParameter(axisSG);
+ }
+ }
+
+ public void commit() throws Exception {
+ //TODO: Method implementation
+ }
+
+ public String toString() {
+ return "LOAD_SERVICE_GROUPS_EVENT";
+ }
+}
Added: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/ReloadConfigurationCommand.java
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/ReloadConfigurationCommand.java Fri Apr 6 23:49:37 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.wso2.wsas.clustering.commands;
+
+import org.wso2.wsas.ServerConstants;
+import org.wso2.wsas.util.Controllable;
+import org.apache.axis2.context.ConfigurationContext;
+
+/**
+ *
+ */
+public class ReloadConfigurationCommand extends AbstractConfigurationCommand {
+ public void commit() throws Exception {
+ Controllable controllable =
+ (Controllable) configContext.
+ getProperty(ServerConstants.WSO2WSAS_INSTANCE);
+ configContext.getServiceGroupContexts().clear();
+ ConfigurationContext newConfigCtx = (ConfigurationContext) configuration;
+ controllable.setConfigurationContext(newConfigCtx);
+ configContext = newConfigCtx;
+ }
+
+ public void prepare() {
+ ((ConfigurationContext) configuration).setProperty(ServerConstants.BLOCK_ALL_REQUESTS,
+ Boolean.TRUE);
+ }
+
+ public String toString() {
+ return "LOAD_CONFIGURATION_EVENT";
+ }
+}
Added: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/UnloadServiceGroupsCommand.java
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/commands/UnloadServiceGroupsCommand.java Fri Apr 6 23:49:37 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.wso2.wsas.clustering.commands;
+
+import org.apache.axis2.description.AxisServiceGroup;
+
+import java.util.List;
+import java.util.Iterator;
+
+/**
+ *
+ */
+public class UnloadServiceGroupsCommand extends AbstractConfigurationCommand {
+
+ public void prepare() {
+ List axisServiceGroups = (List) configuration;
+ for (Iterator iterator = axisServiceGroups.iterator();
+ iterator.hasNext();) {
+ AxisServiceGroup axisSG = (AxisServiceGroup) iterator.next();
+ addBlockAllRequestsParameter(axisSG);
+ }
+ }
+
+ public void commit() throws Exception {
+ List serviceGroups = (List) configuration;
+ for (Iterator sgIter = serviceGroups.iterator(); sgIter.hasNext();) {
+ AxisServiceGroup serviceGroup = (AxisServiceGroup) sgIter.next();
+ configContext.getAxisConfiguration().
+ removeServiceGroup(serviceGroup.getServiceGroupName());
+ }
+ }
+
+ public String toString() {
+ return "LOAD_SERVICE_GROUPS_EVENT";
+ }
+
+}
More information about the Wsas-java-dev
mailing list