You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/08/30 20:17:31 UTC

[38/50] [abbrv] stratos git commit: Fixing pom modules structure. Make it consistent

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/lvs-extension/src/main/notice/NOTICE
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/lvs-extension/src/main/notice/NOTICE b/extensions/load-balancer/lvs-extension/src/main/notice/NOTICE
deleted file mode 100644
index 8624fcc..0000000
--- a/extensions/load-balancer/lvs-extension/src/main/notice/NOTICE
+++ /dev/null
@@ -1,395 +0,0 @@
-Apache Software
-Copyright 2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-================================================================================
-Apache Abdera Notice:
-
-Portions of Abdera were orginally developed by
-International Business Machines Corporation and are
-licensed to the Apache Software Foundation under the
-"Software Grant and Corporate Contribution License Agreement",
-informally known as the "Abdera CLA".
-
-This software's test suite contains data files derived from the
-Universal Feed Parser, Copyright (c) 2002-2005, Mark Pilgrim.
-
-This software's extensions module contains a JSON writer for Atom XML
-that utilizes a JSON parser, Copyright (c) 2002, json.org. The code was 
-licensed using Apache License by the author Douglas Crockford and made 
-available at http://json.org/java/apache.zip We have included portions 
-of the code in the extensions module.
-
-===============================================================================
-Apache Ant Notice:
-
-The <sync> task is based on code Copyright (c) 2002, Landmark
-Graphics Corp that has been kindly donated to the Apache Software
-Foundation.
-
-================================================================================
-Apache Axiom Notice:
-
-Portions Copyright 2006 International Business Machines Corp.
-
-================================================================================
-Apache Axis2 Notice:
-
-Portions Copyright 2006 International Business Machines Corp.
-Portions Copyright 2005-2007 WSO2, Inc.
-
-This product also includes schemas and specification developed by:
-- the W3C consortium (http://www.w3c.org)
-
-This product also includes WS-* schemas developed by International
-Business Machines Corporation, Microsoft Corporation, BEA Systems,
-TIBCO Software, SAP AG, Sonic Software, and VeriSign
-
-This product also includes a WSDL developed by salesforce.com
-- Copyright 1999-2006 salesforce.com, inc.
-
-Portions of the included xmlbeans library were originally based on the following:
-- software copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/>.
-
-================================================================================
-Apache Commons-Lang Notice:
-
-This product includes software from the Spring Framework,
-under the Apache License 2.0 (see: StringUtils.containsWhitespace())
-
-================================================================================
-Apache Commons-Pool Notice:
-
-The LinkedBlockingDeque implementation is based on an implementation written by
-Doug Lea with assistance from members of JCP JSR-166 Expert Group and released
-to the public domain, as explained at
-http://creativecommons.org/licenses/publicdomain
-
-================================================================================
-Apache Commons-httpclient Notice:
-
-This project contains annotations derived from JCIP-ANNOTATIONS
-Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
-
-===============================================================================
-Apache Tomcat Notice:
-
-The Windows Installer is built with the Nullsoft
-Scriptable Install System (NSIS), which is
-open source software.  The original software and
-related information is available at
-http://nsis.sourceforge.net.
-
-Java compilation software for JSP pages is provided by Eclipse,
-which is open source software.  The original software and
-related information is available at
-http://www.eclipse.org.
-
-For the bayeux implementation
-The org.apache.cometd.bayeux API is derivative work originating at the Dojo Foundation
-* Copyright 2007-2008 Guy Molinari
-* Copyright 2007-2008 Filip Hanik
-* Copyright 2007 Dojo Foundation
-* Copyright 2007 Mort Bay Consulting Pty. Ltd.
-
-The original XML Schemas for Java EE Deployment Descriptors:
- - javaee_5.xsd
- - javaee_web_services_1_2.xsd
- - javaee_web_services_client_1_2.xsd
- - javaee_6.xsd
- - javaee_web_services_1_3.xsd
- - javaee_web_services_client_1_3.xsd
- - jsp_2_2.xsd
- - web-app_3_0.xsd
- - web-common_3_0.xsd
- - web-fragment_3_0.xsd
- - javaee_7.xsd
- - javaee_web_services_1_4.xsd
- - javaee_web_services_client_1_4.xsd
- - jsp_2_3.xsd
- - web-app_3_1.xsd
- - web-common_3_1.xsd
- - web-fragment_3_1.xsd
-
-may be obtained from:
-http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/index.html
-
-================================================================================
-Apache Geranimo Notice:
-
-Apache Geronimo
-Copyright 2003-2011 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of the Web Console were orginally developed by International
-Business Machines Corporation and are licensed to the Apache Software
-Foundation under the "Software Grant and Corporate Contribution
-License Agreement", informally known as the "IBM Console CLA".
-
-Portions of the ASN1 codec implementation in
-framework/modules/geronimo-crypto/ were developed by the Bouncy Castle
-project (http://www.bouncycastle.org/).
-
-Copyright (c) 2000-2005
-The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
-
-ORB Portions of this software were developed at IONA Technologies.
-
-Object Management Group (OMG) classes used by the orb.
-The original classes are available from www.org.omg.
-
-The RMI over IIOP implementation were developed at Trifork Technologies.
-
-Copyright 2004-2009 Tranql project committers
-This product includes software developed at
-Tranql (http://tranql.codehaus.org/).
-
-This product includes software developed by the Protocol Buffers
-project (http://code.google.com/apis/protocolbuffers).
-
-This product includes also software developed by :
-  - the W3C consortium (http://www.w3c.org) ,
-  - the SAX project (http://www.saxproject.org)
-
-The <sync> task is based on code Copyright (c) 2002, Landmark
-Graphics Corp that has been kindly donated to the Apache Software
-Foundation.
-
-Portions of this software were originally based on the following:
-  - software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
-  - software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
-  - voluntary contributions made by Paul Eng on behalf of the
-    Apache Software Foundation that were originally developed at iClick, Inc.,
-    software copyright (c) 1999.
-
-
-Portions Copyright 2006 International Business Machines Corp.
-Portions Copyright 2005-2007 WSO2, Inc.
-
-This product also includes schemas and specification developed by:
-- the W3C consortium (http://www.w3c.org)
-
-This product also includes WS-* schemas developed by International
-Business Machines Corporation, Microsoft Corporation, BEA Systems,
-TIBCO Software, SAP AG, Sonic Software, and VeriSign
-
-This product also includes a WSDL developed by salesforce.com
-- Copyright 1999-2006 salesforce.com, inc.
-
-Portions of the included xmlbeans library were originally based on the following:
-- software copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/>.
-
-This product also includes schemas and specification developed by:
-      - the W3C consortium (http://www.w3c.org)
-      (http://www.w3.org/XML/1998/namespace)
-
-This product also includes WS-* schemas developed by International
-   Business Machines Corporation, Microsoft Corporation, BEA Systems,
-   TIBCO Software, SAP AG, Sonic Software, and VeriSign
-   (http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd)
-   (http://schemas.xmlsoap.org/ws/2004/08/addressing/)
-   (http://schemas.xmlsoap.org/wsdl/http)
-   (http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm.xsd)
-   (http://www.w3.org/2005/08/addressing/ws-addr.xsd)
-
-Portions of Derby were originally developed by
-International Business Machines Corporation and are
-licensed to the Apache Software Foundation under the
-"Software Grant and Corporate Contribution License Agreement",
-informally known as the "Derby CLA".
-The following copyright notice(s) were affixed to portions of the code
-with which this file is now or was at one time distributed
-and are placed here unaltered.
-
-(C) Copyright 1997,2004 International Business Machines Corporation.  All rights reserved.
-
-(C) Copyright IBM Corp. 2003.
-
-The portion of the functionTests under 'nist' was originally
-developed by the National Institute of Standards and Technology (NIST),
-an agency of the United States Department of Commerce, and adapted by
-International Business Machines Corporation in accordance with the NIST
-Software Acknowledgment and Redistribution document at
-http://www.itl.nist.gov/div897/ctg/sql_form.htm
-
-* OpenJPA includes software written by Miroslav Nachev.
-
-* OpenJPA uses test code written by Charles Tillman.
-
-XMLSec was originally based on software copyright (c) 2001, Institute for
-Data Communications Systems, <http://www.nue.et-inf.uni-siegen.de/>.
-
-The development of XMLSec was partly funded by the European
-Commission in the <WebSig> project in the ISIS Programme.
-
-This product also includes software developed by :
-
-  - IBM Corporation (http://www.ibm.com),
-      WSDL4J was the initial code contribution for the Apache Woden
-      project and some of the WSDL4J design and code has been reused.
-  - The W3C Consortium (http://www.w3c.org),
-      Common W3C XML Schema and DTD files are packaged with Apache Woden.
-
-Portions Copyright 2006 International Business Machines Corp.
-
-Portions of this software were originally based on the following:
-  - software copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/>.
-
-Aside from contributions to the Apache XMLBeans project, this
-software also includes:
-
- - one or more source files from the Apache Xerces-J and Apache Axis
-   products, Copyright (c) 1999-2003 Apache Software Foundation
-
- - W3C XML Schema documents Copyright 2001-2003 (c) World Wide Web
-   Consortium (Massachusetts Institute of Technology, European Research
-   Consortium for Informatics and Mathematics, Keio University)
-
- - resolver.jar from Apache Xml Commons project,
-   Copyright (c) 2001-2003 Apache Software Foundation
-
- - Piccolo XML Parser for Java from http://piccolo.sourceforge.net/,
-   Copyright 2002 Yuval Oren under the terms of the Apache Software License 2.0
-
- - JSR-173 Streaming API for XML from http://sourceforge.net/projects/xmlpullparser/,
-   Copyright 2005 BEA under the terms of the Apache Software License 2.0
-
-This product includes software developed by the Simple XML Compiler (SXC)
-project (http://sxc.codehaus.org/project-info.html)
-
-This product includes software developed for the JAXB Reference
-Implementation project. (https://jaxb.dev.java.net/).  Apache Geronimo elects
-to include this software in this distribution under the CDDL license.
-
-This product includes software developed for SOAP with Attachments
-API for Java (SAAJ). The software is available from the GlassFish project
-(https://saaj.dev.java.net/).  Apache Geronimo elects to include this
-software in this distribution under the CDDL license.
-
-This product includes software developed for Java API for XML Web Services
-project (JAX-WS) (https://jax-ws.dev.java.net/).  Apache Geronimo elects
-to include this software in this distribution under the CDDL license.
-
-This product includes software developed for the Java Server Pages Tag
-Library project (https://jstl.dev.java.net/).   Apache Geronimo elects
-to include this software in this distribution under the CDDL license.
-
-This product includes schema files developed for the Glassfish Java EE
-reference implementation (http://java.sun.com/xml/ns/j2ee/).
-Apache Geronimo elects to include this software in this distribution
-under the CDDL license.  You can obtain a copy of the License at:
-    https://glassfish.dev.java.net/public/CDDL+GPL.html
-The source code is available at:
-    https://glassfish.dev.java.net/source/browse/glassfish/
-
-The following schemas are included:
-
-----------------------------------
-  application-client_1_4.xsd
-  application_1_4.xsd
-  connector_1_5.xsd
-  datatypes.dtd
-  ejb-jar_2_1.xsd
-  j2ee_1_4.xsd
-  j2ee_jaxrpc_mapping_1_1.xsd
-  j2ee_web_services_1_1.xsd
-  j2ee_web_services_client_1_1.xsd
-  jsp_2_0.xsd
-  web-app_2_4.xsd
-  web-jsptaglibrary_2_0.xsd
-  application-client_5.xsd
-  application_5.xsd
-  ejb-jar_3_0.xsd
-  handler-chain.xsd
-  javaee_5.xsd
-  javaee_web_services_1_2.xsd
-  javaee_web_services_client_1_2.xsd
-  jsp_2_1.xsd
-  persistence_1_0.xsd
-  web-app_2_5.xsd
-  web-facelettaglibrary_2_0.xsd
-  web-facesconfig_2_0.xsd
-  web-partialresponse_2_0.xsd
-  web-jsptaglibrary_2_1.xsd
-  application_6.xsd
-  application-client_6.xsd
-  connector_1_6.xsd
-  ejb-jar_3_1.xsd
-  javaee_6.xsd
-  javaee_web_services_1_3.xsd
-  javaee_web_services_client_1_3.xsd
-  jsp_2_2.xsd
-  persistence_2_0.xsd
-  web-app_3_0.xsd
-  web-common_3_0.xsd
-  web-fragment_3_0.xsd
---------------------------------
-
-This product includes software developed at
-the OSGi Alliance (http://www.osgi.org/).
-
- This product includes software developed at
- OPS4J (http://www.ops4j.org/).
--------------------------------------------------------------------------------
-
-The product contains the software developed in javassist.org (http://www.javassist.org) 
-which is released under both the Mozilla Public License 
-(http://www.mozilla.org/MPL/MPL-1.1.html) and the GNU Lesser General Public 
-License (http://www.gnu.org/licenses/lgpl-2.1.html).  
-
-The Apache Geronimo project elects to distribute this software under the terms of 
-the Mozilla Public License. 
-
--------------------------------------------------------------------------------
-
-The product contains the software developed in json.org which released under the following license.
-
-http://www.json.org/license.html
-
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
-
-================================================================================
-Apache Httpclient Notice:
-
-This project contains annotations derived from JCIP-ANNOTATIONS
-Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
-
-================================================================================
-Apache Httpcore Notice:
-
-This project contains annotations derived from JCIP-ANNOTATIONS
-Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
-
-===============================================================================
-Apache POI Notice:
-
-This product contains the DOM4J library (http://www.dom4j.org).
-Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
-
-This product contains parts that were originally based on software from BEA.
-Copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/>.
-
-This product contains W3C XML Schema documents. Copyright 2001-2003 (c)
-World Wide Web Consortium (Massachusetts Institute of Technology, European
-Research Consortium for Informatics and Mathematics, Keio University)
-
-This product contains the Piccolo XML Parser for Java
-(http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren.
-
-This product contains the chunks_parse_cmds.tbl file from the vsdump program.
-Copyright (C) 2006-2007 Valek Filippov (frob@df.ru)
-
-
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/lvs-extension/src/main/resources/velocity.properties
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/lvs-extension/src/main/resources/velocity.properties b/extensions/load-balancer/lvs-extension/src/main/resources/velocity.properties
deleted file mode 100644
index 437aec5..0000000
--- a/extensions/load-balancer/lvs-extension/src/main/resources/velocity.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-resource.loader=class, file
-class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
-file.resource.loader.class=org.apache.velocity.runtime.resource.loader.FileResourceLoader
-runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem
-runtime.log.logsystem.log4j.category=velocity
-input.encoding=UTF-8
-output.encoding=UTF-8
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/lvs-extension/src/main/security/client-truststore.jks
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/lvs-extension/src/main/security/client-truststore.jks b/extensions/load-balancer/lvs-extension/src/main/security/client-truststore.jks
deleted file mode 100644
index be441f3..0000000
Binary files a/extensions/load-balancer/lvs-extension/src/main/security/client-truststore.jks and /dev/null differ

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/lvs-extension/src/main/templates/keepalived.conf.template
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/lvs-extension/src/main/templates/keepalived.conf.template b/extensions/load-balancer/lvs-extension/src/main/templates/keepalived.conf.template
deleted file mode 100644
index 682598f..0000000
--- a/extensions/load-balancer/lvs-extension/src/main/templates/keepalived.conf.template
+++ /dev/null
@@ -1,59 +0,0 @@
-! Licensed to the Apache Software Foundation (ASF) under one
-! or more contributor license agreements.  See the NOTICE file
-! distributed with this work for additional information
-! regarding copyright ownership.  The ASF licenses this file
-! to you under the Apache License, Version 2.0 (the
-! "License"); you may not use this file except in compliance
-! with the License.  You may obtain a copy of the License at
-!
-!     http://www.apache.org/licenses/LICENSE-2.0
-!
-! Unless required by applicable law or agreed to in writing,
-! software distributed under the License is distributed on an
-! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-! KIND, either express or implied.  See the License for the
-! specific language governing permissions and limitations
-! under the License.
-!
-! This is a generated file and will be overwritten at the next load balancer startup.
-! Please use loadbalancer.conf for updating mb-ip, mb-port and templates/jndi.properties.template
-! file for updating other configurations.
-!
-
-! Configuration File for keepalived
-
-global_defs {
-   notification_email {
-       your_email@admin.com
-   }
-   notification_email_from loadbalancer1@admin.com
-   smtp_server localhost
-   smtp_connect_timeout 30
-! UNIQUE:
-   router_id LVS_PRI
-}
-
-! ***********************************************************************
-! *************************   WEB SERVICES VIP  *************************
-! ***********************************************************************
-vrrp_instance VirtIP_10 {
-    state $state
-    interface eth0
-    virtual_router_id 10
-! UNIQUE:
-    priority 150
-    advert_int 3
-    smtp_alert
-    authentication {
-        auth_type PASS
-        auth_pass MY_PASS
-    }
-    virtual_ipaddress {
-$virtualips
-    }
-
-    lvs_sync_daemon_interface eth0
-}
-
-
-$configuration
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/INSTALL.md
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/INSTALL.md b/extensions/load-balancer/modules/haproxy-extension/INSTALL.md
new file mode 100644
index 0000000..826419f
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/INSTALL.md
@@ -0,0 +1,32 @@
+# Installing Apache Stratos HAProxy Extension
+
+Apache Stratos HAProxy Extension could be used for integrating HAProxy load balancer with Apache Stratos. Please follow
+below steps to proceed with the installation:
+
+1. Download and extract HAProxy binary distribution to a desired location: <haproxy-home>.
+
+2. Extract org.apache.stratos.haproxy.extension-<version>.zip to a desired location: <haproxy-extension-home>.
+
+3. Open <haproxy-extension-home>/bin/haproxy-extension.sh file in a text editor and update following system properties:
+   ```
+   # Define haproxy host private ip address:
+   -Dhaproxy.private.ip=127.0.0.1
+
+   # Define the haproxy executable file path:
+   -Dexecutable.file.path=<haproxy-home>/haproxy
+
+   # Enable/disable cep statistics publisher:
+   -Dcep.stats.publisher.enabled=false
+
+   # If cep statistics publisher is enabled define the following properties:
+   -Dthrift.receiver.ip=127.0.0.1
+   -Dthrift.receiver.port=7615
+   -Dnetwork.partition.id=network-partition-1
+   ```
+
+4. Open <haproxy-extension-home>/conf/jndi.properties file in a text editor and update message broker information:
+   ```
+   java.naming.provider.url=tcp://localhost:61616
+   ```
+5. Run <haproxy-extension-home>/bin/haproxy-extension.sh as the root user.
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/README.md
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/README.md b/extensions/load-balancer/modules/haproxy-extension/README.md
new file mode 100644
index 0000000..50a49a1
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/README.md
@@ -0,0 +1,20 @@
+# Apache Stratos HAProxy Extension
+
+Apache Stratos HAProxy extension is a load balancer extension for HAProxy. It is an executable program
+which can manage the life-cycle of a HAProxy instance according to the topology, composite application model,
+tenant application signups and domain mapping information received from Stratos via the message broker.
+
+## How it works
+1. Wait for the complete topology event message to initialize the topology.
+2. Configure and start an instance of HAProxy.
+3. Listen to topology, application, application signup, domain mapping events.
+4. Reload HAProxy instance with the new topology configuration.
+5. Periodically publish statistics to Complex Event Processor (CEP).
+
+## Installation
+Please refer INSTALL.md for information on the installation process.
+
+Thanks to Vaadin for HAProxyController implementation:
+https://vaadin.com/license
+http://dev.vaadin.com/browser/svn/incubator/Arvue/ArvueMaster/src/org/vaadin/arvue/arvuemaster/HAProxyController.java
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/pom.xml b/extensions/load-balancer/modules/haproxy-extension/pom.xml
new file mode 100644
index 0000000..c15ceba
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.stratos</groupId>
+        <artifactId>stratos-load-balancer-extensions</artifactId>
+        <version>4.1.2</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>apache-stratos-haproxy-extension</artifactId>
+    <name>Apache Stratos - HAProxy Extension</name>
+    <description>Apache Stratos HAProxy Extension for Load Balancing</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.7.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.messaging</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.load.balancer.extension.api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity</artifactId>
+            <version>1.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.andes.wso2</groupId>
+            <artifactId>andes-client</artifactId>
+            <version>0.13.wso2v8</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <mainClass>org.apache.stratos.haproxy.extension.Main</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <descriptors>
+                        <descriptor>src/main/assembly/bin.xml</descriptor>
+                    </descriptors>
+                    <archiverConfig>
+                        <fileMode>420</fileMode>
+                        <directoryMode>493</directoryMode>
+                        <defaultDirectoryMode>493</defaultDirectoryMode>
+                    </archiverConfig>
+                    <appendAssemblyId>false</appendAssemblyId>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>attached</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/assembly/bin.xml b/extensions/load-balancer/modules/haproxy-extension/src/main/assembly/bin.xml
new file mode 100644
index 0000000..5bfa02e
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/assembly/bin.xml
@@ -0,0 +1,106 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+    <id>bin</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <fileSets>
+        <fileSet>
+            <directory>${project.basedir}/src/main/bin</directory>
+            <outputDirectory>/bin</outputDirectory>
+            <fileMode>0755</fileMode>
+            <includes>
+                <include>haproxy-extension.sh</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.basedir}/src/main/conf</directory>
+            <outputDirectory>/conf</outputDirectory>
+            <fileMode>0600</fileMode>
+            <includes>
+                <include>jndi.properties</include>
+                <include>log4j.properties</include>
+                <include>thrift-client-config.xml</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.basedir}/src/main/security</directory>
+            <outputDirectory>/security</outputDirectory>
+            <fileMode>0600</fileMode>
+            <includes>
+                <include>client-truststore.jks</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.basedir}/src/main/templates</directory>
+            <outputDirectory>/templates</outputDirectory>
+            <fileMode>0600</fileMode>
+            <includes>
+                <include>haproxy.cfg.template</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.basedir}/src/main/scripts</directory>
+            <outputDirectory>/scripts</outputDirectory>
+            <fileMode>0755</fileMode>
+            <includes>
+                <include>get-weight.sh</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.basedir}</directory>
+            <outputDirectory>/</outputDirectory>
+            <fileMode>0600</fileMode>
+            <includes>
+                <include>DISCLAIMER</include>
+                <include>README*</include>
+                <include>LICENSE*</include>
+                <include>INSTALL*</include>
+            </includes>
+        </fileSet>
+	<fileSet>
+            <directory>${project.basedir}/src/main/license</directory>
+            <outputDirectory>/</outputDirectory>
+            <fileMode>0600</fileMode>
+        </fileSet>
+        <fileSet>
+            <directory>${project.basedir}/src/main/notice</directory>
+            <outputDirectory>/</outputDirectory>
+            <fileMode>0600</fileMode>
+        </fileSet>
+    </fileSets>
+    <dependencySets>
+        <dependencySet>
+            <outputDirectory>/lib</outputDirectory>
+	    <excludes>
+                <exclude>*:icu4j*</exclude>
+                <exclude>*:jaxen*</exclude>
+                <exclude>*:jboss-transaction-api*</exclude>
+                <exclude>*:wrapper*</exclude>
+                <exclude>*:xom*</exclude>
+            </excludes>
+            <useProjectArtifact>true</useProjectArtifact>
+            <scope>runtime</scope>
+        </dependencySet>
+    </dependencySets>
+</assembly>

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/bin/haproxy-extension.sh
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/bin/haproxy-extension.sh b/extensions/load-balancer/modules/haproxy-extension/src/main/bin/haproxy-extension.sh
new file mode 100755
index 0000000..bc17399
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/bin/haproxy-extension.sh
@@ -0,0 +1,50 @@
+#!/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.
+#
+# --------------------------------------------------------------
+
+echo "Starting haproxy extension..."
+script_path="$( cd -P "$( dirname "$SOURCE" )" && pwd )/`dirname $0`"
+lib_path=${script_path}/../lib/
+class_path=`echo ${lib_path}/*.jar | tr ' ' ':'`
+properties="-Dhaproxy.private.ip=127.0.0.1
+            -Dexecutable.file.path=haproxy
+            -Djndi.properties.dir=${script_path}/../conf
+            -Dtemplates.path=${script_path}/../templates
+            -Dtemplates.name=haproxy.cfg.template
+            -Dscripts.path=${script_path}/../scripts
+            -Dconf.file.path=/tmp/haproxy.cfg
+            -Dstats.socket.file.path=/tmp/haproxy-stats.socket
+            -Dlog4j.properties.file.path=${script_path}/../conf/log4j.properties
+            -Djavax.net.ssl.trustStore=${script_path}/../security/client-truststore.jks
+            -Djavax.net.ssl.trustStorePassword=wso2carbon
+            -Dthrift.client.config.file.path=${script_path}/../conf/thrift-client-config.xml
+            -Dcep.stats.publisher.enabled=false
+            -Dthrift.receiver.ip=127.0.0.1
+            -Dthrift.receiver.port=7615
+            -Dnetwork.partition.id=network-partition-1
+            -Dcluster.id=cluster-1
+            -Dservice.name=service-1"
+
+
+# Uncomment below line to enable remote debugging
+#debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
+
+java -cp "${class_path}" ${properties} ${debug} org.apache.stratos.haproxy.extension.Main $*

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/conf/jndi.properties
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/conf/jndi.properties b/extensions/load-balancer/modules/haproxy-extension/src/main/conf/jndi.properties
new file mode 100644
index 0000000..21d7420
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/conf/jndi.properties
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+connectionfactoryName=TopicConnectionFactory
+java.naming.provider.url=tcp://localhost:61616
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/conf/log4j.properties b/extensions/load-balancer/modules/haproxy-extension/src/main/conf/log4j.properties
new file mode 100644
index 0000000..ec45878
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/conf/log4j.properties
@@ -0,0 +1,40 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Set root logger level and appenders
+log4j.rootLogger=INFO, CONSOLE_APPENDER, FILE_APPENDER
+
+# CONSOLE_APPENDER is set to be a ConsoleAppender.
+log4j.appender.CONSOLE_APPENDER=org.apache.log4j.ConsoleAppender
+
+# The standard error log where all the warnings, errors and fatal errors will be logged
+log4j.appender.FILE_APPENDER=org.apache.log4j.FileAppender
+log4j.appender.FILE_APPENDER.File=logs/haproxy-extension.log
+log4j.appender.FILE_APPENDER.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE_APPENDER.layout.ConversionPattern=%d{ISO8601} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%n
+log4j.appender.FILE_APPENDER.threshold=DEBUG
+
+# CONSOLE_APPENDER uses PatternLayout.
+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.haproxy.extension=INFO
+log4j.logger.org.apache.stratos.load.balancer.extension.api=INFO
+log4j.logger.org.apache.stratos.messaging=INFO
+log4j.logger.org.wso2.andes.client=ERROR
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/conf/thrift-client-config.xml
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/conf/thrift-client-config.xml b/extensions/load-balancer/modules/haproxy-extension/src/main/conf/thrift-client-config.xml
new file mode 100644
index 0000000..5cacada
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/conf/thrift-client-config.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!-- Apache thrift client configuration for publishing statistics to WSO2 CEP -->
+<thriftClientConfiguration>
+    <username>admin</username>
+    <password>admin</password>
+    <ip>localhost</ip>
+    <port>7611</port>
+</thriftClientConfiguration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
new file mode 100644
index 0000000..464f093
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.haproxy.extension;
+
+/**
+ * HA proxy extension constants.
+ */
+public class Constants {
+    public static final String HAPROXY_PRIVATE_IP = "haproxy.private.ip";
+    public static final String EXECUTABLE_FILE_PATH = "executable.file.path";
+    public static final String TEMPLATES_PATH = "templates.path";
+    public static final String TEMPLATES_NAME = "templates.name";
+    public static final String SCRIPTS_PATH = "scripts.path";
+    public static final String CONF_FILE_PATH = "conf.file.path";
+    public static final String STATS_SOCKET_FILE_PATH = "stats.socket.file.path";
+    public static final String CEP_STATS_PUBLISHER_ENABLED = "cep.stats.publisher.enabled";
+    public static final String THRIFT_RECEIVER_IP = "thrift.receiver.ip";
+    public static final String THRIFT_RECEIVER_PORT = "thrift.receiver.port";
+    public static final String NETWORK_PARTITION_ID = "network.partition.id";
+    public static final String CLUSTER_ID = "cluster.id";
+    public static final String SERVICE_NAME = "service.name";
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxy.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxy.java b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxy.java
new file mode 100644
index 0000000..18f005d
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxy.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.haproxy.extension;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.util.CommandUtils;
+import org.apache.stratos.load.balancer.extension.api.LoadBalancer;
+import org.apache.stratos.load.balancer.extension.api.exception.LoadBalancerExtensionException;
+import org.apache.stratos.load.balancer.common.domain.Topology;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.Vector;
+
+/**
+ * HAProxy load balancer life-cycle implementation.
+ */
+public class HAProxy implements LoadBalancer {
+
+    private static final Log log = LogFactory.getLog(HAProxy.class);
+
+    private String executableFilePath;
+    private String processIdFilePath;
+    private String templatePath;
+    private String templateName;
+    private String confFilePath;
+    private String statsSocketFilePath;
+
+    public HAProxy() {
+        this.executableFilePath = HAProxyContext.getInstance().getExecutableFilePath();
+        this.templatePath = HAProxyContext.getInstance().getTemplatePath();
+        this.templateName = HAProxyContext.getInstance().getTemplateName();
+        this.confFilePath = HAProxyContext.getInstance().getConfFilePath();
+        this.processIdFilePath = confFilePath.replace(".cfg", ".pid");
+        this.statsSocketFilePath = HAProxyContext.getInstance().getStatsSocketFilePath();
+    }
+
+    /**
+     * Configure haproxy instance according to topology given
+     * @param topology
+     * @throws LoadBalancerExtensionException
+     */
+    public boolean configure(Topology topology) throws LoadBalancerExtensionException {
+        try {
+            log.info("Generating haproxy configuration...");
+            HAProxyConfigWriter writer = new HAProxyConfigWriter(templatePath, templateName, confFilePath, statsSocketFilePath);
+            if(writer.write(topology)) {
+                return true;
+            }
+            return false;
+        } catch (Exception e) {
+            log.error("Could not generate haproxy configuration");
+            throw new LoadBalancerExtensionException(e);
+        }
+    }
+
+    /**
+     * Start haproxy instance
+     * @throws LoadBalancerExtensionException
+     */
+    public void start() throws LoadBalancerExtensionException {
+        log.info("Starting haproxy instance...");
+        // Check for configuration file
+        File conf = new File(confFilePath);
+        if (!conf.exists()) {
+            throw new LoadBalancerExtensionException("Could not find haproxy configuration file");
+        }
+
+        // Start haproxy and write pid to processIdFilePath
+        try {
+            String command = executableFilePath + " -f " + confFilePath + " -p " + processIdFilePath;
+            CommandUtils.executeCommand(command);
+            log.info("haproxy instance started");
+        } catch (Exception e) {
+            log.error("Could not start haproxy instance");
+            throw new LoadBalancerExtensionException(e);
+        }
+    }
+
+    /**
+     * Reload haproxy instance according to the configuration written in configure() method.
+     * @throws LoadBalancerExtensionException
+     */
+    public void reload() throws LoadBalancerExtensionException {
+        try {
+            log.info("Reloading configuration...");
+
+            // Read pid
+            String pid = "";
+            BufferedReader reader = new BufferedReader(new FileReader(processIdFilePath));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                pid += line + " ";
+            }
+
+            // Execute hot configuration deployment
+            String command = executableFilePath + " -f " + confFilePath + " -p " + processIdFilePath + " -sf " + pid;
+            CommandUtils.executeCommand(command);
+            if (log.isInfoEnabled()) {
+                log.info("Configuration done");
+            }
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("Reconfiguration failed");
+            }
+            throw new LoadBalancerExtensionException(e);
+        }
+    }
+
+    /**
+     * Stop haproxy instance
+     * @throws LoadBalancerExtensionException
+     */
+    public void stop() throws LoadBalancerExtensionException {
+
+        try {
+            // Read the PIDs
+            Vector<String> pids = new Vector<String>();
+            BufferedReader reader = new BufferedReader(new FileReader(processIdFilePath));
+            String pid_;
+            while ((pid_ = reader.readLine()) != null) {
+                pids.add(pid_);
+            }
+
+            // Kill all haproxy processes
+            for (String pid : pids) {
+                String command = "kill -s 9 " + pid;
+                CommandUtils.executeCommand(command);
+                if (log.isInfoEnabled()) {
+                    log.info(String.format("haproxy instance stopped [pid] %s", pid));
+                }
+            }
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("Could not stop haproxy instance", e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
new file mode 100644
index 0000000..7a0d531
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.haproxy.extension;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.load.balancer.common.domain.*;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.RuntimeConstants;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Collection;
+
+/**
+ * HAProxy load balancer configuration writer.
+ */
+public class HAProxyConfigWriter {
+
+    private static final Log log = LogFactory.getLog(Main.class);
+    private static final String NEW_LINE = System.getProperty("line.separator");
+
+    private String templatePath;
+    private String templateName;
+    private String confFilePath;
+    private String statsSocketFilePath;
+
+    public HAProxyConfigWriter(String templatePath, String templateName, String confFilePath,
+                               String statsSocketFilePath) {
+
+        this.templatePath = templatePath;
+        this.templateName = templateName;
+        this.confFilePath = confFilePath;
+        this.statsSocketFilePath = statsSocketFilePath;
+    }
+
+    public boolean write(Topology topology) {
+        // Prepare global parameters
+        StringBuilder globalParameters = new StringBuilder();
+        globalParameters.append("stats socket ");
+        globalParameters.append(statsSocketFilePath);
+
+        StringBuilder frontendCollection = new StringBuilder();
+        StringBuilder backendCollection = new StringBuilder();
+
+        for (Service service : topology.getServices()) {
+            for (Cluster cluster : service.getClusters()) {
+                createConfig(cluster, frontendCollection, backendCollection);
+            }
+        }
+
+        // Start velocity engine
+        VelocityEngine ve = new VelocityEngine();
+        ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, templatePath);
+        ve.init();
+
+        // Open the template
+        Template t = ve.getTemplate(templateName);
+
+        // Insert strings into the template
+        VelocityContext context = new VelocityContext();
+        context.put("global_parameters", globalParameters.toString());
+        context.put("frontend_collection", frontendCollection.toString());
+        context.put("backend_collection", backendCollection.toString());
+
+        // Create a new string from the template
+        StringWriter stringWriter = new StringWriter();
+        t.merge(context, stringWriter);
+        String configuration = stringWriter.toString();
+
+        // Write configuration file
+        try {
+            BufferedWriter writer = new BufferedWriter(new FileWriter(confFilePath));
+            writer.write(configuration);
+            writer.close();
+
+            if (log.isInfoEnabled()) {
+                log.info(String.format("Configuration written to file: %s", confFilePath));
+            }
+            return true;
+        } catch (IOException e) {
+            if (log.isErrorEnabled()) {
+                log.error(String.format("Could not write configuration file: %s", confFilePath));
+            }
+            throw new RuntimeException(e);
+        }
+    }
+
+    private void createConfig(Cluster cluster, StringBuilder frontendCollection,
+                              StringBuilder backendCollection) {
+
+        if((cluster.getMembers() == null) || (cluster.getMembers().size() == 0)) {
+            return;
+        }
+
+        // Find port mappings
+        Member firstMember = (Member) cluster.getMembers().toArray()[0];
+        Collection<Port> ports = firstMember.getPorts();
+
+        for (Port port : ports) {
+            // Frontend block start
+            String protocol = port.getProtocol();
+            String frontendId = protocol + "_" + port.getValue() + "_frontend";
+
+            frontendCollection.append("frontend ").append(frontendId).append(NEW_LINE);
+            frontendCollection.append("\tbind ").append(HAProxyContext.getInstance().getHAProxyPrivateIp())
+                    .append(":").append(port.getProxy()).append(NEW_LINE);
+            frontendCollection.append("\tmode ").append(protocol).append(NEW_LINE);
+
+            for (String hostname : cluster.getHostNames()) {
+                String backendId = hostname + "_" + protocol + "_" + port.getValue() + "_backend";
+
+                frontendCollection.append("\tacl ").append("is_").append(hostname).append(" hdr_beg(host) -i ")
+                        .append(hostname).append(NEW_LINE);
+                frontendCollection.append("\tuse_backend ").append(backendId).append(" if is_")
+                        .append(hostname).append(NEW_LINE);
+                // Front end block end
+
+                // Backend block start
+                backendCollection.append("backend ").append(backendId).append(NEW_LINE);
+                backendCollection.append("\tmode ").append(protocol).append(NEW_LINE);
+                for (Member member : cluster.getMembers()) {
+                    backendCollection.append("\tserver ").append(member.getMemberId()).append(" ")
+                            .append(member.getHostName()).append(":").append(port.getValue()).append(NEW_LINE);
+                }
+                backendCollection.append(NEW_LINE);
+                // Backend block end
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
new file mode 100644
index 0000000..3019c94
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.haproxy.extension;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * HAProxy context to read and store system properties.
+ */
+public class HAProxyContext {
+    private static final Log log = LogFactory.getLog(HAProxyContext.class);
+    private static volatile HAProxyContext context;
+
+    private String haProxyPrivateIp;
+    private String executableFilePath;
+    private String templatePath;
+    private String templateName;
+    private String scriptsPath;
+    private String confFilePath;
+    private String statsSocketFilePath;
+    private boolean cepStatsPublisherEnabled;
+    private String thriftReceiverIp;
+    private String thriftReceiverPort;
+    private String networkPartitionId;
+    private String clusterId;
+    private String serviceName;
+
+    private HAProxyContext() {
+        this.haProxyPrivateIp = System.getProperty(Constants.HAPROXY_PRIVATE_IP);
+        this.executableFilePath = System.getProperty(Constants.EXECUTABLE_FILE_PATH);
+        this.templatePath = System.getProperty(Constants.TEMPLATES_PATH);
+        this.templateName = System.getProperty(Constants.TEMPLATES_NAME);
+        this.scriptsPath = System.getProperty(Constants.SCRIPTS_PATH);
+        this.confFilePath = System.getProperty(Constants.CONF_FILE_PATH);
+        this.statsSocketFilePath = System.getProperty(Constants.STATS_SOCKET_FILE_PATH);
+        this.cepStatsPublisherEnabled = Boolean.getBoolean(Constants.CEP_STATS_PUBLISHER_ENABLED);
+        this.thriftReceiverIp = System.getProperty(Constants.THRIFT_RECEIVER_IP);
+        this.thriftReceiverPort = System.getProperty(Constants.THRIFT_RECEIVER_PORT);
+        this.networkPartitionId = System.getProperty(Constants.NETWORK_PARTITION_ID);
+        this.clusterId = System.getProperty(Constants.CLUSTER_ID);
+        this.serviceName = System.getProperty(Constants.SERVICE_NAME);
+
+        if (log.isDebugEnabled()) {
+            log.debug(Constants.HAPROXY_PRIVATE_IP + " = " + haProxyPrivateIp);
+            log.debug(Constants.EXECUTABLE_FILE_PATH + " = " + executableFilePath);
+            log.debug(Constants.TEMPLATES_PATH + " = " + templatePath);
+            log.debug(Constants.TEMPLATES_NAME + " = " + templateName);
+            log.debug(Constants.SCRIPTS_PATH + " = " + scriptsPath);
+            log.debug(Constants.CONF_FILE_PATH + " = " + confFilePath);
+            log.debug(Constants.STATS_SOCKET_FILE_PATH + " = " + statsSocketFilePath);
+            log.debug(Constants.CEP_STATS_PUBLISHER_ENABLED + " = " + cepStatsPublisherEnabled);
+            log.debug(Constants.THRIFT_RECEIVER_IP + " = " + thriftReceiverIp);
+            log.debug(Constants.THRIFT_RECEIVER_PORT + " = " + thriftReceiverPort);
+            log.debug(Constants.NETWORK_PARTITION_ID + " = " + networkPartitionId);
+            log.debug(Constants.CLUSTER_ID + " = " + clusterId);
+        }
+    }
+
+    public static HAProxyContext getInstance() {
+        if (context == null) {
+            synchronized (HAProxyContext.class) {
+                if (context == null) {
+                    context = new HAProxyContext();
+                }
+            }
+        }
+        return context;
+    }
+
+    public void validate() {
+        validateSystemProperty(Constants.HAPROXY_PRIVATE_IP);
+        validateSystemProperty(Constants.EXECUTABLE_FILE_PATH);
+        validateSystemProperty(Constants.TEMPLATES_PATH);
+        validateSystemProperty(Constants.TEMPLATES_NAME);
+        validateSystemProperty(Constants.SCRIPTS_PATH);
+        validateSystemProperty(Constants.CONF_FILE_PATH);
+        validateSystemProperty(Constants.STATS_SOCKET_FILE_PATH);
+        validateSystemProperty(Constants.CEP_STATS_PUBLISHER_ENABLED);
+        validateSystemProperty(Constants.CLUSTER_ID);
+
+        if (cepStatsPublisherEnabled) {
+            validateSystemProperty(Constants.THRIFT_RECEIVER_IP);
+            validateSystemProperty(Constants.THRIFT_RECEIVER_PORT);
+            validateSystemProperty(Constants.NETWORK_PARTITION_ID);
+        }
+    }
+
+    private void validateSystemProperty(String propertyName) {
+        String value = System.getProperty(propertyName);
+        if (StringUtils.isEmpty(value)) {
+            throw new RuntimeException("System property was not found: " + propertyName);
+        }
+    }
+
+    public String getHAProxyPrivateIp() {
+        return haProxyPrivateIp;
+    }
+
+    public String getExecutableFilePath() {
+        return executableFilePath;
+    }
+
+    public String getTemplatePath() {
+        return templatePath;
+    }
+
+    public String getTemplateName() {
+        return templateName;
+    }
+
+    public String getScriptsPath() {
+        return scriptsPath;
+    }
+
+    public String getConfFilePath() {
+        return confFilePath;
+    }
+
+    public String getStatsSocketFilePath() {
+        return statsSocketFilePath;
+    }
+
+    public boolean isCEPStatsPublisherEnabled() {
+        return cepStatsPublisherEnabled;
+    }
+
+    public String getNetworkPartitionId() {
+        return networkPartitionId;
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyStatisticsReader.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyStatisticsReader.java b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyStatisticsReader.java
new file mode 100644
index 0000000..7dec489
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyStatisticsReader.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.haproxy.extension;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.common.util.CommandUtils;
+import org.apache.stratos.load.balancer.common.domain.Cluster;
+import org.apache.stratos.load.balancer.common.domain.Member;
+import org.apache.stratos.load.balancer.common.domain.Port;
+import org.apache.stratos.load.balancer.common.domain.Service;
+import org.apache.stratos.load.balancer.common.statistics.LoadBalancerStatisticsReader;
+import org.apache.stratos.load.balancer.common.topology.TopologyProvider;
+
+import java.io.IOException;
+
+/**
+ * HAProxy statistics reader.
+ */
+public class HAProxyStatisticsReader implements LoadBalancerStatisticsReader {
+
+    private static final Log log = LogFactory.getLog(HAProxyStatisticsReader.class);
+
+    private String scriptsPath;
+    private String statsSocketFilePath;
+    private TopologyProvider topologyProvider;
+    private String clusterInstanceId;
+
+    public HAProxyStatisticsReader(TopologyProvider topologyProvider) {
+        this.scriptsPath = HAProxyContext.getInstance().getScriptsPath();
+        this.statsSocketFilePath = HAProxyContext.getInstance().getStatsSocketFilePath();
+        this.topologyProvider = topologyProvider;
+        this.clusterInstanceId = System.getProperty(StratosConstants.CLUSTER_INSTANCE_ID, StratosConstants.NOT_DEFINED);
+    }
+
+    @Override
+    public String getClusterInstanceId() {
+        return clusterInstanceId;
+    }
+
+    @Override
+    public int getInFlightRequestCount(String clusterId) {
+        String frontendId, backendId, command, output;
+        String[] array;
+        int totalWeight, weight;
+
+        for (Service service : topologyProvider.getTopology().getServices()) {
+            for (Cluster cluster : service.getClusters()) {
+                if (cluster.getClusterId().equals(clusterId)) {
+                    totalWeight = 0;
+                    if ((service.getPorts() == null) || (service.getPorts().size() == 0)) {
+                        throw new RuntimeException(String.format("No ports found in service: %s", service.getServiceName()));
+                    }
+
+                    for (Port port : service.getPorts()) {
+                        for(String hostname : cluster.getHostNames()) {
+                            backendId = hostname+"-http-members";
+                            for (Member member : cluster.getMembers()) {
+                                // echo "get weight <backend>/<server>" | socat stdio <stats-socket>
+                                command = String.format("%s/get-weight.sh %s %s %s", scriptsPath, backendId, member.getMemberId(), statsSocketFilePath);
+                                try {
+                                    output = CommandUtils.executeCommand(command);
+                                    if ((output != null) && (output.length() > 0)) {
+                                        array = output.split(" ");
+                                        if ((array != null) && (array.length > 0)) {
+                                            weight = Integer.parseInt(array[0]);
+                                            if (log.isDebugEnabled()) {
+                                                log.debug(String.format("Member weight found: [cluster] %s [member] %s [weight] %d", member.getClusterId(), member.getMemberId(), weight));
+                                            }
+                                            totalWeight += weight;
+                                        }
+                                    }
+                                } catch (IOException e) {
+                                    if (log.isErrorEnabled()) {
+                                        log.error(e);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    if (log.isInfoEnabled()) {
+                        log.info(String.format("Cluster weight found: [cluster] %s [weight] %d", cluster.getClusterId(), totalWeight));
+                    }
+                    return totalWeight;
+                }
+            }
+        }
+        return 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d97d9c78/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
new file mode 100644
index 0000000..f56541d
--- /dev/null
+++ b/extensions/load-balancer/modules/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.haproxy.extension;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.stratos.common.threading.StratosThreadPool;
+import org.apache.stratos.load.balancer.common.topology.TopologyProvider;
+import org.apache.stratos.load.balancer.extension.api.LoadBalancerExtension;
+
+import java.util.concurrent.ExecutorService;
+
+/**
+ * HAProxy extension main class.
+ */
+public class Main {
+	private static final Log log = LogFactory.getLog(Main.class);
+	private static ExecutorService executorService;
+
+	public static void main(String[] args) {
+
+		LoadBalancerExtension extension = null;
+		try {
+			// Configure log4j properties
+			PropertyConfigurator.configure(System.getProperty("log4j.properties.file.path"));
+
+			if (log.isInfoEnabled()) {
+				log.info("HAProxy extension started");
+			}
+
+            // Add shutdown hook
+            final Thread mainThread = Thread.currentThread();
+            final LoadBalancerExtension finalExtension = extension;
+            Runtime.getRuntime().addShutdownHook(new Thread() {
+                public void run() {
+                    try {
+                        if(finalExtension != null) {
+                            log.info("Shutting haproxy instance...");
+                            finalExtension.stop();
+                        }
+                        mainThread.join();
+                    } catch (Exception e) {
+                        log.error(e);
+                    }
+                }
+            });
+
+			executorService = StratosThreadPool.getExecutorService("haproxy.extension.thread.pool", 10);
+			// Validate runtime parameters
+			HAProxyContext.getInstance().validate();
+            TopologyProvider topologyProvider = new TopologyProvider();
+            HAProxyStatisticsReader statisticsReader = HAProxyContext.getInstance().isCEPStatsPublisherEnabled() ?
+                    new HAProxyStatisticsReader(topologyProvider) : null;
+            extension = new LoadBalancerExtension(new HAProxy(), statisticsReader, topologyProvider);
+			extension.setExecutorService(executorService);
+			extension.execute();
+		} catch (Exception e) {
+			if (log.isErrorEnabled()) {
+				log.error(e);
+			}
+			if (extension != null) {
+                log.info("Shutting haproxy instance...");
+				extension.stop();
+			}
+		}
+	}
+}