Added a constructor for LoadBalancerConfigCommand, and a variable to keep track of a list of destinations.

This commit is contained in:
keshav 2010-12-09 21:28:10 -08:00
parent f48af6ec43
commit d9f5e63f69
2 changed files with 31 additions and 0 deletions

View File

@ -17,6 +17,11 @@
*/
package com.cloud.agent.api.routing;
import java.util.List;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.LoadBalancer.Destination;
/**
* LoadBalancerConfigCommand sends the load balancer configuration
* to the load balancer. Isn't that kinda obvious?
@ -25,8 +30,24 @@ public class LoadBalancerConfigCommand extends RoutingCommand {
String srcIp;
int srcPort;
String protocol;
String algorithm;
boolean revoked;
boolean alreadyAdded;
DestinationTO[] destinations;
public LoadBalancerConfigCommand(String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, List<? extends Destination> destinations) {
this.srcIp = srcIp;
this.srcPort = srcPort;
this.protocol = protocol;
this.algorithm = algorithm;
this.revoked = revoked;
this.alreadyAdded = alreadyAdded;
this.destinations = new DestinationTO[destinations.size()];
int i = 0;
for (Destination destination : destinations) {
this.destinations[i++] = new DestinationTO(destination.getIpAddress(), destination.getDestinationPortStart(), destination.getRevoked(), destination.getAlreadyAdded());
}
}
public String getSrcIp() {
return srcIp;
@ -35,6 +56,10 @@ public class LoadBalancerConfigCommand extends RoutingCommand {
public int getSrcPort() {
return srcPort;
}
public String getAlgorithm() {
return algorithm;
}
public String getProtocol() {
return protocol;
@ -47,6 +72,10 @@ public class LoadBalancerConfigCommand extends RoutingCommand {
public boolean isAlreadyAdded() {
return alreadyAdded;
}
public DestinationTO[] getDestinations() {
return destinations;
}
public class DestinationTO {
String destIp;

View File

@ -40,5 +40,7 @@ public interface LoadBalancer extends FirewallRule {
String getIpAddress();
int getDestinationPortStart();
int getDestinationPortEnd();
boolean getRevoked();
boolean getAlreadyAdded();
}
}