Permalink
Browse files

Renamed Rackspace Cloud Load Balanacer domain objects with verb first.

  • Loading branch information...
etoews committed Mar 18, 2013
1 parent 3d6a2a6 commit d8b82401ead29ea7d14f4ef9c65eff3a4ecf0a2a
Showing with 258 additions and 207 deletions.
  1. +12 −12 ...rs/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/domain/{NodeAdd.java → AddNode.java}
  2. +13 −13 ...clouds/rackspace/cloudloadbalancers/v1/domain/{LoadBalancerCreate.java → CreateLoadBalancer.java}
  3. +71 −43 ...clouds/rackspace/cloudloadbalancers/v1/domain/{LoadBalancerUpdate.java → UpdateLoadBalancer.java}
  4. +45 −24 .../main/java/org/jclouds/rackspace/cloudloadbalancers/v1/domain/{NodeUpdate.java → UpdateNode.java}
  5. +4 −4 ...balancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/LoadBalancerApi.java
  6. +6 −6 ...cers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/LoadBalancerAsyncApi.java
  7. +5 −5 ...loudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/NodeApi.java
  8. +5 −5 ...oadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/NodeAsyncApi.java
  9. +6 −6 ...space/cloudloadbalancers/v1/loadbalancer/strategy/CloudLoadBalancersLoadBalanceNodesStrategy.java
  10. +6 −6 ...ers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/AccessRuleApiLiveTest.java
  11. +6 −6 ...ers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ConnectionApiLiveTest.java
  12. +6 −6 ...src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ContentCachingApiLiveTest.java
  13. +6 −6 ...cers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ErrorPageApiLiveTest.java
  14. +6 −6 .../src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/HealthMonitorApiLiveTest.java
  15. +13 −12 ...src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/LoadBalancerApiExpectTest.java
  16. +6 −6 ...s/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/LoadBalancerApiLiveTest.java
  17. +11 −10 ...lancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/NodeApiExpectTest.java
  18. +7 −7 ...balancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/NodeApiLiveTest.java
  19. +6 −6 ...lancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ReportApiLiveTest.java
  20. +6 −6 ...src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SSLTerminationApiLiveTest.java
  21. +6 −6 ...test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SessionPersistenceApiLiveTest.java
  22. +6 −6 ...cers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/VirtualIPApiLiveTest.java
