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/03/05 07:45:39 UTC

[2/9] stratos git commit: PCA - Renamed SubscriptionDomain*Event to DomainMapping*Event, replaced extension scripts

PCA - Renamed SubscriptionDomain*Event to DomainMapping*Event, replaced extension scripts


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

Branch: refs/heads/master
Commit: da243903254656ad4fd9197e81e9cacfa25e68c3
Parents: ee66a9c
Author: Chamila de Alwis <ch...@wso2.com>
Authored: Mon Feb 23 14:39:09 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Thu Mar 5 12:15:29 2015 +0530

----------------------------------------------------------------------
 .../cartridge.agent/cartridge.agent/agent.py    | 21 +++---
 .../extensions/domain-mapping-added.sh          | 41 +++++++++++
 .../extensions/domain-mapping-removed.sh        | 39 ++++++++++
 .../extensions/subscription-domain-added.sh     | 39 ----------
 .../extensions/subscription-domain-removed.sh   | 37 ----------
 .../modules/event/domain/__init__.py            | 18 +++++
 .../modules/event/domain/mapping/__init__.py    | 18 +++++
 .../modules/event/domain/mapping/events.py      | 77 ++++++++++++++++++++
 .../modules/event/eventhandler.py               | 42 ++++++-----
 .../modules/event/tenant/events.py              | 53 --------------
 .../src/main/extensions/domain-mapping-added.sh | 41 +++++++++++
 .../main/extensions/domain-mapping-removed.sh   | 39 ++++++++++
 .../extensions/subscription-domain-added.sh     | 39 ----------
 .../extensions/subscription-domain-removed.sh   | 37 ----------
 .../packs/extensions/domain-mapping-added.sh    | 29 ++++++++
 .../packs/extensions/domain-mapping-removed.sh  | 29 ++++++++
 .../extensions/subscription-domain-added.sh     | 29 --------
 .../extensions/subscription-domain-removed.sh   | 29 --------
 tools/puppet3/modules/agent/manifests/init.pp   |  4 +-
 .../extensions/domain-mapping-added.sh.erb      | 29 ++++++++
 .../extensions/domain-mapping-removed.sh.erb    | 29 ++++++++
 .../extensions/subscription-domain-added.sh.erb | 29 --------
 .../subscription-domain-removed.sh.erb          | 29 --------
 .../extensions/domain-mapping-added.sh.erb      | 39 ++++++++++
 .../extensions/domain-mapping-removed.sh.erb    | 36 +++++++++
 .../extensions/subscription-domain-added.sh.erb | 35 ---------
 .../subscription-domain-removed.sh.erb          | 34 ---------
 .../modules/python_agent/manifests/init.pp      |  4 +-
 .../extensions/domain-mapping-added.sh.erb      | 39 ++++++++++
 .../extensions/domain-mapping-removed.sh.erb    | 36 +++++++++
 .../extensions/subscription-domain-added.sh.erb | 35 ---------
 .../subscription-domain-removed.sh.erb          | 34 ---------
 32 files changed, 577 insertions(+), 492 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py
index 1efb0c6..4268269 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py
@@ -24,6 +24,7 @@ from modules.event.instance.notifier.events import *
 from modules.event.tenant.events import *
 from modules.event.topology.events import *
 from modules.event.application.signup.events import *
+from modules.event.domain.mapping.events import *
 from modules.tenant.tenantcontext import *
 from modules.topology.topologycontext import *
 from modules.datapublisher.logpublisher import *
@@ -161,10 +162,10 @@ class CartridgeAgent(threading.Thread):
 
     def register_tenant_event_listeners(self):
         self.__log.debug("Starting tenant event message receiver thread")
-        self.__tenant_topic_subscriber.register_handler("SubscriptionDomainAddedEvent",
-                                                        self.on_subscription_domain_added)
-        self.__tenant_topic_subscriber.register_handler("SubscriptionDomainsRemovedEvent",
-                                                        self.on_subscription_domain_removed)
+        self.__tenant_topic_subscriber.register_handler("DomainMappingAddedEvent",
+                                                        self.on_domain_mapping_added)
+        self.__tenant_topic_subscriber.register_handler("DomainsMappingRemovedEvent",
+                                                        self.on_domain_mapping_removed)
         self.__tenant_topic_subscriber.register_handler("CompleteTenantEvent", self.on_complete_tenant)
         self.__tenant_topic_subscriber.register_handler("TenantSubscribedEvent", self.on_tenant_subscribed)
 
@@ -260,15 +261,15 @@ class CartridgeAgent(threading.Thread):
         event_obj = MemberStartedEvent.create_from_json(msg.payload)
         self.__event_handler.on_member_started_event(event_obj)
 
