You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2014/10/31 08:51:34 UTC

[01/10] git commit: uddating applications topic

Repository: stratos
Updated Branches:
  refs/heads/4.0.0-grouping e15343080 -> 275ba2dd6


uddating applications topic


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

Branch: refs/heads/4.0.0-grouping
Commit: ea9337d36508111c9ad095aadf61e66c43ec4ecf
Parents: f0ba4be
Author: reka <rt...@gmail.com>
Authored: Fri Oct 31 12:23:17 2014 +0530
Committer: reka <rt...@gmail.com>
Committed: Fri Oct 31 12:23:39 2014 +0530

----------------------------------------------------------------------
 .../AutoscalerTopologyEventReceiver.java        |  1 +
 .../ApplicationStatusTopicReceiver.java         | 62 ++++++-------
 .../controller/topology/TopologyBuilder.java    | 45 ++++++----
 .../AppStatusMessageProcessorChain.java         | 94 ++++++++++----------
 .../topology/TopologyMessageProcessorChain.java |  1 +
 5 files changed, 107 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/ea9337d3/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 fe4d9df..97ba3f1 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
@@ -44,6 +44,7 @@ import org.apache.stratos.messaging.domain.applications.GroupStatus;
 import org.apache.stratos.messaging.domain.topology.*;
 import org.apache.stratos.messaging.event.Event;
 import org.apache.stratos.messaging.event.topology.*;
+import org.apache.stratos.messaging.listener.applications.ApplicationUndeployedEventListener;
 import org.apache.stratos.messaging.listener.topology.*;
 import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver;
 import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;