@@ -49,13 +49,13 @@
*
* @author Adrian Cole
*/
-public class NodeAdd extends BaseNode<NodeAdd> {
+public class AddNode extends BaseNode<AddNode> {
// for serialization only
- NodeAdd() {
+ AddNode() {
}
- public NodeAdd(String address, int port, Condition condition, Type type, Integer weight) {
+ public AddNode(String address, int port, Condition condition, Type type, Integer weight) {
super(address, port, condition, type, weight);
}
@@ -79,18 +79,12 @@ public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
- NodeAdd that = NodeAdd.class.cast(obj);
+ AddNode that = AddNode.class.cast(obj);
return Objects.equal(this.address, that.address)
&& Objects.equal(this.port, that.port);
}
- public static class Builder extends BaseNode.Builder<NodeAdd> {
-
- @Override
- public NodeAdd build() {
- return new NodeAdd(address, port, condition, type, weight);
- }
-
+ public static class Builder extends BaseNode.Builder<AddNode> {
/**
* {@inheritDoc}
*/
@@ -130,8 +124,14 @@ public Builder port(int port) {
public Builder weight(Integer weight) {
return Builder.class.cast(super.weight(weight));
}
+
+ @Override
+ public AddNode build() {
+ return new AddNode(address, port, condition, type, weight);
+ }
+
@Override
- public Builder from(NodeAdd in) {
+ public Builder from(AddNode in) {
return Builder.class.cast(super.from(in));
}
}
@@ -37,30 +37,30 @@
*
* @author Adrian Cole
*/
-public class LoadBalancerCreate extends BaseLoadBalancer<NodeAdd, LoadBalancerCreate> {
+public class CreateLoadBalancer extends BaseLoadBalancer<AddNode, CreateLoadBalancer> {
private final Set<Map<String, String>> virtualIps;
private final Set<AccessRule> accessRules;
private final Map<String, String> metadata;
- public LoadBalancerCreate(String name, String protocol, @Nullable Integer port, Set<NodeAdd> nodeAdds,
+ public CreateLoadBalancer(String name, String protocol, @Nullable Integer port, Set<AddNode> addNodes,
@Nullable Algorithm algorithm, @Nullable Integer timeout, @Nullable Boolean halfClosed,
@Nullable Map<String, SessionPersistence> sessionPersistenceType,
@Nullable Map<String, Boolean> connectionLogging, @Nullable ConnectionThrottle connectionThrottle,
@Nullable HealthMonitor healthMonitor, @Nullable Set<AccessRule> accessRules,
@Nullable Map<String, String> metadata, VirtualIP.Type virtualIPType, Integer virtualIPId) {
- this(name, protocol, port, nodeAdds, algorithm, timeout, halfClosed, sessionPersistenceType, connectionLogging,
+ this(name, protocol, port, addNodes, algorithm, timeout, halfClosed, sessionPersistenceType, connectionLogging,
connectionThrottle, healthMonitor, accessRules, metadata,
getVirtualIPsFromOptions(virtualIPType, virtualIPId));
}
- public LoadBalancerCreate(String name, String protocol, @Nullable Integer port, Set<NodeAdd> nodeAdds,
+ public CreateLoadBalancer(String name, String protocol, @Nullable Integer port, Set<AddNode> addNodes,
@Nullable Algorithm algorithm, @Nullable Integer timeout, @Nullable Boolean halfClosed,
@Nullable Map<String, SessionPersistence> sessionPersistenceType,
@Nullable Map<String, Boolean> connectionLogging, @Nullable ConnectionThrottle connectionThrottle,
@Nullable HealthMonitor healthMonitor, @Nullable Set<AccessRule> accessRules,
@Nullable Map<String, String> metadata, Set<Map<String, String>> virtualIPsFromOptions) {
- super(name, protocol, port, nodeAdds, algorithm, timeout, halfClosed, sessionPersistenceType, connectionLogging,
+ super(name, protocol, port, addNodes, algorithm, timeout, halfClosed, sessionPersistenceType, connectionLogging,
connectionThrottle, healthMonitor);
this.virtualIps = checkNotNull(virtualIPsFromOptions, "virtualIPsFromOptions");
this.accessRules = accessRules;
@@ -100,7 +100,7 @@ public String toString() {
return string().toString();
}
- public static class Builder extends BaseLoadBalancer.Builder<NodeAdd, LoadBalancerCreate> {
+ public static class Builder extends BaseLoadBalancer.Builder<AddNode, CreateLoadBalancer> {
private VirtualIP.Type virtualIPType;
private Integer virtualIPId;
private Set<Map<String, String>> virtualIps;
@@ -150,14 +150,14 @@ public Builder metadata(Map<String, String> metadata) {
return this;
}
- public LoadBalancerCreate build() {
+ public CreateLoadBalancer build() {
if (virtualIps == null) {
- return new LoadBalancerCreate(name, protocol, port, nodes, algorithm, timeout, halfClosed,
+ return new CreateLoadBalancer(name, protocol, port, nodes, algorithm, timeout, halfClosed,
sessionPersistence, connectionLogging, connectionThrottle, healthMonitor, accessRules, metadata,
virtualIPType, virtualIPId);
}
else {
- return new LoadBalancerCreate(name, protocol, port, nodes, algorithm, timeout, halfClosed,
+ return new CreateLoadBalancer(name, protocol, port, nodes, algorithm, timeout, halfClosed,
sessionPersistence, connectionLogging, connectionThrottle, healthMonitor, accessRules, metadata,
virtualIps);
}
@@ -167,16 +167,16 @@ public LoadBalancerCreate build() {
* {@inheritDoc}
*/
@Override
- public Builder nodes(Iterable<NodeAdd> nodeAdds) {
- this.nodes = ImmutableSet.<NodeAdd> copyOf(checkNotNull(nodeAdds, "nodes"));
+ public Builder nodes(Iterable<AddNode> addNodes) {
+ this.nodes = ImmutableSet.<AddNode> copyOf(checkNotNull(addNodes, "nodes"));
return this;
}
/**
* {@inheritDoc}
*/
@Override
- public Builder node(NodeAdd nodes) {
+ public Builder node(AddNode nodes) {
this.nodes.add(checkNotNull(nodes, "nodes"));
return this;
}
@@ -217,7 +217,7 @@ public Builder protocol(String protocol) {
* {@inheritDoc}
*/
@Override
- public Builder from(LoadBalancerCreate in) {
+ public Builder from(CreateLoadBalancer in) {
return Builder.class.cast(super.from(in)).virtualIPs(in.virtualIps);
}
}
@@ -27,45 +27,48 @@
/**
* Used to update Load Balancers.
*
- * @author Adrian Cole
+ * @author Everett Toews
*/
-public class LoadBalancerUpdate {
-
- protected String name;
- protected String protocol;
- protected Integer port;
- protected Algorithm algorithm;
- protected Integer timeout;
- protected Boolean halfClosed;
-
- public LoadBalancerUpdate name(String name) {
+public class UpdateLoadBalancer {
+ private String name;
+ private String protocol;
+ private Integer port;
+ private Algorithm algorithm;
+ private Integer timeout;
+ private Boolean halfClosed;
+
+ protected UpdateLoadBalancer(String name, String protocol, Integer port, Algorithm algorithm, Integer timeout,
+ Boolean halfClosed) {
this.name = name;
- return this;
+ this.protocol = protocol;
+ this.port = port;
+ this.algorithm = algorithm;
+ this.timeout = timeout;
+ this.halfClosed = halfClosed;
}
- public LoadBalancerUpdate protocol(String protocol) {
- this.protocol = protocol;
- return this;
+ public String getName() {
+ return name;
}
- public LoadBalancerUpdate port(Integer port) {
- this.port = port;
- return this;
+ public String getProtocol() {
+ return protocol;
}
- public LoadBalancerUpdate algorithm(Algorithm algorithm) {
- this.algorithm = algorithm;
- return this;
+ public Integer getPort() {
+ return port;
}
- public LoadBalancerUpdate timeout(Integer timeout) {
- this.timeout = timeout;
- return this;
+ public Algorithm getAlgorithm() {
+ return algorithm;
}
- public LoadBalancerUpdate halfClosed(Boolean halfClosed) {
- this.halfClosed = halfClosed;
- return this;
+ public Integer getTimeout() {
+ return timeout;
+ }
+
+ public Boolean isHalfClosed() {
+ return halfClosed;
}
protected ToStringHelper string() {
@@ -90,58 +93,83 @@ public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass())
return false;
- LoadBalancerUpdate that = LoadBalancerUpdate.class.cast(obj);
+ UpdateLoadBalancer that = UpdateLoadBalancer.class.cast(obj);
return Objects.equal(this.name, that.name) && Objects.equal(this.algorithm, that.algorithm)
&& Objects.equal(this.port, that.port) && Objects.equal(this.protocol, that.protocol)
&& Objects.equal(this.timeout, that.timeout) && Objects.equal(this.halfClosed, that.halfClosed);
}
public static class Builder {
+ private String name;
+ private String protocol;
+ private Integer port;
+ private Algorithm algorithm;
+ private Integer timeout;
+ private Boolean halfClosed;
+
/**
* @see BaseLoadBalancer.Builder#name(String)
*/
- public static LoadBalancerUpdate name(String name) {
- return new LoadBalancerUpdate().name(name);
+ public Builder name(String name) {
+ this.name = name;
+ return this;
}
/**
* @see BaseLoadBalancer.Builder#protocol(String)
*/
- public static LoadBalancerUpdate protocol(String protocol) {
- return new LoadBalancerUpdate().protocol(protocol);
+ public Builder protocol(String protocol) {
+ this.protocol = protocol;
+ return this;
}
/**
* @see BaseLoadBalancer.Builder#port(Integer)
*/
- public static LoadBalancerUpdate port(Integer port) {
- return new LoadBalancerUpdate().port(port);
+ public Builder port(Integer port) {
+ this.port = port;
+ return this;
}
/**
* @see BaseLoadBalancer.Builder#algorithm(Algorithm)
*/
- public static LoadBalancerUpdate algorithm(Algorithm algorithm) {
- return new LoadBalancerUpdate().algorithm(algorithm);
+ public Builder algorithm(Algorithm algorithm) {
+ this.algorithm = algorithm;
+ return this;
}
/**
* @see BaseLoadBalancer.Builder#timeout(Integer)
*/
- public static LoadBalancerUpdate timeout(Integer timeout) {
- return new LoadBalancerUpdate().timeout(timeout);
+ public Builder timeout(Integer timeout) {
+ this.timeout = timeout;
+ return this;
}
/**
* @see BaseLoadBalancer.Builder#halfClosed(Boolean)
*/
- public static LoadBalancerUpdate halfClosed(Boolean halfClosed) {
- return new LoadBalancerUpdate().halfClosed(halfClosed);
+ public Builder halfClosed(Boolean halfClosed) {
+ this.halfClosed = halfClosed;
+ return this;
}
+
+ public UpdateLoadBalancer build() {
+ return new UpdateLoadBalancer(name, protocol, port, algorithm, timeout, halfClosed);
+ }
+
+ public Builder from(UpdateLoadBalancer lb) {
+ return this.name(lb.getName()).port(lb.getPort()).protocol(lb.getProtocol()).algorithm(lb.getAlgorithm())
+ .timeout(lb.getTimeout()).halfClosed(lb.isHalfClosed());
+ }
+ }
+
+ public static Builder builder() {
+ return new Builder();
}
- public static <T extends BaseLoadBalancer<?, T>> LoadBalancerUpdate fromLoadBalancer(T lb) {
- return Builder.name(lb.getName()).port(lb.getPort()).protocol(lb.getProtocol()).algorithm(lb.getAlgorithm())
- .timeout(lb.getTimeout()).halfClosed(lb.isHalfClosed());
+ public Builder toBuilder() {
+ return new Builder().from(this);
}
}
Oops, something went wrong.

0 comments on commit d8b8240

Please sign in to comment.