-    def on_subscription_domain_added(self, msg):
+    def on_domain_mapping_added(self, msg):
         self.__log.debug("Subscription domain added event received : %r" % msg.payload)
-        event_obj = SubscriptionDomainAddedEvent.create_from_json(msg.payload)
-        self.__event_handler.on_subscription_domain_added_event(event_obj)
+        event_obj = DomainMappingAddedEvent.create_from_json(msg.payload)
+        self.__event_handler.on_domain_mapping_added_event(event_obj)
 
-    def on_subscription_domain_removed(self, msg):
+    def on_domain_mapping_removed(self, msg):
         self.__log.debug("Subscription domain removed event received : %r" % msg.payload)
-        event_obj = SubscriptionDomainRemovedEvent.create_from_json(msg.payload)
-        self.__event_handler.on_subscription_domain_removed_event(event_obj)
+        event_obj = DomainMappingRemovedEvent.create_from_json(msg.payload)
+        self.__event_handler.on_domain_mapping_removed_event(event_obj)
 
     def on_complete_tenant(self, msg):
         if not self.__tenant_context_initialized:

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/domain-mapping-added.sh
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/domain-mapping-added.sh b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/domain-mapping-added.sh
new file mode 100755
index 0000000..7f39472
--- /dev/null
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/domain-mapping-added.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when a subscription domain added
+# event is received by the cartridge agent.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+
+echo "Domain mapping added: [tenant-id] $1 [tenant-domain] $2 [domain-name] $3 [application-context] $4" | tee -a $log
+OUTPUT=`date`": Subscription Domain Added Event"
+OUTPUT="$OUTPUT SUBSCRIPTION_APPLICATION_ID: ${SUBSCRIPTION_APPLICATION_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CLUSTER_ID: ${SUBSCRIPTION_CLUSTER_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN},"
+OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CONTEXT_PATH: ${SUBSCRIPTION_CONTEXT_PATH}"
+echo $OUTPUT | tee -a $log
+
+curl -k -v -X POST -H "Content-Type:application/soap+xml;charset=UTF-8;action=urn:addWebAppToHost" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><s:Body><p:addWebAppToHost xmlns:p=\"http://mapper.url.carbon.wso2.org\"><xs:hostName xmlns:xs=\"http://mapper.url.carbon.wso2.org\">$STRATOS_SUBSCRIPTION_DOMAIN_NAME</xs:hostName><xs:uri xmlns:xs=\"http://mapper.url.carbon.wso2.org\">/t/$STRATOS_SUBSCRIPTION_TENANT_DOMAIN/webapps/$SUBSCRIPTION_CONTEXT_PATH/</xs:uri><xs:appType xmlns:xs=\"http://mapper.url.carbon.wso2.org\">webapp</xs:appType></p:addWebAppToHost></s:Body></s:Envelope>" https://localhost:9443/services/UrlMapperAdminService -u admin:admin

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/domain-mapping-removed.sh
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/domain-mapping-removed.sh b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/domain-mapping-removed.sh
new file mode 100755
index 0000000..3911ec6
--- /dev/null
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/domain-mapping-removed.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when a subscription domain removed
+# event is received by the cartridge agent.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Domain Mapping Removed Event"
+OUTPUT="$OUTPUT SUBSCRIPTION_APPLICATION_ID: ${SUBSCRIPTION_APPLICATION_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CLUSTER_ID: ${SUBSCRIPTION_CLUSTER_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
+OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN}"
+echo $OUTPUT | tee -a $log
+
+curl -k -v -X POST -H "Content-Type:application/soap+xml;charset=UTF-8;action=urn:deleteHost" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><s:Body><p:deleteHost xmlns:p=\"http://mapper.url.carbon.wso2.org\"><xs:hostName xmlns:xs=\"http://mapper.url.carbon.wso2.org\">$STRATOS_SUBSCRIPTION_DOMAIN_NAME</xs:hostName></p:deleteHost></s:Body></s:Envelope>" https://localhost:9443/services/UrlMapperAdminService -u admin:admin
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/subscription-domain-added.sh
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/subscription-domain-added.sh b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/subscription-domain-added.sh
deleted file mode 100755
index 9e488f6..0000000
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/subscription-domain-added.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when a subscription domain added
-# event is received by the cartridge agent.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-
-echo "Subscription domain added: [tenant-id] $1 [tenant-domain] $2 [domain-name] $3 [application-context] $4" | tee -a $log
-OUTPUT=`date`": Subscription Domain Added Event"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN},"
-OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT: ${STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT}"
-echo $OUTPUT | tee -a $log
-
-curl -k -v -X POST -H "Content-Type:application/soap+xml;charset=UTF-8;action=urn:addWebAppToHost" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><s:Body><p:addWebAppToHost xmlns:p=\"http://mapper.url.carbon.wso2.org\"><xs:hostName xmlns:xs=\"http://mapper.url.carbon.wso2.org\">$STRATOS_SUBSCRIPTION_DOMAIN_NAME</xs:hostName><xs:uri xmlns:xs=\"http://mapper.url.carbon.wso2.org\">/t/$STRATOS_SUBSCRIPTION_TENANT_DOMAIN/webapps/$STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT/</xs:uri><xs:appType xmlns:xs=\"http://mapper.url.carbon.wso2.org\">webapp</xs:appType></p:addWebAppToHost></s:Body></s:Envelope>" https://localhost:9443/services/UrlMapperAdminService -u admin:admin

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/subscription-domain-removed.sh
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/subscription-domain-removed.sh b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/subscription-domain-removed.sh
deleted file mode 100755
index a727953..0000000
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/subscription-domain-removed.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when a subscription domain removed
-# event is received by the cartridge agent.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Removed Event"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
-OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN}"
-echo $OUTPUT | tee -a $log
-
-curl -k -v -X POST -H "Content-Type:application/soap+xml;charset=UTF-8;action=urn:deleteHost" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><s:Body><p:deleteHost xmlns:p=\"http://mapper.url.carbon.wso2.org\"><xs:hostName xmlns:xs=\"http://mapper.url.carbon.wso2.org\">$STRATOS_SUBSCRIPTION_DOMAIN_NAME</xs:hostName></p:deleteHost></s:Body></s:Envelope>" https://localhost:9443/services/UrlMapperAdminService -u admin:admin
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/__init__.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/__init__.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/__init__.py
new file mode 100644
index 0000000..9dd7d7b
--- /dev/null
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/__init__.py
@@ -0,0 +1,18 @@
+# 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.
+
+__author__ = 'chamilad'

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/mapping/__init__.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/mapping/__init__.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/mapping/__init__.py
new file mode 100644
index 0000000..9dd7d7b
--- /dev/null
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/mapping/__init__.py
@@ -0,0 +1,18 @@
+# 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.
+
+__author__ = 'chamilad'

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/mapping/events.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/mapping/events.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/mapping/events.py
new file mode 100644
index 0000000..8d7c889
--- /dev/null
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/domain/mapping/events.py
@@ -0,0 +1,77 @@
+# 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.
+
+import json
+
+
+class DomainMappingAddedEvent:
+
+    def __init__(self):
+        self.application_id = None
+        """ :type : str """
+        self.tenant_id = None
+        """ :type : int  """
+        self.service_name = None
+        """ :type : str  """
+        self.cluster_id = None
+        """ :type : str  """
+        self.domain_name = None
+        """ :type : str  """
+        self.context_path = None
+        """ :type : str  """
+
+    @staticmethod
+    def create_from_json(json_str):
+        json_obj = json.loads(json_str)
+        instance = DomainMappingAddedEvent()
+
+        instance.tenant_id = json_obj["applicationId"] if "applicationId" in json_obj else None
+        instance.tenant_id = json_obj["tenantId"] if "tenantId" in json_obj else None
+        instance.service_name = json_obj["serviceName"] if "serviceName" in json_obj else None
+        instance.cluster_ids = json_obj["clusterId"] if "clusterId" in json_obj else None
+        instance.cluster_ids = json_obj["domainName"] if "domainName" in json_obj else None
+        instance.cluster_ids = json_obj["contextPath"] if "contextPath" in json_obj else None
+
+        return instance
+
+
+class DomainMappingRemovedEvent:
+
+    def __init__(self):
+        self.application_id = None
+        """ :type : str """
+        self.tenant_id = None
+        """ :type : int  """
+        self.service_name = None
+        """ :type : str  """
+        self.cluster_id = None
+        """ :type : str  """
+        self.domain_name = None
+        """ :type : str  """
+
+    @staticmethod
+    def create_from_json(json_str):
+        json_obj = json.loads(json_str)
+        instance = DomainMappingRemovedEvent()
+
+        instance.tenant_id = json_obj["applicationId"] if "applicationId" in json_obj else None
+        instance.tenant_id = json_obj["tenantId"] if "tenantId" in json_obj else None
+        instance.service_name = json_obj["serviceName"] if "serviceName" in json_obj else None
+        instance.cluster_ids = json_obj["clusterId"] if "clusterId" in json_obj else None
+        instance.cluster_ids = json_obj["domainName"] if "domainName" in json_obj else None
+
+        return instance

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py
index e414ec7..f27fee1 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py
@@ -407,36 +407,40 @@ class EventHandler:
         self.__log.info("Processing volume mount extension...")
         self.execute_plugins_for_event("VolumeMount", persistence_mappings_payload)
 
