Revert "Support HAProxy for default and static load balancer"

This reverts commit 7e146d29e79fb82528f8c6adb1aed683cc0472ec.


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

Branch: refs/heads/master
Commit: af3663ddfff1add24c7db1c6fa1c47fe226b05c1
Parents: aec171b
Author: Manula Thantriwatte <[email protected]>
Authored: Wed Sep 24 09:27:55 2014 +0000
Committer: Manula Thantriwatte <[email protected]>
Committed: Fri Sep 26 05:00:56 2014 +0000

----------------------------------------------------------------------
 .../src/main/bin/haproxy-extension.sh                 |  1 -
 .../apache/stratos/haproxy/extension/Constants.java   |  1 -
 .../haproxy/extension/HAProxyConfigWriter.java        |  7 +++----
 .../stratos/haproxy/extension/HAProxyContext.java     | 14 ++------------
 .../haproxy-extension/src/main/license/LICENSE        |  1 +
 5 files changed, 6 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/af3663dd/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
----------------------------------------------------------------------
diff --git 
a/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh 
b/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
index f8ed9b3..3f6bc73 100755
--- 
a/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
+++ 
b/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
@@ -40,7 +40,6 @@ properties="-Dhaproxy.private.ip=127.0.0.1
             -Dthrift.receiver.port=7615
             -Dnetwork.partition.id=network-partition-1
             -Dcluster.id=cluster
-            -Dservice.name=service
             -Dcep.stats.publisher.enabled=true"
 
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/af3663dd/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
----------------------------------------------------------------------
diff --git 
a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
 
b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
index d0abeb8..eb88c16 100644
--- 
a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
+++ 
b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
@@ -35,7 +35,6 @@ public class Constants {
     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";
 
     public static final String LOAD_BALANCER = "load.balancer";
     public static final String LOAD_BALANCER_REF = "load.balancer.ref";

http://git-wip-us.apache.org/repos/asf/stratos/blob/af3663dd/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
----------------------------------------------------------------------
diff --git 
a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
 
b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
index f7349d9..10a4c97 100644
--- 
a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
+++ 
b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
@@ -79,7 +79,7 @@ public class HAProxyConfigWriter {
         frontEndHttpsAdded = false;
 
         for (Service service : topology.getServices()) {
-            if 
(service.getServiceName().equals(HAProxyContext.getInstance().getServiceName()))
 {
+            if (service.getServiceName().equals("haproxy")) {
                 for (Cluster cluster : service.getClusters()) {
                     if 
(cluster.getClusterId().equals(HAProxyContext.getInstance().getClusterId())) {
                         if 
((cluster.getProperties().getProperty(Constants.LOAD_BALANCER) != null) && 
(cluster.getProperties().getProperty(Constants.LOAD_BALANCER_REF) != null)) {
@@ -88,8 +88,7 @@ public class HAProxyConfigWriter {
                                 loadBalancedServiceType = 
cluster.getProperties().getProperty(Constants.LB_SERVICE_TYPE);
                             break;
                         } else {
-                            loadBalancerType = Constants.STATIC_LOAD_BALANCER;
-                            log.debug("Static load balancer");
+                            loadBalancerType = 
cluster.getProperties().getProperty(Constants.STATIC_LOAD_BALANCER);
                             break;
                         }
                     }
@@ -102,7 +101,7 @@ public class HAProxyConfigWriter {
                 if 
(cluster.getProperties().getProperty(Constants.LOAD_BALANCER) == null) {
                     if 
((cluster.getProperties().getProperty(Constants.LOAD_BALANCER_REF) != null)) {
                         if 
((cluster.getProperties().getProperty(Constants.LOAD_BALANCER_REF).equals(Constants.NO_LOAD_BALANCER))
 &&
-                                
Constants.STATIC_LOAD_BALANCER.equals(loadBalancerType) && 
cluster.getServiceName().equals(HAProxyContext.getInstance().getLbserviceType()))
  {
+                                
Constants.STATIC_LOAD_BALANCER.equals(loadBalancerType)) {
                             createConfig(service, cluster);
                         } else if 
((cluster.getProperties().getProperty(Constants.LOAD_BALANCER_REF).equals(Constants.DEFAULT_LOAD_BALANCER))
 &&
                                 
Constants.DEFAULT_LOAD_BALANCER.equals(loadBalancerType)) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/af3663dd/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
----------------------------------------------------------------------
diff --git 
a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
 
b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
index 1228b53..f73498a 100644
--- 
a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
+++ 
b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
@@ -42,8 +42,6 @@ public class HAProxyContext {
     private String thriftReceiverPort;
     private String networkPartitionId;
     private String clusterId;
-    private String serviceName;
-    private String lbserviceType;
 
     private HAProxyContext() {
         this.haProxyPrivateIp = 
System.getProperty(Constants.HAPROXY_PRIVATE_IP);
@@ -58,8 +56,6 @@ public class HAProxyContext {
         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);
-        this.lbserviceType = System.getProperty(Constants.LB_SERVICE_TYPE);
 
         if (log.isDebugEnabled()) {
             log.debug(Constants.HAPROXY_PRIVATE_IP + " = " + haProxyPrivateIp);
@@ -99,7 +95,7 @@ public class HAProxyContext {
         validateSystemProperty(Constants.CEP_STATS_PUBLISHER_ENABLED);
         validateSystemProperty(Constants.CLUSTER_ID);
 
-        if (cepStatsPublisherEnabled) {
+        if(cepStatsPublisherEnabled) {
             validateSystemProperty(Constants.THRIFT_RECEIVER_IP);
             validateSystemProperty(Constants.THRIFT_RECEIVER_PORT);
             validateSystemProperty(Constants.NETWORK_PARTITION_ID);
@@ -108,7 +104,7 @@ public class HAProxyContext {
 
     private void validateSystemProperty(String propertyName) {
         String value = System.getProperty(propertyName);
-        if (StringUtils.isEmpty(value)) {
+        if(StringUtils.isEmpty(value)) {
             throw new RuntimeException("System property was not found: " + 
propertyName);
         }
     }
@@ -152,10 +148,4 @@ public class HAProxyContext {
     public String getClusterId() {
         return clusterId;
     }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    public String getLbserviceType() { return  lbserviceType;}
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/af3663dd/extensions/load-balancer/haproxy-extension/src/main/license/LICENSE
----------------------------------------------------------------------
diff --git 
a/extensions/load-balancer/haproxy-extension/src/main/license/LICENSE 
b/extensions/load-balancer/haproxy-extension/src/main/license/LICENSE
index d9da95e..5a78fc9 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/license/LICENSE
+++ b/extensions/load-balancer/haproxy-extension/src/main/license/LICENSE
@@ -457,6 +457,7 @@ slf4j-log4j12-1.7.5.jar
 
 The MIT License (MIT)
 
+Copyright (c) 2004-2013 QOS.ch
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

Reply via email to