You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ma...@apache.org on 2014/07/08 09:41:52 UTC
[02/14] Clustering changes for stratos
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
index fbb8b10..cd10030 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
+++ b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
@@ -31,6 +31,8 @@
</jaxrs:serviceBeans>
<jaxrs:providers>
+ <ref bean="throwableExceptionHandler"/>
+ <ref bean="genericExceptionHandler"/>
<ref bean="jsonProvider"/>
<ref bean="exceptionHandler"/>
<ref bean="basicAuthenticationFilter"/>
@@ -46,6 +48,8 @@
<property name="securedObject" ref="stratosRestEndpointBean"/>
</bean>
<bean id="exceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomExceptionMapper"/>
+ <bean id="genericExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.GenericExceptionMapper"/>
+ <bean id="throwableExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomThrowableExceptionMapper"/>
<!--The below config enables OAuth based authentication/authorization for REST API-->
<bean id="OAuthFilter" class="org.apache.stratos.rest.endpoint.handlers.OAuthHandler">
<property name="password" value="admin"/>
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/assembly/bin.xml b/products/cartridge-agent/modules/distribution/src/main/assembly/bin.xml
index 3662489..3171262 100644
--- a/products/cartridge-agent/modules/distribution/src/main/assembly/bin.xml
+++ b/products/cartridge-agent/modules/distribution/src/main/assembly/bin.xml
@@ -51,7 +51,16 @@
<include>instance-started.sh</include>
<include>start-servers.sh</include>
<include>clean.sh</include>
- <include>mount_volumes.sh</include>
+ <include>mount-volumes.sh</include>
+ <include>member-activated.sh</include>
+ <include>member-started.sh</include>
+ <include>member-terminated.sh</include>
+ <include>member-suspended.sh</include>
+ <include>complete-topology.sh</include>
+ <include>complete-tenant.sh</include>
+ <include>subscription-domain-added.sh</include>
+ <include>subscription-domain-removed.sh</include>
+ <include>artifacts-copy.sh</include>
</includes>
</fileSet>
<fileSet>
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/bin/stratos.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/bin/stratos.sh b/products/cartridge-agent/modules/distribution/src/main/bin/stratos.sh
index db86d7d..0c24f39 100644
--- a/products/cartridge-agent/modules/distribution/src/main/bin/stratos.sh
+++ b/products/cartridge-agent/modules/distribution/src/main/bin/stratos.sh
@@ -31,20 +31,43 @@ properties="-Dmb.ip=MB-IP
-Dthrift.receiver.port=CEP-PORT
-Djndi.properties.template.file.path=${script_path}/../conf/templates/jndi.properties.template
-Djndi.properties.dir=${script_path}/../conf
- -Dlog4j.properties.file.path=${script_path}/../conf/log4j.properties
+ -Dlog4j.configuration=file://${script_path}/../conf/log4j.properties
-Dparam.file.path=${script_path}/../payload/launch-params
-Dextensions.dir=${script_path}/../extensions
-Dcep.stats.publisher.enabled=true
+ -Dlb.private.ip=
+ -Dlb.public.ip=
-Djavax.net.ssl.trustStore=CERT-TRUSTSTORE
-Djavax.net.ssl.trustStorePassword=TRUSTSTORE-PASSWORD
-Denable.artifact.update=true
- -Dartifact.update.interval=10
- -Denable.data.publisher=ENABLE-DATA-PUBLISHER
+ -Dauto.commit=false
+ -Dauto.checkout=true
+ -Dartifact.update.interval=15
+ -Denable.data.publisher=ENABLE-DATA-PUBLISHER
-Dmonitoring.server.ip=MONITORING-SERVER-IP
-Dmonitoring.server.port=MONITORING-SERVER-PORT
-Dmonitoring.server.secure.port=MONITORING-SERVER-SECURE-PORT
-Dmonitoring.server.admin.username=MONITORING-SERVER-ADMIN-USERNAME
- -Dmonitoring.server.admin.password=MONITORING-SERVER-ADMIN-PASSWORD"
+ -Dmonitoring.server.admin.password=MONITORING-SERVER-ADMIN-PASSWORD
+ -Dlog.file.paths=LOG_FILE_PATHS
+ -DAPP_PATH=APP_PATH
+ -Dsuper.tenant.repository.path=/repository/deployment/server/
+ -Dtenant.repository.path=/repository/tenants/
+ -Dextension.instance.started=instance-started.sh
+ -Dextension.start.servers=start-servers.sh
+ -Dextension.instance.activated=instance-activated.sh
+ -Dextension.artifacts.updated=artifacts-updated.sh
+ -Dextension.clean=clean.sh
+ -Dextension.mount.volumes=mount_volumes.sh
+ -Dextension.member.started=member-started.sh
+ -Dextension.member.activated=member-activated.sh
+ -Dextension.member.suspended=member-suspended.sh
+ -Dextension.member.terminated=member-terminated.sh
+ -Dextension.complete.topology=complete-topology.sh
+ -Dextension.complete.tenant=complete-tenant.sh
+ -Dextension.subscription.domain.added=subscription-domain-added.sh
+ -Dextension.subscription.domain.removed=subscription-domain-removed.sh
+ -Dextension.artifacts.copy=artifacts-copy.sh"
# Uncomment below line to enable remote debugging
#debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/conf/log4j.properties b/products/cartridge-agent/modules/distribution/src/main/conf/log4j.properties
index 890a4db..178aa9f 100644
--- a/products/cartridge-agent/modules/distribution/src/main/conf/log4j.properties
+++ b/products/cartridge-agent/modules/distribution/src/main/conf/log4j.properties
@@ -35,5 +35,7 @@ log4j.appender.CONSOLE_APPENDER.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE_APPENDER.layout.ConversionPattern=[%d{ISO8601}] %5p - [%c{1}] %m%n
log4j.logger.org.apache.stratos.cartridge.agent=INFO
+log4j.logger.org.apache.stratos.cartridge.agent.statistics.publisher=ERROR
log4j.logger.org.apache.stratos.messaging=INFO
-log4j.logger.org.wso2.andes.client=ERROR
\ No newline at end of file
+log4j.logger.org.wso2.andes.client=ERROR
+log4j.logger.org.apache.activemq.jndi.ActiveMQInitialContextFactory=ERROR
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/conf/templates/jndi.properties.template
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/conf/templates/jndi.properties.template b/products/cartridge-agent/modules/distribution/src/main/conf/templates/jndi.properties.template
index c6b062a..b5fed16 100644
--- a/products/cartridge-agent/modules/distribution/src/main/conf/templates/jndi.properties.template
+++ b/products/cartridge-agent/modules/distribution/src/main/conf/templates/jndi.properties.template
@@ -20,6 +20,6 @@
# Please use loadbalancer.conf for updating mb-ip, mb-port and templates/jndi.properties.template
# file for updating other configurations.
#
-connectionfactoryName=topicConnectionfactory
-connectionfactory.topicConnectionfactory=amqp://admin:admin@carbon/carbon?brokerlist='tcp://$mb_ip:$mb_port'
-java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory
+connectionfactoryName=TopicConnectionFactory
+java.naming.provider.url=tcp://$mb_ip:$mb_port
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/artifacts-copy.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/artifacts-copy.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/artifacts-copy.sh
new file mode 100644
index 0000000..5cad830
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/artifacts-copy.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 once the update artifacts
+# event is received and they are copied to the given path.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+cp -rf $1* $2
+echo "Artifacts Copied" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/artifacts-updated.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/artifacts-updated.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/artifacts-updated.sh
index 7f112b1..15d5591 100644
--- a/products/cartridge-agent/modules/distribution/src/main/extensions/artifacts-updated.sh
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/artifacts-updated.sh
@@ -25,4 +25,4 @@
#
log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo "Artifacts updated" | tee -a $log
\ No newline at end of file
+echo `date`": Artifacts Updated Event" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/clean.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/clean.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/clean.sh
index 3b87d36..c62ad35 100644
--- a/products/cartridge-agent/modules/distribution/src/main/extensions/clean.sh
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/clean.sh
@@ -25,4 +25,4 @@
#
log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo "Cleaning the cartridge" | tee -a $log
\ No newline at end of file
+echo `date`": Cleaning the cartridge" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/complete-tenant.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/complete-tenant.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/complete-tenant.sh
new file mode 100644
index 0000000..2586474
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/complete-tenant.sh
@@ -0,0 +1,30 @@
+#!/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 complete tenant
+# event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+echo `date`": Complete Tenant Event: " | tee -a $log
+echo "Member List: ${STRATOS_MEMBER_LIST_JSON}" | tee -a $log
+echo "Tenant List: ${STRATOS_TENANT_LIST_JSON}" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/complete-topology.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/complete-topology.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/complete-topology.sh
new file mode 100644
index 0000000..ea2e941
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/complete-topology.sh
@@ -0,0 +1,34 @@
+#!/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 complete topology
+# event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+echo `date`": Complete Topology Event: " | tee -a $log
+echo "LB IP: ${STRATOS_LB_IP}" | tee -a $log
+echo "LB PUBLIC IP: $STRATOS_LB_PUBLIC_IP}" | tee -a $log
+echo "STRATOS_PARAM_FILE_PATH: ${STRATOS_PARAM_FILE_PATH}"
+echo "Member List: ${STRATOS_MEMBER_LIST_JSON}" | tee -a $log
+echo "Complete Topology: ${STRATOS_TOPOLOGY_JSON}" | tee -a $log
+echo "Members in LB: ${STRATOS_MEMBERS_IN_LB_JSON}" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/instance-activated.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/instance-activated.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/instance-activated.sh
index c892ca7..f5d60e8 100644
--- a/products/cartridge-agent/modules/distribution/src/main/extensions/instance-activated.sh
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/instance-activated.sh
@@ -25,4 +25,4 @@
#
log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo "Instance activated" | tee -a $log
\ No newline at end of file
+echo `date`": Instance activated" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/instance-started.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/instance-started.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/instance-started.sh
index b6c9105..7b5aa6a 100644
--- a/products/cartridge-agent/modules/distribution/src/main/extensions/instance-started.sh
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/instance-started.sh
@@ -24,4 +24,4 @@
#
log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo "Instance started" | tee -a $log
\ No newline at end of file
+echo `date`": Instance Started Event: " | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/member-activated.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/member-activated.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/member-activated.sh
new file mode 100644
index 0000000..3bf0b10
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/member-activated.sh
@@ -0,0 +1,43 @@
+#!/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 member activated
+# event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Member Activated Event: "
+OUTPUT="$OUTPUT MEMBER_ID: ${STRATOS_MEMBER_ID}, "
+OUTPUT="$OUTPUT MEMBER_IP: ${STRATOS_MEMBER_IP}, "
+OUTPUT="$OUTPUT CLUSTER_ID: ${STRATOS_CLUSTER_ID}, "
+OUTPUT="$OUTPUT LB_CLUSTER_ID: ${STRATOS_LB_CLUSTER_ID}, "
+OUTPUT="$OUTPUT NETWORK_PARTITION_ID: ${STRATOS_NETWORK_PARTITION_ID}, "
+OUTPUT="$OUTPUT SERVICE_NAME: ${STRATOS_SERVICE_NAME}, "
+OUTPUT="$OUTPUT PORTS: ${STRATOS_PORTS},"
+OUTPUT="$OUTPUT STRATOS_LB_IP: ${STRATOS_LB_IP},"
+OUTPUT="$OUTPUT STRATOS_LB_PUBLIC_IP: ${STRATOS_LB_PUBLIC_IP},"
+OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
+OUTPUT="$OUTPUT STRATOS_PARAM_FILE_PATH: ${STRATOS_PARAM_FILE_PATH}"
+echo $OUTPUT | tee -a $log
+echo "Member List: ${STRATOS_MEMBER_LIST_JSON}" | tee -a $log
+echo "Topology: ${STRATOS_TOPOLOGY_JSON}" | tee -a $log
+echo "---------------" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/member-started.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/member-started.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/member-started.sh
new file mode 100644
index 0000000..29f45c3
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/member-started.sh
@@ -0,0 +1,43 @@
+#!/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 member suspended
+# event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Member Started Event: "
+OUTPUT="$OUTPUT MEMBER_ID: ${STRATOS_MEMBER_ID}, "
+OUTPUT="$OUTPUT MEMBER_IP: ${STRATOS_MEMBER_IP}, "
+OUTPUT="$OUTPUT CLUSTER_ID: ${STRATOS_CLUSTER_ID}, "
+OUTPUT="$OUTPUT LB_CLUSTER_ID: ${STRATOS_LB_CLUSTER_ID}, "
+OUTPUT="$OUTPUT NETWORK_PARTITION_ID: ${STRATOS_NETWORK_PARTITION_ID}, "
+OUTPUT="$OUTPUT SERVICE_NAME: ${STRATOS_SERVICE_NAME}, "
+OUTPUT="$OUTPUT PORTS: ${STRATOS_PORTS},"
+OUTPUT="$OUTPUT STRATOS_LB_IP: ${STRATOS_LB_IP},"
+OUTPUT="$OUTPUT STRATOS_LB_PUBLIC_IP: ${STRATOS_LB_PUBLIC_IP},"
+OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
+OUTPUT="$OUTPUT STRATOS_PARAM_FILE_PATH: ${STRATOS_PARAM_FILE_PATH}"
+echo $OUTPUT | tee -a $log
+echo "Member List: ${STRATOS_MEMBER_LIST_JSON}" | tee -a $log
+echo "Topology: ${STRATOS_TOPOLOGY_JSON}" | tee -a $log
+echo "---------------" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/member-suspended.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/member-suspended.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/member-suspended.sh
new file mode 100644
index 0000000..866aa0d
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/member-suspended.sh
@@ -0,0 +1,43 @@
+#!/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 member suspended
+# event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Member Suspended Event: "
+OUTPUT="$OUTPUT MEMBER_ID: ${STRATOS_MEMBER_ID}, "
+OUTPUT="$OUTPUT MEMBER_IP: ${STRATOS_MEMBER_IP}, "
+OUTPUT="$OUTPUT CLUSTER_ID: ${STRATOS_CLUSTER_ID}, "
+OUTPUT="$OUTPUT LB_CLUSTER_ID: ${STRATOS_LB_CLUSTER_ID}, "
+OUTPUT="$OUTPUT NETWORK_PARTITION_ID: ${STRATOS_NETWORK_PARTITION_ID}, "
+OUTPUT="$OUTPUT SERVICE_NAME: ${STRATOS_SERVICE_NAME}, "
+OUTPUT="$OUTPUT PORTS: ${STRATOS_PORTS},"
+OUTPUT="$OUTPUT STRATOS_LB_IP: ${STRATOS_LB_IP},"
+OUTPUT="$OUTPUT STRATOS_LB_PUBLIC_IP: ${STRATOS_LB_PUBLIC_IP},"
+OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
+OUTPUT="$OUTPUT STRATOS_PARAM_FILE_PATH: ${STRATOS_PARAM_FILE_PATH}"
+echo $OUTPUT | tee -a $log
+echo "Member List: ${STRATOS_MEMBER_LIST_JSON}" | tee -a $log
+echo "Topology: ${STRATOS_TOPOLOGY_JSON}" | tee -a $log
+echo "---------------" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/member-terminated.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/member-terminated.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/member-terminated.sh
new file mode 100644
index 0000000..89cedf6
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/member-terminated.sh
@@ -0,0 +1,43 @@
+#!/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 member terminated
+# event is received.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+OUTPUT=`date`": Member Terminated Event: "
+OUTPUT="$OUTPUT MEMBER_ID: ${STRATOS_MEMBER_ID}, "
+OUTPUT="$OUTPUT MEMBER_IP: ${STRATOS_MEMBER_IP}, "
+OUTPUT="$OUTPUT CLUSTER_ID: ${STRATOS_CLUSTER_ID}, "
+OUTPUT="$OUTPUT LB_CLUSTER_ID: ${STRATOS_LB_CLUSTER_ID}, "
+OUTPUT="$OUTPUT NETWORK_PARTITION_ID: ${STRATOS_NETWORK_PARTITION_ID}, "
+OUTPUT="$OUTPUT SERVICE_NAME: ${STRATOS_SERVICE_NAME}, "
+OUTPUT="$OUTPUT PORTS: ${STRATOS_PORTS},"
+OUTPUT="$OUTPUT STRATOS_LB_IP: ${STRATOS_LB_IP},"
+OUTPUT="$OUTPUT STRATOS_LB_PUBLIC_IP: ${STRATOS_LB_PUBLIC_IP},"
+OUTPUT="$OUTPUT APP_PATH: ${APP_PATH},"
+OUTPUT="$OUTPUT STRATOS_PARAM_FILE_PATH: ${STRATOS_PARAM_FILE_PATH}"
+echo $OUTPUT | tee -a $log
+echo "Member List: ${STRATOS_MEMBER_LIST_JSON}" | tee -a $log
+echo "Topology: ${STRATOS_TOPOLOGY_JSON}" | tee -a $log
+echo "---------------" | tee -a $log
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/mount-volumes.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/mount-volumes.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/mount-volumes.sh
new file mode 100755
index 0000000..2e649bd
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/mount-volumes.sh
@@ -0,0 +1,87 @@
+#!/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 to mount volumes
+# to the instance.
+# --------------------------------------------------------------
+#
+
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+echo -e "Starting mounting volumes" 2>&1 | tee -a $log
+
+# $1 is passed from Cartridge Agent code.
+echo -e "launh param file location $1" | tee -a $log
+#source /opt/apache-stratos-cartridge-agent/launch.params
+PERSISTENCE_MAPPING=$1
+echo -e "Persistance mappings : $PERSISTENCE_MAPPING" 2>&1 | tee -a $log
+
+mount_volume(){
+
+ device=$1;
+ mount_point=$2;
+ echo "device $device"
+ echo "point $mount_point"
+ # check if the volume has a file system
+ output=`sudo file -s $device`;
+ echo $output | tee -a $log
+
+ # this is the pattern of the output of file -s if the volume does not have a file system
+ # refer to http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
+ pattern="$device: data"
+
+ if [[ $output == $pattern ]]
+ then
+ echo -e "Volume is not formatted. So formating the device $device \n" | tee -a $log
+ sudo mkfs -t ext4 $device
+ fi
+
+ echo "Mounting the device $device to the mount point $mount_point \n" | tee -a $log
+ device_mounted=$(mount | grep "$device")
+
+ if [ ! -d "$mount_point" ]
+ then
+ echo "creating the mount point directory $mount_point since it does not exist." | tee -a $log
+ sudo mkdir $mount_point
+ fi
+
+ #mounting the device if it is not already mounted
+ if [ ! "$device_mounted" = "" ]
+ then
+ echo -e "Device $device is already mounted." | tee -a $log
+ else
+ sudo mount $device $mount_point
+ fi
+
+}
+
+IFS='|' read -ra ADDR <<< "${PERSISTENCE_MAPPING}"
+echo "${ADDR[@]}" | tee -a $log
+
+for i in "${!ADDR[@]}"; do
+ # expected PERSISTANCE_MAPPING format is device1|mountPoint1|device2|mountpoint2...
+ # so that even indexes are devices and odd indexes are mount points..
+ if (( $i % 2 == 0 ))
+ then
+ mount_volume ${ADDR[$i]} ${ADDR[$i + 1]}
+ fi
+done
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/cartridge-agent/modules/distribution/src/main/extensions/start-servers.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/distribution/src/main/extensions/start-servers.sh b/products/cartridge-agent/modules/distribution/src/main/extensions/start-servers.sh
index 1bb3f84..d70a193 100644
--- a/products/cartridge-agent/modules/distribution/src/main/extensions/start-servers.sh
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/start-servers.sh
@@ -24,4 +24,16 @@
#
log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo "Starting servers" | tee -a $log
\ No newline at end of file
+if [[ -z $STRATOS_CLUSTERING ]]; then
+ echo `date`": Starting servers..." | tee -a $log
+else
+ echo `date`": Starting servers in clustering mode..." | tee -a $log
+fi
+
+echo "LB IP: ${STRATOS_LB_IP}" | tee -a $log
+echo "LB PUBLIC IP: $STRATOS_LB_PUBLIC_IP}" | tee -a $log
+echo "STRATOS_PARAM_FILE_PATH: ${STRATOS_PARAM_FILE_PATH}"
+echo "Member List: ${STRATOS_MEMBER_LIST_JSON}" | tee -a $log
+echo "Complete Topology: ${STRATOS_TOPOLOGY_JSON}" | tee -a $log
+echo "Members in LB: ${STRATOS_MEMBERS_IN_LB_JSON}" | tee -a $log
+echo "APP_PATH: ${APP_PATH}" | tee -a $log
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/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
new file mode 100644
index 0000000..f78a5db
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-added.sh
@@ -0,0 +1,37 @@
+#!/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
+
+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/7b35e29e/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
new file mode 100644
index 0000000..b007044
--- /dev/null
+++ b/products/cartridge-agent/modules/distribution/src/main/extensions/subscription-domain-removed.sh
@@ -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 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
+
+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/7b35e29e/products/stratos/conf/tenant-mgt.xml
----------------------------------------------------------------------
diff --git a/products/stratos/conf/tenant-mgt.xml b/products/stratos/conf/tenant-mgt.xml
new file mode 100644
index 0000000..ddfe83a
--- /dev/null
+++ b/products/stratos/conf/tenant-mgt.xml
@@ -0,0 +1,42 @@
+<!--
+ ~ 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.
+ -->
+<TenantManagers>
+ <TenantManager class="org.wso2.carbon.user.core.tenant.JDBCTenantManager">
+ <Property name="MultiTenantRealmConfigBuilder">org.wso2.carbon.user.core.config.multitenancy.SimpleRealmConfigBuilder</Property>
+ </TenantManager>
+</TenantManagers>
+
+<!--If the product is using LDAP user store in MT mode, use following tenant manager.-->
+<!--TenantManager class="org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager">
+ <Property name="RootPartition">dc=wso2,dc=com</Property>
+ <Property name="OrganizationalObjectClass">organizationalUnit</Property>
+ <Property name="OrganizationalAttribute">ou</Property>
+ <Property name="OrganizationalSubContextObjectClass">organizationalUnit</Property>
+ <Property name="OrganizationalSubContextAttribute">ou</Property>
+</TenantManager-->
+<!--Following tenant manager is used by Identity Server (IS) as its default tenant manager.
+ IS will do token replacement when building the product. Therefore do not change the syntax.-->
+<!--TenantManager class="org.wso2.carbon.user.core.tenant.JDBCTenantManager">
+ <Property name="RootPartition">dc=wso2,dc=org</Property>
+ <Property name="OrganizationalObjectClass">organizationalUnit</Property>
+ <Property name="OrganizationalAttribute">ou</Property>
+ <Property name="OrganizationalSubContextObjectClass">organizationalUnit</Property>
+ <Property name="OrganizationalSubContextAttribute">ou</Property>
+</TenantManager-->
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/stratos/modules/distribution/src/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/assembly/bin.xml b/products/stratos/modules/distribution/src/assembly/bin.xml
index 6e1d991..b5c4798 100755
--- a/products/stratos/modules/distribution/src/assembly/bin.xml
+++ b/products/stratos/modules/distribution/src/assembly/bin.xml
@@ -39,17 +39,18 @@
<exclude>**/LICENSE.txt</exclude>
<exclude>**/NOTICE</exclude>
<exclude>**/release-notes.html</exclude>
- <exclude>**/launch.ini</exclude>
+ <exclude>**/launch.ini</exclude>
<exclude>**/carbon.xml</exclude>
<exclude>**/README*</exclude>
<exclude>**/log4j.properties</exclude>
<exclude>**/repository/components/**</exclude>
- <exclude>**/lib/endorsed/**</exclude>
+ <exclude>**/lib/endorsed/**</exclude>
<exclude>**/dbscripts/mysql.sql</exclude>
<exclude>**/repository/conf/security/cipher-tool.properties</exclude>
<exclude>**/repository/conf/security/cipher-text.properties</exclude>
- <exclude>**/repository/conf/axis2/axis2.xml</exclude>
- <exclude>**/repository/conf/registry.xml</exclude>
+ <exclude>**/repository/conf/axis2/axis2.xml</exclude>
+ <exclude>**/repository/conf/registry.xml</exclude>
+
<exclude>**/repository/conf/log4j.properties</exclude>
<exclude>**/repository/conf/data-bridge/**</exclude>
</excludes>
@@ -153,6 +154,7 @@
<exclude>**/datasources.properties</exclude>
<exclude>.svn</exclude>
<exclude>**/temp-artifacts/**</exclude>
+ <exclude>tenant-mgt.xml</exclude>
<exclude>email-bill-generated.xml</exclude>
<exclude>email-billing-notifications.xml</exclude>
<exclude>email-new-tenant-activation.xml</exclude>
@@ -168,6 +170,7 @@
<exclude>tenant-reg-agent.xml</exclude>
<exclude>features-dashboard.xml</exclude>
<exclude>**/data-bridge/**</exclude>
+
</excludes>
</fileSet>
<fileSet>
@@ -835,6 +838,12 @@
<destName>jaas.conf</destName>
<filtered>true</filtered>
</file>
+ <file>
+ <source>../../conf/tenant-mgt.xml</source>
+ <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>
+ <filtered>true</filtered>
+ <fileMode>644</fileMode>
+ </file>
<!--Application authenticators -->
<file>
<source>../../conf/application-authenticators.xml</source>
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/stratos/modules/distribution/src/main/conf/autoscaler.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/autoscaler.xml b/products/stratos/modules/distribution/src/main/conf/autoscaler.xml
index 18c44a2..c0c4eb9 100644
--- a/products/stratos/modules/distribution/src/main/conf/autoscaler.xml
+++ b/products/stratos/modules/distribution/src/main/conf/autoscaler.xml
@@ -41,5 +41,7 @@
<!-->member expiry timeout (time waited till activation) in ms<-->
<expiryTimeout>900000</expiryTimeout>
</member>
+ <!-- monitor task interval -->
+ <monitorInterval>90000</monitorInterval>
</autoscaler>
</configuration>
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/stratos/modules/distribution/src/main/conf/mincheck.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/mincheck.drl b/products/stratos/modules/distribution/src/main/conf/mincheck.drl
index b1c0f7c..ceeab48 100755
--- a/products/stratos/modules/distribution/src/main/conf/mincheck.drl
+++ b/products/stratos/modules/distribution/src/main/conf/mincheck.drl
@@ -48,6 +48,8 @@ global org.apache.stratos.messaging.domain.topology.Topology $topology;
global java.util.Map partitionCtxts;
global java.lang.String clusterId;
global java.lang.String lbRef;
+global java.lang.Boolean isPrimary;
+global Integer primaryMemberCount;
rule "Minimum Rule"
dialect "mvel"
@@ -56,11 +58,14 @@ dialect "mvel"
eval(log.debug("Running minimum rule: [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId()))
eval(log.debug("[min-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Non terminated member count: " + $ctxt.getNonTerminatedMemberCount()))
eval(log.debug("[min-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Minimum member count: " + $ctxt.getMinimumMemberCount()))
- eval($ctxt.getNonTerminatedMemberCount() < $ctxt.getMinimumMemberCount())
-
+ eval ( (isPrimary && (primaryMemberCount < $ctxt.getMinimumMemberCount() )) || ( !isPrimary && ($ctxt.getNonTerminatedMemberCount() < $ctxt.getMinimumMemberCount() )) )
then
- $delegator.delegateSpawn($ctxt, clusterId, lbRef);
-
+ if (isPrimary){
+ log.debug("[min-check] true [primary] true [primary member count] " + primaryMemberCount);
+ } else{
+ log.debug("[min-check] true [primary] false");
+ }
+ $delegator.delegateSpawn($ctxt, clusterId, lbRef, isPrimary);
end
rule "Terminate Obsoleted Instances"
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/stratos/modules/distribution/src/main/conf/scaling.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/scaling.drl b/products/stratos/modules/distribution/src/main/conf/scaling.drl
index c192cd2..b3f6466 100644
--- a/products/stratos/modules/distribution/src/main/conf/scaling.drl
+++ b/products/stratos/modules/distribution/src/main/conf/scaling.drl
@@ -53,6 +53,8 @@ global java.lang.String lbRef;
global java.lang.Boolean rifReset;
global java.lang.Boolean mcReset;
global java.lang.Boolean laReset;
+global java.lang.Boolean isPrimary;
+global java.util.List primaryMembers;
rule "Scaling Rule"
dialect "mvel"
@@ -109,7 +111,7 @@ dialect "mvel"
if(partition != null){
log.info("[scale-up] Partition available, hence trying to spawn an instance to scale up!" );
log.debug("[scale-up] " + " [partition] " + partition.getId() + " [cluster] " + clusterId );
- $delegator.delegateSpawn($networkPartitionContext.getPartitionCtxt(partition.getId()), clusterId, lbRef);
+ $delegator.delegateSpawn($networkPartitionContext.getPartitionCtxt(partition.getId()), clusterId, lbRef, isPrimary);
}
} else if(scaleDown){
@@ -126,8 +128,15 @@ dialect "mvel"
log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] " + clusterId);
partitionContext = $networkPartitionContext.getPartitionCtxt(partition.getId());
- for(MemberStatsContext memberStatsContext: partitionContext.getMemberStatsContexts().values()){
+ // In partition context member stat context, all the primary members need to be
+ // avoided being selected as the member to terminated
+
+
+ for(MemberStatsContext memberStatsContext: partitionContext.getMemberStatsContexts().values()){
+
+ if( !primaryMembers.contains(memberStatsContext.getMemberId()) ) {
+
LoadAverage loadAverage = memberStatsContext.getLoadAverage();
log.debug("[scale-down] " + " [cluster] "
+ clusterId + " [member] " + memberStatsContext.getMemberId() + " Load average: " + loadAverage);
@@ -156,6 +165,10 @@ dialect "mvel"
selectedMemberStatsContext = memberStatsContext;
lowestOverallLoad = overallLoad;
}
+
+
+ }
+
}
if(selectedMemberStatsContext != null) {
log.info("[scale-down] Trying to terminating an instace to scale down!" );
http://git-wip-us.apache.org/repos/asf/stratos/blob/7b35e29e/products/stratos/modules/distribution/src/main/conf/siddhi/siddhi.extension
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/siddhi/siddhi.extension b/products/stratos/modules/distribution/src/main/conf/siddhi/siddhi.extension
index 6bb9aca..470d66c 100644
--- a/products/stratos/modules/distribution/src/main/conf/siddhi/siddhi.extension
+++ b/products/stratos/modules/distribution/src/main/conf/siddhi/siddhi.extension
@@ -1,3 +1,4 @@
org.apache.stratos.cep.extension.GradientFinderWindowProcessor
org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor
org.apache.stratos.cep.extension.FaultHandlingWindowProcessor
+org.apache.stratos.cep.extension.ConcatWindowProcessor