-    def on_subscription_domain_added_event(self, subscription_domain_added_event):
-        tenant_domain = EventHandler.find_tenant_domain(subscription_domain_added_event.tenant_id)
+    def on_domain_mapping_added_event(self, domain_mapping_added_event):
+        tenant_domain = EventHandler.find_tenant_domain(domain_mapping_added_event.tenant_id)
         self.__log.info(
-            "Processing Subscription domain added event: [tenant-id] " + subscription_domain_added_event.tenant_id +
-            " [tenant-domain] " + tenant_domain + " [domain-name] " + subscription_domain_added_event.domain_name +
-            " [application-context] " + subscription_domain_added_event.application_context
+            "Processing Domain mapping added event: [tenant-id] " + domain_mapping_added_event.tenant_id +
+            " [tenant-domain] " + tenant_domain + " [domain-name] " + domain_mapping_added_event.domain_name +
+            " [application-context] " + domain_mapping_added_event.application_context
         )
 
-        plugin_values = {"SUBSCRIPTION_SERVICE_NAME": subscription_domain_added_event.service_name,
-                         "SUBSCRIPTION_DOMAIN_NAME": subscription_domain_added_event.domain_name,
-                         "SUBSCRIPTION_TENANT_ID": int(subscription_domain_added_event.tenant_id),
+        plugin_values = {"SUBSCRIPTION_APPLICATION_ID": domain_mapping_added_event.application_id,
+                         "SUBSCRIPTION_SERVICE_NAME": domain_mapping_added_event.service_name,
+                         "SUBSCRIPTION_DOMAIN_NAME": domain_mapping_added_event.domain_name,
+                         "SUBSCRIPTION_CLUSTER_ID": domain_mapping_added_event.cluster_id,
+                         "SUBSCRIPTION_TENANT_ID": int(domain_mapping_added_event.tenant_id),
                          "SUBSCRIPTION_TENANT_DOMAIN": tenant_domain,
-                         "SUBSCRIPTION_APPLICATION_CONTEXT":
-                             subscription_domain_added_event.application_context}
+                         "SUBSCRIPTION_CONTEXT_PATH":
+                             domain_mapping_added_event.context_path}
 