http://git-wip-us.apache.org/repos/asf/stratos/blob/ea9337d3/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 9db0998..d83a7d3 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
@@ -22,8 +22,8 @@ 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.event.Event;
-import org.apache.stratos.messaging.event.application.status.*;
-import org.apache.stratos.messaging.listener.application.status.*;
+import org.apache.stratos.messaging.event.applications.*;
+import org.apache.stratos.messaging.listener.applications.*;
 import org.apache.stratos.messaging.message.receiver.application.status.ApplicationStatusEventReceiver;
 
 public class ApplicationStatusTopicReceiver implements Runnable {
@@ -64,74 +64,74 @@ public class ApplicationStatusTopicReceiver implements Runnable {
 
     private void addEventListeners() {
         // Listen to topology events that affect clusters
-        statusEventReceiver.addEventListener(new AppStatusClusterCreatedEventListener() {
+        statusEventReceiver.addEventListener(new AppClusterCreatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterCreated((AppStatusClusterCreatedEvent) event);
+                TopologyBuilder.handleClusterCreated((AppClusterCreatedEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusClusterActivatedEventListener() {
+        statusEventReceiver.addEventListener(new AppClusterActivatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterActivatedEvent((AppStatusClusterActivatedEvent) event);
+                TopologyBuilder.handleClusterActivatedEvent((AppClusterActivatedEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusClusterTerminatedEventListener() {
+        statusEventReceiver.addEventListener(new AppClusterTerminatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterTerminatedEvent((AppStatusClusterTerminatedEvent) event);
+                TopologyBuilder.handleClusterTerminatedEvent((AppClusterTerminatedEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusClusterTerminatingEventListener(){
+        statusEventReceiver.addEventListener(new AppClusterTerminatingEventListener(){
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterTerminatingEvent((AppStatusClusterTerminatingEvent) event);
+                TopologyBuilder.handleClusterTerminatingEvent((AppClusterTerminatingEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusClusterInactivateEventListener() {
+        statusEventReceiver.addEventListener(new AppClusterInactivateEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterInActivateEvent((AppStatusClusterInactivateEvent) event);
+                TopologyBuilder.handleClusterInActivateEvent((AppClusterInactivateEvent) event);
             }
         });
 
 
-        statusEventReceiver.addEventListener(new AppStatusGroupCreatedEventListener() {
+        statusEventReceiver.addEventListener(new GroupCreatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupCreated((AppStatusGroupCreatedEvent) event);
+                TopologyBuilder.handleGroupCreated((GroupCreatedEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusGroupActivatedEventListener() {
+        statusEventReceiver.addEventListener(new GroupActivatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupActivatedEvent((AppStatusGroupActivatedEvent) event);
+                TopologyBuilder.handleGroupActivatedEvent((GroupActivatedEvent) event);
 
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusGroupTerminatedEventListener() {
+        statusEventReceiver.addEventListener(new GroupTerminatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupTerminatedEvent((AppStatusGroupTerminatedEvent) event);
+                TopologyBuilder.handleGroupTerminatedEvent((GroupTerminatedEvent) event);
 
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusGroupTerminatingEventListener() {
+        statusEventReceiver.addEventListener(new GroupTerminatingEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupTerminatingEvent((AppStatusGroupTerminatingEvent) event);
+                TopologyBuilder.handleGroupTerminatingEvent((GroupTerminatingEvent) event);
 
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusGroupInactivateEventListener() {
+        statusEventReceiver.addEventListener(new GroupInactivateEventListener() {
             @Override
             protected void onEvent(Event event) {
                 TopologyBuilder.handleGroupInActiveEvent((AppStatusGroupInactivateEvent) event);
@@ -139,44 +139,44 @@ public class ApplicationStatusTopicReceiver implements Runnable {
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusApplicationActivatedEventListener() {
+        statusEventReceiver.addEventListener(new ApplicationActivatedEventListener() {
 
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationActivatedEvent((AppStatusApplicationActivatedEvent) event);
+                TopologyBuilder.handleApplicationActivatedEvent((ApplicationActivatedEvent) event);
 
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusApplicationInactivatedEventListener() {
+        statusEventReceiver.addEventListener(new ApplicationInactivatedEventListener() {
 
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationInActivatedEvent((AppStatusApplicationInactivatedEvent) event);
+                TopologyBuilder.handleApplicationInActivatedEvent((ApplicationInactivatedEvent) event);
 
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusApplicationCreatedEventListener() {
+        statusEventReceiver.addEventListener(new ApplicationCreatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationCreatedEvent((AppStatusApplicationCreatedEvent) event);
+                TopologyBuilder.handleApplicationCreatedEvent((ApplicationCreatedEvent) event);
 
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusApplicationTerminatingEventListener() {
+        statusEventReceiver.addEventListener(new ApplicationTerminatingEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationTerminatingEvent((AppStatusApplicationTerminatingEvent) event);
+                TopologyBuilder.handleApplicationTerminatingEvent((ApplicationTerminatingEvent) event);
 
             }
         });
 
-        statusEventReceiver.addEventListener(new AppStatusApplicationTerminatedEventListener() {
+        statusEventReceiver.addEventListener(new ApplicationTerminatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationTerminatedEvent((AppStatusApplicationTerminatedEvent) event);
+                TopologyBuilder.handleApplicationTerminatedEvent((ApplicationTerminatedEvent) event);
 
             }
         });

http://git-wip-us.apache.org/repos/asf/stratos/blob/ea9337d3/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 e31cf32..3bc7b5a 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
@@ -31,7 +31,16 @@ import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
 import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
 import org.apache.stratos.messaging.domain.applications.*;
 import org.apache.stratos.messaging.domain.topology.*;
-import org.apache.stratos.messaging.event.application.status.*;
+import org.apache.stratos.messaging.event.applications.*;
+import org.apache.stratos.messaging.event.applications.ApplicationActivatedEvent;
+import org.apache.stratos.messaging.event.applications.ApplicationCreatedEvent;
+import org.apache.stratos.messaging.event.applications.ApplicationInactivatedEvent;
+import org.apache.stratos.messaging.event.applications.ApplicationTerminatedEvent;
+import org.apache.stratos.messaging.event.applications.ApplicationTerminatingEvent;
+import org.apache.stratos.messaging.event.applications.GroupActivatedEvent;
+import org.apache.stratos.messaging.event.applications.GroupCreatedEvent;
+import org.apache.stratos.messaging.event.applications.GroupTerminatedEvent;
+import org.apache.stratos.messaging.event.applications.GroupTerminatingEvent;
 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;
@@ -115,7 +124,7 @@ public class TopologyBuilder {
         }
     }
 
-    public static void handleClusterCreated (AppStatusClusterCreatedEvent event) {
+    public static void handleClusterCreated (AppClusterCreatedEvent event) {
 
         TopologyManager.acquireWriteLock();
 
@@ -152,7 +161,7 @@ public class TopologyBuilder {
                 event.getClusterId());
     }
 
-    public static void handleGroupCreated (AppStatusGroupCreatedEvent event) {
+    public static void handleGroupCreated (GroupCreatedEvent event) {
 
         TopologyManager.acquireWriteLock();
 
@@ -186,7 +195,7 @@ public class TopologyBuilder {
             TopologyManager.releaseWriteLock();
         }
 
-        TopologyEventPublisher.sendGroupCreatedEvent(new GroupCreatedEvent(event.getAppId(), event.getGroupId()));
+        TopologyEventPublisher.sendGroupCreatedEvent(new org.apache.stratos.messaging.event.topology.GroupCreatedEvent(event.getAppId(), event.getGroupId()));
     }
 
     public static void handleClusterCreated(Registrant registrant, boolean isLb) {
@@ -713,7 +722,7 @@ public class TopologyBuilder {
     }
 
 
-    public static void handleClusterActivatedEvent(AppStatusClusterActivatedEvent clusterActivatedEvent) {
+    public static void handleClusterActivatedEvent(AppClusterActivatedEvent clusterActivatedEvent) {
         Topology topology = TopologyManager.getTopology();
         Service service = topology.getService(clusterActivatedEvent.getServiceName());
         //update the status of the cluster
@@ -751,7 +760,7 @@ public class TopologyBuilder {
     }
 
     public static void handleClusterInActivateEvent(
-            AppStatusClusterInactivateEvent clusterInActivateEvent) {
+            AppClusterInactivateEvent clusterInActivateEvent) {
         Topology topology = TopologyManager.getTopology();
         Service service = topology.getService(clusterInActivateEvent.getServiceName());
         //update the status of the cluster
@@ -788,7 +797,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendClusterInActivateEvent(clusterActivatedEvent1);
     }
 
-    public static void handleGroupActivatedEvent(AppStatusGroupActivatedEvent groupActivatedEvent) {
+    public static void handleGroupActivatedEvent(GroupActivatedEvent groupActivatedEvent) {
         Topology topology = TopologyManager.getTopology();
         Application application = topology.getApplication(groupActivatedEvent.getAppId());
         //update the status of the Group
@@ -822,7 +831,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendGroupActivatedEvent(groupActivatedEvent1);
     }
 
-    public static void handleApplicationActivatedEvent(AppStatusApplicationActivatedEvent applicationActivatedEvent) {
+    public static void handleApplicationActivatedEvent(ApplicationActivatedEvent applicationActivatedEvent) {
         Topology topology = TopologyManager.getTopology();
         Application application = topology.getApplication(applicationActivatedEvent.getAppId());
         //update the status of the Group
@@ -848,7 +857,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendApplicationActivatedEvent(applicationActivatedEvent1);
     }
 
-    public static void handleApplicationInActivatedEvent(AppStatusApplicationInactivatedEvent event) {
+    public static void handleApplicationInActivatedEvent(ApplicationInactivatedEvent event) {
         Topology topology = TopologyManager.getTopology();
         Application application = topology.getApplication(event.getAppId());
         //update the status of the Group
@@ -874,7 +883,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendApplicationInactivatedEvent(applicationActivatedEvent);
     }
 
-    public static void handleApplicationCreatedEvent(AppStatusApplicationCreatedEvent event) {
+    public static void handleApplicationCreatedEvent(ApplicationCreatedEvent event) {
         Topology topology = TopologyManager.getTopology();
         Application application = topology.getApplication(event.getAppId());
         //update the status of the Group
@@ -907,7 +916,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendApplicationCreatedEvent(applicationActivatedEvent);
     }
 
-    public static void handleApplicationTerminatingEvent(AppStatusApplicationTerminatingEvent event) {
+    public static void handleApplicationTerminatingEvent(ApplicationTerminatingEvent event) {
 
         String applicationId = event.getAppId();
 
@@ -956,7 +965,7 @@ public class TopologyBuilder {
         }
     }
 
-    public static void handleApplicationTerminatedEvent(AppStatusApplicationTerminatedEvent event) {
+    public static void handleApplicationTerminatedEvent(ApplicationTerminatedEvent event) {
 
      Topology topology = TopologyManager.getTopology();
 
@@ -1018,7 +1027,7 @@ public class TopologyBuilder {
 
                 log.info("Removed application [ " + event.getAppId() + " ] from Topology");
 
-                TopologyEventPublisher.sendApplicationTerminatedEvent(new ApplicationTerminatedEvent(event.getAppId(),
+                TopologyEventPublisher.sendApplicationTerminatedEvent(new org.apache.stratos.messaging.event.topology.ApplicationTerminatedEvent(event.getAppId(),
                         clusterData, tenantId, tenantDomain));
             }
 
@@ -1027,7 +1036,7 @@ public class TopologyBuilder {
         }
     }
 
-    private static void deleteAppResourcesFromMetadataService(AppStatusApplicationTerminatedEvent event) {
+    private static void deleteAppResourcesFromMetadataService(ApplicationTerminatedEvent event) {
         try {
             MetaDataServiceClient metadataClient = new DefaultMetaDataServiceClient();
             metadataClient.deleteApplicationProperties(event.getAppId());
@@ -1071,7 +1080,7 @@ public class TopologyBuilder {
     }
 
 
-    public static void handleGroupTerminatedEvent(AppStatusGroupTerminatedEvent event) {
+    public static void handleGroupTerminatedEvent(GroupTerminatedEvent event) {
         Topology topology = TopologyManager.getTopology();
         Application application = topology.getApplication(event.getAppId());
         //update the status of the Group
@@ -1105,7 +1114,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendGroupTerminatedEvent(groupTerminatedTopologyEvent);
     }
 
-    public static void handleGroupTerminatingEvent(AppStatusGroupTerminatingEvent event) {
+    public static void handleGroupTerminatingEvent(GroupTerminatingEvent event) {
         Topology topology = TopologyManager.getTopology();
         Application application = topology.getApplication(event.getAppId());
         //update the status of the Group
@@ -1139,7 +1148,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendGroupTerminatingEvent(groupTerminatingTopologyEvent);
     }
 
-    public static void handleClusterTerminatedEvent(AppStatusClusterTerminatedEvent event) {
+    public static void handleClusterTerminatedEvent(AppClusterTerminatedEvent event) {
 
         TopologyManager.acquireWriteLock();
 
@@ -1166,7 +1175,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendClusterTerminatedEvent(clusterTerminatedEvent);
     }
 
-    public static void handleClusterTerminatingEvent(AppStatusClusterTerminatingEvent event) {
+    public static void handleClusterTerminatingEvent(AppClusterTerminatingEvent event) {
 
         TopologyManager.acquireWriteLock();
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/ea9337d3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
index 1524b00..3705f1e 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
@@ -21,7 +21,7 @@ package org.apache.stratos.messaging.message.processor.applications;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.messaging.listener.EventListener;
-import org.apache.stratos.messaging.listener.application.status.*;
+import org.apache.stratos.messaging.listener.applications.*;
 import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
 
 /**
@@ -31,68 +31,68 @@ import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
 public class AppStatusMessageProcessorChain extends MessageProcessorChain {
     private static final Log log = LogFactory.getLog(AppStatusMessageProcessorChain.class);
 
-    private AppStatusClusterCreatedMessageProcessor clusterCreatedMessageProcessor;
-    private AppStatusClusterActivatedMessageProcessor clusterActivatedMessageProcessor;
-    private AppStatusClusterInactivateMessageProcessor clusterInActivateMessageProcessor;
-    private AppStatusClusterTerminatingMessageProcessor clusterTerminatingMessageProcessor;
-    private AppStatusClusterTerminatedMessageProcessor clusterTerminatedMessageProcessor;
-    private AppStatusGroupCreatedMessageProcessor groupCreatedMessageProcessor;
-    private AppStatusGroupActivatedMessageProcessor groupActivatedMessageProcessor;
-    private AppStatusGroupInactivatedMessageProcessor groupInActivateMessageProcessor;
-    private AppStatusApplicationActivatedMessageProcessor appActivatedMessageProcessor;
-    private AppStatusApplicationCreatedMessageProcessor applicationStatusAppCreatedMessageProcessor;
-    private AppStatusApplicationInactivatedMessageProcessor applicationStatusAppInActivatedMessageProcessor;
-    private AppStatusApplicationTerminatedMessageProcessor applicationStatusAppTerminatedMessageProcessor;
-    private AppStatusApplicationTerminatingMessageProcessor applicationStatusAppTerminatingMessageProcessor;
-
-    private AppStatusGroupTerminatedMessageProcessor groupTerminatedMessageProcessor;
-    private AppStatusGroupTerminatingMessageProcessor groupTerminatingMessageProcessor;
+    private AppClusterCreatedMessageProcessor clusterCreatedMessageProcessor;
+    private AppClusterActivatedMessageProcessor clusterActivatedMessageProcessor;
+    private AppClusterInactivateMessageProcessor clusterInActivateMessageProcessor;
+    private AppClusterTerminatingMessageProcessor clusterTerminatingMessageProcessor;
+    private AppClusterTerminatedMessageProcessor clusterTerminatedMessageProcessor;
+    private GroupCreatedMessageProcessor groupCreatedMessageProcessor;
+    private GroupActivatedMessageProcessor groupActivatedMessageProcessor;
+    private GroupInactivatedMessageProcessor groupInActivateMessageProcessor;
+    private ApplicationActivatedMessageProcessor appActivatedMessageProcessor;
+    private ApplicationCreatedMessageProcessor applicationStatusAppCreatedMessageProcessor;
+    private ApplicationInactivatedMessageProcessor applicationStatusAppInActivatedMessageProcessor;
+    private ApplicationTerminatedMessageProcessor applicationStatusAppTerminatedMessageProcessor;
+    private ApplicationTerminatingMessageProcessor applicationStatusAppTerminatingMessageProcessor;
+
+    private GroupTerminatedMessageProcessor groupTerminatedMessageProcessor;
+    private GroupTerminatingMessageProcessor groupTerminatingMessageProcessor;
 
     public void initialize() {
         // Add instance notifier event processors
-        clusterCreatedMessageProcessor= new AppStatusClusterCreatedMessageProcessor();
+        clusterCreatedMessageProcessor= new AppClusterCreatedMessageProcessor();
         add(clusterCreatedMessageProcessor);
 
-        clusterActivatedMessageProcessor = new AppStatusClusterActivatedMessageProcessor();
+        clusterActivatedMessageProcessor = new AppClusterActivatedMessageProcessor();
         add(clusterActivatedMessageProcessor);
 
-        clusterInActivateMessageProcessor = new AppStatusClusterInactivateMessageProcessor();
+        clusterInActivateMessageProcessor = new AppClusterInactivateMessageProcessor();
         add(clusterInActivateMessageProcessor);
 
-        clusterTerminatingMessageProcessor = new AppStatusClusterTerminatingMessageProcessor();
+        clusterTerminatingMessageProcessor = new AppClusterTerminatingMessageProcessor();
         add(clusterTerminatingMessageProcessor);
 
-        clusterTerminatedMessageProcessor = new AppStatusClusterTerminatedMessageProcessor();
+        clusterTerminatedMessageProcessor = new AppClusterTerminatedMessageProcessor();
         add(clusterTerminatedMessageProcessor);
 
-        groupCreatedMessageProcessor = new AppStatusGroupCreatedMessageProcessor();
+        groupCreatedMessageProcessor = new GroupCreatedMessageProcessor();
         add(groupCreatedMessageProcessor);
 
-        groupActivatedMessageProcessor = new AppStatusGroupActivatedMessageProcessor();
+        groupActivatedMessageProcessor = new GroupActivatedMessageProcessor();
         add(groupActivatedMessageProcessor);
 
-        groupInActivateMessageProcessor = new AppStatusGroupInactivatedMessageProcessor();
+        groupInActivateMessageProcessor = new GroupInactivatedMessageProcessor();
         add(groupInActivateMessageProcessor);
 
-        appActivatedMessageProcessor = new AppStatusApplicationActivatedMessageProcessor();
+        appActivatedMessageProcessor = new ApplicationActivatedMessageProcessor();
         add(appActivatedMessageProcessor);
 
-        applicationStatusAppCreatedMessageProcessor = new AppStatusApplicationCreatedMessageProcessor();
+        applicationStatusAppCreatedMessageProcessor = new ApplicationCreatedMessageProcessor();
         this.add(applicationStatusAppCreatedMessageProcessor);
 
-        applicationStatusAppInActivatedMessageProcessor = new AppStatusApplicationInactivatedMessageProcessor();
+        applicationStatusAppInActivatedMessageProcessor = new ApplicationInactivatedMessageProcessor();
         this.add(applicationStatusAppInActivatedMessageProcessor);
 
-        applicationStatusAppTerminatedMessageProcessor = new AppStatusApplicationTerminatedMessageProcessor();
+        applicationStatusAppTerminatedMessageProcessor = new ApplicationTerminatedMessageProcessor();
         this.add(applicationStatusAppTerminatedMessageProcessor);
 
-        applicationStatusAppTerminatingMessageProcessor = new AppStatusApplicationTerminatingMessageProcessor();
+        applicationStatusAppTerminatingMessageProcessor = new ApplicationTerminatingMessageProcessor();
         this.add(applicationStatusAppTerminatingMessageProcessor);
 
-        groupTerminatedMessageProcessor = new AppStatusGroupTerminatedMessageProcessor();
+        groupTerminatedMessageProcessor = new GroupTerminatedMessageProcessor();
         this.add(groupTerminatedMessageProcessor);
 
-        groupTerminatingMessageProcessor = new AppStatusGroupTerminatingMessageProcessor();
+        groupTerminatingMessageProcessor = new GroupTerminatingMessageProcessor();
         this.add(groupTerminatingMessageProcessor);
 
         if (log.isDebugEnabled()) {
@@ -101,35 +101,35 @@ public class AppStatusMessageProcessorChain extends MessageProcessorChain {
     }
 
     public void addEventListener(EventListener eventListener) {
-        if(eventListener instanceof AppStatusClusterCreatedEventListener) {
+        if(eventListener instanceof AppClusterCreatedEventListener) {
             clusterCreatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusClusterActivatedEventListener) {
+        } else if (eventListener instanceof AppClusterActivatedEventListener) {
             clusterActivatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusClusterInactivateEventListener) {
+        } else if (eventListener instanceof AppClusterInactivateEventListener) {
             clusterInActivateMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusGroupCreatedEventListener) {
+        } else if(eventListener instanceof GroupCreatedEventListener) {
             groupCreatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusGroupActivatedEventListener) {
+        } else if (eventListener instanceof GroupActivatedEventListener) {
             groupActivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusClusterTerminatedEventListener){
+        } else if(eventListener instanceof AppClusterTerminatedEventListener){
             clusterTerminatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusClusterTerminatingEventListener){
+        } else if(eventListener instanceof AppClusterTerminatingEventListener){
             clusterTerminatingMessageProcessor.addEventListener(eventListener);
-        }else if (eventListener instanceof AppStatusGroupInactivateEventListener) {
+        }else if (eventListener instanceof GroupInactivateEventListener) {
             groupInActivateMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusApplicationActivatedEventListener) {
+        } else if (eventListener instanceof ApplicationActivatedEventListener) {
             appActivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusApplicationInactivatedEventListener){
+        } else if(eventListener instanceof ApplicationInactivatedEventListener){
             applicationStatusAppInActivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusApplicationCreatedEventListener){
+        } else if(eventListener instanceof ApplicationCreatedEventListener){
             applicationStatusAppCreatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusApplicationTerminatingEventListener){
+        } else if(eventListener instanceof ApplicationTerminatingEventListener){
             applicationStatusAppTerminatingMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusApplicationTerminatedEventListener){
+        } else if(eventListener instanceof ApplicationTerminatedEventListener){
             applicationStatusAppTerminatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusGroupTerminatingEventListener){
+        } else if (eventListener instanceof GroupTerminatingEventListener){
             groupTerminatingMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusGroupTerminatedEventListener){
+        } else if (eventListener instanceof GroupTerminatedEventListener){
             groupTerminatedMessageProcessor.addEventListener(eventListener);
         } else
         {

http://git-wip-us.apache.org/repos/asf/stratos/blob/ea9337d3/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 1ed5576..d8d25d9 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
@@ -22,6 +22,7 @@ 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.listener.EventListener;
+import org.apache.stratos.messaging.listener.applications.ApplicationUndeployedEventListener;
 import org.apache.stratos.messaging.listener.topology.*;
 import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
 


[09/10] removing application status and adding applications, cluster status topic

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatedEvent.java
deleted file mode 100644
index d269d38..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatedEvent.java
+++ /dev/null
@@ -1,50 +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.applications;
-
-/**
- * This event is fired by cartridge agent when it has started the server and
- * applications are ready to serve the incoming requests.
- */
-public class AppClusterTerminatedEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppClusterTerminatedEvent(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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatingEvent.java
deleted file mode 100644
index 547a681..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatingEvent.java
+++ /dev/null
@@ -1,50 +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.applications;
-
-/**
- * This event is fired by cartridge agent when it has started the server and
- * applications are ready to serve the incoming requests.
- */
-public class AppClusterTerminatingEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppClusterTerminatingEvent(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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
index 6eeb2dc..07eb674 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
@@ -19,11 +19,15 @@
 
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+
 /**
  * This event is fired by cartridge agent when it has started the server and
  * applications are ready to serve the incoming requests.
  */
-public class AppStatusGroupInactivateEvent extends StatusEvent {
+public class AppStatusGroupInactivateEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String groupId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationActivatedEvent.java
index 7e6a8b4..7825850 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationActivatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationActivatedEvent.java
@@ -18,12 +18,14 @@
  */
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
 import java.io.Serializable;
 
 /**
  * This event will be fired upon the application activated is detected.
  */
-public class ApplicationActivatedEvent extends StatusEvent implements Serializable {
+public class ApplicationActivatedEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String appId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationCreatedEvent.java
index 5d220fa..dfb90f2 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationCreatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationCreatedEvent.java
@@ -18,12 +18,14 @@
  */
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
 import java.io.Serializable;
 
 /**
  * This event will be fired upon the application created is detected.
  */
-public class ApplicationCreatedEvent extends StatusEvent implements Serializable {
+public class ApplicationCreatedEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String appId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationInactivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationInactivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationInactivatedEvent.java
index 8ff0db3..3006225 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationInactivatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationInactivatedEvent.java
@@ -18,12 +18,14 @@
  */
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
 import java.io.Serializable;
 
 /**
  * This event will be fired upon the application inactivated is detected.
  */
-public class ApplicationInactivatedEvent extends StatusEvent implements Serializable {
+public class ApplicationInactivatedEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String appId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatedEvent.java
index 024327a..eaa54e3 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatedEvent.java
@@ -19,6 +19,7 @@
 package org.apache.stratos.messaging.event.applications;
 
 import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
+import org.apache.stratos.messaging.event.Event;
 
 import java.io.Serializable;
 import java.util.Set;
@@ -26,7 +27,7 @@ import java.util.Set;
 /**
  * This event will be fired upon the application terminated is detected.
  */
-public class ApplicationTerminatedEvent extends StatusEvent implements Serializable {
+public class ApplicationTerminatedEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String appId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatingEvent.java
index e81b988..2a434a4 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatingEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatingEvent.java
@@ -18,12 +18,14 @@
  */
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
 import java.io.Serializable;
 
 /**
  * This event will be fired upon the application terminating is detected.
  */
-public class ApplicationTerminatingEvent extends StatusEvent implements Serializable {
+public class ApplicationTerminatingEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String appId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupActivatedEvent.java
index c200217..a587bef 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupActivatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupActivatedEvent.java
@@ -19,11 +19,15 @@
 
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+
 /**
  * This event is fired by cartridge agent when it has started the server and
  * applications are ready to serve the incoming requests.
  */
-public class GroupActivatedEvent extends StatusEvent {
+public class GroupActivatedEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String groupId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupCreatedEvent.java
index 8b622c5..77336d2 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupCreatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupCreatedEvent.java
@@ -19,11 +19,15 @@
 
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+
 /**
  * This event is fired by cartridge agent when it has started the server and
  * applications are ready to serve the incoming requests.
  */
-public class GroupCreatedEvent extends StatusEvent {
+public class GroupCreatedEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String groupId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupMaintenanceModeEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupMaintenanceModeEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupMaintenanceModeEvent.java
index 5723305..4c1e2f0 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupMaintenanceModeEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupMaintenanceModeEvent.java
@@ -18,10 +18,14 @@
  */
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+
 /**
  * This event will be fired upon the instability of group detection by autoscaler.
  */
-public class GroupMaintenanceModeEvent extends StatusEvent {
+public class GroupMaintenanceModeEvent extends Event implements Serializable {
     private String groupId;
     private String appId;
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupReadyToShutdownEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupReadyToShutdownEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupReadyToShutdownEvent.java
index 8099015..b2d5d57 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupReadyToShutdownEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupReadyToShutdownEvent.java
@@ -18,10 +18,14 @@
  */
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+
 /**
  * This event is fired by autoscaler before actually terminate a group.
  */
-public class GroupReadyToShutdownEvent extends StatusEvent {
+public class GroupReadyToShutdownEvent extends Event implements Serializable {
     private String groupId;
     private String appId;
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatedEvent.java
index 6cfa888..2a38caf 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatedEvent.java
@@ -19,11 +19,15 @@
 
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+
 /**
  * This event is fired by cartridge agent when it has started the server and
  * applications are ready to serve the incoming requests.
  */
-public class GroupTerminatedEvent extends StatusEvent {
+public class GroupTerminatedEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String groupId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatingEvent.java
index ba6f979..c526a35 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatingEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatingEvent.java
@@ -19,11 +19,15 @@
 
 package org.apache.stratos.messaging.event.applications;
 
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+
 /**
  * This event is fired by cartridge agent when it has started the server and
  * applications are ready to serve the incoming requests.
  */
-public class GroupTerminatingEvent extends StatusEvent {
+public class GroupTerminatingEvent extends Event implements Serializable {
     private static final long serialVersionUID = 2625412714611885089L;
 
     private String groupId;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/StatusEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/StatusEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/StatusEvent.java
deleted file mode 100644
index 91dbab3..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/StatusEvent.java
+++ /dev/null
@@ -1,31 +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.applications;
-
-import org.apache.stratos.messaging.event.Event;
-
-import java.io.Serializable;
-
-/**
- * Represents all instance status events.
- */
-public abstract class StatusEvent extends Event implements Serializable {
-    private static final long serialVersionUID = -4790128084271867615L;
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterActivatedEvent.java
new file mode 100644
index 0000000..1e00bd5
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterActivatedEvent.java
@@ -0,0 +1,52 @@
+/*
+ * 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.cluster.status;
+
+import org.apache.stratos.messaging.event.Event;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class ClusterStatusClusterActivatedEvent extends Event {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public ClusterStatusClusterActivatedEvent(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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterCreatedEvent.java
new file mode 100644
index 0000000..d28cca1
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterCreatedEvent.java
@@ -0,0 +1,52 @@
+/*
+ * 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.cluster.status;
+
+import org.apache.stratos.messaging.event.Event;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class ClusterStatusClusterCreatedEvent extends Event {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public ClusterStatusClusterCreatedEvent(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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterInactivateEvent.java
new file mode 100644
index 0000000..34fad5a
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterInactivateEvent.java
@@ -0,0 +1,52 @@
+/*
+ * 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.cluster.status;
+
+import org.apache.stratos.messaging.event.Event;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class ClusterStatusClusterInactivateEvent extends Event {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public ClusterStatusClusterInactivateEvent(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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterTerminatedEvent.java
new file mode 100644
index 0000000..48ecb68
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterTerminatedEvent.java
@@ -0,0 +1,52 @@
+/*
+ * 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.cluster.status;
+
+import org.apache.stratos.messaging.event.Event;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class ClusterStatusClusterTerminatedEvent extends Event {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public ClusterStatusClusterTerminatedEvent(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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterTerminatingEvent.java
new file mode 100644
index 0000000..df6eba9
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterTerminatingEvent.java
@@ -0,0 +1,52 @@
+/*
+ * 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.cluster.status;
+
+import org.apache.stratos.messaging.event.Event;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class ClusterStatusClusterTerminatingEvent extends Event {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public ClusterStatusClusterTerminatingEvent(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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterActivatedEventListener.java
deleted file mode 100644
index f99e15b..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterActivatedEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.applications;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppClusterActivatedEventListener extends EventListener{
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterCreatedEventListener.java
deleted file mode 100644
index d43f360..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterCreatedEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.applications;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppClusterCreatedEventListener extends EventListener{
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterInactivateEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterInactivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterInactivateEventListener.java
deleted file mode 100644
index 1adaeef..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterInactivateEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.applications;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppClusterInactivateEventListener extends EventListener{
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatedEventListener.java
deleted file mode 100644
index 89a66e9..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatedEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.applications;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppClusterTerminatedEventListener extends EventListener{
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatingEventListener.java
deleted file mode 100644
index 9cd9a5d..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatingEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.applications;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppClusterTerminatingEventListener extends EventListener{
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterActivatedEventListener.java
new file mode 100644
index 0000000..c2a1eef
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterActivatedEventListener.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.cluster.status;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class ClusterStatusClusterActivatedEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterCreatedEventListener.java
new file mode 100644
index 0000000..6ca5476
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterCreatedEventListener.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.cluster.status;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class ClusterStatusClusterCreatedEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterInactivateEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterInactivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterInactivateEventListener.java
new file mode 100644
index 0000000..3af6d9d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterInactivateEventListener.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.cluster.status;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class ClusterStatusClusterInactivateEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterTerminatedEventListener.java
new file mode 100644
index 0000000..04b54ba
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterTerminatedEventListener.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.cluster.status;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class ClusterStatusClusterTerminatedEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterTerminatingEventListener.java
new file mode 100644
index 0000000..d007d7f
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterTerminatingEventListener.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.cluster.status;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class ClusterStatusClusterTerminatingEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterActivatedMessageProcessor.java
deleted file mode 100644
index 920f94e..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterActivatedMessageProcessor.java
+++ /dev/null
@@ -1,57 +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.message.processor.applications;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.AppClusterActivatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-
-public class AppClusterActivatedMessageProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(AppClusterActivatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppClusterActivatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppClusterActivatedEvent event = (AppClusterActivatedEvent) Util.jsonToObject(message, AppClusterActivatedEvent.class);
-
-            if(log.isDebugEnabled()) {
-                log.debug("Received ClusterActivatedEvent: " + 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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterCreatedMessageProcessor.java
deleted file mode 100644
index 9caa79c..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterCreatedMessageProcessor.java
+++ /dev/null
@@ -1,57 +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.message.processor.applications;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.AppClusterCreatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-
-public class AppClusterCreatedMessageProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(AppClusterCreatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppClusterCreatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppClusterCreatedEvent event = (AppClusterCreatedEvent) Util.jsonToObject(message, AppClusterCreatedEvent.class);
-
-            if(log.isDebugEnabled()) {
-                log.debug("Received AppStatusClusterCreatedEvent: " + 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 created message using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterInactivateMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterInactivateMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterInactivateMessageProcessor.java
deleted file mode 100644
index d9fb0e9..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterInactivateMessageProcessor.java
+++ /dev/null
@@ -1,58 +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.message.processor.applications;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.AppClusterInactivateEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-
-public class AppClusterInactivateMessageProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(AppClusterInactivateMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppClusterInactivateEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppClusterInactivateEvent event = (AppClusterInactivateEvent) Util.
-                                                jsonToObject(message, AppClusterInactivateEvent.class);
-
-            if(log.isDebugEnabled()) {
-                log.debug("Received ClusterInActivateEvent: " + 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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatedMessageProcessor.java
deleted file mode 100644
index 843d355..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatedMessageProcessor.java
+++ /dev/null
@@ -1,58 +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.message.processor.applications;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.AppClusterTerminatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-
-public class AppClusterTerminatedMessageProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(AppClusterTerminatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppClusterTerminatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppClusterTerminatedEvent event = (AppClusterTerminatedEvent) Util.
-                    jsonToObject(message, AppClusterTerminatedEvent.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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatingMessageProcessor.java
deleted file mode 100644
index 9520f4e..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatingMessageProcessor.java
+++ /dev/null
@@ -1,58 +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.message.processor.applications;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.AppClusterTerminatingEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-
-public class AppClusterTerminatingMessageProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(AppClusterTerminatingMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppClusterTerminatingEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppClusterTerminatingEvent event = (AppClusterTerminatingEvent) Util.
-                                                jsonToObject(message, AppClusterTerminatingEvent.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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
deleted file mode 100644
index 3705f1e..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
+++ /dev/null
@@ -1,139 +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.message.processor.applications;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.listener.EventListener;
-import org.apache.stratos.messaging.listener.applications.*;
-import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
-
-/**
- * Application Status processor chain is to handle the list processors to parse the application
- * status.
- */
-public class AppStatusMessageProcessorChain extends MessageProcessorChain {
-    private static final Log log = LogFactory.getLog(AppStatusMessageProcessorChain.class);
-
-    private AppClusterCreatedMessageProcessor clusterCreatedMessageProcessor;
-    private AppClusterActivatedMessageProcessor clusterActivatedMessageProcessor;
-    private AppClusterInactivateMessageProcessor clusterInActivateMessageProcessor;
-    private AppClusterTerminatingMessageProcessor clusterTerminatingMessageProcessor;
-    private AppClusterTerminatedMessageProcessor clusterTerminatedMessageProcessor;
-    private GroupCreatedMessageProcessor groupCreatedMessageProcessor;
-    private GroupActivatedMessageProcessor groupActivatedMessageProcessor;
-    private GroupInactivatedMessageProcessor groupInActivateMessageProcessor;
-    private ApplicationActivatedMessageProcessor appActivatedMessageProcessor;
-    private ApplicationCreatedMessageProcessor applicationStatusAppCreatedMessageProcessor;
-    private ApplicationInactivatedMessageProcessor applicationStatusAppInActivatedMessageProcessor;
-    private ApplicationTerminatedMessageProcessor applicationStatusAppTerminatedMessageProcessor;
-    private ApplicationTerminatingMessageProcessor applicationStatusAppTerminatingMessageProcessor;
-
-    private GroupTerminatedMessageProcessor groupTerminatedMessageProcessor;
-    private GroupTerminatingMessageProcessor groupTerminatingMessageProcessor;
-
-    public void initialize() {
-        // Add instance notifier event processors
-        clusterCreatedMessageProcessor= new AppClusterCreatedMessageProcessor();
-        add(clusterCreatedMessageProcessor);
-
-        clusterActivatedMessageProcessor = new AppClusterActivatedMessageProcessor();
-        add(clusterActivatedMessageProcessor);
-
-        clusterInActivateMessageProcessor = new AppClusterInactivateMessageProcessor();
-        add(clusterInActivateMessageProcessor);
-
-        clusterTerminatingMessageProcessor = new AppClusterTerminatingMessageProcessor();
-        add(clusterTerminatingMessageProcessor);
-
-        clusterTerminatedMessageProcessor = new AppClusterTerminatedMessageProcessor();
-        add(clusterTerminatedMessageProcessor);
-
-        groupCreatedMessageProcessor = new GroupCreatedMessageProcessor();
-        add(groupCreatedMessageProcessor);
-
-        groupActivatedMessageProcessor = new GroupActivatedMessageProcessor();
-        add(groupActivatedMessageProcessor);
-
-        groupInActivateMessageProcessor = new GroupInactivatedMessageProcessor();
-        add(groupInActivateMessageProcessor);
-
-        appActivatedMessageProcessor = new ApplicationActivatedMessageProcessor();
-        add(appActivatedMessageProcessor);
-
-        applicationStatusAppCreatedMessageProcessor = new ApplicationCreatedMessageProcessor();
-        this.add(applicationStatusAppCreatedMessageProcessor);
-
-        applicationStatusAppInActivatedMessageProcessor = new ApplicationInactivatedMessageProcessor();
-        this.add(applicationStatusAppInActivatedMessageProcessor);
-
-        applicationStatusAppTerminatedMessageProcessor = new ApplicationTerminatedMessageProcessor();
-        this.add(applicationStatusAppTerminatedMessageProcessor);
-
-        applicationStatusAppTerminatingMessageProcessor = new ApplicationTerminatingMessageProcessor();
-        this.add(applicationStatusAppTerminatingMessageProcessor);
-
-        groupTerminatedMessageProcessor = new GroupTerminatedMessageProcessor();
-        this.add(groupTerminatedMessageProcessor);
-
-        groupTerminatingMessageProcessor = new GroupTerminatingMessageProcessor();
-        this.add(groupTerminatingMessageProcessor);
-
-        if (log.isDebugEnabled()) {
-            log.debug("Instance notifier message processor chain initialized");
-        }
-    }
-
-    public void addEventListener(EventListener eventListener) {
-        if(eventListener instanceof AppClusterCreatedEventListener) {
-            clusterCreatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppClusterActivatedEventListener) {
-            clusterActivatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppClusterInactivateEventListener) {
-            clusterInActivateMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof GroupCreatedEventListener) {
-            groupCreatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof GroupActivatedEventListener) {
-            groupActivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppClusterTerminatedEventListener){
-            clusterTerminatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppClusterTerminatingEventListener){
-            clusterTerminatingMessageProcessor.addEventListener(eventListener);
-        }else if (eventListener instanceof GroupInactivateEventListener) {
-            groupInActivateMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof ApplicationActivatedEventListener) {
-            appActivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof ApplicationInactivatedEventListener){
-            applicationStatusAppInActivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof ApplicationCreatedEventListener){
-            applicationStatusAppCreatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof ApplicationTerminatingEventListener){
-            applicationStatusAppTerminatingMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof ApplicationTerminatedEventListener){
-            applicationStatusAppTerminatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof GroupTerminatingEventListener){
-            groupTerminatingMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof GroupTerminatedEventListener){
-            groupTerminatedMessageProcessor.addEventListener(eventListener);
-        } else
-        {
-            throw new RuntimeException("Unknown event listener " + eventListener.toString());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
index 71bd50e..6c82925 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
@@ -20,43 +20,85 @@ package org.apache.stratos.messaging.message.processor.applications;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.ApplicationActivatedEvent;
+import org.apache.stratos.messaging.domain.applications.Application;
+import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
+import org.apache.stratos.messaging.domain.topology.Topology;
+import org.apache.stratos.messaging.event.topology.ApplicationActivatedEvent;
 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 responsible to process the application activation even and update the Topology.
+ */
 public class ApplicationActivatedMessageProcessor extends MessageProcessor {
     private static final Log log =
             LogFactory.getLog(ApplicationActivatedMessageProcessor.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 (ApplicationActivatedEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized())
+                return false;
+
             // Parse complete message and build event
-            ApplicationActivatedEvent event =
-                    (ApplicationActivatedEvent) Util.jsonToObject(message, ApplicationActivatedEvent.class);
+            ApplicationActivatedEvent event = (ApplicationActivatedEvent) Util.
+                    jsonToObject(message, ApplicationActivatedEvent.class);
+
+            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
+
+            try {
+                return doProcess(event, topology);
 
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationActivatedEvent in application status topic: " + event.toString());
+            } finally {
+                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
             }
-            // Notify event listeners
-            notifyEventListeners(event);
-            return true;
+
         } else {
             if (nextProcessor != null) {
-                return nextProcessor.process(type, message, object);
+                // 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
+                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
             }
         }
     }
+
+    private boolean doProcess(ApplicationActivatedEvent event, Topology topology) {
+
+        // Validate event against the existing topology
+        Application application = topology.getApplication(event.getAppId());
+        if (application == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Application does not exist: [service] %s",
+                        event.getAppId()));
+            }
+            return false;
+        } else {
+            // Apply changes to the topology
+            if (!application.isStateTransitionValid(ApplicationStatus.Active)) {
+                log.error("Invalid State transfer from [ " + application.getStatus() +
+                        " ] to [ " + ApplicationStatus.Active + " ]");
+            }
+            application.setStatus(ApplicationStatus.Active);
+
+        }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+
+    }
 }


[02/10] renaming application.status topic to applications

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatingMessageProcessor.java
new file mode 100644
index 0000000..9520f4e
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatingMessageProcessor.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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.AppClusterTerminatingEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class AppClusterTerminatingMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(AppClusterTerminatingMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (AppClusterTerminatingEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            AppClusterTerminatingEvent event = (AppClusterTerminatingEvent) Util.
+                                                jsonToObject(message, AppClusterTerminatingEvent.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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
new file mode 100644
index 0000000..1524b00
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppStatusMessageProcessorChain.java
@@ -0,0 +1,139 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.listener.application.status.*;
+import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
+
+/**
+ * Application Status processor chain is to handle the list processors to parse the application
+ * status.
+ */
+public class AppStatusMessageProcessorChain extends MessageProcessorChain {
+    private static final Log log = LogFactory.getLog(AppStatusMessageProcessorChain.class);
+
+    private AppStatusClusterCreatedMessageProcessor clusterCreatedMessageProcessor;
+    private AppStatusClusterActivatedMessageProcessor clusterActivatedMessageProcessor;
+    private AppStatusClusterInactivateMessageProcessor clusterInActivateMessageProcessor;
+    private AppStatusClusterTerminatingMessageProcessor clusterTerminatingMessageProcessor;
+    private AppStatusClusterTerminatedMessageProcessor clusterTerminatedMessageProcessor;
+    private AppStatusGroupCreatedMessageProcessor groupCreatedMessageProcessor;
+    private AppStatusGroupActivatedMessageProcessor groupActivatedMessageProcessor;
+    private AppStatusGroupInactivatedMessageProcessor groupInActivateMessageProcessor;
+    private AppStatusApplicationActivatedMessageProcessor appActivatedMessageProcessor;
+    private AppStatusApplicationCreatedMessageProcessor applicationStatusAppCreatedMessageProcessor;
+    private AppStatusApplicationInactivatedMessageProcessor applicationStatusAppInActivatedMessageProcessor;
+    private AppStatusApplicationTerminatedMessageProcessor applicationStatusAppTerminatedMessageProcessor;
+    private AppStatusApplicationTerminatingMessageProcessor applicationStatusAppTerminatingMessageProcessor;
+
+    private AppStatusGroupTerminatedMessageProcessor groupTerminatedMessageProcessor;
+    private AppStatusGroupTerminatingMessageProcessor groupTerminatingMessageProcessor;
+
+    public void initialize() {
+        // Add instance notifier event processors
+        clusterCreatedMessageProcessor= new AppStatusClusterCreatedMessageProcessor();
+        add(clusterCreatedMessageProcessor);
+
+        clusterActivatedMessageProcessor = new AppStatusClusterActivatedMessageProcessor();
+        add(clusterActivatedMessageProcessor);
+
+        clusterInActivateMessageProcessor = new AppStatusClusterInactivateMessageProcessor();
+        add(clusterInActivateMessageProcessor);
+
+        clusterTerminatingMessageProcessor = new AppStatusClusterTerminatingMessageProcessor();
+        add(clusterTerminatingMessageProcessor);
+
+        clusterTerminatedMessageProcessor = new AppStatusClusterTerminatedMessageProcessor();
+        add(clusterTerminatedMessageProcessor);
+
+        groupCreatedMessageProcessor = new AppStatusGroupCreatedMessageProcessor();
+        add(groupCreatedMessageProcessor);
+
+        groupActivatedMessageProcessor = new AppStatusGroupActivatedMessageProcessor();
+        add(groupActivatedMessageProcessor);
+
+        groupInActivateMessageProcessor = new AppStatusGroupInactivatedMessageProcessor();
+        add(groupInActivateMessageProcessor);
+
+        appActivatedMessageProcessor = new AppStatusApplicationActivatedMessageProcessor();
+        add(appActivatedMessageProcessor);
+
+        applicationStatusAppCreatedMessageProcessor = new AppStatusApplicationCreatedMessageProcessor();
+        this.add(applicationStatusAppCreatedMessageProcessor);
+
+        applicationStatusAppInActivatedMessageProcessor = new AppStatusApplicationInactivatedMessageProcessor();
+        this.add(applicationStatusAppInActivatedMessageProcessor);
+
+        applicationStatusAppTerminatedMessageProcessor = new AppStatusApplicationTerminatedMessageProcessor();
+        this.add(applicationStatusAppTerminatedMessageProcessor);
+
+        applicationStatusAppTerminatingMessageProcessor = new AppStatusApplicationTerminatingMessageProcessor();
+        this.add(applicationStatusAppTerminatingMessageProcessor);
+
+        groupTerminatedMessageProcessor = new AppStatusGroupTerminatedMessageProcessor();
+        this.add(groupTerminatedMessageProcessor);
+
+        groupTerminatingMessageProcessor = new AppStatusGroupTerminatingMessageProcessor();
+        this.add(groupTerminatingMessageProcessor);
+
+        if (log.isDebugEnabled()) {
+            log.debug("Instance notifier message processor chain initialized");
+        }
+    }
+
+    public void addEventListener(EventListener eventListener) {
+        if(eventListener instanceof AppStatusClusterCreatedEventListener) {
+            clusterCreatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof AppStatusClusterActivatedEventListener) {
+            clusterActivatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof AppStatusClusterInactivateEventListener) {
+            clusterInActivateMessageProcessor.addEventListener(eventListener);
+        } else if(eventListener instanceof AppStatusGroupCreatedEventListener) {
+            groupCreatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof AppStatusGroupActivatedEventListener) {
+            groupActivatedMessageProcessor.addEventListener(eventListener);
+        } else if(eventListener instanceof AppStatusClusterTerminatedEventListener){
+            clusterTerminatedMessageProcessor.addEventListener(eventListener);
+        } else if(eventListener instanceof AppStatusClusterTerminatingEventListener){
+            clusterTerminatingMessageProcessor.addEventListener(eventListener);
+        }else if (eventListener instanceof AppStatusGroupInactivateEventListener) {
+            groupInActivateMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof AppStatusApplicationActivatedEventListener) {
+            appActivatedMessageProcessor.addEventListener(eventListener);
+        } else if(eventListener instanceof AppStatusApplicationInactivatedEventListener){
+            applicationStatusAppInActivatedMessageProcessor.addEventListener(eventListener);
+        } else if(eventListener instanceof AppStatusApplicationCreatedEventListener){
+            applicationStatusAppCreatedMessageProcessor.addEventListener(eventListener);
+        } else if(eventListener instanceof AppStatusApplicationTerminatingEventListener){
+            applicationStatusAppTerminatingMessageProcessor.addEventListener(eventListener);
+        } else if(eventListener instanceof AppStatusApplicationTerminatedEventListener){
+            applicationStatusAppTerminatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof AppStatusGroupTerminatingEventListener){
+            groupTerminatingMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof AppStatusGroupTerminatedEventListener){
+            groupTerminatedMessageProcessor.addEventListener(eventListener);
+        } else
+        {
+            throw new RuntimeException("Unknown event listener " + eventListener.toString());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
new file mode 100644
index 0000000..71bd50e
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
@@ -0,0 +1,62 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.ApplicationActivatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class ApplicationActivatedMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(ApplicationActivatedMessageProcessor.class);
+
+
+    private MessageProcessor nextProcessor;
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ApplicationActivatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ApplicationActivatedEvent event =
+                    (ApplicationActivatedEvent) Util.jsonToObject(message, ApplicationActivatedEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received ApplicationActivatedEvent in application status topic: " + 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 group activated message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationCreatedMessageProcessor.java
new file mode 100644
index 0000000..db5d777
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationCreatedMessageProcessor.java
@@ -0,0 +1,63 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.ApplicationCreatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class ApplicationCreatedMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(ApplicationCreatedMessageProcessor.class);
+
+
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ApplicationCreatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ApplicationCreatedEvent event =
+                    (ApplicationCreatedEvent) Util.jsonToObject(message, ApplicationCreatedEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received ApplicationCreated Event in application status topic: " + 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 group activated message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java
new file mode 100644
index 0000000..d8f2aac
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java
@@ -0,0 +1,63 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.ApplicationInactivatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class ApplicationInactivatedMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(ApplicationInactivatedMessageProcessor.class);
+
+
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ApplicationInactivatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ApplicationInactivatedEvent event =
+                    (ApplicationInactivatedEvent) Util.jsonToObject(message, ApplicationInactivatedEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received ApplicationInActivatedEvent in application status topic: " + 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 group activated message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java
new file mode 100644
index 0000000..a121ffb
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java
@@ -0,0 +1,63 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.ApplicationTerminatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class ApplicationTerminatedMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(ApplicationTerminatedMessageProcessor.class);
+
+
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ApplicationTerminatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ApplicationTerminatedEvent event =
+                    (ApplicationTerminatedEvent) Util.jsonToObject(message, ApplicationTerminatedEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received ApplicationTerminatedEvent in application status topic: " + 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 group activated message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java
new file mode 100644
index 0000000..280de2c
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java
@@ -0,0 +1,63 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.ApplicationTerminatingEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class ApplicationTerminatingMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(ApplicationTerminatingMessageProcessor.class);
+
+
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ApplicationTerminatingEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ApplicationTerminatingEvent event =
+                    (ApplicationTerminatingEvent) Util.jsonToObject(message, ApplicationTerminatingEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received ApplicationTerminatingEvent in application status topic: " + 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 group activated message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedMessageProcessor.java
new file mode 100644
index 0000000..02ddda8
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedMessageProcessor.java
@@ -0,0 +1,61 @@
+/*
+ * 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.applications;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.GroupActivatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class GroupActivatedMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(GroupActivatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (GroupActivatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            GroupActivatedEvent event =
+                    (GroupActivatedEvent) Util.jsonToObject(message, GroupActivatedEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received GroupActivatedEvent: " + 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 group activated message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedMessageProcessor.java
new file mode 100644
index 0000000..d04d7f9
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedMessageProcessor.java
@@ -0,0 +1,61 @@
+/*
+ * 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.applications;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.GroupCreatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class GroupCreatedMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(GroupCreatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (GroupCreatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            GroupCreatedEvent event =
+                    (GroupCreatedEvent) Util.jsonToObject(message, GroupCreatedEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received AppStatusGroupCreatedEvent: " + 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 group created message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInactivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInactivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInactivatedMessageProcessor.java
new file mode 100644
index 0000000..6cf2587
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInactivatedMessageProcessor.java
@@ -0,0 +1,61 @@
+/*
+ * 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.applications;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.AppStatusGroupInactivateEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class GroupInactivatedMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(GroupInactivatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (AppStatusGroupInactivateEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            AppStatusGroupInactivateEvent event =
+                    (AppStatusGroupInactivateEvent) Util.jsonToObject(message, AppStatusGroupInactivateEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received GroupInActivateEvent: " + 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 group in activated message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedMessageProcessor.java
new file mode 100644
index 0000000..a917a14
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedMessageProcessor.java
@@ -0,0 +1,61 @@
+/*
+ * 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.applications;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.GroupTerminatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class GroupTerminatedMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(GroupTerminatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (GroupTerminatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            GroupTerminatedEvent event =
+                    (GroupTerminatedEvent) Util.jsonToObject(message, GroupTerminatedEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received GroupTerminatingEvent: " + 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 group in GroupTerminatingEvent message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingMessageProcessor.java
new file mode 100644
index 0000000..63c055d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingMessageProcessor.java
@@ -0,0 +1,61 @@
+/*
+ * 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.applications;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.GroupTerminatingEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+public class GroupTerminatingMessageProcessor extends MessageProcessor {
+    private static final Log log =
+            LogFactory.getLog(GroupTerminatingMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (GroupTerminatingEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            GroupTerminatingEvent event =
+                    (GroupTerminatingEvent) Util.jsonToObject(message, GroupTerminatingEvent.class);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Received GroupTerminatingEvent: " + 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 group in GroupTerminatingEvent message " +
+                                "using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}


[08/10] removing application status and adding applications, cluster status topic

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationCreatedMessageProcessor.java
index db5d777..92d61ba 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationCreatedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationCreatedMessageProcessor.java
@@ -16,48 +16,106 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.stratos.messaging.message.processor.applications;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.ApplicationCreatedEvent;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
+import org.apache.stratos.messaging.domain.topology.Topology;
+import org.apache.stratos.messaging.event.topology.ApplicationCreatedEvent;
 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;
 
-public class ApplicationCreatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(ApplicationCreatedMessageProcessor.class);
+import java.util.Set;
 
+public class ApplicationCreatedMessageProcessor extends MessageProcessor {
 
+    private static final Log log = LogFactory.getLog(ApplicationCreatedMessageProcessor.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 (ApplicationCreatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            ApplicationCreatedEvent event =
-                    (ApplicationCreatedEvent) Util.jsonToObject(message, ApplicationCreatedEvent.class);
+            if (!topology.isInitialized()) {
+                return false;
+            }
 
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationCreated Event in application status topic: " + event.toString());
+            ApplicationCreatedEvent event = (ApplicationCreatedEvent) Util.jsonToObject(message, ApplicationCreatedEvent.class);
+            if (event == null) {
+                log.error("Unable to convert the JSON message to ApplicationCreatedEvent");
+                return false;
             }
-            // Notify event listeners
-            notifyEventListeners(event);
-            return true;
+
+            TopologyUpdater.acquireWriteLockForApplications();
+            // since the Clusters will also get modified, acquire write locks for each Service Type
+            Set<ClusterDataHolder> clusterDataHolders = event.getApplication().getClusterDataRecursively();
+            if (clusterDataHolders != null) {
+                for (ClusterDataHolder clusterData : clusterDataHolders) {
+                    TopologyUpdater.acquireWriteLockForService(clusterData.getServiceType());
+                }
+            }
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                if (clusterDataHolders != null) {
+                    for (ClusterDataHolder clusterData : clusterDataHolders) {
+                        TopologyUpdater.releaseWriteLockForService(clusterData.getServiceType());
+                    }
+                }
+                TopologyUpdater.releaseWriteLockForApplications();
+            }
+
         } else {
             if (nextProcessor != null) {
-                return nextProcessor.process(type, message, object);
+                // 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
+                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
             }
         }
     }
+
+    private boolean doProcess (ApplicationCreatedEvent event,Topology topology) {
+
+        // check if required properties are available
+        if (event.getApplication() == null) {
+            String errorMsg = "Application object of application created event is invalid";
+            log.error(errorMsg);
+            throw new RuntimeException(errorMsg);
+        }
+
+        if (event.getApplication().getUniqueIdentifier() == null || event.getApplication().getUniqueIdentifier().isEmpty()) {
+            String errorMsg = "App id of application created event is invalid: [ " + event.getApplication().getUniqueIdentifier() + " ]";
+            log.error(errorMsg);
+            throw new RuntimeException(errorMsg);
+        }
+
+        // check if an Application with same name exists in topology
+        if (topology.applicationExists(event.getApplication().getUniqueIdentifier())) {
+            log.warn("Application with id [ " + event.getApplication().getUniqueIdentifier() + " ] already exists in Topology");
+
+        } else {
+            // add application and the clusters to Topology
+            for(Cluster cluster: event.getClusterList()) {
+                topology.getService(cluster.getServiceName()).addCluster(cluster);
+            }
+            topology.addApplication(event.getApplication());
+        }
+
+        notifyEventListeners(event);
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java
index d8f2aac..91eae8c 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java
@@ -20,10 +20,17 @@ package org.apache.stratos.messaging.message.processor.applications;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.ApplicationInactivatedEvent;
+import org.apache.stratos.messaging.domain.applications.Application;
+import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
+import org.apache.stratos.messaging.domain.topology.Topology;
+import org.apache.stratos.messaging.event.topology.ApplicationInactivatedEvent;
 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 responsible to process the application Inactivation even and update the Topology.
+ */
 public class ApplicationInactivatedMessageProcessor extends MessageProcessor {
     private static final Log log =
             LogFactory.getLog(ApplicationInactivatedMessageProcessor.class);
@@ -34,30 +41,64 @@ public class ApplicationInactivatedMessageProcessor extends MessageProcessor {
     @Override
     public void setNext(MessageProcessor nextProcessor) {
         this.nextProcessor = nextProcessor;
-
     }
 
+
     @Override
     public boolean process(String type, String message, Object object) {
+        Topology topology = (Topology) object;
+
         if (ApplicationInactivatedEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized())
+                return false;
+
             // Parse complete message and build event
-            ApplicationInactivatedEvent event =
-                    (ApplicationInactivatedEvent) Util.jsonToObject(message, ApplicationInactivatedEvent.class);
+            ApplicationInactivatedEvent event = (ApplicationInactivatedEvent) Util.
+                    jsonToObject(message, ApplicationInactivatedEvent.class);
 
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationInActivatedEvent in application status topic: " + event.toString());
+            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
             }
-            // Notify event listeners
-            notifyEventListeners(event);
-            return true;
+
         } else {
             if (nextProcessor != null) {
-                return nextProcessor.process(type, message, object);
+                // 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
+                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+
+    private boolean doProcess (ApplicationInactivatedEvent event, Topology topology) {
+
+        // Validate event against the existing topology
+        Application application = topology.getApplication(event.getAppId());
+        if (application == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Application does not exist: [service] %s",
+                        event.getAppId()));
             }
+            return false;
+        } else {
+            // Apply changes to the topology
+            if (!application.isStateTransitionValid(ApplicationStatus.Inactive)) {
+                log.error("Invalid State transfer from [ " + application.getStatus() +
+                        " ] to [ " + ApplicationStatus.Inactive + " ]");
+            }
+            application.setStatus(ApplicationStatus.Inactive);
+
         }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java
index a121ffb..8cd2182 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java
@@ -20,10 +20,18 @@ package org.apache.stratos.messaging.message.processor.applications;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.ApplicationTerminatedEvent;
+import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
+import org.apache.stratos.messaging.domain.topology.*;
+import org.apache.stratos.messaging.event.topology.ApplicationTerminatedEvent;
 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;
 
+import java.util.Set;
+
+/**
+ * This processor responsible to process the application Inactivation even and update the Topology.
+ */
 public class ApplicationTerminatedMessageProcessor extends MessageProcessor {
     private static final Log log =
             LogFactory.getLog(ApplicationTerminatedMessageProcessor.class);
@@ -34,30 +42,95 @@ public class ApplicationTerminatedMessageProcessor extends MessageProcessor {
     @Override
     public void setNext(MessageProcessor nextProcessor) {
         this.nextProcessor = nextProcessor;
-
     }
 
+
     @Override
     public boolean process(String type, String message, Object object) {
+        Topology topology = (Topology) object;
+
         if (ApplicationTerminatedEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized())
+                return false;
+
             // Parse complete message and build event
-            ApplicationTerminatedEvent event =
-                    (ApplicationTerminatedEvent) Util.jsonToObject(message, ApplicationTerminatedEvent.class);
+            ApplicationTerminatedEvent event = (ApplicationTerminatedEvent) Util.
+                    jsonToObject(message, ApplicationTerminatedEvent.class);
 
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationTerminatedEvent in application status topic: " + event.toString());
+            TopologyUpdater.acquireWriteLockForApplications();
+                        Set<ClusterDataHolder> clusterDataHolders = event.getClusterData();
+            if (clusterDataHolders != null) {
+                for (ClusterDataHolder clusterData : clusterDataHolders) {
+                    TopologyUpdater.acquireWriteLockForService(clusterData.getServiceType());
+                }
             }
-            // Notify event listeners
-            notifyEventListeners(event);
-            return true;
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForApplications();
+                if (clusterDataHolders != null) {
+                    for (ClusterDataHolder clusterData : clusterDataHolders) {
+                        TopologyUpdater.releaseWriteLockForService(clusterData.getServiceType());
+                    }
+                }
+            }
+
         } else {
             if (nextProcessor != null) {
-                return nextProcessor.process(type, message, object);
+                // 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
+                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
             }
         }
     }
+
+    private boolean doProcess (ApplicationTerminatedEvent event, Topology topology) {
+
+        // check if required properties are available
+        if (event.getAppId() == null) {
+            String errorMsg = "Application Id of application removed event is invalid";
+            log.error(errorMsg);
+            throw new RuntimeException(errorMsg);
+        }
+
+        if (event.getTenantDomain()== null) {
+            String errorMsg = "Application tenant domain of application removed event is invalid";
+            log.error(errorMsg);
+            throw new RuntimeException(errorMsg);
+        }
+
+        // check if an Application with same name exists in topology
+        String appId = event.getAppId();
+        if (topology.applicationExists(appId)) {
+            log.warn("Application with id [ " + appId + " ] still exists in Topology, removing it");
+            topology.removeApplication(appId);
+        }
+
+        if (event.getClusterData() != null) {
+            // remove the Clusters from the Topology
+            for (ClusterDataHolder clusterData : event.getClusterData()) {
+                Service service = topology.getService(clusterData.getServiceType());
+                if (service != null) {
+                    service.removeCluster(clusterData.getClusterId());
+                    if (log.isDebugEnabled()) {
+                        log.debug("Removed the Cluster " + clusterData.getClusterId() + " from Topology");
+                    }
+                }  else {
+                    log.warn("Service " + clusterData.getServiceType() + " not found in Topology!");
+                }
+            }
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("ApplicationRemovedMessageProcessor notifying listener ");
+        }
+
+        notifyEventListeners(event);
+        return true;
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java
index 280de2c..057d013 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java
@@ -20,10 +20,17 @@ package org.apache.stratos.messaging.message.processor.applications;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.ApplicationTerminatingEvent;
+import org.apache.stratos.messaging.domain.applications.Application;
+import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
+import org.apache.stratos.messaging.domain.topology.Topology;
+import org.apache.stratos.messaging.event.topology.ApplicationTerminatingEvent;
 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 responsible to process the application Inactivation even and update the Topology.
+ */
 public class ApplicationTerminatingMessageProcessor extends MessageProcessor {
     private static final Log log =
             LogFactory.getLog(ApplicationTerminatingMessageProcessor.class);
@@ -34,30 +41,64 @@ public class ApplicationTerminatingMessageProcessor extends MessageProcessor {
     @Override
     public void setNext(MessageProcessor nextProcessor) {
         this.nextProcessor = nextProcessor;
-
     }
 
+
     @Override
     public boolean process(String type, String message, Object object) {
+        Topology topology = (Topology) object;
+
         if (ApplicationTerminatingEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized())
+                return false;
+
             // Parse complete message and build event
-            ApplicationTerminatingEvent event =
-                    (ApplicationTerminatingEvent) Util.jsonToObject(message, ApplicationTerminatingEvent.class);
+            ApplicationTerminatingEvent event = (ApplicationTerminatingEvent) Util.
+                    jsonToObject(message, ApplicationTerminatingEvent.class);
 
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationTerminatingEvent in application status topic: " + event.toString());
+            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
             }
-            // Notify event listeners
-            notifyEventListeners(event);
-            return true;
+
         } else {
             if (nextProcessor != null) {
-                return nextProcessor.process(type, message, object);
+                // 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
+                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+
+    private boolean doProcess (ApplicationTerminatingEvent event, Topology topology) {
+
+        // Validate event against the existing topology
+        Application application = topology.getApplication(event.getAppId());
+        if (application == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Application does not exist: [service] %s",
+                        event.getAppId()));
             }
+            return false;
+        } else {
+            // Apply changes to the topology
+            if (!application.isStateTransitionValid(ApplicationStatus.Terminating)) {
+                log.error("Invalid State transfer from [ " + application.getStatus() +
+                        " ] to [ " + ApplicationStatus.Terminating + " ]");
+            }
+            application.setStatus(ApplicationStatus.Terminating);
+
         }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationUndeployedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationUndeployedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationUndeployedMessageProcessor.java
new file mode 100644
index 0000000..7e91ab8
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationUndeployedMessageProcessor.java
@@ -0,0 +1,139 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.applications.Application;
+import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
+import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
+import org.apache.stratos.messaging.domain.topology.*;
+import org.apache.stratos.messaging.event.topology.ApplicationUndeployedEvent;
+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;
+
+import java.util.Set;
+
+public class ApplicationUndeployedMessageProcessor extends MessageProcessor {
+
+    private static final Log log = LogFactory.getLog(ApplicationUndeployedMessageProcessor.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 (ApplicationUndeployedEvent.class.getName().equals(type)) {
+            if (!topology.isInitialized()) {
+                return false;
+            }
+
+            ApplicationUndeployedEvent event = (ApplicationUndeployedEvent)
+                    Util.jsonToObject(message, ApplicationUndeployedEvent.class);
+            if (event == null) {
+                log.error("Unable to convert the JSON message to ApplicationUndeployedEvent");
+                return false;
+            }
+
+            // get write lock for the application and relevant Clusters
+            TopologyUpdater.acquireWriteLockForApplication(event.getApplicationId());
+            Set<ClusterDataHolder> clusterDataHolders = event.getClusterData();
+            if (clusterDataHolders != null) {
+                for (ClusterDataHolder clusterData : clusterDataHolders) {
+                    TopologyUpdater.acquireWriteLockForCluster(clusterData.getServiceType(),
+                            clusterData.getClusterId());
+                }
+            }
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                // remove locks
+                if (clusterDataHolders != null) {
+                    for (ClusterDataHolder clusterData : clusterDataHolders) {
+                        TopologyUpdater.releaseWriteLockForCluster(clusterData.getServiceType(),
+                                clusterData.getClusterId());
+                    }
+                }
+                TopologyUpdater.releaseWriteLockForApplication(event.getApplicationId());
+            }
+
+        } 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 (ApplicationUndeployedEvent event, Topology topology) {
+
+        // update the application status to Terminating
+        Application application = topology.getApplication(event.getApplicationId());
+        // check and update application status to 'Terminating'
+        if (!application.isStateTransitionValid(ApplicationStatus.Terminating)) {
+            log.error("Invalid state transfer from " + application.getStatus() + " to " + ApplicationStatus.Terminating);
+        }
+        // for now anyway update the status forcefully
+        application.setStatus(ApplicationStatus.Terminating);
+
+        // update all the Clusters' statuses to 'Terminating'
+        Set<ClusterDataHolder> clusterData = application.getClusterDataRecursively();
+        // update the Cluster statuses to Terminating
+        for (ClusterDataHolder clusterDataHolder : clusterData) {
+            Service service = topology.getService(clusterDataHolder.getServiceType());
+            if (service != null) {
+                Cluster aCluster = service.getCluster(clusterDataHolder.getClusterId());
+                if (aCluster != null) {
+                    // validate state transition
+                    if (!aCluster.isStateTransitionValid(ClusterStatus.Terminating)) {
+                        log.error("Invalid state transfer from " + aCluster.getStatus() + " to "
+                                + ClusterStatus.Terminating);
+                    }
+                    // for now anyway update the status forcefully
+                    aCluster.setStatus(ClusterStatus.Terminating);
+
+                } else {
+                    log.warn("Unable to find Cluster with cluster id " + clusterDataHolder.getClusterId() +
+                            " in Topology");
+                }
+
+            } else {
+                log.warn("Unable to remove cluster with cluster id: " + clusterDataHolder.getClusterId() + " from Topology, " +
+                        " associated Service [ " + clusterDataHolder.getServiceType() + " ] npt found");
+            }
+        }
+
+        notifyEventListeners(event);
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationsMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationsMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationsMessageProcessorChain.java
new file mode 100644
index 0000000..e75b604
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationsMessageProcessorChain.java
@@ -0,0 +1,115 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.listener.applications.*;
+import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
+
+/**
+ * Application Status processor chain is to handle the list processors to parse the application
+ * status.
+ */
+public class ApplicationsMessageProcessorChain extends MessageProcessorChain {
+    private static final Log log = LogFactory.getLog(ApplicationsMessageProcessorChain.class);
+
+    private GroupCreatedProcessor groupCreatedMessageProcessor;
+    private GroupActivatedProcessor groupActivatedMessageProcessor;
+    private GroupInActivateProcessor groupInActivateMessageProcessor;
+    private GroupTerminatedProcessor groupTerminatedProcessor;
+    private GroupTerminatingProcessor groupTerminatingProcessor;
+    private ApplicationActivatedMessageProcessor applicationActivatedMessageProcessor;
+    private ApplicationCreatedMessageProcessor applicationCreatedMessageProcessor;
+    private ApplicationInactivatedMessageProcessor applicationInactivatedMessageProcessor;
+    private ApplicationTerminatedMessageProcessor applicationTerminatedMessageProcessor;
+    private ApplicationTerminatingMessageProcessor applicationTerminatingMessageProcessor;
+    private ApplicationUndeployedMessageProcessor applicationUndeployedMessageProcessor;
+
+    public void initialize() {
+        // Add instance notifier event processors
+
+        groupCreatedMessageProcessor = new GroupCreatedProcessor();
+        add(groupCreatedMessageProcessor);
+
+        groupActivatedMessageProcessor = new GroupActivatedProcessor();
+        add(groupActivatedMessageProcessor);
+
+        groupInActivateMessageProcessor = new GroupInActivateProcessor();
+        add(groupInActivateMessageProcessor);
+
+        groupTerminatedProcessor = new GroupTerminatedProcessor();
+        add(groupTerminatedProcessor);
+
+        groupTerminatingProcessor = new GroupTerminatingProcessor();
+        add(groupTerminatingProcessor);
+
+        applicationActivatedMessageProcessor = new ApplicationActivatedMessageProcessor();
+        add(applicationActivatedMessageProcessor);
+
+        applicationCreatedMessageProcessor = new ApplicationCreatedMessageProcessor();
+        add(applicationCreatedMessageProcessor);
+
+        applicationInactivatedMessageProcessor = new ApplicationInactivatedMessageProcessor();
+        add(applicationInactivatedMessageProcessor);
+
+        applicationTerminatingMessageProcessor = new ApplicationTerminatingMessageProcessor();
+        add(applicationTerminatingMessageProcessor);
+
+        applicationTerminatedMessageProcessor = new ApplicationTerminatedMessageProcessor();
+        add(applicationTerminatedMessageProcessor);
+
+        applicationUndeployedMessageProcessor = new ApplicationUndeployedMessageProcessor();
+        add(applicationUndeployedMessageProcessor);
+
+        if (log.isDebugEnabled()) {
+            log.debug("Instance notifier message processor chain initialized");
+        }
+    }
+
+    public void addEventListener(EventListener eventListener) {
+
+        if(eventListener instanceof GroupCreatedEventListener) {
+            groupCreatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof GroupInactivateEventListener) {
+            groupInActivateMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof GroupActivatedEventListener) {
+            groupActivatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof GroupTerminatingEventListener) {
+            groupTerminatingProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof GroupTerminatedEventListener) {
+            groupTerminatedProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ApplicationCreatedEventListener) {
+            applicationCreatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ApplicationActivatedEventListener) {
+            applicationActivatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ApplicationInactivatedEventListener) {
+            applicationInactivatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ApplicationTerminatingEventListener) {
+            applicationTerminatingMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ApplicationTerminatedEventListener) {
+            applicationTerminatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ApplicationUndeployedEventListener) {
+            applicationUndeployedMessageProcessor.addEventListener(eventListener);
+        } else {
+            throw new RuntimeException("Unknown event listener " + eventListener.toString());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedMessageProcessor.java
deleted file mode 100644
index 02ddda8..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedMessageProcessor.java
+++ /dev/null
@@ -1,61 +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.message.processor.applications;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.GroupActivatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class GroupActivatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(GroupActivatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (GroupActivatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            GroupActivatedEvent event =
-                    (GroupActivatedEvent) Util.jsonToObject(message, GroupActivatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received GroupActivatedEvent: " + 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedProcessor.java
new file mode 100644
index 0000000..845e933
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedProcessor.java
@@ -0,0 +1,107 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.applications.Application;
+import org.apache.stratos.messaging.domain.applications.Group;
+import org.apache.stratos.messaging.domain.applications.GroupStatus;
+import org.apache.stratos.messaging.domain.topology.*;
+import org.apache.stratos.messaging.event.topology.GroupActivatedEvent;
+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 Group activation events
+ */
+public class GroupActivatedProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(GroupActivatedProcessor.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 (GroupActivatedEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized())
+                return false;
+
+            // Parse complete message and build event
+            GroupActivatedEvent event = (GroupActivatedEvent) Util.
+                    jsonToObject(message, GroupActivatedEvent.class);
+
+            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
+            }
+
+        } 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 (GroupActivatedEvent event,Topology topology) {
+
+        // Validate event against the existing topology
+        Application application = topology.getApplication(event.getAppId());
+        if (application == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Application does not exist: [service] %s",
+                        event.getAppId()));
+            }
+            return false;
+        }
+        Group group = application.getGroupRecursively(event.getGroupId());
+
+        if (group == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
+                        event.getGroupId()));
+            }
+        } else {
+            // Apply changes to the topology
+            if (!group.isStateTransitionValid(GroupStatus.Active)) {
+                log.error("Invalid State Transition from " + group.getStatus() + " to " + GroupStatus.Active);
+            }
+            group.setStatus(GroupStatus.Active);
+
+        }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedMessageProcessor.java
deleted file mode 100644
index d04d7f9..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedMessageProcessor.java
+++ /dev/null
@@ -1,61 +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.message.processor.applications;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.GroupCreatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class GroupCreatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(GroupCreatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (GroupCreatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            GroupCreatedEvent event =
-                    (GroupCreatedEvent) Util.jsonToObject(message, GroupCreatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received AppStatusGroupCreatedEvent: " + 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 group created message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedProcessor.java
new file mode 100644
index 0000000..47d4457
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupCreatedProcessor.java
@@ -0,0 +1,108 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.applications.Application;
+import org.apache.stratos.messaging.domain.applications.Group;
+import org.apache.stratos.messaging.domain.applications.GroupStatus;
+import org.apache.stratos.messaging.domain.topology.Topology;
+import org.apache.stratos.messaging.event.topology.GroupCreatedEvent;
+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 Group activation events
+ */
+public class GroupCreatedProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(GroupCreatedProcessor.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 (GroupCreatedEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized())
+                return false;
+
+            // Parse complete message and build event
+            GroupCreatedEvent event = (GroupCreatedEvent) Util.
+                    jsonToObject(message, GroupCreatedEvent.class);
+
+            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
+            }
+
+        } 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 (GroupCreatedEvent event,Topology topology) {
+
+        // Validate event against the existing topology
+        Application application = topology.getApplication(event.getAppId());
+        if (application == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Application does not exist: [service] %s",
+                        event.getAppId()));
+            }
+            return false;
+        }
+        Group group = application.getGroupRecursively(event.getGroupId());
+
+        if (group == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
+                        event.getGroupId()));
+            }
+        } else {
+            // Apply changes to the topology
+            if (!group.isStateTransitionValid(GroupStatus.Created)) {
+                log.error("Invalid State Transition from " + group.getStatus() + " to " + GroupStatus.Created  + " " +
+                        "for Group " + group.getAlias());
+            }
+            group.setStatus(GroupStatus.Created);
+
+        }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInActivateProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInActivateProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInActivateProcessor.java
new file mode 100644
index 0000000..063a3de
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInActivateProcessor.java
@@ -0,0 +1,106 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.applications.Application;
+import org.apache.stratos.messaging.domain.applications.Group;
+import org.apache.stratos.messaging.domain.applications.GroupStatus;
+import org.apache.stratos.messaging.domain.topology.Topology;
+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;
+
+/**
+ * This processor will act upon the Group activation events
+ */
+public class GroupInActivateProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(GroupInActivateProcessor.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 (GroupInactivateEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized())
+                return false;
+
+            // Parse complete message and build event
+            GroupInactivateEvent event = (GroupInactivateEvent) Util.
+                    jsonToObject(message, GroupInactivateEvent.class);
+
+            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
+            }
+
+        } 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(GroupInactivateEvent event, Topology topology) {
+
+        // Validate event against the existing topology
+        Application application = topology.getApplication(event.getAppId());
+        if (application == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Application does not exist: [service] %s",
+                        event.getAppId()));
+            }
+            return false;
+        }
+        Group group = application.getGroupRecursively(event.getGroupId());
+
+        if (group == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
+                        event.getGroupId()));
+            }
+        } else {
+            group.setStatus(GroupStatus.Inactive);
+            if (log.isInfoEnabled()) {
+                log.info(String.format("Group updated as in-activated : %s",
+                        group.getUniqueIdentifier()));
+            }
+        }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInactivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInactivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInactivatedMessageProcessor.java
deleted file mode 100644
index 6cf2587..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInactivatedMessageProcessor.java
+++ /dev/null
@@ -1,61 +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.message.processor.applications;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.AppStatusGroupInactivateEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class GroupInactivatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(GroupInactivatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusGroupInactivateEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusGroupInactivateEvent event =
-                    (AppStatusGroupInactivateEvent) Util.jsonToObject(message, AppStatusGroupInactivateEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received GroupInActivateEvent: " + 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 group in activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedMessageProcessor.java
deleted file mode 100644
index a917a14..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedMessageProcessor.java
+++ /dev/null
@@ -1,61 +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.message.processor.applications;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.GroupTerminatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class GroupTerminatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(GroupTerminatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (GroupTerminatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            GroupTerminatedEvent event =
-                    (GroupTerminatedEvent) Util.jsonToObject(message, GroupTerminatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received GroupTerminatingEvent: " + 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 group in GroupTerminatingEvent message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedProcessor.java
new file mode 100644
index 0000000..3de0914
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedProcessor.java
@@ -0,0 +1,107 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.applications.Application;
+import org.apache.stratos.messaging.domain.applications.Group;
+import org.apache.stratos.messaging.domain.applications.GroupStatus;
+import org.apache.stratos.messaging.domain.topology.Topology;
+import org.apache.stratos.messaging.event.topology.GroupTerminatedEvent;
+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 Group activation events
+ */
+public class GroupTerminatedProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(GroupTerminatedProcessor.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 (GroupTerminatedEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized())
+                return false;
+
+            // Parse complete message and build event
+            GroupTerminatedEvent event = (GroupTerminatedEvent) Util.
+                    jsonToObject(message, GroupTerminatedEvent.class);
+
+            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
+            }
+
+        } 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 (GroupTerminatedEvent event,Topology topology) {
+
+        // Validate event against the existing topology
+        Application application = topology.getApplication(event.getAppId());
+        if (application == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Application does not exist: [service] %s",
+                        event.getAppId()));
+            }
+            return false;
+        }
+        Group group = application.getGroupRecursively(event.getGroupId());
+
+        if (group == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
+                        event.getGroupId()));
+            }
+        } else {
+            // Apply changes to the topology
+            if (!group.isStateTransitionValid(GroupStatus.Terminated)) {
+                log.error("Invalid State Transition from " + group.getStatus() + " to " + GroupStatus.Terminated);
+            }
+            group.setStatus(GroupStatus.Terminated);
+
+        }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingMessageProcessor.java
deleted file mode 100644
index 63c055d..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingMessageProcessor.java
+++ /dev/null
@@ -1,61 +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.message.processor.applications;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.applications.GroupTerminatingEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class GroupTerminatingMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(GroupTerminatingMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (GroupTerminatingEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            GroupTerminatingEvent event =
-                    (GroupTerminatingEvent) Util.jsonToObject(message, GroupTerminatingEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received GroupTerminatingEvent: " + 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 group in GroupTerminatingEvent message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingProcessor.java
new file mode 100644
index 0000000..e124b7b
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingProcessor.java
@@ -0,0 +1,107 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.applications.Application;
+import org.apache.stratos.messaging.domain.applications.Group;
+import org.apache.stratos.messaging.domain.applications.GroupStatus;
+import org.apache.stratos.messaging.domain.topology.Topology;
+import org.apache.stratos.messaging.event.topology.GroupTerminatingEvent;
+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 Group activation events
+ */
+public class GroupTerminatingProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(GroupTerminatingProcessor.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 (GroupTerminatingEvent.class.getName().equals(type)) {
+            // Return if topology has not been initialized
+            if (!topology.isInitialized())
+                return false;
+
+            // Parse complete message and build event
+            GroupTerminatingEvent event = (GroupTerminatingEvent) Util.
+                    jsonToObject(message, GroupTerminatingEvent.class);
+
+            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
+
+            try {
+                return doProcess(event, topology);
+
+            } finally {
+                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
+            }
+
+        } 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 (GroupTerminatingEvent event,Topology topology) {
+
+        // Validate event against the existing topology
+        Application application = topology.getApplication(event.getAppId());
+        if (application == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Application does not exist: [service] %s",
+                        event.getAppId()));
+            }
+            return false;
+        }
+        Group group = application.getGroupRecursively(event.getGroupId());
+
+        if (group == null) {
+            if (log.isWarnEnabled()) {
+                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
+                        event.getGroupId()));
+            }
+        } else {
+            // Apply changes to the topology
+            if (!group.isStateTransitionValid(GroupStatus.Terminating)) {
+                log.error("Invalid State Transition from " + group.getStatus() + " to " + GroupStatus.Active);
+            }
+            group.setStatus(GroupStatus.Terminating);
+
+        }
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterActivatedMessageProcessor.java
new file mode 100644
index 0000000..694c3f3
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterActivatedMessageProcessor.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.cluster.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.cluster.status.ClusterStatusClusterActivatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class ClusterStatusClusterActivatedMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(ClusterStatusClusterActivatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ClusterStatusClusterActivatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ClusterStatusClusterActivatedEvent event = (ClusterStatusClusterActivatedEvent) Util.
+                    jsonToObject(message, ClusterStatusClusterActivatedEvent.class);
+
+            if(log.isDebugEnabled()) {
+                log.debug("Received ClusterActivatedEvent: " + 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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterCreatedMessageProcessor.java
new file mode 100644
index 0000000..9b4780b
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterCreatedMessageProcessor.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.cluster.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.cluster.status.ClusterStatusClusterCreatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class ClusterStatusClusterCreatedMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(ClusterStatusClusterCreatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ClusterStatusClusterCreatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ClusterStatusClusterCreatedEvent event = (ClusterStatusClusterCreatedEvent) Util.
+                    jsonToObject(message, ClusterStatusClusterCreatedEvent.class);
+
+            if(log.isDebugEnabled()) {
+                log.debug("Received AppStatusClusterCreatedEvent: " + 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 created message using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}


[03/10] renaming application.status topic to applications

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationTerminatingEventListener.java
deleted file mode 100644
index cc26454..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationTerminatingEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This listener will be triggered upon the application activated event received.
- */
-public abstract class ApplicationTerminatingEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationUndeployedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationUndeployedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationUndeployedEventListener.java
deleted file mode 100644
index b28a40d..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationUndeployedEventListener.java
+++ /dev/null
@@ -1,26 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class ApplicationUndeployedEventListener extends EventListener {
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupActivatedEventListener.java
deleted file mode 100644
index d19d013..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupActivatedEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This will get triggered by the groups activation processor after processing the event
- */
-public abstract class GroupActivatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupCreatedEventListener.java
deleted file mode 100644
index 3fb2d11..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupCreatedEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This will get triggered by the groups activation processor after processing the event
- */
-public abstract class GroupCreatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupInActivateEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupInActivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupInActivateEventListener.java
deleted file mode 100644
index 93a5a60..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupInActivateEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This will get triggered by the groups activation processor after processing the event
- */
-public abstract class GroupInActivateEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupTerminatedEventListener.java
deleted file mode 100644
index af409e7..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupTerminatedEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This will get triggered by the groups activation processor after processing the event
- */
-public abstract class GroupTerminatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupTerminatingEventListener.java
deleted file mode 100644
index ab4042f..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupTerminatingEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This will get triggered by the groups activation processor after processing the event
- */
-public abstract class GroupTerminatingEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationActivatedMessageProcessor.java
deleted file mode 100644
index 8b88724..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationActivatedMessageProcessor.java
+++ /dev/null
@@ -1,62 +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.message.processor.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusApplicationActivatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusApplicationActivatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusApplicationActivatedMessageProcessor.class);
-
-
-    private MessageProcessor nextProcessor;
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusApplicationActivatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusApplicationActivatedEvent event =
-                    (AppStatusApplicationActivatedEvent) Util.jsonToObject(message, AppStatusApplicationActivatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationActivatedEvent in application status topic: " + 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationCreatedMessageProcessor.java
deleted file mode 100644
index 29fce0a..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationCreatedMessageProcessor.java
+++ /dev/null
@@ -1,63 +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.message.processor.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusApplicationCreatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusApplicationCreatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusApplicationCreatedMessageProcessor.class);
-
-
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusApplicationCreatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusApplicationCreatedEvent event =
-                    (AppStatusApplicationCreatedEvent) Util.jsonToObject(message, AppStatusApplicationCreatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationCreated Event in application status topic: " + 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationInactivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationInactivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationInactivatedMessageProcessor.java
deleted file mode 100644
index 972fca3..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationInactivatedMessageProcessor.java
+++ /dev/null
@@ -1,63 +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.message.processor.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusApplicationInactivatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusApplicationInactivatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusApplicationInactivatedMessageProcessor.class);
-
-
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusApplicationInactivatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusApplicationInactivatedEvent event =
-                    (AppStatusApplicationInactivatedEvent) Util.jsonToObject(message, AppStatusApplicationInactivatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationInActivatedEvent in application status topic: " + 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationTerminatedMessageProcessor.java
deleted file mode 100644
index b639ac0..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationTerminatedMessageProcessor.java
+++ /dev/null
@@ -1,63 +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.message.processor.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusApplicationTerminatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusApplicationTerminatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusApplicationTerminatedMessageProcessor.class);
-
-
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusApplicationTerminatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusApplicationTerminatedEvent event =
-                    (AppStatusApplicationTerminatedEvent) Util.jsonToObject(message, AppStatusApplicationTerminatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationTerminatedEvent in application status topic: " + 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationTerminatingMessageProcessor.java
deleted file mode 100644
index 143565a..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusApplicationTerminatingMessageProcessor.java
+++ /dev/null
@@ -1,63 +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.message.processor.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusApplicationTerminatingEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusApplicationTerminatingMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusApplicationTerminatingMessageProcessor.class);
-
-
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusApplicationTerminatingEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusApplicationTerminatingEvent event =
-                    (AppStatusApplicationTerminatingEvent) Util.jsonToObject(message, AppStatusApplicationTerminatingEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received ApplicationTerminatingEvent in application status topic: " + 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterActivatedMessageProcessor.java
deleted file mode 100644
index 3f3c6eb..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterActivatedMessageProcessor.java
+++ /dev/null
@@ -1,57 +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.message.processor.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusClusterActivatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-
-public class AppStatusClusterActivatedMessageProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(AppStatusClusterActivatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusClusterActivatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusClusterActivatedEvent event = (AppStatusClusterActivatedEvent) Util.jsonToObject(message, AppStatusClusterActivatedEvent.class);
-
-            if(log.isDebugEnabled()) {
-                log.debug("Received ClusterActivatedEvent: " + 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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterCreatedMessageProcessor.java
deleted file mode 100644
index a743c43..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterCreatedMessageProcessor.java
+++ /dev/null
@@ -1,58 +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.message.processor.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusClusterActivatedEvent;
-import org.apache.stratos.messaging.event.application.status.AppStatusClusterCreatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-
-public class AppStatusClusterCreatedMessageProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(AppStatusClusterCreatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusClusterCreatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusClusterCreatedEvent event = (AppStatusClusterCreatedEvent) Util.jsonToObject(message, AppStatusClusterCreatedEvent.class);
-
-            if(log.isDebugEnabled()) {
-                log.debug("Received AppStatusClusterCreatedEvent: " + 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 created message using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterInactivateMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterInactivateMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterInactivateMessageProcessor.java
deleted file mode 100644
index 6e28972..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterInactivateMessageProcessor.java
+++ /dev/null
@@ -1,58 +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.message.processor.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusClusterInactivateEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-
-public class AppStatusClusterInactivateMessageProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(AppStatusClusterInactivateMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusClusterInactivateEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusClusterInactivateEvent event = (AppStatusClusterInactivateEvent) Util.
-                                                jsonToObject(message, AppStatusClusterInactivateEvent.class);
-
-            if(log.isDebugEnabled()) {
-                log.debug("Received ClusterInActivateEvent: " + 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/f0ba4beb/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
deleted file mode 100644
index 55cec80..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatedMessageProcessor.java
+++ /dev/null
@@ -1,58 +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.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.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
-            AppStatusClusterTerminatedEvent event = (AppStatusClusterTerminatedEvent) 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/f0ba4beb/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
deleted file mode 100644
index e387a15..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusClusterTerminatingMessageProcessor.java
+++ /dev/null
@@ -1,58 +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.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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupActivatedMessageProcessor.java
deleted file mode 100644
index 473726c..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupActivatedMessageProcessor.java
+++ /dev/null
@@ -1,61 +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.message.processor.application.status;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusGroupActivatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusGroupActivatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusGroupActivatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusGroupActivatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusGroupActivatedEvent event =
-                    (AppStatusGroupActivatedEvent) Util.jsonToObject(message, AppStatusGroupActivatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received GroupActivatedEvent: " + 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 group activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupCreatedMessageProcessor.java
deleted file mode 100644
index b9a1c6d..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupCreatedMessageProcessor.java
+++ /dev/null
@@ -1,62 +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.message.processor.application.status;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusGroupActivatedEvent;
-import org.apache.stratos.messaging.event.application.status.AppStatusGroupCreatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusGroupCreatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusGroupCreatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusGroupCreatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusGroupCreatedEvent event =
-                    (AppStatusGroupCreatedEvent) Util.jsonToObject(message, AppStatusGroupCreatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received AppStatusGroupCreatedEvent: " + 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 group created message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupInactivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupInactivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupInactivatedMessageProcessor.java
deleted file mode 100644
index 714ee88..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupInactivatedMessageProcessor.java
+++ /dev/null
@@ -1,61 +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.message.processor.application.status;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusGroupInactivateEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusGroupInactivatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusGroupInactivatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusGroupInactivateEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusGroupInactivateEvent event =
-                    (AppStatusGroupInactivateEvent) Util.jsonToObject(message, AppStatusGroupInactivateEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received GroupInActivateEvent: " + 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 group in activated message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupTerminatedMessageProcessor.java
deleted file mode 100644
index daa7206..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupTerminatedMessageProcessor.java
+++ /dev/null
@@ -1,61 +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.message.processor.application.status;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusGroupTerminatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusGroupTerminatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusGroupTerminatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusGroupTerminatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusGroupTerminatedEvent event =
-                    (AppStatusGroupTerminatedEvent) Util.jsonToObject(message, AppStatusGroupTerminatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received GroupTerminatingEvent: " + 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 group in GroupTerminatingEvent message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupTerminatingMessageProcessor.java
deleted file mode 100644
index 75012e0..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusGroupTerminatingMessageProcessor.java
+++ /dev/null
@@ -1,61 +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.message.processor.application.status;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.application.status.AppStatusGroupTerminatingEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.Util;
-
-public class AppStatusGroupTerminatingMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(AppStatusGroupTerminatingMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (AppStatusGroupTerminatingEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            AppStatusGroupTerminatingEvent event =
-                    (AppStatusGroupTerminatingEvent) Util.jsonToObject(message, AppStatusGroupTerminatingEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received GroupTerminatingEvent: " + 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 group in GroupTerminatingEvent message " +
-                                "using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusMessageProcessorChain.java
deleted file mode 100644
index 34cd02b..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/AppStatusMessageProcessorChain.java
+++ /dev/null
@@ -1,139 +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.message.processor.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.listener.EventListener;
-import org.apache.stratos.messaging.listener.application.status.*;
-import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
-
-/**
- * Application Status processor chain is to handle the list processors to parse the application
- * status.
- */
-public class AppStatusMessageProcessorChain extends MessageProcessorChain {
-    private static final Log log = LogFactory.getLog(AppStatusMessageProcessorChain.class);
-
-    private AppStatusClusterCreatedMessageProcessor clusterCreatedMessageProcessor;
-    private AppStatusClusterActivatedMessageProcessor clusterActivatedMessageProcessor;
-    private AppStatusClusterInactivateMessageProcessor clusterInActivateMessageProcessor;
-    private AppStatusClusterTerminatingMessageProcessor clusterTerminatingMessageProcessor;
-    private AppStatusClusterTerminatedMessageProcessor clusterTerminatedMessageProcessor;
-    private AppStatusGroupCreatedMessageProcessor groupCreatedMessageProcessor;
-    private AppStatusGroupActivatedMessageProcessor groupActivatedMessageProcessor;
-    private AppStatusGroupInactivatedMessageProcessor groupInActivateMessageProcessor;
-    private AppStatusApplicationActivatedMessageProcessor appActivatedMessageProcessor;
-    private AppStatusApplicationCreatedMessageProcessor applicationStatusAppCreatedMessageProcessor;
-    private AppStatusApplicationInactivatedMessageProcessor applicationStatusAppInActivatedMessageProcessor;
-    private AppStatusApplicationTerminatedMessageProcessor applicationStatusAppTerminatedMessageProcessor;
-    private AppStatusApplicationTerminatingMessageProcessor applicationStatusAppTerminatingMessageProcessor;
-
-    private AppStatusGroupTerminatedMessageProcessor groupTerminatedMessageProcessor;
-    private AppStatusGroupTerminatingMessageProcessor groupTerminatingMessageProcessor;
-
-    public void initialize() {
-        // Add instance notifier event processors
-        clusterCreatedMessageProcessor= new AppStatusClusterCreatedMessageProcessor();
-        add(clusterCreatedMessageProcessor);
-
-        clusterActivatedMessageProcessor = new AppStatusClusterActivatedMessageProcessor();
-        add(clusterActivatedMessageProcessor);
-
-        clusterInActivateMessageProcessor = new AppStatusClusterInactivateMessageProcessor();
-        add(clusterInActivateMessageProcessor);
-
-        clusterTerminatingMessageProcessor = new AppStatusClusterTerminatingMessageProcessor();
-        add(clusterTerminatingMessageProcessor);
-
-        clusterTerminatedMessageProcessor = new AppStatusClusterTerminatedMessageProcessor();
-        add(clusterTerminatedMessageProcessor);
-
-        groupCreatedMessageProcessor = new AppStatusGroupCreatedMessageProcessor();
-        add(groupCreatedMessageProcessor);
-
-        groupActivatedMessageProcessor = new AppStatusGroupActivatedMessageProcessor();
-        add(groupActivatedMessageProcessor);
-
-        groupInActivateMessageProcessor = new AppStatusGroupInactivatedMessageProcessor();
-        add(groupInActivateMessageProcessor);
-
-        appActivatedMessageProcessor = new AppStatusApplicationActivatedMessageProcessor();
-        add(appActivatedMessageProcessor);
-
-        applicationStatusAppCreatedMessageProcessor = new AppStatusApplicationCreatedMessageProcessor();
-        this.add(applicationStatusAppCreatedMessageProcessor);
-
-        applicationStatusAppInActivatedMessageProcessor = new AppStatusApplicationInactivatedMessageProcessor();
-        this.add(applicationStatusAppInActivatedMessageProcessor);
-
-        applicationStatusAppTerminatedMessageProcessor = new AppStatusApplicationTerminatedMessageProcessor();
-        this.add(applicationStatusAppTerminatedMessageProcessor);
-
-        applicationStatusAppTerminatingMessageProcessor = new AppStatusApplicationTerminatingMessageProcessor();
-        this.add(applicationStatusAppTerminatingMessageProcessor);
-
-        groupTerminatedMessageProcessor = new AppStatusGroupTerminatedMessageProcessor();
-        this.add(groupTerminatedMessageProcessor);
-
-        groupTerminatingMessageProcessor = new AppStatusGroupTerminatingMessageProcessor();
-        this.add(groupTerminatingMessageProcessor);
-
-        if (log.isDebugEnabled()) {
-            log.debug("Instance notifier message processor chain initialized");
-        }
-    }
-
-    public void addEventListener(EventListener eventListener) {
-        if(eventListener instanceof AppStatusClusterCreatedEventListener) {
-            clusterCreatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusClusterActivatedEventListener) {
-            clusterActivatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusClusterInactivateEventListener) {
-            clusterInActivateMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusGroupCreatedEventListener) {
-            groupCreatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusGroupActivatedEventListener) {
-            groupActivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusClusterTerminatedEventListener){
-            clusterTerminatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusClusterTerminatingEventListener){
-            clusterTerminatingMessageProcessor.addEventListener(eventListener);
-        }else if (eventListener instanceof AppStatusGroupInactivateEventListener) {
-            groupInActivateMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusApplicationActivatedEventListener) {
-            appActivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusApplicationInactivatedEventListener){
-            applicationStatusAppInActivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusApplicationCreatedEventListener){
-            applicationStatusAppCreatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusApplicationTerminatingEventListener){
-            applicationStatusAppTerminatingMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof AppStatusApplicationTerminatedEventListener){
-            applicationStatusAppTerminatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusGroupTerminatingEventListener){
-            groupTerminatingMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof AppStatusGroupTerminatedEventListener){
-            groupTerminatedMessageProcessor.addEventListener(eventListener);
-        } else
-        {
-            throw new RuntimeException("Unknown event listener " + eventListener.toString());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterActivatedMessageProcessor.java
new file mode 100644
index 0000000..920f94e
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterActivatedMessageProcessor.java
@@ -0,0 +1,57 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.AppClusterActivatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class AppClusterActivatedMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(AppClusterActivatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (AppClusterActivatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            AppClusterActivatedEvent event = (AppClusterActivatedEvent) Util.jsonToObject(message, AppClusterActivatedEvent.class);
+
+            if(log.isDebugEnabled()) {
+                log.debug("Received ClusterActivatedEvent: " + 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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterCreatedMessageProcessor.java
new file mode 100644
index 0000000..9caa79c
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterCreatedMessageProcessor.java
@@ -0,0 +1,57 @@
+/*
+ * 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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.AppClusterCreatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class AppClusterCreatedMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(AppClusterCreatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (AppClusterCreatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            AppClusterCreatedEvent event = (AppClusterCreatedEvent) Util.jsonToObject(message, AppClusterCreatedEvent.class);
+
+            if(log.isDebugEnabled()) {
+                log.debug("Received AppStatusClusterCreatedEvent: " + 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 created message using available message processors: [type] %s [body] %s", type, message));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterInactivateMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterInactivateMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterInactivateMessageProcessor.java
new file mode 100644
index 0000000..d9fb0e9
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterInactivateMessageProcessor.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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.AppClusterInactivateEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class AppClusterInactivateMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(AppClusterInactivateMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (AppClusterInactivateEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            AppClusterInactivateEvent event = (AppClusterInactivateEvent) Util.
+                                                jsonToObject(message, AppClusterInactivateEvent.class);
+
+            if(log.isDebugEnabled()) {
+                log.debug("Received ClusterInActivateEvent: " + 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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatedMessageProcessor.java
new file mode 100644
index 0000000..843d355
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/AppClusterTerminatedMessageProcessor.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.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.applications.AppClusterTerminatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class AppClusterTerminatedMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(AppClusterTerminatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (AppClusterTerminatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            AppClusterTerminatedEvent event = (AppClusterTerminatedEvent) Util.
+                    jsonToObject(message, AppClusterTerminatedEvent.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));
+            }
+        }
+    }
+}


[07/10] removing application status and adding applications, cluster status topic

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterInactivateMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterInactivateMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterInactivateMessageProcessor.java
new file mode 100644
index 0000000..69918e2
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterInactivateMessageProcessor.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.cluster.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.cluster.status.ClusterStatusClusterInactivateEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class ClusterStatusClusterInactivateMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(ClusterStatusClusterInactivateMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ClusterStatusClusterInactivateEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ClusterStatusClusterInactivateEvent event = (ClusterStatusClusterInactivateEvent) Util.
+                                                jsonToObject(message, ClusterStatusClusterInactivateEvent.class);
+
+            if(log.isDebugEnabled()) {
+                log.debug("Received ClusterInActivateEvent: " + 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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterTerminatedMessageProcessor.java
new file mode 100644
index 0000000..64b6c7b
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterTerminatedMessageProcessor.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.cluster.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.cluster.status.ClusterStatusClusterTerminatedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class ClusterStatusClusterTerminatedMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(ClusterStatusClusterTerminatedMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ClusterStatusClusterTerminatedEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ClusterStatusClusterTerminatedEvent event = (ClusterStatusClusterTerminatedEvent) Util.
+                    jsonToObject(message, ClusterStatusClusterTerminatedEvent.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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterTerminatingMessageProcessor.java
new file mode 100644
index 0000000..c161dd5
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterTerminatingMessageProcessor.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.cluster.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.cluster.status.ClusterStatusClusterTerminatingEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.util.Util;
+
+
+public class ClusterStatusClusterTerminatingMessageProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(ClusterStatusClusterTerminatingMessageProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        if (ClusterStatusClusterTerminatingEvent.class.getName().equals(type)) {
+            // Parse complete message and build event
+            ClusterStatusClusterTerminatingEvent event = (ClusterStatusClusterTerminatingEvent) Util.
+                                                jsonToObject(message, ClusterStatusClusterTerminatingEvent.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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusMessageProcessorChain.java
new file mode 100644
index 0000000..29556ec
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusMessageProcessorChain.java
@@ -0,0 +1,78 @@
+/*
+ * 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.cluster.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.listener.cluster.status.*;
+import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
+
+/**
+ * This is to keep track of the processors for the cluster status topic.
+ */
+public class ClusterStatusMessageProcessorChain extends MessageProcessorChain {
+    private static final Log log = LogFactory.getLog(ClusterStatusMessageProcessorChain.class);
+
+
+    private ClusterStatusClusterActivatedMessageProcessor clusterActivatedMessageProcessor;
+    private ClusterStatusClusterCreatedMessageProcessor clusterCreatedMessageProcessor;
+    private ClusterStatusClusterInactivateMessageProcessor clusterInactivateMessageProcessor;
+    private ClusterStatusClusterTerminatedMessageProcessor clusterTerminatedMessageProcessor;
+    private ClusterStatusClusterTerminatingMessageProcessor clusterTerminatingMessageProcessor;
+    @Override
+    protected void initialize() {
+        clusterCreatedMessageProcessor = new ClusterStatusClusterCreatedMessageProcessor();
+        add(clusterCreatedMessageProcessor);
+
+        clusterActivatedMessageProcessor = new ClusterStatusClusterActivatedMessageProcessor();
+        add(clusterActivatedMessageProcessor);
+
+        clusterInactivateMessageProcessor = new ClusterStatusClusterInactivateMessageProcessor();
+        add(clusterInactivateMessageProcessor);
+
+        clusterTerminatedMessageProcessor = new ClusterStatusClusterTerminatedMessageProcessor();
+        add(clusterTerminatedMessageProcessor);
+
+        clusterTerminatingMessageProcessor = new ClusterStatusClusterTerminatingMessageProcessor();
+        add(clusterTerminatingMessageProcessor);
+
+        if (log.isDebugEnabled()) {
+            log.debug("Cluster status  message processor chain initialized");
+        }
+    }
+
+    @Override
+    public void addEventListener(EventListener eventListener) {
+        if(eventListener instanceof ClusterStatusClusterCreatedEventListener) {
+            clusterCreatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ClusterStatusClusterInactivateEventListener) {
+            clusterInactivateMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ClusterStatusClusterActivatedEventListener) {
+            clusterActivatedMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ClusterStatusClusterTerminatingEventListener) {
+            clusterTerminatingMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof ClusterStatusClusterTerminatedEventListener) {
+            clusterTerminatedMessageProcessor.addEventListener(eventListener);
+        } else {
+            throw new RuntimeException("Unknown event listener " + eventListener.toString());
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationActivatedMessageProcessor.java
deleted file mode 100644
index 341b402..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationActivatedMessageProcessor.java
+++ /dev/null
@@ -1,104 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
-import org.apache.stratos.messaging.domain.topology.Topology;
-import org.apache.stratos.messaging.event.topology.ApplicationActivatedEvent;
-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 responsible to process the application activation even and update the Topology.
- */
-public class ApplicationActivatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(ApplicationActivatedMessageProcessor.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 (ApplicationActivatedEvent.class.getName().equals(type)) {
-            // Return if topology has not been initialized
-            if (!topology.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            ApplicationActivatedEvent event = (ApplicationActivatedEvent) Util.
-                    jsonToObject(message, ApplicationActivatedEvent.class);
-
-            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } 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(ApplicationActivatedEvent event, Topology topology) {
-
-        // Validate event against the existing topology
-        Application application = topology.getApplication(event.getAppId());
-        if (application == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Application does not exist: [service] %s",
-                        event.getAppId()));
-            }
-            return false;
-        } else {
-            // Apply changes to the topology
-            if (!application.isStateTransitionValid(ApplicationStatus.Active)) {
-                log.error("Invalid State transfer from [ " + application.getStatus() +
-                        " ] to [ " + ApplicationStatus.Active + " ]");
-            }
-            application.setStatus(ApplicationStatus.Active);
-
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationCreatedMessageProcessor.java
deleted file mode 100644
index 079cb90..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationCreatedMessageProcessor.java
+++ /dev/null
@@ -1,121 +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.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.applications.ClusterDataHolder;
-import org.apache.stratos.messaging.domain.topology.Topology;
-import org.apache.stratos.messaging.event.topology.ApplicationCreatedEvent;
-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;
-
-import java.util.Set;
-
-public class ApplicationCreatedMessageProcessor extends MessageProcessor {
-
-    private static final Log log = LogFactory.getLog(ApplicationCreatedMessageProcessor.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 (ApplicationCreatedEvent.class.getName().equals(type)) {
-            if (!topology.isInitialized()) {
-                return false;
-            }
-
-            ApplicationCreatedEvent event = (ApplicationCreatedEvent) Util.jsonToObject(message, ApplicationCreatedEvent.class);
-            if (event == null) {
-                log.error("Unable to convert the JSON message to ApplicationCreatedEvent");
-                return false;
-            }
-
-            TopologyUpdater.acquireWriteLockForApplications();
-            // since the Clusters will also get modified, acquire write locks for each Service Type
-            Set<ClusterDataHolder> clusterDataHolders = event.getApplication().getClusterDataRecursively();
-            if (clusterDataHolders != null) {
-                for (ClusterDataHolder clusterData : clusterDataHolders) {
-                    TopologyUpdater.acquireWriteLockForService(clusterData.getServiceType());
-                }
-            }
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                if (clusterDataHolders != null) {
-                    for (ClusterDataHolder clusterData : clusterDataHolders) {
-                        TopologyUpdater.releaseWriteLockForService(clusterData.getServiceType());
-                    }
-                }
-                TopologyUpdater.releaseWriteLockForApplications();
-            }
-
-        } 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 (ApplicationCreatedEvent event,Topology topology) {
-
-        // check if required properties are available
-        if (event.getApplication() == null) {
-            String errorMsg = "Application object of application created event is invalid";
-            log.error(errorMsg);
-            throw new RuntimeException(errorMsg);
-        }
-
-        if (event.getApplication().getUniqueIdentifier() == null || event.getApplication().getUniqueIdentifier().isEmpty()) {
-            String errorMsg = "App id of application created event is invalid: [ " + event.getApplication().getUniqueIdentifier() + " ]";
-            log.error(errorMsg);
-            throw new RuntimeException(errorMsg);
-        }
-
-        // check if an Application with same name exists in topology
-        if (topology.applicationExists(event.getApplication().getUniqueIdentifier())) {
-            log.warn("Application with id [ " + event.getApplication().getUniqueIdentifier() + " ] already exists in Topology");
-
-        } else {
-            // add application and the clusters to Topology
-            for(Cluster cluster: event.getClusterList()) {
-                topology.getService(cluster.getServiceName()).addCluster(cluster);
-            }
-            topology.addApplication(event.getApplication());
-        }
-
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationInactivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationInactivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationInactivatedMessageProcessor.java
deleted file mode 100644
index 8c88324..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationInactivatedMessageProcessor.java
+++ /dev/null
@@ -1,104 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
-import org.apache.stratos.messaging.domain.topology.Topology;
-import org.apache.stratos.messaging.event.topology.ApplicationInactivatedEvent;
-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 responsible to process the application Inactivation even and update the Topology.
- */
-public class ApplicationInactivatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(ApplicationInactivatedMessageProcessor.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 (ApplicationInactivatedEvent.class.getName().equals(type)) {
-            // Return if topology has not been initialized
-            if (!topology.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            ApplicationInactivatedEvent event = (ApplicationInactivatedEvent) Util.
-                    jsonToObject(message, ApplicationInactivatedEvent.class);
-
-            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } 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 (ApplicationInactivatedEvent event, Topology topology) {
-
-        // Validate event against the existing topology
-        Application application = topology.getApplication(event.getAppId());
-        if (application == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Application does not exist: [service] %s",
-                        event.getAppId()));
-            }
-            return false;
-        } else {
-            // Apply changes to the topology
-            if (!application.isStateTransitionValid(ApplicationStatus.Inactive)) {
-                log.error("Invalid State transfer from [ " + application.getStatus() +
-                        " ] to [ " + ApplicationStatus.Inactive + " ]");
-            }
-            application.setStatus(ApplicationStatus.Inactive);
-
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationTerminatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationTerminatedMessageProcessor.java
deleted file mode 100644
index 2dd3ea7..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationTerminatedMessageProcessor.java
+++ /dev/null
@@ -1,136 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
-import org.apache.stratos.messaging.domain.topology.*;
-import org.apache.stratos.messaging.event.topology.ApplicationTerminatedEvent;
-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;
-
-import java.util.Set;
-
-/**
- * This processor responsible to process the application Inactivation even and update the Topology.
- */
-public class ApplicationTerminatedMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(ApplicationTerminatedMessageProcessor.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 (ApplicationTerminatedEvent.class.getName().equals(type)) {
-            // Return if topology has not been initialized
-            if (!topology.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            ApplicationTerminatedEvent event = (ApplicationTerminatedEvent) Util.
-                    jsonToObject(message, ApplicationTerminatedEvent.class);
-
-            TopologyUpdater.acquireWriteLockForApplications();
-                        Set<ClusterDataHolder> clusterDataHolders = event.getClusterData();
-            if (clusterDataHolders != null) {
-                for (ClusterDataHolder clusterData : clusterDataHolders) {
-                    TopologyUpdater.acquireWriteLockForService(clusterData.getServiceType());
-                }
-            }
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                TopologyUpdater.releaseWriteLockForApplications();
-                if (clusterDataHolders != null) {
-                    for (ClusterDataHolder clusterData : clusterDataHolders) {
-                        TopologyUpdater.releaseWriteLockForService(clusterData.getServiceType());
-                    }
-                }
-            }
-
-        } 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 (ApplicationTerminatedEvent event, Topology topology) {
-
-        // check if required properties are available
-        if (event.getAppId() == null) {
-            String errorMsg = "Application Id of application removed event is invalid";
-            log.error(errorMsg);
-            throw new RuntimeException(errorMsg);
-        }
-
-        if (event.getTenantDomain()== null) {
-            String errorMsg = "Application tenant domain of application removed event is invalid";
-            log.error(errorMsg);
-            throw new RuntimeException(errorMsg);
-        }
-
-        // check if an Application with same name exists in topology
-        String appId = event.getAppId();
-        if (topology.applicationExists(appId)) {
-            log.warn("Application with id [ " + appId + " ] still exists in Topology, removing it");
-            topology.removeApplication(appId);
-        }
-
-        if (event.getClusterData() != null) {
-            // remove the Clusters from the Topology
-            for (ClusterDataHolder clusterData : event.getClusterData()) {
-                Service service = topology.getService(clusterData.getServiceType());
-                if (service != null) {
-                    service.removeCluster(clusterData.getClusterId());
-                    if (log.isDebugEnabled()) {
-                        log.debug("Removed the Cluster " + clusterData.getClusterId() + " from Topology");
-                    }
-                }  else {
-                    log.warn("Service " + clusterData.getServiceType() + " not found in Topology!");
-                }
-            }
-        }
-
-        if (log.isDebugEnabled()) {
-            log.debug("ApplicationRemovedMessageProcessor notifying listener ");
-        }
-
-        notifyEventListeners(event);
-        return true;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationTerminatingMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationTerminatingMessageProcessor.java
deleted file mode 100644
index 032be79..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationTerminatingMessageProcessor.java
+++ /dev/null
@@ -1,104 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
-import org.apache.stratos.messaging.domain.topology.Topology;
-import org.apache.stratos.messaging.event.topology.ApplicationTerminatingEvent;
-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 responsible to process the application Inactivation even and update the Topology.
- */
-public class ApplicationTerminatingMessageProcessor extends MessageProcessor {
-    private static final Log log =
-            LogFactory.getLog(ApplicationTerminatingMessageProcessor.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 (ApplicationTerminatingEvent.class.getName().equals(type)) {
-            // Return if topology has not been initialized
-            if (!topology.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            ApplicationTerminatingEvent event = (ApplicationTerminatingEvent) Util.
-                    jsonToObject(message, ApplicationTerminatingEvent.class);
-
-            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } 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 (ApplicationTerminatingEvent event, Topology topology) {
-
-        // Validate event against the existing topology
-        Application application = topology.getApplication(event.getAppId());
-        if (application == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Application does not exist: [service] %s",
-                        event.getAppId()));
-            }
-            return false;
-        } else {
-            // Apply changes to the topology
-            if (!application.isStateTransitionValid(ApplicationStatus.Terminating)) {
-                log.error("Invalid State transfer from [ " + application.getStatus() +
-                        " ] to [ " + ApplicationStatus.Terminating + " ]");
-            }
-            application.setStatus(ApplicationStatus.Terminating);
-
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationUndeployedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationUndeployedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationUndeployedMessageProcessor.java
deleted file mode 100644
index f368dd1..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationUndeployedMessageProcessor.java
+++ /dev/null
@@ -1,139 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
-import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
-import org.apache.stratos.messaging.domain.topology.*;
-import org.apache.stratos.messaging.event.topology.ApplicationUndeployedEvent;
-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;
-
-import java.util.Set;
-
-public class ApplicationUndeployedMessageProcessor extends MessageProcessor {
-
-    private static final Log log = LogFactory.getLog(ApplicationUndeployedMessageProcessor.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 (ApplicationUndeployedEvent.class.getName().equals(type)) {
-            if (!topology.isInitialized()) {
-                return false;
-            }
-
-            ApplicationUndeployedEvent event = (ApplicationUndeployedEvent)
-                    Util.jsonToObject(message, ApplicationUndeployedEvent.class);
-            if (event == null) {
-                log.error("Unable to convert the JSON message to ApplicationUndeployedEvent");
-                return false;
-            }
-
-            // get write lock for the application and relevant Clusters
-            TopologyUpdater.acquireWriteLockForApplication(event.getApplicationId());
-            Set<ClusterDataHolder> clusterDataHolders = event.getClusterData();
-            if (clusterDataHolders != null) {
-                for (ClusterDataHolder clusterData : clusterDataHolders) {
-                    TopologyUpdater.acquireWriteLockForCluster(clusterData.getServiceType(),
-                            clusterData.getClusterId());
-                }
-            }
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                // remove locks
-                if (clusterDataHolders != null) {
-                    for (ClusterDataHolder clusterData : clusterDataHolders) {
-                        TopologyUpdater.releaseWriteLockForCluster(clusterData.getServiceType(),
-                                clusterData.getClusterId());
-                    }
-                }
-                TopologyUpdater.releaseWriteLockForApplication(event.getApplicationId());
-            }
-
-        } 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 (ApplicationUndeployedEvent event, Topology topology) {
-
-        // update the application status to Terminating
-        Application application = topology.getApplication(event.getApplicationId());
-        // check and update application status to 'Terminating'
-        if (!application.isStateTransitionValid(ApplicationStatus.Terminating)) {
-            log.error("Invalid state transfer from " + application.getStatus() + " to " + ApplicationStatus.Terminating);
-        }
-        // for now anyway update the status forcefully
-        application.setStatus(ApplicationStatus.Terminating);
-
-        // update all the Clusters' statuses to 'Terminating'
-        Set<ClusterDataHolder> clusterData = application.getClusterDataRecursively();
-        // update the Cluster statuses to Terminating
-        for (ClusterDataHolder clusterDataHolder : clusterData) {
-            Service service = topology.getService(clusterDataHolder.getServiceType());
-            if (service != null) {
-                Cluster aCluster = service.getCluster(clusterDataHolder.getClusterId());
-                if (aCluster != null) {
-                    // validate state transition
-                    if (!aCluster.isStateTransitionValid(ClusterStatus.Terminating)) {
-                        log.error("Invalid state transfer from " + aCluster.getStatus() + " to "
-                                + ClusterStatus.Terminating);
-                    }
-                    // for now anyway update the status forcefully
-                    aCluster.setStatus(ClusterStatus.Terminating);
-
-                } else {
-                    log.warn("Unable to find Cluster with cluster id " + clusterDataHolder.getClusterId() +
-                            " in Topology");
-                }
-
-            } else {
-                log.warn("Unable to remove cluster with cluster id: " + clusterDataHolder.getClusterId() + " from Topology, " +
-                        " associated Service [ " + clusterDataHolder.getServiceType() + " ] npt found");
-            }
-        }
-
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupActivatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupActivatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupActivatedProcessor.java
deleted file mode 100644
index 09b9062..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupActivatedProcessor.java
+++ /dev/null
@@ -1,107 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.topology.*;
-import org.apache.stratos.messaging.event.topology.GroupActivatedEvent;
-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 Group activation events
- */
-public class GroupActivatedProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupActivatedProcessor.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 (GroupActivatedEvent.class.getName().equals(type)) {
-            // Return if topology has not been initialized
-            if (!topology.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupActivatedEvent event = (GroupActivatedEvent) Util.
-                    jsonToObject(message, GroupActivatedEvent.class);
-
-            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } 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 (GroupActivatedEvent event,Topology topology) {
-
-        // Validate event against the existing topology
-        Application application = topology.getApplication(event.getAppId());
-        if (application == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Application does not exist: [service] %s",
-                        event.getAppId()));
-            }
-            return false;
-        }
-        Group group = application.getGroupRecursively(event.getGroupId());
-
-        if (group == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
-                        event.getGroupId()));
-            }
-        } else {
-            // Apply changes to the topology
-            if (!group.isStateTransitionValid(GroupStatus.Active)) {
-                log.error("Invalid State Transition from " + group.getStatus() + " to " + GroupStatus.Active);
-            }
-            group.setStatus(GroupStatus.Active);
-
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupCreatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupCreatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupCreatedProcessor.java
deleted file mode 100644
index d053f5d..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupCreatedProcessor.java
+++ /dev/null
@@ -1,108 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.topology.Topology;
-import org.apache.stratos.messaging.event.topology.GroupCreatedEvent;
-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 Group activation events
- */
-public class GroupCreatedProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupCreatedProcessor.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 (GroupCreatedEvent.class.getName().equals(type)) {
-            // Return if topology has not been initialized
-            if (!topology.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupCreatedEvent event = (GroupCreatedEvent) Util.
-                    jsonToObject(message, GroupCreatedEvent.class);
-
-            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } 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 (GroupCreatedEvent event,Topology topology) {
-
-        // Validate event against the existing topology
-        Application application = topology.getApplication(event.getAppId());
-        if (application == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Application does not exist: [service] %s",
-                        event.getAppId()));
-            }
-            return false;
-        }
-        Group group = application.getGroupRecursively(event.getGroupId());
-
-        if (group == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
-                        event.getGroupId()));
-            }
-        } else {
-            // Apply changes to the topology
-            if (!group.isStateTransitionValid(GroupStatus.Created)) {
-                log.error("Invalid State Transition from " + group.getStatus() + " to " + GroupStatus.Created  + " " +
-                        "for Group " + group.getAlias());
-            }
-            group.setStatus(GroupStatus.Created);
-
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/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
deleted file mode 100644
index add40b4..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupInActivateProcessor.java
+++ /dev/null
@@ -1,106 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.topology.Topology;
-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;
-
-/**
- * This processor will act upon the Group activation events
- */
-public class GroupInActivateProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupInActivateProcessor.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 (GroupInactivateEvent.class.getName().equals(type)) {
-            // Return if topology has not been initialized
-            if (!topology.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupInactivateEvent event = (GroupInactivateEvent) Util.
-                    jsonToObject(message, GroupInactivateEvent.class);
-
-            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } 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(GroupInactivateEvent event, Topology topology) {
-
-        // Validate event against the existing topology
-        Application application = topology.getApplication(event.getAppId());
-        if (application == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Application does not exist: [service] %s",
-                        event.getAppId()));
-            }
-            return false;
-        }
-        Group group = application.getGroupRecursively(event.getGroupId());
-
-        if (group == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
-                        event.getGroupId()));
-            }
-        } else {
-            group.setStatus(GroupStatus.Inactive);
-            if (log.isInfoEnabled()) {
-                log.info(String.format("Group updated as in-activated : %s",
-                        group.getUniqueIdentifier()));
-            }
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupTerminatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupTerminatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupTerminatedProcessor.java
deleted file mode 100644
index 767ff71..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupTerminatedProcessor.java
+++ /dev/null
@@ -1,107 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.topology.Topology;
-import org.apache.stratos.messaging.event.topology.GroupTerminatedEvent;
-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 Group activation events
- */
-public class GroupTerminatedProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupTerminatedProcessor.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 (GroupTerminatedEvent.class.getName().equals(type)) {
-            // Return if topology has not been initialized
-            if (!topology.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupTerminatedEvent event = (GroupTerminatedEvent) Util.
-                    jsonToObject(message, GroupTerminatedEvent.class);
-
-            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } 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 (GroupTerminatedEvent event,Topology topology) {
-
-        // Validate event against the existing topology
-        Application application = topology.getApplication(event.getAppId());
-        if (application == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Application does not exist: [service] %s",
-                        event.getAppId()));
-            }
-            return false;
-        }
-        Group group = application.getGroupRecursively(event.getGroupId());
-
-        if (group == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
-                        event.getGroupId()));
-            }
-        } else {
-            // Apply changes to the topology
-            if (!group.isStateTransitionValid(GroupStatus.Terminated)) {
-                log.error("Invalid State Transition from " + group.getStatus() + " to " + GroupStatus.Terminated);
-            }
-            group.setStatus(GroupStatus.Terminated);
-
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupTerminatingProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupTerminatingProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupTerminatingProcessor.java
deleted file mode 100644
index 5b15532..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupTerminatingProcessor.java
+++ /dev/null
@@ -1,107 +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.message.processor.topology;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.topology.Topology;
-import org.apache.stratos.messaging.event.topology.GroupTerminatingEvent;
-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 Group activation events
- */
-public class GroupTerminatingProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupTerminatingProcessor.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 (GroupTerminatingEvent.class.getName().equals(type)) {
-            // Return if topology has not been initialized
-            if (!topology.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupTerminatingEvent event = (GroupTerminatingEvent) Util.
-                    jsonToObject(message, GroupTerminatingEvent.class);
-
-            TopologyUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, topology);
-
-            } finally {
-                TopologyUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } 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 (GroupTerminatingEvent event,Topology topology) {
-
-        // Validate event against the existing topology
-        Application application = topology.getApplication(event.getAppId());
-        if (application == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Application does not exist: [service] %s",
-                        event.getAppId()));
-            }
-            return false;
-        }
-        Group group = application.getGroupRecursively(event.getGroupId());
-
-        if (group == null) {
-            if (log.isWarnEnabled()) {
-                log.warn(String.format("Group not exists in service: [AppId] %s [groupId] %s", event.getAppId(),
-                        event.getGroupId()));
-            }
-        } else {
-            // Apply changes to the topology
-            if (!group.isStateTransitionValid(GroupStatus.Terminating)) {
-                log.error("Invalid State Transition from " + group.getStatus() + " to " + GroupStatus.Active);
-            }
-            group.setStatus(GroupStatus.Terminating);
-
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/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 d8d25d9..048e9a3 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
@@ -22,7 +22,6 @@ 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.listener.EventListener;
-import org.apache.stratos.messaging.listener.applications.ApplicationUndeployedEventListener;
 import org.apache.stratos.messaging.listener.topology.*;
 import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
 
@@ -47,17 +46,6 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain {
     private MemberMaintenanceModeProcessor memberMaintenanceModeProcessor;
     private MemberSuspendedMessageProcessor memberSuspendedMessageProcessor;
     private MemberTerminatedMessageProcessor memberTerminatedMessageProcessor;
-    private GroupCreatedProcessor groupCreatedProcessor;
-    private GroupActivatedProcessor groupActivatedProcessor;
-    private GroupInActivateProcessor groupInActivateProcessor;
-    private ApplicationCreatedMessageProcessor applicationCreatedMessageProcessor;
-    private ApplicationUndeployedMessageProcessor applicationUndeployedMessageProcessor;
-    private ApplicationActivatedMessageProcessor applicationActivatedMessageProcessor;
-    private ApplicationInactivatedMessageProcessor applicationInactivatedMessageProcessor;
-    private ApplicationTerminatedMessageProcessor applicationTerminatedMessageProcessor;
-    private ApplicationTerminatingMessageProcessor applicationTerminatingMessageProcessor;
-    private GroupTerminatingProcessor groupTerminatingProcessor;
-    private GroupTerminatedProcessor groupTerminatedProcessor;
     private ClusterTerminatingProcessor clusterTerminatingProcessor;
     private ClusterTerminatedProcessor clusterTerminatedProcessor;
 
@@ -111,39 +99,6 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain {
         memberTerminatedMessageProcessor = new MemberTerminatedMessageProcessor();
         add(memberTerminatedMessageProcessor);
 
-        groupCreatedProcessor = new GroupCreatedProcessor();
-        add(groupCreatedProcessor);
-
-        groupActivatedProcessor = new GroupActivatedProcessor();
-        add(groupActivatedProcessor);
-
-        groupInActivateProcessor = new GroupInActivateProcessor();
-        add(groupInActivateProcessor);
-
-        groupTerminatingProcessor = new GroupTerminatingProcessor();
-        add(groupTerminatingProcessor);
-
-        groupTerminatedProcessor = new GroupTerminatedProcessor();
-        add(groupTerminatedProcessor);
-
-        applicationCreatedMessageProcessor = new ApplicationCreatedMessageProcessor();
-        add(applicationCreatedMessageProcessor);
-
-        applicationUndeployedMessageProcessor = new ApplicationUndeployedMessageProcessor();
-        add(applicationUndeployedMessageProcessor);
-
-        applicationActivatedMessageProcessor = new ApplicationActivatedMessageProcessor();
-        add(applicationActivatedMessageProcessor);
-
-        applicationInactivatedMessageProcessor = new ApplicationInactivatedMessageProcessor();
-        add(applicationInactivatedMessageProcessor);
-
-        applicationTerminatedMessageProcessor = new ApplicationTerminatedMessageProcessor();
-        add(applicationTerminatedMessageProcessor);
-
-        applicationTerminatingMessageProcessor = new ApplicationTerminatingMessageProcessor();
-        add(applicationTerminatingMessageProcessor);
-
         if (log.isDebugEnabled()) {
             log.debug("Topology message processor chain initialized X1");
         }
@@ -182,30 +137,7 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain {
             serviceRemovedMessageProcessor.addEventListener(eventListener);
         } else if (eventListener instanceof  MemberMaintenanceListener) {
             memberMaintenanceModeProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof GroupActivatedEventListener) {
-            groupActivatedProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof GroupCreatedEventListener) {
-            groupCreatedProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof GroupInActivateEventListener) {
-            groupInActivateProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof GroupTerminatedEventListener){
-            groupTerminatedProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof GroupTerminatingEventListener){
-            groupTerminatingProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof ApplicationCreatedEventListener) {
-            applicationCreatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof ApplicationUndeployedEventListener) {
-            applicationUndeployedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof ApplicationActivatedEventListener) {
-            applicationActivatedMessageProcessor.addEventListener(eventListener);
-        } else  if (eventListener instanceof ApplicationInActivateEventListener){
-            applicationInactivatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof ApplicationTerminatedEventListener){
-            applicationTerminatedMessageProcessor.addEventListener(eventListener);
-        } else if(eventListener instanceof ApplicationTerminatingEventListener){
-            applicationTerminatingMessageProcessor.addEventListener(eventListener);
-        }
-        else {
+        } else {
             throw new RuntimeException("Unknown event listener");
         }
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageDelegator.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageDelegator.java
deleted file mode 100644
index 9eda9e0..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageDelegator.java
+++ /dev/null
@@ -1,146 +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.message.receiver.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.listener.EventListener;
-import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
-import org.apache.stratos.messaging.message.processor.application.status.AppStatusMessageProcessorChain;
-import org.apache.stratos.messaging.util.Constants;
-
-import javax.jms.TextMessage;
-
-public class ApplicationStatusEventMessageDelegator implements Runnable {
-    private static final Log log = LogFactory.getLog(ApplicationStatusEventMessageDelegator.class);
-
-    private ApplicationStatusEventMessageQueue messageQueue;
-    private MessageProcessorChain processorChain;
-    private boolean terminated;
-
-    public ApplicationStatusEventMessageDelegator(ApplicationStatusEventMessageQueue messageQueue) {
-        this.messageQueue = messageQueue;
-        this.processorChain = new AppStatusMessageProcessorChain();
-    }
-
-    public void addEventListener(EventListener eventListener) {
-        processorChain.addEventListener(eventListener);
-    }
-
-    @Override
-    public void run() {
-        try {
-            if (log.isInfoEnabled()) {
-                log.info("Application status event message delegator started");
-            }
-
-            while (!terminated) {
-                try {
-                    TextMessage message = messageQueue.take();
-
-                    // Retrieve the header
-                    String type = message.getStringProperty(Constants.EVENT_CLASS_NAME);
-
-                    // Retrieve the actual message
-                    String json = message.getText();
-
-                    if (log.isDebugEnabled()) {
-                        log.debug(String.format("Application status event message received from queue: %s", type));
-                    }
-
-                    // Delegate message to message processor chain
-                    if (log.isDebugEnabled()) {
-                        log.debug(String.format("Delegating application status event message: %s", type));
-                    }
-                    processorChain.process(type, json, null);
-                } catch (Exception e) {
-                    log.error("Failed to retrieve application status event message", e);
-                }
-            }
-        } catch (Exception e) {
-            if (log.isErrorEnabled()) {
-                log.error("Application status event message delegator failed", e);
-            }
-        }
-    }
-
-    /**
-     * Terminate topology event message delegator thread.
-     */
-    public void terminate() {
-        terminated = true;
-    }
-
-
-    private EventMessage jsonToEventMessage(String json) {
-
-        EventMessage event = new EventMessage();
-        String message;
-
-        //split the message to 3 parts using ':' first is class name, second contains the text 'message' and the third contains
-        //message
-        String[] MessageParts = json.split(":", 3);
-
-        String eventType = MessageParts[0].trim();
-        eventType = eventType.substring(eventType.indexOf("\"") + 1, eventType.lastIndexOf("\""));
-        if(log.isDebugEnabled()){
-            log.debug(String.format("Extracted [event type] %s", eventType));
-        }
-
-        event.setEventName(eventType);
-        String messageTag = MessageParts[1];
-        messageTag = messageTag.substring(messageTag.indexOf("\"") + 1, messageTag.lastIndexOf("\""));
-
-        if("message".equals(messageTag)){
-            message = MessageParts[2].trim();
-            //Remove trailing bracket twice to get the message
-            message = message.substring(0, message.lastIndexOf("}")).trim();
-            message = message.substring(0, message.lastIndexOf("}")).trim();
-            if(message.indexOf('{') == 0 && message.indexOf('}') == message.length() - 1){
-                if(log.isDebugEnabled()) {
-                    log.debug(String.format("[Extracted message] %s ", message));
-                }
-                event.setMessage(message);
-                return event;
-            }
-        }
-        return null;
-    }
-
-    private class EventMessage {
-        private String eventName;
-        private String message;
-
-        private String getEventName() {
-            return eventName;
-        }
-
-        private void setEventName(String eventName) {
-            this.eventName = eventName;
-        }
-
-        public String getMessage() {
-            return message;
-        }
-
-        public void setMessage(String message) {
-            this.message = message;
-        }
-    }
-}


[06/10] removing application status and adding applications, cluster status topic

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageListener.java
deleted file mode 100644
index 93eeb54..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageListener.java
+++ /dev/null
@@ -1,54 +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.message.receiver.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.TextMessage;
-
-public class ApplicationStatusEventMessageListener implements MessageListener {
-    private static final Log log = LogFactory.getLog(ApplicationStatusEventMessageListener.class);
-
-    private ApplicationStatusEventMessageQueue messageQueue;
-
-    public ApplicationStatusEventMessageListener(ApplicationStatusEventMessageQueue messageQueue) {
-        this.messageQueue = messageQueue;
-    }
-
-    @Override
-    public void onMessage(Message message) {
-        if (message instanceof TextMessage) {
-            TextMessage receivedMessage = (TextMessage) message;
-            try {
-                if (log.isDebugEnabled()) {
-                    log.debug(String.format("Tenant message received: %s", ((TextMessage) message).getText()));
-                }
-                // Add received message to the queue
-                messageQueue.add(receivedMessage);
-
-            } catch (JMSException e) {
-                log.error(e.getMessage(), e);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageQueue.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageQueue.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageQueue.java
deleted file mode 100644
index ba455c9..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventMessageQueue.java
+++ /dev/null
@@ -1,26 +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.message.receiver.application.status;
-
-
-import javax.jms.TextMessage;
-import java.util.concurrent.LinkedBlockingQueue;
-
-public class ApplicationStatusEventMessageQueue extends LinkedBlockingQueue<TextMessage> {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventReceiver.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventReceiver.java
deleted file mode 100644
index 0b6cada..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/status/ApplicationStatusEventReceiver.java
+++ /dev/null
@@ -1,83 +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.message.receiver.application.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.broker.subscribe.TopicSubscriber;
-import org.apache.stratos.messaging.listener.EventListener;
-import org.apache.stratos.messaging.util.Constants;
-
-public class ApplicationStatusEventReceiver implements Runnable {
-    private static final Log log = LogFactory.getLog(ApplicationStatusEventReceiver.class);
-
-    private ApplicationStatusEventMessageDelegator messageDelegator;
-    private ApplicationStatusEventMessageListener messageListener;
-    private TopicSubscriber topicSubscriber;
-    private boolean terminated;
-
-    public ApplicationStatusEventReceiver() {
-        ApplicationStatusEventMessageQueue messageQueue = new ApplicationStatusEventMessageQueue();
-        this.messageDelegator = new ApplicationStatusEventMessageDelegator(messageQueue);
-        this.messageListener = new ApplicationStatusEventMessageListener(messageQueue);
-    }
-
-    public void addEventListener(EventListener eventListener) {
-        messageDelegator.addEventListener(eventListener);
-    }
-
-    @Override
-    public void run() {
-        try {
-            // Start topic subscriber thread
-            topicSubscriber = new TopicSubscriber(Constants.APPLICATION_STATUS_TOPIC);
-            topicSubscriber.setMessageListener(messageListener);
-            Thread subscriberThread = new Thread(topicSubscriber);
-            subscriberThread.start();
-            if (log.isDebugEnabled()) {
-                log.debug("Application status event message receiver thread started");
-            }
-
-            // Start Application status event message delegator thread
-            Thread receiverThread = new Thread(messageDelegator);
-            receiverThread.start();
-            if (log.isDebugEnabled()) {
-                log.debug("Application status event message delegator thread started");
-            }
-
-            // Keep the thread live until terminated
-            while (!terminated) {
-                try {
-                    Thread.sleep(1000);
-                } catch (InterruptedException ignore) {
-                }
-            }
-        } catch (Exception e) {
-            if (log.isErrorEnabled()) {
-                log.error("Application status failed", e);
-            }
-        }
-    }
-
-    public void terminate() {
-        topicSubscriber.terminate();
-        messageDelegator.terminate();
-        terminated = true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageDelegator.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageDelegator.java
new file mode 100644
index 0000000..68d44b0
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageDelegator.java
@@ -0,0 +1,146 @@
+/*
+ * 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.receiver.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
+import org.apache.stratos.messaging.message.processor.applications.ApplicationsMessageProcessorChain;
+import org.apache.stratos.messaging.util.Constants;
+
+import javax.jms.TextMessage;
+
+public class ApplicationsEventMessageDelegator implements Runnable {
+    private static final Log log = LogFactory.getLog(ApplicationsEventMessageDelegator.class);
+
+    private ApplicationsEventMessageQueue messageQueue;
+    private MessageProcessorChain processorChain;
+    private boolean terminated;
+
+    public ApplicationsEventMessageDelegator(ApplicationsEventMessageQueue messageQueue) {
+        this.messageQueue = messageQueue;
+        this.processorChain = new ApplicationsMessageProcessorChain();
+    }
+
+    public void addEventListener(EventListener eventListener) {
+        processorChain.addEventListener(eventListener);
+    }
+
+    @Override
+    public void run() {
+        try {
+            if (log.isInfoEnabled()) {
+                log.info("Application status event message delegator started");
+            }
+
+            while (!terminated) {
+                try {
+                    TextMessage message = messageQueue.take();
+
+                    // Retrieve the header
+                    String type = message.getStringProperty(Constants.EVENT_CLASS_NAME);
+
+                    // Retrieve the actual message
+                    String json = message.getText();
+
+                    if (log.isDebugEnabled()) {
+                        log.debug(String.format("Application status event message received from queue: %s", type));
+                    }
+
+                    // Delegate message to message processor chain
+                    if (log.isDebugEnabled()) {
+                        log.debug(String.format("Delegating application status event message: %s", type));
+                    }
+                    processorChain.process(type, json, null);
+                } catch (Exception e) {
+                    log.error("Failed to retrieve application status event message", e);
+                }
+            }
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("Application status event message delegator failed", e);
+            }
+        }
+    }
+
+    /**
+     * Terminate topology event message delegator thread.
+     */
+    public void terminate() {
+        terminated = true;
+    }
+
+
+    private EventMessage jsonToEventMessage(String json) {
+
+        EventMessage event = new EventMessage();
+        String message;
+
+        //split the message to 3 parts using ':' first is class name, second contains the text 'message' and the third contains
+        //message
+        String[] MessageParts = json.split(":", 3);
+
+        String eventType = MessageParts[0].trim();
+        eventType = eventType.substring(eventType.indexOf("\"") + 1, eventType.lastIndexOf("\""));
+        if (log.isDebugEnabled()) {
+            log.debug(String.format("Extracted [event type] %s", eventType));
+        }
+
+        event.setEventName(eventType);
+        String messageTag = MessageParts[1];
+        messageTag = messageTag.substring(messageTag.indexOf("\"") + 1, messageTag.lastIndexOf("\""));
+
+        if ("message".equals(messageTag)) {
+            message = MessageParts[2].trim();
+            //Remove trailing bracket twice to get the message
+            message = message.substring(0, message.lastIndexOf("}")).trim();
+            message = message.substring(0, message.lastIndexOf("}")).trim();
+            if (message.indexOf('{') == 0 && message.indexOf('}') == message.length() - 1) {
+                if (log.isDebugEnabled()) {
+                    log.debug(String.format("[Extracted message] %s ", message));
+                }
+                event.setMessage(message);
+                return event;
+            }
+        }
+        return null;
+    }
+
+    private class EventMessage {
+        private String eventName;
+        private String message;
+
+        private String getEventName() {
+            return eventName;
+        }
+
+        private void setEventName(String eventName) {
+            this.eventName = eventName;
+        }
+
+        public String getMessage() {
+            return message;
+        }
+
+        public void setMessage(String message) {
+            this.message = message;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageListener.java
new file mode 100644
index 0000000..936c174
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageListener.java
@@ -0,0 +1,54 @@
+/*
+ * 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.receiver.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+public class ApplicationsEventMessageListener implements MessageListener {
+    private static final Log log = LogFactory.getLog(ApplicationsEventMessageListener.class);
+
+    private ApplicationsEventMessageQueue messageQueue;
+
+    public ApplicationsEventMessageListener(ApplicationsEventMessageQueue messageQueue) {
+        this.messageQueue = messageQueue;
+    }
+
+    @Override
+    public void onMessage(Message message) {
+        if (message instanceof TextMessage) {
+            TextMessage receivedMessage = (TextMessage) message;
+            try {
+                if (log.isDebugEnabled()) {
+                    log.debug(String.format("Tenant message received: %s", ((TextMessage) message).getText()));
+                }
+                // Add received message to the queue
+                messageQueue.add(receivedMessage);
+
+            } catch (JMSException e) {
+                log.error(e.getMessage(), e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageQueue.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageQueue.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageQueue.java
new file mode 100644
index 0000000..604513e
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageQueue.java
@@ -0,0 +1,26 @@
+/*
+ * 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.receiver.applications;
+
+
+import javax.jms.TextMessage;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class ApplicationsEventMessageQueue extends LinkedBlockingQueue<TextMessage> {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventReceiver.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventReceiver.java
new file mode 100644
index 0000000..b7577bd
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventReceiver.java
@@ -0,0 +1,83 @@
+/*
+ * 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.receiver.applications;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.broker.subscribe.TopicSubscriber;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.util.Constants;
+
+public class ApplicationsEventReceiver implements Runnable {
+    private static final Log log = LogFactory.getLog(ApplicationsEventReceiver.class);
+
+    private ApplicationsEventMessageDelegator messageDelegator;
+    private ApplicationsEventMessageListener messageListener;
+    private TopicSubscriber topicSubscriber;
+    private boolean terminated;
+
+    public ApplicationsEventReceiver() {
+        ApplicationsEventMessageQueue messageQueue = new ApplicationsEventMessageQueue();
+        this.messageDelegator = new ApplicationsEventMessageDelegator(messageQueue);
+        this.messageListener = new ApplicationsEventMessageListener(messageQueue);
+    }
+
+    public void addEventListener(EventListener eventListener) {
+        messageDelegator.addEventListener(eventListener);
+    }
+
+    @Override
+    public void run() {
+        try {
+            // Start topic subscriber thread
+            topicSubscriber = new TopicSubscriber(Constants.APPLICATIONS_TOPIC);
+            topicSubscriber.setMessageListener(messageListener);
+            Thread subscriberThread = new Thread(topicSubscriber);
+            subscriberThread.start();
+            if (log.isDebugEnabled()) {
+                log.debug("Application status event message receiver thread started");
+            }
+
+            // Start Application status event message delegator thread
+            Thread receiverThread = new Thread(messageDelegator);
+            receiverThread.start();
+            if (log.isDebugEnabled()) {
+                log.debug("Application status event message delegator thread started");
+            }
+
+            // Keep the thread live until terminated
+            while (!terminated) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException ignore) {
+                }
+            }
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("Application status failed", e);
+            }
+        }
+    }
+
+    public void terminate() {
+        topicSubscriber.terminate();
+        messageDelegator.terminate();
+        terminated = true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageDelegator.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageDelegator.java
new file mode 100644
index 0000000..a2fed87
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageDelegator.java
@@ -0,0 +1,146 @@
+/*
+ * 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.receiver.cluster.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
+import org.apache.stratos.messaging.message.processor.cluster.status.ClusterStatusMessageProcessorChain;
+import org.apache.stratos.messaging.util.Constants;
+
+import javax.jms.TextMessage;
+
+public class ClusterStatusEventMessageDelegator implements Runnable {
+    private static final Log log = LogFactory.getLog(ClusterStatusEventMessageDelegator.class);
+
+    private ClusterStatusEventMessageQueue messageQueue;
+    private MessageProcessorChain processorChain;
+    private boolean terminated;
+
+    public ClusterStatusEventMessageDelegator(ClusterStatusEventMessageQueue messageQueue) {
+        this.messageQueue = messageQueue;
+        this.processorChain = new ClusterStatusMessageProcessorChain();
+    }
+
+    public void addEventListener(EventListener eventListener) {
+        processorChain.addEventListener(eventListener);
+    }
+
+    @Override
+    public void run() {
+        try {
+            if (log.isInfoEnabled()) {
+                log.info("Application status event message delegator started");
+            }
+
+            while (!terminated) {
+                try {
+                    TextMessage message = messageQueue.take();
+
+                    // Retrieve the header
+                    String type = message.getStringProperty(Constants.EVENT_CLASS_NAME);
+
+                    // Retrieve the actual message
+                    String json = message.getText();
+
+                    if (log.isDebugEnabled()) {
+                        log.debug(String.format("Application status event message received from queue: %s", type));
+                    }
+
+                    // Delegate message to message processor chain
+                    if (log.isDebugEnabled()) {
+                        log.debug(String.format("Delegating application status event message: %s", type));
+                    }
+                    processorChain.process(type, json, null);
+                } catch (Exception e) {
+                    log.error("Failed to retrieve application status event message", e);
+                }
+            }
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("Application status event message delegator failed", e);
+            }
+        }
+    }
+
+    /**
+     * Terminate topology event message delegator thread.
+     */
+    public void terminate() {
+        terminated = true;
+    }
+
+
+    private EventMessage jsonToEventMessage(String json) {
+
+        EventMessage event = new EventMessage();
+        String message;
+
+        //split the message to 3 parts using ':' first is class name, second contains the text 'message' and the third contains
+        //message
+        String[] MessageParts = json.split(":", 3);
+
+        String eventType = MessageParts[0].trim();
+        eventType = eventType.substring(eventType.indexOf("\"") + 1, eventType.lastIndexOf("\""));
+        if (log.isDebugEnabled()) {
+            log.debug(String.format("Extracted [event type] %s", eventType));
+        }
+
+        event.setEventName(eventType);
+        String messageTag = MessageParts[1];
+        messageTag = messageTag.substring(messageTag.indexOf("\"") + 1, messageTag.lastIndexOf("\""));
+
+        if ("message".equals(messageTag)) {
+            message = MessageParts[2].trim();
+            //Remove trailing bracket twice to get the message
+            message = message.substring(0, message.lastIndexOf("}")).trim();
+            message = message.substring(0, message.lastIndexOf("}")).trim();
+            if (message.indexOf('{') == 0 && message.indexOf('}') == message.length() - 1) {
+                if (log.isDebugEnabled()) {
+                    log.debug(String.format("[Extracted message] %s ", message));
+                }
+                event.setMessage(message);
+                return event;
+            }
+        }
+        return null;
+    }
+
+    private class EventMessage {
+        private String eventName;
+        private String message;
+
+        private String getEventName() {
+            return eventName;
+        }
+
+        private void setEventName(String eventName) {
+            this.eventName = eventName;
+        }
+
+        public String getMessage() {
+            return message;
+        }
+
+        public void setMessage(String message) {
+            this.message = message;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageListener.java
new file mode 100644
index 0000000..12c7800
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageListener.java
@@ -0,0 +1,54 @@
+/*
+ * 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.receiver.cluster.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+public class ClusterStatusEventMessageListener implements MessageListener {
+    private static final Log log = LogFactory.getLog(ClusterStatusEventMessageListener.class);
+
+    private ClusterStatusEventMessageQueue messageQueue;
+
+    public ClusterStatusEventMessageListener(ClusterStatusEventMessageQueue messageQueue) {
+        this.messageQueue = messageQueue;
+    }
+
+    @Override
+    public void onMessage(Message message) {
+        if (message instanceof TextMessage) {
+            TextMessage receivedMessage = (TextMessage) message;
+            try {
+                if (log.isDebugEnabled()) {
+                    log.debug(String.format("Tenant message received: %s", ((TextMessage) message).getText()));
+                }
+                // Add received message to the queue
+                messageQueue.add(receivedMessage);
+
+            } catch (JMSException e) {
+                log.error(e.getMessage(), e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageQueue.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageQueue.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageQueue.java
new file mode 100644
index 0000000..9656800
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageQueue.java
@@ -0,0 +1,26 @@
+/*
+ * 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.receiver.cluster.status;
+
+
+import javax.jms.TextMessage;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class ClusterStatusEventMessageQueue extends LinkedBlockingQueue<TextMessage> {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventReceiver.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventReceiver.java
new file mode 100644
index 0000000..72ccaed
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventReceiver.java
@@ -0,0 +1,83 @@
+/*
+ * 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.receiver.cluster.status;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.broker.subscribe.TopicSubscriber;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.util.Constants;
+
+public class ClusterStatusEventReceiver implements Runnable {
+    private static final Log log = LogFactory.getLog(ClusterStatusEventReceiver.class);
+
+    private ClusterStatusEventMessageDelegator messageDelegator;
+    private ClusterStatusEventMessageListener messageListener;
+    private TopicSubscriber topicSubscriber;
+    private boolean terminated;
+
+    public ClusterStatusEventReceiver() {
+        ClusterStatusEventMessageQueue messageQueue = new ClusterStatusEventMessageQueue();
+        this.messageDelegator = new ClusterStatusEventMessageDelegator(messageQueue);
+        this.messageListener = new ClusterStatusEventMessageListener(messageQueue);
+    }
+
+    public void addEventListener(EventListener eventListener) {
+        messageDelegator.addEventListener(eventListener);
+    }
+
+    @Override
+    public void run() {
+        try {
+            // Start topic subscriber thread
+            topicSubscriber = new TopicSubscriber(Constants.CLUSTER_STATUS_TOPIC);
+            topicSubscriber.setMessageListener(messageListener);
+            Thread subscriberThread = new Thread(topicSubscriber);
+            subscriberThread.start();
+            if (log.isDebugEnabled()) {
+                log.debug("Application status event message receiver thread started");
+            }
+
+            // Start Application status event message delegator thread
+            Thread receiverThread = new Thread(messageDelegator);
+            receiverThread.start();
+            if (log.isDebugEnabled()) {
+                log.debug("Application status event message delegator thread started");
+            }
+
+            // Keep the thread live until terminated
+            while (!terminated) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException ignore) {
+                }
+            }
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("Application status failed", e);
+            }
+        }
+    }
+
+    public void terminate() {
+        topicSubscriber.terminate();
+        messageDelegator.terminate();
+        terminated = true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Constants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Constants.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Constants.java
index 33f2f22..2d2d532 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Constants.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Constants.java
@@ -24,7 +24,9 @@ public class Constants {
 	public static final String HEALTH_STAT_TOPIC = "summarized-health-stats";
     public static final String INSTANCE_STATUS_TOPIC = "instance-status";
     public static final String INSTANCE_NOTIFIER_TOPIC = "instance-notifier";
-    public static final String APPLICATION_STATUS_TOPIC = "application-status";
+    public static final String APPLICATIONS_TOPIC = "applications";
+    public static final String CLUSTER_STATUS_TOPIC = "applications";
+
     public static final String PING_TOPIC = "ping";
     public static final String TENANT_TOPIC = "tenant";
     public static final String TENANT_RANGE_ALL = "*";


[10/10] git commit: removing application status and adding applications, cluster status topic

Posted by re...@apache.org.
removing application status and adding applications, cluster status topic


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

Branch: refs/heads/4.0.0-grouping
Commit: 275ba2dd6757a652450246e3843c3c25366a8327
Parents: ea9337d
Author: reka <rt...@gmail.com>
Authored: Fri Oct 31 13:20:57 2014 +0530
Committer: reka <rt...@gmail.com>
Committed: Fri Oct 31 13:20:57 2014 +0530

----------------------------------------------------------------------
 .../topic/ApplicationsEventPublisher.java       | 238 ++++++++++++
 .../topic/ClusterStatusEventPublisher.java      | 171 +++++++++
 .../grouping/topic/StatusEventPublisher.java    | 361 -------------------
 .../AutoscalerTopologyEventReceiver.java        |  25 +-
 .../monitor/ParentComponentMonitor.java         |  11 +-
 .../monitor/cluster/ClusterMonitor.java         |   5 +-
 .../autoscaler/monitor/group/GroupMonitor.java  |   4 +-
 .../status/checker/StatusChecker.java           |  26 +-
 .../ApplicationStatusTopicReceiver.java         | 112 +-----
 .../internal/CloudControllerDSComponent.java    |   1 -
 .../controller/topology/TopologyBuilder.java    |  11 +-
 .../StratosManagerTopologyEventReceiver.java    |   6 +-
 .../applications/AppClusterActivatedEvent.java  |  50 ---
 .../applications/AppClusterCreatedEvent.java    |  50 ---
 .../applications/AppClusterInactivateEvent.java |  50 ---
 .../applications/AppClusterTerminatedEvent.java |  50 ---
 .../AppClusterTerminatingEvent.java             |  50 ---
 .../AppStatusGroupInactivateEvent.java          |   6 +-
 .../applications/ApplicationActivatedEvent.java |   4 +-
 .../applications/ApplicationCreatedEvent.java   |   4 +-
 .../ApplicationInactivatedEvent.java            |   4 +-
 .../ApplicationTerminatedEvent.java             |   3 +-
 .../ApplicationTerminatingEvent.java            |   4 +-
 .../event/applications/GroupActivatedEvent.java |   6 +-
 .../event/applications/GroupCreatedEvent.java   |   6 +-
 .../applications/GroupMaintenanceModeEvent.java |   6 +-
 .../applications/GroupReadyToShutdownEvent.java |   6 +-
 .../applications/GroupTerminatedEvent.java      |   6 +-
 .../applications/GroupTerminatingEvent.java     |   6 +-
 .../event/applications/StatusEvent.java         |  31 --
 .../ClusterStatusClusterActivatedEvent.java     |  52 +++
 .../ClusterStatusClusterCreatedEvent.java       |  52 +++
 .../ClusterStatusClusterInactivateEvent.java    |  52 +++
 .../ClusterStatusClusterTerminatedEvent.java    |  52 +++
 .../ClusterStatusClusterTerminatingEvent.java   |  52 +++
 .../AppClusterActivatedEventListener.java       |  24 --
 .../AppClusterCreatedEventListener.java         |  24 --
 .../AppClusterInactivateEventListener.java      |  24 --
 .../AppClusterTerminatedEventListener.java      |  24 --
 .../AppClusterTerminatingEventListener.java     |  24 --
 ...sterStatusClusterActivatedEventListener.java |  24 ++
 ...lusterStatusClusterCreatedEventListener.java |  24 ++
 ...terStatusClusterInactivateEventListener.java |  24 ++
 ...terStatusClusterTerminatedEventListener.java |  24 ++
 ...erStatusClusterTerminatingEventListener.java |  24 ++
 .../AppClusterActivatedMessageProcessor.java    |  57 ---
 .../AppClusterCreatedMessageProcessor.java      |  57 ---
 .../AppClusterInactivateMessageProcessor.java   |  58 ---
 .../AppClusterTerminatedMessageProcessor.java   |  58 ---
 .../AppClusterTerminatingMessageProcessor.java  |  58 ---
 .../AppStatusMessageProcessorChain.java         | 139 -------
 .../ApplicationActivatedMessageProcessor.java   |  68 +++-
 .../ApplicationCreatedMessageProcessor.java     |  92 ++++-
 .../ApplicationInactivatedMessageProcessor.java |  67 +++-
 .../ApplicationTerminatedMessageProcessor.java  |  99 ++++-
 .../ApplicationTerminatingMessageProcessor.java |  67 +++-
 .../ApplicationUndeployedMessageProcessor.java  | 139 +++++++
 .../ApplicationsMessageProcessorChain.java      | 115 ++++++
 .../GroupActivatedMessageProcessor.java         |  61 ----
 .../applications/GroupActivatedProcessor.java   | 107 ++++++
 .../GroupCreatedMessageProcessor.java           |  61 ----
 .../applications/GroupCreatedProcessor.java     | 108 ++++++
 .../applications/GroupInActivateProcessor.java  | 106 ++++++
 .../GroupInactivatedMessageProcessor.java       |  61 ----
 .../GroupTerminatedMessageProcessor.java        |  61 ----
 .../applications/GroupTerminatedProcessor.java  | 107 ++++++
 .../GroupTerminatingMessageProcessor.java       |  61 ----
 .../applications/GroupTerminatingProcessor.java | 107 ++++++
 ...rStatusClusterActivatedMessageProcessor.java |  58 +++
 ...terStatusClusterCreatedMessageProcessor.java |  58 +++
 ...StatusClusterInactivateMessageProcessor.java |  58 +++
 ...StatusClusterTerminatedMessageProcessor.java |  58 +++
 ...tatusClusterTerminatingMessageProcessor.java |  58 +++
 .../ClusterStatusMessageProcessorChain.java     |  78 ++++
 .../ApplicationActivatedMessageProcessor.java   | 104 ------
 .../ApplicationCreatedMessageProcessor.java     | 121 -------
 .../ApplicationInactivatedMessageProcessor.java | 104 ------
 .../ApplicationTerminatedMessageProcessor.java  | 136 -------
 .../ApplicationTerminatingMessageProcessor.java | 104 ------
 .../ApplicationUndeployedMessageProcessor.java  | 139 -------
 .../topology/GroupActivatedProcessor.java       | 107 ------
 .../topology/GroupCreatedProcessor.java         | 108 ------
 .../topology/GroupInActivateProcessor.java      | 106 ------
 .../topology/GroupTerminatedProcessor.java      | 107 ------
 .../topology/GroupTerminatingProcessor.java     | 107 ------
 .../topology/TopologyMessageProcessorChain.java |  70 +---
 .../ApplicationStatusEventMessageDelegator.java | 146 --------
 .../ApplicationStatusEventMessageListener.java  |  54 ---
 .../ApplicationStatusEventMessageQueue.java     |  26 --
 .../status/ApplicationStatusEventReceiver.java  |  83 -----
 .../ApplicationsEventMessageDelegator.java      | 146 ++++++++
 .../ApplicationsEventMessageListener.java       |  54 +++
 .../ApplicationsEventMessageQueue.java          |  26 ++
 .../applications/ApplicationsEventReceiver.java |  83 +++++
 .../ClusterStatusEventMessageDelegator.java     | 146 ++++++++
 .../ClusterStatusEventMessageListener.java      |  54 +++
 .../status/ClusterStatusEventMessageQueue.java  |  26 ++
 .../status/ClusterStatusEventReceiver.java      |  83 +++++
 .../stratos/messaging/util/Constants.java       |   4 +-
 99 files changed, 3004 insertions(+), 3335 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/ApplicationsEventPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/ApplicationsEventPublisher.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/ApplicationsEventPublisher.java
new file mode 100644
index 0000000..1fbc143
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/ApplicationsEventPublisher.java
@@ -0,0 +1,238 @@
+package org.apache.stratos.autoscaler.grouping.topic;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.broker.publish.EventPublisher;
+import org.apache.stratos.messaging.broker.publish.EventPublisherPool;
+import org.apache.stratos.messaging.domain.applications.*;
+import org.apache.stratos.messaging.domain.topology.*;
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.event.applications.*;
+import org.apache.stratos.messaging.event.cluster.status.*;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
+import org.apache.stratos.messaging.util.Constants;
+
+import java.util.Set;
+
+/**
+ * This will publish application related events to application status topic.
+ */
+public class ApplicationsEventPublisher {
+    private static final Log log = LogFactory.getLog(ApplicationsEventPublisher.class);
+
+
+    public static void sendGroupCreatedEvent(String appId, String groupId) {
+        try {
+            TopologyManager.acquireReadLockForApplication(appId);
+            Application application = TopologyManager.getTopology().getApplication(appId);
+            if (application != null) {
+                Group group = application.getGroupRecursively(groupId);
+                if (group.isStateTransitionValid(GroupStatus.Created)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Group created event for [application]: " + appId +
+                                " [group]: " + groupId);
+                    }
+                    GroupCreatedEvent groupCreatedEvent =
+                            new GroupCreatedEvent(appId, groupId);
+
+                    publishEvent(groupCreatedEvent);
+                } else {
+                    log.warn("Created is not in the possible state list of [group] " + groupId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForApplication(appId);
+        }
+    }
+
+    public static void sendGroupActivatedEvent(String appId, String groupId) {
+        try {
+            TopologyManager.acquireReadLockForApplication(appId);
+            Application application = TopologyManager.getTopology().getApplication(appId);
+            if (application != null) {
+                Group group = application.getGroupRecursively(groupId);
+                if (group.isStateTransitionValid(GroupStatus.Active)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Group activated event for [application]: " + appId +
+                                " [group]: " + groupId);
+                    }
+                    GroupActivatedEvent groupActivatedEvent =
+                            new GroupActivatedEvent(appId, groupId);
+
+                    publishEvent(groupActivatedEvent);
+                } else {
+                    log.warn("Active is not in the possible state list of [group] " + groupId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForApplication(appId);
+        }
+    }
+
+    public static void sendGroupInActivateEvent(String appId, String groupId) {
+        try {
+            TopologyManager.acquireReadLockForApplication(appId);
+            Application application = TopologyManager.getTopology().getApplication(appId);
+            if (application != null) {
+                Group group = application.getGroupRecursively(groupId);
+                if (group.isStateTransitionValid(GroupStatus.Inactive)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Group in-activate event for [application]: " + appId +
+                                " [group]: " + groupId);
+                    }
+                    AppStatusGroupInactivateEvent appStatusGroupInactivateEvent = new
+                            AppStatusGroupInactivateEvent(appId, groupId);
+
+                    publishEvent(appStatusGroupInactivateEvent);
+                } else {
+                    log.warn("InActive is not in the possible state list of [group] " + groupId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForApplication(appId);
+        }
+    }
+
+    public static void sendGroupTerminatingEvent(String appId, String groupId) {
+        try {
+            TopologyManager.acquireReadLockForApplication(appId);
+            Application application = TopologyManager.getTopology().getApplication(appId);
+            if (application != null) {
+                Group group = application.getGroupRecursively(groupId);
+                if (group.isStateTransitionValid(GroupStatus.Terminating)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Group terminating event for [application]: " + appId +
+                                " [group]: " + groupId);
+                    }
+                    GroupTerminatingEvent groupInTerminatingEvent =
+                            new GroupTerminatingEvent(appId, groupId);
+                    publishEvent(groupInTerminatingEvent);
+                } else {
+                    log.warn("Terminating is not in the possible state list of [group] " + groupId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForApplication(appId);
+        }
+    }
+
+    public static void sendGroupTerminatedEvent(String appId, String groupId) {
+
+        if (log.isInfoEnabled()) {
+            log.info("Publishing Group terminated event for [application]: " + appId +
+                    " [group]: " + groupId);
+        }
+
+        try {
+            TopologyManager.acquireReadLockForApplication(appId);
+            Application application = TopologyManager.getTopology().getApplication(appId);
+            if (application != null) {
+                Group group = application.getGroupRecursively(groupId);
+                if (group.isStateTransitionValid(GroupStatus.Terminated)) {
+                    GroupTerminatedEvent groupInTerminatedEvent =
+                            new GroupTerminatedEvent(appId, groupId);
+                    publishEvent(groupInTerminatedEvent);
+                } else {
+                    log.warn("Terminated is not in the possible state list of [group] " + groupId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForApplication(appId);
+        }
+
+
+    }
+
+    public static void sendApplicationActivatedEvent(String appId) {
+        try {
+            TopologyManager.acquireReadLockForApplication(appId);
+            Application application = TopologyManager.getTopology().getApplication(appId);
+            if (application != null) {
+                if (application.isStateTransitionValid(ApplicationStatus.Active)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Application activated event for [application]: " + appId);
+                    }
+                    ApplicationActivatedEvent applicationActivatedEvent =
+                            new ApplicationActivatedEvent(appId);
+
+                    publishEvent(applicationActivatedEvent);
+                } else {
+                    log.warn("Active is not in the possible state list of [application] " + appId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForApplication(appId);
+        }
+    }
+
+    public static void sendApplicationInactivatedEvent(String appId) {
+        if (log.isInfoEnabled()) {
+            log.info("Publishing Application In-activated event for [application]: " + appId);
+        }
+
+        try {
+            TopologyManager.acquireReadLockForApplication(appId);
+            Application application = TopologyManager.getTopology().getApplication(appId);
+            if (application != null) {
+                if (application.isStateTransitionValid(ApplicationStatus.Inactive)) {
+                    ApplicationInactivatedEvent applicationInActivatedEvent =
+                            new ApplicationInactivatedEvent(appId);
+                    publishEvent(applicationInActivatedEvent);
+                } else {
+                    log.warn("Inactive is not in the possible state list of [application] " + appId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForApplication(appId);
+        }
+    }
+
+    public static void sendApplicationTerminatingEvent(String appId) {
+        try {
+            TopologyManager.acquireReadLockForApplication(appId);
+            Application application = TopologyManager.getTopology().getApplication(appId);
+            if (application != null) {
+                if (application.isStateTransitionValid(ApplicationStatus.Terminating)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Application terminated event for [application]: " + appId);
+                    }
+                    ApplicationTerminatingEvent applicationTerminatingEvent =
+                            new ApplicationTerminatingEvent(appId);
+                    publishEvent(applicationTerminatingEvent);
+                } else {
+                    log.warn("Terminating is not in the possible state list of [application] " + appId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForApplication(appId);
+        }
+    }
+
+    public static void sendApplicationTerminatedEvent(String appId, Set<ClusterDataHolder> clusterData) {
+        try {
+            TopologyManager.acquireReadLockForApplication(appId);
+            Application application = TopologyManager.getTopology().getApplication(appId);
+            if (application != null) {
+                if (application.isStateTransitionValid(ApplicationStatus.Terminated)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Application terminated event for [application]: " + appId);
+                    }
+                    ApplicationTerminatedEvent applicationTerminatedEvent =
+                            new ApplicationTerminatedEvent(appId, clusterData);
+                    publishEvent(applicationTerminatedEvent);
+                } else {
+                    log.warn("Terminated is not in the possible state list of [application] " + appId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForApplication(appId);
+        }
+    }
+
+    public static void publishEvent(Event event) {
+        //publishing events to application status topic
+        EventPublisher eventPublisher = EventPublisherPool.getPublisher(Constants.APPLICATIONS_TOPIC);
+        eventPublisher.publish(event);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/ClusterStatusEventPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/ClusterStatusEventPublisher.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/ClusterStatusEventPublisher.java
new file mode 100644
index 0000000..2a05b2e
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/ClusterStatusEventPublisher.java
@@ -0,0 +1,171 @@
+/*
+ * 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.autoscaler.grouping.topic;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.broker.publish.EventPublisher;
+import org.apache.stratos.messaging.broker.publish.EventPublisherPool;
+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.event.Event;
+import org.apache.stratos.messaging.event.cluster.status.*;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
+import org.apache.stratos.messaging.util.Constants;
+
+/**
+ * This will publish cluster status events to cluster-status topic
+ */
+public class ClusterStatusEventPublisher {
+    private static final Log log = LogFactory.getLog(ClusterStatusEventPublisher.class);
+
+
+    public static void sendClusterCreatedEvent(String appId, String serviceName, String clusterId) {
+        try {
+            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
+            Service service = TopologyManager.getTopology().getService(serviceName);
+            if (service != null) {
+                Cluster cluster = service.getCluster(clusterId);
+                if (cluster.isStateTransitionValid(ClusterStatus.Created)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Cluster created event for [application]: " + appId +
+                                " [cluster]: " + clusterId);
+                    }
+                    ClusterStatusClusterCreatedEvent clusterCreatedEvent =
+                            new ClusterStatusClusterCreatedEvent(appId, serviceName, clusterId);
+
+                    publishEvent(clusterCreatedEvent);
+                } else {
+                    log.warn("Created is not in the possible state list of [cluster] " + clusterId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
+        }
+    }
+
+    public static void sendClusterActivatedEvent(String appId, String serviceName, String clusterId) {
+        try {
+            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
+            Service service = TopologyManager.getTopology().getService(serviceName);
+            if (service != null) {
+                Cluster cluster = service.getCluster(clusterId);
+                if (cluster.isStateTransitionValid(ClusterStatus.Active)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Cluster activated event for [application]: " + appId +
+                                " [cluster]: " + clusterId);
+                    }
+                    ClusterStatusClusterActivatedEvent clusterActivatedEvent =
+                            new ClusterStatusClusterActivatedEvent(appId, serviceName, clusterId);
+
+                    publishEvent(clusterActivatedEvent);
+                } else {
+                    log.warn("Active is not in the possible state list of [cluster] " + clusterId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
+        }
+    }
+
+    public static void sendClusterInActivateEvent(String appId, String serviceName, String clusterId) {
+        try {
+            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
+            Service service = TopologyManager.getTopology().getService(serviceName);
+            if (service != null) {
+                Cluster cluster = service.getCluster(clusterId);
+                if (cluster.isStateTransitionValid(ClusterStatus.Inactive)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Cluster in-activate event for [application]: " + appId +
+                                " [cluster]: " + clusterId);
+                    }
+                    ClusterStatusClusterInactivateEvent clusterInActivateEvent =
+                            new ClusterStatusClusterInactivateEvent(appId, serviceName, clusterId);
+
+                    publishEvent(clusterInActivateEvent);
+                } else {
+                    log.warn("In-active is not in the possible state list of [cluster] " + clusterId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
+
+        }
+    }
+
+    public static void sendClusterTerminatingEvent(String appId, String serviceName, String clusterId) {
+
+        try {
+            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
+            Service service = TopologyManager.getTopology().getService(serviceName);
+            if (service != null) {
+                Cluster cluster = service.getCluster(clusterId);
+                if (cluster.isStateTransitionValid(ClusterStatus.Terminating)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Cluster Terminating event for [application]: " + appId +
+                                " [cluster]: " + clusterId);
+                    }
+                    ClusterStatusClusterTerminatingEvent appStatusClusterTerminatingEvent =
+                            new ClusterStatusClusterTerminatingEvent(appId, serviceName, clusterId);
+
+                    publishEvent(appStatusClusterTerminatingEvent);
+                } else {
+                    log.warn("Terminating is not in the possible state list of [cluster] " + clusterId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
+
+        }
+
+    }
+
+    public static void sendClusterTerminatedEvent(String appId, String serviceName, String clusterId) {
+        try {
+            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
+            Service service = TopologyManager.getTopology().getService(serviceName);
+            if (service != null) {
+                Cluster cluster = service.getCluster(clusterId);
+                if (cluster.isStateTransitionValid(ClusterStatus.Terminated)) {
+                    if (log.isInfoEnabled()) {
+                        log.info("Publishing Cluster terminated event for [application]: " + appId +
+                                " [cluster]: " + clusterId);
+                    }
+                    ClusterStatusClusterTerminatedEvent appStatusClusterTerminatedEvent =
+                            new ClusterStatusClusterTerminatedEvent(appId, serviceName, clusterId);
+
+                    publishEvent(appStatusClusterTerminatedEvent);
+                } else {
+                    log.warn("Terminated is not in the possible state list of [cluster] " + clusterId);
+                }
+            }
+        } finally {
+            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
+
+        }
+    }
+
+
+    public static void publishEvent(Event event) {
+        //publishing events to application status topic
+        EventPublisher eventPublisher = EventPublisherPool.getPublisher(Constants.CLUSTER_STATUS_TOPIC);
+        eventPublisher.publish(event);
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/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
deleted file mode 100644
index c0e77de..0000000
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java
+++ /dev/null
@@ -1,361 +0,0 @@
-package org.apache.stratos.autoscaler.grouping.topic;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.broker.publish.EventPublisher;
-import org.apache.stratos.messaging.broker.publish.EventPublisherPool;
-import org.apache.stratos.messaging.domain.applications.*;
-import org.apache.stratos.messaging.domain.topology.*;
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.applications.*;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-import org.apache.stratos.messaging.util.Constants;
-
-import java.util.Set;
-
-/**
- * This will publish application related events to application status topic.
- */
-public class StatusEventPublisher {
-    private static final Log log = LogFactory.getLog(StatusEventPublisher.class);
-
-    public static void sendClusterCreatedEvent(String appId, String serviceName, String clusterId) {
-        try {
-            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
-            Service service = TopologyManager.getTopology().getService(serviceName);
-            if (service != null) {
-                Cluster cluster = service.getCluster(clusterId);
-                if (cluster.isStateTransitionValid(ClusterStatus.Created)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Cluster created event for [application]: " + appId +
-                                " [cluster]: " + clusterId);
-                    }
-                    AppClusterCreatedEvent clusterCreatedEvent =
-                            new AppClusterCreatedEvent(appId, serviceName, clusterId);
-
-                    publishEvent(clusterCreatedEvent);
-                } else {
-                    log.warn("Created is not in the possible state list of [cluster] " + clusterId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
-        }
-    }
-
-    public static void sendClusterActivatedEvent(String appId, String serviceName, String clusterId) {
-        try {
-            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
-            Service service = TopologyManager.getTopology().getService(serviceName);
-            if (service != null) {
-                Cluster cluster = service.getCluster(clusterId);
-                if (cluster.isStateTransitionValid(ClusterStatus.Active)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Cluster activated event for [application]: " + appId +
-                                " [cluster]: " + clusterId);
-                    }
-                    AppClusterActivatedEvent clusterActivatedEvent =
-                            new AppClusterActivatedEvent(appId, serviceName, clusterId);
-
-                    publishEvent(clusterActivatedEvent);
-                } else {
-                    log.warn("Active is not in the possible state list of [cluster] " + clusterId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
-        }
-    }
-
-    public static void sendClusterInActivateEvent(String appId, String serviceName, String clusterId) {
-        try {
-            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
-            Service service = TopologyManager.getTopology().getService(serviceName);
-            if (service != null) {
-                Cluster cluster = service.getCluster(clusterId);
-                if (cluster.isStateTransitionValid(ClusterStatus.Inactive)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Cluster in-activate event for [application]: " + appId +
-                                " [cluster]: " + clusterId);
-                    }
-                    AppClusterInactivateEvent clusterInActivateEvent =
-                            new AppClusterInactivateEvent(appId, serviceName, clusterId);
-
-                    publishEvent(clusterInActivateEvent);
-                } else {
-                    log.warn("In-active is not in the possible state list of [cluster] " + clusterId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
-
-        }
-    }
-
-    public static void sendClusterTerminatingEvent(String appId, String serviceName, String clusterId) {
-
-        try {
-            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
-            Service service = TopologyManager.getTopology().getService(serviceName);
-            if (service != null) {
-                Cluster cluster = service.getCluster(clusterId);
-                if (cluster.isStateTransitionValid(ClusterStatus.Terminating)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Cluster Terminating event for [application]: " + appId +
-                                " [cluster]: " + clusterId);
-                    }
-                    AppClusterTerminatingEvent appStatusClusterTerminatingEvent =
-                            new AppClusterTerminatingEvent(appId, serviceName, clusterId);
-
-                    publishEvent(appStatusClusterTerminatingEvent);
-                } else {
-                    log.warn("Terminating is not in the possible state list of [cluster] " + clusterId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
-
-        }
-
-    }
-
-    public static void sendClusterTerminatedEvent(String appId, String serviceName, String clusterId) {
-        try {
-            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
-            Service service = TopologyManager.getTopology().getService(serviceName);
-            if (service != null) {
-                Cluster cluster = service.getCluster(clusterId);
-                if (cluster.isStateTransitionValid(ClusterStatus.Terminated)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Cluster terminated event for [application]: " + appId +
-                                " [cluster]: " + clusterId);
-                    }
-                    AppClusterTerminatedEvent appStatusClusterTerminatedEvent =
-                            new AppClusterTerminatedEvent(appId, serviceName, clusterId);
-
-                    publishEvent(appStatusClusterTerminatedEvent);
-                } else {
-                    log.warn("Terminated is not in the possible state list of [cluster] " + clusterId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
-
-        }
-    }
-
-    public static void sendGroupCreatedEvent(String appId, String groupId) {
-        try {
-            TopologyManager.acquireReadLockForApplication(appId);
-            Application application = TopologyManager.getTopology().getApplication(appId);
-            if (application != null) {
-                Group group = application.getGroupRecursively(groupId);
-                if (group.isStateTransitionValid(GroupStatus.Created)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Group created event for [application]: " + appId +
-                                " [group]: " + groupId);
-                    }
-                    GroupCreatedEvent groupCreatedEvent =
-                            new GroupCreatedEvent(appId, groupId);
-
-                    publishEvent(groupCreatedEvent);
-                } else {
-                    log.warn("Created is not in the possible state list of [group] " + groupId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForApplication(appId);
-        }
-    }
-
-    public static void sendGroupActivatedEvent(String appId, String groupId) {
-        try {
-            TopologyManager.acquireReadLockForApplication(appId);
-            Application application = TopologyManager.getTopology().getApplication(appId);
-            if (application != null) {
-                Group group = application.getGroupRecursively(groupId);
-                if (group.isStateTransitionValid(GroupStatus.Active)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Group activated event for [application]: " + appId +
-                                " [group]: " + groupId);
-                    }
-                    GroupActivatedEvent groupActivatedEvent =
-                            new GroupActivatedEvent(appId, groupId);
-
-                    publishEvent(groupActivatedEvent);
-                } else {
-                    log.warn("Active is not in the possible state list of [group] " + groupId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForApplication(appId);
-        }
-    }
-
-    public static void sendGroupInActivateEvent(String appId, String groupId) {
-        try {
-            TopologyManager.acquireReadLockForApplication(appId);
-            Application application = TopologyManager.getTopology().getApplication(appId);
-            if (application != null) {
-                Group group = application.getGroupRecursively(groupId);
-                if (group.isStateTransitionValid(GroupStatus.Inactive)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Group in-activate event for [application]: " + appId +
-                                " [group]: " + groupId);
-                    }
-                    AppStatusGroupInactivateEvent appStatusGroupInactivateEvent = new
-                            AppStatusGroupInactivateEvent(appId, groupId);
-
-                    publishEvent(appStatusGroupInactivateEvent);
-                } else {
-                    log.warn("InActive is not in the possible state list of [group] " + groupId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForApplication(appId);
-        }
-    }
-
-    public static void sendGroupTerminatingEvent(String appId, String groupId) {
-        try {
-            TopologyManager.acquireReadLockForApplication(appId);
-            Application application = TopologyManager.getTopology().getApplication(appId);
-            if (application != null) {
-                Group group = application.getGroupRecursively(groupId);
-                if (group.isStateTransitionValid(GroupStatus.Terminating)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Group terminating event for [application]: " + appId +
-                                " [group]: " + groupId);
-                    }
-                    GroupTerminatingEvent groupInTerminatingEvent =
-                            new GroupTerminatingEvent(appId, groupId);
-                    publishEvent(groupInTerminatingEvent);
-                } else {
-                    log.warn("Terminating is not in the possible state list of [group] " + groupId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForApplication(appId);
-        }
-    }
-
-    public static void sendGroupTerminatedEvent(String appId, String groupId) {
-
-        if (log.isInfoEnabled()) {
-            log.info("Publishing Group terminated event for [application]: " + appId +
-                    " [group]: " + groupId);
-        }
-
-        try {
-            TopologyManager.acquireReadLockForApplication(appId);
-            Application application = TopologyManager.getTopology().getApplication(appId);
-            if (application != null) {
-                Group group = application.getGroupRecursively(groupId);
-                if (group.isStateTransitionValid(GroupStatus.Terminated)) {
-                    GroupTerminatedEvent groupInTerminatedEvent =
-                            new GroupTerminatedEvent(appId, groupId);
-                    publishEvent(groupInTerminatedEvent);
-                } else {
-                    log.warn("Terminated is not in the possible state list of [group] " + groupId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForApplication(appId);
-        }
-
-
-    }
-
-    public static void sendApplicationActivatedEvent(String appId) {
-        try {
-            TopologyManager.acquireReadLockForApplication(appId);
-            Application application = TopologyManager.getTopology().getApplication(appId);
-            if (application != null) {
-                if (application.isStateTransitionValid(ApplicationStatus.Active)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Application activated event for [application]: " + appId);
-                    }
-                    ApplicationActivatedEvent applicationActivatedEvent =
-                            new ApplicationActivatedEvent(appId);
-
-                    publishEvent(applicationActivatedEvent);
-                } else {
-                    log.warn("Active is not in the possible state list of [application] " + appId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForApplication(appId);
-        }
-    }
-
-    public static void sendApplicationInactivatedEvent(String appId) {
-        if (log.isInfoEnabled()) {
-            log.info("Publishing Application In-activated event for [application]: " + appId);
-        }
-
-        try {
-            TopologyManager.acquireReadLockForApplication(appId);
-            Application application = TopologyManager.getTopology().getApplication(appId);
-            if (application != null) {
-                if (application.isStateTransitionValid(ApplicationStatus.Inactive)) {
-                    ApplicationInactivatedEvent applicationInActivatedEvent =
-                            new ApplicationInactivatedEvent(appId);
-                    publishEvent(applicationInActivatedEvent);
-                } else {
-                    log.warn("Inactive is not in the possible state list of [application] " + appId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForApplication(appId);
-        }
-    }
-
-    public static void sendApplicationTerminatingEvent(String appId) {
-        try {
-            TopologyManager.acquireReadLockForApplication(appId);
-            Application application = TopologyManager.getTopology().getApplication(appId);
-            if (application != null) {
-                if (application.isStateTransitionValid(ApplicationStatus.Terminating)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Application terminated event for [application]: " + appId);
-                    }
-                    ApplicationTerminatingEvent applicationTerminatingEvent =
-                            new ApplicationTerminatingEvent(appId);
-                    publishEvent(applicationTerminatingEvent);
-                } else {
-                    log.warn("Terminating is not in the possible state list of [application] " + appId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForApplication(appId);
-        }
-    }
-
-    public static void sendApplicationTerminatedEvent(String appId, Set<ClusterDataHolder> clusterData) {
-        try {
-            TopologyManager.acquireReadLockForApplication(appId);
-            Application application = TopologyManager.getTopology().getApplication(appId);
-            if (application != null) {
-                if (application.isStateTransitionValid(ApplicationStatus.Terminated)) {
-                    if (log.isInfoEnabled()) {
-                        log.info("Publishing Application terminated event for [application]: " + appId);
-                    }
-                    ApplicationTerminatedEvent applicationTerminatedEvent =
-                            new ApplicationTerminatedEvent(appId, clusterData);
-                    publishEvent(applicationTerminatedEvent);
-                } else {
-                    log.warn("Terminated is not in the possible state list of [application] " + appId);
-                }
-            }
-        } finally {
-            TopologyManager.releaseReadLockForApplication(appId);
-        }
-    }
-
-    public static void publishEvent(Event event) {
-        //publishing events to application status topic
-        EventPublisher eventPublisher = EventPublisherPool.getPublisher(Constants.APPLICATION_STATUS_TOPIC);
-        eventPublisher.publish(event);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/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 97ba3f1..aacc31c 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
@@ -27,8 +27,9 @@ import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
 import org.apache.stratos.autoscaler.exception.DependencyBuilderException;
 import org.apache.stratos.autoscaler.exception.TerminationException;
 import org.apache.stratos.autoscaler.exception.TopologyInConsistentException;
+import org.apache.stratos.autoscaler.grouping.topic.ApplicationsEventPublisher;
+import org.apache.stratos.autoscaler.grouping.topic.ClusterStatusEventPublisher;
 import org.apache.stratos.autoscaler.grouping.topic.InstanceNotificationPublisher;
-import org.apache.stratos.autoscaler.grouping.topic.StatusEventPublisher;
 import org.apache.stratos.autoscaler.monitor.AbstractClusterMonitor;
 import org.apache.stratos.autoscaler.monitor.ApplicationMonitorFactory;
 import org.apache.stratos.autoscaler.monitor.application.ApplicationMonitor;
@@ -119,7 +120,7 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
         });
 
 
-        topologyEventReceiver.addEventListener(new ApplicationCreatedEventListener() {
+        /*topologyEventReceiver.addEventListener(new ApplicationCreatedEventListener() {
             @Override
             protected void onEvent(Event event) {
                 try {
@@ -146,7 +147,7 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
                 }
 
             }
-        });
+        });*/
 
         topologyEventReceiver.addEventListener(new ClusterActivatedEventListener() {
             @Override
@@ -252,7 +253,7 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
             }
         });
 
-        topologyEventReceiver.addEventListener(new GroupActivatedEventListener() {
+        /*topologyEventReceiver.addEventListener(new GroupActivatedEventListener() {
             @Override
             protected void onEvent(Event event) {
 
@@ -350,7 +351,7 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
                     appMonitor.setStatus(ApplicationStatus.Active);
                 }
             }
-        });
+        });*/
 
         topologyEventReceiver.addEventListener(new ApplicationUndeployedEventListener() {
             @Override
@@ -372,7 +373,7 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
                                    ((ClusterMonitor) AutoscalerContext.getInstance().getMonitor(clusterDataHolder.getClusterId()));
                         if (clusterMonitor == null) {
                             // Cluster Monitor not found; send Cluster Terminated event to cleanup
-                            StatusEventPublisher.sendClusterTerminatedEvent(
+                            ClusterStatusEventPublisher.sendClusterTerminatedEvent(
                                     applicationUndeployedEvent.getApplicationId(),
                                     clusterDataHolder.getServiceType(),
                                     clusterDataHolder.getClusterId());
@@ -390,8 +391,8 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
 
                 } else {
                     // ApplicationMonitor is not found, send Terminating event to clean up
-                    StatusEventPublisher.sendApplicationTerminatedEvent(
-                                applicationUndeployedEvent.getApplicationId(), applicationUndeployedEvent.getClusterData());
+                    ApplicationsEventPublisher.sendApplicationTerminatedEvent(
+                            applicationUndeployedEvent.getApplicationId(), applicationUndeployedEvent.getClusterData());
                 }
 
 //                ApplicationUndeployedEvent applicationUndeployedEvent = (ApplicationUndeployedEvent) event;
@@ -481,7 +482,7 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
         });
 
 
-        topologyEventReceiver.addEventListener(new ApplicationTerminatingEventListener() {
+        /*topologyEventReceiver.addEventListener(new ApplicationTerminatingEventListener() {
             @Override
             protected void onEvent(Event event) {
 
@@ -510,7 +511,7 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
                             releaseReadLockForApplication(appTerminatingEvent.getAppId());
                 }
             }
-        });
+        });*/
 
 //        topologyEventReceiver.addEventListener(new ApplicationRemovedEventListener() {
 //            @Override
@@ -566,7 +567,7 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
 //            }
 //        });
 
-        topologyEventReceiver.addEventListener(new ApplicationTerminatedEventListener() {
+        /*topologyEventReceiver.addEventListener(new ApplicationTerminatedEventListener() {
             @Override
             protected void onEvent(Event event) {
 
@@ -626,7 +627,7 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
 
             }
         });
-
+*/
         topologyEventReceiver.addEventListener(new MemberReadyToShutdownEventListener() {
             @Override
             protected void onEvent(Event event) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java
index c304027..c8f9d9c 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java
@@ -27,7 +27,8 @@ import org.apache.stratos.autoscaler.exception.TopologyInConsistentException;
 import org.apache.stratos.autoscaler.grouping.dependency.DependencyBuilder;
 import org.apache.stratos.autoscaler.grouping.dependency.DependencyTree;
 import org.apache.stratos.autoscaler.grouping.dependency.context.ApplicationContext;
-import org.apache.stratos.autoscaler.grouping.topic.StatusEventPublisher;
+import org.apache.stratos.autoscaler.grouping.topic.ApplicationsEventPublisher;
+import org.apache.stratos.autoscaler.grouping.topic.ClusterStatusEventPublisher;
 import org.apache.stratos.autoscaler.status.checker.StatusChecker;
 import org.apache.stratos.messaging.domain.applications.ParentComponent;
 
@@ -129,12 +130,12 @@ public abstract class ParentComponentMonitor extends Monitor {
             if (terminationList.size() ==
                     (this.aliasToActiveMonitorsMap.size() + this.aliasToInActiveMonitorsMap.size())) {
                 if (this.parent != null) {
-                    StatusEventPublisher.sendGroupTerminatingEvent(this.appId, this.id);
+                    ApplicationsEventPublisher.sendGroupTerminatingEvent(this.appId, this.id);
                 }
             } else {
                 //TODO application InActive
                 if (this.parent != null) {
-                    StatusEventPublisher.sendGroupInActivateEvent(this.appId, this.id);
+                    ApplicationsEventPublisher.sendGroupInActivateEvent(this.appId, this.id);
                 }
                 //Since it is reached the most independent unit and has few independent monitors,
                 // has to put the children down to terminating
@@ -149,10 +150,10 @@ public abstract class ParentComponentMonitor extends Monitor {
                         if (monitor != null) {
                             if (monitor.hasActiveMonitors()) {
                                 //it is a group
-                                StatusEventPublisher.sendGroupTerminatingEvent(this.appId,
+                                ApplicationsEventPublisher.sendGroupTerminatingEvent(this.appId,
                                         terminationContext.getId());
                             } else {
-                                StatusEventPublisher.sendClusterTerminatingEvent(this.appId,
+                                ClusterStatusEventPublisher.sendClusterTerminatingEvent(this.appId,
                                         ((AbstractClusterMonitor) monitor).getServiceId(),
                                         terminationContext.getId());
                             }

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
index 22b5e48..02c1b18 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
@@ -25,7 +25,8 @@ import org.apache.stratos.autoscaler.PartitionContext;
 import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
 import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
 import org.apache.stratos.autoscaler.exception.TerminationException;
-import org.apache.stratos.autoscaler.grouping.topic.StatusEventPublisher;
+import org.apache.stratos.autoscaler.grouping.topic.ApplicationsEventPublisher;
+import org.apache.stratos.autoscaler.grouping.topic.ClusterStatusEventPublisher;
 import org.apache.stratos.autoscaler.monitor.AbstractClusterMonitor;
 import org.apache.stratos.autoscaler.monitor.events.MonitorStatusEvent;
 import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
@@ -287,7 +288,7 @@ public class ClusterMonitor extends AbstractClusterMonitor {
         // send the ClusterTerminating event
         if (statusEvent.getStatus() == GroupStatus.Terminating || statusEvent.getStatus() ==
                 ApplicationStatus.Terminating) {
-            StatusEventPublisher.sendClusterTerminatingEvent(appId, serviceId, clusterId);
+            ClusterStatusEventPublisher.sendClusterTerminatingEvent(appId, serviceId, clusterId);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
index d48c7ae..5ee7f84 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
@@ -22,7 +22,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.autoscaler.exception.DependencyBuilderException;
 import org.apache.stratos.autoscaler.exception.TopologyInConsistentException;
-import org.apache.stratos.autoscaler.grouping.topic.StatusEventPublisher;
+import org.apache.stratos.autoscaler.grouping.topic.ApplicationsEventPublisher;
 import org.apache.stratos.autoscaler.monitor.EventHandler;
 import org.apache.stratos.autoscaler.monitor.MonitorStatusEventBuilder;
 import org.apache.stratos.autoscaler.monitor.ParentComponentMonitor;
@@ -104,7 +104,7 @@ public class GroupMonitor extends ParentComponentMonitor implements EventHandler
         // send the ClusterTerminating event
         if (statusEvent.getStatus() == GroupStatus.Terminating || statusEvent.getStatus() ==
                 ApplicationStatus.Terminating) {
-            StatusEventPublisher.sendGroupTerminatingEvent(appId, id);
+            ApplicationsEventPublisher.sendGroupTerminatingEvent(appId, id);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
index 408776f..629667a 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
@@ -23,14 +23,14 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.autoscaler.AutoscalerContext;
 import org.apache.stratos.autoscaler.NetworkPartitionContext;
 import org.apache.stratos.autoscaler.PartitionContext;
-import org.apache.stratos.autoscaler.grouping.topic.StatusEventPublisher;
+import org.apache.stratos.autoscaler.grouping.topic.ApplicationsEventPublisher;
+import org.apache.stratos.autoscaler.grouping.topic.ClusterStatusEventPublisher;
 import org.apache.stratos.autoscaler.monitor.AbstractClusterMonitor;
 import org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor;
 import org.apache.stratos.messaging.domain.applications.*;
 import org.apache.stratos.messaging.domain.topology.*;
 import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
 
-import javax.net.ssl.SSLEngineResult;
 import java.util.Map;
 
 /**
@@ -71,7 +71,7 @@ public class StatusChecker {
                 if (clusterActive) {
                     //send event to cluster status topic
                     monitor.setHasFaultyMember(false);
-                    StatusEventPublisher.sendClusterActivatedEvent(monitor.getAppId(),
+                    ClusterStatusEventPublisher.sendClusterActivatedEvent(monitor.getAppId(),
                             monitor.getServiceId(), monitor.getClusterId());
                 }
             }
@@ -102,10 +102,10 @@ public class StatusChecker {
 
                                 if (!clusterMonitorHasMembers && cluster.getStatus() == ClusterStatus.Terminating) {
                                     if (application.getStatus() == ApplicationStatus.Terminating) {
-                                        StatusEventPublisher.sendClusterTerminatedEvent(appId, monitor.getServiceId(),
+                                        ClusterStatusEventPublisher.sendClusterTerminatedEvent(appId, monitor.getServiceId(),
                                                 monitor.getClusterId());
                                     } else {
-                                        StatusEventPublisher.sendClusterCreatedEvent(appId, monitor.getServiceId(),
+                                        ClusterStatusEventPublisher.sendClusterCreatedEvent(appId, monitor.getServiceId(),
                                                 monitor.getClusterId());
                                     }
 
@@ -188,12 +188,12 @@ public class StatusChecker {
                         monitor.setHasFaultyMember(true);
                     }
                     //send cluster In-Active event to cluster status topic
-                    StatusEventPublisher.sendClusterInActivateEvent(appId, monitor.getServiceId(), clusterId);
+                    ClusterStatusEventPublisher.sendClusterInActivateEvent(appId, monitor.getServiceId(), clusterId);
 
                 } else {
                     boolean clusterActive = clusterActive(monitor);
                     if (clusterActive) {
-                        StatusEventPublisher.sendClusterActivatedEvent(appId, monitor.getServiceId(), clusterId);
+                        ClusterStatusEventPublisher.sendClusterActivatedEvent(appId, monitor.getServiceId(), clusterId);
                     }
                 }
 
@@ -295,11 +295,11 @@ public class StatusChecker {
                     if (parent instanceof Application) {
                         //send application activated event
                         log.info("sending app activate: " + appId);
-                        StatusEventPublisher.sendApplicationActivatedEvent(appId);
+                        ApplicationsEventPublisher.sendApplicationActivatedEvent(appId);
                     } else if (parent instanceof Group) {
                         //send activation to the parent
                         log.info("sending group activate: " + parent.getUniqueIdentifier());
-                        StatusEventPublisher.sendGroupActivatedEvent(appId, parent.getUniqueIdentifier());
+                        ApplicationsEventPublisher.sendGroupActivatedEvent(appId, parent.getUniqueIdentifier());
                     }
                 } else if (groups.isEmpty() && clusterStatus == ClusterStatus.Inactive ||
                         clusterData.isEmpty() && groupStatus == GroupStatus.Inactive ||
@@ -312,7 +312,7 @@ public class StatusChecker {
                     } else if (parent instanceof Group) {
                         //send activation to the parent
                         log.info("sending group in-active: " + parent.getUniqueIdentifier());
-                        StatusEventPublisher.sendGroupInActivateEvent(appId, parent.getUniqueIdentifier());
+                        ApplicationsEventPublisher.sendGroupInActivateEvent(appId, parent.getUniqueIdentifier());
                     }
                 } else if (groups.isEmpty() && clusterStatus == ClusterStatus.Terminated ||
                         clusterData.isEmpty() && groupStatus == GroupStatus.Terminated ||
@@ -322,7 +322,7 @@ public class StatusChecker {
                         //validating the life cycle
                         if (application.getStatus().equals(ApplicationStatus.Terminating)) {
                             log.info("sending app terminated: " + appId);
-                            StatusEventPublisher.sendApplicationTerminatedEvent(appId, parent.getClusterDataRecursively());
+                            ApplicationsEventPublisher.sendApplicationTerminatedEvent(appId, parent.getClusterDataRecursively());
                         } else {
                             log.info("[Application] " + appId + " is in the [status] " +
                                     application.getStatus().toString() + ". Hence not sending terminated event");
@@ -331,7 +331,7 @@ public class StatusChecker {
                     } else if (parent instanceof Group) {
                         //send activation to the parent
                         log.info("sending group created : " + parent.getUniqueIdentifier());
-                        StatusEventPublisher.sendGroupCreatedEvent(appId, parent.getUniqueIdentifier());
+                        ApplicationsEventPublisher.sendGroupCreatedEvent(appId, parent.getUniqueIdentifier());
                     }
                 /*} else if (groups.isEmpty() && clusterStatus == ClusterStatus.Terminating ||
                         clusterData.isEmpty() && groupStatus == GroupStatus.Terminating ||
@@ -352,7 +352,7 @@ public class StatusChecker {
                     } else if (parent instanceof Group) {
                         //send activation to the parent
                         log.info("sending group created : " + parent.getUniqueIdentifier());
-                        StatusEventPublisher.sendGroupCreatedEvent(appId, parent.getUniqueIdentifier());
+                        ApplicationsEventPublisher.sendGroupCreatedEvent(appId, parent.getUniqueIdentifier());
                     }
                 } else {
                     log.warn("Clusters/groups not found in this [component] " + appId);

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/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 d83a7d3..fe97f99 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
@@ -23,17 +23,19 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.topology.TopologyBuilder;
 import org.apache.stratos.messaging.event.Event;
 import org.apache.stratos.messaging.event.applications.*;
+import org.apache.stratos.messaging.event.cluster.status.*;
 import org.apache.stratos.messaging.listener.applications.*;
-import org.apache.stratos.messaging.message.receiver.application.status.ApplicationStatusEventReceiver;
+import org.apache.stratos.messaging.listener.cluster.status.*;
+import org.apache.stratos.messaging.message.receiver.applications.ApplicationsEventReceiver;
 
 public class ApplicationStatusTopicReceiver implements Runnable {
     private static final Log log = LogFactory.getLog(ApplicationStatusTopicReceiver.class);
 
-    private ApplicationStatusEventReceiver statusEventReceiver;
+    private ApplicationsEventReceiver statusEventReceiver;
     private boolean terminated;
 
     public ApplicationStatusTopicReceiver() {
-        this.statusEventReceiver = new ApplicationStatusEventReceiver();
+        this.statusEventReceiver = new ApplicationsEventReceiver();
         addEventListeners();
     }
 
@@ -64,124 +66,40 @@ public class ApplicationStatusTopicReceiver implements Runnable {
 
     private void addEventListeners() {
         // Listen to topology events that affect clusters
-        statusEventReceiver.addEventListener(new AppClusterCreatedEventListener() {
+        statusEventReceiver.addEventListener(new ClusterStatusClusterCreatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterCreated((AppClusterCreatedEvent) event);
+                TopologyBuilder.handleClusterCreated((ClusterStatusClusterCreatedEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new AppClusterActivatedEventListener() {
+        statusEventReceiver.addEventListener(new ClusterStatusClusterActivatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterActivatedEvent((AppClusterActivatedEvent) event);
+                TopologyBuilder.handleClusterActivatedEvent((ClusterStatusClusterActivatedEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new AppClusterTerminatedEventListener() {
+        statusEventReceiver.addEventListener(new ClusterStatusClusterTerminatedEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterTerminatedEvent((AppClusterTerminatedEvent) event);
+                TopologyBuilder.handleClusterTerminatedEvent((ClusterStatusClusterTerminatedEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new AppClusterTerminatingEventListener(){
+        statusEventReceiver.addEventListener(new ClusterStatusClusterTerminatingEventListener(){
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterTerminatingEvent((AppClusterTerminatingEvent) event);
+                TopologyBuilder.handleClusterTerminatingEvent((ClusterStatusClusterTerminatingEvent) event);
             }
         });
 
-        statusEventReceiver.addEventListener(new AppClusterInactivateEventListener() {
+        statusEventReceiver.addEventListener(new ClusterStatusClusterInactivateEventListener() {
             @Override
             protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterInActivateEvent((AppClusterInactivateEvent) event);
+                TopologyBuilder.handleClusterInActivateEvent((ClusterStatusClusterInactivateEvent) event);
             }
         });
-
-
-        statusEventReceiver.addEventListener(new GroupCreatedEventListener() {
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupCreated((GroupCreatedEvent) event);
-            }
-        });
-
-        statusEventReceiver.addEventListener(new GroupActivatedEventListener() {
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupActivatedEvent((GroupActivatedEvent) event);
-
-            }
-        });
-
-        statusEventReceiver.addEventListener(new GroupTerminatedEventListener() {
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupTerminatedEvent((GroupTerminatedEvent) event);
-
-            }
-        });
-
-        statusEventReceiver.addEventListener(new GroupTerminatingEventListener() {
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupTerminatingEvent((GroupTerminatingEvent) event);
-
-            }
-        });
-
-        statusEventReceiver.addEventListener(new GroupInactivateEventListener() {
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleGroupInActiveEvent((AppStatusGroupInactivateEvent) event);
-
-            }
-        });
-
-        statusEventReceiver.addEventListener(new ApplicationActivatedEventListener() {
-
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationActivatedEvent((ApplicationActivatedEvent) event);
-
-            }
-        });
-
-        statusEventReceiver.addEventListener(new ApplicationInactivatedEventListener() {
-
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationInActivatedEvent((ApplicationInactivatedEvent) event);
-
-            }
-        });
-
-        statusEventReceiver.addEventListener(new ApplicationCreatedEventListener() {
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationCreatedEvent((ApplicationCreatedEvent) event);
-
-            }
-        });
-
-        statusEventReceiver.addEventListener(new ApplicationTerminatingEventListener() {
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationTerminatingEvent((ApplicationTerminatingEvent) event);
-
-            }
-        });
-
-        statusEventReceiver.addEventListener(new ApplicationTerminatedEventListener() {
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleApplicationTerminatedEvent((ApplicationTerminatedEvent) event);
-
-            }
-        });
-
-
     }
 
     public void setTerminated(boolean terminated) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java
index 5831948..222cc15 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java
@@ -34,7 +34,6 @@ import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
 import org.apache.stratos.cloud.controller.util.ServiceReferenceHolder;
 import org.apache.stratos.messaging.broker.publish.EventPublisherPool;
 import org.apache.stratos.messaging.broker.subscribe.TopicSubscriber;
-import org.apache.stratos.messaging.message.receiver.application.status.ApplicationStatusEventReceiver;
 import org.apache.stratos.messaging.util.Constants;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.ComponentContext;

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/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 3bc7b5a..2941027 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
@@ -41,6 +41,7 @@ import org.apache.stratos.messaging.event.applications.GroupActivatedEvent;
 import org.apache.stratos.messaging.event.applications.GroupCreatedEvent;
 import org.apache.stratos.messaging.event.applications.GroupTerminatedEvent;
 import org.apache.stratos.messaging.event.applications.GroupTerminatingEvent;
+import org.apache.stratos.messaging.event.cluster.status.*;
 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;
@@ -124,7 +125,7 @@ public class TopologyBuilder {
         }
     }
 
-    public static void handleClusterCreated (AppClusterCreatedEvent event) {
+    public static void handleClusterCreated (ClusterStatusClusterCreatedEvent event) {
 
         TopologyManager.acquireWriteLock();
 
@@ -722,7 +723,7 @@ public class TopologyBuilder {
     }
 
 
-    public static void handleClusterActivatedEvent(AppClusterActivatedEvent clusterActivatedEvent) {
+    public static void handleClusterActivatedEvent(ClusterStatusClusterActivatedEvent clusterActivatedEvent) {
         Topology topology = TopologyManager.getTopology();
         Service service = topology.getService(clusterActivatedEvent.getServiceName());
         //update the status of the cluster
@@ -760,7 +761,7 @@ public class TopologyBuilder {
     }
 
     public static void handleClusterInActivateEvent(
-            AppClusterInactivateEvent clusterInActivateEvent) {
+            ClusterStatusClusterInactivateEvent clusterInActivateEvent) {
         Topology topology = TopologyManager.getTopology();
         Service service = topology.getService(clusterInActivateEvent.getServiceName());
         //update the status of the cluster
@@ -1148,7 +1149,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendGroupTerminatingEvent(groupTerminatingTopologyEvent);
     }
 
-    public static void handleClusterTerminatedEvent(AppClusterTerminatedEvent event) {
+    public static void handleClusterTerminatedEvent(ClusterStatusClusterTerminatedEvent event) {
 
         TopologyManager.acquireWriteLock();
 
@@ -1175,7 +1176,7 @@ public class TopologyBuilder {
         TopologyEventPublisher.sendClusterTerminatedEvent(clusterTerminatedEvent);
     }
 
-    public static void handleClusterTerminatingEvent(AppClusterTerminatingEvent event) {
+    public static void handleClusterTerminatingEvent(ClusterStatusClusterTerminatingEvent event) {
 
         TopologyManager.acquireWriteLock();
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/topology/receiver/StratosManagerTopologyEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/topology/receiver/StratosManagerTopologyEventReceiver.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/topology/receiver/StratosManagerTopologyEventReceiver.java
index d6cc395..a085664 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/topology/receiver/StratosManagerTopologyEventReceiver.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/topology/receiver/StratosManagerTopologyEventReceiver.java
@@ -310,6 +310,7 @@ public class StratosManagerTopologyEventReceiver implements Runnable {
         });
         
       //add listner to Complete Topology Event
+/*
         topologyEventReceiver.addEventListener(new ApplicationCreatedEventListener() {
             @Override
             protected void onEvent(Event event) {
@@ -367,8 +368,10 @@ public class StratosManagerTopologyEventReceiver implements Runnable {
                 }
             }
         });
-        
+*/
+
         //add listener 
+/*
         topologyEventReceiver.addEventListener(new ApplicationTerminatedEventListener() {
             @Override
             protected void onEvent(Event event) {
@@ -412,6 +415,7 @@ public class StratosManagerTopologyEventReceiver implements Runnable {
                 }
             }
         });
+*/
     }
 
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterActivatedEvent.java
deleted file mode 100644
index 688b382..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterActivatedEvent.java
+++ /dev/null
@@ -1,50 +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.applications;
-
-/**
- * This event is fired by cartridge agent when it has started the server and
- * applications are ready to serve the incoming requests.
- */
-public class AppClusterActivatedEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppClusterActivatedEvent(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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterCreatedEvent.java
deleted file mode 100644
index 3382a34..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterCreatedEvent.java
+++ /dev/null
@@ -1,50 +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.applications;
-
-/**
- * This event is fired by cartridge agent when it has started the server and
- * applications are ready to serve the incoming requests.
- */
-public class AppClusterCreatedEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppClusterCreatedEvent(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/275ba2dd/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterInactivateEvent.java
deleted file mode 100644
index bf8926e..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterInactivateEvent.java
+++ /dev/null
@@ -1,50 +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.applications;
-
-/**
- * This event is fired by cartridge agent when it has started the server and
- * applications are ready to serve the incoming requests.
- */
-public class AppClusterInactivateEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppClusterInactivateEvent(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;
-    }
-}


[04/10] renaming application.status topic to applications

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationInactivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationInactivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationInactivatedEvent.java
new file mode 100644
index 0000000..8ff0db3
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationInactivatedEvent.java
@@ -0,0 +1,38 @@
+/*
+ * 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.applications;
+
+import java.io.Serializable;
+
+/**
+ * This event will be fired upon the application inactivated is detected.
+ */
+public class ApplicationInactivatedEvent extends StatusEvent implements Serializable {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String appId;
+
+    public ApplicationInactivatedEvent(String appId) {
+        this.appId = appId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatedEvent.java
new file mode 100644
index 0000000..024327a
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatedEvent.java
@@ -0,0 +1,47 @@
+/*
+ * 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.applications;
+
+import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
+
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * This event will be fired upon the application terminated is detected.
+ */
+public class ApplicationTerminatedEvent extends StatusEvent implements Serializable {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String appId;
+    private Set<ClusterDataHolder> clusterData;
+
+    public ApplicationTerminatedEvent(String appId, Set<ClusterDataHolder> clusterData) {
+        this.appId = appId;
+        this.clusterData = clusterData;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public Set<ClusterDataHolder> getClusterData() {
+        return clusterData;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatingEvent.java
new file mode 100644
index 0000000..e81b988
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationTerminatingEvent.java
@@ -0,0 +1,38 @@
+/*
+ * 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.applications;
+
+import java.io.Serializable;
+
+/**
+ * This event will be fired upon the application terminating is detected.
+ */
+public class ApplicationTerminatingEvent extends StatusEvent implements Serializable {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String appId;
+
+    public ApplicationTerminatingEvent(String appId) {
+        this.appId = appId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupActivatedEvent.java
new file mode 100644
index 0000000..c200217
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupActivatedEvent.java
@@ -0,0 +1,44 @@
+/*
+ * 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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class GroupActivatedEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String groupId;
+    private String appId;
+
+    public GroupActivatedEvent(String appId, String groupId) {
+        this.appId = appId;
+        this.groupId = groupId;
+    }
+
+    public String getGroupId() {
+        return this.groupId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupCreatedEvent.java
new file mode 100644
index 0000000..8b622c5
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupCreatedEvent.java
@@ -0,0 +1,44 @@
+/*
+ * 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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class GroupCreatedEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String groupId;
+    private String appId;
+
+    public GroupCreatedEvent(String appId, String groupId) {
+        this.appId = appId;
+        this.groupId = groupId;
+    }
+
+    public String getGroupId() {
+        return this.groupId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupMaintenanceModeEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupMaintenanceModeEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupMaintenanceModeEvent.java
new file mode 100644
index 0000000..5723305
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupMaintenanceModeEvent.java
@@ -0,0 +1,41 @@
+/*
+ * 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.applications;
+
+/**
+ * This event will be fired upon the instability of group detection by autoscaler.
+ */
+public class GroupMaintenanceModeEvent extends StatusEvent {
+    private String groupId;
+    private String appId;
+
+    public GroupMaintenanceModeEvent(String appId, String groupId) {
+        this.appId = appId;
+        this.groupId = groupId;
+    }
+
+    public String getGroupId(String groupId) {
+        return this.groupId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupReadyToShutdownEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupReadyToShutdownEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupReadyToShutdownEvent.java
new file mode 100644
index 0000000..8099015
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupReadyToShutdownEvent.java
@@ -0,0 +1,40 @@
+/*
+ * 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.applications;
+
+/**
+ * This event is fired by autoscaler before actually terminate a group.
+ */
+public class GroupReadyToShutdownEvent extends StatusEvent {
+    private String groupId;
+    private String appId;
+
+    public GroupReadyToShutdownEvent(String appId, String groupId) {
+        this.appId = appId;
+        this.groupId = groupId;
+    }
+
+    public String getGroupId(String groupId) {
+        return this.groupId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatedEvent.java
new file mode 100644
index 0000000..6cfa888
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatedEvent.java
@@ -0,0 +1,44 @@
+/*
+ * 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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class GroupTerminatedEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String groupId;
+    private String appId;
+
+    public GroupTerminatedEvent(String appId, String groupId) {
+        this.appId = appId;
+        this.groupId = groupId;
+    }
+
+    public String getGroupId() {
+        return this.groupId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatingEvent.java
new file mode 100644
index 0000000..ba6f979
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupTerminatingEvent.java
@@ -0,0 +1,44 @@
+/*
+ * 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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class GroupTerminatingEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String groupId;
+    private String appId;
+
+    public GroupTerminatingEvent(String appId, String groupId) {
+        this.appId = appId;
+        this.groupId = groupId;
+    }
+
+    public String getGroupId() {
+        return this.groupId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/StatusEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/StatusEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/StatusEvent.java
new file mode 100644
index 0000000..91dbab3
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/StatusEvent.java
@@ -0,0 +1,31 @@
+/*
+ * 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.applications;
+
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+
+/**
+ * Represents all instance status events.
+ */
+public abstract class StatusEvent extends Event implements Serializable {
+    private static final long serialVersionUID = -4790128084271867615L;
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationActivatedEventListener.java
deleted file mode 100644
index 4dfc8b5..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationActivatedEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This listener will get triggered upon the application activated event.
- */
-public abstract class AppStatusApplicationActivatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationCreatedEventListener.java
deleted file mode 100644
index 79a7d21..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationCreatedEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This listener will get triggered upon the application created event.
- */
-public abstract class AppStatusApplicationCreatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationInactivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationInactivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationInactivatedEventListener.java
deleted file mode 100644
index c2a356d..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationInactivatedEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This listener will get triggered upon the application inactivated event.
- */
-public abstract class AppStatusApplicationInactivatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationTerminatedEventListener.java
deleted file mode 100644
index ad1be52..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationTerminatedEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This listener will get triggered upon the application terminated event.
- */
-public abstract class AppStatusApplicationTerminatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationTerminatingEventListener.java
deleted file mode 100644
index a454f16..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusApplicationTerminatingEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This listener will get triggered upon the application terminating event.
- */
-public abstract class AppStatusApplicationTerminatingEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterActivatedEventListener.java
deleted file mode 100644
index 75da7b8..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterActivatedEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppStatusClusterActivatedEventListener extends EventListener{
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterCreatedEventListener.java
deleted file mode 100644
index c0c62f9..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterCreatedEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppStatusClusterCreatedEventListener extends EventListener{
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterInactivateEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterInactivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterInactivateEventListener.java
deleted file mode 100644
index 03da7f7..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterInactivateEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppStatusClusterInactivateEventListener extends EventListener{
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/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
deleted file mode 100644
index a47c371..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatedEventListener.java
+++ /dev/null
@@ -1,24 +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.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/f0ba4beb/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
deleted file mode 100644
index 11bdb97..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusClusterTerminatingEventListener.java
+++ /dev/null
@@ -1,24 +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.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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupActivatedEventListener.java
deleted file mode 100644
index e6381e3..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupActivatedEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppStatusGroupActivatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupCreatedEventListener.java
deleted file mode 100644
index 82386a3..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupCreatedEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppStatusGroupCreatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupInactivateEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupInactivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupInactivateEventListener.java
deleted file mode 100644
index 0873a70..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupInactivateEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppStatusGroupInactivateEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupTerminatedEventListener.java
deleted file mode 100644
index 785abbd..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupTerminatedEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppStatusGroupTerminatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupTerminatingEventListener.java
deleted file mode 100644
index 8d56555..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/AppStatusGroupTerminatingEventListener.java
+++ /dev/null
@@ -1,24 +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.listener.application.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class AppStatusGroupTerminatingEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterActivatedEventListener.java
new file mode 100644
index 0000000..f99e15b
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterActivatedEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class AppClusterActivatedEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterCreatedEventListener.java
new file mode 100644
index 0000000..d43f360
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterCreatedEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class AppClusterCreatedEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterInactivateEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterInactivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterInactivateEventListener.java
new file mode 100644
index 0000000..1adaeef
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterInactivateEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class AppClusterInactivateEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatedEventListener.java
new file mode 100644
index 0000000..89a66e9
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatedEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class AppClusterTerminatedEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatingEventListener.java
new file mode 100644
index 0000000..9cd9a5d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/AppClusterTerminatingEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class AppClusterTerminatingEventListener extends EventListener{
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationActivatedEventListener.java
new file mode 100644
index 0000000..e244ae9
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationActivatedEventListener.java
@@ -0,0 +1,27 @@
+/*
+ * 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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+/**
+ * This listener will get triggered upon the application activated event.
+ */
+public abstract class ApplicationActivatedEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationCreatedEventListener.java
new file mode 100644
index 0000000..8e17c7b
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationCreatedEventListener.java
@@ -0,0 +1,27 @@
+/*
+ * 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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+/**
+ * This listener will get triggered upon the application created event.
+ */
+public abstract class ApplicationCreatedEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationInactivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationInactivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationInactivatedEventListener.java
new file mode 100644
index 0000000..d0593fb
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationInactivatedEventListener.java
@@ -0,0 +1,27 @@
+/*
+ * 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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+/**
+ * This listener will get triggered upon the application inactivated event.
+ */
+public abstract class ApplicationInactivatedEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationTerminatedEventListener.java
new file mode 100644
index 0000000..064465c
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationTerminatedEventListener.java
@@ -0,0 +1,27 @@
+/*
+ * 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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+/**
+ * This listener will get triggered upon the application terminated event.
+ */
+public abstract class ApplicationTerminatedEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationTerminatingEventListener.java
new file mode 100644
index 0000000..3be2ad2
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationTerminatingEventListener.java
@@ -0,0 +1,27 @@
+/*
+ * 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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+/**
+ * This listener will get triggered upon the application terminating event.
+ */
+public abstract class ApplicationTerminatingEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationUndeployedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationUndeployedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationUndeployedEventListener.java
new file mode 100644
index 0000000..3abd823
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/ApplicationUndeployedEventListener.java
@@ -0,0 +1,26 @@
+/*
+ * 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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class ApplicationUndeployedEventListener extends EventListener {
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupActivatedEventListener.java
new file mode 100644
index 0000000..51455ae
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupActivatedEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class GroupActivatedEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupCreatedEventListener.java
new file mode 100644
index 0000000..f13ed10
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupCreatedEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class GroupCreatedEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupInactivateEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupInactivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupInactivateEventListener.java
new file mode 100644
index 0000000..aeb58da
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupInactivateEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class GroupInactivateEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupTerminatedEventListener.java
new file mode 100644
index 0000000..ed4bb3a
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupTerminatedEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class GroupTerminatedEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupTerminatingEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupTerminatingEventListener.java
new file mode 100644
index 0000000..5168f77
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/applications/GroupTerminatingEventListener.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.applications;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class GroupTerminatingEventListener extends EventListener {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationActivatedEventListener.java
deleted file mode 100644
index f54ab9e..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationActivatedEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This listener will be triggered upon the application activated event received.
- */
-public abstract class ApplicationActivatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationCreatedEventListener.java
deleted file mode 100644
index bbc853f..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationCreatedEventListener.java
+++ /dev/null
@@ -1,26 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class ApplicationCreatedEventListener extends EventListener {
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationInActivateEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationInActivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationInActivateEventListener.java
deleted file mode 100644
index d33c037..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationInActivateEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This listener will be triggered upon the application activated event received.
- */
-public abstract class ApplicationInActivateEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationTerminatedEventListener.java
deleted file mode 100644
index 0b6fd59..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ApplicationTerminatedEventListener.java
+++ /dev/null
@@ -1,27 +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.listener.topology;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * This listener will be triggered upon the application activated event received.
- */
-public abstract class ApplicationTerminatedEventListener extends EventListener {
-}


[05/10] git commit: renaming application.status topic to applications

Posted by re...@apache.org.
renaming application.status topic to applications


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

Branch: refs/heads/4.0.0-grouping
Commit: f0ba4beb168eb119011aef6c424cc4d60057585b
Parents: e153430
Author: reka <rt...@gmail.com>
Authored: Fri Oct 31 12:22:29 2014 +0530
Committer: reka <rt...@gmail.com>
Committed: Fri Oct 31 12:23:39 2014 +0530

----------------------------------------------------------------------
 .../grouping/topic/StatusEventPublisher.java    |  54 +++----
 .../status/checker/StatusChecker.java           |  62 ++++++++-
 .../AppStatusApplicationActivatedEvent.java     |  38 -----
 .../AppStatusApplicationCreatedEvent.java       |  38 -----
 .../AppStatusApplicationInactivatedEvent.java   |  38 -----
 .../AppStatusApplicationTerminatedEvent.java    |  47 -------
 .../AppStatusApplicationTerminatingEvent.java   |  38 -----
 .../status/AppStatusClusterActivatedEvent.java  |  50 -------
 .../status/AppStatusClusterCreatedEvent.java    |  50 -------
 .../status/AppStatusClusterInactivateEvent.java |  50 -------
 .../AppStatusClusterMaintenanceModeEvent.java   |  49 -------
 .../AppStatusClusterReadyToShutdownEvent.java   |  47 -------
 .../status/AppStatusClusterTerminatedEvent.java |  50 -------
 .../AppStatusClusterTerminatingEvent.java       |  50 -------
 .../status/AppStatusGroupActivatedEvent.java    |  44 ------
 .../status/AppStatusGroupCreatedEvent.java      |  44 ------
 .../status/AppStatusGroupInactivateEvent.java   |  44 ------
 .../AppStatusGroupMaintenanceModeEvent.java     |  41 ------
 .../AppStatusGroupReadyToShutdownEvent.java     |  40 ------
 .../status/AppStatusGroupTerminatedEvent.java   |  44 ------
 .../status/AppStatusGroupTerminatingEvent.java  |  44 ------
 .../event/application/status/StatusEvent.java   |  31 -----
 .../applications/AppClusterActivatedEvent.java  |  50 +++++++
 .../applications/AppClusterCreatedEvent.java    |  50 +++++++
 .../applications/AppClusterInactivateEvent.java |  50 +++++++
 .../applications/AppClusterTerminatedEvent.java |  50 +++++++
 .../AppClusterTerminatingEvent.java             |  50 +++++++
 .../AppStatusGroupInactivateEvent.java          |  44 ++++++
 .../applications/ApplicationActivatedEvent.java |  38 +++++
 .../applications/ApplicationCreatedEvent.java   |  38 +++++
 .../ApplicationInactivatedEvent.java            |  38 +++++
 .../ApplicationTerminatedEvent.java             |  47 +++++++
 .../ApplicationTerminatingEvent.java            |  38 +++++
 .../event/applications/GroupActivatedEvent.java |  44 ++++++
 .../event/applications/GroupCreatedEvent.java   |  44 ++++++
 .../applications/GroupMaintenanceModeEvent.java |  41 ++++++
 .../applications/GroupReadyToShutdownEvent.java |  40 ++++++
 .../applications/GroupTerminatedEvent.java      |  44 ++++++
 .../applications/GroupTerminatingEvent.java     |  44 ++++++
 .../event/applications/StatusEvent.java         |  31 +++++
 ...StatusApplicationActivatedEventListener.java |  27 ----
 ...ppStatusApplicationCreatedEventListener.java |  27 ----
 ...atusApplicationInactivatedEventListener.java |  27 ----
 ...tatusApplicationTerminatedEventListener.java |  27 ----
 ...atusApplicationTerminatingEventListener.java |  27 ----
 .../AppStatusClusterActivatedEventListener.java |  24 ----
 .../AppStatusClusterCreatedEventListener.java   |  24 ----
 ...AppStatusClusterInactivateEventListener.java |  24 ----
 ...AppStatusClusterTerminatedEventListener.java |  24 ----
 ...ppStatusClusterTerminatingEventListener.java |  24 ----
 .../AppStatusGroupActivatedEventListener.java   |  24 ----
 .../AppStatusGroupCreatedEventListener.java     |  24 ----
 .../AppStatusGroupInactivateEventListener.java  |  24 ----
 .../AppStatusGroupTerminatedEventListener.java  |  24 ----
 .../AppStatusGroupTerminatingEventListener.java |  24 ----
 .../AppClusterActivatedEventListener.java       |  24 ++++
 .../AppClusterCreatedEventListener.java         |  24 ++++
 .../AppClusterInactivateEventListener.java      |  24 ++++
 .../AppClusterTerminatedEventListener.java      |  24 ++++
 .../AppClusterTerminatingEventListener.java     |  24 ++++
 .../ApplicationActivatedEventListener.java      |  27 ++++
 .../ApplicationCreatedEventListener.java        |  27 ++++
 .../ApplicationInactivatedEventListener.java    |  27 ++++
 .../ApplicationTerminatedEventListener.java     |  27 ++++
 .../ApplicationTerminatingEventListener.java    |  27 ++++
 .../ApplicationUndeployedEventListener.java     |  26 ++++
 .../GroupActivatedEventListener.java            |  24 ++++
 .../applications/GroupCreatedEventListener.java |  24 ++++
 .../GroupInactivateEventListener.java           |  24 ++++
 .../GroupTerminatedEventListener.java           |  24 ++++
 .../GroupTerminatingEventListener.java          |  24 ++++
 .../ApplicationActivatedEventListener.java      |  27 ----
 .../ApplicationCreatedEventListener.java        |  26 ----
 .../ApplicationInActivateEventListener.java     |  27 ----
 .../ApplicationTerminatedEventListener.java     |  27 ----
 .../ApplicationTerminatingEventListener.java    |  27 ----
 .../ApplicationUndeployedEventListener.java     |  26 ----
 .../topology/GroupActivatedEventListener.java   |  27 ----
 .../topology/GroupCreatedEventListener.java     |  27 ----
 .../topology/GroupInActivateEventListener.java  |  27 ----
 .../topology/GroupTerminatedEventListener.java  |  27 ----
 .../topology/GroupTerminatingEventListener.java |  27 ----
 ...tusApplicationActivatedMessageProcessor.java |  62 ---------
 ...tatusApplicationCreatedMessageProcessor.java |  63 ---------
 ...sApplicationInactivatedMessageProcessor.java |  63 ---------
 ...usApplicationTerminatedMessageProcessor.java |  63 ---------
 ...sApplicationTerminatingMessageProcessor.java |  63 ---------
 ...pStatusClusterActivatedMessageProcessor.java |  57 --------
 ...AppStatusClusterCreatedMessageProcessor.java |  58 --------
 ...StatusClusterInactivateMessageProcessor.java |  58 --------
 ...StatusClusterTerminatedMessageProcessor.java |  58 --------
 ...tatusClusterTerminatingMessageProcessor.java |  58 --------
 ...AppStatusGroupActivatedMessageProcessor.java |  61 --------
 .../AppStatusGroupCreatedMessageProcessor.java  |  62 ---------
 ...pStatusGroupInactivatedMessageProcessor.java |  61 --------
 ...ppStatusGroupTerminatedMessageProcessor.java |  61 --------
 ...pStatusGroupTerminatingMessageProcessor.java |  61 --------
 .../status/AppStatusMessageProcessorChain.java  | 139 -------------------
 .../AppClusterActivatedMessageProcessor.java    |  57 ++++++++
 .../AppClusterCreatedMessageProcessor.java      |  57 ++++++++
 .../AppClusterInactivateMessageProcessor.java   |  58 ++++++++
 .../AppClusterTerminatedMessageProcessor.java   |  58 ++++++++
 .../AppClusterTerminatingMessageProcessor.java  |  58 ++++++++
 .../AppStatusMessageProcessorChain.java         | 139 +++++++++++++++++++
 .../ApplicationActivatedMessageProcessor.java   |  62 +++++++++
 .../ApplicationCreatedMessageProcessor.java     |  63 +++++++++
 .../ApplicationInactivatedMessageProcessor.java |  63 +++++++++
 .../ApplicationTerminatedMessageProcessor.java  |  63 +++++++++
 .../ApplicationTerminatingMessageProcessor.java |  63 +++++++++
 .../GroupActivatedMessageProcessor.java         |  61 ++++++++
 .../GroupCreatedMessageProcessor.java           |  61 ++++++++
 .../GroupInactivatedMessageProcessor.java       |  61 ++++++++
 .../GroupTerminatedMessageProcessor.java        |  61 ++++++++
 .../GroupTerminatingMessageProcessor.java       |  61 ++++++++
 114 files changed, 2316 insertions(+), 2623 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/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 eb6e084..c0e77de 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
@@ -7,7 +7,7 @@ import org.apache.stratos.messaging.broker.publish.EventPublisherPool;
 import org.apache.stratos.messaging.domain.applications.*;
 import org.apache.stratos.messaging.domain.topology.*;
 import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.application.status.*;
+import org.apache.stratos.messaging.event.applications.*;
 import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
 import org.apache.stratos.messaging.util.Constants;
 
@@ -30,8 +30,8 @@ public class StatusEventPublisher {
                         log.info("Publishing Cluster created event for [application]: " + appId +
                                 " [cluster]: " + clusterId);
                     }
-                    AppStatusClusterCreatedEvent clusterCreatedEvent =
-                            new AppStatusClusterCreatedEvent(appId, serviceName, clusterId);
+                    AppClusterCreatedEvent clusterCreatedEvent =
+                            new AppClusterCreatedEvent(appId, serviceName, clusterId);
 
                     publishEvent(clusterCreatedEvent);
                 } else {
@@ -54,8 +54,8 @@ public class StatusEventPublisher {
                         log.info("Publishing Cluster activated event for [application]: " + appId +
                                 " [cluster]: " + clusterId);
                     }
-                    AppStatusClusterActivatedEvent clusterActivatedEvent =
-                            new AppStatusClusterActivatedEvent(appId, serviceName, clusterId);
+                    AppClusterActivatedEvent clusterActivatedEvent =
+                            new AppClusterActivatedEvent(appId, serviceName, clusterId);
 
                     publishEvent(clusterActivatedEvent);
                 } else {
@@ -78,8 +78,8 @@ public class StatusEventPublisher {
                         log.info("Publishing Cluster in-activate event for [application]: " + appId +
                                 " [cluster]: " + clusterId);
                     }
-                    AppStatusClusterInactivateEvent clusterInActivateEvent =
-                            new AppStatusClusterInactivateEvent(appId, serviceName, clusterId);
+                    AppClusterInactivateEvent clusterInActivateEvent =
+                            new AppClusterInactivateEvent(appId, serviceName, clusterId);
 
                     publishEvent(clusterInActivateEvent);
                 } else {
@@ -104,8 +104,8 @@ public class StatusEventPublisher {
                         log.info("Publishing Cluster Terminating event for [application]: " + appId +
                                 " [cluster]: " + clusterId);
                     }
-                    AppStatusClusterTerminatingEvent appStatusClusterTerminatingEvent =
-                            new AppStatusClusterTerminatingEvent(appId, serviceName, clusterId);
+                    AppClusterTerminatingEvent appStatusClusterTerminatingEvent =
+                            new AppClusterTerminatingEvent(appId, serviceName, clusterId);
 
                     publishEvent(appStatusClusterTerminatingEvent);
                 } else {
@@ -130,8 +130,8 @@ public class StatusEventPublisher {
                         log.info("Publishing Cluster terminated event for [application]: " + appId +
                                 " [cluster]: " + clusterId);
                     }
-                    AppStatusClusterTerminatedEvent appStatusClusterTerminatedEvent =
-                            new AppStatusClusterTerminatedEvent(appId, serviceName, clusterId);
+                    AppClusterTerminatedEvent appStatusClusterTerminatedEvent =
+                            new AppClusterTerminatedEvent(appId, serviceName, clusterId);
 
                     publishEvent(appStatusClusterTerminatedEvent);
                 } else {
@@ -155,8 +155,8 @@ public class StatusEventPublisher {
                         log.info("Publishing Group created event for [application]: " + appId +
                                 " [group]: " + groupId);
                     }
-                    AppStatusGroupCreatedEvent groupCreatedEvent =
-                            new AppStatusGroupCreatedEvent(appId, groupId);
+                    GroupCreatedEvent groupCreatedEvent =
+                            new GroupCreatedEvent(appId, groupId);
 
                     publishEvent(groupCreatedEvent);
                 } else {
@@ -179,8 +179,8 @@ public class StatusEventPublisher {
                         log.info("Publishing Group activated event for [application]: " + appId +
                                 " [group]: " + groupId);
                     }
-                    AppStatusGroupActivatedEvent groupActivatedEvent =
-                            new AppStatusGroupActivatedEvent(appId, groupId);
+                    GroupActivatedEvent groupActivatedEvent =
+                            new GroupActivatedEvent(appId, groupId);
 
                     publishEvent(groupActivatedEvent);
                 } else {
@@ -227,8 +227,8 @@ public class StatusEventPublisher {
                         log.info("Publishing Group terminating event for [application]: " + appId +
                                 " [group]: " + groupId);
                     }
-                    AppStatusGroupTerminatingEvent groupInTerminatingEvent =
-                            new AppStatusGroupTerminatingEvent(appId, groupId);
+                    GroupTerminatingEvent groupInTerminatingEvent =
+                            new GroupTerminatingEvent(appId, groupId);
                     publishEvent(groupInTerminatingEvent);
                 } else {
                     log.warn("Terminating is not in the possible state list of [group] " + groupId);
@@ -252,8 +252,8 @@ public class StatusEventPublisher {
             if (application != null) {
                 Group group = application.getGroupRecursively(groupId);
                 if (group.isStateTransitionValid(GroupStatus.Terminated)) {
-                    AppStatusGroupTerminatedEvent groupInTerminatedEvent =
-                            new AppStatusGroupTerminatedEvent(appId, groupId);
+                    GroupTerminatedEvent groupInTerminatedEvent =
+                            new GroupTerminatedEvent(appId, groupId);
                     publishEvent(groupInTerminatedEvent);
                 } else {
                     log.warn("Terminated is not in the possible state list of [group] " + groupId);
@@ -275,8 +275,8 @@ public class StatusEventPublisher {
                     if (log.isInfoEnabled()) {
                         log.info("Publishing Application activated event for [application]: " + appId);
                     }
-                    AppStatusApplicationActivatedEvent applicationActivatedEvent =
-                            new AppStatusApplicationActivatedEvent(appId);
+                    ApplicationActivatedEvent applicationActivatedEvent =
+                            new ApplicationActivatedEvent(appId);
 
                     publishEvent(applicationActivatedEvent);
                 } else {
@@ -298,8 +298,8 @@ public class StatusEventPublisher {
             Application application = TopologyManager.getTopology().getApplication(appId);
             if (application != null) {
                 if (application.isStateTransitionValid(ApplicationStatus.Inactive)) {
-                    AppStatusApplicationInactivatedEvent applicationInActivatedEvent =
-                            new AppStatusApplicationInactivatedEvent(appId);
+                    ApplicationInactivatedEvent applicationInActivatedEvent =
+                            new ApplicationInactivatedEvent(appId);
                     publishEvent(applicationInActivatedEvent);
                 } else {
                     log.warn("Inactive is not in the possible state list of [application] " + appId);
@@ -319,8 +319,8 @@ public class StatusEventPublisher {
                     if (log.isInfoEnabled()) {
                         log.info("Publishing Application terminated event for [application]: " + appId);
                     }
-                    AppStatusApplicationTerminatingEvent applicationTerminatingEvent =
-                            new AppStatusApplicationTerminatingEvent(appId);
+                    ApplicationTerminatingEvent applicationTerminatingEvent =
+                            new ApplicationTerminatingEvent(appId);
                     publishEvent(applicationTerminatingEvent);
                 } else {
                     log.warn("Terminating is not in the possible state list of [application] " + appId);
@@ -340,8 +340,8 @@ public class StatusEventPublisher {
                     if (log.isInfoEnabled()) {
                         log.info("Publishing Application terminated event for [application]: " + appId);
                     }
-                    AppStatusApplicationTerminatedEvent applicationTerminatedEvent =
-                            new AppStatusApplicationTerminatedEvent(appId, clusterData);
+                    ApplicationTerminatedEvent applicationTerminatedEvent =
+                            new ApplicationTerminatedEvent(appId, clusterData);
                     publishEvent(applicationTerminatedEvent);
                 } else {
                     log.warn("Terminated is not in the possible state list of [application] " + appId);

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
index 392a0d5..408776f 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
@@ -30,6 +30,7 @@ import org.apache.stratos.messaging.domain.applications.*;
 import org.apache.stratos.messaging.domain.topology.*;
 import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
 
+import javax.net.ssl.SSLEngineResult;
 import java.util.Map;
 
 /**
@@ -287,7 +288,7 @@ public class StatusChecker {
                 TopologyManager.acquireReadLockForApplication(appId);
                 Application application = TopologyManager.getTopology().getApplication(appId);
 
-                if (groups.isEmpty() && clusterStatus == ClusterStatus.Active ||
+                if (groups.isEmpty() && getClusterAllInSameState(clusterData,ClusterStatus.Active) ||
                         clusterData.isEmpty() && groupStatus == GroupStatus.Active ||
                         groupStatus == GroupStatus.Active && clusterStatus == ClusterStatus.Active) {
                     //send activation event
@@ -369,6 +370,65 @@ public class StatusChecker {
         return childFound;
     }
 
+    private boolean getGroupInActive(Map<String, Group> groups) {
+        boolean groupStat = false;
+        for (Group group : groups.values()) {
+            if (group.getStatus() == GroupStatus.Inactive) {
+                groupStat = true;
+                return groupStat;
+            } else {
+                groupStat = false;
+            }
+        }
+        return groupStat;
+    }
+
+    private boolean allGroupInSameState(Map<String, Group> groups, GroupStatus status) {
+        boolean groupStat = false;
+        for (Group group : groups.values()) {
+            if (group.getStatus() == status) {
+                groupStat = true;
+            } else {
+                groupStat = false;
+                return groupStat;
+            }
+        }
+        return groupStat;
+    }
+
+
+    private boolean getClusterInActive(Map<String, ClusterDataHolder> clusterData) {
+        boolean clusterStat = false;
+        for (Map.Entry<String, ClusterDataHolder> clusterDataHolderEntry : clusterData.entrySet()) {
+            Service service = TopologyManager.getTopology().getService(clusterDataHolderEntry.getValue().getServiceType());
+            Cluster cluster = service.getCluster(clusterDataHolderEntry.getValue().getClusterId());
+            if (cluster.getStatus() == ClusterStatus.Inactive) {
+                clusterStat = true;
+                return clusterStat;
+            } else {
+                clusterStat = false;
+
+            }
+        }
+        return clusterStat;
+    }
+
+    private boolean getClusterAllInSameState(Map<String, ClusterDataHolder> clusterData,
+                                             ClusterStatus status) {
+        boolean clusterStat = false;
+        for (Map.Entry<String, ClusterDataHolder> clusterDataHolderEntry : clusterData.entrySet()) {
+            Service service = TopologyManager.getTopology().getService(clusterDataHolderEntry.getValue().getServiceType());
+            Cluster cluster = service.getCluster(clusterDataHolderEntry.getValue().getClusterId());
+            if (cluster.getStatus() == status) {
+                clusterStat = true;
+            } else {
+                clusterStat = false;
+                return clusterStat;
+            }
+        }
+        return clusterStat;
+    }
+
     private GroupStatus getGroupStatus(Map<String, Group> groups) {
         GroupStatus status = null;
         boolean groupActive = true;

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationActivatedEvent.java
deleted file mode 100644
index f04ae02..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationActivatedEvent.java
+++ /dev/null
@@ -1,38 +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.application.status;
-
-import java.io.Serializable;
-
-/**
- * This event will be fired upon the application activated is detected.
- */
-public class AppStatusApplicationActivatedEvent extends StatusEvent implements Serializable {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String appId;
-
-    public AppStatusApplicationActivatedEvent(String appId) {
-        this.appId = appId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationCreatedEvent.java
deleted file mode 100644
index c432e14..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationCreatedEvent.java
+++ /dev/null
@@ -1,38 +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.application.status;
-
-import java.io.Serializable;
-
-/**
- * This event will be fired upon the application created is detected.
- */
-public class AppStatusApplicationCreatedEvent extends StatusEvent implements Serializable {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String appId;
-
-    public AppStatusApplicationCreatedEvent(String appId) {
-        this.appId = appId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationInactivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationInactivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationInactivatedEvent.java
deleted file mode 100644
index f00a97a..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationInactivatedEvent.java
+++ /dev/null
@@ -1,38 +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.application.status;
-
-import java.io.Serializable;
-
-/**
- * This event will be fired upon the application inactivated is detected.
- */
-public class AppStatusApplicationInactivatedEvent extends StatusEvent implements Serializable {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String appId;
-
-    public AppStatusApplicationInactivatedEvent(String appId) {
-        this.appId = appId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationTerminatedEvent.java
deleted file mode 100644
index 2dafcdc..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationTerminatedEvent.java
+++ /dev/null
@@ -1,47 +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.application.status;
-
-import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
-
-import java.io.Serializable;
-import java.util.Set;
-
-/**
- * This event will be fired upon the application terminated is detected.
- */
-public class AppStatusApplicationTerminatedEvent extends StatusEvent implements Serializable {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String appId;
-    private Set<ClusterDataHolder> clusterData;
-
-    public AppStatusApplicationTerminatedEvent(String appId, Set<ClusterDataHolder> clusterData) {
-        this.appId = appId;
-        this.clusterData = clusterData;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-
-    public Set<ClusterDataHolder> getClusterData() {
-        return clusterData;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationTerminatingEvent.java
deleted file mode 100644
index e2a3a09..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusApplicationTerminatingEvent.java
+++ /dev/null
@@ -1,38 +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.application.status;
-
-import java.io.Serializable;
-
-/**
- * This event will be fired upon the application terminating is detected.
- */
-public class AppStatusApplicationTerminatingEvent extends StatusEvent implements Serializable {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String appId;
-
-    public AppStatusApplicationTerminatingEvent(String appId) {
-        this.appId = appId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterActivatedEvent.java
deleted file mode 100644
index c5737c6..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterActivatedEvent.java
+++ /dev/null
@@ -1,50 +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.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 AppStatusClusterActivatedEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppStatusClusterActivatedEvent(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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterCreatedEvent.java
deleted file mode 100644
index 6480af2..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterCreatedEvent.java
+++ /dev/null
@@ -1,50 +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.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 AppStatusClusterCreatedEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppStatusClusterCreatedEvent(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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterInactivateEvent.java
deleted file mode 100644
index 6d8ed46..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterInactivateEvent.java
+++ /dev/null
@@ -1,50 +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.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 AppStatusClusterInactivateEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppStatusClusterInactivateEvent(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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterMaintenanceModeEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterMaintenanceModeEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterMaintenanceModeEvent.java
deleted file mode 100644
index 527d86e..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterMaintenanceModeEvent.java
+++ /dev/null
@@ -1,49 +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.application.status;
-
-import java.io.Serializable;
-
-/**
- * This will be fired upon the cluster instability detection by either cep/autoscaler.
- */
-public class AppStatusClusterMaintenanceModeEvent extends StatusEvent implements Serializable {
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppStatusClusterMaintenanceModeEvent(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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterReadyToShutdownEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterReadyToShutdownEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterReadyToShutdownEvent.java
deleted file mode 100644
index 7841d9c..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterReadyToShutdownEvent.java
+++ /dev/null
@@ -1,47 +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.application.status;
-
-/**
- * This event is fired by autoscaler before actually terminate a cluster.
- */
-public class AppStatusClusterReadyToShutdownEvent extends StatusEvent {
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-
-    public AppStatusClusterReadyToShutdownEvent(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/f0ba4beb/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
deleted file mode 100644
index 919d0ca..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatedEvent.java
+++ /dev/null
@@ -1,50 +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.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/f0ba4beb/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
deleted file mode 100644
index 7a6baf0..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusClusterTerminatingEvent.java
+++ /dev/null
@@ -1,50 +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.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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupActivatedEvent.java
deleted file mode 100644
index 3da8667..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupActivatedEvent.java
+++ /dev/null
@@ -1,44 +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.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 AppStatusGroupActivatedEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String groupId;
-    private String appId;
-
-    public AppStatusGroupActivatedEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getGroupId() {
-        return this.groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupCreatedEvent.java
deleted file mode 100644
index 04ee30e..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupCreatedEvent.java
+++ /dev/null
@@ -1,44 +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.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 AppStatusGroupCreatedEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String groupId;
-    private String appId;
-
-    public AppStatusGroupCreatedEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getGroupId() {
-        return this.groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupInactivateEvent.java
deleted file mode 100644
index ee26292..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupInactivateEvent.java
+++ /dev/null
@@ -1,44 +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.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 AppStatusGroupInactivateEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String groupId;
-    private String appId;
-
-    public AppStatusGroupInactivateEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getGroupId() {
-        return this.groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupMaintenanceModeEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupMaintenanceModeEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupMaintenanceModeEvent.java
deleted file mode 100644
index a1a787c..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupMaintenanceModeEvent.java
+++ /dev/null
@@ -1,41 +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.application.status;
-
-/**
- * This event will be fired upon the instability of group detection by autoscaler.
- */
-public class AppStatusGroupMaintenanceModeEvent extends StatusEvent {
-    private String groupId;
-    private String appId;
-
-    public AppStatusGroupMaintenanceModeEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getGroupId(String groupId) {
-        return this.groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupReadyToShutdownEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupReadyToShutdownEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupReadyToShutdownEvent.java
deleted file mode 100644
index eaba17d..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupReadyToShutdownEvent.java
+++ /dev/null
@@ -1,40 +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.application.status;
-
-/**
- * This event is fired by autoscaler before actually terminate a group.
- */
-public class AppStatusGroupReadyToShutdownEvent extends StatusEvent {
-    private String groupId;
-    private String appId;
-
-    public AppStatusGroupReadyToShutdownEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getGroupId(String groupId) {
-        return this.groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupTerminatedEvent.java
deleted file mode 100644
index db31b64..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupTerminatedEvent.java
+++ /dev/null
@@ -1,44 +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.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 AppStatusGroupTerminatedEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String groupId;
-    private String appId;
-
-    public AppStatusGroupTerminatedEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getGroupId() {
-        return this.groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupTerminatingEvent.java
deleted file mode 100644
index 52db5fb..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/AppStatusGroupTerminatingEvent.java
+++ /dev/null
@@ -1,44 +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.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 AppStatusGroupTerminatingEvent extends StatusEvent {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String groupId;
-    private String appId;
-
-    public AppStatusGroupTerminatingEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getGroupId() {
-        return this.groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/StatusEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/StatusEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/StatusEvent.java
deleted file mode 100644
index 7ffc449..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/StatusEvent.java
+++ /dev/null
@@ -1,31 +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.application.status;
-
-import org.apache.stratos.messaging.event.Event;
-
-import java.io.Serializable;
-
-/**
- * Represents all instance status events.
- */
-public abstract class StatusEvent extends Event implements Serializable {
-    private static final long serialVersionUID = -4790128084271867615L;
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterActivatedEvent.java
new file mode 100644
index 0000000..688b382
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterActivatedEvent.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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class AppClusterActivatedEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public AppClusterActivatedEvent(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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterCreatedEvent.java
new file mode 100644
index 0000000..3382a34
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterCreatedEvent.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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class AppClusterCreatedEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public AppClusterCreatedEvent(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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterInactivateEvent.java
new file mode 100644
index 0000000..bf8926e
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterInactivateEvent.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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class AppClusterInactivateEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public AppClusterInactivateEvent(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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatedEvent.java
new file mode 100644
index 0000000..d269d38
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatedEvent.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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class AppClusterTerminatedEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public AppClusterTerminatedEvent(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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatingEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatingEvent.java
new file mode 100644
index 0000000..547a681
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppClusterTerminatingEvent.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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class AppClusterTerminatingEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private String appId;
+
+    public AppClusterTerminatingEvent(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/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
new file mode 100644
index 0000000..6eeb2dc
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
@@ -0,0 +1,44 @@
+/*
+ * 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.applications;
+
+/**
+ * This event is fired by cartridge agent when it has started the server and
+ * applications are ready to serve the incoming requests.
+ */
+public class AppStatusGroupInactivateEvent extends StatusEvent {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String groupId;
+    private String appId;
+
+    public AppStatusGroupInactivateEvent(String appId, String groupId) {
+        this.appId = appId;
+        this.groupId = groupId;
+    }
+
+    public String getGroupId() {
+        return this.groupId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationActivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationActivatedEvent.java
new file mode 100644
index 0000000..7e6a8b4
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationActivatedEvent.java
@@ -0,0 +1,38 @@
+/*
+ * 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.applications;
+
+import java.io.Serializable;
+
+/**
+ * This event will be fired upon the application activated is detected.
+ */
+public class ApplicationActivatedEvent extends StatusEvent implements Serializable {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String appId;
+
+    public ApplicationActivatedEvent(String appId) {
+        this.appId = appId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/f0ba4beb/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationCreatedEvent.java
new file mode 100644
index 0000000..5d220fa
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/ApplicationCreatedEvent.java
@@ -0,0 +1,38 @@
+/*
+ * 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.applications;
+
+import java.io.Serializable;
+
+/**
+ * This event will be fired upon the application created is detected.
+ */
+public class ApplicationCreatedEvent extends StatusEvent implements Serializable {
+    private static final long serialVersionUID = 2625412714611885089L;
+
+    private String appId;
+
+    public ApplicationCreatedEvent(String appId) {
+        this.appId = appId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+}