stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ud...@apache.org
Subject git commit: add cluster teminating/terminated event, event listeners, mesage processors
Date Fri, 24 Oct 2014 12:06:55 GMT
Repository: stratos
Updated Branches:
  refs/heads/4.0.0-grouping fe38bdcfc -> 7619d85c0


add cluster teminating/terminated event, event listeners, mesage processors


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7619d85c
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7619d85c
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7619d85c

Branch: refs/heads/4.0.0-grouping
Commit: 7619d85c09ca12783ba86f209bc2db882341123f
Parents: fe38bdc
Author: Udara Liyanage <udara@wso2.com>
Authored: Fri Oct 24 17:07:51 2014 +0530
Committer: Udara Liyanage <udara@wso2.com>
Committed: Fri Oct 24 17:36:03 2014 +0530

----------------------------------------------------------------------
 .../grouping/topic/StatusEventPublisher.java    |   8 +-
 .../AutoscalerTopologyEventReceiver.java        |  52 +++++++-
 .../ApplicationStatusTopicReceiver.java         |  19 ++-
 .../controller/topology/TopologyBuilder.java    |  18 ++-
 .../topology/TopologyEventPublisher.java        |   4 +-
 .../status/AppStatusClusterTerminatedEvent.java |  50 +++++++
 .../AppStatusClusterTerminatingEvent.java       |  50 +++++++
 .../event/topology/ClusterInActivateEvent.java  |  56 --------
 .../event/topology/ClusterInactivateEvent.java  |  56 ++++++++
 .../event/topology/ClusterTerminatedEvent.java  |  56 ++++++++
 .../event/topology/ClusterTerminatingEvent.java |  56 ++++++++
 .../event/topology/GroupInActivateEvent.java    |  43 ------
 .../event/topology/GroupInactivateEvent.java    |  43 ++++++
 .../event/topology/GroupInactivatedEvent.java   |  43 ------
 ...AppStatusClusterTerminatedEventListener.java |  24 ++++
 ...ppStatusClusterTerminatingEventListener.java |  24 ++++
 .../ClusterTerminatedEventListener.java         |  24 ++++
 .../ClusterTerminatingEventListener.java        |  24 ++++
 ...StatusClusterTerminatedMessageProcessor.java |  59 ++++++++
 ...tatusClusterTerminatingMessageProcessor.java |  58 ++++++++
 .../ApplicationStatusMessageProcessorChain.java |  13 +-
 .../topology/ClusterInActivateProcessor.java    |  10 +-
 .../topology/ClusterTerminatedProcessor.java    | 133 +++++++++++++++++++
 .../topology/ClusterTerminatingProcessor.java   | 133 +++++++++++++++++++
 .../topology/GroupInActivateProcessor.java      |   8 +-
 .../topology/TopologyMessageProcessorChain.java |  14 +-
 .../exception/MetadataException.java            |   4 +-
 .../rest/endpoint/bean/ApplicationBean.java     |   3 -
 .../stratos/rest/endpoint/services/MyType.java  |  16 ---
 29 files changed, 901 insertions(+), 200 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java
index 630ffd2..0800b14 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java
@@ -15,7 +15,7 @@ import org.apache.stratos.messaging.event.application.status.ClusterInActivateEv
 import org.apache.stratos.messaging.event.application.status.ClusterMaintenanceModeEvent;
 import org.apache.stratos.messaging.event.application.status.GroupActivatedEvent;
 import org.apache.stratos.messaging.event.topology.*;
-import org.apache.stratos.messaging.event.topology.GroupInActivateEvent;
+import org.apache.stratos.messaging.event.topology.GroupInactivateEvent;
 import org.apache.stratos.messaging.util.Constants;
 
 import java.util.Set;
@@ -108,9 +108,9 @@ public class StatusEventPublisher {
                     " [group]: " + groupId);
         }
 
-        GroupInActivateEvent groupInActivateEvent = new GroupInActivateEvent(appId, groupId);
+        GroupInactivateEvent groupInactivateEvent = new GroupInactivateEvent(appId, groupId);
 
-        publishEvent(groupInActivateEvent);
+        publishEvent(groupInactivateEvent);
     }
 
     public static void sendGroupTerminatingEvent(String appId, String groupId) {
@@ -121,7 +121,6 @@ public class StatusEventPublisher {
         }
 
         GroupInTerminatingEvent groupInTerminatingEvent = new GroupInTerminatingEvent(appId, groupId);
-
         publishEvent(groupInTerminatingEvent);
     }
 