-        self.execute_plugins_for_event("SubscriptionDomainAddedEvent", plugin_values)
+        self.execute_plugins_for_event("DomainMappingAddedEvent", plugin_values)
 
-    def on_subscription_domain_removed_event(self, subscription_domain_removed_event):
-        tenant_domain = EventHandler.find_tenant_domain(subscription_domain_removed_event.tenant_id)
+    def on_domain_mapping_removed_event(self, domain_mapping_removed_event):
+        tenant_domain = EventHandler.find_tenant_domain(domain_mapping_removed_event.tenant_id)
         self.__log.info(
-            "Subscription domain removed event received: [tenant-id] " + subscription_domain_removed_event.tenant_id +
-            " [tenant-domain] " + tenant_domain + " [domain-name] " + subscription_domain_removed_event.domain_name
+            "Domain mapping removed event received: [tenant-id] " + domain_mapping_removed_event.tenant_id +
+            " [tenant-domain] " + tenant_domain + " [domain-name] " + domain_mapping_removed_event.domain_name
         )
 
-        plugin_values = {"SUBSCRIPTION_SERVICE_NAME": subscription_domain_removed_event.service_name,
-                         "SUBSCRIPTION_DOMAIN_NAME": subscription_domain_removed_event.domain_name,
-                         "SUBSCRIPTION_TENANT_ID": int(subscription_domain_removed_event.tenant_id),
+        plugin_values = {"SUBSCRIPTION_APPLICATION_ID": domain_mapping_removed_event.application_id,
+                         "SUBSCRIPTION_SERVICE_NAME": domain_mapping_removed_event.service_name,
+                         "SUBSCRIPTION_DOMAIN_NAME": domain_mapping_removed_event.domain_name,
+                         "SUBSCRIPTION_CLUSTER_ID": domain_mapping_removed_event.cluster_id,
+                         "SUBSCRIPTION_TENANT_ID": int(domain_mapping_removed_event.tenant_id),
                          "SUBSCRIPTION_TENANT_DOMAIN": tenant_domain}
 
-        self.execute_plugins_for_event("SubscriptionDomainRemovedEvent", plugin_values)
+        self.execute_plugins_for_event("DomainMappingRemovedEvent", plugin_values)
 
     def on_copy_artifacts_extension(self, src, dest):
         self.__log.info("Processing Copy artifacts extension...")

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/tenant/events.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/tenant/events.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/tenant/events.py
index def2b64..473b35c 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/tenant/events.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/tenant/events.py
@@ -19,59 +19,6 @@ import json
 from ... tenant.tenantcontext import *
 
 
-class SubscriptionDomainAddedEvent():
-
-    def __init__(self):
-        self.tenant_id = None
-        """ :type : int  """
-        self.service_name = None
-        """ :type : str  """
-        self.cluster_ids = None
-        """ :type : list[str]  """
-        self.domain_name = None
-        """ :type : str  """
-        self.application_context = None
-        """ :type : str  """
-
-    @staticmethod
-    def create_from_json(json_str):
-        json_obj = json.loads(json_str)
-        instance = SubscriptionDomainAddedEvent()
-
-        instance.cluster_ids = json_obj["clusterIds"] if "clusterIds" in json_obj else None
-        instance.tenant_id = json_obj["tenantId"] if "tenantId" in json_obj else None
-        instance.service_name = json_obj["serviceName"] if "serviceName" in json_obj else None
-        instance.domain_name = json_obj["domainName"] if "domainName" in json_obj else None
-        instance.application_context = json_obj["applicationContext"] if "applicationContext" in json_obj else None
-
-        return instance
-
-
-class SubscriptionDomainRemovedEvent:
-
-    def __init__(self, tenant_id, service_name, cluster_ids, domain_name):
-        self.tenant_id = tenant_id
-        """ :type : int  """
-        self.service_name = service_name
-        """ :type : str  """
-        self.cluster_ids = cluster_ids
-        """ :type : list[str]  """
-        self.domain_name = domain_name
-        """ :type : str  """
-
-    @staticmethod
-    def create_from_json(json_str):
-        json_obj = json.loads(json_str)
-        instance = SubscriptionDomainRemovedEvent()
-
-        instance.cluster_ids = json_obj["clusterIds"] if "clusterIds" in json_obj else None
-        instance.tenant_id = json_obj["tenantId"] if "tenantId" in json_obj else None
-        instance.service_name = json_obj["serviceName"] if "serviceName" in json_obj else None
-        instance.domain_name = json_obj["domainName"] if "domainName" in json_obj else None
-
-        return instance
-
-
 class CompleteTenantEvent:
 
     def __init__(self):

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/products/cartridge-agent/modules/distribution/src/main/extensions/domain-mapping-added.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/domain-mapping-added.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/domain-mapping-added.sh
new file mode 100755
index 0000000..7f39472
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/domain-mapping-added.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when a subscription domain added
+# event is received by the cartridge agent.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+
+echo "Domain mapping added: [tenant-id] $1 [tenant-domain] $2 [domain-name] $3 [application-context] $4" | tee -a $log
+OUTPUT=`date`": Subscription Domain Added Event"
+OUTPUT="$OUTPUT SUBSCRIPTION_APPLICATION_ID: ${SUBSCRIPTION_APPLICATION_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CLUSTER_ID: ${SUBSCRIPTION_CLUSTER_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN},"
+OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CONTEXT_PATH: ${SUBSCRIPTION_CONTEXT_PATH}"
+echo $OUTPUT | tee -a $log
+
+curl -k -v -X POST -H "Content-Type:application/soap+xml;charset=UTF-8;action=urn:addWebAppToHost" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><s:Body><p:addWebAppToHost xmlns:p=\"http://mapper.url.carbon.wso2.org\"><xs:hostName xmlns:xs=\"http://mapper.url.carbon.wso2.org\">$STRATOS_SUBSCRIPTION_DOMAIN_NAME</xs:hostName><xs:uri xmlns:xs=\"http://mapper.url.carbon.wso2.org\">/t/$STRATOS_SUBSCRIPTION_TENANT_DOMAIN/webapps/$SUBSCRIPTION_CONTEXT_PATH/</xs:uri><xs:appType xmlns:xs=\"http://mapper.url.carbon.wso2.org\">webapp</xs:appType></p:addWebAppToHost></s:Body></s:Envelope>" https://localhost:9443/services/UrlMapperAdminService -u admin:admin

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/products/cartridge-agent/modules/distribution/src/main/extensions/domain-mapping-removed.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/domain-mapping-removed.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/domain-mapping-removed.sh
new file mode 100755
index 0000000..3911ec6
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/domain-mapping-removed.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when a subscription domain removed
+# event is received by the cartridge agent.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Domain Mapping Removed Event"
+OUTPUT="$OUTPUT SUBSCRIPTION_APPLICATION_ID: ${SUBSCRIPTION_APPLICATION_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CLUSTER_ID: ${SUBSCRIPTION_CLUSTER_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
+OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN}"
+echo $OUTPUT | tee -a $log
+
+curl -k -v -X POST -H "Content-Type:application/soap+xml;charset=UTF-8;action=urn:deleteHost" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><s:Body><p:deleteHost xmlns:p=\"http://mapper.url.carbon.wso2.org\"><xs:hostName xmlns:xs=\"http://mapper.url.carbon.wso2.org\">$STRATOS_SUBSCRIPTION_DOMAIN_NAME</xs:hostName></p:deleteHost></s:Body></s:Envelope>" https://localhost:9443/services/UrlMapperAdminService -u admin:admin
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-added.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-added.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-added.sh
deleted file mode 100644
index 9deefab..0000000
--- a/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-added.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when a subscription domain added
-# event is received by the cartridge agent.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-
-echo "Subscription domain added: [tenant-id] $1 [tenant-domain] $2 [domain-name] $3 [application-context] $4" | tee -a $log
-OUTPUT=`date`": Subscription Domain Added Event"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN},"
-OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT: ${STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT}"
-echo $OUTPUT | tee -a $log
-
-curl -k -v -X POST -H "Content-Type:application/soap+xml;charset=UTF-8;action=urn:addWebAppToHost" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><s:Body><p:addWebAppToHost xmlns:p=\"http://mapper.url.carbon.wso2.org\"><xs:hostName xmlns:xs=\"http://mapper.url.carbon.wso2.org\">$STRATOS_SUBSCRIPTION_DOMAIN_NAME</xs:hostName><xs:uri xmlns:xs=\"http://mapper.url.carbon.wso2.org\">/t/$STRATOS_SUBSCRIPTION_TENANT_DOMAIN/webapps/$STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT/</xs:uri><xs:appType xmlns:xs=\"http://mapper.url.carbon.wso2.org\">webapp</xs:appType></p:addWebAppToHost></s:Body></s:Envelope>" https://localhost:9443/services/UrlMapperAdminService -u admin:admin

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-removed.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-removed.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-removed.sh
deleted file mode 100644
index f74a725..0000000
--- a/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-removed.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when a subscription domain removed
-# event is received by the cartridge agent.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Removed Event"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
-OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN}"
-echo $OUTPUT | tee -a $log
-
-curl -k -v -X POST -H "Content-Type:application/soap+xml;charset=UTF-8;action=urn:deleteHost" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><s:Body><p:deleteHost xmlns:p=\"http://mapper.url.carbon.wso2.org\"><xs:hostName xmlns:xs=\"http://mapper.url.carbon.wso2.org\">$STRATOS_SUBSCRIPTION_DOMAIN_NAME</xs:hostName></p:deleteHost></s:Body></s:Envelope>" https://localhost:9443/services/UrlMapperAdminService -u admin:admin
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-added.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-added.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-added.sh
new file mode 100644
index 0000000..759f6b4
--- /dev/null
+++ b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-added.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when subscription domain
+# added event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Domain Mapping Added Event"
+echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-removed.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-removed.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-removed.sh
new file mode 100644
index 0000000..3be259e
--- /dev/null
+++ b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-removed.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when subscription domain
+# removed event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Domain Mapping Removed Event"
+echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/subscription-domain-added.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/subscription-domain-added.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/subscription-domain-added.sh
deleted file mode 100644
index a8b7459..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/subscription-domain-added.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when subscription domain
-# added event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Added Event"
-echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/subscription-domain-removed.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/subscription-domain-removed.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/subscription-domain-removed.sh
deleted file mode 100644
index 3612bb6..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/subscription-domain-removed.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when subscription domain
-# removed event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Removed Event"
-echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/agent/manifests/init.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/agent/manifests/init.pp b/tools/puppet3/modules/agent/manifests/init.pp
index ea67b7c..b6e59f7 100644
--- a/tools/puppet3/modules/agent/manifests/init.pp
+++ b/tools/puppet3/modules/agent/manifests/init.pp
@@ -53,8 +53,8 @@ class agent(
     'extensions/member-suspended.sh',
     'extensions/member-terminated.sh',
     'extensions/mount-volumes.sh',
-    'extensions/subscription-domain-added.sh',
-    'extensions/subscription-domain-removed.sh',
+    'extensions/domain-mapping-added.sh',
+    'extensions/domain-mapping-removed.sh',
     ]
 
   agent::initialize { $deployment_code:

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/agent/templates/extensions/domain-mapping-added.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/agent/templates/extensions/domain-mapping-added.sh.erb b/tools/puppet3/modules/agent/templates/extensions/domain-mapping-added.sh.erb
new file mode 100644
index 0000000..759f6b4
--- /dev/null
+++ b/tools/puppet3/modules/agent/templates/extensions/domain-mapping-added.sh.erb
@@ -0,0 +1,29 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when subscription domain
+# added event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Domain Mapping Added Event"
+echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/agent/templates/extensions/domain-mapping-removed.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/agent/templates/extensions/domain-mapping-removed.sh.erb b/tools/puppet3/modules/agent/templates/extensions/domain-mapping-removed.sh.erb
new file mode 100644
index 0000000..3be259e
--- /dev/null
+++ b/tools/puppet3/modules/agent/templates/extensions/domain-mapping-removed.sh.erb
@@ -0,0 +1,29 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when subscription domain
+# removed event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Domain Mapping Removed Event"
+echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/agent/templates/extensions/subscription-domain-added.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/agent/templates/extensions/subscription-domain-added.sh.erb b/tools/puppet3/modules/agent/templates/extensions/subscription-domain-added.sh.erb
deleted file mode 100644
index a8b7459..0000000
--- a/tools/puppet3/modules/agent/templates/extensions/subscription-domain-added.sh.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when subscription domain
-# added event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Added Event"
-echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/agent/templates/extensions/subscription-domain-removed.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/agent/templates/extensions/subscription-domain-removed.sh.erb b/tools/puppet3/modules/agent/templates/extensions/subscription-domain-removed.sh.erb
deleted file mode 100644
index 3612bb6..0000000
--- a/tools/puppet3/modules/agent/templates/extensions/subscription-domain-removed.sh.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when subscription domain
-# removed event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Removed Event"
-echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/appserver/templates/agent/extensions/domain-mapping-added.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/appserver/templates/agent/extensions/domain-mapping-added.sh.erb b/tools/puppet3/modules/appserver/templates/agent/extensions/domain-mapping-added.sh.erb
new file mode 100755
index 0000000..d2a1de7
--- /dev/null
+++ b/tools/puppet3/modules/appserver/templates/agent/extensions/domain-mapping-added.sh.erb
@@ -0,0 +1,39 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when a subscription domain added
+# event is received by the cartridge agent.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+
+echo "Domain mapping added: [tenant-id] $1 [tenant-domain] $2 [domain-name] $3 [application-context] $4" | tee -a $log
+OUTPUT=`date`": Subscription Domain Added Event"
+OUTPUT="$OUTPUT SUBSCRIPTION_APPLICATION_ID: ${SUBSCRIPTION_APPLICATION_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CLUSTER_ID: ${SUBSCRIPTION_CLUSTER_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN},"
+OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CONTEXT_PATH: ${SUBSCRIPTION_CONTEXT_PATH}"
+echo $OUTPUT | tee -a $log
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/appserver/templates/agent/extensions/domain-mapping-removed.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/appserver/templates/agent/extensions/domain-mapping-removed.sh.erb b/tools/puppet3/modules/appserver/templates/agent/extensions/domain-mapping-removed.sh.erb
new file mode 100755
index 0000000..00a553d
--- /dev/null
+++ b/tools/puppet3/modules/appserver/templates/agent/extensions/domain-mapping-removed.sh.erb
@@ -0,0 +1,36 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when a subscription domain removed
+# event is received by the cartridge agent.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Domain Mapping Removed Event"
+OUTPUT="$OUTPUT SUBSCRIPTION_APPLICATION_ID: ${SUBSCRIPTION_APPLICATION_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CLUSTER_ID: ${SUBSCRIPTION_CLUSTER_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
+OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN}"
+echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/appserver/templates/agent/extensions/subscription-domain-added.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/appserver/templates/agent/extensions/subscription-domain-added.sh.erb b/tools/puppet3/modules/appserver/templates/agent/extensions/subscription-domain-added.sh.erb
deleted file mode 100644
index 9ef88a2..0000000
--- a/tools/puppet3/modules/appserver/templates/agent/extensions/subscription-domain-added.sh.erb
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when subscription domain
-# added event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Added Event"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN},"
-OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT: ${STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT}"
-echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/appserver/templates/agent/extensions/subscription-domain-removed.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/appserver/templates/agent/extensions/subscription-domain-removed.sh.erb b/tools/puppet3/modules/appserver/templates/agent/extensions/subscription-domain-removed.sh.erb
deleted file mode 100644
index ff7b56b..0000000
--- a/tools/puppet3/modules/appserver/templates/agent/extensions/subscription-domain-removed.sh.erb
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when subscription domain
-# removed event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Removed Event"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
-OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN}"
-echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/python_agent/manifests/init.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/python_agent/manifests/init.pp b/tools/puppet3/modules/python_agent/manifests/init.pp
index 0e91ece..08430ac 100644
--- a/tools/puppet3/modules/python_agent/manifests/init.pp
+++ b/tools/puppet3/modules/python_agent/manifests/init.pp
@@ -53,8 +53,8 @@ class python_agent(
     'extensions/member-suspended.sh',
     'extensions/member-terminated.sh',
     'extensions/mount-volumes.sh',
-    'extensions/subscription-domain-added.sh',
-    'extensions/subscription-domain-removed.sh',
+    'extensions/domain-mapping-added.sh',
+    'extensions/domain-mapping-removed.sh',
   ]
 
  python_agent::initialize { $service_code:

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/python_agent/templates/extensions/domain-mapping-added.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/python_agent/templates/extensions/domain-mapping-added.sh.erb b/tools/puppet3/modules/python_agent/templates/extensions/domain-mapping-added.sh.erb
new file mode 100755
index 0000000..d2a1de7
--- /dev/null
+++ b/tools/puppet3/modules/python_agent/templates/extensions/domain-mapping-added.sh.erb
@@ -0,0 +1,39 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when a subscription domain added
+# event is received by the cartridge agent.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+
+echo "Domain mapping added: [tenant-id] $1 [tenant-domain] $2 [domain-name] $3 [application-context] $4" | tee -a $log
+OUTPUT=`date`": Subscription Domain Added Event"
+OUTPUT="$OUTPUT SUBSCRIPTION_APPLICATION_ID: ${SUBSCRIPTION_APPLICATION_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CLUSTER_ID: ${SUBSCRIPTION_CLUSTER_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN},"
+OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CONTEXT_PATH: ${SUBSCRIPTION_CONTEXT_PATH}"
+echo $OUTPUT | tee -a $log
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/python_agent/templates/extensions/domain-mapping-removed.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/python_agent/templates/extensions/domain-mapping-removed.sh.erb b/tools/puppet3/modules/python_agent/templates/extensions/domain-mapping-removed.sh.erb
new file mode 100755
index 0000000..00a553d
--- /dev/null
+++ b/tools/puppet3/modules/python_agent/templates/extensions/domain-mapping-removed.sh.erb
@@ -0,0 +1,36 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+# This extension script will be executed when a subscription domain removed
+# event is received by the cartridge agent.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Domain Mapping Removed Event"
+OUTPUT="$OUTPUT SUBSCRIPTION_APPLICATION_ID: ${SUBSCRIPTION_APPLICATION_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
+OUTPUT="$OUTPUT SUBSCRIPTION_CLUSTER_ID: ${SUBSCRIPTION_CLUSTER_ID},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
+OUTPUT="$OUTPUT APPLICATION_PATH: ${APPLICATION_PATH},"
+OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN}"
+echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/python_agent/templates/extensions/subscription-domain-added.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/python_agent/templates/extensions/subscription-domain-added.sh.erb b/tools/puppet3/modules/python_agent/templates/extensions/subscription-domain-added.sh.erb
deleted file mode 100644
index 9ef88a2..0000000
--- a/tools/puppet3/modules/python_agent/templates/extensions/subscription-domain-added.sh.erb
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when subscription domain
-# added event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Added Event"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN},"
-OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT: ${STRATOS_SUBSCRIPTION_APPLICATION_CONTEXT}"
-echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/da243903/tools/puppet3/modules/python_agent/templates/extensions/subscription-domain-removed.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/python_agent/templates/extensions/subscription-domain-removed.sh.erb b/tools/puppet3/modules/python_agent/templates/extensions/subscription-domain-removed.sh.erb
deleted file mode 100644
index ff7b56b..0000000
--- a/tools/puppet3/modules/python_agent/templates/extensions/subscription-domain-removed.sh.erb
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# 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.
-#
-# --------------------------------------------------------------
-# This extension script will be executed when subscription domain
-# removed event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Subscription Domain Removed Event"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_SERVICE_NAME: ${STRATOS_SUBSCRIPTION_SERVICE_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_DOMAIN_NAME: ${STRATOS_SUBSCRIPTION_DOMAIN_NAME},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_ID: ${STRATOS_SUBSCRIPTION_TENANT_ID},"
-OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
-OUTPUT="$OUTPUT STRATOS_SUBSCRIPTION_TENANT_DOMAIN: $STRATOS_SUBSCRIPTION_TENANT_DOMAIN}"
-echo $OUTPUT | tee -a $log