You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/01/09 18:04:38 UTC

[2/7] stratos git commit: Renaming applications package to application in messaging component

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceActivatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceActivatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceActivatedProcessor.java
deleted file mode 100644
index c74d176..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceActivatedProcessor.java
+++ /dev/null
@@ -1,120 +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.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Applications;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.instance.GroupInstance;
-import org.apache.stratos.messaging.event.applications.GroupInstanceActivatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
-import org.apache.stratos.messaging.util.Util;
-
-/**
- * This processor will act upon the Group activation events
- */
-public class GroupInstanceActivatedProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupInstanceActivatedProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        Applications applications = (Applications) object;
-
-        if (GroupInstanceActivatedEvent.class.getName().equals(type)) {
-            // Return if applications has not been initialized
-            if (!applications.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupInstanceActivatedEvent event = (GroupInstanceActivatedEvent) Util.
-                    jsonToObject(message, GroupInstanceActivatedEvent.class);
-
-            ApplicationsUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, applications);
-
-            } finally {
-                ApplicationsUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } else {
-            if (nextProcessor != null) {
-                // ask the next processor to take care of the message.
-                return nextProcessor.process(type, message, applications);
-            } else {
-                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-
-    private boolean doProcess(GroupInstanceActivatedEvent event, Applications applications) {
-
-        // Validate event against the existing topology
-        Application application = applications.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()));
-                return false;
-            }
-        } else {
-            GroupInstance context = group.getInstanceContexts(event.getInstanceId());
-            if(context == null) {
-                if (log.isWarnEnabled()) {
-                    log.warn(String.format("Group Instance not exists in Group: [AppId] %s [groupId] %s " +
-                                    "[instanceId] %s", event.getAppId(), event.getGroupId(),
-                            event.getInstanceId()));
-                    return false;
-                }
-            }
-            // Apply changes to the topology
-            GroupStatus status = GroupStatus.Active;
-            if (!context.isStateTransitionValid(status)) {
-                log.error("Invalid State Transition from " + context.getStatus() + " to " +
-                        status);
-                return false;
-            }
-            context.setStatus(status);
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceCreatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceCreatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceCreatedProcessor.java
deleted file mode 100644
index 4031d55..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceCreatedProcessor.java
+++ /dev/null
@@ -1,116 +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.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Applications;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.instance.GroupInstance;
-import org.apache.stratos.messaging.event.applications.GroupInstanceCreatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
-import org.apache.stratos.messaging.util.Util;
-
-/**
- * This processor will act upon the Group activation events
- */
-public class GroupInstanceCreatedProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupInstanceCreatedProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        Applications applications = (Applications) object;
-
-        if (GroupInstanceCreatedEvent.class.getName().equals(type)) {
-            // Return if applications has not been initialized
-            if (!applications.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupInstanceCreatedEvent event = (GroupInstanceCreatedEvent) Util.
-                    jsonToObject(message, GroupInstanceCreatedEvent.class);
-
-            ApplicationsUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, applications);
-
-            } finally {
-                ApplicationsUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } else {
-            if (nextProcessor != null) {
-                // ask the next processor to take care of the message.
-                return nextProcessor.process(type, message, applications);
-            } else {
-                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-
-    private boolean doProcess(GroupInstanceCreatedEvent event, Applications applications) {
-
-        // Validate event against the existing applications
-        Application application = applications.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()));
-                return false;
-            }
-        } else {
-            // Apply changes to the applications
-            String instanceId = event.getGroupInstance().getInstanceId();
-            GroupInstance context = group.getInstanceContexts(instanceId);
-            if(context != null) {
-                if (log.isWarnEnabled()) {
-                    log.warn(String.format("Group Instance already exists in Group: [AppId] %s [groupId] %s " +
-                                    "[instanceId] %s", event.getAppId(), event.getGroupId(),
-                            instanceId));
-                    return false;
-                }
-            }
-            // Apply changes to the topology
-            group.addInstance(instanceId, event.getGroupInstance());
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceInactivateProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceInactivateProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceInactivateProcessor.java
deleted file mode 100644
index df749ea..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceInactivateProcessor.java
+++ /dev/null
@@ -1,120 +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.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Applications;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.instance.GroupInstance;
-import org.apache.stratos.messaging.event.applications.GroupInstanceInactivatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
-import org.apache.stratos.messaging.util.Util;
-
-/**
- * This processor will act upon the Group activation events
- */
-public class GroupInstanceInactivateProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupInstanceInactivateProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        Applications applications = (Applications) object;
-
-        if (GroupInstanceInactivatedEvent.class.getName().equals(type)) {
-            // Return if applications has not been initialized
-            if (!applications.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupInstanceInactivatedEvent event = (GroupInstanceInactivatedEvent) Util.
-                    jsonToObject(message, GroupInstanceInactivatedEvent.class);
-
-            ApplicationsUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, applications);
-
-            } finally {
-                ApplicationsUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } else {
-            if (nextProcessor != null) {
-                // ask the next processor to take care of the message.
-                return nextProcessor.process(type, message, applications);
-            } else {
-                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-
-    private boolean doProcess(GroupInstanceInactivatedEvent event, Applications applications) {
-
-        // Validate event against the existing applications
-        Application application = applications.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()));
-                return false;
-            }
-        } else {
-            GroupInstance context = group.getInstanceContexts(event.getInstanceId());
-            if(context == null) {
-                if (log.isWarnEnabled()) {
-                    log.warn(String.format("Group Instance not exists in Group: [AppId] %s [groupId] %s " +
-                                    "[instanceId] %s", event.getAppId(), event.getGroupId(),
-                            event.getInstanceId()));
-                    return false;
-                }
-            }
-            // Apply changes to the topology
-            GroupStatus status = GroupStatus.Inactive;
-            if (!context.isStateTransitionValid(status)) {
-                log.error("Invalid State Transition from " + context.getStatus() + " to " +
-                        status);
-                return false;
-            }
-            context.setStatus(status);
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceTerminatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceTerminatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceTerminatedProcessor.java
deleted file mode 100644
index 10a1a70..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceTerminatedProcessor.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.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.Applications;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.instance.GroupInstance;
-import org.apache.stratos.messaging.event.applications.GroupInstanceTerminatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
-import org.apache.stratos.messaging.util.Util;
-
-/**
- * This processor will act upon the Group activation events
- */
-public class GroupInstanceTerminatedProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupInstanceTerminatedProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        Applications applications = (Applications) object;
-
-        if (GroupInstanceTerminatedEvent.class.getName().equals(type)) {
-            // Return if applications has not been initialized
-            if (!applications.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupInstanceTerminatedEvent event = (GroupInstanceTerminatedEvent) Util.
-                    jsonToObject(message, GroupInstanceTerminatedEvent.class);
-
-            ApplicationsUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, applications);
-
-            } finally {
-                ApplicationsUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } else {
-            if (nextProcessor != null) {
-                // ask the next processor to take care of the message.
-                return nextProcessor.process(type, message, applications);
-            } else {
-                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-
-    private boolean doProcess(GroupInstanceTerminatedEvent event, Applications applications) {
-
-        // Validate event against the existing applications
-        Application application = applications.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()));
-                return false;
-            }
-        } else {
-            GroupInstance context = group.getInstanceContexts(event.getInstanceId());
-            if(context == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug(String.format("Group Instance alread removed in Group: [AppId] %s [groupId] %s " +
-                                    "[instanceId] %s", event.getAppId(), event.getGroupId(),
-                            event.getInstanceId()));
-                }
-            } else {
-                // Apply changes to the topology
-                GroupStatus status = GroupStatus.Terminated;
-                if (!context.isStateTransitionValid(status)) {
-                    log.error("Invalid State Transition from " + context.getStatus() + " to " +
-                            status);
-                    return false;
-                }
-                context.setStatus(status);
-                group.removeInstance(event.getInstanceId());
-            }
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceTerminatingProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceTerminatingProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceTerminatingProcessor.java
deleted file mode 100644
index e3a8708..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInstanceTerminatingProcessor.java
+++ /dev/null
@@ -1,122 +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.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Applications;
-import org.apache.stratos.messaging.domain.applications.Group;
-import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.domain.instance.GroupInstance;
-import org.apache.stratos.messaging.event.applications.GroupInstanceTerminatingEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
-import org.apache.stratos.messaging.util.Util;
-
-/**
- * This processor will act upon the Group activation events
- */
-public class GroupInstanceTerminatingProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(GroupInstanceTerminatingProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        Applications applications = (Applications) object;
-
-        if (GroupInstanceTerminatingEvent.class.getName().equals(type)) {
-            // Return if applications has not been initialized
-            if (!applications.isInitialized())
-                return false;
-
-            // Parse complete message and build event
-            GroupInstanceTerminatingEvent event = (GroupInstanceTerminatingEvent) Util.
-                    jsonToObject(message, GroupInstanceTerminatingEvent.class);
-
-            ApplicationsUpdater.acquireWriteLockForApplication(event.getAppId());
-
-            try {
-                return doProcess(event, applications);
-
-            } finally {
-                ApplicationsUpdater.releaseWriteLockForApplication(event.getAppId());
-            }
-
-        } else {
-            if (nextProcessor != null) {
-                // ask the next processor to take care of the message.
-                return nextProcessor.process(type, message, applications);
-            } else {
-                throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-
-    private boolean doProcess(GroupInstanceTerminatingEvent event, Applications applications) {
-
-        // Validate event against the existing applications
-        Application application = applications.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()));
-                return false;
-            }
-        } else {
-            // Apply changes to the applications
-            GroupInstance context = group.getInstanceContexts(event.getInstanceId());
-            if(context == null) {
-                if (log.isWarnEnabled()) {
-                    log.warn(String.format("Group Instance not exists in Group: [AppId] %s [groupId] %s " +
-                                    "[instanceId] %s", event.getAppId(), event.getGroupId(),
-                            event.getInstanceId()));
-                    return false;
-                }
-            }
-            // Apply changes to the topology
-            GroupStatus status = GroupStatus.Terminating;
-            if (!context.isStateTransitionValid(status)) {
-                log.error("Invalid State Transition from " + context.getStatus() + " to " +
-                        status);
-                return false;
-            }
-            context.setStatus(status);
-
-        }
-
-        // Notify event listeners
-        notifyEventListeners(event);
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/updater/ApplicationsUpdater.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/updater/ApplicationsUpdater.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/updater/ApplicationsUpdater.java
deleted file mode 100644
index 5a45ff0..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/updater/ApplicationsUpdater.java
+++ /dev/null
@@ -1,138 +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.updater;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.locking.ApplicationLock;
-import org.apache.stratos.messaging.domain.applications.locking.ApplicationLockHierarchy;
-import org.apache.stratos.messaging.message.receiver.applications.ApplicationManager;
-
-/**
- * Used to lock the Topology for writes by messaging component
- * <p/>
- * Acquire a write lock:
- * <p/>
- * From root level, acquire read lock, and acquire a write lock only for the
- * relevant sub tree.
- * <p/>
- * Example 1: Acquiring write lock for a Cluster to modify the Cluster object -
- * acquiring:
- * public static void acquireWriteLockForCluster (String serviceName, String clusterId)
- * <p/>
- * releasing:
- * public static void releaseWriteLockForCluster (String serviceName, String clusterId)
- * <p/>
- * Example 2: Acquiring write lock to add a new Cluster object -
- * acquiring:
- * public static void acquireWriteLockForService (String serviceName)
- * <p/>
- * releasing:
- * public static void releaseWriteLockForService (String serviceName)
- * <p/>
- * Example 3: Acquiring the write lock to add a deploy a Cartridge (add a new Service)
- * acquire:
- * public static void acquireWriteLockForServices()
- * <p/>
- * release:
- * public static void releaseWriteLockForServices()
- */
-
-public class ApplicationsUpdater {
-
-    private static final Log log = LogFactory.getLog(ApplicationsUpdater.class);
-
-    private static volatile ApplicationLockHierarchy applicationLockHierarchy =
-            ApplicationLockHierarchy.getInstance();
-
-    // Top level locks - should be used to lock the entire Topology
-
-    /**
-     * Acquires write lock for all Applications
-     */
-    public static void acquireWriteLockForApplications() {
-        if (log.isDebugEnabled()) {
-            log.debug("Write lock acquired for Applications");
-        }
-        applicationLockHierarchy.getApplicationLock().acquireWriteLock();
-    }
-
-    /**
-     * Releases write lock for all Applications
-     */
-    public static void releaseWriteLockForApplications() {
-        if (log.isDebugEnabled()) {
-            log.debug("Write lock released for Applications");
-        }
-        applicationLockHierarchy.getApplicationLock().releaseWritelock();
-    }
-
-    /**
-     * Acquires write lock for the Application
-     *
-     * @param appId Application id
-     */
-    public static void acquireWriteLockForApplication(String appId) {
-
-        // acquire read lock for all Applications
-        ApplicationManager.acquireReadLockForApplications();
-
-        ApplicationLock applicationLock = applicationLockHierarchy.getLockForApplication(appId);
-        if (applicationLock == null) {
-            handleLockNotFound("Topology lock not found for Application " + appId);
-
-        } else {
-            // now, lock Application
-            applicationLock.acquireWriteLock();
-            if (log.isDebugEnabled()) {
-                log.debug("Write lock acquired for Application " + appId);
-            }
-        }
-    }
-
-    /**
-     * Releases write lock for the Application
-     *
-     * @param appId Application id
-     */
-    public static void releaseWriteLockForApplication(String appId) {
-
-        ApplicationLock applicationLock = applicationLockHierarchy.getLockForApplication(appId);
-        if (applicationLock == null) {
-            handleLockNotFound("Topology lock not found for Application " + appId);
-
-        } else {
-            // release App lock
-            applicationLock.releaseWritelock();
-            if (log.isDebugEnabled()) {
-                log.debug("Write lock released for Application " + appId);
-            }
-        }
-
-        // release read lock for all Applications
-        ApplicationManager.releaseReadLockForApplications();
-    }
-
-    private static void handleLockNotFound(String errorMsg) {
-        log.warn(errorMsg);
-        //throw new RuntimeException(errorMsg);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameAddedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameAddedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameAddedMessageProcessor.java
index c87c48f..c905cb0 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameAddedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameAddedMessageProcessor.java
@@ -21,12 +21,12 @@ package org.apache.stratos.messaging.message.processor.domain.mapping;
 
 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.application.Application;
 import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
 import org.apache.stratos.messaging.domain.tenant.Tenant;
 import org.apache.stratos.messaging.event.domain.mapping.DomainMappingAddedEvent;
 import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.message.receiver.applications.ApplicationManager;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
 import org.apache.stratos.messaging.message.receiver.domain.mapping.DomainMappingManager;
 import org.apache.stratos.messaging.message.receiver.tenant.TenantManager;
 import org.apache.stratos.messaging.util.Util;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameRemovedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameRemovedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameRemovedMessageProcessor.java
index f0c22ef..497104a 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameRemovedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameRemovedMessageProcessor.java
@@ -21,13 +21,12 @@ package org.apache.stratos.messaging.message.processor.domain.mapping;
 
 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.application.Application;
 import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
-import org.apache.stratos.messaging.domain.tenant.Subscription;
 import org.apache.stratos.messaging.domain.tenant.Tenant;
 import org.apache.stratos.messaging.event.domain.mapping.DomainMappingRemovedEvent;
 import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.message.receiver.applications.ApplicationManager;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
 import org.apache.stratos.messaging.message.receiver.domain.mapping.DomainMappingManager;
 import org.apache.stratos.messaging.message.receiver.tenant.TenantManager;
 import org.apache.stratos.messaging.util.Util;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java
index 2073b5e..c5a1988 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java
@@ -21,7 +21,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.domain.applications.ClusterDataHolder;
+import org.apache.stratos.messaging.domain.application.ClusterDataHolder;
 import org.apache.stratos.messaging.domain.topology.Service;
 import org.apache.stratos.messaging.domain.topology.Topology;
 import org.apache.stratos.messaging.event.topology.ApplicationClustersRemovedEvent;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyMessageProcessor.java
index ea1f83b..55f6666 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyMessageProcessor.java
@@ -20,7 +20,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.domain.applications.Application;
 import org.apache.stratos.messaging.domain.topology.*;
 import org.apache.stratos.messaging.domain.topology.locking.TopologyLock;
 import org.apache.stratos.messaging.domain.topology.locking.TopologyLockHierarchy;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationManager.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationManager.java
new file mode 100644
index 0000000..1e0dfd3
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationManager.java
@@ -0,0 +1,119 @@
+/*
+ * 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;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.application.Applications;
+import org.apache.stratos.messaging.domain.application.locking.ApplicationLock;
+import org.apache.stratos.messaging.domain.application.locking.ApplicationLockHierarchy;
+
+public class ApplicationManager {
+
+    private static final Log log = LogFactory.getLog(ApplicationManager.class);
+
+    private static volatile Applications applications;
+    private static volatile ApplicationLockHierarchy applicationLockHierarchy =
+            ApplicationLockHierarchy.getInstance();
+
+    public static Applications getApplications () {
+
+        if (applications == null) {
+            synchronized (ApplicationManager.class){
+                if (applications == null) {
+                    applications = new Applications();
+                    if(log.isDebugEnabled()) {
+                        log.debug("Applications object created");
+                    }
+                }
+            }
+        }
+        return applications;
+    }
+
+    /**
+     * Acquires read lock for all Applications
+     */
+    public static void acquireReadLockForApplications() {
+        if(log.isDebugEnabled()) {
+            log.debug("Read lock acquired for applications");
+        }
+        applicationLockHierarchy.getApplicationLock().acquireReadLock();
+    }
+
+    /**
+     * Releases read lock for all Applications
+     */
+    public static void releaseReadLockForApplications() {
+        if(log.isDebugEnabled()) {
+            log.debug("Read lock released for applications");
+        }
+        applicationLockHierarchy.getApplicationLock().releaseReadLock();
+    }
+
+    /**
+     * Acquires read lock for an Application
+     *
+     * @param applicationId Application Id to acquire read lock
+     */
+    public static void acquireReadLockForApplication(String applicationId) {
+
+        // acquire read lock for all Applications
+        acquireReadLockForApplications();
+
+        ApplicationLock applicationLock = applicationLockHierarchy.getLockForApplication(applicationId);
+        if (applicationLock == null) {
+            handleLockNotFound("Application lock not found: [application-id] " + applicationId);
+
+        } else {
+            applicationLock.acquireReadLock();
+            if(log.isDebugEnabled()) {
+                log.debug("Read lock acquired: [application-id] " + applicationId);
+            }
+        }
+    }
+
+    /**
+     * Releases read lock for an Application
+     *
+     * @param applicationId Application Id to release read lock
+     */
+    public static void releaseReadLockForApplication(String applicationId) {
+
+        ApplicationLock applicationLock = applicationLockHierarchy.getLockForApplication(applicationId);
+        if (applicationLock == null) {
+            handleLockNotFound("Application lock not found: [application-id] " + applicationId);
+
+        } else {
+            applicationLock.releaseReadLock();
+            if(log.isDebugEnabled()) {
+                log.debug("Read lock released: [application-id] " + applicationId);
+            }
+        }
+
+        // release read lock for all Applications
+        releaseReadLockForApplications();
+    }
+
+    private static void handleLockNotFound (String errorMsg) {
+        log.warn(errorMsg);
+        //throw new RuntimeException(errorMsg);
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageDelegator.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageDelegator.java
new file mode 100644
index 0000000..b20b9ac
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageDelegator.java
@@ -0,0 +1,142 @@
+/*
+ * 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;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.Message;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
+import org.apache.stratos.messaging.message.processor.application.ApplicationsMessageProcessorChain;
+
+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 {
+                    Message message = messageQueue.take();
+                    String type = message.getEventClassName();
+
+                    // 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, ApplicationManager.getApplications());
+                } 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/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageListener.java
new file mode 100644
index 0000000..1e5598e
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageListener.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.message.receiver.application;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.broker.subscribe.MessageListener;
+import org.apache.stratos.messaging.domain.Message;
+
+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 messageReceived(Message message) {
+        try {
+            if (log.isDebugEnabled()) {
+                log.debug(String.format("Tenant message received: %s", message.getText()));
+            }
+            // Add received message to the queue
+            messageQueue.add(message);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageQueue.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageQueue.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageQueue.java
new file mode 100644
index 0000000..a84f556
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventMessageQueue.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.message.receiver.application;
+
+
+import org.apache.stratos.messaging.domain.Message;
+
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class ApplicationsEventMessageQueue extends LinkedBlockingQueue<Message> {
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventReceiver.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventReceiver.java
new file mode 100644
index 0000000..1675275
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/ApplicationsEventReceiver.java
@@ -0,0 +1,87 @@
+/*
+ * 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;
+
+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.Util;
+
+import java.util.concurrent.ExecutorService;
+
+public class ApplicationsEventReceiver {
+    private static final Log log = LogFactory.getLog(ApplicationsEventReceiver.class);
+
+    private ApplicationsEventMessageDelegator messageDelegator;
+    private ApplicationsEventMessageListener messageListener;
+    private TopicSubscriber topicSubscriber;
+    private boolean terminated;
+	private ExecutorService executorService;
+
+    public ApplicationsEventReceiver() {
+        ApplicationsEventMessageQueue messageQueue = new ApplicationsEventMessageQueue();
+        this.messageDelegator = new ApplicationsEventMessageDelegator(messageQueue);
+        this.messageListener = new ApplicationsEventMessageListener(messageQueue);
+    }
+
+    public void addEventListener(EventListener eventListener) {
+        messageDelegator.addEventListener(eventListener);
+    }
+
+
+    public void execute() {
+        try {
+            // Start topic subscriber thread
+            topicSubscriber = new TopicSubscriber(Util.Topics.APPLICATIONS_TOPIC.getTopicName(), messageListener);
+			executorService.execute(topicSubscriber);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Application status event message receiver thread started");
+            }
+
+            // Start Application status event message delegator thread
+	        executorService.execute(messageDelegator);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Application status event message delegator thread started");
+            }
+
+
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("Application status failed", e);
+            }
+        }
+    }
+
+    public void terminate() {
+        topicSubscriber.terminate();
+        messageDelegator.terminate();
+        terminated = true;
+    }
+
+	public ExecutorService getExecutorService() {
+		return executorService;
+	}
+
+	public void setExecutorService(ExecutorService executorService) {
+		this.executorService = executorService;
+	}
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationManager.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationManager.java
deleted file mode 100644
index 8302e2a..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationManager.java
+++ /dev/null
@@ -1,119 +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.applications;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.applications.Applications;
-import org.apache.stratos.messaging.domain.applications.locking.ApplicationLock;
-import org.apache.stratos.messaging.domain.applications.locking.ApplicationLockHierarchy;
-
-public class ApplicationManager {
-
-    private static final Log log = LogFactory.getLog(ApplicationManager.class);
-
-    private static volatile Applications applications;
-    private static volatile ApplicationLockHierarchy applicationLockHierarchy =
-            ApplicationLockHierarchy.getInstance();
-
-    public static Applications getApplications () {
-
-        if (applications == null) {
-            synchronized (ApplicationManager.class){
-                if (applications == null) {
-                    applications = new Applications();
-                    if(log.isDebugEnabled()) {
-                        log.debug("Applications object created");
-                    }
-                }
-            }
-        }
-        return applications;
-    }
-
-    /**
-     * Acquires read lock for all Applications
-     */
-    public static void acquireReadLockForApplications() {
-        if(log.isDebugEnabled()) {
-            log.debug("Read lock acquired for applications");
-        }
-        applicationLockHierarchy.getApplicationLock().acquireReadLock();
-    }
-
-    /**
-     * Releases read lock for all Applications
-     */
-    public static void releaseReadLockForApplications() {
-        if(log.isDebugEnabled()) {
-            log.debug("Read lock released for applications");
-        }
-        applicationLockHierarchy.getApplicationLock().releaseReadLock();
-    }
-
-    /**
-     * Acquires read lock for an Application
-     *
-     * @param applicationId Application Id to acquire read lock
-     */
-    public static void acquireReadLockForApplication(String applicationId) {
-
-        // acquire read lock for all Applications
-        acquireReadLockForApplications();
-
-        ApplicationLock applicationLock = applicationLockHierarchy.getLockForApplication(applicationId);
-        if (applicationLock == null) {
-            handleLockNotFound("Application lock not found: [application-id] " + applicationId);
-
-        } else {
-            applicationLock.acquireReadLock();
-            if(log.isDebugEnabled()) {
-                log.debug("Read lock acquired: [application-id] " + applicationId);
-            }
-        }
-    }
-
-    /**
-     * Releases read lock for an Application
-     *
-     * @param applicationId Application Id to release read lock
-     */
-    public static void releaseReadLockForApplication(String applicationId) {
-
-        ApplicationLock applicationLock = applicationLockHierarchy.getLockForApplication(applicationId);
-        if (applicationLock == null) {
-            handleLockNotFound("Application lock not found: [application-id] " + applicationId);
-
-        } else {
-            applicationLock.releaseReadLock();
-            if(log.isDebugEnabled()) {
-                log.debug("Read lock released: [application-id] " + applicationId);
-            }
-        }
-
-        // release read lock for all Applications
-        releaseReadLockForApplications();
-    }
-
-    private static void handleLockNotFound (String errorMsg) {
-        log.warn(errorMsg);
-        //throw new RuntimeException(errorMsg);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/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
deleted file mode 100644
index 77f4630..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageDelegator.java
+++ /dev/null
@@ -1,142 +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.applications;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.Message;
-import org.apache.stratos.messaging.listener.EventListener;
-import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
-import org.apache.stratos.messaging.message.processor.applications.ApplicationsMessageProcessorChain;
-
-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 {
-                    Message message = messageQueue.take();
-                    String type = message.getEventClassName();
-
-                    // 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, ApplicationManager.getApplications());
-                } 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/c65438a3/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
deleted file mode 100644
index f5c407e..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageListener.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.message.receiver.applications;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.broker.subscribe.MessageListener;
-import org.apache.stratos.messaging.domain.Message;
-
-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 messageReceived(Message message) {
-        try {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Tenant message received: %s", message.getText()));
-            }
-            // Add received message to the queue
-            messageQueue.add(message);
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/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
deleted file mode 100644
index 88676c6..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventMessageQueue.java
+++ /dev/null
@@ -1,28 +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.applications;
-
-
-import org.apache.stratos.messaging.domain.Message;
-
-import javax.jms.TextMessage;
-import java.util.concurrent.LinkedBlockingQueue;
-
-public class ApplicationsEventMessageQueue extends LinkedBlockingQueue<Message> {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/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
deleted file mode 100644
index 657efa5..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/applications/ApplicationsEventReceiver.java
+++ /dev/null
@@ -1,87 +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.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.Util;
-
-import java.util.concurrent.ExecutorService;
-
-public class ApplicationsEventReceiver {
-    private static final Log log = LogFactory.getLog(ApplicationsEventReceiver.class);
-
-    private ApplicationsEventMessageDelegator messageDelegator;
-    private ApplicationsEventMessageListener messageListener;
-    private TopicSubscriber topicSubscriber;
-    private boolean terminated;
-	private ExecutorService executorService;
-
-    public ApplicationsEventReceiver() {
-        ApplicationsEventMessageQueue messageQueue = new ApplicationsEventMessageQueue();
-        this.messageDelegator = new ApplicationsEventMessageDelegator(messageQueue);
-        this.messageListener = new ApplicationsEventMessageListener(messageQueue);
-    }
-
-    public void addEventListener(EventListener eventListener) {
-        messageDelegator.addEventListener(eventListener);
-    }
-
-
-    public void execute() {
-        try {
-            // Start topic subscriber thread
-            topicSubscriber = new TopicSubscriber(Util.Topics.APPLICATIONS_TOPIC.getTopicName(), messageListener);
-			executorService.execute(topicSubscriber);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Application status event message receiver thread started");
-            }
-
-            // Start Application status event message delegator thread
-	        executorService.execute(messageDelegator);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Application status event message delegator thread started");
-            }
-
-
-        } catch (Exception e) {
-            if (log.isErrorEnabled()) {
-                log.error("Application status failed", e);
-            }
-        }
-    }
-
-    public void terminate() {
-        topicSubscriber.terminate();
-        messageDelegator.terminate();
-        terminated = true;
-    }
-
-	public ExecutorService getExecutorService() {
-		return executorService;
-	}
-
-	public void setExecutorService(ExecutorService executorService) {
-		this.executorService = executorService;
-	}
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.messaging/src/test/java/org/apache/stratos/messaging/topology/locking/TopologyLockingTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/test/java/org/apache/stratos/messaging/topology/locking/TopologyLockingTest.java b/components/org.apache.stratos.messaging/src/test/java/org/apache/stratos/messaging/topology/locking/TopologyLockingTest.java
index 6363307..a3c6950 100644
--- a/components/org.apache.stratos.messaging/src/test/java/org/apache/stratos/messaging/topology/locking/TopologyLockingTest.java
+++ b/components/org.apache.stratos.messaging/src/test/java/org/apache/stratos/messaging/topology/locking/TopologyLockingTest.java
@@ -19,15 +19,7 @@
 
 package org.apache.stratos.messaging.topology.locking;
 
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
 import org.apache.stratos.messaging.domain.topology.*;
-import org.apache.stratos.messaging.message.processor.topology.updater.TopologyUpdater;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-import org.junit.*;
-
-import java.util.HashMap;
-import java.util.Map;
 
 public class TopologyLockingTest {
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index cb7a4ef..fbe747f 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -52,11 +52,11 @@ import org.apache.stratos.common.client.StratosManagerServiceClient;
 import org.apache.stratos.manager.service.stub.domain.ApplicationSignUp;
 import org.apache.stratos.manager.utils.ApplicationManagementUtil;
 import org.apache.stratos.manager.utils.CartridgeConstants;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
-import org.apache.stratos.messaging.domain.applications.Group;
+import org.apache.stratos.messaging.domain.application.Application;
+import org.apache.stratos.messaging.domain.application.ClusterDataHolder;
+import org.apache.stratos.messaging.domain.application.Group;
 import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.messaging.message.receiver.applications.ApplicationManager;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
 import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
 import org.apache.stratos.rest.endpoint.exception.RestAPIException;
 import org.apache.stratos.rest.endpoint.util.converter.ObjectConverter;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c65438a3/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
index e3f18f8..997616d 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
@@ -50,8 +50,8 @@ import org.apache.stratos.common.util.CommonUtil;
 import org.apache.stratos.common.beans.DependencyDefinitions;
 import org.apache.stratos.manager.service.stub.domain.ApplicationSignUp;
 import org.apache.stratos.manager.service.stub.domain.ArtifactRepository;
-import org.apache.stratos.messaging.domain.applications.Application;
-import org.apache.stratos.messaging.domain.applications.Group;
+import org.apache.stratos.messaging.domain.application.Application;
+import org.apache.stratos.messaging.domain.application.Group;
 import org.apache.stratos.messaging.domain.instance.ApplicationInstance;
 import org.apache.stratos.messaging.domain.instance.ClusterInstance;
 import org.apache.stratos.messaging.domain.instance.GroupInstance;