@@ -133,7 +132,6 @@ public class StatusEventPublisher {
         }
 
         GroupInTerminatedEvent groupInTerminatedEvent = new GroupInTerminatedEvent(appId, groupId);
-
         publishEvent(groupInTerminatedEvent);
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java
index ce5aff0..63f9079 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java
@@ -181,9 +181,9 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
 
                 log.info("[ClusterInActivateEvent] Received: " + event.getClass());
 
-                ClusterInActivateEvent clusterInActivateEvent = (ClusterInActivateEvent) event;
-                String appId = clusterInActivateEvent.getAppId();
-                String clusterId = clusterInActivateEvent.getClusterId();
+                ClusterInactivateEvent clusterInactivateEvent = (ClusterInactivateEvent) event;
+                String appId = clusterInactivateEvent.getAppId();
+                String clusterId = clusterInactivateEvent.getClusterId();
                 AbstractClusterMonitor clusterMonitor =
                         (AbstractClusterMonitor) AutoscalerContext.getInstance().getMonitor(clusterId);
 
@@ -193,6 +193,46 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
             }
         });
 
+        topologyEventReceiver.addEventListener(new ClusterTerminatingEventListener() {
+            @Override
+            protected void onEvent(Event event) {
+
+                log.info("[ClusterInActivateEvent] Received: " + event.getClass());
+
+                ClusterTerminatedEvent clusterInactivateEvent = (ClusterTerminatedEvent) event;
+                String appId = clusterInactivateEvent.getAppId();
+                String clusterId = clusterInactivateEvent.getClusterId();
+                AbstractClusterMonitor clusterMonitor =
+                        (AbstractClusterMonitor) AutoscalerContext.getInstance().getMonitor(clusterId);
+
+                //changing the status in the monitor, will notify its parent monitor
+                clusterMonitor.setStatus(ClusterStatus.Terminating);
+
+                //starting the status checker to decide on the status of it's parent
+                //StatusChecker.getInstance().onClusterStatusChange(clusterId, appId);
+            }
+        });
+
+        topologyEventReceiver.addEventListener(new ClusterTerminatedEventListener() {
+            @Override
+            protected void onEvent(Event event) {
+
+                log.info("[ClusterInActivateEvent] Received: " + event.getClass());
+
+                ClusterTerminatedEvent clusterInactivateEvent = (ClusterTerminatedEvent) event;
+                String appId = clusterInactivateEvent.getAppId();
+                String clusterId = clusterInactivateEvent.getClusterId();
+                AbstractClusterMonitor clusterMonitor =
+                        (AbstractClusterMonitor) AutoscalerContext.getInstance().getMonitor(clusterId);
+
+                //changing the status in the monitor, will notify its parent monitor
+                clusterMonitor.setStatus(ClusterStatus.Terminated);
+
+                //starting the status checker to decide on the status of it's parent
+                //StatusChecker.getInstance().onClusterStatusChange(clusterId, appId);
+            }
+        });
+
         topologyEventReceiver.addEventListener(new GroupActivatedEventListener() {
             @Override
             protected void onEvent(Event event) {
@@ -218,9 +258,9 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
 
                 log.info("[GroupInActivateEvent] Received: " + event.getClass());
 
-                GroupInActivateEvent groupInActivateEvent = (GroupInActivateEvent) event;
-                String appId = groupInActivateEvent.getAppId();
-                String groupId = groupInActivateEvent.getGroupId();
+                GroupInactivateEvent groupInactivateEvent = (GroupInactivateEvent) event;
+                String appId = groupInactivateEvent.getAppId();
+                String groupId = groupInactivateEvent.getGroupId();
 
                 ApplicationMonitor appMonitor = AutoscalerContext.getInstance().getAppMonitor(appId);
                 GroupMonitor monitor = (GroupMonitor) appMonitor.findGroupMonitorWithId(groupId);

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java
index 604602b..5aa4467 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java
@@ -21,7 +21,6 @@ package org.apache.stratos.cloud.controller.application.status.receiver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.topology.TopologyBuilder;
-import org.apache.stratos.messaging.domain.topology.Cluster;
 import org.apache.stratos.messaging.event.Event;
 import org.apache.stratos.messaging.event.application.status.*;
 import org.apache.stratos.messaging.listener.application.status.*;
@@ -72,25 +71,31 @@ public class ApplicationStatusTopicReceiver implements Runnable {
             }
         });
 
-        statusEventReceiver.addEventListener(new ClusterInActivateEventListener() {
+        statusEventReceiver.addEventListener(new AppStatusClusterTerminatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterInActivateEvent((ClusterInActivateEvent) event);
+                TopologyBuilder.handleClusterTerminatedEvent((ClusterActivatedEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new GroupActivatedEventListener() {
+        statusEventReceiver.addEventListener(new AppStatusClusterTerminatingEventListener(){
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupActivatedEvent((GroupActivatedEvent) event);
+                TopologyBuilder.handleClusterTerminatingEvent((ClusterActivatedEvent) event);
+            }
+        });
 
+        statusEventReceiver.addEventListener(new ClusterInActivateEventListener() {
+            @Override
+            protected void onEvent(Event event) {
+                TopologyBuilder.handleClusterInActivateEvent((ClusterInActivateEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new GroupInactivateEventListener() {
+        statusEventReceiver.addEventListener(new GroupActivatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupInActiveEvent((GroupInactivateEvent) event);
+                TopologyBuilder.handleGroupActivatedEvent((GroupActivatedEvent) event);
 
             }
         });

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
index 484cf99..80315ea 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
@@ -39,12 +39,12 @@ import org.apache.stratos.messaging.event.application.status.ApplicationTerminat
 import org.apache.stratos.messaging.event.application.status.ApplicationTerminatingEvent;
 import org.apache.stratos.messaging.event.application.status.ClusterActivatedEvent;
 import org.apache.stratos.messaging.event.application.status.GroupActivatedEvent;
+import org.apache.stratos.messaging.event.application.status.GroupInactivateEvent;
 import org.apache.stratos.messaging.event.instance.status.InstanceActivatedEvent;
 import org.apache.stratos.messaging.event.instance.status.InstanceMaintenanceModeEvent;
 import org.apache.stratos.messaging.event.instance.status.InstanceReadyToShutdownEvent;
 import org.apache.stratos.messaging.event.instance.status.InstanceStartedEvent;
 import org.apache.stratos.messaging.event.topology.*;
-import org.apache.stratos.messaging.event.topology.ClusterInActivateEvent;
 import org.wso2.carbon.registry.core.exceptions.RegistryException;
 
 import java.util.*;
@@ -793,8 +793,8 @@ public class TopologyBuilder {
             return;
         }
 
-        ClusterInActivateEvent clusterActivatedEvent1 =
-                new ClusterInActivateEvent(
+        ClusterInactivateEvent clusterActivatedEvent1 =
+                new ClusterInactivateEvent(
                         clusterInActivateEvent.getAppId(),
                         clusterInActivateEvent.getServiceName(),
                         clusterInActivateEvent.getClusterId());
@@ -1059,8 +1059,8 @@ public class TopologyBuilder {
             return;
         }
 
-        GroupInActivateEvent groupInActivateEvent =
-                new GroupInActivateEvent(
+        org.apache.stratos.messaging.event.topology.GroupInactivateEvent groupInActivateEvent =
+                new org.apache.stratos.messaging.event.topology.GroupInactivateEvent(
                         event.getAppId(),
                         event.getGroupId());
         try {
@@ -1144,4 +1144,12 @@ public class TopologyBuilder {
         //publishing data
         TopologyEventPublisher.sendGroupTerminatingEvent(groupTerminatingTopologyEvent);
     }
+
+    public static void handleClusterTerminatedEvent(ClusterActivatedEvent event) {
+
+    }
+
+    public static void handleClusterTerminatingEvent(ClusterActivatedEvent event) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java
index 9f69ee2..3c6277d 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java
@@ -204,7 +204,7 @@ public class TopologyEventPublisher {
         publishEvent(clusterActivatedEvent);
     }
 
-    public static void sendClusterInActivateEvent(ClusterInActivateEvent clusterInActiveEvent) {
+    public static void sendClusterInActivateEvent(ClusterInactivateEvent clusterInActiveEvent) {
         if(log.isInfoEnabled()) {
             log.info(String.format("Publishing cluster in-active event: [service] %s [cluster] %s [appId] %s",
                     clusterInActiveEvent.getServiceName(), clusterInActiveEvent.getClusterId() , clusterInActiveEvent.getAppId()));
@@ -273,7 +273,7 @@ public class TopologyEventPublisher {
         publishEvent(applicationTerminatedEvent);
     }
 
-    public static void sendGroupInActiveEvent(GroupInActivateEvent groupInActivateEvent) {
+    public static void sendGroupInActiveEvent(GroupInactivateEvent groupInActivateEvent) {
         if(log.isInfoEnabled()) {
             log.info(String.format("Publishing group in-active event: [appId] %s",
                     groupInActivateEvent.getAppId()));

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatedEvent.java
new file mode 100644
index 0000000..919d0ca
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatedEvent.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.event.application.status;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class AppStatusClusterTerminatedEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public AppStatusClusterTerminatedEvent(String appId, String serviceName, String clusterId) {
+        this.serviceName = serviceName;
+        this.clusterId = clusterId;
+        this.appId = appId;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatingEvent.java
new file mode 100644
index 0000000..7a6baf0
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatingEvent.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.event.application.status;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class AppStatusClusterTerminatingEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public AppStatusClusterTerminatingEvent(String appId, String serviceName, String clusterId) {
+        this.serviceName = serviceName;
+        this.clusterId = clusterId;
+        this.appId = appId;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterInActivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterInActivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterInActivateEvent.java
deleted file mode 100644
index 36ea436..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterInActivateEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.stratos.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-
-/**
- * Cluster activated event will be sent by Autoscaler
- */
-public class ClusterInActivateEvent extends Event {
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public ClusterInActivateEvent(String appId, String serviceName, String clusterId) {
-        this.serviceName = serviceName;
-        this.clusterId = clusterId;
-        this.appId = appId;
-    }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    @Override
-    public String toString() {
-        return "ClusterActivatedEvent [serviceName=" + serviceName + ", clusterStatus=" +
-                "]";
-    }
-
-    public String getClusterId() {
-        return clusterId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterInactivateEvent.java
new file mode 100644
index 0000000..0f14e4f
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterInactivateEvent.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.event.topology;
+
+import org.apache.stratos.messaging.event.Event;
+
+/**
+ * Cluster activated event will be sent by Autoscaler
+ */
+public class ClusterInactivateEvent extends Event {
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public ClusterInactivateEvent(String appId, String serviceName, String clusterId) {
+        this.serviceName = serviceName;
+        this.clusterId = clusterId;
+        this.appId = appId;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    @Override
+    public String toString() {
+        return "ClusterActivatedEvent [serviceName=" + serviceName + ", clusterStatus=" +
+                "]";
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterTerminatedEvent.java
new file mode 100644
index 0000000..c4ab872
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterTerminatedEvent.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.event.topology;
+
+import org.apache.stratos.messaging.event.Event;
+
+/**
+ * Cluster activated event will be sent by Autoscaler
+ */
+public class ClusterTerminatedEvent extends Event {
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public ClusterTerminatedEvent(String appId, String serviceName, String clusterId) {
+        this.serviceName = serviceName;
+        this.clusterId = clusterId;
+        this.appId = appId;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    @Override
+    public String toString() {
+        return "ClusterActivatedEvent [serviceName=" + serviceName + ", clusterStatus=" +
+                "]";
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterTerminatingEvent.java
new file mode 100644
index 0000000..5b04fcd
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterTerminatingEvent.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.event.topology;
+
+import org.apache.stratos.messaging.event.Event;
+
+/**
+ * Cluster activated event will be sent by Autoscaler
+ */
+public class ClusterTerminatingEvent extends Event {
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public ClusterTerminatingEvent(String appId, String serviceName, String clusterId) {
+        this.serviceName = serviceName;
+        this.clusterId = clusterId;
+        this.appId = appId;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    @Override
+    public String toString() {
+        return "ClusterActivatedEvent [serviceName=" + serviceName + ", clusterStatus=" +
+                "]";
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInActivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInActivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInActivateEvent.java
deleted file mode 100644
index dd7007b..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInActivateEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.stratos.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-
-/**
- * Group Activated Event which will be sent to Topology upon group activation
- */
-public class GroupInActivateEvent extends Event {
-    private String appId;
-    private String groupId;
-
-    public GroupInActivateEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-
-    public String getGroupId() {
-        return groupId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivateEvent.java
new file mode 100644
index 0000000..3bcbaa9
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivateEvent.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.event.topology;
+
+import org.apache.stratos.messaging.event.Event;
+
+/**
+ * Group Activated Event which will be sent to Topology upon group activation
+ */
+public class GroupInactivateEvent extends Event {
+    private String appId;
+    private String groupId;
+
+    public GroupInactivateEvent(String appId, String groupId) {
+        this.appId = appId;
+        this.groupId = groupId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public String getGroupId() {
+        return groupId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivatedEvent.java
deleted file mode 100644
index 176f709..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivatedEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.stratos.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-
-/**
- * Group Activated Event which will be sent to Topology upon group activation
- */
-public class GroupInactivatedEvent extends Event {
-    private String appId;
-    private String groupId;
-
-    public GroupInactivatedEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-
-    public String getGroupId() {
-        return groupId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatedEventListener.java
new file mode 100644
index 0000000..a47c371
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatedEventListener.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.listener.application.status;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class AppStatusClusterTerminatedEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatingEventListener.java
new file mode 100644
index 0000000..11bdb97
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatingEventListener.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.listener.application.status;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class AppStatusClusterTerminatingEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterTerminatedEventListener.java
new file mode 100644
index 0000000..33d050d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterTerminatedEventListener.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.listener.topology;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class ClusterTerminatedEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterTerminatingEventListener.java
new file mode 100644
index 0000000..5c08203
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterTerminatingEventListener.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.listener.topology;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class ClusterTerminatingEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatedMessageProcessor.java
new file mode 100644
index 0000000..a5bed11
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatedMessageProcessor.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.message.processor.application.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.application.status.AppStatusClusterTerminatedEvent;
+import org.apache.stratos.messaging.event.topology.ClusterTerminatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class AppStatusClusterTerminatedMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(AppStatusClusterTerminatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (AppStatusClusterTerminatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ClusterTerminatedEvent event = (ClusterTerminatedEvent) Util.
+                                                jsonToObject(message, AppStatusClusterTerminatedEvent.class);
+
+            if(log.isDebugEnabled()) {
+                log.debug("Received AppStatusClusterTerminatedEvent: " + event.toString());
+            }
+            // Notify event listeners
+            notifyEventListeners(event);
+            return true;
+        } else {
+            if (nextProcessor != null) {
+                return nextProcessor.process(type, message, object);
+            } else {
+                throw new RuntimeException(String.format("Failed to process cluster activated message using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatingMessageProcessor.java
new file mode 100644
index 0000000..e387a15
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatingMessageProcessor.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.message.processor.application.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.application.status.AppStatusClusterTerminatingEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class AppStatusClusterTerminatingMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(AppStatusClusterTerminatingMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (AppStatusClusterTerminatingEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            AppStatusClusterTerminatingEvent event = (AppStatusClusterTerminatingEvent) Util.
+                                                jsonToObject(message, AppStatusClusterTerminatingEvent.class);
+
+            if(log.isDebugEnabled()) {
+                log.debug("Received AppStatusClusterTerminatingEvent: " + event.toString());
+            }
+            // Notify event listeners
+            notifyEventListeners(event);
+            return true;
+        } else {
+            if (nextProcessor != null) {
+                return nextProcessor.process(type, message, object);
+            } else {
+                throw new RuntimeException(String.format("Failed to process cluster activated message using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java
index e8575cc..8d2cdf6 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java
@@ -33,6 +33,8 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai
 
     private ApplicationStatusClusterActivatedMessageProcessor clusterActivatedMessageProcessor;
     private ApplicationStatusClusterInActivateMessageProcessor clusterInActivateMessageProcessor;
+    private AppStatusClusterTerminatingMessageProcessor clusterTerminatingMessageProcessor;
+    private AppStatusClusterTerminatedMessageProcessor clusterTerminatedMessageProcessor;
     private ApplicationStatusGroupActivatedMessageProcessor groupActivatedMessageProcessor;
     private ApplicationStatusGroupInActivatedMessageProcessor groupInActivateMessageProcessor;
     private ApplicationStatusAppActivatedMessageProcessor appActivatedMessageProcessor;
@@ -52,6 +54,11 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai
         clusterInActivateMessageProcessor = new ApplicationStatusClusterInActivateMessageProcessor();
         add(clusterInActivateMessageProcessor);
 
+        clusterTerminatingMessageProcessor = new AppStatusClusterTerminatingMessageProcessor();
+        add(clusterTerminatingMessageProcessor);
+        clusterTerminatedMessageProcessor = new AppStatusClusterTerminatedMessageProcessor();
+        add(clusterTerminatedMessageProcessor);
+
         groupActivatedMessageProcessor = new ApplicationStatusGroupActivatedMessageProcessor();
         add(groupActivatedMessageProcessor);
 
@@ -91,7 +98,11 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai
             clusterInActivateMessageProcessor.addEventListener(eventListener);
         } else if (eventListener instanceof GroupActivatedEventListener) {
             groupActivatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof GroupInactivateEventListener) {
+        } else if(eventListener instanceof AppStatusClusterTerminatedEventListener){
+            clusterTerminatedMessageProcessor.addEventListener(eventListener);
+        } else if(eventListener instanceof AppStatusClusterTerminatingEventListener){
+            clusterTerminatingMessageProcessor.addEventListener(eventListener);
+        }else if (eventListener instanceof GroupInactivateEventListener) {
             groupInActivateMessageProcessor.addEventListener(eventListener);
         } else if (eventListener instanceof ApplicationActivatedEventListener) {
             appActivatedMessageProcessor.addEventListener(eventListener);

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterInActivateProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterInActivateProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterInActivateProcessor.java
index cfaad73..a0862b2 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterInActivateProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterInActivateProcessor.java
@@ -24,7 +24,7 @@ import org.apache.stratos.messaging.domain.topology.Cluster;
 import org.apache.stratos.messaging.domain.topology.ClusterStatus;
 import org.apache.stratos.messaging.domain.topology.Service;
 import org.apache.stratos.messaging.domain.topology.Topology;
-import org.apache.stratos.messaging.event.topology.ClusterInActivateEvent;
+import org.apache.stratos.messaging.event.topology.ClusterInactivateEvent;
 import org.apache.stratos.messaging.message.filter.topology.TopologyClusterFilter;
 import org.apache.stratos.messaging.message.filter.topology.TopologyServiceFilter;
 import org.apache.stratos.messaging.message.processor.MessageProcessor;
@@ -48,15 +48,15 @@ public class ClusterInActivateProcessor extends MessageProcessor {
 
         Topology topology = (Topology) object;
 
-        if (ClusterInActivateEvent.class.getName().equals(type)) {
+        if (ClusterInactivateEvent.class.getName().equals(type)) {
             // Return if topology has not been initialized
             if (!topology.isInitialized()) {
                 return false;
             }
 
             // Parse complete message and build event
-            ClusterInActivateEvent event = (ClusterInActivateEvent) Util.
-                    jsonToObject(message, ClusterInActivateEvent.class);
+            ClusterInactivateEvent event = (ClusterInactivateEvent) Util.
+                    jsonToObject(message, ClusterInactivateEvent.class);
 
             TopologyUpdater.acquireWriteLockForCluster(event.getServiceName(), event.getClusterId());
             try {
@@ -76,7 +76,7 @@ public class ClusterInActivateProcessor extends MessageProcessor {
         }
     }
 
-    private boolean doProcess(ClusterInActivateEvent event, Topology topology) {
+    private boolean doProcess(ClusterInactivateEvent event, Topology topology) {
 // Apply service filter
         if (TopologyServiceFilter.getInstance().isActive()) {
             if (TopologyServiceFilter.getInstance().serviceNameExcluded(event.getServiceName())) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterTerminatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterTerminatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterTerminatedProcessor.java
new file mode 100644
index 0000000..0536011
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterTerminatedProcessor.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.message.processor.topology;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.messaging.domain.topology.ClusterStatus;
+import org.apache.stratos.messaging.domain.topology.Service;
+import org.apache.stratos.messaging.domain.topology.Topology;
+import org.apache.stratos.messaging.event.topology.ClusterActivatedEvent;
+import org.apache.stratos.messaging.message.filter.topology.TopologyClusterFilter;
+import org.apache.stratos.messaging.message.filter.topology.TopologyServiceFilter;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.message.processor.topology.updater.TopologyUpdater;
+import org.apache.stratos.messaging.util.Util;
+
+/**
+ * This processor will act upon the cluster activated event
+ */
+public class ClusterTerminatedProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(ClusterTerminatedProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+
+        Topology topology = (Topology) object;
+
+        if (ClusterActivatedEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized()) {
+                return false;
+            }
+
+            // Parse complete message and build event
+            ClusterActivatedEvent event = (ClusterActivatedEvent) Util.
+                    jsonToObject(message, ClusterActivatedEvent.class);
+
+            TopologyUpdater.acquireWriteLockForCluster(event.getServiceName(), event.getClusterId());
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForCluster(event.getServiceName(), event.getClusterId());
+            }
+
+        } else {
+            if (nextProcessor != null) {
+                // ask the next processor to take care of the message.
+                return nextProcessor.process(type, message, topology);
+            } else {
+                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+
+    private boolean doProcess(ClusterActivatedEvent event, Topology topology) {
+
+        // Apply service filter
+        if (TopologyServiceFilter.getInstance().isActive()) {
+            if (TopologyServiceFilter.getInstance().serviceNameExcluded(event.getServiceName())) {
+                // Service is excluded, do not update topology or fire event
+                if (log.isDebugEnabled()) {
+                    log.debug(String.format("Service is excluded: [service] %s", event.getServiceName()));
+                }
+                return false;
+            }
+        }
+
+        // Apply cluster filter
+        if (TopologyClusterFilter.getInstance().isActive()) {
+            if (TopologyClusterFilter.getInstance().clusterIdExcluded(event.getClusterId())) {
+                // Cluster is excluded, do not update topology or fire event
+                if (log.isDebugEnabled()) {
+                    log.debug(String.format("Cluster is excluded: [cluster] %s", event.getClusterId()));
+                }
+                return false;
+            }
+        }
+
+        // Validate event against the existing topology
+        Service service = topology.getService(event.getServiceName());
+        if (service == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Service does not exist: [service] %s",
+                        event.getServiceName()));
+            }
+            return false;
+        }
+        Cluster cluster = service.getCluster(event.getClusterId());
+
+        if (cluster == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Cluster not exists in service: [service] %s [cluster] %s", event.getServiceName(),
+                        event.getClusterId()));
+            }
+        } else {
+            // Apply changes to the topology
+            if (!cluster.isStateTransitionValid(ClusterStatus.Active)) {
+                log.error("Invalid State Transition from " + cluster.getStatus() + " to " + ClusterStatus.Active);
+            }
+            cluster.setStatus(ClusterStatus.Active);
+
+        }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterTerminatingProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterTerminatingProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterTerminatingProcessor.java
new file mode 100644
index 0000000..1ed2671
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterTerminatingProcessor.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.stratos.messaging.message.processor.topology;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.messaging.domain.topology.ClusterStatus;
+import org.apache.stratos.messaging.domain.topology.Service;
+import org.apache.stratos.messaging.domain.topology.Topology;
+import org.apache.stratos.messaging.event.topology.ClusterActivatedEvent;
+import org.apache.stratos.messaging.message.filter.topology.TopologyClusterFilter;
+import org.apache.stratos.messaging.message.filter.topology.TopologyServiceFilter;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.message.processor.topology.updater.TopologyUpdater;
+import org.apache.stratos.messaging.util.Util;
+
+/**
+ * This processor will act upon the cluster activated event
+ */
+public class ClusterTerminatingProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(ClusterTerminatingProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+
+        Topology topology = (Topology) object;
+
+        if (ClusterActivatedEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized()) {
+                return false;
+            }
+
+            // Parse complete message and build event
+            ClusterActivatedEvent event = (ClusterActivatedEvent) Util.
+                    jsonToObject(message, ClusterActivatedEvent.class);
+
+            TopologyUpdater.acquireWriteLockForCluster(event.getServiceName(), event.getClusterId());
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForCluster(event.getServiceName(), event.getClusterId());
+            }
+
+        } else {
+            if (nextProcessor != null) {
+                // ask the next processor to take care of the message.
+                return nextProcessor.process(type, message, topology);
+            } else {
+                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+
+    private boolean doProcess(ClusterActivatedEvent event, Topology topology) {
+
+        // Apply service filter
+        if (TopologyServiceFilter.getInstance().isActive()) {
+            if (TopologyServiceFilter.getInstance().serviceNameExcluded(event.getServiceName())) {
+                // Service is excluded, do not update topology or fire event
+                if (log.isDebugEnabled()) {
+                    log.debug(String.format("Service is excluded: [service] %s", event.getServiceName()));
+                }
+                return false;
+            }
+        }
+
+        // Apply cluster filter
+        if (TopologyClusterFilter.getInstance().isActive()) {
+            if (TopologyClusterFilter.getInstance().clusterIdExcluded(event.getClusterId())) {
+                // Cluster is excluded, do not update topology or fire event
+                if (log.isDebugEnabled()) {
+                    log.debug(String.format("Cluster is excluded: [cluster] %s", event.getClusterId()));
+                }
+                return false;
+            }
+        }
+
+        // Validate event against the existing topology
+        Service service = topology.getService(event.getServiceName());
+        if (service == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Service does not exist: [service] %s",
+                        event.getServiceName()));
+            }
+            return false;
+        }
+        Cluster cluster = service.getCluster(event.getClusterId());
+
+        if (cluster == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Cluster not exists in service: [service] %s [cluster] %s", event.getServiceName(),
+                        event.getClusterId()));
+            }
+        } else {
+            // Apply changes to the topology
+            if (!cluster.isStateTransitionValid(ClusterStatus.Active)) {
+                log.error("Invalid State Transition from " + cluster.getStatus() + " to " + ClusterStatus.Active);
+            }
+            cluster.setStatus(ClusterStatus.Active);
+
+        }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupInActivateProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupInActivateProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupInActivateProcessor.java
index ed8488c..f8fe705 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupInActivateProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupInActivateProcessor.java
@@ -25,7 +25,7 @@ import org.apache.stratos.messaging.domain.topology.Group;
 import org.apache.stratos.messaging.domain.topology.GroupStatus;
 import org.apache.stratos.messaging.domain.topology.Topology;
 import org.apache.stratos.messaging.event.topology.GroupActivatedEvent;
-import org.apache.stratos.messaging.event.topology.GroupInActivateEvent;
+import org.apache.stratos.messaging.event.topology.GroupInactivateEvent;
 import org.apache.stratos.messaging.message.processor.MessageProcessor;
 import org.apache.stratos.messaging.message.processor.topology.updater.TopologyUpdater;
 import org.apache.stratos.messaging.util.Util;
@@ -52,8 +52,8 @@ public class GroupInActivateProcessor extends MessageProcessor {
                 return false;
 
             // Parse complete message and build event
-            GroupInActivateEvent event = (GroupInActivateEvent) Util.
-                    jsonToObject(message, GroupInActivateEvent.class);
+            GroupInactivateEvent event = (GroupInactivateEvent) Util.
+                    jsonToObject(message, GroupInactivateEvent.class);
 
             TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
 
@@ -74,7 +74,7 @@ public class GroupInActivateProcessor extends MessageProcessor {
         }
     }
 
-    private boolean doProcess(GroupInActivateEvent event, Topology topology) {
+    private boolean doProcess(GroupInactivateEvent event, Topology topology) {
 
         // Validate event against the existing topology
         Application application = topology.getApplication(event.getAppId());

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java
index 1e1930c..1b7ba13 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java
@@ -57,6 +57,8 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain {
     private ApplicationTerminatingMessageProcessor applicationTerminatingMessageProcessor;
     private GroupTerminatingProcessor groupTerminatingProcessor;
     private GroupTerminatedProcessor groupTerminatedProcessor;
+    private ClusterTerminatingProcessor clusterTerminatingProcessor;
+    private ClusterTerminatedProcessor clusterTerminatedProcessor;
 
     public void initialize() {
         // Add topology event processors
@@ -81,6 +83,12 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain {
         clusterRemovedMessageProcessor = new ClusterRemovedMessageProcessor();
         add(clusterRemovedMessageProcessor);
 
+        clusterTerminatedProcessor = new ClusterTerminatedProcessor();
+        add(clusterTerminatedProcessor);
+
+        clusterTerminatingProcessor = new ClusterTerminatingProcessor();
+        add(clusterTerminatingProcessor);
+
         instanceSpawnedMessageProcessor = new InstanceSpawnedMessageProcessor();
         add(instanceSpawnedMessageProcessor);
 
@@ -151,7 +159,11 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain {
             clusterInActivateProcessor.addEventListener(eventListener);
         } else if (eventListener instanceof ClusterRemovedEventListener) {
             clusterRemovedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof InstanceSpawnedEventListener) {
+        } else if(eventListener instanceof ClusterTerminatedEventListener){
+            clusterTerminatedProcessor.addEventListener(eventListener);
+        } else if(eventListener instanceof  ClusterTerminatingEventListener){
+            clusterTerminatingProcessor.addEventListener(eventListener);
+        }else if (eventListener instanceof InstanceSpawnedEventListener) {
             instanceSpawnedMessageProcessor.addEventListener(eventListener);
         } else if (eventListener instanceof MemberActivatedEventListener) {
             memberActivatedMessageProcessor.addEventListener(eventListener);

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/exception/MetadataException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/exception/MetadataException.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/exception/MetadataException.java
index 4252b46..8883ab1 100644
--- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/exception/MetadataException.java
+++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/exception/MetadataException.java
@@ -1,8 +1,6 @@
 package org.apache.stratos.metadataservice.exception;
 
-/**
- * Created by udara on 9/22/14.
- */
+
 public class MetadataException extends Exception {
 
     public MetadataException(String message, Throwable cause) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/ApplicationBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/ApplicationBean.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/ApplicationBean.java
index eb90f3b..59da564 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/ApplicationBean.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/ApplicationBean.java
@@ -6,9 +6,6 @@ import javax.xml.bind.annotation.XmlRootElement;
 import java.util.ArrayList;
 import java.util.List;
 
-/**
- * Created by udara on 10/17/14.
- */
 @XmlRootElement(name="applications")
 public class ApplicationBean {
     private String id;

http://git-wip-us.apache.org/repos/asf/stratos/blob/7619d85c/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/MyType.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/MyType.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/MyType.java
deleted file mode 100644
index 0526faa..0000000
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/MyType.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.apache.stratos.rest.endpoint.services;
-
-/**
- * Created by udara on 7/7/14.
- */
-public class MyType {
-    private int name;
-
-    public int getName() {
-        return name;
-    }
-
-    public void setName(int name) {
-        this.name = name;
-    }
-}


Mime
View raw message