cloudstack: removing unnecessary (and in some cases misleading Named annotations). Also removing CloudstackParserModule - handling deserialization in constructors marked with ConstructorProperties annotation

This commit is contained in:
Adam Lowe 2012-07-05 12:50:03 +01:00 committed by Adrian Cole
parent bb5d9b4577
commit ea901e3f7a
69 changed files with 1973 additions and 2776 deletions

View File

@ -1,296 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.cloudstack.config;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import javax.inject.Singleton;
import org.jclouds.cloudstack.domain.Account;
import org.jclouds.cloudstack.domain.FirewallRule;
import org.jclouds.cloudstack.domain.LoadBalancerRule;
import org.jclouds.cloudstack.domain.PortForwardingRule;
import org.jclouds.cloudstack.domain.User;
import org.jclouds.cloudstack.domain.Account.State;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.annotations.SerializedName;
import com.google.inject.AbstractModule;
import com.google.inject.TypeLiteral;
/**
* Configures the cloudstack parsers.
*
* @author Adrian Cole, Andrei Savu
*/
public class CloudStackParserModule extends AbstractModule {
@Singleton
public static class PortForwardingRuleAdapter implements JsonSerializer<PortForwardingRule>, JsonDeserializer<PortForwardingRule> {
public JsonElement serialize(PortForwardingRule src, Type typeOfSrc, JsonSerializationContext context) {
return context.serialize(src);
}
public PortForwardingRule deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return apply(context.<PortForwardingRuleInternal>deserialize(json, PortForwardingRuleInternal.class));
}
public PortForwardingRule apply(PortForwardingRuleInternal in) {
Set<String> cidrSet;
if (in.CIDRs != null) {
String[] elements = in.CIDRs.split(",");
cidrSet = Sets.newTreeSet(Arrays.asList(elements));
} else {
cidrSet = Collections.emptySet();
}
return PortForwardingRule.builder().id(in.id).IPAddress(in.IPAddress).IPAddressId(in.IPAddressId)
.privatePort(in.privatePort).protocol(in.protocol).publicPort(in.publicPort).state(in.state)
.virtualMachineDisplayName(in.virtualMachineDisplayName).virtualMachineId(in.virtualMachineId)
.virtualMachineName(in.virtualMachineName).CIDRs(cidrSet).privateEndPort(in.privateEndPort)
.publicEndPort(in.publicEndPort).build();
}
static final class PortForwardingRuleInternal {
private String id;
@SerializedName("ipaddress")
private String IPAddress;
@SerializedName("ipaddressid")
private String IPAddressId;
@SerializedName("privateport")
private int privatePort;
private PortForwardingRule.Protocol protocol;
@SerializedName("publicport")
public int publicPort;
private PortForwardingRule.State state;
@SerializedName("virtualmachinedisplayname")
private String virtualMachineDisplayName;
@SerializedName("virtualmachineid")
public String virtualMachineId;
@SerializedName("virtualmachinename")
private String virtualMachineName;
@SerializedName("cidrlist")
private String CIDRs;
@SerializedName("privateendport")
private int privateEndPort;
@SerializedName("publicendport")
private int publicEndPort;
}
}
@Singleton
public static class FirewallRuleAdapter implements JsonSerializer<FirewallRule>, JsonDeserializer<FirewallRule> {
public JsonElement serialize(FirewallRule src, Type typeOfSrc, JsonSerializationContext context) {
return context.serialize(src);
}
public FirewallRule deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return apply(context.<FirewallRuleInternal>deserialize(json, FirewallRuleInternal.class));
}
public FirewallRule apply(FirewallRuleInternal in) {
Set<String> cidrSet;
if (in.CIDRs != null) {
String[] elements = in.CIDRs.split(",");
cidrSet = Sets.newTreeSet(Arrays.asList(elements));
} else {
cidrSet = Collections.emptySet();
}
return FirewallRule.builder().id(in.id).CIDRs(cidrSet).startPort(in.startPort).endPort(in.endPort)
.icmpCode(in.icmpCode).icmpType(in.icmpType).ipAddress(in.ipAddress).ipAddressId(in.ipAddressId)
.protocol(in.protocol).state(in.state).build();
}
static final class FirewallRuleInternal {
private String id;
@SerializedName("cidrlist")
private String CIDRs;
@SerializedName("startport")
private int startPort;
@SerializedName("endport")
private int endPort;
@SerializedName("icmpcode")
private String icmpCode;
@SerializedName("icmptype")
private String icmpType;
@SerializedName("ipaddress")
private String ipAddress;
@SerializedName("ipaddressid")
private String ipAddressId;
private FirewallRule.Protocol protocol;
private FirewallRule.State state;
}
}
@Singleton
public static class LoadBalancerRuleAdapter implements JsonSerializer<LoadBalancerRule>, JsonDeserializer<LoadBalancerRule> {
public JsonElement serialize(LoadBalancerRule src, Type typeOfSrc, JsonSerializationContext context) {
return context.serialize(src);
}
public LoadBalancerRule deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return apply(context.<LoadBalancerRuleInternal>deserialize(json, LoadBalancerRuleInternal.class));
}
public LoadBalancerRule apply(LoadBalancerRuleInternal in) {
Set<String> cidrSet = Sets.newHashSet(in.CIDRs.split(","));
return LoadBalancerRule.builder().id(in.id).account(in.account).algorithm(in.algorithm)
.description(in.description).domain(in.domain).domainId(in.domainId).name(in.name)
.privatePort(in.privatePort).publicIP(in.publicIP).publicIPId(in.publicIPId)
.publicPort(in.publicPort).state(in.state).CIDRs(cidrSet).zoneId(in.zoneId).build();
}
static final class LoadBalancerRuleInternal {
private String id;
private String account;
private LoadBalancerRule.Algorithm algorithm;
private String description;
private String domain;
@SerializedName("domainid")
private String domainId;
private String name;
@SerializedName("privateport")
private int privatePort;
@SerializedName("publicip")
private String publicIP;
@SerializedName("publicipid")
private String publicIPId;
@SerializedName("publicport")
private int publicPort;
private LoadBalancerRule.State state;
@SerializedName("cidrlist")
private String CIDRs;
@SerializedName("zoneId")
private String zoneId;
}
}
@Singleton
public static class BreakGenericSetAdapter implements JsonSerializer<Account>, JsonDeserializer<Account> {
public JsonElement serialize(Account src, Type typeOfSrc, JsonSerializationContext context) {
return context.serialize(src);
}
public Account deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return apply(context.<AccountInternal>deserialize(json, AccountInternal.class));
}
public Account apply(AccountInternal in) {
return Account.builder().id(in.id).type(in.type).domain(in.domain).domainId(in.domainId)
.IPsAvailable(nullIfUnlimited(in.IPsAvailable)).IPLimit(nullIfUnlimited(in.IPLimit)).IPs(in.IPs)
.cleanupRequired(in.cleanupRequired).name(in.name).receivedBytes(in.receivedBytes)
.sentBytes(in.sentBytes).snapshotsAvailable(nullIfUnlimited(in.snapshotsAvailable))
.snapshotLimit(nullIfUnlimited(in.snapshotLimit)).snapshots(in.snapshots).state(in.state)
.templatesAvailable(nullIfUnlimited(in.templatesAvailable))
.templateLimit(nullIfUnlimited(in.templateLimit)).templates(in.templates)
.VMsAvailable(nullIfUnlimited(in.VMsAvailable)).VMLimit(nullIfUnlimited(in.VMLimit))
.VMsRunning(in.VMsRunning).VMsStopped(in.VMsStopped).VMs(in.VMs)
.volumesAvailable(nullIfUnlimited(in.volumesAvailable)).volumeLimit(nullIfUnlimited(in.volumeLimit))
.volumes(in.volumes).users(in.users).build();
}
static final class AccountInternal {
private String id;
@SerializedName("accounttype")
private Account.Type type;
private String domain;
@SerializedName("domainid")
private String domainId;
@SerializedName("ipavailable")
private String IPsAvailable;
@SerializedName("iplimit")
private String IPLimit;
@SerializedName("iptotal")
private long IPs;
@SerializedName("iscleanuprequired")
private boolean cleanupRequired;
private String name;
@SerializedName("receivedbytes")
private long receivedBytes;
@SerializedName("sentbytes")
private long sentBytes;
@SerializedName("snapshotavailable")
private String snapshotsAvailable;
@SerializedName("snapshotlimit")
private String snapshotLimit;
@SerializedName("snapshottotal")
private long snapshots;
@SerializedName("state")
private State state;
@SerializedName("templateavailable")
private String templatesAvailable;
@SerializedName("templatelimit")
private String templateLimit;
@SerializedName("templatetotal")
private long templates;
@SerializedName("vmavailable")
private String VMsAvailable;
@SerializedName("vmlimit")
private String VMLimit;
@SerializedName("vmrunning")
private long VMsRunning;
@SerializedName("vmstopped")
private long VMsStopped;
@SerializedName("vmtotal")
private long VMs;
@SerializedName("volumeavailable")
private String volumesAvailable;
@SerializedName("volumelimit")
private String volumeLimit;
@SerializedName("volumetotal")
private long volumes;
@SerializedName("user")
private Set<User> users;
}
private static Long nullIfUnlimited(String in) {
return in == null || "Unlimited".equals(in) ? null : new Long(in);
}
}
@Override
protected void configure() {
bind(new TypeLiteral<Map<Type, Object>>() {
}).toInstance(ImmutableMap.<Type, Object>of(
Account.class, new BreakGenericSetAdapter(),
LoadBalancerRule.class, new LoadBalancerRuleAdapter(),
PortForwardingRule.class, new PortForwardingRuleAdapter(),
FirewallRule.class, new FirewallRuleAdapter()
));
}
}

View File

@ -33,86 +33,7 @@ import org.jclouds.cloudstack.CloudStackDomainClient;
import org.jclouds.cloudstack.CloudStackGlobalAsyncClient; import org.jclouds.cloudstack.CloudStackGlobalAsyncClient;
import org.jclouds.cloudstack.CloudStackGlobalClient; import org.jclouds.cloudstack.CloudStackGlobalClient;
import org.jclouds.cloudstack.domain.LoginResponse; import org.jclouds.cloudstack.domain.LoginResponse;
import org.jclouds.cloudstack.features.AccountAsyncClient; import org.jclouds.cloudstack.features.*;
import org.jclouds.cloudstack.features.AccountClient;
import org.jclouds.cloudstack.features.AddressAsyncClient;
import org.jclouds.cloudstack.features.AddressClient;
import org.jclouds.cloudstack.features.AsyncJobAsyncClient;
import org.jclouds.cloudstack.features.AsyncJobClient;
import org.jclouds.cloudstack.features.ConfigurationAsyncClient;
import org.jclouds.cloudstack.features.ConfigurationClient;
import org.jclouds.cloudstack.features.DomainAccountAsyncClient;
import org.jclouds.cloudstack.features.DomainAccountClient;
import org.jclouds.cloudstack.features.DomainDomainAsyncClient;
import org.jclouds.cloudstack.features.DomainDomainClient;
import org.jclouds.cloudstack.features.DomainLimitAsyncClient;
import org.jclouds.cloudstack.features.DomainLimitClient;
import org.jclouds.cloudstack.features.DomainUserAsyncClient;
import org.jclouds.cloudstack.features.DomainUserClient;
import org.jclouds.cloudstack.features.EventAsyncClient;
import org.jclouds.cloudstack.features.EventClient;
import org.jclouds.cloudstack.features.FirewallAsyncClient;
import org.jclouds.cloudstack.features.FirewallClient;
import org.jclouds.cloudstack.features.GlobalAccountAsyncClient;
import org.jclouds.cloudstack.features.GlobalAccountClient;
import org.jclouds.cloudstack.features.GlobalAlertAsyncClient;
import org.jclouds.cloudstack.features.GlobalAlertClient;
import org.jclouds.cloudstack.features.GlobalCapacityAsyncClient;
import org.jclouds.cloudstack.features.GlobalCapacityClient;
import org.jclouds.cloudstack.features.GlobalConfigurationAsyncClient;
import org.jclouds.cloudstack.features.GlobalConfigurationClient;
import org.jclouds.cloudstack.features.GlobalDomainAsyncClient;
import org.jclouds.cloudstack.features.GlobalDomainClient;
import org.jclouds.cloudstack.features.GlobalHostAsyncClient;
import org.jclouds.cloudstack.features.GlobalHostClient;
import org.jclouds.cloudstack.features.GlobalOfferingAsyncClient;
import org.jclouds.cloudstack.features.GlobalOfferingClient;
import org.jclouds.cloudstack.features.GlobalPodAsyncClient;
import org.jclouds.cloudstack.features.GlobalPodClient;
import org.jclouds.cloudstack.features.GlobalStoragePoolAsyncClient;
import org.jclouds.cloudstack.features.GlobalStoragePoolClient;
import org.jclouds.cloudstack.features.GlobalUsageAsyncClient;
import org.jclouds.cloudstack.features.GlobalUsageClient;
import org.jclouds.cloudstack.features.GlobalUserAsyncClient;
import org.jclouds.cloudstack.features.GlobalUserClient;
import org.jclouds.cloudstack.features.GlobalVlanAsyncClient;
import org.jclouds.cloudstack.features.GlobalVlanClient;
import org.jclouds.cloudstack.features.GlobalZoneAsyncClient;
import org.jclouds.cloudstack.features.GlobalZoneClient;
import org.jclouds.cloudstack.features.GuestOSAsyncClient;
import org.jclouds.cloudstack.features.GuestOSClient;
import org.jclouds.cloudstack.features.HypervisorAsyncClient;
import org.jclouds.cloudstack.features.HypervisorClient;
import org.jclouds.cloudstack.features.ISOAsyncClient;
import org.jclouds.cloudstack.features.ISOClient;
import org.jclouds.cloudstack.features.LimitAsyncClient;
import org.jclouds.cloudstack.features.LimitClient;
import org.jclouds.cloudstack.features.LoadBalancerAsyncClient;
import org.jclouds.cloudstack.features.LoadBalancerClient;
import org.jclouds.cloudstack.features.NATAsyncClient;
import org.jclouds.cloudstack.features.NATClient;
import org.jclouds.cloudstack.features.NetworkAsyncClient;
import org.jclouds.cloudstack.features.NetworkClient;
import org.jclouds.cloudstack.features.OfferingAsyncClient;
import org.jclouds.cloudstack.features.OfferingClient;
import org.jclouds.cloudstack.features.SSHKeyPairAsyncClient;
import org.jclouds.cloudstack.features.SSHKeyPairClient;
import org.jclouds.cloudstack.features.SecurityGroupAsyncClient;
import org.jclouds.cloudstack.features.SecurityGroupClient;
import org.jclouds.cloudstack.features.SessionAsyncClient;
import org.jclouds.cloudstack.features.SessionClient;
import org.jclouds.cloudstack.features.SnapshotAsyncClient;
import org.jclouds.cloudstack.features.SnapshotClient;
import org.jclouds.cloudstack.features.TemplateAsyncClient;
import org.jclouds.cloudstack.features.TemplateClient;
import org.jclouds.cloudstack.features.VMGroupAsyncClient;
import org.jclouds.cloudstack.features.VMGroupClient;
import org.jclouds.cloudstack.features.VirtualMachineAsyncClient;
import org.jclouds.cloudstack.features.VirtualMachineClient;
import org.jclouds.cloudstack.features.VolumeAsyncClient;
import org.jclouds.cloudstack.features.VolumeClient;
import org.jclouds.cloudstack.features.ZoneAsyncClient;
import org.jclouds.cloudstack.features.ZoneClient;
import org.jclouds.cloudstack.filters.AddSessionKeyAndJSessionIdToRequest; import org.jclouds.cloudstack.filters.AddSessionKeyAndJSessionIdToRequest;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.filters.QuerySigner; import org.jclouds.cloudstack.filters.QuerySigner;
@ -233,7 +154,6 @@ public class CloudStackRestClientModule extends RestClientModule<CloudStackClien
bind(new TypeLiteral<RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient>>() { bind(new TypeLiteral<RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient>>() {
}).to(new TypeLiteral<RestContextImpl<CloudStackGlobalClient, CloudStackGlobalAsyncClient>>() { }).to(new TypeLiteral<RestContextImpl<CloudStackGlobalClient, CloudStackGlobalAsyncClient>>() {
}); });
install(new CloudStackParserModule());
bind(CredentialType.class).toProvider(CredentialTypeFromPropertyOrDefault.class); bind(CredentialType.class).toProvider(CredentialTypeFromPropertyOrDefault.class);
// session client is used directly for filters and retry handlers, so let's bind it explicitly // session client is used directly for filters and retry handlers, so let's bind it explicitly

View File

@ -24,8 +24,6 @@ import java.beans.ConstructorProperties;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -119,7 +117,7 @@ public class Account extends ForwardingSet<User> {
return new ConcreteBuilder().fromAccount(this); return new ConcreteBuilder().fromAccount(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -424,58 +422,60 @@ public class Account extends ForwardingSet<User> {
} }
private final String id; private final String id;
@Named("accounttype")
private final Account.Type type; private final Account.Type type;
@Named("networkdomain")
private final String networkDomain; private final String networkDomain;
private final String domain; private final String domain;
private final String domainId; private final String domainId;
@Named("ipsavailable")
private final Long IPsAvailable; private final Long IPsAvailable;
@Named("iplimit")
private final Long IPLimit; private final Long IPLimit;
@Named("iptotal")
private final long IPs; private final long IPs;
@Named("iscleanuprequired")
private final boolean cleanupRequired; private final boolean cleanupRequired;
private final String name; private final String name;
@Named("receivedbytes")
private final long receivedBytes; private final long receivedBytes;
@Named("sentbytes")
private final long sentBytes; private final long sentBytes;
@Named("snapshotavailable")
private final Long snapshotsAvailable; private final Long snapshotsAvailable;
private final Long snapshotLimit; private final Long snapshotLimit;
@Named("snapshottotal")
private final long snapshots; private final long snapshots;
private final Account.State state; private final Account.State state;
@Named("templateavailable")
private final Long templatesAvailable; private final Long templatesAvailable;
@Named("templatelimit")
private final Long templateLimit; private final Long templateLimit;
@Named("templatetotal")
private final long templates; private final long templates;
@Named("vmavailable")
private final Long VMsAvailable; private final Long VMsAvailable;
@Named("vmlimit")
private final Long VMLimit; private final Long VMLimit;
@Named("vmrunning")
private final long VMsRunning; private final long VMsRunning;
@Named("vmstopped")
private final long VMsStopped; private final long VMsStopped;
@Named("vmtotal")
private final long VMs; private final long VMs;
@Named("volumeavailable")
private final Long volumesAvailable; private final Long volumesAvailable;
@Named("volumelimit")
private final Long volumeLimit; private final Long volumeLimit;
@Named("volumetotal")
private final long volumes; private final long volumes;
private final Set<User> users; private final Set<User> users;
@ConstructorProperties({ @ConstructorProperties({
"id", "accounttype", "networkdomain", "domain", "domainId", "ipsavailable", "iplimit", "iptotal", "iscleanuprequired", "name", "receivedbytes", "sentbytes", "snapshotavailable", "snapshotLimit", "snapshottotal", "state", "templateavailable", "templatelimit", "templatetotal", "vmavailable", "vmlimit", "vmrunning", "vmstopped", "vmtotal", "volumeavailable", "volumelimit", "volumetotal", "users" "id", "accounttype", "networkdomain", "domain", "domainid", "ipavailable", "iplimit", "iptotal", "iscleanuprequired",
"name", "receivedbytes", "sentbytes", "snapshotavailable", "snapshotlimit", "snapshottotal", "state", "templateavailable",
"templatelimit", "templatetotal", "vmavailable", "vmlimit", "vmrunning", "vmstopped", "vmtotal", "volumeavailable", "volumelimit",
"volumetotal", "user"
}) })
@SuppressWarnings("unused")
private Account(String id, @Nullable Type type, @Nullable String networkDomain, @Nullable String domain,
@Nullable String domainId, @Nullable String IPsAvailable, @Nullable String IPLimit, long IPs,
boolean cleanupRequired, @Nullable String name, long receivedBytes, long sentBytes,
@Nullable String snapshotsAvailable, @Nullable String snapshotLimit, long snapshots,
@Nullable State state, @Nullable String templatesAvailable, @Nullable String templateLimit,
long templates, @Nullable String VMsAvailable, @Nullable String VMLimit, long VMsRunning,
long VMsStopped, long VMs, @Nullable String volumesAvailable, @Nullable String volumeLimit,
long volumes, @Nullable Set<User> users) {
this(id, type, networkDomain, domain, domainId, toLongNullIfUnlimited(IPsAvailable), toLongNullIfUnlimited(IPLimit), IPs,
cleanupRequired, name, receivedBytes, sentBytes, toLongNullIfUnlimited(snapshotsAvailable), toLongNullIfUnlimited(snapshotLimit),
snapshots, state, toLongNullIfUnlimited(templatesAvailable), toLongNullIfUnlimited(templateLimit), templates,
toLongNullIfUnlimited(VMsAvailable), toLongNullIfUnlimited(VMLimit), VMsRunning, VMsStopped, VMs,
toLongNullIfUnlimited(volumesAvailable), toLongNullIfUnlimited(volumeLimit), volumes, users);
}
private static Long toLongNullIfUnlimited(String in) {
return in == null || "Unlimited".equals(in) ? null : new Long(in);
}
protected Account(String id, @Nullable Account.Type type, @Nullable String networkDomain, @Nullable String domain, protected Account(String id, @Nullable Account.Type type, @Nullable String networkDomain, @Nullable String domain,
@Nullable String domainId, @Nullable Long IPsAvailable, @Nullable Long IPLimit, long IPs, @Nullable String domainId, @Nullable Long IPsAvailable, @Nullable Long IPLimit, long IPs,
boolean cleanupRequired, @Nullable String name, long receivedBytes, long sentBytes, @Nullable Long snapshotsAvailable, boolean cleanupRequired, @Nullable String name, long receivedBytes, long sentBytes, @Nullable Long snapshotsAvailable,
@ -554,7 +554,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total number of public ip addresses available for this account * @return the total number of public ip addresses available for this account
to acquire, or null if unlimited * to acquire, or null if unlimited
*/ */
@Nullable @Nullable
public Long getIPsAvailable() { public Long getIPsAvailable() {
@ -563,7 +563,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total number of public ip addresses this account can acquire, * @return the total number of public ip addresses this account can acquire,
or null if unlimited * or null if unlimited
*/ */
@Nullable @Nullable
public Long getIPLimit() { public Long getIPLimit() {
@ -608,7 +608,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total number of snapshots available for this account, or null * @return the total number of snapshots available for this account, or null
if unlimited * if unlimited
*/ */
@Nullable @Nullable
public Long getSnapshotsAvailable() { public Long getSnapshotsAvailable() {
@ -617,7 +617,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total number of snapshots which can be stored by this account, * @return the total number of snapshots which can be stored by this account,
or null if unlimited * or null if unlimited
*/ */
@Nullable @Nullable
public Long getSnapshotLimit() { public Long getSnapshotLimit() {
@ -641,7 +641,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total number of templates available to be created by this * @return the total number of templates available to be created by this
account, or null if unlimited * account, or null if unlimited
*/ */
@Nullable @Nullable
public Long getTemplatesAvailable() { public Long getTemplatesAvailable() {
@ -650,7 +650,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total number of templates which can be created by this * @return the total number of templates which can be created by this
account, or null if unlimited * account, or null if unlimited
*/ */
@Nullable @Nullable
public Long getTemplateLimit() { public Long getTemplateLimit() {
@ -659,7 +659,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total number of templates which have been created by this * @return the total number of templates which have been created by this
account * account
*/ */
public long getTemplates() { public long getTemplates() {
return this.templates; return this.templates;
@ -667,7 +667,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total number of virtual machines available for this account to * @return the total number of virtual machines available for this account to
acquire, or null if unlimited * acquire, or null if unlimited
*/ */
@Nullable @Nullable
public Long getVMsAvailable() { public Long getVMsAvailable() {
@ -676,7 +676,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total number of virtual machines that can be deployed by this * @return the total number of virtual machines that can be deployed by this
account, or null if unlimited * account, or null if unlimited
*/ */
@Nullable @Nullable
public Long getVMLimit() { public Long getVMLimit() {
@ -714,7 +714,7 @@ public class Account extends ForwardingSet<User> {
/** /**
* @return the total volume which can be used by this account, or null if * @return the total volume which can be used by this account, or null if
unlimited * unlimited
*/ */
@Nullable @Nullable
public Long getVolumeLimit() { public Long getVolumeLimit() {

View File

@ -43,7 +43,7 @@ public class Alert {
return new ConcreteBuilder().fromAlert(this); return new ConcreteBuilder().fromAlert(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;

View File

@ -30,7 +30,7 @@ public enum AllocationState {
UNKNOWN; UNKNOWN;
public static AllocationState fromValue(String value) { public static AllocationState fromValue(String value) {
try{ try {
return valueOf(value.toUpperCase()); return valueOf(value.toUpperCase());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNKNOWN; return UNKNOWN;

View File

@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -42,7 +40,7 @@ public class ApiKeyPair {
return new ConcreteBuilder().fromApiKeyPair(this); return new ConcreteBuilder().fromApiKeyPair(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String apiKey; protected String apiKey;
@ -82,9 +80,7 @@ public class ApiKeyPair {
} }
} }
@Named("apikey")
private final String apiKey; private final String apiKey;
@Named("secretkey")
private final String secretKey; private final String secretKey;
@ConstructorProperties({ @ConstructorProperties({

View File

@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -43,7 +41,7 @@ public class AsyncCreateResponse {
return new ConcreteBuilder().fromAsyncCreateResponse(this); return new ConcreteBuilder().fromAsyncCreateResponse(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -84,7 +82,6 @@ public class AsyncCreateResponse {
} }
private final String id; private final String id;
@Named("jobid")
private final String jobId; private final String jobId;
@ConstructorProperties({ @ConstructorProperties({

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -41,9 +39,9 @@ public class AsyncJob<S> {
* Valid job result codes * Valid job result codes
*/ */
public static enum ResultCode { public static enum ResultCode {
SUCCESS (0), SUCCESS(0),
FAIL (530), FAIL(530),
UNKNOWN (-1); UNKNOWN(-1);
private final int code; private final int code;
@ -51,7 +49,9 @@ public class AsyncJob<S> {
this.code = code; this.code = code;
} }
public int code() { return this.code; } public int code() {
return this.code;
}
public static ResultCode fromValue(String value) { public static ResultCode fromValue(String value) {
try { try {
@ -64,7 +64,7 @@ public class AsyncJob<S> {
default: default:
return UNKNOWN; return UNKNOWN;
} }
} catch(NumberFormatException e) { } catch (NumberFormatException e) {
return UNKNOWN; return UNKNOWN;
} }
} }
@ -74,10 +74,10 @@ public class AsyncJob<S> {
* Valid async job statuses * Valid async job statuses
*/ */
public static enum Status { public static enum Status {
IN_PROGRESS (0), IN_PROGRESS(0),
SUCCEEDED (1), SUCCEEDED(1),
FAILED (2), FAILED(2),
UNKNOWN (-1); UNKNOWN(-1);
private final int code; private final int code;
@ -85,7 +85,9 @@ public class AsyncJob<S> {
this.code = code; this.code = code;
} }
public int code() { return this.code; } public int code() {
return this.code;
}
public static Status fromValue(String value) { public static Status fromValue(String value) {
try { try {
@ -106,7 +108,7 @@ public class AsyncJob<S> {
} }
} }
public static <T> Builder<?,T> builder() { public static <T> Builder<?, T> builder() {
return new ConcreteBuilder<T>(); return new ConcreteBuilder<T>();
} }
@ -114,7 +116,7 @@ public class AsyncJob<S> {
return new ConcreteBuilder<S>().fromAsyncJob(this); return new ConcreteBuilder<S>().fromAsyncJob(this);
} }
public static abstract class Builder<T extends Builder<T,S>, S> { public static abstract class Builder<T extends Builder<T, S>, S> {
protected abstract T self(); protected abstract T self();
protected String accountId; protected String accountId;
@ -262,34 +264,24 @@ public class AsyncJob<S> {
} }
} }
private static class ConcreteBuilder<T> extends Builder<ConcreteBuilder<T>,T> { private static class ConcreteBuilder<T> extends Builder<ConcreteBuilder<T>, T> {
@Override @Override
protected ConcreteBuilder<T> self() { protected ConcreteBuilder<T> self() {
return this; return this;
} }
} }
@Named("accountid")
private final String accountId; private final String accountId;
private final String cmd; private final String cmd;
private final Date created; private final Date created;
@Named("jobid")
private final String id; private final String id;
@Named("jobinstanceid")
private final String instanceId; private final String instanceId;
@Named("jobinstancetype")
private final String instanceType; private final String instanceType;
@Named("jobprocstatus")
private final int progress; private final int progress;
@Named("jobresult")
private final S result; private final S result;
@Named("jobresultcode")
private final AsyncJob.ResultCode resultCode; private final AsyncJob.ResultCode resultCode;
@Named("jobresulttype")
private final String resultType; private final String resultType;
@Named("jobstatus")
private final AsyncJob.Status status; private final AsyncJob.Status status;
@Named("userid")
private final String userId; private final String userId;
private final AsyncJobError error; private final AsyncJobError error;
@ -412,7 +404,7 @@ public class AsyncJob<S> {
/** /**
* @return the error related to this command, or null if no error or error * @return the error related to this command, or null if no error or error
not yet encountered. * not yet encountered.
*/ */
@Nullable @Nullable
public AsyncJobError getError() { public AsyncJobError getError() {

View File

@ -20,15 +20,12 @@ package org.jclouds.cloudstack.domain;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
/** /**
*
* @author Adrian Cole * @author Adrian Cole
*/ */
public class AsyncJobError { public class AsyncJobError {
@ -37,15 +34,15 @@ public class AsyncJobError {
* Error codes for job errors * Error codes for job errors
*/ */
public static enum ErrorCode { public static enum ErrorCode {
INTERNAL_ERROR (530), INTERNAL_ERROR(530),
ACCOUNT_ERROR (531), ACCOUNT_ERROR(531),
ACCOUNT_RESOURCE_LIMIT_ERROR(532), ACCOUNT_RESOURCE_LIMIT_ERROR(532),
INSUFFICIENT_CAPACITY_ERROR (533), INSUFFICIENT_CAPACITY_ERROR(533),
RESOURCE_UNAVAILABLE_ERROR (534), RESOURCE_UNAVAILABLE_ERROR(534),
RESOURCE_ALLOCATION_ERROR (535), RESOURCE_ALLOCATION_ERROR(535),
RESOURCE_IN_USE_ERROR (536), RESOURCE_IN_USE_ERROR(536),
NETWORK_RULE_CONFLICT_ERROR (537), NETWORK_RULE_CONFLICT_ERROR(537),
UNKNOWN (-1); UNKNOWN(-1);
private final int code; private final int code;
@ -53,19 +50,21 @@ public class AsyncJobError {
this.code = code; this.code = code;
} }
public int code() { return this.code; } public int code() {
return this.code;
}
public static ErrorCode fromValue(String value) { public static ErrorCode fromValue(String value) {
try { try {
int errorCode = Integer.parseInt(value); int errorCode = Integer.parseInt(value);
for(ErrorCode candidate : values()) { for (ErrorCode candidate : values()) {
if (candidate.code() == errorCode) { if (candidate.code() == errorCode) {
return candidate; return candidate;
} }
} }
return UNKNOWN; return UNKNOWN;
} catch(NumberFormatException e) { } catch (NumberFormatException e) {
return UNKNOWN; return UNKNOWN;
} }
} }
@ -79,7 +78,7 @@ public class AsyncJobError {
return new ConcreteBuilder().fromAsyncJobError(this); return new ConcreteBuilder().fromAsyncJobError(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected AsyncJobError.ErrorCode errorCode; protected AsyncJobError.ErrorCode errorCode;
@ -119,9 +118,7 @@ public class AsyncJobError {
} }
} }
@Named("errorcode")
private final ErrorCode errorCode; private final ErrorCode errorCode;
@Named("errortext")
private final String errorText; private final String errorText;
@ConstructorProperties({ @ConstructorProperties({

View File

@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -42,7 +40,7 @@ public class Capabilities {
return new ConcreteBuilder().fromCapabilities(this); return new ConcreteBuilder().fromCapabilities(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String cloudStackVersion; protected String cloudStackVersion;
@ -112,11 +110,8 @@ public class Capabilities {
} }
} }
@Named("cloudstackversion")
private final String cloudStackVersion; private final String cloudStackVersion;
@Named("securitygroupsenabled")
private final boolean securityGroupsEnabled; private final boolean securityGroupsEnabled;
@Named("userpublictemplateenabled")
private final boolean canShareTemplates; private final boolean canShareTemplates;
private final boolean firewallRuleUiEnabled; private final boolean firewallRuleUiEnabled;
private final boolean supportELB; private final boolean supportELB;

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Map; import java.util.Map;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -90,7 +88,7 @@ public class Capacity implements Comparable<Capacity> {
return new ConcreteBuilder().fromCapacity(this); return new ConcreteBuilder().fromCapacity(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected long capacityTotal; protected long capacityTotal;
@ -190,20 +188,13 @@ public class Capacity implements Comparable<Capacity> {
} }
} }
@Named("capacitytotal")
private final long capacityTotal; private final long capacityTotal;
@Named("capacityused")
private final long capacityUsed; private final long capacityUsed;
@Named("percentused")
private final double percentUsed; private final double percentUsed;
@Named("podid")
private final String podId; private final String podId;
@Named("podname")
private final String podName; private final String podName;
private final Capacity.Type type; private final Capacity.Type type;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@ConstructorProperties({ @ConstructorProperties({

View File

@ -24,8 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -48,7 +46,7 @@ public class Cluster implements Comparable<Cluster> {
UNRECOGNIZED; UNRECOGNIZED;
public static ManagedState fromValue(String value) { public static ManagedState fromValue(String value) {
try{ try {
return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, value)); return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, value));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNRECOGNIZED; return UNRECOGNIZED;
@ -69,7 +67,7 @@ public class Cluster implements Comparable<Cluster> {
return new ConcreteBuilder().fromCluster(this); return new ConcreteBuilder().fromCluster(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -190,22 +188,14 @@ public class Cluster implements Comparable<Cluster> {
} }
private final String id; private final String id;
@Named("allocationstate")
private final AllocationState allocationState; private final AllocationState allocationState;
@Named("clustertype")
private final Host.ClusterType clusterType; private final Host.ClusterType clusterType;
@Named("hypervisortype")
private final String hypervisor; private final String hypervisor;
@Named("managedstate")
private final Cluster.ManagedState managedState; private final Cluster.ManagedState managedState;
private final String name; private final String name;
@Named("podid")
private final String podId; private final String podId;
@Named("podname")
private final String podName; private final String podName;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@ConstructorProperties({ @ConstructorProperties({

View File

@ -42,7 +42,7 @@ public class ConfigurationEntry implements Comparable<ConfigurationEntry> {
return new ConcreteBuilder().fromConfigurationEntry(this); return new ConcreteBuilder().fromConfigurationEntry(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String category; protected String category;

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -45,7 +43,7 @@ public class DiskOffering implements Comparable<DiskOffering> {
return new ConcreteBuilder().fromDiskOffering(this); return new ConcreteBuilder().fromDiskOffering(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -157,15 +155,11 @@ public class DiskOffering implements Comparable<DiskOffering> {
private final String id; private final String id;
private final String name; private final String name;
@Named("displaytext")
private final String displayText; private final String displayText;
private final Date created; private final Date created;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("disksize")
private final int diskSize; private final int diskSize;
@Named("iscustomized")
private final boolean customized; private final boolean customized;
private final String tags; private final String tags;

View File

@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -44,7 +42,7 @@ public class Domain implements Comparable<Domain> {
return new ConcreteBuilder().fromDomain(this); return new ConcreteBuilder().fromDomain(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -135,15 +133,11 @@ public class Domain implements Comparable<Domain> {
} }
private final String id; private final String id;
@Named("haschild")
private final boolean hasChild; private final boolean hasChild;
private final long level; private final long level;
private final String name; private final String name;
@Named("networkdomain")
private final String networkDomain; private final String networkDomain;
@Named("parentdomainid")
private final String parentDomainId; private final String parentDomainId;
@Named("parentdomainname")
private final String parentDomainName; private final String parentDomainName;
@ConstructorProperties({ @ConstructorProperties({

View File

@ -40,7 +40,7 @@ public class EncryptedPasswordAndPrivateKey {
return new ConcreteBuilder().fromEncryptedPasswordAndPrivateKey(this); return new ConcreteBuilder().fromEncryptedPasswordAndPrivateKey(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String encryptedPassword; protected String encryptedPassword;

View File

@ -43,7 +43,7 @@ public class Event implements Comparable<Event> {
return new ConcreteBuilder().fromEvent(this); return new ConcreteBuilder().fromEvent(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -213,7 +213,7 @@ public class Event implements Comparable<Event> {
/** /**
* @return the account name for the account that owns the object being acted on in the event * @return the account name for the account that owns the object being acted on in the event
(e.g. the owner of the virtual machine, ip address, or security group) * (e.g. the owner of the virtual machine, ip address, or security group)
*/ */
@Nullable @Nullable
public String getAccount() { public String getAccount() {
@ -286,7 +286,7 @@ public class Event implements Comparable<Event> {
/** /**
* @return the name of the user who performed the action (can be different from the account if * @return the name of the user who performed the action (can be different from the account if
an admin is performing an action for a user, e.g. starting/stopping a user's virtual machine) * an admin is performing an action for a user, e.g. starting/stopping a user's virtual machine)
*/ */
@Nullable @Nullable
public String getUsername() { public String getUsername() {

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -50,7 +48,7 @@ public class FirewallRule implements Comparable<FirewallRule> {
public static Protocol fromValue(String value) { public static Protocol fromValue(String value) {
try { try {
return valueOf(value.toUpperCase()); return valueOf(value.toUpperCase());
} catch(IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNKNOWN; return UNKNOWN;
} }
} }
@ -63,17 +61,17 @@ public class FirewallRule implements Comparable<FirewallRule> {
public static enum State { public static enum State {
STAGED, // Rule been created but has never got through network rule conflict detection. STAGED, // Rule been created but has never got through network rule conflict detection.
// Rules in this state can not be sent to network elements. // Rules in this state can not be sent to network elements.
ADD, // Add means the rule has been created and has gone through network rule conflict detection. ADD, // Add means the rule has been created and has gone through network rule conflict detection.
ACTIVE, // Rule has been sent to the network elements and reported to be active. ACTIVE, // Rule has been sent to the network elements and reported to be active.
DELETING, // Revoke means this rule has been revoked. If this rule has been sent to the DELETING, // Revoke means this rule has been revoked. If this rule has been sent to the
// network elements, the rule will be deleted from database. // network elements, the rule will be deleted from database.
UNKNOWN; UNKNOWN;
public static State fromValue(String value) { public static State fromValue(String value) {
try { try {
return valueOf(value.toUpperCase()); return valueOf(value.toUpperCase());
} catch(IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNKNOWN; return UNKNOWN;
} }
} }
@ -92,7 +90,7 @@ public class FirewallRule implements Comparable<FirewallRule> {
return new ConcreteBuilder().fromFirewallRule(this); return new ConcreteBuilder().fromFirewallRule(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -217,19 +215,12 @@ public class FirewallRule implements Comparable<FirewallRule> {
} }
private final String id; private final String id;
@Named("cidrlist")
private final Set<String> CIDRs; private final Set<String> CIDRs;
@Named("startport")
private final int startPort; private final int startPort;
@Named("endport")
private final int endPort; private final int endPort;
@Named("icmpcode")
private final String icmpCode; private final String icmpCode;
@Named("icmptype")
private final String icmpType; private final String icmpType;
@Named("ipaddress")
private final String ipAddress; private final String ipAddress;
@Named("ipaddressid")
private final String ipAddressId; private final String ipAddressId;
private final FirewallRule.Protocol protocol; private final FirewallRule.Protocol protocol;
private final FirewallRule.State state; private final FirewallRule.State state;
@ -237,7 +228,19 @@ public class FirewallRule implements Comparable<FirewallRule> {
@ConstructorProperties({ @ConstructorProperties({
"id", "cidrlist", "startport", "endport", "icmpcode", "icmptype", "ipaddress", "ipaddressid", "protocol", "state" "id", "cidrlist", "startport", "endport", "icmpcode", "icmptype", "ipaddress", "ipaddressid", "protocol", "state"
}) })
protected FirewallRule(String id, @Nullable Set<String> CIDRs, int startPort, int endPort, @Nullable String icmpCode, @SuppressWarnings("unused")
private FirewallRule(String id, @Nullable String CIDRs, int startPort, int endPort, @Nullable String icmpCode,
@Nullable String icmpType, @Nullable String ipAddress, @Nullable String ipAddressId,
@Nullable Protocol protocol, @Nullable State state) {
this(id, splitStringOnCommas(CIDRs), startPort, endPort, icmpCode, icmpType, ipAddress, ipAddressId, protocol, state);
}
private static Set<String> splitStringOnCommas(String in) {
return in == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(in.split(","));
}
protected FirewallRule(String id, @Nullable Iterable<String> CIDRs, int startPort, int endPort, @Nullable String icmpCode,
@Nullable String icmpType, @Nullable String ipAddress, @Nullable String ipAddressId, @Nullable String icmpType, @Nullable String ipAddress, @Nullable String ipAddressId,
@Nullable FirewallRule.Protocol protocol, @Nullable FirewallRule.State state) { @Nullable FirewallRule.Protocol protocol, @Nullable FirewallRule.State state) {
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");

View File

@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
/** /**
*
* @author Adrian Cole * @author Adrian Cole
* @see org.jclouds.cloudstack.features.OfferingClient#listNetworkOfferings * @see org.jclouds.cloudstack.features.OfferingClient#listNetworkOfferings
*/ */

View File

@ -25,8 +25,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -75,7 +73,7 @@ public class Host implements Comparable<Host> {
public static State fromValue(String value) { public static State fromValue(String value) {
try { try {
return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, value)); return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, value));
} catch(IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNKNOWN; return UNKNOWN;
} }
} }
@ -108,7 +106,7 @@ public class Host implements Comparable<Host> {
} }
return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, value)); return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, value));
} catch(IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNKNOWN; return UNKNOWN;
} }
} }
@ -572,77 +570,46 @@ public class Host implements Comparable<Host> {
} }
private final String id; private final String id;
@Named("allocationstate")
private final AllocationState allocationState; private final AllocationState allocationState;
@Named("averageload")
private final int averageLoad; private final int averageLoad;
private final String capabilities; private final String capabilities;
@Named("clusterid")
private final String clusterId; private final String clusterId;
@Named("clustername")
private final String clusterName; private final String clusterName;
@Named("clustertype")
private final Host.ClusterType clusterType; private final Host.ClusterType clusterType;
@Named("cpuallocated")
private final String cpuAllocated; private final String cpuAllocated;
@Named("cpunumber")
private final int cpuNumber; private final int cpuNumber;
@Named("cpuspeed")
private final int cpuSpeed; private final int cpuSpeed;
@Named("cpuused")
private final String cpuUsed; private final String cpuUsed;
@Named("cpuwithoverprovisioning")
private final float cpuWithOverProvisioning; private final float cpuWithOverProvisioning;
private final Date created; private final Date created;
private final Date disconnected; private final Date disconnected;
@Named("disksizeallocated")
private final long diskSizeAllocated; private final long diskSizeAllocated;
@Named("disksizetotal")
private final long diskSizeTotal; private final long diskSizeTotal;
private final String events; private final String events;
@Named("hasenoughcapacity")
private final boolean hasEnoughCapacity; private final boolean hasEnoughCapacity;
@Named("hosttags")
private final String hostTags; private final String hostTags;
private final String hypervisor; private final String hypervisor;
@Named("ipaddress")
private final String ipAddress; private final String ipAddress;
@Named("islocalstorageactive")
private final boolean localStorageActive; private final boolean localStorageActive;
@Named("jobid")
private final String jobId; private final String jobId;
@Named("jobstatus")
private final AsyncJob.Status jobStatus; private final AsyncJob.Status jobStatus;
@Named("lastpinged")
private final Date lastPinged; private final Date lastPinged;
@Named("managementserverid")
private final String managementServerId; private final String managementServerId;
@Named("memoryallocated")
private final long memoryAllocated; private final long memoryAllocated;
@Named("memorytotal")
private final long memoryTotal; private final long memoryTotal;
@Named("memoryused")
private final long memoryUsed; private final long memoryUsed;
private final String name; private final String name;
@Named("networkkbsread")
private final long networkKbsRead; private final long networkKbsRead;
@Named("networkkbswrite")
private final long networkKbsWrite; private final long networkKbsWrite;
@Named("oscategoryid")
private final String osCategoryId; private final String osCategoryId;
@Named("oscategoryname")
private final String osCategoryName; private final String osCategoryName;
@Named("podid")
private final String podId; private final String podId;
@Named("podname")
private final String podName; private final String podName;
private final Date removed; private final Date removed;
private final Host.State state; private final Host.State state;
private final Host.Type type; private final Host.Type type;
private final String version; private final String version;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@ConstructorProperties({ @ConstructorProperties({
@ -835,7 +802,7 @@ public class Host implements Comparable<Host> {
public long getMemoryUsed() { public long getMemoryUsed() {
return this.memoryUsed; return this.memoryUsed;
} }
@Nullable @Nullable
public String getName() { public String getName() {
return this.name; return this.name;

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -33,20 +31,20 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Class IPForwardingRule * Class IPForwardingRule
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class IPForwardingRule implements Comparable<IPForwardingRule> { public class IPForwardingRule implements Comparable<IPForwardingRule> {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromIPForwardingRule(this); return new ConcreteBuilder().fromIPForwardingRule(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -63,8 +61,8 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
protected Set<String> CIDRs = ImmutableSet.of(); protected Set<String> CIDRs = ImmutableSet.of();
protected int privateEndPort; protected int privateEndPort;
protected int publicEndPort; protected int publicEndPort;
/** /**
* @see IPForwardingRule#getId() * @see IPForwardingRule#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -72,7 +70,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getIPAddress() * @see IPForwardingRule#getIPAddress()
*/ */
public T IPAddress(String IPAddress) { public T IPAddress(String IPAddress) {
@ -80,7 +78,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getIPAddressId() * @see IPForwardingRule#getIPAddressId()
*/ */
public T IPAddressId(String IPAddressId) { public T IPAddressId(String IPAddressId) {
@ -88,7 +86,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getStartPort() * @see IPForwardingRule#getStartPort()
*/ */
public T startPort(int startPort) { public T startPort(int startPort) {
@ -96,7 +94,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getProtocol() * @see IPForwardingRule#getProtocol()
*/ */
public T protocol(String protocol) { public T protocol(String protocol) {
@ -104,7 +102,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getEndPort() * @see IPForwardingRule#getEndPort()
*/ */
public T endPort(int endPort) { public T endPort(int endPort) {
@ -112,7 +110,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getState() * @see IPForwardingRule#getState()
*/ */
public T state(String state) { public T state(String state) {
@ -120,7 +118,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getVirtualMachineDisplayName() * @see IPForwardingRule#getVirtualMachineDisplayName()
*/ */
public T virtualMachineDisplayName(String virtualMachineDisplayName) { public T virtualMachineDisplayName(String virtualMachineDisplayName) {
@ -128,7 +126,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getVirtualMachineId() * @see IPForwardingRule#getVirtualMachineId()
*/ */
public T virtualMachineId(String virtualMachineId) { public T virtualMachineId(String virtualMachineId) {
@ -136,7 +134,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getVirtualMachineName() * @see IPForwardingRule#getVirtualMachineName()
*/ */
public T virtualMachineName(String virtualMachineName) { public T virtualMachineName(String virtualMachineName) {
@ -144,7 +142,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getPublicPort() * @see IPForwardingRule#getPublicPort()
*/ */
public T publicPort(int publicPort) { public T publicPort(int publicPort) {
@ -152,11 +150,11 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getCIDRs() * @see IPForwardingRule#getCIDRs()
*/ */
public T CIDRs(Set<String> CIDRs) { public T CIDRs(Set<String> CIDRs) {
this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs"));
return self(); return self();
} }
@ -164,7 +162,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return CIDRs(ImmutableSet.copyOf(in)); return CIDRs(ImmutableSet.copyOf(in));
} }
/** /**
* @see IPForwardingRule#getPrivateEndPort() * @see IPForwardingRule#getPrivateEndPort()
*/ */
public T privateEndPort(int privateEndPort) { public T privateEndPort(int privateEndPort) {
@ -172,7 +170,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return self(); return self();
} }
/** /**
* @see IPForwardingRule#getPublicEndPort() * @see IPForwardingRule#getPublicEndPort()
*/ */
public T publicEndPort(int publicEndPort) { public T publicEndPort(int publicEndPort) {
@ -184,23 +182,23 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return new IPForwardingRule(id, IPAddress, IPAddressId, startPort, protocol, endPort, state, virtualMachineDisplayName, return new IPForwardingRule(id, IPAddress, IPAddressId, startPort, protocol, endPort, state, virtualMachineDisplayName,
virtualMachineId, virtualMachineName, publicPort, CIDRs, privateEndPort, publicEndPort); virtualMachineId, virtualMachineName, publicPort, CIDRs, privateEndPort, publicEndPort);
} }
public T fromIPForwardingRule(IPForwardingRule in) { public T fromIPForwardingRule(IPForwardingRule in) {
return this return this
.id(in.getId()) .id(in.getId())
.IPAddress(in.getIPAddress()) .IPAddress(in.getIPAddress())
.IPAddressId(in.getIPAddressId()) .IPAddressId(in.getIPAddressId())
.startPort(in.getStartPort()) .startPort(in.getStartPort())
.protocol(in.getProtocol()) .protocol(in.getProtocol())
.endPort(in.getEndPort()) .endPort(in.getEndPort())
.state(in.getState()) .state(in.getState())
.virtualMachineDisplayName(in.getVirtualMachineDisplayName()) .virtualMachineDisplayName(in.getVirtualMachineDisplayName())
.virtualMachineId(in.getVirtualMachineId()) .virtualMachineId(in.getVirtualMachineId())
.virtualMachineName(in.getVirtualMachineName()) .virtualMachineName(in.getVirtualMachineName())
.publicPort(in.getPublicPort()) .publicPort(in.getPublicPort())
.CIDRs(in.getCIDRs()) .CIDRs(in.getCIDRs())
.privateEndPort(in.getPrivateEndPort()) .privateEndPort(in.getPrivateEndPort())
.publicEndPort(in.getPublicEndPort()); .publicEndPort(in.getPublicEndPort());
} }
} }
@ -212,33 +210,22 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
} }
private final String id; private final String id;
@Named("ipaddress")
private final String IPAddress; private final String IPAddress;
@Named("ipaddressid")
private final String IPAddressId; private final String IPAddressId;
@Named("startport")
private final int startPort; private final int startPort;
private final String protocol; private final String protocol;
@Named("endport")
private final int endPort; private final int endPort;
private final String state; private final String state;
@Named("virtualmachinedisplayname")
private final String virtualMachineDisplayName; private final String virtualMachineDisplayName;
@Named("virtualmachineid")
private final String virtualMachineId; private final String virtualMachineId;
@Named("virtualmachinename")
private final String virtualMachineName; private final String virtualMachineName;
@Named("publicport")
private final int publicPort; private final int publicPort;
@Named("cidrlist")
private final Set<String> CIDRs; private final Set<String> CIDRs;
@Named("privateendport")
private final int privateEndPort; private final int privateEndPort;
@Named("publicendport")
private final int publicEndPort; private final int publicEndPort;
@ConstructorProperties({ @ConstructorProperties({
"id", "ipaddress", "ipaddressid", "startport", "protocol", "endport", "state", "virtualmachinedisplayname", "id", "ipaddress", "ipaddressid", "startport", "protocol", "endport", "state", "virtualmachinedisplayname",
"virtualmachineid", "virtualmachinename", "publicport", "cidrlist", "privateendport", "publicendport" "virtualmachineid", "virtualmachinename", "publicport", "cidrlist", "privateendport", "publicendport"
}) })
protected IPForwardingRule(String id, String IPAddress, String IPAddressId, int startPort, @Nullable String protocol, protected IPForwardingRule(String id, String IPAddress, String IPAddressId, int startPort, @Nullable String protocol,
@ -256,7 +243,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
this.virtualMachineId = virtualMachineId; this.virtualMachineId = virtualMachineId;
this.virtualMachineName = virtualMachineName; this.virtualMachineName = virtualMachineName;
this.publicPort = publicPort; this.publicPort = publicPort;
this.CIDRs = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs); this.CIDRs = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs);
this.privateEndPort = privateEndPort; this.privateEndPort = privateEndPort;
this.publicEndPort = publicEndPort; this.publicEndPort = publicEndPort;
} }
@ -377,21 +364,21 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
IPForwardingRule that = IPForwardingRule.class.cast(obj); IPForwardingRule that = IPForwardingRule.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.IPAddress, that.IPAddress) && Objects.equal(this.IPAddress, that.IPAddress)
&& Objects.equal(this.IPAddressId, that.IPAddressId) && Objects.equal(this.IPAddressId, that.IPAddressId)
&& Objects.equal(this.startPort, that.startPort) && Objects.equal(this.startPort, that.startPort)
&& Objects.equal(this.protocol, that.protocol) && Objects.equal(this.protocol, that.protocol)
&& Objects.equal(this.endPort, that.endPort) && Objects.equal(this.endPort, that.endPort)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName)
&& Objects.equal(this.virtualMachineId, that.virtualMachineId) && Objects.equal(this.virtualMachineId, that.virtualMachineId)
&& Objects.equal(this.virtualMachineName, that.virtualMachineName) && Objects.equal(this.virtualMachineName, that.virtualMachineName)
&& Objects.equal(this.publicPort, that.publicPort) && Objects.equal(this.publicPort, that.publicPort)
&& Objects.equal(this.CIDRs, that.CIDRs) && Objects.equal(this.CIDRs, that.CIDRs)
&& Objects.equal(this.privateEndPort, that.privateEndPort) && Objects.equal(this.privateEndPort, that.privateEndPort)
&& Objects.equal(this.publicEndPort, that.publicEndPort); && Objects.equal(this.publicEndPort, that.publicEndPort);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("IPAddress", IPAddress).add("IPAddressId", IPAddressId).add("startPort", startPort) .add("id", id).add("IPAddress", IPAddress).add("IPAddressId", IPAddressId).add("startPort", startPort)
@ -399,7 +386,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
.add("virtualMachineId", virtualMachineId).add("virtualMachineName", virtualMachineName).add("publicPort", publicPort) .add("virtualMachineId", virtualMachineId).add("virtualMachineName", virtualMachineName).add("publicPort", publicPort)
.add("CIDRs", CIDRs).add("privateEndPort", privateEndPort).add("publicEndPort", publicEndPort); .add("CIDRs", CIDRs).add("privateEndPort", privateEndPort).add("publicEndPort", publicEndPort);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -32,35 +30,35 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class ISO * Class ISO
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class ISO { public class ISO {
/** /**
*/ */
public static enum ISOFilter { public static enum ISOFilter {
featured, self, self_executable, executable, community, UNRECOGNIZED; featured, self, self_executable, executable, community, UNRECOGNIZED;
public static ISOFilter fromValue(String format) { public static ISOFilter fromValue(String format) {
try { try {
return valueOf(checkNotNull(format, "format")); return valueOf(checkNotNull(format, "format"));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNRECOGNIZED; return UNRECOGNIZED;
} }
} }
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromISO(this); return new ConcreteBuilder().fromISO(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -95,8 +93,8 @@ public class ISO {
protected String templateType; protected String templateType;
protected String zoneId; protected String zoneId;
protected String zoneName; protected String zoneName;
/** /**
* @see ISO#getId() * @see ISO#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -104,7 +102,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getAccount() * @see ISO#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -112,7 +110,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getAccountId() * @see ISO#getAccountId()
*/ */
public T accountId(String accountId) { public T accountId(String accountId) {
@ -120,7 +118,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#isBootable() * @see ISO#isBootable()
*/ */
public T bootable(boolean bootable) { public T bootable(boolean bootable) {
@ -128,7 +126,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getChecksum() * @see ISO#getChecksum()
*/ */
public T checksum(String checksum) { public T checksum(String checksum) {
@ -136,7 +134,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getCreated() * @see ISO#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -144,7 +142,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#isCrossZones() * @see ISO#isCrossZones()
*/ */
public T crossZones(boolean crossZones) { public T crossZones(boolean crossZones) {
@ -152,7 +150,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getDisplayText() * @see ISO#getDisplayText()
*/ */
public T displayText(String displayText) { public T displayText(String displayText) {
@ -160,7 +158,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getDomain() * @see ISO#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -168,7 +166,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getDomainid() * @see ISO#getDomainid()
*/ */
public T domainid(String domainid) { public T domainid(String domainid) {
@ -176,7 +174,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getFormat() * @see ISO#getFormat()
*/ */
public T format(String format) { public T format(String format) {
@ -184,7 +182,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getHostId() * @see ISO#getHostId()
*/ */
public T hostId(String hostId) { public T hostId(String hostId) {
@ -192,7 +190,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getHostName() * @see ISO#getHostName()
*/ */
public T hostName(String hostName) { public T hostName(String hostName) {
@ -200,7 +198,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getHypervisor() * @see ISO#getHypervisor()
*/ */
public T hypervisor(String hypervisor) { public T hypervisor(String hypervisor) {
@ -208,7 +206,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#isExtractable() * @see ISO#isExtractable()
*/ */
public T isExtractable(boolean isExtractable) { public T isExtractable(boolean isExtractable) {
@ -216,7 +214,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#isFeatured() * @see ISO#isFeatured()
*/ */
public T isFeatured(boolean isFeatured) { public T isFeatured(boolean isFeatured) {
@ -224,7 +222,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#isPublic() * @see ISO#isPublic()
*/ */
public T isPublic(boolean isPublic) { public T isPublic(boolean isPublic) {
@ -232,7 +230,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#isReady() * @see ISO#isReady()
*/ */
public T isReady(boolean isReady) { public T isReady(boolean isReady) {
@ -240,7 +238,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getJobId() * @see ISO#getJobId()
*/ */
public T jobId(String jobId) { public T jobId(String jobId) {
@ -248,7 +246,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getJobStatus() * @see ISO#getJobStatus()
*/ */
public T jobStatus(String jobStatus) { public T jobStatus(String jobStatus) {
@ -256,7 +254,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getName() * @see ISO#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -264,7 +262,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getOsTypeId() * @see ISO#getOsTypeId()
*/ */
public T osTypeId(String osTypeId) { public T osTypeId(String osTypeId) {
@ -272,7 +270,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getOsTypeName() * @see ISO#getOsTypeName()
*/ */
public T osTypeName(String osTypeName) { public T osTypeName(String osTypeName) {
@ -280,7 +278,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#isPasswordEnabled() * @see ISO#isPasswordEnabled()
*/ */
public T passwordEnabled(boolean passwordEnabled) { public T passwordEnabled(boolean passwordEnabled) {
@ -288,7 +286,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getRemoved() * @see ISO#getRemoved()
*/ */
public T removed(Date removed) { public T removed(Date removed) {
@ -296,7 +294,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getSize() * @see ISO#getSize()
*/ */
public T size(long size) { public T size(long size) {
@ -304,7 +302,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getSourceTemplateId() * @see ISO#getSourceTemplateId()
*/ */
public T sourceTemplateId(String sourceTemplateId) { public T sourceTemplateId(String sourceTemplateId) {
@ -312,7 +310,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getStatus() * @see ISO#getStatus()
*/ */
public T status(String status) { public T status(String status) {
@ -320,7 +318,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getTemplateTag() * @see ISO#getTemplateTag()
*/ */
public T templateTag(String templateTag) { public T templateTag(String templateTag) {
@ -328,7 +326,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getTemplateType() * @see ISO#getTemplateType()
*/ */
public T templateType(String templateType) { public T templateType(String templateType) {
@ -336,7 +334,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getZoneId() * @see ISO#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -344,7 +342,7 @@ public class ISO {
return self(); return self();
} }
/** /**
* @see ISO#getZoneName() * @see ISO#getZoneName()
*/ */
public T zoneName(String zoneName) { public T zoneName(String zoneName) {
@ -358,41 +356,41 @@ public class ISO {
osTypeId, osTypeName, passwordEnabled, removed, size, sourceTemplateId, status, templateTag, templateType, osTypeId, osTypeName, passwordEnabled, removed, size, sourceTemplateId, status, templateTag, templateType,
zoneId, zoneName); zoneId, zoneName);
} }
public T fromISO(ISO in) { public T fromISO(ISO in) {
return this return this
.id(in.getId()) .id(in.getId())
.account(in.getAccount()) .account(in.getAccount())
.accountId(in.getAccountId()) .accountId(in.getAccountId())
.bootable(in.isBootable()) .bootable(in.isBootable())
.checksum(in.getChecksum()) .checksum(in.getChecksum())
.created(in.getCreated()) .created(in.getCreated())
.crossZones(in.isCrossZones()) .crossZones(in.isCrossZones())
.displayText(in.getDisplayText()) .displayText(in.getDisplayText())
.domain(in.getDomain()) .domain(in.getDomain())
.domainid(in.getDomainid()) .domainid(in.getDomainid())
.format(in.getFormat()) .format(in.getFormat())
.hostId(in.getHostId()) .hostId(in.getHostId())
.hostName(in.getHostName()) .hostName(in.getHostName())
.hypervisor(in.getHypervisor()) .hypervisor(in.getHypervisor())
.isExtractable(in.isExtractable()) .isExtractable(in.isExtractable())
.isFeatured(in.isFeatured()) .isFeatured(in.isFeatured())
.isPublic(in.isPublic()) .isPublic(in.isPublic())
.isReady(in.isReady()) .isReady(in.isReady())
.jobId(in.getJobId()) .jobId(in.getJobId())
.jobStatus(in.getJobStatus()) .jobStatus(in.getJobStatus())
.name(in.getName()) .name(in.getName())
.osTypeId(in.getOsTypeId()) .osTypeId(in.getOsTypeId())
.osTypeName(in.getOsTypeName()) .osTypeName(in.getOsTypeName())
.passwordEnabled(in.isPasswordEnabled()) .passwordEnabled(in.isPasswordEnabled())
.removed(in.getRemoved()) .removed(in.getRemoved())
.size(in.getSize()) .size(in.getSize())
.sourceTemplateId(in.getSourceTemplateId()) .sourceTemplateId(in.getSourceTemplateId())
.status(in.getStatus()) .status(in.getStatus())
.templateTag(in.getTemplateTag()) .templateTag(in.getTemplateTag())
.templateType(in.getTemplateType()) .templateType(in.getTemplateType())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.zoneName(in.getZoneName()); .zoneName(in.getZoneName());
} }
} }
@ -405,58 +403,39 @@ public class ISO {
private final String id; private final String id;
private final String account; private final String account;
@Named("accountid")
private final String accountId; private final String accountId;
private final boolean bootable; private final boolean bootable;
private final String checksum; private final String checksum;
private final Date created; private final Date created;
private final boolean crossZones; private final boolean crossZones;
@Named("displaytext")
private final String displayText; private final String displayText;
private final String domain; private final String domain;
@Named("domainId")
private final String domainid; private final String domainid;
private final String format; private final String format;
@Named("hostid")
private final String hostId; private final String hostId;
@Named("hostname")
private final String hostName; private final String hostName;
private final String hypervisor; private final String hypervisor;
@Named("isextractable")
private final boolean isExtractable; private final boolean isExtractable;
@Named("isfeatured")
private final boolean isFeatured; private final boolean isFeatured;
@Named("ispublic")
private final boolean isPublic; private final boolean isPublic;
@Named("isready")
private final boolean isReady; private final boolean isReady;
@Named("jobid")
private final String jobId; private final String jobId;
@Named("jobstatus")
private final String jobStatus; private final String jobStatus;
private final String name; private final String name;
@Named("ostypeid")
private final String osTypeId; private final String osTypeId;
@Named("ostypename")
private final String osTypeName; private final String osTypeName;
@Named("passwordenabled")
private final boolean passwordEnabled; private final boolean passwordEnabled;
private final Date removed; private final Date removed;
private final long size; private final long size;
@Named("sourcetemplateid")
private final String sourceTemplateId; private final String sourceTemplateId;
private final String status; private final String status;
@Named("templatetag")
private final String templateTag; private final String templateTag;
@Named("templatetype")
private final String templateType; private final String templateType;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "accountid", "bootable", "checksum", "created", "crossZones", "displaytext", "domain", "domainId", "format", "hostid", "hostname", "hypervisor", "isextractable", "isfeatured", "ispublic", "isready", "jobid", "jobstatus", "name", "ostypeid", "ostypename", "passwordenabled", "removed", "size", "sourcetemplateid", "status", "templatetag", "templatetype", "zoneid", "zonename" "id", "account", "accountid", "bootable", "checksum", "created", "crossZones", "displaytext", "domain", "domainId", "format", "hostid", "hostname", "hypervisor", "isextractable", "isfeatured", "ispublic", "isready", "jobid", "jobstatus", "name", "ostypeid", "ostypename", "passwordenabled", "removed", "size", "sourcetemplateid", "status", "templatetag", "templatetype", "zoneid", "zonename"
}) })
protected ISO(String id, @Nullable String account, @Nullable String accountId, boolean bootable, @Nullable String checksum, protected ISO(String id, @Nullable String account, @Nullable String accountId, boolean bootable, @Nullable String checksum,
@Nullable Date created, boolean crossZones, @Nullable String displayText, @Nullable String domain, @Nullable Date created, boolean crossZones, @Nullable String displayText, @Nullable String domain,
@ -738,39 +717,39 @@ public class ISO {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
ISO that = ISO.class.cast(obj); ISO that = ISO.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.accountId, that.accountId) && Objects.equal(this.accountId, that.accountId)
&& Objects.equal(this.bootable, that.bootable) && Objects.equal(this.bootable, that.bootable)
&& Objects.equal(this.checksum, that.checksum) && Objects.equal(this.checksum, that.checksum)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.crossZones, that.crossZones) && Objects.equal(this.crossZones, that.crossZones)
&& Objects.equal(this.displayText, that.displayText) && Objects.equal(this.displayText, that.displayText)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainid, that.domainid) && Objects.equal(this.domainid, that.domainid)
&& Objects.equal(this.format, that.format) && Objects.equal(this.format, that.format)
&& Objects.equal(this.hostId, that.hostId) && Objects.equal(this.hostId, that.hostId)
&& Objects.equal(this.hostName, that.hostName) && Objects.equal(this.hostName, that.hostName)
&& Objects.equal(this.hypervisor, that.hypervisor) && Objects.equal(this.hypervisor, that.hypervisor)
&& Objects.equal(this.isExtractable, that.isExtractable) && Objects.equal(this.isExtractable, that.isExtractable)
&& Objects.equal(this.isFeatured, that.isFeatured) && Objects.equal(this.isFeatured, that.isFeatured)
&& Objects.equal(this.isPublic, that.isPublic) && Objects.equal(this.isPublic, that.isPublic)
&& Objects.equal(this.isReady, that.isReady) && Objects.equal(this.isReady, that.isReady)
&& Objects.equal(this.jobId, that.jobId) && Objects.equal(this.jobId, that.jobId)
&& Objects.equal(this.jobStatus, that.jobStatus) && Objects.equal(this.jobStatus, that.jobStatus)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.osTypeId, that.osTypeId) && Objects.equal(this.osTypeId, that.osTypeId)
&& Objects.equal(this.osTypeName, that.osTypeName) && Objects.equal(this.osTypeName, that.osTypeName)
&& Objects.equal(this.passwordEnabled, that.passwordEnabled) && Objects.equal(this.passwordEnabled, that.passwordEnabled)
&& Objects.equal(this.removed, that.removed) && Objects.equal(this.removed, that.removed)
&& Objects.equal(this.size, that.size) && Objects.equal(this.size, that.size)
&& Objects.equal(this.sourceTemplateId, that.sourceTemplateId) && Objects.equal(this.sourceTemplateId, that.sourceTemplateId)
&& Objects.equal(this.status, that.status) && Objects.equal(this.status, that.status)
&& Objects.equal(this.templateTag, that.templateTag) && Objects.equal(this.templateTag, that.templateTag)
&& Objects.equal(this.templateType, that.templateType) && Objects.equal(this.templateType, that.templateType)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.zoneName, that.zoneName); && Objects.equal(this.zoneName, that.zoneName);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("account", account).add("accountId", accountId).add("bootable", bootable) .add("id", id).add("account", account).add("accountId", accountId).add("bootable", bootable)
@ -782,7 +761,7 @@ public class ISO {
.add("sourceTemplateId", sourceTemplateId).add("status", status).add("templateTag", templateTag).add("templateType", templateType) .add("sourceTemplateId", sourceTemplateId).add("status", status).add("templateTag", templateTag).add("templateType", templateType)
.add("zoneId", zoneId).add("zoneName", zoneName); .add("zoneId", zoneId).add("zoneName", zoneName);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -32,20 +30,20 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class ISOExtraction * Class ISOExtraction
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class ISOExtraction { public class ISOExtraction {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromISOExtraction(this); return new ConcreteBuilder().fromISOExtraction(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -61,8 +59,8 @@ public class ISOExtraction {
protected String url; protected String url;
protected String zoneId; protected String zoneId;
protected String zoneName; protected String zoneName;
/** /**
* @see ISOExtraction#getId() * @see ISOExtraction#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -70,7 +68,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getAccountId() * @see ISOExtraction#getAccountId()
*/ */
public T accountId(String accountId) { public T accountId(String accountId) {
@ -78,7 +76,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getCreated() * @see ISOExtraction#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -86,7 +84,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getExtractId() * @see ISOExtraction#getExtractId()
*/ */
public T extractId(String extractId) { public T extractId(String extractId) {
@ -94,7 +92,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getExtractMode() * @see ISOExtraction#getExtractMode()
*/ */
public T extractMode(ExtractMode extractMode) { public T extractMode(ExtractMode extractMode) {
@ -102,7 +100,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getName() * @see ISOExtraction#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -110,7 +108,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getState() * @see ISOExtraction#getState()
*/ */
public T state(String state) { public T state(String state) {
@ -118,7 +116,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getStatus() * @see ISOExtraction#getStatus()
*/ */
public T status(String status) { public T status(String status) {
@ -126,7 +124,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getStorageType() * @see ISOExtraction#getStorageType()
*/ */
public T storageType(String storageType) { public T storageType(String storageType) {
@ -134,7 +132,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getUploadPercentage() * @see ISOExtraction#getUploadPercentage()
*/ */
public T uploadPercentage(int uploadPercentage) { public T uploadPercentage(int uploadPercentage) {
@ -142,7 +140,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getUrl() * @see ISOExtraction#getUrl()
*/ */
public T url(String url) { public T url(String url) {
@ -150,7 +148,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getZoneId() * @see ISOExtraction#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -158,7 +156,7 @@ public class ISOExtraction {
return self(); return self();
} }
/** /**
* @see ISOExtraction#getZoneName() * @see ISOExtraction#getZoneName()
*/ */
public T zoneName(String zoneName) { public T zoneName(String zoneName) {
@ -169,22 +167,22 @@ public class ISOExtraction {
public ISOExtraction build() { public ISOExtraction build() {
return new ISOExtraction(id, accountId, created, extractId, extractMode, name, state, status, storageType, uploadPercentage, url, zoneId, zoneName); return new ISOExtraction(id, accountId, created, extractId, extractMode, name, state, status, storageType, uploadPercentage, url, zoneId, zoneName);
} }
public T fromISOExtraction(ISOExtraction in) { public T fromISOExtraction(ISOExtraction in) {
return this return this
.id(in.getId()) .id(in.getId())
.accountId(in.getAccountId()) .accountId(in.getAccountId())
.created(in.getCreated()) .created(in.getCreated())
.extractId(in.getExtractId()) .extractId(in.getExtractId())
.extractMode(in.getExtractMode()) .extractMode(in.getExtractMode())
.name(in.getName()) .name(in.getName())
.state(in.getState()) .state(in.getState())
.status(in.getStatus()) .status(in.getStatus())
.storageType(in.getStorageType()) .storageType(in.getStorageType())
.uploadPercentage(in.getUploadPercentage()) .uploadPercentage(in.getUploadPercentage())
.url(in.getUrl()) .url(in.getUrl())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.zoneName(in.getZoneName()); .zoneName(in.getZoneName());
} }
} }
@ -196,7 +194,6 @@ public class ISOExtraction {
} }
private final String id; private final String id;
@Named("accountid")
private final String accountId; private final String accountId;
private final Date created; private final Date created;
private final String extractId; private final String extractId;
@ -204,18 +201,14 @@ public class ISOExtraction {
private final String name; private final String name;
private final String state; private final String state;
private final String status; private final String status;
@Named("storagetype")
private final String storageType; private final String storageType;
@Named("uploadpercentage")
private final int uploadPercentage; private final int uploadPercentage;
private final String url; private final String url;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@ConstructorProperties({ @ConstructorProperties({
"id", "accountid", "created", "extractId", "extractMode", "name", "state", "status", "storagetype", "uploadpercentage", "url", "zoneid", "zonename" "id", "accountid", "created", "extractId", "extractMode", "name", "state", "status", "storagetype", "uploadpercentage", "url", "zoneid", "zonename"
}) })
protected ISOExtraction(String id, @Nullable String accountId, @Nullable Date created, @Nullable String extractId, protected ISOExtraction(String id, @Nullable String accountId, @Nullable Date created, @Nullable String extractId,
@Nullable ExtractMode extractMode, @Nullable String name, @Nullable String state, @Nullable String status, @Nullable ExtractMode extractMode, @Nullable String name, @Nullable String state, @Nullable String status,
@ -349,27 +342,27 @@ public class ISOExtraction {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
ISOExtraction that = ISOExtraction.class.cast(obj); ISOExtraction that = ISOExtraction.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.accountId, that.accountId) && Objects.equal(this.accountId, that.accountId)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.extractId, that.extractId) && Objects.equal(this.extractId, that.extractId)
&& Objects.equal(this.extractMode, that.extractMode) && Objects.equal(this.extractMode, that.extractMode)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.status, that.status) && Objects.equal(this.status, that.status)
&& Objects.equal(this.storageType, that.storageType) && Objects.equal(this.storageType, that.storageType)
&& Objects.equal(this.uploadPercentage, that.uploadPercentage) && Objects.equal(this.uploadPercentage, that.uploadPercentage)
&& Objects.equal(this.url, that.url) && Objects.equal(this.url, that.url)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.zoneName, that.zoneName); && Objects.equal(this.zoneName, that.zoneName);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("accountId", accountId).add("created", created).add("extractId", extractId).add("extractMode", extractMode) .add("id", id).add("accountId", accountId).add("created", created).add("extractId", extractId).add("extractMode", extractMode)
.add("name", name).add("state", state).add("status", status).add("storageType", storageType).add("uploadPercentage", uploadPercentage) .add("name", name).add("state", state).add("status", status).add("storageType", storageType).add("uploadPercentage", uploadPercentage)
.add("url", url).add("zoneId", zoneId).add("zoneName", zoneName); .add("url", url).add("zoneId", zoneId).add("zoneName", zoneName);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -33,28 +31,28 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Class ISOPermissions * Class ISOPermissions
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class ISOPermissions { public class ISOPermissions {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromISOPermissions(this); return new ConcreteBuilder().fromISOPermissions(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
protected Set<String> accounts = ImmutableSet.of(); protected Set<String> accounts = ImmutableSet.of();
protected String domainId; protected String domainId;
protected boolean isPublic; protected boolean isPublic;
/** /**
* @see ISOPermissions#getId() * @see ISOPermissions#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -62,11 +60,11 @@ public class ISOPermissions {
return self(); return self();
} }
/** /**
* @see ISOPermissions#getAccounts() * @see ISOPermissions#getAccounts()
*/ */
public T accounts(Set<String> accounts) { public T accounts(Set<String> accounts) {
this.accounts = ImmutableSet.copyOf(checkNotNull(accounts, "accounts")); this.accounts = ImmutableSet.copyOf(checkNotNull(accounts, "accounts"));
return self(); return self();
} }
@ -74,7 +72,7 @@ public class ISOPermissions {
return accounts(ImmutableSet.copyOf(in)); return accounts(ImmutableSet.copyOf(in));
} }
/** /**
* @see ISOPermissions#getDomainId() * @see ISOPermissions#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -82,7 +80,7 @@ public class ISOPermissions {
return self(); return self();
} }
/** /**
* @see ISOPermissions#isPublic() * @see ISOPermissions#isPublic()
*/ */
public T isPublic(boolean isPublic) { public T isPublic(boolean isPublic) {
@ -93,13 +91,13 @@ public class ISOPermissions {
public ISOPermissions build() { public ISOPermissions build() {
return new ISOPermissions(id, accounts, domainId, isPublic); return new ISOPermissions(id, accounts, domainId, isPublic);
} }
public T fromISOPermissions(ISOPermissions in) { public T fromISOPermissions(ISOPermissions in) {
return this return this
.id(in.getId()) .id(in.getId())
.accounts(in.getAccounts()) .accounts(in.getAccounts())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.isPublic(in.isPublic()); .isPublic(in.isPublic());
} }
} }
@ -111,19 +109,16 @@ public class ISOPermissions {
} }
private final String id; private final String id;
@Named("account")
private final Set<String> accounts; private final Set<String> accounts;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("ispublic")
private final boolean isPublic; private final boolean isPublic;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "domainid", "ispublic" "id", "account", "domainid", "ispublic"
}) })
protected ISOPermissions(String id, @Nullable Set<String> accounts, @Nullable String domainId, boolean isPublic) { protected ISOPermissions(String id, @Nullable Set<String> accounts, @Nullable String domainId, boolean isPublic) {
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
this.accounts = accounts == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(accounts); this.accounts = accounts == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(accounts);
this.domainId = domainId; this.domainId = domainId;
this.isPublic = isPublic; this.isPublic = isPublic;
} }
@ -168,16 +163,16 @@ public class ISOPermissions {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
ISOPermissions that = ISOPermissions.class.cast(obj); ISOPermissions that = ISOPermissions.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.accounts, that.accounts) && Objects.equal(this.accounts, that.accounts)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.isPublic, that.isPublic); && Objects.equal(this.isPublic, that.isPublic);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("accounts", accounts).add("domainId", domainId).add("isPublic", isPublic); .add("id", id).add("accounts", accounts).add("domainId", domainId).add("isPublic", isPublic);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -22,28 +22,25 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
/** /**
*
* @author Adrian Cole * @author Adrian Cole
*/ */
public class IngressRule implements Comparable<IngressRule> { public class IngressRule implements Comparable<IngressRule> {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromIngressRule(this); return new ConcreteBuilder().fromIngressRule(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String account; protected String account;
@ -55,8 +52,8 @@ public class IngressRule implements Comparable<IngressRule> {
protected String id; protected String id;
protected String securityGroupName; protected String securityGroupName;
protected int startPort; protected int startPort;
/** /**
* @see IngressRule#getAccount() * @see IngressRule#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -64,7 +61,7 @@ public class IngressRule implements Comparable<IngressRule> {
return self(); return self();
} }
/** /**
* @see IngressRule#getCIDR() * @see IngressRule#getCIDR()
*/ */
public T CIDR(String CIDR) { public T CIDR(String CIDR) {
@ -72,7 +69,7 @@ public class IngressRule implements Comparable<IngressRule> {
return self(); return self();
} }
/** /**
* @see IngressRule#getEndPort() * @see IngressRule#getEndPort()
*/ */
public T endPort(int endPort) { public T endPort(int endPort) {
@ -80,7 +77,7 @@ public class IngressRule implements Comparable<IngressRule> {
return self(); return self();
} }
/** /**
* @see IngressRule#getICMPCode() * @see IngressRule#getICMPCode()
*/ */
public T ICMPCode(int ICMPCode) { public T ICMPCode(int ICMPCode) {
@ -88,7 +85,7 @@ public class IngressRule implements Comparable<IngressRule> {
return self(); return self();
} }
/** /**
* @see IngressRule#getICMPType() * @see IngressRule#getICMPType()
*/ */
public T ICMPType(int ICMPType) { public T ICMPType(int ICMPType) {
@ -96,7 +93,7 @@ public class IngressRule implements Comparable<IngressRule> {
return self(); return self();
} }
/** /**
* @see IngressRule#getProtocol() * @see IngressRule#getProtocol()
*/ */
public T protocol(String protocol) { public T protocol(String protocol) {
@ -104,7 +101,7 @@ public class IngressRule implements Comparable<IngressRule> {
return self(); return self();
} }
/** /**
* @see IngressRule#getId() * @see IngressRule#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -112,7 +109,7 @@ public class IngressRule implements Comparable<IngressRule> {
return self(); return self();
} }
/** /**
* @see IngressRule#getSecurityGroupName() * @see IngressRule#getSecurityGroupName()
*/ */
public T securityGroupName(String securityGroupName) { public T securityGroupName(String securityGroupName) {
@ -120,7 +117,7 @@ public class IngressRule implements Comparable<IngressRule> {
return self(); return self();
} }
/** /**
* @see IngressRule#getStartPort() * @see IngressRule#getStartPort()
*/ */
public T startPort(int startPort) { public T startPort(int startPort) {
@ -131,18 +128,18 @@ public class IngressRule implements Comparable<IngressRule> {
public IngressRule build() { public IngressRule build() {
return new IngressRule(account, CIDR, endPort, ICMPCode, ICMPType, protocol, id, securityGroupName, startPort); return new IngressRule(account, CIDR, endPort, ICMPCode, ICMPType, protocol, id, securityGroupName, startPort);
} }
public T fromIngressRule(IngressRule in) { public T fromIngressRule(IngressRule in) {
return this return this
.account(in.getAccount()) .account(in.getAccount())
.CIDR(in.getCIDR()) .CIDR(in.getCIDR())
.endPort(in.getEndPort()) .endPort(in.getEndPort())
.ICMPCode(in.getICMPCode()) .ICMPCode(in.getICMPCode())
.ICMPType(in.getICMPType()) .ICMPType(in.getICMPType())
.protocol(in.getProtocol()) .protocol(in.getProtocol())
.id(in.getId()) .id(in.getId())
.securityGroupName(in.getSecurityGroupName()) .securityGroupName(in.getSecurityGroupName())
.startPort(in.getStartPort()); .startPort(in.getStartPort());
} }
} }
@ -154,24 +151,17 @@ public class IngressRule implements Comparable<IngressRule> {
} }
private final String account; private final String account;
@Named("cidr")
private final String CIDR; private final String CIDR;
@Named("endport")
private final int endPort; private final int endPort;
@Named("icmpcode")
private final int ICMPCode; private final int ICMPCode;
@Named("icmptype")
private final int ICMPType; private final int ICMPType;
private final String protocol; private final String protocol;
@Named("ruleid")
private final String id; private final String id;
@Named("securitygroupname")
private final String securityGroupName; private final String securityGroupName;
@Named("startport")
private final int startPort; private final int startPort;
@ConstructorProperties({ @ConstructorProperties({
"account", "cidr", "endport", "icmpcode", "icmptype", "protocol", "ruleid", "securitygroupname", "startport" "account", "cidr", "endport", "icmpcode", "icmptype", "protocol", "ruleid", "securitygroupname", "startport"
}) })
protected IngressRule(@Nullable String account, @Nullable String CIDR, int endPort, int ICMPCode, int ICMPType, protected IngressRule(@Nullable String account, @Nullable String CIDR, int endPort, int ICMPCode, int ICMPType,
@Nullable String protocol, String id, @Nullable String securityGroupName, int startPort) { @Nullable String protocol, String id, @Nullable String securityGroupName, int startPort) {
@ -264,22 +254,22 @@ public class IngressRule implements Comparable<IngressRule> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
IngressRule that = IngressRule.class.cast(obj); IngressRule that = IngressRule.class.cast(obj);
return Objects.equal(this.account, that.account) return Objects.equal(this.account, that.account)
&& Objects.equal(this.CIDR, that.CIDR) && Objects.equal(this.CIDR, that.CIDR)
&& Objects.equal(this.endPort, that.endPort) && Objects.equal(this.endPort, that.endPort)
&& Objects.equal(this.ICMPCode, that.ICMPCode) && Objects.equal(this.ICMPCode, that.ICMPCode)
&& Objects.equal(this.ICMPType, that.ICMPType) && Objects.equal(this.ICMPType, that.ICMPType)
&& Objects.equal(this.protocol, that.protocol) && Objects.equal(this.protocol, that.protocol)
&& Objects.equal(this.id, that.id) && Objects.equal(this.id, that.id)
&& Objects.equal(this.securityGroupName, that.securityGroupName) && Objects.equal(this.securityGroupName, that.securityGroupName)
&& Objects.equal(this.startPort, that.startPort); && Objects.equal(this.startPort, that.startPort);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("account", account).add("CIDR", CIDR).add("endPort", endPort).add("ICMPCode", ICMPCode) .add("account", account).add("CIDR", CIDR).add("endPort", endPort).add("ICMPCode", ICMPCode)
.add("ICMPType", ICMPType).add("protocol", protocol).add("id", id).add("securityGroupName", securityGroupName).add("startPort", startPort); .add("ICMPType", ICMPType).add("protocol", protocol).add("id", id).add("securityGroupName", securityGroupName).add("startPort", startPort);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -29,29 +27,29 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* The result of an operation. * The result of an operation.
* * <p/>
* A handful of Cloudstack API calls return this structure when there is no domain model data to return - for example, * A handful of Cloudstack API calls return this structure when there is no domain model data to return - for example,
* when deleting an object. * when deleting an object.
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class JobResult { public class JobResult {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromJobResult(this); return new ConcreteBuilder().fromJobResult(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected boolean success; protected boolean success;
protected String displayText; protected String displayText;
/** /**
* @see JobResult#isSuccess() * @see JobResult#isSuccess()
*/ */
public T success(boolean success) { public T success(boolean success) {
@ -59,7 +57,7 @@ public class JobResult {
return self(); return self();
} }
/** /**
* @see JobResult#getDisplayText() * @see JobResult#getDisplayText()
*/ */
public T displayText(String displayText) { public T displayText(String displayText) {
@ -70,11 +68,11 @@ public class JobResult {
public JobResult build() { public JobResult build() {
return new JobResult(success, displayText); return new JobResult(success, displayText);
} }
public T fromJobResult(JobResult in) { public T fromJobResult(JobResult in) {
return this return this
.success(in.isSuccess()) .success(in.isSuccess())
.displayText(in.getDisplayText()); .displayText(in.getDisplayText());
} }
} }
@ -86,11 +84,10 @@ public class JobResult {
} }
private final boolean success; private final boolean success;
@Named("displaytext")
private final String displayText; private final String displayText;
@ConstructorProperties({ @ConstructorProperties({
"success", "displaytext" "success", "displaytext"
}) })
protected JobResult(boolean success, @Nullable String displayText) { protected JobResult(boolean success, @Nullable String displayText) {
this.success = success; this.success = success;
@ -117,13 +114,13 @@ public class JobResult {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
JobResult that = JobResult.class.cast(obj); JobResult that = JobResult.class.cast(obj);
return Objects.equal(this.success, that.success) return Objects.equal(this.success, that.success)
&& Objects.equal(this.displayText, that.displayText); && Objects.equal(this.displayText, that.displayText);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this).add("success", success).add("displayText", displayText); return Objects.toStringHelper(this).add("success", success).add("displayText", displayText);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -34,58 +32,58 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Class LoadBalancerRule * Class LoadBalancerRule
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class LoadBalancerRule { public class LoadBalancerRule {
/** /**
*/ */
public static enum State { public static enum State {
ADD, ACTIVE, UNRECOGNIZED; ADD, ACTIVE, UNRECOGNIZED;
@Override @Override
public String toString() { public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
} }
public static State fromValue(String state) { public static State fromValue(String state) {
try { try {
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNRECOGNIZED; return UNRECOGNIZED;
}
} }
}
} }
public static enum Algorithm { public static enum Algorithm {
SOURCE, ROUNDROBIN, LEASTCONN, UNRECOGNIZED; SOURCE, ROUNDROBIN, LEASTCONN, UNRECOGNIZED;
@Override @Override
public String toString() { public String toString() {
return name().toLowerCase(); return name().toLowerCase();
} }
public static Algorithm fromValue(String algorithm) { public static Algorithm fromValue(String algorithm) {
try { try {
return Algorithm.valueOf(checkNotNull(algorithm, "algorithm").toUpperCase()); return Algorithm.valueOf(checkNotNull(algorithm, "algorithm").toUpperCase());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNRECOGNIZED; return UNRECOGNIZED;
}
} }
}
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromLoadBalancerRule(this); return new ConcreteBuilder().fromLoadBalancerRule(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -102,8 +100,8 @@ public class LoadBalancerRule {
protected LoadBalancerRule.State state; protected LoadBalancerRule.State state;
protected Set<String> CIDRs = ImmutableSet.of(); protected Set<String> CIDRs = ImmutableSet.of();
protected String zoneId; protected String zoneId;
/** /**
* @see LoadBalancerRule#getId() * @see LoadBalancerRule#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -111,7 +109,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getAccount() * @see LoadBalancerRule#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -119,7 +117,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getAlgorithm() * @see LoadBalancerRule#getAlgorithm()
*/ */
public T algorithm(LoadBalancerRule.Algorithm algorithm) { public T algorithm(LoadBalancerRule.Algorithm algorithm) {
@ -127,7 +125,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getDescription() * @see LoadBalancerRule#getDescription()
*/ */
public T description(String description) { public T description(String description) {
@ -135,7 +133,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getDomain() * @see LoadBalancerRule#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -143,7 +141,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getDomainId() * @see LoadBalancerRule#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -151,7 +149,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getName() * @see LoadBalancerRule#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -159,7 +157,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getPrivatePort() * @see LoadBalancerRule#getPrivatePort()
*/ */
public T privatePort(int privatePort) { public T privatePort(int privatePort) {
@ -167,7 +165,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getPublicIP() * @see LoadBalancerRule#getPublicIP()
*/ */
public T publicIP(String publicIP) { public T publicIP(String publicIP) {
@ -175,7 +173,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getPublicIPId() * @see LoadBalancerRule#getPublicIPId()
*/ */
public T publicIPId(String publicIPId) { public T publicIPId(String publicIPId) {
@ -183,7 +181,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getPublicPort() * @see LoadBalancerRule#getPublicPort()
*/ */
public T publicPort(int publicPort) { public T publicPort(int publicPort) {
@ -191,7 +189,7 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getState() * @see LoadBalancerRule#getState()
*/ */
public T state(LoadBalancerRule.State state) { public T state(LoadBalancerRule.State state) {
@ -199,11 +197,11 @@ public class LoadBalancerRule {
return self(); return self();
} }
/** /**
* @see LoadBalancerRule#getCIDRs() * @see LoadBalancerRule#getCIDRs()
*/ */
public T CIDRs(Set<String> CIDRs) { public T CIDRs(Set<String> CIDRs) {
this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs"));
return self(); return self();
} }
@ -211,7 +209,7 @@ public class LoadBalancerRule {
return CIDRs(ImmutableSet.copyOf(in)); return CIDRs(ImmutableSet.copyOf(in));
} }
/** /**
* @see LoadBalancerRule#getZoneId() * @see LoadBalancerRule#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -222,23 +220,23 @@ public class LoadBalancerRule {
public LoadBalancerRule build() { public LoadBalancerRule build() {
return new LoadBalancerRule(id, account, algorithm, description, domain, domainId, name, privatePort, publicIP, publicIPId, publicPort, state, CIDRs, zoneId); return new LoadBalancerRule(id, account, algorithm, description, domain, domainId, name, privatePort, publicIP, publicIPId, publicPort, state, CIDRs, zoneId);
} }
public T fromLoadBalancerRule(LoadBalancerRule in) { public T fromLoadBalancerRule(LoadBalancerRule in) {
return this return this
.id(in.getId()) .id(in.getId())
.account(in.getAccount()) .account(in.getAccount())
.algorithm(in.getAlgorithm()) .algorithm(in.getAlgorithm())
.description(in.getDescription()) .description(in.getDescription())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.name(in.getName()) .name(in.getName())
.privatePort(in.getPrivatePort()) .privatePort(in.getPrivatePort())
.publicIP(in.getPublicIP()) .publicIP(in.getPublicIP())
.publicIPId(in.getPublicIPId()) .publicIPId(in.getPublicIPId())
.publicPort(in.getPublicPort()) .publicPort(in.getPublicPort())
.state(in.getState()) .state(in.getState())
.CIDRs(in.getCIDRs()) .CIDRs(in.getCIDRs())
.zoneId(in.getZoneId()); .zoneId(in.getZoneId());
} }
} }
@ -254,29 +252,39 @@ public class LoadBalancerRule {
private final LoadBalancerRule.Algorithm algorithm; private final LoadBalancerRule.Algorithm algorithm;
private final String description; private final String description;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
private final String name; private final String name;
@Named("privateport")
private final int privatePort; private final int privatePort;
@Named("publicip")
private final String publicIP; private final String publicIP;
@Named("publicipid")
private final String publicIPId; private final String publicIPId;
@Named("publicport")
private final int publicPort; private final int publicPort;
private final LoadBalancerRule.State state; private final LoadBalancerRule.State state;
@Named("cidrlist")
private final Set<String> CIDRs; private final Set<String> CIDRs;
private final String zoneId; private final String zoneId;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "algorithm", "description", "domain", "domainid", "name", "privateport", "publicip", "publicipid", "publicport", "state", "cidrlist", "zoneId" "id", "account", "algorithm", "description", "domain", "domainid", "name", "privateport", "publicip",
"publicipid", "publicport", "state", "cidrlist", "zoneId"
}) })
@SuppressWarnings("unused")
private LoadBalancerRule(String id, @Nullable String account, @Nullable Algorithm algorithm,
@Nullable String description, @Nullable String domain, @Nullable String domainId,
@Nullable String name, int privatePort, @Nullable String publicIP,
@Nullable String publicIPId, int publicPort, @Nullable State state,
@Nullable String CIDRs, @Nullable String zoneId) {
this(id, account, algorithm, description, domain, domainId, name, privatePort, publicIP, publicIPId, publicPort, state,
splitStringOnCommas(CIDRs), zoneId);
}
private static Set<String> splitStringOnCommas(String in) {
return in == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(in.split(","));
}
protected LoadBalancerRule(String id, @Nullable String account, @Nullable LoadBalancerRule.Algorithm algorithm, protected LoadBalancerRule(String id, @Nullable String account, @Nullable LoadBalancerRule.Algorithm algorithm,
@Nullable String description, @Nullable String domain, @Nullable String domainId, @Nullable String name, @Nullable String description, @Nullable String domain, @Nullable String domainId, @Nullable String name,
int privatePort, @Nullable String publicIP, @Nullable String publicIPId, int publicPort, int privatePort, @Nullable String publicIP, @Nullable String publicIPId, int publicPort,
@Nullable LoadBalancerRule.State state, @Nullable Set<String> CIDRs, @Nullable String zoneId) { @Nullable LoadBalancerRule.State state, @Nullable Iterable<String> CIDRs, @Nullable String zoneId) {
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
this.account = account; this.account = account;
this.algorithm = algorithm; this.algorithm = algorithm;
@ -289,7 +297,7 @@ public class LoadBalancerRule {
this.publicIPId = publicIPId; this.publicIPId = publicIPId;
this.publicPort = publicPort; this.publicPort = publicPort;
this.state = state; this.state = state;
this.CIDRs = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs); this.CIDRs = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs);
this.zoneId = zoneId; this.zoneId = zoneId;
} }
@ -412,26 +420,26 @@ public class LoadBalancerRule {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
LoadBalancerRule that = LoadBalancerRule.class.cast(obj); LoadBalancerRule that = LoadBalancerRule.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.algorithm, that.algorithm) && Objects.equal(this.algorithm, that.algorithm)
&& Objects.equal(this.description, that.description) && Objects.equal(this.description, that.description)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.privatePort, that.privatePort) && Objects.equal(this.privatePort, that.privatePort)
&& Objects.equal(this.publicIP, that.publicIP) && Objects.equal(this.publicIP, that.publicIP)
&& Objects.equal(this.publicIPId, that.publicIPId) && Objects.equal(this.publicIPId, that.publicIPId)
&& Objects.equal(this.publicPort, that.publicPort) && Objects.equal(this.publicPort, that.publicPort)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.CIDRs, that.CIDRs) && Objects.equal(this.CIDRs, that.CIDRs)
&& Objects.equal(this.zoneId, that.zoneId); && Objects.equal(this.zoneId, that.zoneId);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("account", account).add("algorithm", algorithm).add("description", description).add("domain", domain).add("domainId", domainId).add("name", name).add("privatePort", privatePort).add("publicIP", publicIP).add("publicIPId", publicIPId).add("publicPort", publicPort).add("state", state).add("CIDRs", CIDRs).add("zoneId", zoneId); .add("id", id).add("account", account).add("algorithm", algorithm).add("description", description).add("domain", domain).add("domainId", domainId).add("name", name).add("privatePort", privatePort).add("publicIP", publicIP).add("publicIPId", publicIPId).add("publicPort", publicPort).add("state", state).add("CIDRs", CIDRs).add("zoneId", zoneId);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -29,20 +27,20 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Representation of the login API call response * Representation of the login API call response
* *
* @author Andrei Savu * @author Andrei Savu
*/ */
public class LoginResponse { public class LoginResponse {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromLoginResponse(this); return new ConcreteBuilder().fromLoginResponse(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String username; protected String username;
@ -59,8 +57,8 @@ public class LoginResponse {
protected String timezoneOffset; protected String timezoneOffset;
protected String sessionKey; protected String sessionKey;
protected String jSessionId; protected String jSessionId;
/** /**
* @see LoginResponse#getUsername() * @see LoginResponse#getUsername()
*/ */
public T username(String username) { public T username(String username) {
@ -68,7 +66,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getUserId() * @see LoginResponse#getUserId()
*/ */
public T userId(String userId) { public T userId(String userId) {
@ -76,7 +74,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getPassword() * @see LoginResponse#getPassword()
*/ */
public T password(String password) { public T password(String password) {
@ -84,7 +82,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getDomainId() * @see LoginResponse#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -92,7 +90,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getTimeout() * @see LoginResponse#getTimeout()
*/ */
public T timeout(long timeout) { public T timeout(long timeout) {
@ -100,7 +98,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#isRegistered() * @see LoginResponse#isRegistered()
*/ */
public T registered(boolean registered) { public T registered(boolean registered) {
@ -108,7 +106,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getAccountName() * @see LoginResponse#getAccountName()
*/ */
public T accountName(String accountName) { public T accountName(String accountName) {
@ -116,7 +114,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getFirstName() * @see LoginResponse#getFirstName()
*/ */
public T firstName(String firstName) { public T firstName(String firstName) {
@ -124,7 +122,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getLastName() * @see LoginResponse#getLastName()
*/ */
public T lastName(String lastName) { public T lastName(String lastName) {
@ -132,7 +130,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getAccountType() * @see LoginResponse#getAccountType()
*/ */
public T accountType(Account.Type accountType) { public T accountType(Account.Type accountType) {
@ -140,7 +138,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getTimezone() * @see LoginResponse#getTimezone()
*/ */
public T timezone(String timezone) { public T timezone(String timezone) {
@ -148,7 +146,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getTimezoneOffset() * @see LoginResponse#getTimezoneOffset()
*/ */
public T timezoneOffset(String timezoneOffset) { public T timezoneOffset(String timezoneOffset) {
@ -156,7 +154,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getSessionKey() * @see LoginResponse#getSessionKey()
*/ */
public T sessionKey(String sessionKey) { public T sessionKey(String sessionKey) {
@ -164,7 +162,7 @@ public class LoginResponse {
return self(); return self();
} }
/** /**
* @see LoginResponse#getJSessionId() * @see LoginResponse#getJSessionId()
*/ */
public T jSessionId(String jSessionId) { public T jSessionId(String jSessionId) {
@ -175,23 +173,23 @@ public class LoginResponse {
public LoginResponse build() { public LoginResponse build() {
return new LoginResponse(username, userId, password, domainId, timeout, registered, accountName, firstName, lastName, accountType, timezone, timezoneOffset, sessionKey, jSessionId); return new LoginResponse(username, userId, password, domainId, timeout, registered, accountName, firstName, lastName, accountType, timezone, timezoneOffset, sessionKey, jSessionId);
} }
public T fromLoginResponse(LoginResponse in) { public T fromLoginResponse(LoginResponse in) {
return this return this
.username(in.getUsername()) .username(in.getUsername())
.userId(in.getUserId()) .userId(in.getUserId())
.password(in.getPassword()) .password(in.getPassword())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.timeout(in.getTimeout()) .timeout(in.getTimeout())
.registered(in.isRegistered()) .registered(in.isRegistered())
.accountName(in.getAccountName()) .accountName(in.getAccountName())
.firstName(in.getFirstName()) .firstName(in.getFirstName())
.lastName(in.getLastName()) .lastName(in.getLastName())
.accountType(in.getAccountType()) .accountType(in.getAccountType())
.timezone(in.getTimezone()) .timezone(in.getTimezone())
.timezoneOffset(in.getTimezoneOffset()) .timezoneOffset(in.getTimezoneOffset())
.sessionKey(in.getSessionKey()) .sessionKey(in.getSessionKey())
.jSessionId(in.getJSessionId()); .jSessionId(in.getJSessionId());
} }
} }
@ -203,30 +201,22 @@ public class LoginResponse {
} }
private final String username; private final String username;
@Named("userid")
private final String userId; private final String userId;
private final String password; private final String password;
@Named("domainid")
private final String domainId; private final String domainId;
private final long timeout; private final long timeout;
private final boolean registered; private final boolean registered;
@Named("account")
private final String accountName; private final String accountName;
@Named("firstname")
private final String firstName; private final String firstName;
@Named("lastname")
private final String lastName; private final String lastName;
@Named("type")
private final Account.Type accountType; private final Account.Type accountType;
private final String timezone; private final String timezone;
@Named("timezoneoffset")
private final String timezoneOffset; private final String timezoneOffset;
@Named("sessionkey")
private final String sessionKey; private final String sessionKey;
private final String jSessionId; private final String jSessionId;
@ConstructorProperties({ @ConstructorProperties({
"username", "userid", "password", "domainid", "timeout", "registered", "account", "firstname", "lastname", "type", "timezone", "timezoneoffset", "sessionkey", "jSessionId" "username", "userid", "password", "domainid", "timeout", "registered", "account", "firstname", "lastname", "type", "timezone", "timezoneoffset", "sessionkey", "jSessionId"
}) })
protected LoginResponse(@Nullable String username, @Nullable String userId, @Nullable String password, @Nullable String domainId, long timeout, boolean registered, @Nullable String accountName, @Nullable String firstName, @Nullable String lastName, @Nullable Account.Type accountType, @Nullable String timezone, @Nullable String timezoneOffset, @Nullable String sessionKey, @Nullable String jSessionId) { protected LoginResponse(@Nullable String username, @Nullable String userId, @Nullable String password, @Nullable String domainId, long timeout, boolean registered, @Nullable String accountName, @Nullable String firstName, @Nullable String lastName, @Nullable Account.Type accountType, @Nullable String timezone, @Nullable String timezoneOffset, @Nullable String sessionKey, @Nullable String jSessionId) {
this.username = username; this.username = username;
@ -324,26 +314,26 @@ public class LoginResponse {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
LoginResponse that = LoginResponse.class.cast(obj); LoginResponse that = LoginResponse.class.cast(obj);
return Objects.equal(this.username, that.username) return Objects.equal(this.username, that.username)
&& Objects.equal(this.userId, that.userId) && Objects.equal(this.userId, that.userId)
&& Objects.equal(this.password, that.password) && Objects.equal(this.password, that.password)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.timeout, that.timeout) && Objects.equal(this.timeout, that.timeout)
&& Objects.equal(this.registered, that.registered) && Objects.equal(this.registered, that.registered)
&& Objects.equal(this.accountName, that.accountName) && Objects.equal(this.accountName, that.accountName)
&& Objects.equal(this.firstName, that.firstName) && Objects.equal(this.firstName, that.firstName)
&& Objects.equal(this.lastName, that.lastName) && Objects.equal(this.lastName, that.lastName)
&& Objects.equal(this.accountType, that.accountType) && Objects.equal(this.accountType, that.accountType)
&& Objects.equal(this.timezone, that.timezone) && Objects.equal(this.timezone, that.timezone)
&& Objects.equal(this.timezoneOffset, that.timezoneOffset) && Objects.equal(this.timezoneOffset, that.timezoneOffset)
&& Objects.equal(this.sessionKey, that.sessionKey) && Objects.equal(this.sessionKey, that.sessionKey)
&& Objects.equal(this.jSessionId, that.jSessionId); && Objects.equal(this.jSessionId, that.jSessionId);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("username", username).add("userId", userId).add("password", password).add("domainId", domainId).add("timeout", timeout).add("registered", registered).add("accountName", accountName).add("firstName", firstName).add("lastName", lastName).add("accountType", accountType).add("timezone", timezone).add("timezoneOffset", timezoneOffset).add("sessionKey", sessionKey).add("jSessionId", jSessionId); .add("username", username).add("userId", userId).add("password", password).add("domainId", domainId).add("timeout", timeout).add("registered", registered).add("accountName", accountName).add("firstName", firstName).add("lastName", lastName).add("accountType", accountType).add("timezone", timezone).add("timezoneOffset", timezoneOffset).add("sessionKey", sessionKey).add("jSessionId", jSessionId);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.net.URI; import java.net.URI;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -32,20 +30,20 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class NIC * Class NIC
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class NIC { public class NIC {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromNIC(this); return new ConcreteBuilder().fromNIC(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -59,8 +57,8 @@ public class NIC {
protected String networkId; protected String networkId;
protected TrafficType trafficType; protected TrafficType trafficType;
protected GuestIPType guestIPType; protected GuestIPType guestIPType;
/** /**
* @see NIC#getId() * @see NIC#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -68,7 +66,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#getBroadcastURI() * @see NIC#getBroadcastURI()
*/ */
public T broadcastURI(URI broadcastURI) { public T broadcastURI(URI broadcastURI) {
@ -76,7 +74,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#getGateway() * @see NIC#getGateway()
*/ */
public T gateway(String gateway) { public T gateway(String gateway) {
@ -84,7 +82,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#getIPAddress() * @see NIC#getIPAddress()
*/ */
public T IPAddress(String IPAddress) { public T IPAddress(String IPAddress) {
@ -92,7 +90,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#isDefault() * @see NIC#isDefault()
*/ */
public T isDefault(boolean isDefault) { public T isDefault(boolean isDefault) {
@ -100,7 +98,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#getIsolationURI() * @see NIC#getIsolationURI()
*/ */
public T isolationURI(URI isolationURI) { public T isolationURI(URI isolationURI) {
@ -108,7 +106,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#getNetmask() * @see NIC#getNetmask()
*/ */
public T netmask(String netmask) { public T netmask(String netmask) {
@ -116,7 +114,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#getMacAddress() * @see NIC#getMacAddress()
*/ */
public T macAddress(String macAddress) { public T macAddress(String macAddress) {
@ -124,7 +122,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#getNetworkId() * @see NIC#getNetworkId()
*/ */
public T networkId(String networkId) { public T networkId(String networkId) {
@ -132,7 +130,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#getTrafficType() * @see NIC#getTrafficType()
*/ */
public T trafficType(TrafficType trafficType) { public T trafficType(TrafficType trafficType) {
@ -140,7 +138,7 @@ public class NIC {
return self(); return self();
} }
/** /**
* @see NIC#getGuestIPType() * @see NIC#getGuestIPType()
*/ */
public T guestIPType(GuestIPType guestIPType) { public T guestIPType(GuestIPType guestIPType) {
@ -151,20 +149,20 @@ public class NIC {
public NIC build() { public NIC build() {
return new NIC(id, broadcastURI, gateway, IPAddress, isDefault, isolationURI, netmask, macAddress, networkId, trafficType, guestIPType); return new NIC(id, broadcastURI, gateway, IPAddress, isDefault, isolationURI, netmask, macAddress, networkId, trafficType, guestIPType);
} }
public T fromNIC(NIC in) { public T fromNIC(NIC in) {
return this return this
.id(in.getId()) .id(in.getId())
.broadcastURI(in.getBroadcastURI()) .broadcastURI(in.getBroadcastURI())
.gateway(in.getGateway()) .gateway(in.getGateway())
.IPAddress(in.getIPAddress()) .IPAddress(in.getIPAddress())
.isDefault(in.isDefault()) .isDefault(in.isDefault())
.isolationURI(in.getIsolationURI()) .isolationURI(in.getIsolationURI())
.netmask(in.getNetmask()) .netmask(in.getNetmask())
.macAddress(in.getMacAddress()) .macAddress(in.getMacAddress())
.networkId(in.getNetworkId()) .networkId(in.getNetworkId())
.trafficType(in.getTrafficType()) .trafficType(in.getTrafficType())
.guestIPType(in.getGuestIPType()); .guestIPType(in.getGuestIPType());
} }
} }
@ -176,27 +174,19 @@ public class NIC {
} }
private final String id; private final String id;
@Named("broadcasturi")
private final URI broadcastURI; private final URI broadcastURI;
private final String gateway; private final String gateway;
@Named("ipaddress")
private final String IPAddress; private final String IPAddress;
@Named("isdefault")
private final boolean isDefault; private final boolean isDefault;
@Named("isolationuri")
private final URI isolationURI; private final URI isolationURI;
private final String netmask; private final String netmask;
@Named("macaddress")
private final String macAddress; private final String macAddress;
@Named("networkid")
private final String networkId; private final String networkId;
@Named("traffictype")
private final TrafficType trafficType; private final TrafficType trafficType;
@Named("type")
private final GuestIPType guestIPType; private final GuestIPType guestIPType;
@ConstructorProperties({ @ConstructorProperties({
"id", "broadcasturi", "gateway", "ipaddress", "isdefault", "isolationuri", "netmask", "macaddress", "networkid", "traffictype", "type" "id", "broadcasturi", "gateway", "ipaddress", "isdefault", "isolationuri", "netmask", "macaddress", "networkid", "traffictype", "type"
}) })
protected NIC(String id, @Nullable URI broadcastURI, @Nullable String gateway, @Nullable String IPAddress, boolean isDefault, protected NIC(String id, @Nullable URI broadcastURI, @Nullable String gateway, @Nullable String IPAddress, boolean isDefault,
@Nullable URI isolationURI, @Nullable String netmask, @Nullable String macAddress, @Nullable String networkId, @Nullable URI isolationURI, @Nullable String netmask, @Nullable String macAddress, @Nullable String networkId,
@ -311,25 +301,25 @@ public class NIC {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
NIC that = NIC.class.cast(obj); NIC that = NIC.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.broadcastURI, that.broadcastURI) && Objects.equal(this.broadcastURI, that.broadcastURI)
&& Objects.equal(this.gateway, that.gateway) && Objects.equal(this.gateway, that.gateway)
&& Objects.equal(this.IPAddress, that.IPAddress) && Objects.equal(this.IPAddress, that.IPAddress)
&& Objects.equal(this.isDefault, that.isDefault) && Objects.equal(this.isDefault, that.isDefault)
&& Objects.equal(this.isolationURI, that.isolationURI) && Objects.equal(this.isolationURI, that.isolationURI)
&& Objects.equal(this.netmask, that.netmask) && Objects.equal(this.netmask, that.netmask)
&& Objects.equal(this.macAddress, that.macAddress) && Objects.equal(this.macAddress, that.macAddress)
&& Objects.equal(this.networkId, that.networkId) && Objects.equal(this.networkId, that.networkId)
&& Objects.equal(this.trafficType, that.trafficType) && Objects.equal(this.trafficType, that.trafficType)
&& Objects.equal(this.guestIPType, that.guestIPType); && Objects.equal(this.guestIPType, that.guestIPType);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("broadcastURI", broadcastURI).add("gateway", gateway).add("IPAddress", IPAddress) .add("id", id).add("broadcastURI", broadcastURI).add("gateway", gateway).add("IPAddress", IPAddress)
.add("isDefault", isDefault).add("isolationURI", isolationURI).add("netmask", netmask).add("macAddress", macAddress) .add("isDefault", isDefault).add("isolationURI", isolationURI).add("netmask", netmask).add("macAddress", macAddress)
.add("networkId", networkId).add("trafficType", trafficType).add("guestIPType", guestIPType); .add("networkId", networkId).add("trafficType", trafficType).add("guestIPType", guestIPType);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -25,8 +25,6 @@ import java.net.URI;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -36,20 +34,20 @@ import com.google.common.collect.ImmutableSortedSet;
/** /**
* Class Network * Class Network
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class Network { public class Network {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromNetwork(this); return new ConcreteBuilder().fromNetwork(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -83,8 +81,8 @@ public class Network {
protected String tags; protected String tags;
protected boolean securityGroupEnabled; protected boolean securityGroupEnabled;
protected Set<? extends NetworkService> services = ImmutableSortedSet.of(); protected Set<? extends NetworkService> services = ImmutableSortedSet.of();
/** /**
* @see Network#getId() * @see Network#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -92,7 +90,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getAccount() * @see Network#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -100,7 +98,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getBroadcastDomainType() * @see Network#getBroadcastDomainType()
*/ */
public T broadcastDomainType(String broadcastDomainType) { public T broadcastDomainType(String broadcastDomainType) {
@ -108,7 +106,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getBroadcastURI() * @see Network#getBroadcastURI()
*/ */
public T broadcastURI(URI broadcastURI) { public T broadcastURI(URI broadcastURI) {
@ -116,7 +114,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getDisplayText() * @see Network#getDisplayText()
*/ */
public T displayText(String displayText) { public T displayText(String displayText) {
@ -132,7 +130,8 @@ public class Network {
if (DNS.size() > 1) this.DNS2 = DNS.get(1); if (DNS.size() > 1) this.DNS2 = DNS.get(1);
return self(); return self();
} }
/**
/**
* @see Network#getDomain() * @see Network#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -140,7 +139,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getDomainId() * @see Network#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -148,7 +147,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getEndIP() * @see Network#getEndIP()
*/ */
public T endIP(String endIP) { public T endIP(String endIP) {
@ -156,7 +155,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getGateway() * @see Network#getGateway()
*/ */
public T gateway(String gateway) { public T gateway(String gateway) {
@ -164,7 +163,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#isDefault() * @see Network#isDefault()
*/ */
public T isDefault(boolean isDefault) { public T isDefault(boolean isDefault) {
@ -172,7 +171,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#isShared() * @see Network#isShared()
*/ */
public T isShared(boolean isShared) { public T isShared(boolean isShared) {
@ -180,7 +179,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#isSystem() * @see Network#isSystem()
*/ */
public T isSystem(boolean isSystem) { public T isSystem(boolean isSystem) {
@ -188,7 +187,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getNetmask() * @see Network#getNetmask()
*/ */
public T netmask(String netmask) { public T netmask(String netmask) {
@ -196,7 +195,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getNetworkDomain() * @see Network#getNetworkDomain()
*/ */
public T networkDomain(String networkDomain) { public T networkDomain(String networkDomain) {
@ -204,7 +203,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getNetworkOfferingAvailability() * @see Network#getNetworkOfferingAvailability()
*/ */
public T networkOfferingAvailability(String networkOfferingAvailability) { public T networkOfferingAvailability(String networkOfferingAvailability) {
@ -212,7 +211,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getNetworkOfferingDisplayText() * @see Network#getNetworkOfferingDisplayText()
*/ */
public T networkOfferingDisplayText(String networkOfferingDisplayText) { public T networkOfferingDisplayText(String networkOfferingDisplayText) {
@ -220,7 +219,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getNetworkOfferingId() * @see Network#getNetworkOfferingId()
*/ */
public T networkOfferingId(String networkOfferingId) { public T networkOfferingId(String networkOfferingId) {
@ -228,7 +227,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getNetworkOfferingName() * @see Network#getNetworkOfferingName()
*/ */
public T networkOfferingName(String networkOfferingName) { public T networkOfferingName(String networkOfferingName) {
@ -236,7 +235,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getRelated() * @see Network#getRelated()
*/ */
public T related(String related) { public T related(String related) {
@ -244,7 +243,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getStartIP() * @see Network#getStartIP()
*/ */
public T startIP(String startIP) { public T startIP(String startIP) {
@ -252,7 +251,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getName() * @see Network#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -260,7 +259,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getState() * @see Network#getState()
*/ */
public T state(String state) { public T state(String state) {
@ -268,7 +267,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getGuestIPType() * @see Network#getGuestIPType()
*/ */
public T guestIPType(GuestIPType guestIPType) { public T guestIPType(GuestIPType guestIPType) {
@ -276,7 +275,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getVLAN() * @see Network#getVLAN()
*/ */
public T VLAN(String VLAN) { public T VLAN(String VLAN) {
@ -284,7 +283,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getTrafficType() * @see Network#getTrafficType()
*/ */
public T trafficType(TrafficType trafficType) { public T trafficType(TrafficType trafficType) {
@ -292,7 +291,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getZoneId() * @see Network#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -300,7 +299,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getTags() * @see Network#getTags()
*/ */
public T tags(String tags) { public T tags(String tags) {
@ -308,7 +307,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#isSecurityGroupEnabled() * @see Network#isSecurityGroupEnabled()
*/ */
public T securityGroupEnabled(boolean securityGroupEnabled) { public T securityGroupEnabled(boolean securityGroupEnabled) {
@ -316,7 +315,7 @@ public class Network {
return self(); return self();
} }
/** /**
* @see Network#getServices() * @see Network#getServices()
*/ */
public T services(Set<? extends NetworkService> services) { public T services(Set<? extends NetworkService> services) {
@ -327,39 +326,39 @@ public class Network {
public Network build() { public Network build() {
return new Network(id, account, broadcastDomainType, broadcastURI, displayText, DNS1, DNS2, domain, domainId, endIP, gateway, isDefault, isShared, isSystem, netmask, networkDomain, networkOfferingAvailability, networkOfferingDisplayText, networkOfferingId, networkOfferingName, related, startIP, name, state, guestIPType, VLAN, trafficType, zoneId, tags, securityGroupEnabled, services); return new Network(id, account, broadcastDomainType, broadcastURI, displayText, DNS1, DNS2, domain, domainId, endIP, gateway, isDefault, isShared, isSystem, netmask, networkDomain, networkOfferingAvailability, networkOfferingDisplayText, networkOfferingId, networkOfferingName, related, startIP, name, state, guestIPType, VLAN, trafficType, zoneId, tags, securityGroupEnabled, services);
} }
public T fromNetwork(Network in) { public T fromNetwork(Network in) {
return this return this
.id(in.getId()) .id(in.getId())
.account(in.getAccount()) .account(in.getAccount())
.broadcastDomainType(in.getBroadcastDomainType()) .broadcastDomainType(in.getBroadcastDomainType())
.broadcastURI(in.getBroadcastURI()) .broadcastURI(in.getBroadcastURI())
.displayText(in.getDisplayText()) .displayText(in.getDisplayText())
.DNS(in.getDNS()) .DNS(in.getDNS())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.endIP(in.getEndIP()) .endIP(in.getEndIP())
.gateway(in.getGateway()) .gateway(in.getGateway())
.isDefault(in.isDefault()) .isDefault(in.isDefault())
.isShared(in.isShared()) .isShared(in.isShared())
.isSystem(in.isSystem()) .isSystem(in.isSystem())
.netmask(in.getNetmask()) .netmask(in.getNetmask())
.networkDomain(in.getNetworkDomain()) .networkDomain(in.getNetworkDomain())
.networkOfferingAvailability(in.getNetworkOfferingAvailability()) .networkOfferingAvailability(in.getNetworkOfferingAvailability())
.networkOfferingDisplayText(in.getNetworkOfferingDisplayText()) .networkOfferingDisplayText(in.getNetworkOfferingDisplayText())
.networkOfferingId(in.getNetworkOfferingId()) .networkOfferingId(in.getNetworkOfferingId())
.networkOfferingName(in.getNetworkOfferingName()) .networkOfferingName(in.getNetworkOfferingName())
.related(in.getRelated()) .related(in.getRelated())
.startIP(in.getStartIP()) .startIP(in.getStartIP())
.name(in.getName()) .name(in.getName())
.state(in.getState()) .state(in.getState())
.guestIPType(in.getGuestIPType()) .guestIPType(in.getGuestIPType())
.VLAN(in.getVLAN()) .VLAN(in.getVLAN())
.trafficType(in.getTrafficType()) .trafficType(in.getTrafficType())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.tags(in.getTags()) .tags(in.getTags())
.securityGroupEnabled(in.isSecurityGroupEnabled()) .securityGroupEnabled(in.isSecurityGroupEnabled())
.services(in.getServices()); .services(in.getServices());
} }
} }
@ -372,60 +371,38 @@ public class Network {
private final String id; private final String id;
private final String account; private final String account;
@Named("broadcastdomaintype")
private final String broadcastDomainType; private final String broadcastDomainType;
@Named("broadcasturi")
private final URI broadcastURI; private final URI broadcastURI;
@Named("displaytext")
private final String displayText; private final String displayText;
@Named("dns1")
private final String DNS1; private final String DNS1;
@Named("dns2")
private final String DNS2; private final String DNS2;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("endip")
private final String endIP; private final String endIP;
private final String gateway; private final String gateway;
@Named("isdefault")
private final boolean isDefault; private final boolean isDefault;
@Named("isshared")
private final boolean isShared; private final boolean isShared;
@Named("issystem")
private final boolean isSystem; private final boolean isSystem;
private final String netmask; private final String netmask;
@Named("networkdomain")
private final String networkDomain; private final String networkDomain;
@Named("networkofferingavailability")
private final String networkOfferingAvailability; private final String networkOfferingAvailability;
@Named("networkofferingdisplaytext")
private final String networkOfferingDisplayText; private final String networkOfferingDisplayText;
@Named("networkofferingid")
private final String networkOfferingId; private final String networkOfferingId;
@Named("networkofferingname")
private final String networkOfferingName; private final String networkOfferingName;
private final String related; private final String related;
@Named("startip")
private final String startIP; private final String startIP;
private final String name; private final String name;
private final String state; private final String state;
@Named("type")
private final GuestIPType guestIPType; private final GuestIPType guestIPType;
@Named("vlan")
private final String VLAN; private final String VLAN;
@Named("traffictype")
private final TrafficType trafficType; private final TrafficType trafficType;
@Named("zoneid")
private final String zoneId; private final String zoneId;
private final String tags; private final String tags;
@Named("securitygroupenabled")
private final boolean securityGroupEnabled; private final boolean securityGroupEnabled;
@Named("service")
private final Set<? extends NetworkService> services; private final Set<? extends NetworkService> services;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "broadcastdomaintype", "broadcasturi", "displaytext", "dns1", "dns2", "domain", "domainid", "endip", "gateway", "isdefault", "isshared", "issystem", "netmask", "networkdomain", "networkofferingavailability", "networkofferingdisplaytext", "networkofferingid", "networkofferingname", "related", "startip", "name", "state", "type", "vlan", "traffictype", "zoneid", "tags", "securitygroupenabled", "service" "id", "account", "broadcastdomaintype", "broadcasturi", "displaytext", "dns1", "dns2", "domain", "domainid", "endip", "gateway", "isdefault", "isshared", "issystem", "netmask", "networkdomain", "networkofferingavailability", "networkofferingdisplaytext", "networkofferingid", "networkofferingname", "related", "startip", "name", "state", "type", "vlan", "traffictype", "zoneid", "tags", "securitygroupenabled", "service"
}) })
protected Network(String id, @Nullable String account, @Nullable String broadcastDomainType, @Nullable URI broadcastURI, protected Network(String id, @Nullable String account, @Nullable String broadcastDomainType, @Nullable URI broadcastURI,
@Nullable String displayText, @Nullable String DNS1, @Nullable String DNS2, @Nullable String domain, @Nullable String domainId, @Nullable String displayText, @Nullable String DNS1, @Nullable String DNS2, @Nullable String domain, @Nullable String domainId,
@ -713,38 +690,38 @@ public class Network {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
Network that = Network.class.cast(obj); Network that = Network.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.broadcastDomainType, that.broadcastDomainType) && Objects.equal(this.broadcastDomainType, that.broadcastDomainType)
&& Objects.equal(this.broadcastURI, that.broadcastURI) && Objects.equal(this.broadcastURI, that.broadcastURI)
&& Objects.equal(this.displayText, that.displayText) && Objects.equal(this.displayText, that.displayText)
&& Objects.equal(this.DNS1, that.DNS1) && Objects.equal(this.DNS1, that.DNS1)
&& Objects.equal(this.DNS2, that.DNS2) && Objects.equal(this.DNS2, that.DNS2)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.endIP, that.endIP) && Objects.equal(this.endIP, that.endIP)
&& Objects.equal(this.gateway, that.gateway) && Objects.equal(this.gateway, that.gateway)
&& Objects.equal(this.isDefault, that.isDefault) && Objects.equal(this.isDefault, that.isDefault)
&& Objects.equal(this.isShared, that.isShared) && Objects.equal(this.isShared, that.isShared)
&& Objects.equal(this.isSystem, that.isSystem) && Objects.equal(this.isSystem, that.isSystem)
&& Objects.equal(this.netmask, that.netmask) && Objects.equal(this.netmask, that.netmask)
&& Objects.equal(this.networkDomain, that.networkDomain) && Objects.equal(this.networkDomain, that.networkDomain)
&& Objects.equal(this.networkOfferingAvailability, that.networkOfferingAvailability) && Objects.equal(this.networkOfferingAvailability, that.networkOfferingAvailability)
&& Objects.equal(this.networkOfferingDisplayText, that.networkOfferingDisplayText) && Objects.equal(this.networkOfferingDisplayText, that.networkOfferingDisplayText)
&& Objects.equal(this.networkOfferingId, that.networkOfferingId) && Objects.equal(this.networkOfferingId, that.networkOfferingId)
&& Objects.equal(this.networkOfferingName, that.networkOfferingName) && Objects.equal(this.networkOfferingName, that.networkOfferingName)
&& Objects.equal(this.related, that.related) && Objects.equal(this.related, that.related)
&& Objects.equal(this.startIP, that.startIP) && Objects.equal(this.startIP, that.startIP)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.guestIPType, that.guestIPType) && Objects.equal(this.guestIPType, that.guestIPType)
&& Objects.equal(this.VLAN, that.VLAN) && Objects.equal(this.VLAN, that.VLAN)
&& Objects.equal(this.trafficType, that.trafficType) && Objects.equal(this.trafficType, that.trafficType)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.tags, that.tags) && Objects.equal(this.tags, that.tags)
&& Objects.equal(this.securityGroupEnabled, that.securityGroupEnabled) && Objects.equal(this.securityGroupEnabled, that.securityGroupEnabled)
&& Objects.equal(this.services, that.services); && Objects.equal(this.services, that.services);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("account", account).add("broadcastDomainType", broadcastDomainType).add("broadcastURI", broadcastURI) .add("id", id).add("account", account).add("broadcastDomainType", broadcastDomainType).add("broadcastURI", broadcastURI)
@ -756,7 +733,7 @@ public class Network {
.add("state", state).add("guestIPType", guestIPType).add("VLAN", VLAN).add("trafficType", trafficType) .add("state", state).add("guestIPType", guestIPType).add("VLAN", VLAN).add("trafficType", trafficType)
.add("zoneId", zoneId).add("tags", tags).add("securityGroupEnabled", securityGroupEnabled).add("services", services); .add("zoneId", zoneId).add("tags", tags).add("securityGroupEnabled", securityGroupEnabled).add("services", services);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -32,20 +30,20 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class NetworkOffering * Class NetworkOffering
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class NetworkOffering implements Comparable<NetworkOffering> { public class NetworkOffering implements Comparable<NetworkOffering> {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromNetworkOffering(this); return new ConcreteBuilder().fromNetworkOffering(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -60,8 +58,8 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
protected GuestIPType guestIPType; protected GuestIPType guestIPType;
protected int networkRate; protected int networkRate;
protected String tags; protected String tags;
/** /**
* @see NetworkOffering#getId() * @see NetworkOffering#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -69,7 +67,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#getName() * @see NetworkOffering#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -77,7 +75,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#getDisplayText() * @see NetworkOffering#getDisplayText()
*/ */
public T displayText(String displayText) { public T displayText(String displayText) {
@ -85,7 +83,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#getCreated() * @see NetworkOffering#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -93,7 +91,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#getAvailability() * @see NetworkOffering#getAvailability()
*/ */
public T availability(NetworkOfferingAvailabilityType availability) { public T availability(NetworkOfferingAvailabilityType availability) {
@ -101,7 +99,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#getMaxConnections() * @see NetworkOffering#getMaxConnections()
*/ */
public T maxConnections(Integer maxConnections) { public T maxConnections(Integer maxConnections) {
@ -109,7 +107,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#isDefault() * @see NetworkOffering#isDefault()
*/ */
public T isDefault(boolean isDefault) { public T isDefault(boolean isDefault) {
@ -117,7 +115,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#supportsVLAN() * @see NetworkOffering#supportsVLAN()
*/ */
public T supportsVLAN(boolean supportsVLAN) { public T supportsVLAN(boolean supportsVLAN) {
@ -125,7 +123,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#getTrafficType() * @see NetworkOffering#getTrafficType()
*/ */
public T trafficType(TrafficType trafficType) { public T trafficType(TrafficType trafficType) {
@ -133,7 +131,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#getGuestIPType() * @see NetworkOffering#getGuestIPType()
*/ */
public T guestIPType(GuestIPType guestIPType) { public T guestIPType(GuestIPType guestIPType) {
@ -141,7 +139,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#getNetworkRate() * @see NetworkOffering#getNetworkRate()
*/ */
public T networkRate(int networkRate) { public T networkRate(int networkRate) {
@ -149,7 +147,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
return self(); return self();
} }
/** /**
* @see NetworkOffering#getTags() * @see NetworkOffering#getTags()
*/ */
public T tags(String tags) { public T tags(String tags) {
@ -160,21 +158,21 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
public NetworkOffering build() { public NetworkOffering build() {
return new NetworkOffering(id, name, displayText, created, availability, maxConnections, isDefault, supportsVLAN, trafficType, guestIPType, networkRate, tags); return new NetworkOffering(id, name, displayText, created, availability, maxConnections, isDefault, supportsVLAN, trafficType, guestIPType, networkRate, tags);
} }
public T fromNetworkOffering(NetworkOffering in) { public T fromNetworkOffering(NetworkOffering in) {
return this return this
.id(in.getId()) .id(in.getId())
.name(in.getName()) .name(in.getName())
.displayText(in.getDisplayText()) .displayText(in.getDisplayText())
.created(in.getCreated()) .created(in.getCreated())
.availability(in.getAvailability()) .availability(in.getAvailability())
.maxConnections(in.getMaxConnections()) .maxConnections(in.getMaxConnections())
.isDefault(in.isDefault()) .isDefault(in.isDefault())
.supportsVLAN(in.supportsVLAN()) .supportsVLAN(in.supportsVLAN())
.trafficType(in.getTrafficType()) .trafficType(in.getTrafficType())
.guestIPType(in.getGuestIPType()) .guestIPType(in.getGuestIPType())
.networkRate(in.getNetworkRate()) .networkRate(in.getNetworkRate())
.tags(in.getTags()); .tags(in.getTags());
} }
} }
@ -187,26 +185,19 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
private final String id; private final String id;
private final String name; private final String name;
@Named("displaytext")
private final String displayText; private final String displayText;
private final Date created; private final Date created;
private final NetworkOfferingAvailabilityType availability; private final NetworkOfferingAvailabilityType availability;
@Named("maxconnections")
private final Integer maxConnections; private final Integer maxConnections;
@Named("isdefault")
private final boolean isDefault; private final boolean isDefault;
@Named("specifyvlan")
private final boolean supportsVLAN; private final boolean supportsVLAN;
@Named("traffictype")
private final TrafficType trafficType; private final TrafficType trafficType;
@Named("guestiptype")
private final GuestIPType guestIPType; private final GuestIPType guestIPType;
@Named("networkrate")
private final int networkRate; private final int networkRate;
private final String tags; private final String tags;
@ConstructorProperties({ @ConstructorProperties({
"id", "name", "displaytext", "created", "availability", "maxconnections", "isdefault", "specifyvlan", "traffictype", "guestiptype", "networkrate", "tags" "id", "name", "displaytext", "created", "availability", "maxconnections", "isdefault", "specifyvlan", "traffictype", "guestiptype", "networkrate", "tags"
}) })
protected NetworkOffering(String id, @Nullable String name, @Nullable String displayText, @Nullable Date created, @Nullable NetworkOfferingAvailabilityType availability, @Nullable Integer maxConnections, boolean isDefault, boolean supportsVLAN, @Nullable TrafficType trafficType, @Nullable GuestIPType guestIPType, int networkRate, @Nullable String tags) { protected NetworkOffering(String id, @Nullable String name, @Nullable String displayText, @Nullable Date created, @Nullable NetworkOfferingAvailabilityType availability, @Nullable Integer maxConnections, boolean isDefault, boolean supportsVLAN, @Nullable TrafficType trafficType, @Nullable GuestIPType guestIPType, int networkRate, @Nullable String tags) {
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
@ -264,7 +255,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
/** /**
* @return the max number of concurrent connection the network offering * @return the max number of concurrent connection the network offering
supports * supports
*/ */
@Nullable @Nullable
public Integer getMaxConnections() { public Integer getMaxConnections() {
@ -327,24 +318,24 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
NetworkOffering that = NetworkOffering.class.cast(obj); NetworkOffering that = NetworkOffering.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.displayText, that.displayText) && Objects.equal(this.displayText, that.displayText)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.availability, that.availability) && Objects.equal(this.availability, that.availability)
&& Objects.equal(this.maxConnections, that.maxConnections) && Objects.equal(this.maxConnections, that.maxConnections)
&& Objects.equal(this.isDefault, that.isDefault) && Objects.equal(this.isDefault, that.isDefault)
&& Objects.equal(this.supportsVLAN, that.supportsVLAN) && Objects.equal(this.supportsVLAN, that.supportsVLAN)
&& Objects.equal(this.trafficType, that.trafficType) && Objects.equal(this.trafficType, that.trafficType)
&& Objects.equal(this.guestIPType, that.guestIPType) && Objects.equal(this.guestIPType, that.guestIPType)
&& Objects.equal(this.networkRate, that.networkRate) && Objects.equal(this.networkRate, that.networkRate)
&& Objects.equal(this.tags, that.tags); && Objects.equal(this.tags, that.tags);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("name", name).add("displayText", displayText).add("created", created).add("availability", availability).add("maxConnections", maxConnections).add("isDefault", isDefault).add("supportsVLAN", supportsVLAN).add("trafficType", trafficType).add("guestIPType", guestIPType).add("networkRate", networkRate).add("tags", tags); .add("id", id).add("name", name).add("displayText", displayText).add("created", created).add("availability", availability).add("maxConnections", maxConnections).add("isDefault", isDefault).add("supportsVLAN", supportsVLAN).add("trafficType", trafficType).add("guestIPType", guestIPType).add("networkRate", networkRate).add("tags", tags);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
/** /**
*
* @author Andrei Savu * @author Andrei Savu
*/ */
public enum NetworkOfferingAvailabilityType { public enum NetworkOfferingAvailabilityType {

View File

@ -24,8 +24,6 @@ import java.beans.ConstructorProperties;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -52,7 +50,7 @@ public class NetworkService implements Comparable<NetworkService> {
return new ConcreteBuilder().fromCapability(this); return new ConcreteBuilder().fromCapability(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String name; protected String name;
@ -83,7 +81,7 @@ public class NetworkService implements Comparable<NetworkService> {
.name(in.getName()) .name(in.getName())
.value(in.getValue()); .value(in.getValue());
} }
} }
private static class ConcreteBuilder extends Builder<ConcreteBuilder> { private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
@ -142,7 +140,7 @@ public class NetworkService implements Comparable<NetworkService> {
return name.compareTo(o.getName()); return name.compareTo(o.getName());
} }
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
@ -194,7 +192,6 @@ public class NetworkService implements Comparable<NetworkService> {
} }
private final String name; private final String name;
@Named("capability")
private final Set<Capability> capabilities; private final Set<Capability> capabilities;
@ConstructorProperties({ @ConstructorProperties({
@ -217,7 +214,7 @@ public class NetworkService implements Comparable<NetworkService> {
} }
return returnVal.build(); return returnVal.build();
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(name, capabilities); return Objects.hashCode(name, capabilities);

View File

@ -25,7 +25,6 @@ import org.jclouds.cloudstack.features.TemplateClient;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
/** /**
*
* @author Adrian Cole * @author Adrian Cole
* @see TemplateClient#listZones * @see TemplateClient#listZones
*/ */

View File

@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -44,7 +42,7 @@ public class OSType implements Comparable<OSType> {
return new ConcreteBuilder().fromOSType(this); return new ConcreteBuilder().fromOSType(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -95,7 +93,6 @@ public class OSType implements Comparable<OSType> {
} }
private final String id; private final String id;
@Named("oscategoryid")
private final String OSCategoryId; private final String OSCategoryId;
private final String description; private final String description;

View File

@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -31,20 +29,20 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Represents a Pod in CloudStack. * Represents a Pod in CloudStack.
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class Pod implements Comparable<Pod> { public class Pod implements Comparable<Pod> {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromPod(this); return new ConcreteBuilder().fromPod(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -56,8 +54,8 @@ public class Pod implements Comparable<Pod> {
protected String startIp; protected String startIp;
protected String endIp; protected String endIp;
protected AllocationState allocationState; protected AllocationState allocationState;
/** /**
* @see Pod#getId() * @see Pod#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -65,7 +63,7 @@ public class Pod implements Comparable<Pod> {
return self(); return self();
} }
/** /**
* @see Pod#getName() * @see Pod#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -73,7 +71,7 @@ public class Pod implements Comparable<Pod> {
return self(); return self();
} }
/** /**
* @see Pod#getZoneId() * @see Pod#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -81,7 +79,7 @@ public class Pod implements Comparable<Pod> {
return self(); return self();
} }
/** /**
* @see Pod#getZoneName() * @see Pod#getZoneName()
*/ */
public T zoneName(String zoneName) { public T zoneName(String zoneName) {
@ -89,7 +87,7 @@ public class Pod implements Comparable<Pod> {
return self(); return self();
} }
/** /**
* @see Pod#getGateway() * @see Pod#getGateway()
*/ */
public T gateway(String gateway) { public T gateway(String gateway) {
@ -97,7 +95,7 @@ public class Pod implements Comparable<Pod> {
return self(); return self();
} }
/** /**
* @see Pod#getNetmask() * @see Pod#getNetmask()
*/ */
public T netmask(String netmask) { public T netmask(String netmask) {
@ -105,7 +103,7 @@ public class Pod implements Comparable<Pod> {
return self(); return self();
} }
/** /**
* @see Pod#getStartIp() * @see Pod#getStartIp()
*/ */
public T startIp(String startIp) { public T startIp(String startIp) {
@ -113,7 +111,7 @@ public class Pod implements Comparable<Pod> {
return self(); return self();
} }
/** /**
* @see Pod#getEndIp() * @see Pod#getEndIp()
*/ */
public T endIp(String endIp) { public T endIp(String endIp) {
@ -121,7 +119,7 @@ public class Pod implements Comparable<Pod> {
return self(); return self();
} }
/** /**
* @see Pod#getAllocationState() * @see Pod#getAllocationState()
*/ */
public T allocationState(AllocationState allocationState) { public T allocationState(AllocationState allocationState) {
@ -132,18 +130,18 @@ public class Pod implements Comparable<Pod> {
public Pod build() { public Pod build() {
return new Pod(id, name, zoneId, zoneName, gateway, netmask, startIp, endIp, allocationState); return new Pod(id, name, zoneId, zoneName, gateway, netmask, startIp, endIp, allocationState);
} }
public T fromPod(Pod in) { public T fromPod(Pod in) {
return this return this
.id(in.getId()) .id(in.getId())
.name(in.getName()) .name(in.getName())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.zoneName(in.getZoneName()) .zoneName(in.getZoneName())
.gateway(in.getGateway()) .gateway(in.getGateway())
.netmask(in.getNetmask()) .netmask(in.getNetmask())
.startIp(in.getStartIp()) .startIp(in.getStartIp())
.endIp(in.getEndIp()) .endIp(in.getEndIp())
.allocationState(in.getAllocationState()); .allocationState(in.getAllocationState());
} }
} }
@ -156,21 +154,16 @@ public class Pod implements Comparable<Pod> {
private final String id; private final String id;
private final String name; private final String name;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
private final String gateway; private final String gateway;
private final String netmask; private final String netmask;
@Named("startip")
private final String startIp; private final String startIp;
@Named("endip")
private final String endIp; private final String endIp;
@Named("allocationstate")
private final AllocationState allocationState; private final AllocationState allocationState;
@ConstructorProperties({ @ConstructorProperties({
"id", "name", "zoneid", "zonename", "gateway", "netmask", "startip", "endip", "allocationstate" "id", "name", "zoneid", "zonename", "gateway", "netmask", "startip", "endip", "allocationstate"
}) })
protected Pod(String id, @Nullable String name, @Nullable String zoneId, @Nullable String zoneName, @Nullable String gateway, @Nullable String netmask, @Nullable String startIp, @Nullable String endIp, @Nullable AllocationState allocationState) { protected Pod(String id, @Nullable String name, @Nullable String zoneId, @Nullable String zoneName, @Nullable String gateway, @Nullable String netmask, @Nullable String startIp, @Nullable String endIp, @Nullable AllocationState allocationState) {
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
@ -266,21 +259,21 @@ public class Pod implements Comparable<Pod> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
Pod that = Pod.class.cast(obj); Pod that = Pod.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.zoneName, that.zoneName) && Objects.equal(this.zoneName, that.zoneName)
&& Objects.equal(this.gateway, that.gateway) && Objects.equal(this.gateway, that.gateway)
&& Objects.equal(this.netmask, that.netmask) && Objects.equal(this.netmask, that.netmask)
&& Objects.equal(this.startIp, that.startIp) && Objects.equal(this.startIp, that.startIp)
&& Objects.equal(this.endIp, that.endIp) && Objects.equal(this.endIp, that.endIp)
&& Objects.equal(this.allocationState, that.allocationState); && Objects.equal(this.allocationState, that.allocationState);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("name", name).add("zoneId", zoneId).add("zoneName", zoneName).add("gateway", gateway).add("netmask", netmask).add("startIp", startIp).add("endIp", endIp).add("allocationState", allocationState); .add("id", id).add("name", name).add("zoneId", zoneId).add("zoneName", zoneName).add("gateway", gateway).add("netmask", netmask).add("startIp", startIp).add("endIp", endIp).add("allocationState", allocationState);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -34,9 +32,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Class PortForwardingRule * Class PortForwardingRule
* *
* @author Adrian Cole, Andrei Savu * @author Adrian Cole, Andrei Savu
*/ */
public class PortForwardingRule implements Comparable<PortForwardingRule> { public class PortForwardingRule implements Comparable<PortForwardingRule> {
public static enum Protocol { public static enum Protocol {
@ -61,11 +59,11 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
public static enum State { public static enum State {
STAGED, // Rule been created but has never got through network rule conflict detection. STAGED, // Rule been created but has never got through network rule conflict detection.
// Rules in this state can not be sent to network elements. // Rules in this state can not be sent to network elements.
ADD, // Add means the rule has been created and has gone through network rule conflict detection. ADD, // Add means the rule has been created and has gone through network rule conflict detection.
ACTIVE, // Rule has been sent to the network elements and reported to be active. ACTIVE, // Rule has been sent to the network elements and reported to be active.
DELETING, // Revoke means this rule has been revoked. If this rule has been sent to the DELETING, // Revoke means this rule has been revoked. If this rule has been sent to the
// network elements, the rule will be deleted from database. // network elements, the rule will be deleted from database.
UNKNOWN; UNKNOWN;
public static State fromValue(String value) { public static State fromValue(String value) {
@ -82,15 +80,15 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
} }
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromPortForwardingRule(this); return new ConcreteBuilder().fromPortForwardingRule(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -106,8 +104,8 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
protected Set<String> CIDRs = ImmutableSet.of(); protected Set<String> CIDRs = ImmutableSet.of();
protected int privateEndPort; protected int privateEndPort;
protected int publicEndPort; protected int publicEndPort;
/** /**
* @see PortForwardingRule#getId() * @see PortForwardingRule#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -115,7 +113,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getIPAddress() * @see PortForwardingRule#getIPAddress()
*/ */
public T IPAddress(String IPAddress) { public T IPAddress(String IPAddress) {
@ -123,7 +121,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getIPAddressId() * @see PortForwardingRule#getIPAddressId()
*/ */
public T IPAddressId(String IPAddressId) { public T IPAddressId(String IPAddressId) {
@ -131,7 +129,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getPrivatePort() * @see PortForwardingRule#getPrivatePort()
*/ */
public T privatePort(int privatePort) { public T privatePort(int privatePort) {
@ -139,7 +137,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getProtocol() * @see PortForwardingRule#getProtocol()
*/ */
public T protocol(Protocol protocol) { public T protocol(Protocol protocol) {
@ -147,7 +145,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getPublicPort() * @see PortForwardingRule#getPublicPort()
*/ */
public T publicPort(int publicPort) { public T publicPort(int publicPort) {
@ -155,7 +153,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getState() * @see PortForwardingRule#getState()
*/ */
public T state(State state) { public T state(State state) {
@ -163,7 +161,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getVirtualMachineDisplayName() * @see PortForwardingRule#getVirtualMachineDisplayName()
*/ */
public T virtualMachineDisplayName(String virtualMachineDisplayName) { public T virtualMachineDisplayName(String virtualMachineDisplayName) {
@ -171,7 +169,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getVirtualMachineId() * @see PortForwardingRule#getVirtualMachineId()
*/ */
public T virtualMachineId(String virtualMachineId) { public T virtualMachineId(String virtualMachineId) {
@ -179,7 +177,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getVirtualMachineName() * @see PortForwardingRule#getVirtualMachineName()
*/ */
public T virtualMachineName(String virtualMachineName) { public T virtualMachineName(String virtualMachineName) {
@ -187,11 +185,11 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getCIDRs() * @see PortForwardingRule#getCIDRs()
*/ */
public T CIDRs(Set<String> CIDRs) { public T CIDRs(Set<String> CIDRs) {
this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs"));
return self(); return self();
} }
@ -199,7 +197,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return CIDRs(ImmutableSet.copyOf(in)); return CIDRs(ImmutableSet.copyOf(in));
} }
/** /**
* @see PortForwardingRule#getPrivateEndPort() * @see PortForwardingRule#getPrivateEndPort()
*/ */
public T privateEndPort(int privateEndPort) { public T privateEndPort(int privateEndPort) {
@ -207,7 +205,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return self(); return self();
} }
/** /**
* @see PortForwardingRule#getPublicEndPort() * @see PortForwardingRule#getPublicEndPort()
*/ */
public T publicEndPort(int publicEndPort) { public T publicEndPort(int publicEndPort) {
@ -219,22 +217,22 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return new PortForwardingRule(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state, virtualMachineDisplayName, return new PortForwardingRule(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state, virtualMachineDisplayName,
virtualMachineId, virtualMachineName, CIDRs, privateEndPort, publicEndPort); virtualMachineId, virtualMachineName, CIDRs, privateEndPort, publicEndPort);
} }
public T fromPortForwardingRule(PortForwardingRule in) { public T fromPortForwardingRule(PortForwardingRule in) {
return this return this
.id(in.getId()) .id(in.getId())
.IPAddress(in.getIPAddress()) .IPAddress(in.getIPAddress())
.IPAddressId(in.getIPAddressId()) .IPAddressId(in.getIPAddressId())
.privatePort(in.getPrivatePort()) .privatePort(in.getPrivatePort())
.protocol(in.getProtocol()) .protocol(in.getProtocol())
.publicPort(in.getPublicPort()) .publicPort(in.getPublicPort())
.state(in.getState()) .state(in.getState())
.virtualMachineDisplayName(in.getVirtualMachineDisplayName()) .virtualMachineDisplayName(in.getVirtualMachineDisplayName())
.virtualMachineId(in.getVirtualMachineId()) .virtualMachineId(in.getVirtualMachineId())
.virtualMachineName(in.getVirtualMachineName()) .virtualMachineName(in.getVirtualMachineName())
.CIDRs(in.getCIDRs()) .CIDRs(in.getCIDRs())
.privateEndPort(in.getPrivateEndPort()) .privateEndPort(in.getPrivateEndPort())
.publicEndPort(in.getPublicEndPort()); .publicEndPort(in.getPublicEndPort());
} }
} }
@ -246,33 +244,36 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
} }
private final String id; private final String id;
@Named("ipaddress")
private final String IPAddress; private final String IPAddress;
@Named("ipaddressid")
private final String IPAddressId; private final String IPAddressId;
@Named("privateport")
private final int privatePort; private final int privatePort;
private final PortForwardingRule.Protocol protocol; private final PortForwardingRule.Protocol protocol;
@Named("publicport")
private final int publicPort; private final int publicPort;
private final PortForwardingRule.State state; private final PortForwardingRule.State state;
@Named("virtualmachinedisplayname")
private final String virtualMachineDisplayName; private final String virtualMachineDisplayName;
@Named("virtualmachineid")
private final String virtualMachineId; private final String virtualMachineId;
@Named("virtualmachinename")
private final String virtualMachineName; private final String virtualMachineName;
@Named("cidrlist")
private final Set<String> CIDRs; private final Set<String> CIDRs;
@Named("privateendport")
private final int privateEndPort; private final int privateEndPort;
@Named("publicendport")
private final int publicEndPort; private final int publicEndPort;
@ConstructorProperties({ @ConstructorProperties({
"id", "ipaddress", "ipaddressid", "privateport", "protocol", "publicport", "state", "virtualmachinedisplayname", "id", "ipaddress", "ipaddressid", "privateport", "protocol", "publicport", "state", "virtualmachinedisplayname",
"virtualmachineid", "virtualmachinename", "cidrlist", "privateendport", "publicendport" "virtualmachineid", "virtualmachinename", "cidrlist", "privateendport", "publicendport"
}) })
@SuppressWarnings("unused")
private PortForwardingRule(String id, @Nullable String IPAddress, @Nullable String IPAddressId, int privatePort,
@Nullable Protocol protocol, int publicPort, @Nullable State state, @Nullable String virtualMachineDisplayName,
@Nullable String virtualMachineId, @Nullable String virtualMachineName, @Nullable String CIDRs,
int privateEndPort, int publicEndPort) {
this(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state, virtualMachineDisplayName, virtualMachineId,
virtualMachineName, splitStringOnCommas(CIDRs), privateEndPort, publicEndPort);
}
private static Set<String> splitStringOnCommas(String in) {
return in == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(in.split(","));
}
protected PortForwardingRule(String id, @Nullable String IPAddress, @Nullable String IPAddressId, int privatePort, protected PortForwardingRule(String id, @Nullable String IPAddress, @Nullable String IPAddressId, int privatePort,
@Nullable Protocol protocol, int publicPort, @Nullable State state, @Nullable Protocol protocol, int publicPort, @Nullable State state,
@Nullable String virtualMachineDisplayName, @Nullable String virtualMachineId, @Nullable String virtualMachineDisplayName, @Nullable String virtualMachineId,
@ -287,7 +288,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
this.virtualMachineDisplayName = virtualMachineDisplayName; this.virtualMachineDisplayName = virtualMachineDisplayName;
this.virtualMachineId = virtualMachineId; this.virtualMachineId = virtualMachineId;
this.virtualMachineName = virtualMachineName; this.virtualMachineName = virtualMachineName;
this.CIDRs = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs); this.CIDRs = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs);
this.privateEndPort = privateEndPort; this.privateEndPort = privateEndPort;
this.publicEndPort = publicEndPort; this.publicEndPort = publicEndPort;
} }
@ -401,20 +402,20 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
PortForwardingRule that = PortForwardingRule.class.cast(obj); PortForwardingRule that = PortForwardingRule.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.IPAddress, that.IPAddress) && Objects.equal(this.IPAddress, that.IPAddress)
&& Objects.equal(this.IPAddressId, that.IPAddressId) && Objects.equal(this.IPAddressId, that.IPAddressId)
&& Objects.equal(this.privatePort, that.privatePort) && Objects.equal(this.privatePort, that.privatePort)
&& Objects.equal(this.protocol, that.protocol) && Objects.equal(this.protocol, that.protocol)
&& Objects.equal(this.publicPort, that.publicPort) && Objects.equal(this.publicPort, that.publicPort)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName)
&& Objects.equal(this.virtualMachineId, that.virtualMachineId) && Objects.equal(this.virtualMachineId, that.virtualMachineId)
&& Objects.equal(this.virtualMachineName, that.virtualMachineName) && Objects.equal(this.virtualMachineName, that.virtualMachineName)
&& Objects.equal(this.CIDRs, that.CIDRs) && Objects.equal(this.CIDRs, that.CIDRs)
&& Objects.equal(this.privateEndPort, that.privateEndPort) && Objects.equal(this.privateEndPort, that.privateEndPort)
&& Objects.equal(this.publicEndPort, that.publicEndPort); && Objects.equal(this.publicEndPort, that.publicEndPort);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("IPAddress", IPAddress).add("IPAddressId", IPAddressId).add("privatePort", privatePort) .add("id", id).add("IPAddress", IPAddress).add("IPAddressId", IPAddressId).add("privatePort", privatePort)
@ -422,7 +423,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
.add("virtualMachineId", virtualMachineId).add("virtualMachineName", virtualMachineName).add("CIDRs", CIDRs) .add("virtualMachineId", virtualMachineId).add("virtualMachineName", virtualMachineName).add("CIDRs", CIDRs)
.add("privateEndPort", privateEndPort).add("publicEndPort", publicEndPort); .add("privateEndPort", privateEndPort).add("publicEndPort", publicEndPort);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -33,40 +31,40 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class PublicIPAddress * Class PublicIPAddress
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class PublicIPAddress { public class PublicIPAddress {
/** /**
*/ */
public static enum State { public static enum State {
ALLOCATING, ALLOCATED, RELEASING, UNRECOGNIZED; ALLOCATING, ALLOCATED, RELEASING, UNRECOGNIZED;
@Override @Override
public String toString() { public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
} }
public static State fromValue(String state) { public static State fromValue(String state) {
try { try {
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNRECOGNIZED; return UNRECOGNIZED;
}
} }
}
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromPublicIPAddress(this); return new ConcreteBuilder().fromPublicIPAddress(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -90,8 +88,8 @@ public class PublicIPAddress {
protected String zoneName; protected String zoneName;
protected String jobId; protected String jobId;
protected Integer jobStatus; protected Integer jobStatus;
/** /**
* @see PublicIPAddress#getId() * @see PublicIPAddress#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -99,7 +97,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getAccount() * @see PublicIPAddress#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -107,7 +105,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getAllocated() * @see PublicIPAddress#getAllocated()
*/ */
public T allocated(Date allocated) { public T allocated(Date allocated) {
@ -115,7 +113,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getAssociatedNetworkId() * @see PublicIPAddress#getAssociatedNetworkId()
*/ */
public T associatedNetworkId(String associatedNetworkId) { public T associatedNetworkId(String associatedNetworkId) {
@ -123,7 +121,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getDomain() * @see PublicIPAddress#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -131,7 +129,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getDomainId() * @see PublicIPAddress#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -139,7 +137,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#isUsesVirtualNetwork() * @see PublicIPAddress#isUsesVirtualNetwork()
*/ */
public T usesVirtualNetwork(boolean usesVirtualNetwork) { public T usesVirtualNetwork(boolean usesVirtualNetwork) {
@ -147,7 +145,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getIPAddress() * @see PublicIPAddress#getIPAddress()
*/ */
public T IPAddress(String IPAddress) { public T IPAddress(String IPAddress) {
@ -155,7 +153,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#isSourceNAT() * @see PublicIPAddress#isSourceNAT()
*/ */
public T isSourceNAT(boolean isSourceNAT) { public T isSourceNAT(boolean isSourceNAT) {
@ -163,7 +161,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#isStaticNAT() * @see PublicIPAddress#isStaticNAT()
*/ */
public T isStaticNAT(boolean isStaticNAT) { public T isStaticNAT(boolean isStaticNAT) {
@ -171,7 +169,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getNetworkId() * @see PublicIPAddress#getNetworkId()
*/ */
public T networkId(String networkId) { public T networkId(String networkId) {
@ -179,7 +177,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getState() * @see PublicIPAddress#getState()
*/ */
public T state(PublicIPAddress.State state) { public T state(PublicIPAddress.State state) {
@ -187,7 +185,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getVirtualMachineDisplayName() * @see PublicIPAddress#getVirtualMachineDisplayName()
*/ */
public T virtualMachineDisplayName(String virtualMachineDisplayName) { public T virtualMachineDisplayName(String virtualMachineDisplayName) {
@ -195,7 +193,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getVirtualMachineId() * @see PublicIPAddress#getVirtualMachineId()
*/ */
public T virtualMachineId(String virtualMachineId) { public T virtualMachineId(String virtualMachineId) {
@ -203,7 +201,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getVirtualMachineName() * @see PublicIPAddress#getVirtualMachineName()
*/ */
public T virtualMachineName(String virtualMachineName) { public T virtualMachineName(String virtualMachineName) {
@ -211,7 +209,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getVLANId() * @see PublicIPAddress#getVLANId()
*/ */
public T VLANId(String VLANId) { public T VLANId(String VLANId) {
@ -219,7 +217,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getVLANName() * @see PublicIPAddress#getVLANName()
*/ */
public T VLANName(String VLANName) { public T VLANName(String VLANName) {
@ -227,7 +225,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getZoneId() * @see PublicIPAddress#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -235,7 +233,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getZoneName() * @see PublicIPAddress#getZoneName()
*/ */
public T zoneName(String zoneName) { public T zoneName(String zoneName) {
@ -243,7 +241,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getJobId() * @see PublicIPAddress#getJobId()
*/ */
public T jobId(String jobId) { public T jobId(String jobId) {
@ -251,7 +249,7 @@ public class PublicIPAddress {
return self(); return self();
} }
/** /**
* @see PublicIPAddress#getJobStatus() * @see PublicIPAddress#getJobStatus()
*/ */
public T jobStatus(Integer jobStatus) { public T jobStatus(Integer jobStatus) {
@ -262,30 +260,30 @@ public class PublicIPAddress {
public PublicIPAddress build() { public PublicIPAddress build() {
return new PublicIPAddress(id, account, allocated, associatedNetworkId, domain, domainId, usesVirtualNetwork, IPAddress, isSourceNAT, isStaticNAT, networkId, state, virtualMachineDisplayName, virtualMachineId, virtualMachineName, VLANId, VLANName, zoneId, zoneName, jobId, jobStatus); return new PublicIPAddress(id, account, allocated, associatedNetworkId, domain, domainId, usesVirtualNetwork, IPAddress, isSourceNAT, isStaticNAT, networkId, state, virtualMachineDisplayName, virtualMachineId, virtualMachineName, VLANId, VLANName, zoneId, zoneName, jobId, jobStatus);
} }
public T fromPublicIPAddress(PublicIPAddress in) { public T fromPublicIPAddress(PublicIPAddress in) {
return this return this
.id(in.getId()) .id(in.getId())
.account(in.getAccount()) .account(in.getAccount())
.allocated(in.getAllocated()) .allocated(in.getAllocated())
.associatedNetworkId(in.getAssociatedNetworkId()) .associatedNetworkId(in.getAssociatedNetworkId())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.usesVirtualNetwork(in.isUsesVirtualNetwork()) .usesVirtualNetwork(in.isUsesVirtualNetwork())
.IPAddress(in.getIPAddress()) .IPAddress(in.getIPAddress())
.isSourceNAT(in.isSourceNAT()) .isSourceNAT(in.isSourceNAT())
.isStaticNAT(in.isStaticNAT()) .isStaticNAT(in.isStaticNAT())
.networkId(in.getNetworkId()) .networkId(in.getNetworkId())
.state(in.getState()) .state(in.getState())
.virtualMachineDisplayName(in.getVirtualMachineDisplayName()) .virtualMachineDisplayName(in.getVirtualMachineDisplayName())
.virtualMachineId(in.getVirtualMachineId()) .virtualMachineId(in.getVirtualMachineId())
.virtualMachineName(in.getVirtualMachineName()) .virtualMachineName(in.getVirtualMachineName())
.VLANId(in.getVLANId()) .VLANId(in.getVLANId())
.VLANName(in.getVLANName()) .VLANName(in.getVLANName())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.zoneName(in.getZoneName()) .zoneName(in.getZoneName())
.jobId(in.getJobId()) .jobId(in.getJobId())
.jobStatus(in.getJobStatus()); .jobStatus(in.getJobStatus());
} }
} }
@ -299,43 +297,27 @@ public class PublicIPAddress {
private final String id; private final String id;
private final String account; private final String account;
private final Date allocated; private final Date allocated;
@Named("associatednetworkid")
private final String associatedNetworkId; private final String associatedNetworkId;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("forvirtualnetwork")
private final boolean usesVirtualNetwork; private final boolean usesVirtualNetwork;
@Named("ipaddress")
private final String IPAddress; private final String IPAddress;
@Named("issourcenat")
private final boolean isSourceNAT; private final boolean isSourceNAT;
@Named("isstaticnat")
private final boolean isStaticNAT; private final boolean isStaticNAT;
@Named("networkid")
private final String networkId; private final String networkId;
private final PublicIPAddress.State state; private final PublicIPAddress.State state;
@Named("virtualmachinedisplayname")
private final String virtualMachineDisplayName; private final String virtualMachineDisplayName;
@Named("virtualmachineid")
private final String virtualMachineId; private final String virtualMachineId;
@Named("virtualmachinename")
private final String virtualMachineName; private final String virtualMachineName;
@Named("VLANid")
private final String VLANId; private final String VLANId;
@Named("VLANname")
private final String VLANName; private final String VLANName;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@Named("jobid")
private final String jobId; private final String jobId;
@Named("jobstatus")
private final Integer jobStatus; private final Integer jobStatus;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "allocated", "associatednetworkid", "domain", "domainid", "forvirtualnetwork", "ipaddress", "issourcenat", "id", "account", "allocated", "associatednetworkid", "domain", "domainid", "forvirtualnetwork", "ipaddress", "issourcenat",
"isstaticnat", "networkid", "state", "virtualmachinedisplayname", "virtualmachineid", "virtualmachinename", "VLANid", "isstaticnat", "networkid", "state", "virtualmachinedisplayname", "virtualmachineid", "virtualmachinename", "VLANid",
"VLANname", "zoneid", "zonename", "jobid", "jobstatus" "VLANname", "zoneid", "zonename", "jobid", "jobstatus"
}) })
@ -454,7 +436,7 @@ public class PublicIPAddress {
/** /**
* @return State of the ip address. Can be: Allocating, Allocated and * @return State of the ip address. Can be: Allocating, Allocated and
Releasing * Releasing
*/ */
@Nullable @Nullable
public PublicIPAddress.State getState() { public PublicIPAddress.State getState() {
@ -463,7 +445,7 @@ public class PublicIPAddress {
/** /**
* @return virtual machine display name the ip address is assigned to (not * @return virtual machine display name the ip address is assigned to (not
null only for static nat Ip) * null only for static nat Ip)
*/ */
@Nullable @Nullable
public String getVirtualMachineDisplayName() { public String getVirtualMachineDisplayName() {
@ -472,7 +454,7 @@ public class PublicIPAddress {
/** /**
* @return virtual machine id the ip address is assigned to (not null only * @return virtual machine id the ip address is assigned to (not null only
for static nat Ip) * for static nat Ip)
*/ */
@Nullable @Nullable
public String getVirtualMachineId() { public String getVirtualMachineId() {
@ -481,7 +463,7 @@ public class PublicIPAddress {
/** /**
* @return virtual machine name the ip address is assigned to (not null only * @return virtual machine name the ip address is assigned to (not null only
for static nat Ip) * for static nat Ip)
*/ */
@Nullable @Nullable
public String getVirtualMachineName() { public String getVirtualMachineName() {
@ -522,8 +504,8 @@ public class PublicIPAddress {
/** /**
* @return shows the current pending asynchronous job ID. This tag is not * @return shows the current pending asynchronous job ID. This tag is not
returned if no current pending jobs are acting on the virtual * returned if no current pending jobs are acting on the virtual
machine * machine
*/ */
@Nullable @Nullable
public String getJobId() { public String getJobId() {
@ -549,28 +531,28 @@ public class PublicIPAddress {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
PublicIPAddress that = PublicIPAddress.class.cast(obj); PublicIPAddress that = PublicIPAddress.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.allocated, that.allocated) && Objects.equal(this.allocated, that.allocated)
&& Objects.equal(this.associatedNetworkId, that.associatedNetworkId) && Objects.equal(this.associatedNetworkId, that.associatedNetworkId)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.usesVirtualNetwork, that.usesVirtualNetwork) && Objects.equal(this.usesVirtualNetwork, that.usesVirtualNetwork)
&& Objects.equal(this.IPAddress, that.IPAddress) && Objects.equal(this.IPAddress, that.IPAddress)
&& Objects.equal(this.isSourceNAT, that.isSourceNAT) && Objects.equal(this.isSourceNAT, that.isSourceNAT)
&& Objects.equal(this.isStaticNAT, that.isStaticNAT) && Objects.equal(this.isStaticNAT, that.isStaticNAT)
&& Objects.equal(this.networkId, that.networkId) && Objects.equal(this.networkId, that.networkId)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName)
&& Objects.equal(this.virtualMachineId, that.virtualMachineId) && Objects.equal(this.virtualMachineId, that.virtualMachineId)
&& Objects.equal(this.virtualMachineName, that.virtualMachineName) && Objects.equal(this.virtualMachineName, that.virtualMachineName)
&& Objects.equal(this.VLANId, that.VLANId) && Objects.equal(this.VLANId, that.VLANId)
&& Objects.equal(this.VLANName, that.VLANName) && Objects.equal(this.VLANName, that.VLANName)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.zoneName, that.zoneName) && Objects.equal(this.zoneName, that.zoneName)
&& Objects.equal(this.jobId, that.jobId) && Objects.equal(this.jobId, that.jobId)
&& Objects.equal(this.jobStatus, that.jobStatus); && Objects.equal(this.jobStatus, that.jobStatus);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("account", account).add("allocated", allocated).add("associatedNetworkId", associatedNetworkId) .add("id", id).add("account", account).add("allocated", allocated).add("associatedNetworkId", associatedNetworkId)
@ -580,7 +562,7 @@ public class PublicIPAddress {
.add("virtualMachineName", virtualMachineName).add("VLANId", VLANId).add("VLANName", VLANName).add("zoneId", zoneId) .add("virtualMachineName", virtualMachineName).add("VLANId", VLANId).add("VLANName", VLANName).add("zoneId", zoneId)
.add("zoneName", zoneName).add("jobId", jobId).add("jobStatus", jobStatus); .add("zoneName", zoneName).add("jobId", jobId).add("jobStatus", jobStatus);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Map; import java.util.Map;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -35,9 +33,9 @@ import com.google.common.collect.Maps;
/** /**
* Class ResourceLimit * Class ResourceLimit
* *
* @author Vijay Kiran * @author Vijay Kiran
*/ */
public class ResourceLimit { public class ResourceLimit {
/** /**
@ -83,7 +81,7 @@ public class ResourceLimit {
this.code = code; this.code = code;
} }
public int getCode(){ public int getCode() {
return code; return code;
} }
@ -98,15 +96,15 @@ public class ResourceLimit {
} }
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromResourceLimit(this); return new ConcreteBuilder().fromResourceLimit(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String account; protected String account;
@ -114,8 +112,8 @@ public class ResourceLimit {
protected String domainId; protected String domainId;
protected int max; protected int max;
protected ResourceType resourceType; protected ResourceType resourceType;
/** /**
* @see ResourceLimit#getAccount() * @see ResourceLimit#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -123,7 +121,7 @@ public class ResourceLimit {
return self(); return self();
} }
/** /**
* @see ResourceLimit#getDomain() * @see ResourceLimit#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -131,7 +129,7 @@ public class ResourceLimit {
return self(); return self();
} }
/** /**
* @see ResourceLimit#getDomainId() * @see ResourceLimit#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -139,7 +137,7 @@ public class ResourceLimit {
return self(); return self();
} }
/** /**
* @see ResourceLimit#getMax() * @see ResourceLimit#getMax()
*/ */
public T max(int max) { public T max(int max) {
@ -147,7 +145,7 @@ public class ResourceLimit {
return self(); return self();
} }
/** /**
* @see ResourceLimit#getResourceType() * @see ResourceLimit#getResourceType()
*/ */
public T resourceType(ResourceType resourceType) { public T resourceType(ResourceType resourceType) {
@ -158,14 +156,14 @@ public class ResourceLimit {
public ResourceLimit build() { public ResourceLimit build() {
return new ResourceLimit(account, domain, domainId, max, resourceType); return new ResourceLimit(account, domain, domainId, max, resourceType);
} }
public T fromResourceLimit(ResourceLimit in) { public T fromResourceLimit(ResourceLimit in) {
return this return this
.account(in.getAccount()) .account(in.getAccount())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.max(in.getMax()) .max(in.getMax())
.resourceType(in.getResourceType()); .resourceType(in.getResourceType());
} }
} }
@ -178,14 +176,12 @@ public class ResourceLimit {
private final String account; private final String account;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
private final int max; private final int max;
@Named("resourcetype")
private final ResourceLimit.ResourceType resourceType; private final ResourceLimit.ResourceType resourceType;
@ConstructorProperties({ @ConstructorProperties({
"account", "domain", "domainid", "max", "resourcetype" "account", "domain", "domainid", "max", "resourcetype"
}) })
protected ResourceLimit(@Nullable String account, @Nullable String domain, @Nullable String domainId, int max, protected ResourceLimit(@Nullable String account, @Nullable String domain, @Nullable String domainId, int max,
@Nullable ResourceType resourceType) { @Nullable ResourceType resourceType) {
@ -231,17 +227,17 @@ public class ResourceLimit {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
ResourceLimit that = ResourceLimit.class.cast(obj); ResourceLimit that = ResourceLimit.class.cast(obj);
return Objects.equal(this.account, that.account) return Objects.equal(this.account, that.account)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.max, that.max) && Objects.equal(this.max, that.max)
&& Objects.equal(this.resourceType, that.resourceType); && Objects.equal(this.resourceType, that.resourceType);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("account", account).add("domain", domain).add("domainId", domainId).add("max", max).add("resourceType", resourceType); .add("account", account).add("domain", domain).add("domainId", domainId).add("max", max).add("resourceType", resourceType);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -34,20 +32,20 @@ import com.google.common.collect.ImmutableSortedSet;
/** /**
* Class SecurityGroup * Class SecurityGroup
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class SecurityGroup implements Comparable<SecurityGroup> { public class SecurityGroup implements Comparable<SecurityGroup> {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromSecurityGroup(this); return new ConcreteBuilder().fromSecurityGroup(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -59,8 +57,8 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
protected String jobId; protected String jobId;
protected Integer jobStatus; protected Integer jobStatus;
protected Set<IngressRule> ingressRules; protected Set<IngressRule> ingressRules;
/** /**
* @see SecurityGroup#getId() * @see SecurityGroup#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -68,7 +66,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
return self(); return self();
} }
/** /**
* @see SecurityGroup#getAccount() * @see SecurityGroup#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -76,7 +74,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
return self(); return self();
} }
/** /**
* @see SecurityGroup#getName() * @see SecurityGroup#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -84,7 +82,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
return self(); return self();
} }
/** /**
* @see SecurityGroup#getDescription() * @see SecurityGroup#getDescription()
*/ */
public T description(String description) { public T description(String description) {
@ -92,7 +90,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
return self(); return self();
} }
/** /**
* @see SecurityGroup#getDomain() * @see SecurityGroup#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -100,7 +98,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
return self(); return self();
} }
/** /**
* @see SecurityGroup#getDomainId() * @see SecurityGroup#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -108,7 +106,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
return self(); return self();
} }
/** /**
* @see SecurityGroup#getJobId() * @see SecurityGroup#getJobId()
*/ */
public T jobId(String jobId) { public T jobId(String jobId) {
@ -116,7 +114,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
return self(); return self();
} }
/** /**
* @see SecurityGroup#getJobStatus() * @see SecurityGroup#getJobStatus()
*/ */
public T jobStatus(Integer jobStatus) { public T jobStatus(Integer jobStatus) {
@ -124,7 +122,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
return self(); return self();
} }
/** /**
* @see SecurityGroup#getIngressRules() * @see SecurityGroup#getIngressRules()
*/ */
public T ingressRules(Set<IngressRule> ingressRules) { public T ingressRules(Set<IngressRule> ingressRules) {
@ -135,18 +133,18 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
public SecurityGroup build() { public SecurityGroup build() {
return new SecurityGroup(id, account, name, description, domain, domainId, jobId, jobStatus, ingressRules); return new SecurityGroup(id, account, name, description, domain, domainId, jobId, jobStatus, ingressRules);
} }
public T fromSecurityGroup(SecurityGroup in) { public T fromSecurityGroup(SecurityGroup in) {
return this return this
.id(in.getId()) .id(in.getId())
.account(in.getAccount()) .account(in.getAccount())
.name(in.getName()) .name(in.getName())
.description(in.getDescription()) .description(in.getDescription())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.jobId(in.getJobId()) .jobId(in.getJobId())
.jobStatus(in.getJobStatus()) .jobStatus(in.getJobStatus())
.ingressRules(in.getIngressRules()); .ingressRules(in.getIngressRules());
} }
} }
@ -162,17 +160,13 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
private final String name; private final String name;
private final String description; private final String description;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("jobid")
private final String jobId; private final String jobId;
@Named("jobstatus")
private final Integer jobStatus; private final Integer jobStatus;
@Named("ingressrule")
private final Set<IngressRule> ingressRules; private final Set<IngressRule> ingressRules;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "name", "description", "domain", "domainid", "jobid", "jobstatus", "ingressrule" "id", "account", "name", "description", "domain", "domainid", "jobid", "jobstatus", "ingressrule"
}) })
protected SecurityGroup(String id, @Nullable String account, @Nullable String name, @Nullable String description, protected SecurityGroup(String id, @Nullable String account, @Nullable String name, @Nullable String description,
@Nullable String domain, @Nullable String domainId, @Nullable String jobId, @Nullable Integer jobStatus, @Nullable String domain, @Nullable String domainId, @Nullable String jobId, @Nullable Integer jobStatus,
@ -237,8 +231,8 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
/** /**
* @return shows the current pending asynchronous job ID. This tag is not * @return shows the current pending asynchronous job ID. This tag is not
returned if no current pending jobs are acting on the virtual * returned if no current pending jobs are acting on the virtual
machine * machine
*/ */
@Nullable @Nullable
public String getJobId() { public String getJobId() {
@ -271,21 +265,21 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
SecurityGroup that = SecurityGroup.class.cast(obj); SecurityGroup that = SecurityGroup.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.description, that.description) && Objects.equal(this.description, that.description)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.jobId, that.jobId) && Objects.equal(this.jobId, that.jobId)
&& Objects.equal(this.jobStatus, that.jobStatus) && Objects.equal(this.jobStatus, that.jobStatus)
&& Objects.equal(this.ingressRules, that.ingressRules); && Objects.equal(this.ingressRules, that.ingressRules);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this).add("id", id).add("account", account).add("name", name).add("description", description) return Objects.toStringHelper(this).add("id", id).add("account", account).add("name", name).add("description", description)
.add("domain", domain).add("domainId", domainId).add("jobId", jobId).add("jobStatus", jobStatus).add("ingressRules", ingressRules); .add("domain", domain).add("domainId", domainId).add("jobId", jobId).add("jobStatus", jobStatus).add("ingressRules", ingressRules);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -24,8 +24,6 @@ import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
@ -252,33 +250,21 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
private final String id; private final String id;
private final String name; private final String name;
@Named("displaytext")
private final String displayText; private final String displayText;
private final Date created; private final Date created;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("cpunumber")
private final int cpuNumber; private final int cpuNumber;
@Named("cpuspeed")
private final int cpuSpeed; private final int cpuSpeed;
private final int memory; private final int memory;
@Named("offerha")
private final boolean haSupport; private final boolean haSupport;
@Named("storagetype")
private final StorageType storageType; private final StorageType storageType;
private final String tags; private final String tags;
@Named("defaultuse")
private final boolean defaultUse; private final boolean defaultUse;
@Named("hosttags")
private final String hostTags; private final String hostTags;
@Named("issystem")
private final boolean systemOffering; private final boolean systemOffering;
@Named("limitcpuuse")
private final boolean cpuUseLimited; private final boolean cpuUseLimited;
@Named("networkrate")
private final long networkRate; private final long networkRate;
@Named("systemvmtype")
private final boolean systemVmType; private final boolean systemVmType;
@ConstructorProperties({ @ConstructorProperties({

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -261,23 +259,15 @@ public class Snapshot {
private final String account; private final String account;
private final Date created; private final Date created;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("intervaltype")
private final Snapshot.Interval interval; private final Snapshot.Interval interval;
@Named("jobid")
private final String jobId; private final String jobId;
@Named("jobstatus")
private final String jobStatus; private final String jobStatus;
private final String name; private final String name;
@Named("snapshottype")
private final Snapshot.Type snapshotType; private final Snapshot.Type snapshotType;
private final Snapshot.State state; private final Snapshot.State state;
@Named("volumeid")
private final String volumeId; private final String volumeId;
@Named("volumename")
private final String volumeName; private final String volumeName;
@Named("volumetype")
private final Volume.Type volumeType; private final Volume.Type volumeType;
@ConstructorProperties({ @ConstructorProperties({

View File

@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -31,20 +29,20 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class SnapshotPolicy * Class SnapshotPolicy
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class SnapshotPolicy { public class SnapshotPolicy {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromSnapshotPolicy(this); return new ConcreteBuilder().fromSnapshotPolicy(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -53,8 +51,8 @@ public class SnapshotPolicy {
protected String schedule; protected String schedule;
protected String timezone; protected String timezone;
protected String volumeId; protected String volumeId;
/** /**
* @see SnapshotPolicy#getId() * @see SnapshotPolicy#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -62,7 +60,7 @@ public class SnapshotPolicy {
return self(); return self();
} }
/** /**
* @see SnapshotPolicy#getInterval() * @see SnapshotPolicy#getInterval()
*/ */
public T interval(Snapshot.Interval interval) { public T interval(Snapshot.Interval interval) {
@ -70,7 +68,7 @@ public class SnapshotPolicy {
return self(); return self();
} }
/** /**
* @see SnapshotPolicy#getNumberToRetain() * @see SnapshotPolicy#getNumberToRetain()
*/ */
public T numberToRetain(long numberToRetain) { public T numberToRetain(long numberToRetain) {
@ -78,7 +76,7 @@ public class SnapshotPolicy {
return self(); return self();
} }
/** /**
* @see SnapshotPolicy#getSchedule() * @see SnapshotPolicy#getSchedule()
*/ */
public T schedule(String schedule) { public T schedule(String schedule) {
@ -86,7 +84,7 @@ public class SnapshotPolicy {
return self(); return self();
} }
/** /**
* @see SnapshotPolicy#getTimezone() * @see SnapshotPolicy#getTimezone()
*/ */
public T timezone(String timezone) { public T timezone(String timezone) {
@ -94,7 +92,7 @@ public class SnapshotPolicy {
return self(); return self();
} }
/** /**
* @see SnapshotPolicy#getVolumeId() * @see SnapshotPolicy#getVolumeId()
*/ */
public T volumeId(String volumeId) { public T volumeId(String volumeId) {
@ -105,15 +103,15 @@ public class SnapshotPolicy {
public SnapshotPolicy build() { public SnapshotPolicy build() {
return new SnapshotPolicy(id, interval, numberToRetain, schedule, timezone, volumeId); return new SnapshotPolicy(id, interval, numberToRetain, schedule, timezone, volumeId);
} }
public T fromSnapshotPolicy(SnapshotPolicy in) { public T fromSnapshotPolicy(SnapshotPolicy in) {
return this return this
.id(in.getId()) .id(in.getId())
.interval(in.getInterval()) .interval(in.getInterval())
.numberToRetain(in.getNumberToRetain()) .numberToRetain(in.getNumberToRetain())
.schedule(in.getSchedule()) .schedule(in.getSchedule())
.timezone(in.getTimezone()) .timezone(in.getTimezone())
.volumeId(in.getVolumeId()); .volumeId(in.getVolumeId());
} }
} }
@ -125,17 +123,14 @@ public class SnapshotPolicy {
} }
private final String id; private final String id;
@Named("intervaltype")
private final Snapshot.Interval interval; private final Snapshot.Interval interval;
@Named("maxsnaps")
private final long numberToRetain; private final long numberToRetain;
private final String schedule; private final String schedule;
private final String timezone; private final String timezone;
@Named("volumeid")
private final String volumeId; private final String volumeId;
@ConstructorProperties({ @ConstructorProperties({
"id", "intervaltype", "maxsnaps", "schedule", "timezone", "volumeid" "id", "intervaltype", "maxsnaps", "schedule", "timezone", "volumeid"
}) })
protected SnapshotPolicy(String id, @Nullable Snapshot.Interval interval, long numberToRetain, @Nullable String schedule, protected SnapshotPolicy(String id, @Nullable Snapshot.Interval interval, long numberToRetain, @Nullable String schedule,
@Nullable String timezone, @Nullable String volumeId) { @Nullable String timezone, @Nullable String volumeId) {
@ -204,19 +199,19 @@ public class SnapshotPolicy {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
SnapshotPolicy that = SnapshotPolicy.class.cast(obj); SnapshotPolicy that = SnapshotPolicy.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.interval, that.interval) && Objects.equal(this.interval, that.interval)
&& Objects.equal(this.numberToRetain, that.numberToRetain) && Objects.equal(this.numberToRetain, that.numberToRetain)
&& Objects.equal(this.schedule, that.schedule) && Objects.equal(this.schedule, that.schedule)
&& Objects.equal(this.timezone, that.timezone) && Objects.equal(this.timezone, that.timezone)
&& Objects.equal(this.volumeId, that.volumeId); && Objects.equal(this.volumeId, that.volumeId);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("interval", interval).add("numberToRetain", numberToRetain).add("schedule", schedule).add("timezone", timezone) .add("id", id).add("interval", interval).add("numberToRetain", numberToRetain).add("schedule", schedule).add("timezone", timezone)
.add("volumeId", volumeId); .add("volumeId", volumeId);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -28,26 +28,26 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Describes the schedule of a snapshot policy. * Describes the schedule of a snapshot policy.
* *
* @see org.jclouds.cloudstack.util.SnapshotPolicySchedules
* @author Richard Downer * @author Richard Downer
*/ * @see org.jclouds.cloudstack.util.SnapshotPolicySchedules
*/
public class SnapshotPolicySchedule { public class SnapshotPolicySchedule {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromSnapshotPolicySchedule(this); return new ConcreteBuilder().fromSnapshotPolicySchedule(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected Snapshot.Interval interval; protected Snapshot.Interval interval;
protected String time; protected String time;
/** /**
* @see SnapshotPolicySchedule#getInterval() * @see SnapshotPolicySchedule#getInterval()
*/ */
public T interval(Snapshot.Interval interval) { public T interval(Snapshot.Interval interval) {
@ -55,7 +55,7 @@ public class SnapshotPolicySchedule {
return self(); return self();
} }
/** /**
* @see SnapshotPolicySchedule#getTime() * @see SnapshotPolicySchedule#getTime()
*/ */
public T time(String time) { public T time(String time) {
@ -66,11 +66,11 @@ public class SnapshotPolicySchedule {
public SnapshotPolicySchedule build() { public SnapshotPolicySchedule build() {
return new SnapshotPolicySchedule(interval, time); return new SnapshotPolicySchedule(interval, time);
} }
public T fromSnapshotPolicySchedule(SnapshotPolicySchedule in) { public T fromSnapshotPolicySchedule(SnapshotPolicySchedule in) {
return this return this
.interval(in.getInterval()) .interval(in.getInterval())
.time(in.getTime()); .time(in.getTime());
} }
} }
@ -85,7 +85,7 @@ public class SnapshotPolicySchedule {
private final String time; private final String time;
@ConstructorProperties({ @ConstructorProperties({
"interval", "time" "interval", "time"
}) })
protected SnapshotPolicySchedule(@Nullable Snapshot.Interval interval, @Nullable String time) { protected SnapshotPolicySchedule(@Nullable Snapshot.Interval interval, @Nullable String time) {
this.interval = interval; this.interval = interval;
@ -113,14 +113,14 @@ public class SnapshotPolicySchedule {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
SnapshotPolicySchedule that = SnapshotPolicySchedule.class.cast(obj); SnapshotPolicySchedule that = SnapshotPolicySchedule.class.cast(obj);
return Objects.equal(this.interval, that.interval) return Objects.equal(this.interval, that.interval)
&& Objects.equal(this.time, that.time); && Objects.equal(this.time, that.time);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("interval", interval).add("time", time); .add("interval", interval).add("time", time);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -31,27 +29,27 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class SshKeyPair * Class SshKeyPair
* *
* @author Vijay Kiran * @author Vijay Kiran
*/ */
public class SshKeyPair { public class SshKeyPair {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromSshKeyPair(this); return new ConcreteBuilder().fromSshKeyPair(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String fingerprint; protected String fingerprint;
protected String name; protected String name;
protected String privateKey; protected String privateKey;
/** /**
* @see SshKeyPair#getFingerprint() * @see SshKeyPair#getFingerprint()
*/ */
public T fingerprint(String fingerprint) { public T fingerprint(String fingerprint) {
@ -59,7 +57,7 @@ public class SshKeyPair {
return self(); return self();
} }
/** /**
* @see SshKeyPair#getName() * @see SshKeyPair#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -67,7 +65,7 @@ public class SshKeyPair {
return self(); return self();
} }
/** /**
* @see SshKeyPair#getPrivateKey() * @see SshKeyPair#getPrivateKey()
*/ */
public T privateKey(String privateKey) { public T privateKey(String privateKey) {
@ -78,12 +76,12 @@ public class SshKeyPair {
public SshKeyPair build() { public SshKeyPair build() {
return new SshKeyPair(fingerprint, name, privateKey); return new SshKeyPair(fingerprint, name, privateKey);
} }
public T fromSshKeyPair(SshKeyPair in) { public T fromSshKeyPair(SshKeyPair in) {
return this return this
.fingerprint(in.getFingerprint()) .fingerprint(in.getFingerprint())
.name(in.getName()) .name(in.getName())
.privateKey(in.getPrivateKey()); .privateKey(in.getPrivateKey());
} }
} }
@ -96,11 +94,10 @@ public class SshKeyPair {
private final String fingerprint; private final String fingerprint;
private final String name; private final String name;
@Named("privatekey")
private final String privateKey; private final String privateKey;
@ConstructorProperties({ @ConstructorProperties({
"fingerprint", "name", "privatekey" "fingerprint", "name", "privatekey"
}) })
protected SshKeyPair(@Nullable String fingerprint, String name, @Nullable String privateKey) { protected SshKeyPair(@Nullable String fingerprint, String name, @Nullable String privateKey) {
this.fingerprint = fingerprint; this.fingerprint = fingerprint;
@ -133,15 +130,15 @@ public class SshKeyPair {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
SshKeyPair that = SshKeyPair.class.cast(obj); SshKeyPair that = SshKeyPair.class.cast(obj);
return Objects.equal(this.fingerprint, that.fingerprint) return Objects.equal(this.fingerprint, that.fingerprint)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.privateKey, that.privateKey); && Objects.equal(this.privateKey, that.privateKey);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("fingerprint", fingerprint).add("name", name).add("privateKey", privateKey); .add("fingerprint", fingerprint).add("name", name).add("privateKey", privateKey);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -33,9 +31,9 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Represents a storage pool in CloudStack * Represents a storage pool in CloudStack
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class StoragePool implements Comparable<StoragePool> { public class StoragePool implements Comparable<StoragePool> {
public enum State { public enum State {
@ -75,30 +73,30 @@ public class StoragePool implements Comparable<StoragePool> {
EXT, EXT,
OCFS2, OCFS2,
UNRECOGNIZED; UNRECOGNIZED;
@Override @Override
public String toString() { public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
} }
public static Type fromValue(String type) { public static Type fromValue(String type) {
try { try {
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type"))); return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNRECOGNIZED; return UNRECOGNIZED;
} }
} }
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromStoragePool(this); return new ConcreteBuilder().fromStoragePool(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -119,8 +117,8 @@ public class StoragePool implements Comparable<StoragePool> {
protected String ipAddress; protected String ipAddress;
protected String jobId; protected String jobId;
protected String jobStatus; protected String jobStatus;
/** /**
* @see StoragePool#getId() * @see StoragePool#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -128,7 +126,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getName() * @see StoragePool#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -136,7 +134,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getPath() * @see StoragePool#getPath()
*/ */
public T path(String path) { public T path(String path) {
@ -144,7 +142,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getTags() * @see StoragePool#getTags()
*/ */
public T tags(String tags) { public T tags(String tags) {
@ -152,7 +150,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getState() * @see StoragePool#getState()
*/ */
public T state(StoragePool.State state) { public T state(StoragePool.State state) {
@ -160,7 +158,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getType() * @see StoragePool#getType()
*/ */
public T type(StoragePool.Type type) { public T type(StoragePool.Type type) {
@ -168,7 +166,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getZoneId() * @see StoragePool#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -176,7 +174,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getZoneName() * @see StoragePool#getZoneName()
*/ */
public T zoneName(String zoneName) { public T zoneName(String zoneName) {
@ -184,7 +182,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getPodId() * @see StoragePool#getPodId()
*/ */
public T podId(String podId) { public T podId(String podId) {
@ -192,7 +190,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getPodName() * @see StoragePool#getPodName()
*/ */
public T podName(String podName) { public T podName(String podName) {
@ -200,7 +198,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getClusterId() * @see StoragePool#getClusterId()
*/ */
public T clusterId(String clusterId) { public T clusterId(String clusterId) {
@ -208,7 +206,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getClusterName() * @see StoragePool#getClusterName()
*/ */
public T clusterName(String clusterName) { public T clusterName(String clusterName) {
@ -216,7 +214,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getCreated() * @see StoragePool#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -224,7 +222,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getDiskSizeAllocated() * @see StoragePool#getDiskSizeAllocated()
*/ */
public T diskSizeAllocated(long diskSizeAllocated) { public T diskSizeAllocated(long diskSizeAllocated) {
@ -232,7 +230,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getDiskSizeTotal() * @see StoragePool#getDiskSizeTotal()
*/ */
public T diskSizeTotal(long diskSizeTotal) { public T diskSizeTotal(long diskSizeTotal) {
@ -240,7 +238,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getIpAddress() * @see StoragePool#getIpAddress()
*/ */
public T ipAddress(String ipAddress) { public T ipAddress(String ipAddress) {
@ -248,7 +246,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getJobId() * @see StoragePool#getJobId()
*/ */
public T jobId(String jobId) { public T jobId(String jobId) {
@ -256,7 +254,7 @@ public class StoragePool implements Comparable<StoragePool> {
return self(); return self();
} }
/** /**
* @see StoragePool#getJobStatus() * @see StoragePool#getJobStatus()
*/ */
public T jobStatus(String jobStatus) { public T jobStatus(String jobStatus) {
@ -267,27 +265,27 @@ public class StoragePool implements Comparable<StoragePool> {
public StoragePool build() { public StoragePool build() {
return new StoragePool(id, name, path, tags, state, type, zoneId, zoneName, podId, podName, clusterId, clusterName, created, diskSizeAllocated, diskSizeTotal, ipAddress, jobId, jobStatus); return new StoragePool(id, name, path, tags, state, type, zoneId, zoneName, podId, podName, clusterId, clusterName, created, diskSizeAllocated, diskSizeTotal, ipAddress, jobId, jobStatus);
} }
public T fromStoragePool(StoragePool in) { public T fromStoragePool(StoragePool in) {
return this return this
.id(in.getId()) .id(in.getId())
.name(in.getName()) .name(in.getName())
.path(in.getPath()) .path(in.getPath())
.tags(in.getTags()) .tags(in.getTags())
.state(in.getState()) .state(in.getState())
.type(in.getType()) .type(in.getType())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.zoneName(in.getZoneName()) .zoneName(in.getZoneName())
.podId(in.getPodId()) .podId(in.getPodId())
.podName(in.getPodName()) .podName(in.getPodName())
.clusterId(in.getClusterId()) .clusterId(in.getClusterId())
.clusterName(in.getClusterName()) .clusterName(in.getClusterName())
.created(in.getCreated()) .created(in.getCreated())
.diskSizeAllocated(in.getDiskSizeAllocated()) .diskSizeAllocated(in.getDiskSizeAllocated())
.diskSizeTotal(in.getDiskSizeTotal()) .diskSizeTotal(in.getDiskSizeTotal())
.ipAddress(in.getIpAddress()) .ipAddress(in.getIpAddress())
.jobId(in.getJobId()) .jobId(in.getJobId())
.jobStatus(in.getJobStatus()); .jobStatus(in.getJobStatus());
} }
} }
@ -304,32 +302,21 @@ public class StoragePool implements Comparable<StoragePool> {
private final String tags; private final String tags;
private final StoragePool.State state; private final StoragePool.State state;
private final StoragePool.Type type; private final StoragePool.Type type;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@Named("podid")
private final String podId; private final String podId;
@Named("podname")
private final String podName; private final String podName;
@Named("clusterid")
private final String clusterId; private final String clusterId;
@Named("clustername")
private final String clusterName; private final String clusterName;
private final Date created; private final Date created;
@Named("disksizeallocated")
private final long diskSizeAllocated; private final long diskSizeAllocated;
@Named("disksizetotal")
private final long diskSizeTotal; private final long diskSizeTotal;
@Named("ipaddress")
private final String ipAddress; private final String ipAddress;
@Named("jobid")
private final String jobId; private final String jobId;
@Named("jobstatus")
private final String jobStatus; private final String jobStatus;
@ConstructorProperties({ @ConstructorProperties({
"id", "name", "path", "tags", "state", "type", "zoneid", "zonename", "podid", "podname", "clusterid", "clustername", "created", "disksizeallocated", "disksizetotal", "ipaddress", "jobid", "jobstatus" "id", "name", "path", "tags", "state", "type", "zoneid", "zonename", "podid", "podname", "clusterid", "clustername", "created", "disksizeallocated", "disksizetotal", "ipaddress", "jobid", "jobstatus"
}) })
protected StoragePool(String id, @Nullable String name, @Nullable String path, @Nullable String tags, @Nullable StoragePool.State state, @Nullable StoragePool.Type type, @Nullable String zoneId, @Nullable String zoneName, @Nullable String podId, @Nullable String podName, @Nullable String clusterId, @Nullable String clusterName, @Nullable Date created, long diskSizeAllocated, long diskSizeTotal, @Nullable String ipAddress, @Nullable String jobId, @Nullable String jobStatus) { protected StoragePool(String id, @Nullable String name, @Nullable String path, @Nullable String tags, @Nullable StoragePool.State state, @Nullable StoragePool.Type type, @Nullable String zoneId, @Nullable String zoneName, @Nullable String podId, @Nullable String podName, @Nullable String clusterId, @Nullable String clusterName, @Nullable Date created, long diskSizeAllocated, long diskSizeTotal, @Nullable String ipAddress, @Nullable String jobId, @Nullable String jobStatus) {
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
@ -450,35 +437,35 @@ public class StoragePool implements Comparable<StoragePool> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
StoragePool that = StoragePool.class.cast(obj); StoragePool that = StoragePool.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.path, that.path) && Objects.equal(this.path, that.path)
&& Objects.equal(this.tags, that.tags) && Objects.equal(this.tags, that.tags)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.type, that.type) && Objects.equal(this.type, that.type)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.zoneName, that.zoneName) && Objects.equal(this.zoneName, that.zoneName)
&& Objects.equal(this.podId, that.podId) && Objects.equal(this.podId, that.podId)
&& Objects.equal(this.podName, that.podName) && Objects.equal(this.podName, that.podName)
&& Objects.equal(this.clusterId, that.clusterId) && Objects.equal(this.clusterId, that.clusterId)
&& Objects.equal(this.clusterName, that.clusterName) && Objects.equal(this.clusterName, that.clusterName)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.diskSizeAllocated, that.diskSizeAllocated) && Objects.equal(this.diskSizeAllocated, that.diskSizeAllocated)
&& Objects.equal(this.diskSizeTotal, that.diskSizeTotal) && Objects.equal(this.diskSizeTotal, that.diskSizeTotal)
&& Objects.equal(this.ipAddress, that.ipAddress) && Objects.equal(this.ipAddress, that.ipAddress)
&& Objects.equal(this.jobId, that.jobId) && Objects.equal(this.jobId, that.jobId)
&& Objects.equal(this.jobStatus, that.jobStatus); && Objects.equal(this.jobStatus, that.jobStatus);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("name", name).add("path", path).add("tags", tags).add("state", state).add("type", type).add("zoneId", zoneId).add("zoneName", zoneName).add("podId", podId).add("podName", podName).add("clusterId", clusterId).add("clusterName", clusterName).add("created", created).add("diskSizeAllocated", diskSizeAllocated).add("diskSizeTotal", diskSizeTotal).add("ipAddress", ipAddress).add("jobId", jobId).add("jobStatus", jobStatus); .add("id", id).add("name", name).add("path", path).add("tags", tags).add("state", state).add("type", type).add("zoneId", zoneId).add("zoneName", zoneName).add("podId", podId).add("podName", podName).add("clusterId", clusterId).add("clusterName", clusterName).add("created", created).add("diskSizeAllocated", diskSizeAllocated).add("diskSizeTotal", diskSizeTotal).add("ipAddress", ipAddress).add("jobId", jobId).add("jobStatus", jobStatus);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();
} }
@Override @Override
public int compareTo(StoragePool other) { public int compareTo(StoragePool other) {
return this.id.compareTo(other.id); return this.id.compareTo(other.id);

View File

@ -25,7 +25,6 @@ import org.jclouds.cloudstack.features.OfferingClient;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
/** /**
*
* @author Adrian Cole * @author Adrian Cole
* @see OfferingClient#listServiceOfferings * @see OfferingClient#listServiceOfferings
*/ */

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -32,57 +30,57 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* @author Adrian Cole * @author Adrian Cole
*/ */
public class Template implements Comparable<Template> { public class Template implements Comparable<Template> {
public enum Status { public enum Status {
/** /**
* status of download is not known. Example - When the job for downloading doesn't exist * status of download is not known. Example - When the job for downloading doesn't exist
* during progress check. * during progress check.
*/ */
UNKNOWN, UNKNOWN,
/** /**
* the download has been cancelled/aborted. * the download has been cancelled/aborted.
*/ */
ABANDONED, ABANDONED,
/** /**
* the download has reached an error state. Example - there is not route to ssvm agent * the download has reached an error state. Example - there is not route to ssvm agent
*/ */
DOWNLOAD_ERROR, DOWNLOAD_ERROR,
/** /**
* the download hasn't started. * the download hasn't started.
*/ */
NOT_DOWNLOADED, NOT_DOWNLOADED,
/** /**
* the download is in progress * the download is in progress
*/ */
DOWNLOAD_IN_PROGRESS, DOWNLOAD_IN_PROGRESS,
/** /**
* the resource has been downloaded on secondary storage. * the resource has been downloaded on secondary storage.
*/ */
DOWNLOADED, DOWNLOADED,
// These states are specifically used for extraction of resources out of CS(ironically shown // These states are specifically used for extraction of resources out of CS(ironically shown
// as download template in the UI, API - extractTemplate ). Some of the generic states (like // as download template in the UI, API - extractTemplate ). Some of the generic states (like
// abandoned, unknown) above are used for the extraction tasks as well. // abandoned, unknown) above are used for the extraction tasks as well.
/** /**
* the resource has been uploaded * the resource has been uploaded
*/ */
UPLOADED, UPLOADED,
/** /**
* the resource upload work hasn't started yet * the resource upload work hasn't started yet
*/ */
NOT_UPLOADED, NOT_UPLOADED,
/** /**
* the resource upload has reached error. * the resource upload has reached error.
*/ */
UPLOAD_ERROR, UPLOAD_ERROR,
/** /**
* the resource upload is in progress. * the resource upload is in progress.
*/ */
UPLOAD_IN_PROGRESS, UNRECOGNIZED; UPLOAD_IN_PROGRESS, UNRECOGNIZED;
public static Status fromValue(String state) { public static Status fromValue(String state) {
if (state.equals("Download Complete")) { if (state.equals("Download Complete")) {
return DOWNLOADED; return DOWNLOADED;
@ -93,45 +91,45 @@ public class Template implements Comparable<Template> {
return UNRECOGNIZED; return UNRECOGNIZED;
} }
} }
} }
public static enum Type { public static enum Type {
USER, BUILTIN, UNRECOGNIZED; USER, BUILTIN, UNRECOGNIZED;
//TODO do we need camel case routines (e.g. see enums in VirtualMachine) ? //TODO do we need camel case routines (e.g. see enums in VirtualMachine) ?
public static Type fromValue(String type) { public static Type fromValue(String type) {
try { try {
return valueOf(checkNotNull(type, "type")); return valueOf(checkNotNull(type, "type"));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNRECOGNIZED; return UNRECOGNIZED;
} }
} }
} }
public enum Format { public enum Format {
VHD, QCOW2, OVA, UNRECOGNIZED; VHD, QCOW2, OVA, UNRECOGNIZED;
public static Format fromValue(String format) { public static Format fromValue(String format) {
try { try {
return valueOf(checkNotNull(format, "format")); return valueOf(checkNotNull(format, "format"));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNRECOGNIZED; return UNRECOGNIZED;
} }
} }
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromTemplate(this); return new ConcreteBuilder().fromTemplate(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -166,8 +164,8 @@ public class Template implements Comparable<Template> {
protected String hostName; protected String hostName;
protected String sourceTemplateId; protected String sourceTemplateId;
protected String templateTag; protected String templateTag;
/** /**
* @see Template#getId() * @see Template#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -175,7 +173,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getDisplayText() * @see Template#getDisplayText()
*/ */
public T displayText(String displayText) { public T displayText(String displayText) {
@ -183,7 +181,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getDomain() * @see Template#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -191,7 +189,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getDomainId() * @see Template#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -199,7 +197,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getAccount() * @see Template#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -207,7 +205,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getAccountId() * @see Template#getAccountId()
*/ */
public T accountId(String accountId) { public T accountId(String accountId) {
@ -215,7 +213,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getZone() * @see Template#getZone()
*/ */
public T zone(String zone) { public T zone(String zone) {
@ -223,7 +221,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getZoneId() * @see Template#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -231,7 +229,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getOSType() * @see Template#getOSType()
*/ */
public T OSType(String OSType) { public T OSType(String OSType) {
@ -239,7 +237,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getOSTypeId() * @see Template#getOSTypeId()
*/ */
public T OSTypeId(String OSTypeId) { public T OSTypeId(String OSTypeId) {
@ -247,7 +245,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getName() * @see Template#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -255,7 +253,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getType() * @see Template#getType()
*/ */
public T type(Template.Type type) { public T type(Template.Type type) {
@ -263,7 +261,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getStatus() * @see Template#getStatus()
*/ */
public T status(Template.Status status) { public T status(Template.Status status) {
@ -271,7 +269,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getFormat() * @see Template#getFormat()
*/ */
public T format(Template.Format format) { public T format(Template.Format format) {
@ -279,7 +277,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getHypervisor() * @see Template#getHypervisor()
*/ */
public T hypervisor(String hypervisor) { public T hypervisor(String hypervisor) {
@ -287,7 +285,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getSize() * @see Template#getSize()
*/ */
public T size(Long size) { public T size(Long size) {
@ -295,7 +293,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getCreated() * @see Template#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -303,7 +301,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getRemoved() * @see Template#getRemoved()
*/ */
public T removed(Date removed) { public T removed(Date removed) {
@ -311,7 +309,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#isCrossZones() * @see Template#isCrossZones()
*/ */
public T crossZones(boolean crossZones) { public T crossZones(boolean crossZones) {
@ -319,7 +317,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#isBootable() * @see Template#isBootable()
*/ */
public T bootable(boolean bootable) { public T bootable(boolean bootable) {
@ -327,7 +325,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#isExtractable() * @see Template#isExtractable()
*/ */
public T extractable(boolean extractable) { public T extractable(boolean extractable) {
@ -335,7 +333,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#isFeatured() * @see Template#isFeatured()
*/ */
public T featured(boolean featured) { public T featured(boolean featured) {
@ -343,7 +341,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#ispublic() * @see Template#ispublic()
*/ */
public T isPublic(boolean isPublic) { public T isPublic(boolean isPublic) {
@ -351,7 +349,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#isReady() * @see Template#isReady()
*/ */
public T ready(boolean ready) { public T ready(boolean ready) {
@ -359,7 +357,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#isPasswordEnabled() * @see Template#isPasswordEnabled()
*/ */
public T passwordEnabled(boolean passwordEnabled) { public T passwordEnabled(boolean passwordEnabled) {
@ -367,7 +365,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getJobId() * @see Template#getJobId()
*/ */
public T jobId(String jobId) { public T jobId(String jobId) {
@ -375,7 +373,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getJobStatus() * @see Template#getJobStatus()
*/ */
public T jobStatus(String jobStatus) { public T jobStatus(String jobStatus) {
@ -383,7 +381,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getChecksum() * @see Template#getChecksum()
*/ */
public T checksum(String checksum) { public T checksum(String checksum) {
@ -391,7 +389,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getHostId() * @see Template#getHostId()
*/ */
public T hostId(String hostId) { public T hostId(String hostId) {
@ -399,7 +397,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getHostName() * @see Template#getHostName()
*/ */
public T hostName(String hostName) { public T hostName(String hostName) {
@ -407,7 +405,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getSourceTemplateId() * @see Template#getSourceTemplateId()
*/ */
public T sourceTemplateId(String sourceTemplateId) { public T sourceTemplateId(String sourceTemplateId) {
@ -415,7 +413,7 @@ public class Template implements Comparable<Template> {
return self(); return self();
} }
/** /**
* @see Template#getTemplateTag() * @see Template#getTemplateTag()
*/ */
public T templateTag(String templateTag) { public T templateTag(String templateTag) {
@ -426,41 +424,41 @@ public class Template implements Comparable<Template> {
public Template build() { public Template build() {
return new Template(id, displayText, domain, domainId, account, accountId, zone, zoneId, OSType, OSTypeId, name, type, status, format, hypervisor, size, created, removed, crossZones, bootable, extractable, featured, isPublic, ready, passwordEnabled, jobId, jobStatus, checksum, hostId, hostName, sourceTemplateId, templateTag); return new Template(id, displayText, domain, domainId, account, accountId, zone, zoneId, OSType, OSTypeId, name, type, status, format, hypervisor, size, created, removed, crossZones, bootable, extractable, featured, isPublic, ready, passwordEnabled, jobId, jobStatus, checksum, hostId, hostName, sourceTemplateId, templateTag);
} }
public T fromTemplate(Template in) { public T fromTemplate(Template in) {
return this return this
.id(in.getId()) .id(in.getId())
.displayText(in.getDisplayText()) .displayText(in.getDisplayText())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.account(in.getAccount()) .account(in.getAccount())
.accountId(in.getAccountId()) .accountId(in.getAccountId())
.zone(in.getZone()) .zone(in.getZone())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.OSType(in.getOSType()) .OSType(in.getOSType())
.OSTypeId(in.getOSTypeId()) .OSTypeId(in.getOSTypeId())
.name(in.getName()) .name(in.getName())
.type(in.getType()) .type(in.getType())
.status(in.getStatus()) .status(in.getStatus())
.format(in.getFormat()) .format(in.getFormat())
.hypervisor(in.getHypervisor()) .hypervisor(in.getHypervisor())
.size(in.getSize()) .size(in.getSize())
.created(in.getCreated()) .created(in.getCreated())
.removed(in.getRemoved()) .removed(in.getRemoved())
.crossZones(in.isCrossZones()) .crossZones(in.isCrossZones())
.bootable(in.isBootable()) .bootable(in.isBootable())
.extractable(in.isExtractable()) .extractable(in.isExtractable())
.featured(in.isFeatured()) .featured(in.isFeatured())
.isPublic(in.ispublic()) .isPublic(in.ispublic())
.ready(in.isReady()) .ready(in.isReady())
.passwordEnabled(in.isPasswordEnabled()) .passwordEnabled(in.isPasswordEnabled())
.jobId(in.getJobId()) .jobId(in.getJobId())
.jobStatus(in.getJobStatus()) .jobStatus(in.getJobStatus())
.checksum(in.getChecksum()) .checksum(in.getChecksum())
.hostId(in.getHostId()) .hostId(in.getHostId())
.hostName(in.getHostName()) .hostName(in.getHostName())
.sourceTemplateId(in.getSourceTemplateId()) .sourceTemplateId(in.getSourceTemplateId())
.templateTag(in.getTemplateTag()); .templateTag(in.getTemplateTag());
} }
} }
@ -472,24 +470,16 @@ public class Template implements Comparable<Template> {
} }
private final String id; private final String id;
@Named("displaytext")
private final String displayText; private final String displayText;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
private final String account; private final String account;
@Named("accountid")
private final String accountId; private final String accountId;
@Named("zonename")
private final String zone; private final String zone;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("ostypename")
private final String OSType; private final String OSType;
@Named("ostypeid")
private final String OSTypeId; private final String OSTypeId;
private final String name; private final String name;
@Named("templatetype")
private final Template.Type type; private final Template.Type type;
private final Template.Status status; private final Template.Status status;
private final Template.Format format; private final Template.Format format;
@ -499,33 +489,24 @@ public class Template implements Comparable<Template> {
private final Date removed; private final Date removed;
private final boolean crossZones; private final boolean crossZones;
private final boolean bootable; private final boolean bootable;
@Named("isextractable")
private final boolean extractable; private final boolean extractable;
@Named("isfeatured")
private final boolean featured; private final boolean featured;
private final boolean ispublic; private final boolean ispublic;
@Named("isready")
private final boolean ready; private final boolean ready;
@Named("passwordenabled")
private final boolean passwordEnabled; private final boolean passwordEnabled;
@Named("jobid")
private final String jobId; private final String jobId;
@Named("jobstatus")
private final String jobStatus; private final String jobStatus;
private final String checksum; private final String checksum;
private final String hostId; private final String hostId;
@Named("hostname")
private final String hostName; private final String hostName;
@Named("sourcetemplateid")
private final String sourceTemplateId; private final String sourceTemplateId;
@Named("templatetag")
private final String templateTag; private final String templateTag;
@ConstructorProperties({ @ConstructorProperties({
"id", "displaytext", "domain", "domainid", "account", "accountid", "zonename", "zoneid", "ostypename", "ostypeid", "id", "displaytext", "domain", "domainid", "account", "accountid", "zonename", "zoneid", "ostypename", "ostypeid",
"name", "templatetype", "status", "format", "hypervisor", "size", "created", "removed", "crossZones", "bootable", "name", "templatetype", "status", "format", "hypervisor", "size", "created", "removed", "crossZones", "bootable",
"isextractable", "isfeatured", "ispublic", "isready", "passwordenabled", "jobid", "jobstatus", "checksum", "hostId", "isextractable", "isfeatured", "ispublic", "isready", "passwordenabled", "jobid", "jobstatus", "checksum", "hostId",
"hostname", "sourcetemplateid", "templatetag" "hostname", "sourcetemplateid", "templatetag"
}) })
protected Template(String id, @Nullable String displayText, @Nullable String domain, @Nullable String domainId, protected Template(String id, @Nullable String displayText, @Nullable String domain, @Nullable String domainId,
@Nullable String account, @Nullable String accountId, @Nullable String zone, @Nullable String zoneId, @Nullable String account, @Nullable String accountId, @Nullable String zone, @Nullable String zoneId,
@ -760,7 +741,7 @@ public class Template implements Comparable<Template> {
/** /**
* @return shows the current pending asynchronous job ID, or null if current * @return shows the current pending asynchronous job ID, or null if current
pending jobs are acting on the template * pending jobs are acting on the template
*/ */
@Nullable @Nullable
public String getJobId() { public String getJobId() {
@ -826,44 +807,44 @@ public class Template implements Comparable<Template> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
Template that = Template.class.cast(obj); Template that = Template.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.displayText, that.displayText) && Objects.equal(this.displayText, that.displayText)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.accountId, that.accountId) && Objects.equal(this.accountId, that.accountId)
&& Objects.equal(this.zone, that.zone) && Objects.equal(this.zone, that.zone)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.OSType, that.OSType) && Objects.equal(this.OSType, that.OSType)
&& Objects.equal(this.OSTypeId, that.OSTypeId) && Objects.equal(this.OSTypeId, that.OSTypeId)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.type, that.type) && Objects.equal(this.type, that.type)
&& Objects.equal(this.status, that.status) && Objects.equal(this.status, that.status)
&& Objects.equal(this.format, that.format) && Objects.equal(this.format, that.format)
&& Objects.equal(this.hypervisor, that.hypervisor) && Objects.equal(this.hypervisor, that.hypervisor)
&& Objects.equal(this.size, that.size) && Objects.equal(this.size, that.size)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.removed, that.removed) && Objects.equal(this.removed, that.removed)
&& Objects.equal(this.crossZones, that.crossZones) && Objects.equal(this.crossZones, that.crossZones)
&& Objects.equal(this.bootable, that.bootable) && Objects.equal(this.bootable, that.bootable)
&& Objects.equal(this.extractable, that.extractable) && Objects.equal(this.extractable, that.extractable)
&& Objects.equal(this.featured, that.featured) && Objects.equal(this.featured, that.featured)
&& Objects.equal(this.ispublic, that.ispublic) && Objects.equal(this.ispublic, that.ispublic)
&& Objects.equal(this.ready, that.ready) && Objects.equal(this.ready, that.ready)
&& Objects.equal(this.passwordEnabled, that.passwordEnabled) && Objects.equal(this.passwordEnabled, that.passwordEnabled)
&& Objects.equal(this.jobId, that.jobId) && Objects.equal(this.jobId, that.jobId)
&& Objects.equal(this.jobStatus, that.jobStatus) && Objects.equal(this.jobStatus, that.jobStatus)
&& Objects.equal(this.checksum, that.checksum) && Objects.equal(this.checksum, that.checksum)
&& Objects.equal(this.hostId, that.hostId) && Objects.equal(this.hostId, that.hostId)
&& Objects.equal(this.hostName, that.hostName) && Objects.equal(this.hostName, that.hostName)
&& Objects.equal(this.sourceTemplateId, that.sourceTemplateId) && Objects.equal(this.sourceTemplateId, that.sourceTemplateId)
&& Objects.equal(this.templateTag, that.templateTag); && Objects.equal(this.templateTag, that.templateTag);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("displayText", displayText).add("domain", domain).add("domainId", domainId).add("account", account).add("accountId", accountId).add("zone", zone).add("zoneId", zoneId).add("OSType", OSType).add("OSTypeId", OSTypeId).add("name", name).add("type", type).add("status", status).add("format", format).add("hypervisor", hypervisor).add("size", size).add("created", created).add("removed", removed).add("crossZones", crossZones).add("bootable", bootable).add("extractable", extractable).add("featured", featured).add("ispublic", ispublic).add("ready", ready).add("passwordEnabled", passwordEnabled).add("jobId", jobId).add("jobStatus", jobStatus).add("checksum", checksum).add("hostId", hostId).add("hostName", hostName).add("sourceTemplateId", sourceTemplateId).add("templateTag", templateTag); .add("id", id).add("displayText", displayText).add("domain", domain).add("domainId", domainId).add("account", account).add("accountId", accountId).add("zone", zone).add("zoneId", zoneId).add("OSType", OSType).add("OSTypeId", OSTypeId).add("name", name).add("type", type).add("status", status).add("format", format).add("hypervisor", hypervisor).add("size", size).add("created", created).add("removed", removed).add("crossZones", crossZones).add("bootable", bootable).add("extractable", extractable).add("featured", featured).add("ispublic", ispublic).add("ready", ready).add("passwordEnabled", passwordEnabled).add("jobId", jobId).add("jobStatus", jobStatus).add("checksum", checksum).add("hostId", hostId).add("hostName", hostName).add("sourceTemplateId", sourceTemplateId).add("templateTag", templateTag);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -32,18 +30,18 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* @author Richard Downer * @author Richard Downer
*/ */
public class TemplateExtraction implements Comparable<TemplateExtraction> { public class TemplateExtraction implements Comparable<TemplateExtraction> {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromTemplateExtraction(this); return new ConcreteBuilder().fromTemplateExtraction(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -59,8 +57,8 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
protected String url; protected String url;
protected String zoneId; protected String zoneId;
protected String zoneName; protected String zoneName;
/** /**
* @see TemplateExtraction#getId() * @see TemplateExtraction#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -68,7 +66,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getAccountId() * @see TemplateExtraction#getAccountId()
*/ */
public T accountId(String accountId) { public T accountId(String accountId) {
@ -76,7 +74,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getCreated() * @see TemplateExtraction#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -84,7 +82,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getExtractId() * @see TemplateExtraction#getExtractId()
*/ */
public T extractId(String extractId) { public T extractId(String extractId) {
@ -92,7 +90,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getExtractMode() * @see TemplateExtraction#getExtractMode()
*/ */
public T extractMode(ExtractMode extractMode) { public T extractMode(ExtractMode extractMode) {
@ -100,7 +98,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getName() * @see TemplateExtraction#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -108,7 +106,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getState() * @see TemplateExtraction#getState()
*/ */
public T state(String state) { public T state(String state) {
@ -116,7 +114,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getStatus() * @see TemplateExtraction#getStatus()
*/ */
public T status(String status) { public T status(String status) {
@ -124,7 +122,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getStorageType() * @see TemplateExtraction#getStorageType()
*/ */
public T storageType(String storageType) { public T storageType(String storageType) {
@ -132,7 +130,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getUploadPercentage() * @see TemplateExtraction#getUploadPercentage()
*/ */
public T uploadPercentage(int uploadPercentage) { public T uploadPercentage(int uploadPercentage) {
@ -140,7 +138,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getUrl() * @see TemplateExtraction#getUrl()
*/ */
public T url(String url) { public T url(String url) {
@ -148,7 +146,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getZoneId() * @see TemplateExtraction#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -156,7 +154,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
return self(); return self();
} }
/** /**
* @see TemplateExtraction#getZoneName() * @see TemplateExtraction#getZoneName()
*/ */
public T zoneName(String zoneName) { public T zoneName(String zoneName) {
@ -167,22 +165,22 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
public TemplateExtraction build() { public TemplateExtraction build() {
return new TemplateExtraction(id, accountId, created, extractId, extractMode, name, state, status, storageType, uploadPercentage, url, zoneId, zoneName); return new TemplateExtraction(id, accountId, created, extractId, extractMode, name, state, status, storageType, uploadPercentage, url, zoneId, zoneName);
} }
public T fromTemplateExtraction(TemplateExtraction in) { public T fromTemplateExtraction(TemplateExtraction in) {
return this return this
.id(in.getId()) .id(in.getId())
.accountId(in.getAccountId()) .accountId(in.getAccountId())
.created(in.getCreated()) .created(in.getCreated())
.extractId(in.getExtractId()) .extractId(in.getExtractId())
.extractMode(in.getExtractMode()) .extractMode(in.getExtractMode())
.name(in.getName()) .name(in.getName())
.state(in.getState()) .state(in.getState())
.status(in.getStatus()) .status(in.getStatus())
.storageType(in.getStorageType()) .storageType(in.getStorageType())
.uploadPercentage(in.getUploadPercentage()) .uploadPercentage(in.getUploadPercentage())
.url(in.getUrl()) .url(in.getUrl())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.zoneName(in.getZoneName()); .zoneName(in.getZoneName());
} }
} }
@ -194,7 +192,6 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
} }
private final String id; private final String id;
@Named("accountid")
private final String accountId; private final String accountId;
private final Date created; private final Date created;
private final String extractId; private final String extractId;
@ -202,18 +199,14 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
private final String name; private final String name;
private final String state; private final String state;
private final String status; private final String status;
@Named("storagetype")
private final String storageType; private final String storageType;
@Named("uploadpercentage")
private final int uploadPercentage; private final int uploadPercentage;
private final String url; private final String url;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@ConstructorProperties({ @ConstructorProperties({
"id", "accountid", "created", "extractId", "extractMode", "name", "state", "status", "storagetype", "uploadpercentage", "url", "zoneid", "zonename" "id", "accountid", "created", "extractId", "extractMode", "name", "state", "status", "storagetype", "uploadpercentage", "url", "zoneid", "zonename"
}) })
protected TemplateExtraction(String id, @Nullable String accountId, @Nullable Date created, @Nullable String extractId, protected TemplateExtraction(String id, @Nullable String accountId, @Nullable Date created, @Nullable String extractId,
@Nullable ExtractMode extractMode, @Nullable String name, @Nullable String state, @Nullable String status, @Nullable ExtractMode extractMode, @Nullable String name, @Nullable String state, @Nullable String status,
@ -347,25 +340,25 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
TemplateExtraction that = TemplateExtraction.class.cast(obj); TemplateExtraction that = TemplateExtraction.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.accountId, that.accountId) && Objects.equal(this.accountId, that.accountId)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.extractId, that.extractId) && Objects.equal(this.extractId, that.extractId)
&& Objects.equal(this.extractMode, that.extractMode) && Objects.equal(this.extractMode, that.extractMode)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.status, that.status) && Objects.equal(this.status, that.status)
&& Objects.equal(this.storageType, that.storageType) && Objects.equal(this.storageType, that.storageType)
&& Objects.equal(this.uploadPercentage, that.uploadPercentage) && Objects.equal(this.uploadPercentage, that.uploadPercentage)
&& Objects.equal(this.url, that.url) && Objects.equal(this.url, that.url)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.zoneName, that.zoneName); && Objects.equal(this.zoneName, that.zoneName);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("accountId", accountId).add("created", created).add("extractId", extractId).add("extractMode", extractMode).add("name", name).add("state", state).add("status", status).add("storageType", storageType).add("uploadPercentage", uploadPercentage).add("url", url).add("zoneId", zoneId).add("zoneName", zoneName); .add("id", id).add("accountId", accountId).add("created", created).add("extractId", extractId).add("extractMode", extractMode).add("name", name).add("state", state).add("status", status).add("storageType", storageType).add("uploadPercentage", uploadPercentage).add("url", url).add("zoneId", zoneId).add("zoneName", zoneName);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,7 +23,6 @@ import org.jclouds.cloudstack.features.TemplateClient;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
/** /**
*
* @author Adrian Cole * @author Adrian Cole
* @see TemplateClient#listTemplates * @see TemplateClient#listTemplates
*/ */

View File

@ -29,20 +29,20 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class TemplateMetadata * Class TemplateMetadata
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class TemplateMetadata { public class TemplateMetadata {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromTemplateMetadata(this); return new ConcreteBuilder().fromTemplateMetadata(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String name; protected String name;
@ -52,8 +52,8 @@ public class TemplateMetadata {
protected String volumeId; protected String volumeId;
protected String virtualMachineId; protected String virtualMachineId;
protected Boolean passwordEnabled; protected Boolean passwordEnabled;
/** /**
* @see TemplateMetadata#getName() * @see TemplateMetadata#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -61,7 +61,7 @@ public class TemplateMetadata {
return self(); return self();
} }
/** /**
* @see TemplateMetadata#getOsTypeId() * @see TemplateMetadata#getOsTypeId()
*/ */
public T osTypeId(String osTypeId) { public T osTypeId(String osTypeId) {
@ -69,7 +69,7 @@ public class TemplateMetadata {
return self(); return self();
} }
/** /**
* @see TemplateMetadata#getDisplayText() * @see TemplateMetadata#getDisplayText()
*/ */
public T displayText(String displayText) { public T displayText(String displayText) {
@ -77,7 +77,7 @@ public class TemplateMetadata {
return self(); return self();
} }
/** /**
* @see TemplateMetadata#getSnapshotId() * @see TemplateMetadata#getSnapshotId()
*/ */
public T snapshotId(String snapshotId) { public T snapshotId(String snapshotId) {
@ -85,7 +85,7 @@ public class TemplateMetadata {
return self(); return self();
} }
/** /**
* @see TemplateMetadata#getVolumeId() * @see TemplateMetadata#getVolumeId()
*/ */
public T volumeId(String volumeId) { public T volumeId(String volumeId) {
@ -93,7 +93,7 @@ public class TemplateMetadata {
return self(); return self();
} }
/** /**
* @see TemplateMetadata#getVirtualMachineId() * @see TemplateMetadata#getVirtualMachineId()
*/ */
public T virtualMachineId(String virtualMachineId) { public T virtualMachineId(String virtualMachineId) {
@ -101,7 +101,7 @@ public class TemplateMetadata {
return self(); return self();
} }
/** /**
* @see TemplateMetadata#isPasswordEnabled() * @see TemplateMetadata#isPasswordEnabled()
*/ */
public T passwordEnabled(Boolean passwordEnabled) { public T passwordEnabled(Boolean passwordEnabled) {
@ -112,16 +112,16 @@ public class TemplateMetadata {
public TemplateMetadata build() { public TemplateMetadata build() {
return new TemplateMetadata(name, osTypeId, displayText, snapshotId, volumeId, virtualMachineId, passwordEnabled); return new TemplateMetadata(name, osTypeId, displayText, snapshotId, volumeId, virtualMachineId, passwordEnabled);
} }
public T fromTemplateMetadata(TemplateMetadata in) { public T fromTemplateMetadata(TemplateMetadata in) {
return this return this
.name(in.getName()) .name(in.getName())
.osTypeId(in.getOsTypeId()) .osTypeId(in.getOsTypeId())
.displayText(in.getDisplayText()) .displayText(in.getDisplayText())
.snapshotId(in.getSnapshotId()) .snapshotId(in.getSnapshotId())
.volumeId(in.getVolumeId()) .volumeId(in.getVolumeId())
.virtualMachineId(in.getVirtualMachineId()) .virtualMachineId(in.getVirtualMachineId())
.passwordEnabled(in.isPasswordEnabled()); .passwordEnabled(in.isPasswordEnabled());
} }
} }
@ -141,7 +141,7 @@ public class TemplateMetadata {
private final Boolean passwordEnabled; private final Boolean passwordEnabled;
@ConstructorProperties({ @ConstructorProperties({
"name", "osTypeId", "displayText", "snapshotId", "volumeId", "virtualMachineId", "passwordEnabled" "name", "osTypeId", "displayText", "snapshotId", "volumeId", "virtualMachineId", "passwordEnabled"
}) })
protected TemplateMetadata(String name, @Nullable String osTypeId, @Nullable String displayText, @Nullable String snapshotId, protected TemplateMetadata(String name, @Nullable String osTypeId, @Nullable String displayText, @Nullable String snapshotId,
@Nullable String volumeId, String virtualMachineId, Boolean passwordEnabled) { @Nullable String volumeId, String virtualMachineId, Boolean passwordEnabled) {
@ -217,20 +217,20 @@ public class TemplateMetadata {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
TemplateMetadata that = TemplateMetadata.class.cast(obj); TemplateMetadata that = TemplateMetadata.class.cast(obj);
return Objects.equal(this.name, that.name) return Objects.equal(this.name, that.name)
&& Objects.equal(this.osTypeId, that.osTypeId) && Objects.equal(this.osTypeId, that.osTypeId)
&& Objects.equal(this.displayText, that.displayText) && Objects.equal(this.displayText, that.displayText)
&& Objects.equal(this.snapshotId, that.snapshotId) && Objects.equal(this.snapshotId, that.snapshotId)
&& Objects.equal(this.volumeId, that.volumeId) && Objects.equal(this.volumeId, that.volumeId)
&& Objects.equal(this.virtualMachineId, that.virtualMachineId) && Objects.equal(this.virtualMachineId, that.virtualMachineId)
&& Objects.equal(this.passwordEnabled, that.passwordEnabled); && Objects.equal(this.passwordEnabled, that.passwordEnabled);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("name", name).add("osTypeId", osTypeId).add("displayText", displayText).add("snapshotId", snapshotId) .add("name", name).add("osTypeId", osTypeId).add("displayText", displayText).add("snapshotId", snapshotId)
.add("volumeId", volumeId).add("virtualMachineId", virtualMachineId).add("passwordEnabled", passwordEnabled); .add("volumeId", volumeId).add("virtualMachineId", virtualMachineId).add("passwordEnabled", passwordEnabled);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -31,26 +29,26 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* @author Richard Downer * @author Richard Downer
*/ */
public class TemplatePermission { public class TemplatePermission {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromTemplatePermission(this); return new ConcreteBuilder().fromTemplatePermission(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
protected String account; protected String account;
protected String domainId; protected String domainId;
protected boolean isPublic; protected boolean isPublic;
/** /**
* @see TemplatePermission#getId() * @see TemplatePermission#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -58,7 +56,7 @@ public class TemplatePermission {
return self(); return self();
} }
/** /**
* @see TemplatePermission#getAccount() * @see TemplatePermission#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -66,7 +64,7 @@ public class TemplatePermission {
return self(); return self();
} }
/** /**
* @see TemplatePermission#getDomainId() * @see TemplatePermission#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -74,7 +72,7 @@ public class TemplatePermission {
return self(); return self();
} }
/** /**
* @see TemplatePermission#isPublic() * @see TemplatePermission#isPublic()
*/ */
public T isPublic(boolean isPublic) { public T isPublic(boolean isPublic) {
@ -85,13 +83,13 @@ public class TemplatePermission {
public TemplatePermission build() { public TemplatePermission build() {
return new TemplatePermission(id, account, domainId, isPublic); return new TemplatePermission(id, account, domainId, isPublic);
} }
public T fromTemplatePermission(TemplatePermission in) { public T fromTemplatePermission(TemplatePermission in) {
return this return this
.id(in.getId()) .id(in.getId())
.account(in.getAccount()) .account(in.getAccount())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.isPublic(in.isPublic()); .isPublic(in.isPublic());
} }
} }
@ -104,13 +102,11 @@ public class TemplatePermission {
private final String id; private final String id;
private final String account; private final String account;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("ispublic")
private final boolean isPublic; private final boolean isPublic;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "domainid", "ispublic" "id", "account", "domainid", "ispublic"
}) })
protected TemplatePermission(String id, @Nullable String account, @Nullable String domainId, boolean isPublic) { protected TemplatePermission(String id, @Nullable String account, @Nullable String domainId, boolean isPublic) {
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
@ -121,7 +117,7 @@ public class TemplatePermission {
/** /**
* Gets the template ID * Gets the template ID
* *
* @return the template ID * @return the template ID
*/ */
public String getId() { public String getId() {
@ -130,7 +126,7 @@ public class TemplatePermission {
/** /**
* Gets the list of accounts the template is available for * Gets the list of accounts the template is available for
* *
* @return the list of accounts the template is available for * @return the list of accounts the template is available for
*/ */
@Nullable @Nullable
@ -140,7 +136,7 @@ public class TemplatePermission {
/** /**
* Gets the ID of the domain to which the template belongs * Gets the ID of the domain to which the template belongs
* *
* @return the ID of the domain to which the template belongs * @return the ID of the domain to which the template belongs
*/ */
@Nullable @Nullable
@ -150,7 +146,7 @@ public class TemplatePermission {
/** /**
* Returns true if this template is a public template, false otherwise * Returns true if this template is a public template, false otherwise
* *
* @return true if this template is a public template, false otherwise * @return true if this template is a public template, false otherwise
*/ */
public boolean isPublic() { public boolean isPublic() {
@ -168,16 +164,16 @@ public class TemplatePermission {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
TemplatePermission that = TemplatePermission.class.cast(obj); TemplatePermission that = TemplatePermission.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.isPublic, that.isPublic); && Objects.equal(this.isPublic, that.isPublic);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("account", account).add("domainId", domainId).add("isPublic", isPublic); .add("id", id).add("account", account).add("domainId", domainId).add("isPublic", isPublic);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
/** /**
*
* @author Adrian Cole * @author Adrian Cole
* @see NetworkOfferingClient#listNetworkOfferings * @see NetworkOfferingClient#listNetworkOfferings
*/ */
@ -54,6 +53,7 @@ public enum TrafficType {
CONTROL, CONTROL,
UNRECOGNIZED; UNRECOGNIZED;
@Override @Override
public String toString() { public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());

View File

@ -24,8 +24,6 @@ import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -36,9 +34,9 @@ import com.google.common.collect.Maps;
/** /**
* Represents a usage record from CloudStack * Represents a usage record from CloudStack
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class UsageRecord { public class UsageRecord {
/** /**
@ -59,44 +57,44 @@ public class UsageRecord {
NETWORK_OFFERING(13), NETWORK_OFFERING(13),
VPN_USERS(14), VPN_USERS(14),
UNRECOGNIZED(0); UNRECOGNIZED(0);
private int code; private int code;
private static final Map<Integer, UsageType> INDEX = Maps.uniqueIndex(ImmutableSet.copyOf(UsageType.values()), private static final Map<Integer, UsageType> INDEX = Maps.uniqueIndex(ImmutableSet.copyOf(UsageType.values()),
new Function<UsageType, Integer>() { new Function<UsageType, Integer>() {
@Override @Override
public Integer apply(UsageType input) { public Integer apply(UsageType input) {
return input.code; return input.code;
} }
}); });
UsageType(int code) { UsageType(int code) {
this.code = code; this.code = code;
} }
@Override @Override
public String toString() { public String toString() {
return "" + code; return "" + code;
} }
public static UsageType fromValue(String usageType) { public static UsageType fromValue(String usageType) {
Integer code = new Integer(checkNotNull(usageType, "usageType")); Integer code = new Integer(checkNotNull(usageType, "usageType"));
return INDEX.containsKey(code) ? INDEX.get(code) : UNRECOGNIZED; return INDEX.containsKey(code) ? INDEX.get(code) : UNRECOGNIZED;
} }
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromUsageRecord(this); return new ConcreteBuilder().fromUsageRecord(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -119,8 +117,8 @@ public class UsageRecord {
protected String usage; protected String usage;
protected String type; protected String type;
protected UsageType usageType; protected UsageType usageType;
/** /**
* @see UsageRecord#getId() * @see UsageRecord#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -128,7 +126,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getDescription() * @see UsageRecord#getDescription()
*/ */
public T description(String description) { public T description(String description) {
@ -136,7 +134,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getAccountId() * @see UsageRecord#getAccountId()
*/ */
public T accountId(String accountId) { public T accountId(String accountId) {
@ -144,7 +142,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getAccountName() * @see UsageRecord#getAccountName()
*/ */
public T accountName(String accountName) { public T accountName(String accountName) {
@ -152,7 +150,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getDomainId() * @see UsageRecord#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -160,7 +158,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getStartDate() * @see UsageRecord#getStartDate()
*/ */
public T startDate(Date startDate) { public T startDate(Date startDate) {
@ -168,7 +166,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getEndDate() * @see UsageRecord#getEndDate()
*/ */
public T endDate(Date endDate) { public T endDate(Date endDate) {
@ -176,7 +174,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getAssignDate() * @see UsageRecord#getAssignDate()
*/ */
public T assignDate(Date assignDate) { public T assignDate(Date assignDate) {
@ -184,7 +182,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getReleaseDate() * @see UsageRecord#getReleaseDate()
*/ */
public T releaseDate(String releaseDate) { public T releaseDate(String releaseDate) {
@ -192,7 +190,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getZoneId() * @see UsageRecord#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -200,7 +198,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getVirtualMachineId() * @see UsageRecord#getVirtualMachineId()
*/ */
public T virtualMachineId(String virtualMachineId) { public T virtualMachineId(String virtualMachineId) {
@ -208,7 +206,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getVirtualMachineName() * @see UsageRecord#getVirtualMachineName()
*/ */
public T virtualMachineName(String virtualMachineName) { public T virtualMachineName(String virtualMachineName) {
@ -216,7 +214,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getServiceOfferingId() * @see UsageRecord#getServiceOfferingId()
*/ */
public T serviceOfferingId(String serviceOfferingId) { public T serviceOfferingId(String serviceOfferingId) {
@ -224,7 +222,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getTemplateId() * @see UsageRecord#getTemplateId()
*/ */
public T templateId(String templateId) { public T templateId(String templateId) {
@ -232,7 +230,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getIpAddress() * @see UsageRecord#getIpAddress()
*/ */
public T ipAddress(String ipAddress) { public T ipAddress(String ipAddress) {
@ -240,7 +238,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#isSourceNAT() * @see UsageRecord#isSourceNAT()
*/ */
public T isSourceNAT(boolean isSourceNAT) { public T isSourceNAT(boolean isSourceNAT) {
@ -248,7 +246,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getRawUsageHours() * @see UsageRecord#getRawUsageHours()
*/ */
public T rawUsageHours(double rawUsageHours) { public T rawUsageHours(double rawUsageHours) {
@ -256,7 +254,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getUsage() * @see UsageRecord#getUsage()
*/ */
public T usage(String usage) { public T usage(String usage) {
@ -264,7 +262,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getType() * @see UsageRecord#getType()
*/ */
public T type(String type) { public T type(String type) {
@ -272,7 +270,7 @@ public class UsageRecord {
return self(); return self();
} }
/** /**
* @see UsageRecord#getUsageType() * @see UsageRecord#getUsageType()
*/ */
public T usageType(UsageType usageType) { public T usageType(UsageType usageType) {
@ -285,29 +283,29 @@ public class UsageRecord {
zoneId, virtualMachineId, virtualMachineName, serviceOfferingId, templateId, ipAddress, isSourceNAT, rawUsageHours, zoneId, virtualMachineId, virtualMachineName, serviceOfferingId, templateId, ipAddress, isSourceNAT, rawUsageHours,
usage, type, usageType); usage, type, usageType);
} }
public T fromUsageRecord(UsageRecord in) { public T fromUsageRecord(UsageRecord in) {
return this return this
.id(in.getId()) .id(in.getId())
.description(in.getDescription()) .description(in.getDescription())
.accountId(in.getAccountId()) .accountId(in.getAccountId())
.accountName(in.getAccountName()) .accountName(in.getAccountName())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.startDate(in.getStartDate()) .startDate(in.getStartDate())
.endDate(in.getEndDate()) .endDate(in.getEndDate())
.assignDate(in.getAssignDate()) .assignDate(in.getAssignDate())
.releaseDate(in.getReleaseDate()) .releaseDate(in.getReleaseDate())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.virtualMachineId(in.getVirtualMachineId()) .virtualMachineId(in.getVirtualMachineId())
.virtualMachineName(in.getVirtualMachineName()) .virtualMachineName(in.getVirtualMachineName())
.serviceOfferingId(in.getServiceOfferingId()) .serviceOfferingId(in.getServiceOfferingId())
.templateId(in.getTemplateId()) .templateId(in.getTemplateId())
.ipAddress(in.getIpAddress()) .ipAddress(in.getIpAddress())
.isSourceNAT(in.isSourceNAT()) .isSourceNAT(in.isSourceNAT())
.rawUsageHours(in.getRawUsageHours()) .rawUsageHours(in.getRawUsageHours())
.usage(in.getUsage()) .usage(in.getUsage())
.type(in.getType()) .type(in.getType())
.usageType(in.getUsageType()); .usageType(in.getUsageType());
} }
} }
@ -318,46 +316,29 @@ public class UsageRecord {
} }
} }
@Named("usageid")
private final String id; private final String id;
private final String description; private final String description;
@Named("accountid")
private final String accountId; private final String accountId;
@Named("account")
private final String accountName; private final String accountName;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("startdate")
private final Date startDate; private final Date startDate;
@Named("enddate")
private final Date endDate; private final Date endDate;
@Named("assigndate")
private final Date assignDate; private final Date assignDate;
@Named("releasedate")
private final String releaseDate; private final String releaseDate;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("virtualmachineid")
private final String virtualMachineId; private final String virtualMachineId;
@Named("name")
private final String virtualMachineName; private final String virtualMachineName;
@Named("offeringid")
private final String serviceOfferingId; private final String serviceOfferingId;
@Named("templateid")
private final String templateId; private final String templateId;
@Named("ipaddress")
private final String ipAddress; private final String ipAddress;
@Named("issourcenat")
private final boolean isSourceNAT; private final boolean isSourceNAT;
@Named("rawusage")
private final double rawUsageHours; private final double rawUsageHours;
private final String usage; private final String usage;
private final String type; private final String type;
@Named("usagetype")
private final UsageType usageType; private final UsageType usageType;
@ConstructorProperties({ @ConstructorProperties({
"usageid", "description", "accountid", "account", "domainid", "startdate", "enddate", "assigndate", "releasedate", "usageid", "description", "accountid", "account", "domainid", "startdate", "enddate", "assigndate", "releasedate",
"zoneid", "virtualmachineid", "name", "offeringid", "templateid", "ipaddress", "issourcenat", "rawusage", "usage", "zoneid", "virtualmachineid", "name", "offeringid", "templateid", "ipaddress", "issourcenat", "rawusage", "usage",
"type", "usagetype" "type", "usagetype"
}) })
@ -498,27 +479,27 @@ public class UsageRecord {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
UsageRecord that = UsageRecord.class.cast(obj); UsageRecord that = UsageRecord.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.description, that.description) && Objects.equal(this.description, that.description)
&& Objects.equal(this.accountId, that.accountId) && Objects.equal(this.accountId, that.accountId)
&& Objects.equal(this.accountName, that.accountName) && Objects.equal(this.accountName, that.accountName)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.startDate, that.startDate) && Objects.equal(this.startDate, that.startDate)
&& Objects.equal(this.endDate, that.endDate) && Objects.equal(this.endDate, that.endDate)
&& Objects.equal(this.assignDate, that.assignDate) && Objects.equal(this.assignDate, that.assignDate)
&& Objects.equal(this.releaseDate, that.releaseDate) && Objects.equal(this.releaseDate, that.releaseDate)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.virtualMachineId, that.virtualMachineId) && Objects.equal(this.virtualMachineId, that.virtualMachineId)
&& Objects.equal(this.virtualMachineName, that.virtualMachineName) && Objects.equal(this.virtualMachineName, that.virtualMachineName)
&& Objects.equal(this.serviceOfferingId, that.serviceOfferingId) && Objects.equal(this.serviceOfferingId, that.serviceOfferingId)
&& Objects.equal(this.templateId, that.templateId) && Objects.equal(this.templateId, that.templateId)
&& Objects.equal(this.ipAddress, that.ipAddress) && Objects.equal(this.ipAddress, that.ipAddress)
&& Objects.equal(this.isSourceNAT, that.isSourceNAT) && Objects.equal(this.isSourceNAT, that.isSourceNAT)
&& Objects.equal(this.rawUsageHours, that.rawUsageHours) && Objects.equal(this.rawUsageHours, that.rawUsageHours)
&& Objects.equal(this.usage, that.usage) && Objects.equal(this.usage, that.usage)
&& Objects.equal(this.type, that.type) && Objects.equal(this.type, that.type)
&& Objects.equal(this.usageType, that.usageType); && Objects.equal(this.usageType, that.usageType);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("description", description).add("accountId", accountId).add("accountName", accountName) .add("id", id).add("description", description).add("accountId", accountId).add("accountName", accountName)
@ -528,7 +509,7 @@ public class UsageRecord {
.add("ipAddress", ipAddress).add("isSourceNAT", isSourceNAT).add("rawUsageHours", rawUsageHours).add("usage", usage) .add("ipAddress", ipAddress).add("isSourceNAT", isSourceNAT).add("rawUsageHours", rawUsageHours).add("usage", usage)
.add("type", type).add("usageType", usageType); .add("type", type).add("usageType", usageType);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -32,9 +30,9 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class User * Class User
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class User { public class User {
/** /**
@ -43,30 +41,30 @@ public class User {
ENABLED, ENABLED,
DISABLED, DISABLED,
UNKNOWN; UNKNOWN;
public static State fromValue(String value) { public static State fromValue(String value) {
try { try {
return valueOf(value.toUpperCase()); return valueOf(value.toUpperCase());
} catch(IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNKNOWN; return UNKNOWN;
}
} }
}
@Override @Override
public String toString() { public String toString() {
return name().toLowerCase(); return name().toLowerCase();
} }
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromUser(this); return new ConcreteBuilder().fromUser(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -83,8 +81,8 @@ public class User {
protected String timeZone; protected String timeZone;
protected String apiKey; protected String apiKey;
protected String secretKey; protected String secretKey;
/** /**
* @see User#getId() * @see User#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -92,7 +90,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getName() * @see User#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -100,7 +98,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getFirstName() * @see User#getFirstName()
*/ */
public T firstName(String firstName) { public T firstName(String firstName) {
@ -108,7 +106,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getLastName() * @see User#getLastName()
*/ */
public T lastName(String lastName) { public T lastName(String lastName) {
@ -116,7 +114,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getEmail() * @see User#getEmail()
*/ */
public T email(String email) { public T email(String email) {
@ -124,7 +122,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getCreated() * @see User#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -132,7 +130,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getState() * @see User#getState()
*/ */
public T state(User.State state) { public T state(User.State state) {
@ -140,7 +138,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getAccount() * @see User#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -148,7 +146,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getAccountType() * @see User#getAccountType()
*/ */
public T accountType(Account.Type accountType) { public T accountType(Account.Type accountType) {
@ -156,7 +154,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getDomain() * @see User#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -164,7 +162,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getDomainId() * @see User#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -172,7 +170,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getTimeZone() * @see User#getTimeZone()
*/ */
public T timeZone(String timeZone) { public T timeZone(String timeZone) {
@ -180,7 +178,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getApiKey() * @see User#getApiKey()
*/ */
public T apiKey(String apiKey) { public T apiKey(String apiKey) {
@ -188,7 +186,7 @@ public class User {
return self(); return self();
} }
/** /**
* @see User#getSecretKey() * @see User#getSecretKey()
*/ */
public T secretKey(String secretKey) { public T secretKey(String secretKey) {
@ -199,23 +197,23 @@ public class User {
public User build() { public User build() {
return new User(id, name, firstName, lastName, email, created, state, account, accountType, domain, domainId, timeZone, apiKey, secretKey); return new User(id, name, firstName, lastName, email, created, state, account, accountType, domain, domainId, timeZone, apiKey, secretKey);
} }
public T fromUser(User in) { public T fromUser(User in) {
return this return this
.id(in.getId()) .id(in.getId())
.name(in.getName()) .name(in.getName())
.firstName(in.getFirstName()) .firstName(in.getFirstName())
.lastName(in.getLastName()) .lastName(in.getLastName())
.email(in.getEmail()) .email(in.getEmail())
.created(in.getCreated()) .created(in.getCreated())
.state(in.getState()) .state(in.getState())
.account(in.getAccount()) .account(in.getAccount())
.accountType(in.getAccountType()) .accountType(in.getAccountType())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.timeZone(in.getTimeZone()) .timeZone(in.getTimeZone())
.apiKey(in.getApiKey()) .apiKey(in.getApiKey())
.secretKey(in.getSecretKey()); .secretKey(in.getSecretKey());
} }
} }
@ -227,30 +225,22 @@ public class User {
} }
private final String id; private final String id;
@Named("username")
private final String name; private final String name;
@Named("firstname")
private final String firstName; private final String firstName;
@Named("lastname")
private final String lastName; private final String lastName;
private final String email; private final String email;
private final Date created; private final Date created;
private final User.State state; private final User.State state;
private final String account; private final String account;
@Named("accounttype")
private final Account.Type accountType; private final Account.Type accountType;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("timezone")
private final String timeZone; private final String timeZone;
@Named("apikey")
private final String apiKey; private final String apiKey;
@Named("secretkey")
private final String secretKey; private final String secretKey;
@ConstructorProperties({ @ConstructorProperties({
"id", "username", "firstname", "lastname", "email", "created", "state", "account", "accounttype", "domain", "id", "username", "firstname", "lastname", "email", "created", "state", "account", "accounttype", "domain",
"domainid", "timezone", "apikey", "secretkey" "domainid", "timezone", "apikey", "secretkey"
}) })
protected User(String id, @Nullable String name, @Nullable String firstName, @Nullable String lastName, protected User(String id, @Nullable String name, @Nullable String firstName, @Nullable String lastName,
@ -395,28 +385,28 @@ public class User {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
User that = User.class.cast(obj); User that = User.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.firstName, that.firstName) && Objects.equal(this.firstName, that.firstName)
&& Objects.equal(this.lastName, that.lastName) && Objects.equal(this.lastName, that.lastName)
&& Objects.equal(this.email, that.email) && Objects.equal(this.email, that.email)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.accountType, that.accountType) && Objects.equal(this.accountType, that.accountType)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.timeZone, that.timeZone) && Objects.equal(this.timeZone, that.timeZone)
&& Objects.equal(this.apiKey, that.apiKey) && Objects.equal(this.apiKey, that.apiKey)
&& Objects.equal(this.secretKey, that.secretKey); && Objects.equal(this.secretKey, that.secretKey);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("name", name).add("firstName", firstName).add("lastName", lastName).add("email", email) .add("id", id).add("name", name).add("firstName", firstName).add("lastName", lastName).add("email", email)
.add("created", created).add("state", state).add("account", account).add("accountType", accountType).add("domain", domain) .add("created", created).add("state", state).add("account", account).add("accountType", accountType).add("domain", domain)
.add("domainId", domainId).add("timeZone", timeZone).add("apiKey", apiKey).add("secretKey", secretKey); .add("domainId", domainId).add("timeZone", timeZone).add("apiKey", apiKey).add("secretKey", secretKey);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -32,20 +30,20 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Class VMGroup * Class VMGroup
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class VMGroup { public class VMGroup {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromVMGroup(this); return new ConcreteBuilder().fromVMGroup(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -54,8 +52,8 @@ public class VMGroup {
protected String domain; protected String domain;
protected String domainId; protected String domainId;
protected String name; protected String name;
/** /**
* @see VMGroup#getId() * @see VMGroup#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -63,7 +61,7 @@ public class VMGroup {
return self(); return self();
} }
/** /**
* @see VMGroup#getAccount() * @see VMGroup#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -71,7 +69,7 @@ public class VMGroup {
return self(); return self();
} }
/** /**
* @see VMGroup#getCreated() * @see VMGroup#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -79,7 +77,7 @@ public class VMGroup {
return self(); return self();
} }
/** /**
* @see VMGroup#getDomain() * @see VMGroup#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -87,7 +85,7 @@ public class VMGroup {
return self(); return self();
} }
/** /**
* @see VMGroup#getDomainId() * @see VMGroup#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -95,7 +93,7 @@ public class VMGroup {
return self(); return self();
} }
/** /**
* @see VMGroup#getName() * @see VMGroup#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -106,15 +104,15 @@ public class VMGroup {
public VMGroup build() { public VMGroup build() {
return new VMGroup(id, account, created, domain, domainId, name); return new VMGroup(id, account, created, domain, domainId, name);
} }
public T fromVMGroup(VMGroup in) { public T fromVMGroup(VMGroup in) {
return this return this
.id(in.getId()) .id(in.getId())
.account(in.getAccount()) .account(in.getAccount())
.created(in.getCreated()) .created(in.getCreated())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.name(in.getName()); .name(in.getName());
} }
} }
@ -129,12 +127,11 @@ public class VMGroup {
private final String account; private final String account;
private final Date created; private final Date created;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
private final String name; private final String name;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "created", "domain", "domainid", "name" "id", "account", "created", "domain", "domainid", "name"
}) })
protected VMGroup(String id, @Nullable String account, @Nullable Date created, @Nullable String domain, protected VMGroup(String id, @Nullable String account, @Nullable Date created, @Nullable String domain,
@Nullable String domainId, @Nullable String name) { @Nullable String domainId, @Nullable String name) {
@ -203,18 +200,18 @@ public class VMGroup {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
VMGroup that = VMGroup.class.cast(obj); VMGroup that = VMGroup.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.name, that.name); && Objects.equal(this.name, that.name);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("account", account).add("created", created).add("domain", domain).add("domainId", domainId).add("name", name); .add("id", id).add("account", account).add("created", created).add("domain", domain).add("domainId", domainId).add("name", name);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -24,8 +24,6 @@ import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import java.util.Set; import java.util.Set;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -37,39 +35,40 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Class VirtualMachine * Class VirtualMachine
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class VirtualMachine { public class VirtualMachine {
/** /**
*/ */
public static enum State { public static enum State {
STARTING, RUNNING, STOPPING, STOPPED, DESTROYED, EXPUNGING, MIGRATING, ERROR, UNKNOWN, SHUTDOWNED, UNRECOGNIZED; STARTING, RUNNING, STOPPING, STOPPED, DESTROYED, EXPUNGING, MIGRATING, ERROR, UNKNOWN, SHUTDOWNED, UNRECOGNIZED;
@Override @Override
public String toString() { public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
} }
public static State fromValue(String state) { public static State fromValue(String state) {
try { try {
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return UNRECOGNIZED; return UNRECOGNIZED;
}
} }
}
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromVirtualMachine(this); return new ConcreteBuilder().fromVirtualMachine(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -115,8 +114,8 @@ public class VirtualMachine {
protected Set<NIC> nics = ImmutableSet.of(); protected Set<NIC> nics = ImmutableSet.of();
protected String hypervisor; protected String hypervisor;
protected Set<SecurityGroup> securityGroups = ImmutableSet.of(); protected Set<SecurityGroup> securityGroups = ImmutableSet.of();
/** /**
* @see VirtualMachine#getId() * @see VirtualMachine#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -124,7 +123,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getAccount() * @see VirtualMachine#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -132,7 +131,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getCpuCount() * @see VirtualMachine#getCpuCount()
*/ */
public T cpuCount(long cpuCount) { public T cpuCount(long cpuCount) {
@ -140,7 +139,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getCpuSpeed() * @see VirtualMachine#getCpuSpeed()
*/ */
public T cpuSpeed(long cpuSpeed) { public T cpuSpeed(long cpuSpeed) {
@ -148,7 +147,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getCpuUsed() * @see VirtualMachine#getCpuUsed()
*/ */
public T cpuUsed(String cpuUsed) { public T cpuUsed(String cpuUsed) {
@ -156,7 +155,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getDisplayName() * @see VirtualMachine#getDisplayName()
*/ */
public T displayName(String displayName) { public T displayName(String displayName) {
@ -164,7 +163,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getCreated() * @see VirtualMachine#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -172,7 +171,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getDomain() * @see VirtualMachine#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -180,7 +179,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getDomainId() * @see VirtualMachine#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -188,7 +187,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#usesVirtualNetwork() * @see VirtualMachine#usesVirtualNetwork()
*/ */
public T usesVirtualNetwork(boolean usesVirtualNetwork) { public T usesVirtualNetwork(boolean usesVirtualNetwork) {
@ -196,7 +195,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getGroup() * @see VirtualMachine#getGroup()
*/ */
public T group(String group) { public T group(String group) {
@ -204,7 +203,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getGroupId() * @see VirtualMachine#getGroupId()
*/ */
public T groupId(String groupId) { public T groupId(String groupId) {
@ -212,7 +211,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getGuestOSId() * @see VirtualMachine#getGuestOSId()
*/ */
public T guestOSId(String guestOSId) { public T guestOSId(String guestOSId) {
@ -220,7 +219,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#isHAEnabled() * @see VirtualMachine#isHAEnabled()
*/ */
public T isHAEnabled(boolean HAEnabled) { public T isHAEnabled(boolean HAEnabled) {
@ -228,7 +227,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getHostId() * @see VirtualMachine#getHostId()
*/ */
public T hostId(String hostId) { public T hostId(String hostId) {
@ -236,7 +235,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getHostname() * @see VirtualMachine#getHostname()
*/ */
public T hostname(String hostname) { public T hostname(String hostname) {
@ -244,7 +243,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getIPAddress() * @see VirtualMachine#getIPAddress()
*/ */
public T IPAddress(String IPAddress) { public T IPAddress(String IPAddress) {
@ -252,7 +251,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getISODisplayText() * @see VirtualMachine#getISODisplayText()
*/ */
public T ISODisplayText(String ISODisplayText) { public T ISODisplayText(String ISODisplayText) {
@ -260,7 +259,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getISOId() * @see VirtualMachine#getISOId()
*/ */
public T ISOId(String ISOId) { public T ISOId(String ISOId) {
@ -268,7 +267,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getISOName() * @see VirtualMachine#getISOName()
*/ */
public T ISOName(String ISOName) { public T ISOName(String ISOName) {
@ -276,7 +275,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getJobId() * @see VirtualMachine#getJobId()
*/ */
public T jobId(String jobId) { public T jobId(String jobId) {
@ -284,7 +283,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getJobStatus() * @see VirtualMachine#getJobStatus()
*/ */
public T jobStatus(Integer jobStatus) { public T jobStatus(Integer jobStatus) {
@ -292,7 +291,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getMemory() * @see VirtualMachine#getMemory()
*/ */
public T memory(long memory) { public T memory(long memory) {
@ -300,7 +299,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getName() * @see VirtualMachine#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -308,7 +307,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getNetworkKbsRead() * @see VirtualMachine#getNetworkKbsRead()
*/ */
public T networkKbsRead(Long networkKbsRead) { public T networkKbsRead(Long networkKbsRead) {
@ -316,7 +315,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getNetworkKbsWrite() * @see VirtualMachine#getNetworkKbsWrite()
*/ */
public T networkKbsWrite(Long networkKbsWrite) { public T networkKbsWrite(Long networkKbsWrite) {
@ -324,7 +323,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getPassword() * @see VirtualMachine#getPassword()
*/ */
public T password(String password) { public T password(String password) {
@ -332,7 +331,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#isPasswordEnabled() * @see VirtualMachine#isPasswordEnabled()
*/ */
public T passwordEnabled(boolean passwordEnabled) { public T passwordEnabled(boolean passwordEnabled) {
@ -340,7 +339,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getPublicIP() * @see VirtualMachine#getPublicIP()
*/ */
public T publicIP(String publicIP) { public T publicIP(String publicIP) {
@ -348,7 +347,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getPublicIPId() * @see VirtualMachine#getPublicIPId()
*/ */
public T publicIPId(String publicIPId) { public T publicIPId(String publicIPId) {
@ -356,7 +355,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getRootDeviceId() * @see VirtualMachine#getRootDeviceId()
*/ */
public T rootDeviceId(String rootDeviceId) { public T rootDeviceId(String rootDeviceId) {
@ -364,7 +363,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getRootDeviceType() * @see VirtualMachine#getRootDeviceType()
*/ */
public T rootDeviceType(String rootDeviceType) { public T rootDeviceType(String rootDeviceType) {
@ -372,7 +371,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getServiceOfferingId() * @see VirtualMachine#getServiceOfferingId()
*/ */
public T serviceOfferingId(String serviceOfferingId) { public T serviceOfferingId(String serviceOfferingId) {
@ -380,7 +379,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getServiceOfferingName() * @see VirtualMachine#getServiceOfferingName()
*/ */
public T serviceOfferingName(String serviceOfferingName) { public T serviceOfferingName(String serviceOfferingName) {
@ -388,7 +387,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getState() * @see VirtualMachine#getState()
*/ */
public T state(VirtualMachine.State state) { public T state(VirtualMachine.State state) {
@ -396,7 +395,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getTemplateDisplayText() * @see VirtualMachine#getTemplateDisplayText()
*/ */
public T templateDisplayText(String templateDisplayText) { public T templateDisplayText(String templateDisplayText) {
@ -404,7 +403,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getTemplateId() * @see VirtualMachine#getTemplateId()
*/ */
public T templateId(String templateId) { public T templateId(String templateId) {
@ -412,7 +411,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getTemplateName() * @see VirtualMachine#getTemplateName()
*/ */
public T templateName(String templateName) { public T templateName(String templateName) {
@ -420,7 +419,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getZoneId() * @see VirtualMachine#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -428,7 +427,7 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getZoneName() * @see VirtualMachine#getZoneName()
*/ */
public T zoneName(String zoneName) { public T zoneName(String zoneName) {
@ -436,11 +435,11 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getNICs() * @see VirtualMachine#getNICs()
*/ */
public T nics(Set<NIC> nics) { public T nics(Set<NIC> nics) {
this.nics = ImmutableSet.copyOf(checkNotNull(nics, "nics")); this.nics = ImmutableSet.copyOf(checkNotNull(nics, "nics"));
return self(); return self();
} }
@ -448,7 +447,7 @@ public class VirtualMachine {
return nics(ImmutableSet.copyOf(in)); return nics(ImmutableSet.copyOf(in));
} }
/** /**
* @see VirtualMachine#getHypervisor() * @see VirtualMachine#getHypervisor()
*/ */
public T hypervisor(String hypervisor) { public T hypervisor(String hypervisor) {
@ -456,11 +455,11 @@ public class VirtualMachine {
return self(); return self();
} }
/** /**
* @see VirtualMachine#getSecurityGroups() * @see VirtualMachine#getSecurityGroups()
*/ */
public T securityGroups(Set<SecurityGroup> securityGroups) { public T securityGroups(Set<SecurityGroup> securityGroups) {
this.securityGroups = ImmutableSet.copyOf(checkNotNull(securityGroups, "securityGroups")); this.securityGroups = ImmutableSet.copyOf(checkNotNull(securityGroups, "securityGroups"));
return self(); return self();
} }
@ -475,52 +474,52 @@ public class VirtualMachine {
publicIPId, rootDeviceId, rootDeviceType, serviceOfferingId, serviceOfferingName, state, templateDisplayText, publicIPId, rootDeviceId, rootDeviceType, serviceOfferingId, serviceOfferingName, state, templateDisplayText,
templateId, templateName, zoneId, zoneName, nics, hypervisor, securityGroups); templateId, templateName, zoneId, zoneName, nics, hypervisor, securityGroups);
} }
public T fromVirtualMachine(VirtualMachine in) { public T fromVirtualMachine(VirtualMachine in) {
return this return this
.id(in.getId()) .id(in.getId())
.account(in.getAccount()) .account(in.getAccount())
.cpuCount(in.getCpuCount()) .cpuCount(in.getCpuCount())
.cpuSpeed(in.getCpuSpeed()) .cpuSpeed(in.getCpuSpeed())
.cpuUsed(in.getCpuUsedAsString()) .cpuUsed(in.getCpuUsedAsString())
.displayName(in.getDisplayName()) .displayName(in.getDisplayName())
.created(in.getCreated()) .created(in.getCreated())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.usesVirtualNetwork(in.usesVirtualNetwork()) .usesVirtualNetwork(in.usesVirtualNetwork())
.group(in.getGroup()) .group(in.getGroup())
.groupId(in.getGroupId()) .groupId(in.getGroupId())
.guestOSId(in.getGuestOSId()) .guestOSId(in.getGuestOSId())
.isHAEnabled(in.isHAEnabled()) .isHAEnabled(in.isHAEnabled())
.hostId(in.getHostId()) .hostId(in.getHostId())
.hostname(in.getHostname()) .hostname(in.getHostname())
.IPAddress(in.getIPAddress()) .IPAddress(in.getIPAddress())
.ISODisplayText(in.getISODisplayText()) .ISODisplayText(in.getISODisplayText())
.ISOId(in.getISOId()) .ISOId(in.getISOId())
.ISOName(in.getISOName()) .ISOName(in.getISOName())
.jobId(in.getJobId()) .jobId(in.getJobId())
.jobStatus(in.getJobStatus()) .jobStatus(in.getJobStatus())
.memory(in.getMemory()) .memory(in.getMemory())
.name(in.getName()) .name(in.getName())
.networkKbsRead(in.getNetworkKbsRead()) .networkKbsRead(in.getNetworkKbsRead())
.networkKbsWrite(in.getNetworkKbsWrite()) .networkKbsWrite(in.getNetworkKbsWrite())
.password(in.getPassword()) .password(in.getPassword())
.passwordEnabled(in.isPasswordEnabled()) .passwordEnabled(in.isPasswordEnabled())
.publicIP(in.getPublicIP()) .publicIP(in.getPublicIP())
.publicIPId(in.getPublicIPId()) .publicIPId(in.getPublicIPId())
.rootDeviceId(in.getRootDeviceId()) .rootDeviceId(in.getRootDeviceId())
.rootDeviceType(in.getRootDeviceType()) .rootDeviceType(in.getRootDeviceType())
.serviceOfferingId(in.getServiceOfferingId()) .serviceOfferingId(in.getServiceOfferingId())
.serviceOfferingName(in.getServiceOfferingName()) .serviceOfferingName(in.getServiceOfferingName())
.state(in.getState()) .state(in.getState())
.templateDisplayText(in.getTemplateDisplayText()) .templateDisplayText(in.getTemplateDisplayText())
.templateId(in.getTemplateId()) .templateId(in.getTemplateId())
.templateName(in.getTemplateName()) .templateName(in.getTemplateName())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.zoneName(in.getZoneName()) .zoneName(in.getZoneName())
.nics(in.getNICs()) .nics(in.getNICs())
.hypervisor(in.getHypervisor()) .hypervisor(in.getHypervisor())
.securityGroups(in.getSecurityGroups()); .securityGroups(in.getSecurityGroups());
} }
} }
@ -533,82 +532,50 @@ public class VirtualMachine {
private final String id; private final String id;
private final String account; private final String account;
@Named("cpunumber")
private final long cpuCount; private final long cpuCount;
@Named("cpuspeed")
private final long cpuSpeed; private final long cpuSpeed;
@Named("cpuused")
private final String cpuUsed; private final String cpuUsed;
@Named("displayname")
private final String displayName; private final String displayName;
private final Date created; private final Date created;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("forvirtualnetwork")
private final boolean usesVirtualNetwork; private final boolean usesVirtualNetwork;
private final String group; private final String group;
@Named("groupid")
private final String groupId; private final String groupId;
@Named("guestosid")
private final String guestOSId; private final String guestOSId;
@Named("haenable")
private final boolean HAEnabled; private final boolean HAEnabled;
@Named("hostid")
private final String hostId; private final String hostId;
private final String hostname; private final String hostname;
@Named("ipaddress")
private final String IPAddress; private final String IPAddress;
@Named("isodisplaytext")
private final String ISODisplayText; private final String ISODisplayText;
@Named("isoid")
private final String ISOId; private final String ISOId;
@Named("isoname")
private final String ISOName; private final String ISOName;
@Named("jobid")
private final String jobId; private final String jobId;
@Named("jobstatus")
private final Integer jobStatus; private final Integer jobStatus;
private final long memory; private final long memory;
private final String name; private final String name;
@Named("networkkbsread")
private final Long networkKbsRead; private final Long networkKbsRead;
@Named("networkkbswrite")
private final Long networkKbsWrite; private final Long networkKbsWrite;
private final String password; private final String password;
@Named("passwordenabled")
private final boolean passwordEnabled; private final boolean passwordEnabled;
@Named("publicip")
private final String publicIP; private final String publicIP;
@Named("publicipid")
private final String publicIPId; private final String publicIPId;
@Named("rootdeviceid")
private final String rootDeviceId; private final String rootDeviceId;
@Named("rootdevicetype")
private final String rootDeviceType; private final String rootDeviceType;
@Named("serviceofferingid")
private final String serviceOfferingId; private final String serviceOfferingId;
@Named("serviceofferingname")
private final String serviceOfferingName; private final String serviceOfferingName;
private final VirtualMachine.State state; private final VirtualMachine.State state;
@Named("templatedisplaytext")
private final String templateDisplayText; private final String templateDisplayText;
@Named("templateid")
private final String templateId; private final String templateId;
@Named("templatename")
private final String templateName; private final String templateName;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@Named("nic")
private final Set<NIC> nics; private final Set<NIC> nics;
private final String hypervisor; private final String hypervisor;
@Named("securitygroup")
private final Set<SecurityGroup> securityGroups; private final Set<SecurityGroup> securityGroups;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "cpunumber", "cpuspeed", "cpuused", "displayname", "created", "domain", "domainid", "forvirtualnetwork", "group", "groupid", "guestosid", "haenable", "hostid", "hostname", "ipaddress", "isodisplaytext", "isoid", "isoname", "jobid", "jobstatus", "memory", "name", "networkkbsread", "networkkbswrite", "password", "passwordenabled", "publicip", "publicipid", "rootdeviceid", "rootdevicetype", "serviceofferingid", "serviceofferingname", "state", "templatedisplaytext", "templateid", "templatename", "zoneid", "zonename", "nic", "hypervisor", "securitygroup" "id", "account", "cpunumber", "cpuspeed", "cpuused", "displayname", "created", "domain", "domainid", "forvirtualnetwork", "group", "groupid", "guestosid", "haenable", "hostid", "hostname", "ipaddress", "isodisplaytext", "isoid", "isoname", "jobid", "jobstatus", "memory", "name", "networkkbsread", "networkkbswrite", "password", "passwordenabled", "publicip", "publicipid", "rootdeviceid", "rootdevicetype", "serviceofferingid", "serviceofferingname", "state", "templatedisplaytext", "templateid", "templatename", "zoneid", "zonename", "nic", "hypervisor", "securitygroup"
}) })
protected VirtualMachine(String id, @Nullable String account, long cpuCount, long cpuSpeed, @Nullable String cpuUsed, protected VirtualMachine(String id, @Nullable String account, long cpuCount, long cpuSpeed, @Nullable String cpuUsed,
@Nullable String displayName, @Nullable Date created, @Nullable String domain, @Nullable String domainId, @Nullable String displayName, @Nullable Date created, @Nullable String domain, @Nullable String domainId,
@ -662,9 +629,9 @@ public class VirtualMachine {
this.templateName = templateName; this.templateName = templateName;
this.zoneId = zoneId; this.zoneId = zoneId;
this.zoneName = zoneName; this.zoneName = zoneName;
this.nics = nics == null ? ImmutableSet.<NIC>of() : ImmutableSet.copyOf(nics); this.nics = nics == null ? ImmutableSet.<NIC>of() : ImmutableSet.copyOf(nics);
this.hypervisor = hypervisor; this.hypervisor = hypervisor;
this.securityGroups = securityGroups == null ? ImmutableSet.<SecurityGroup>of() : ImmutableSet.copyOf(securityGroups); this.securityGroups = securityGroups == null ? ImmutableSet.<SecurityGroup>of() : ImmutableSet.copyOf(securityGroups);
} }
/** /**
@ -707,10 +674,10 @@ public class VirtualMachine {
return cpuUsed; return cpuUsed;
} }
/** /**
* @return user generated name. The name of the virtual machine is returned * @return user generated name. The name of the virtual machine is returned
if no displayname exists. * if no displayname exists.
*/ */
@Nullable @Nullable
public String getDisplayName() { public String getDisplayName() {
return this.displayName; return this.displayName;
@ -804,7 +771,7 @@ public class VirtualMachine {
/** /**
* @return an alternate display text of the ISO attached to the virtual * @return an alternate display text of the ISO attached to the virtual
machine * machine
*/ */
@Nullable @Nullable
public String getISODisplayText() { public String getISODisplayText() {
@ -829,8 +796,8 @@ public class VirtualMachine {
/** /**
* @return shows the current pending asynchronous job ID. This tag is not * @return shows the current pending asynchronous job ID. This tag is not
returned if no current pending jobs are acting on the virtual * returned if no current pending jobs are acting on the virtual
machine * machine
*/ */
@Nullable @Nullable
public String getJobId() { public String getJobId() {
@ -957,7 +924,7 @@ public class VirtualMachine {
/** /**
* @return the ID of the template for the virtual machine. A -1 is returned * @return the ID of the template for the virtual machine. A -1 is returned
if the virtual machine was created from an ISO file. * if the virtual machine was created from an ISO file.
*/ */
@Nullable @Nullable
public String getTemplateId() { public String getTemplateId() {
@ -1018,50 +985,50 @@ public class VirtualMachine {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
VirtualMachine that = VirtualMachine.class.cast(obj); VirtualMachine that = VirtualMachine.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.cpuCount, that.cpuCount) && Objects.equal(this.cpuCount, that.cpuCount)
&& Objects.equal(this.cpuSpeed, that.cpuSpeed) && Objects.equal(this.cpuSpeed, that.cpuSpeed)
&& Objects.equal(this.cpuUsed, that.cpuUsed) && Objects.equal(this.cpuUsed, that.cpuUsed)
&& Objects.equal(this.displayName, that.displayName) && Objects.equal(this.displayName, that.displayName)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.usesVirtualNetwork, that.usesVirtualNetwork) && Objects.equal(this.usesVirtualNetwork, that.usesVirtualNetwork)
&& Objects.equal(this.group, that.group) && Objects.equal(this.group, that.group)
&& Objects.equal(this.groupId, that.groupId) && Objects.equal(this.groupId, that.groupId)
&& Objects.equal(this.guestOSId, that.guestOSId) && Objects.equal(this.guestOSId, that.guestOSId)
&& Objects.equal(this.HAEnabled, that.HAEnabled) && Objects.equal(this.HAEnabled, that.HAEnabled)
&& Objects.equal(this.hostId, that.hostId) && Objects.equal(this.hostId, that.hostId)
&& Objects.equal(this.hostname, that.hostname) && Objects.equal(this.hostname, that.hostname)
&& Objects.equal(this.IPAddress, that.IPAddress) && Objects.equal(this.IPAddress, that.IPAddress)
&& Objects.equal(this.ISODisplayText, that.ISODisplayText) && Objects.equal(this.ISODisplayText, that.ISODisplayText)
&& Objects.equal(this.ISOId, that.ISOId) && Objects.equal(this.ISOId, that.ISOId)
&& Objects.equal(this.ISOName, that.ISOName) && Objects.equal(this.ISOName, that.ISOName)
&& Objects.equal(this.jobId, that.jobId) && Objects.equal(this.jobId, that.jobId)
&& Objects.equal(this.jobStatus, that.jobStatus) && Objects.equal(this.jobStatus, that.jobStatus)
&& Objects.equal(this.memory, that.memory) && Objects.equal(this.memory, that.memory)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.networkKbsRead, that.networkKbsRead) && Objects.equal(this.networkKbsRead, that.networkKbsRead)
&& Objects.equal(this.networkKbsWrite, that.networkKbsWrite) && Objects.equal(this.networkKbsWrite, that.networkKbsWrite)
&& Objects.equal(this.password, that.password) && Objects.equal(this.password, that.password)
&& Objects.equal(this.passwordEnabled, that.passwordEnabled) && Objects.equal(this.passwordEnabled, that.passwordEnabled)
&& Objects.equal(this.publicIP, that.publicIP) && Objects.equal(this.publicIP, that.publicIP)
&& Objects.equal(this.publicIPId, that.publicIPId) && Objects.equal(this.publicIPId, that.publicIPId)
&& Objects.equal(this.rootDeviceId, that.rootDeviceId) && Objects.equal(this.rootDeviceId, that.rootDeviceId)
&& Objects.equal(this.rootDeviceType, that.rootDeviceType) && Objects.equal(this.rootDeviceType, that.rootDeviceType)
&& Objects.equal(this.serviceOfferingId, that.serviceOfferingId) && Objects.equal(this.serviceOfferingId, that.serviceOfferingId)
&& Objects.equal(this.serviceOfferingName, that.serviceOfferingName) && Objects.equal(this.serviceOfferingName, that.serviceOfferingName)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.templateDisplayText, that.templateDisplayText) && Objects.equal(this.templateDisplayText, that.templateDisplayText)
&& Objects.equal(this.templateId, that.templateId) && Objects.equal(this.templateId, that.templateId)
&& Objects.equal(this.templateName, that.templateName) && Objects.equal(this.templateName, that.templateName)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.zoneName, that.zoneName) && Objects.equal(this.zoneName, that.zoneName)
&& Objects.equal(this.nics, that.nics) && Objects.equal(this.nics, that.nics)
&& Objects.equal(this.hypervisor, that.hypervisor) && Objects.equal(this.hypervisor, that.hypervisor)
&& Objects.equal(this.securityGroups, that.securityGroups); && Objects.equal(this.securityGroups, that.securityGroups);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("account", account).add("cpuCount", cpuCount).add("cpuSpeed", cpuSpeed).add("cpuUsed", cpuUsed) .add("id", id).add("account", account).add("cpuCount", cpuCount).add("cpuSpeed", cpuSpeed).add("cpuUsed", cpuUsed)
@ -1076,7 +1043,7 @@ public class VirtualMachine {
.add("templateDisplayText", templateDisplayText).add("templateId", templateId).add("templateName", templateName) .add("templateDisplayText", templateDisplayText).add("templateId", templateId).add("templateName", templateName)
.add("zoneId", zoneId).add("zoneName", zoneName).add("nics", nics).add("hypervisor", hypervisor).add("securityGroups", securityGroups); .add("zoneId", zoneId).add("zoneName", zoneName).add("nics", nics).add("hypervisor", hypervisor).add("securityGroups", securityGroups);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -31,20 +29,20 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Represents the data object used in CloudStack's "Vlan" API. * Represents the data object used in CloudStack's "Vlan" API.
* *
* @author Richard Downer * @author Richard Downer
*/ */
public class VlanIPRange implements Comparable<VlanIPRange> { public class VlanIPRange implements Comparable<VlanIPRange> {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromVlanIPRange(this); return new ConcreteBuilder().fromVlanIPRange(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -62,8 +60,8 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
protected String startIP; protected String startIP;
protected String endIP; protected String endIP;
protected String networkId; protected String networkId;
/** /**
* @see VlanIPRange#getId() * @see VlanIPRange#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -71,7 +69,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getDescription() * @see VlanIPRange#getDescription()
*/ */
public T description(String description) { public T description(String description) {
@ -79,7 +77,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#isForVirtualNetwork() * @see VlanIPRange#isForVirtualNetwork()
*/ */
public T forVirtualNetwork(boolean forVirtualNetwork) { public T forVirtualNetwork(boolean forVirtualNetwork) {
@ -87,7 +85,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getZoneId() * @see VlanIPRange#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -95,7 +93,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getVlan() * @see VlanIPRange#getVlan()
*/ */
public T vlan(String vlan) { public T vlan(String vlan) {
@ -103,7 +101,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getAccount() * @see VlanIPRange#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -111,7 +109,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getDomainId() * @see VlanIPRange#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -119,7 +117,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getDomain() * @see VlanIPRange#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -127,7 +125,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getPodId() * @see VlanIPRange#getPodId()
*/ */
public T podId(String podId) { public T podId(String podId) {
@ -135,7 +133,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getPodName() * @see VlanIPRange#getPodName()
*/ */
public T podName(String podName) { public T podName(String podName) {
@ -143,7 +141,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getGateway() * @see VlanIPRange#getGateway()
*/ */
public T gateway(String gateway) { public T gateway(String gateway) {
@ -151,7 +149,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getNetmask() * @see VlanIPRange#getNetmask()
*/ */
public T netmask(String netmask) { public T netmask(String netmask) {
@ -159,7 +157,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getStartIP() * @see VlanIPRange#getStartIP()
*/ */
public T startIP(String startIP) { public T startIP(String startIP) {
@ -167,7 +165,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getEndIP() * @see VlanIPRange#getEndIP()
*/ */
public T endIP(String endIP) { public T endIP(String endIP) {
@ -175,7 +173,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return self(); return self();
} }
/** /**
* @see VlanIPRange#getNetworkId() * @see VlanIPRange#getNetworkId()
*/ */
public T networkId(String networkId) { public T networkId(String networkId) {
@ -187,24 +185,24 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return new VlanIPRange(id, description, forVirtualNetwork, zoneId, vlan, account, domainId, domain, podId, return new VlanIPRange(id, description, forVirtualNetwork, zoneId, vlan, account, domainId, domain, podId,
podName, gateway, netmask, startIP, endIP, networkId); podName, gateway, netmask, startIP, endIP, networkId);
} }
public T fromVlanIPRange(VlanIPRange in) { public T fromVlanIPRange(VlanIPRange in) {
return this return this
.id(in.getId()) .id(in.getId())
.description(in.getDescription()) .description(in.getDescription())
.forVirtualNetwork(in.isForVirtualNetwork()) .forVirtualNetwork(in.isForVirtualNetwork())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.vlan(in.getVlan()) .vlan(in.getVlan())
.account(in.getAccount()) .account(in.getAccount())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.domain(in.getDomain()) .domain(in.getDomain())
.podId(in.getPodId()) .podId(in.getPodId())
.podName(in.getPodName()) .podName(in.getPodName())
.gateway(in.getGateway()) .gateway(in.getGateway())
.netmask(in.getNetmask()) .netmask(in.getNetmask())
.startIP(in.getStartIP()) .startIP(in.getStartIP())
.endIP(in.getEndIP()) .endIP(in.getEndIP())
.networkId(in.getNetworkId()); .networkId(in.getNetworkId());
} }
} }
@ -217,30 +215,22 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
private final String id; private final String id;
private final String description; private final String description;
@Named("forvirtualnetwork")
private final boolean forVirtualNetwork; private final boolean forVirtualNetwork;
@Named("zoneid")
private final String zoneId; private final String zoneId;
private final String vlan; private final String vlan;
private final String account; private final String account;
@Named("domainid")
private final String domainId; private final String domainId;
private final String domain; private final String domain;
@Named("podid")
private final String podId; private final String podId;
@Named("podname")
private final String podName; private final String podName;
private final String gateway; private final String gateway;
private final String netmask; private final String netmask;
@Named("startip")
private final String startIP; private final String startIP;
@Named("endip")
private final String endIP; private final String endIP;
@Named("networkid")
private final String networkId; private final String networkId;
@ConstructorProperties({ @ConstructorProperties({
"id", "description", "forvirtualnetwork", "zoneid", "vlan", "account", "domainid", "domain", "podid", "podname", "id", "description", "forvirtualnetwork", "zoneid", "vlan", "account", "domainid", "domain", "podid", "podname",
"gateway", "netmask", "startip", "endip", "networkid" "gateway", "netmask", "startip", "endip", "networkid"
}) })
protected VlanIPRange(String id, @Nullable String description, boolean forVirtualNetwork, @Nullable String zoneId, protected VlanIPRange(String id, @Nullable String description, boolean forVirtualNetwork, @Nullable String zoneId,
@ -348,22 +338,22 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
VlanIPRange that = VlanIPRange.class.cast(obj); VlanIPRange that = VlanIPRange.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.description, that.description) && Objects.equal(this.description, that.description)
&& Objects.equal(this.forVirtualNetwork, that.forVirtualNetwork) && Objects.equal(this.forVirtualNetwork, that.forVirtualNetwork)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.vlan, that.vlan) && Objects.equal(this.vlan, that.vlan)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.podId, that.podId) && Objects.equal(this.podId, that.podId)
&& Objects.equal(this.podName, that.podName) && Objects.equal(this.podName, that.podName)
&& Objects.equal(this.gateway, that.gateway) && Objects.equal(this.gateway, that.gateway)
&& Objects.equal(this.netmask, that.netmask) && Objects.equal(this.netmask, that.netmask)
&& Objects.equal(this.startIP, that.startIP) && Objects.equal(this.startIP, that.startIP)
&& Objects.equal(this.endIP, that.endIP) && Objects.equal(this.endIP, that.endIP)
&& Objects.equal(this.networkId, that.networkId); && Objects.equal(this.networkId, that.networkId);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("description", description).add("forVirtualNetwork", forVirtualNetwork).add("zoneId", zoneId) .add("id", id).add("description", description).add("forVirtualNetwork", forVirtualNetwork).add("zoneId", zoneId)
@ -371,7 +361,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
.add("podName", podName).add("gateway", gateway).add("netmask", netmask).add("startIP", startIP).add("endIP", endIP) .add("podName", podName).add("gateway", gateway).add("netmask", netmask).add("startIP", startIP).add("endIP", endIP)
.add("networkId", networkId); .add("networkId", networkId);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -24,8 +24,6 @@ import java.beans.ConstructorProperties;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -37,41 +35,41 @@ import com.google.common.collect.Maps;
/** /**
* @author Vijay Kiran * @author Vijay Kiran
*/ */
public class Volume { public class Volume {
/** /**
*/ */
public static enum State { public static enum State {
/** /**
* indicates that the volume record is created in the DB, but not on the backend * indicates that the volume record is created in the DB, but not on the backend
*/ */
ALLOCATED, ALLOCATED,
/** /**
* the volume is being created on the backend * the volume is being created on the backend
*/ */
CREATING, CREATING,
/** /**
* the volume is ready to be used * the volume is ready to be used
*/ */
READY, READY,
/** /**
* the volume is destroyed (either as a result of deleteVolume command for DataDisk or as a part of destroyVm) * the volume is destroyed (either as a result of deleteVolume command for DataDisk or as a part of destroyVm)
*/ */
DESTROYED, DESTROYED,
/** /**
* the volume has failed somehow, e.g. during creation (in cloudstack development) * the volume has failed somehow, e.g. during creation (in cloudstack development)
*/ */
FAILED, FAILED,
UNRECOGNIZED; UNRECOGNIZED;
@Override @Override
public String toString() { public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
} }
public static State fromValue(String state) { public static State fromValue(String state) {
try { try {
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
@ -87,44 +85,44 @@ public class Volume {
ROOT(0), ROOT(0),
DATADISK(1), DATADISK(1),
UNRECOGNIZED(Integer.MAX_VALUE); UNRECOGNIZED(Integer.MAX_VALUE);
private int code; private int code;
private static final Map<Integer, Type> INDEX = Maps.uniqueIndex(ImmutableSet.copyOf(Type.values()), private static final Map<Integer, Type> INDEX = Maps.uniqueIndex(ImmutableSet.copyOf(Type.values()),
new Function<Type, Integer>() { new Function<Type, Integer>() {
@Override @Override
public Integer apply(Type input) { public Integer apply(Type input) {
return input.code; return input.code;
} }
}); });
Type(int code) { Type(int code) {
this.code = code; this.code = code;
} }
@Override @Override
public String toString() { public String toString() {
return name().toLowerCase(); return name().toLowerCase();
} }
public static Type fromValue(String resourceType) { public static Type fromValue(String resourceType) {
Integer code = new Integer(checkNotNull(resourceType, "resourcetype")); Integer code = new Integer(checkNotNull(resourceType, "resourcetype"));
return INDEX.containsKey(code) ? INDEX.get(code) : UNRECOGNIZED; return INDEX.containsKey(code) ? INDEX.get(code) : UNRECOGNIZED;
} }
} }
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromVolume(this); return new ConcreteBuilder().fromVolume(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -158,8 +156,8 @@ public class Volume {
protected VirtualMachine.State vmState; protected VirtualMachine.State vmState;
protected String zoneId; protected String zoneId;
protected String zoneName; protected String zoneName;
/** /**
* @see Volume#getId() * @see Volume#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -167,7 +165,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getAccount() * @see Volume#getAccount()
*/ */
public T account(String account) { public T account(String account) {
@ -175,7 +173,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getAttached() * @see Volume#getAttached()
*/ */
public T attached(Date attached) { public T attached(Date attached) {
@ -183,7 +181,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getCreated() * @see Volume#getCreated()
*/ */
public T created(Date created) { public T created(Date created) {
@ -191,7 +189,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#isDestroyed() * @see Volume#isDestroyed()
*/ */
public T destroyed(boolean destroyed) { public T destroyed(boolean destroyed) {
@ -199,7 +197,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getDeviceId() * @see Volume#getDeviceId()
*/ */
public T deviceId(String deviceId) { public T deviceId(String deviceId) {
@ -207,7 +205,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getDiskOfferingDisplayText() * @see Volume#getDiskOfferingDisplayText()
*/ */
public T diskOfferingDisplayText(String diskOfferingDisplayText) { public T diskOfferingDisplayText(String diskOfferingDisplayText) {
@ -215,7 +213,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getDiskOfferingId() * @see Volume#getDiskOfferingId()
*/ */
public T diskOfferingId(String diskOfferingId) { public T diskOfferingId(String diskOfferingId) {
@ -223,7 +221,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getDiskOfferingName() * @see Volume#getDiskOfferingName()
*/ */
public T diskOfferingName(String diskOfferingName) { public T diskOfferingName(String diskOfferingName) {
@ -231,7 +229,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getDomain() * @see Volume#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -239,7 +237,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getDomainId() * @see Volume#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -247,7 +245,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getHypervisor() * @see Volume#getHypervisor()
*/ */
public T hypervisor(String hypervisor) { public T hypervisor(String hypervisor) {
@ -255,7 +253,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#isExtractable() * @see Volume#isExtractable()
*/ */
public T isExtractable(boolean isExtractable) { public T isExtractable(boolean isExtractable) {
@ -263,7 +261,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getJobId() * @see Volume#getJobId()
*/ */
public T jobId(String jobId) { public T jobId(String jobId) {
@ -271,7 +269,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getJobStatus() * @see Volume#getJobStatus()
*/ */
public T jobStatus(String jobStatus) { public T jobStatus(String jobStatus) {
@ -279,7 +277,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getName() * @see Volume#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -287,7 +285,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getServiceOfferingDisplayText() * @see Volume#getServiceOfferingDisplayText()
*/ */
public T serviceOfferingDisplayText(String serviceOfferingDisplayText) { public T serviceOfferingDisplayText(String serviceOfferingDisplayText) {
@ -295,7 +293,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getServiceOfferingId() * @see Volume#getServiceOfferingId()
*/ */
public T serviceOfferingId(String serviceOfferingId) { public T serviceOfferingId(String serviceOfferingId) {
@ -303,7 +301,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getServiceOfferingName() * @see Volume#getServiceOfferingName()
*/ */
public T serviceOfferingName(String serviceOfferingName) { public T serviceOfferingName(String serviceOfferingName) {
@ -311,7 +309,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getSize() * @see Volume#getSize()
*/ */
public T size(long size) { public T size(long size) {
@ -319,7 +317,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getSnapshotId() * @see Volume#getSnapshotId()
*/ */
public T snapshotId(String snapshotId) { public T snapshotId(String snapshotId) {
@ -327,7 +325,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getState() * @see Volume#getState()
*/ */
public T state(Volume.State state) { public T state(Volume.State state) {
@ -335,7 +333,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getStorage() * @see Volume#getStorage()
*/ */
public T storage(String storage) { public T storage(String storage) {
@ -343,7 +341,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getStorageType() * @see Volume#getStorageType()
*/ */
public T storageType(String storageType) { public T storageType(String storageType) {
@ -351,7 +349,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getType() * @see Volume#getType()
*/ */
public T type(Volume.Type type) { public T type(Volume.Type type) {
@ -359,7 +357,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getVirtualMachineId() * @see Volume#getVirtualMachineId()
*/ */
public T virtualMachineId(String virtualMachineId) { public T virtualMachineId(String virtualMachineId) {
@ -367,7 +365,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getVmDisplayName() * @see Volume#getVmDisplayName()
*/ */
public T vmDisplayName(String vmDisplayName) { public T vmDisplayName(String vmDisplayName) {
@ -375,7 +373,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getVmName() * @see Volume#getVmName()
*/ */
public T vmName(String vmName) { public T vmName(String vmName) {
@ -383,7 +381,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getVmState() * @see Volume#getVmState()
*/ */
public T vmState(VirtualMachine.State vmState) { public T vmState(VirtualMachine.State vmState) {
@ -391,7 +389,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getZoneId() * @see Volume#getZoneId()
*/ */
public T zoneId(String zoneId) { public T zoneId(String zoneId) {
@ -399,7 +397,7 @@ public class Volume {
return self(); return self();
} }
/** /**
* @see Volume#getZoneName() * @see Volume#getZoneName()
*/ */
public T zoneName(String zoneName) { public T zoneName(String zoneName) {
@ -410,40 +408,40 @@ public class Volume {
public Volume build() { public Volume build() {
return new Volume(id, account, attached, created, destroyed, deviceId, diskOfferingDisplayText, diskOfferingId, diskOfferingName, domain, domainId, hypervisor, isExtractable, jobId, jobStatus, name, serviceOfferingDisplayText, serviceOfferingId, serviceOfferingName, size, snapshotId, state, storage, storageType, type, virtualMachineId, vmDisplayName, vmName, vmState, zoneId, zoneName); return new Volume(id, account, attached, created, destroyed, deviceId, diskOfferingDisplayText, diskOfferingId, diskOfferingName, domain, domainId, hypervisor, isExtractable, jobId, jobStatus, name, serviceOfferingDisplayText, serviceOfferingId, serviceOfferingName, size, snapshotId, state, storage, storageType, type, virtualMachineId, vmDisplayName, vmName, vmState, zoneId, zoneName);
} }
public T fromVolume(Volume in) { public T fromVolume(Volume in) {
return this return this
.id(in.getId()) .id(in.getId())
.account(in.getAccount()) .account(in.getAccount())
.attached(in.getAttached()) .attached(in.getAttached())
.created(in.getCreated()) .created(in.getCreated())
.destroyed(in.isDestroyed()) .destroyed(in.isDestroyed())
.deviceId(in.getDeviceId()) .deviceId(in.getDeviceId())
.diskOfferingDisplayText(in.getDiskOfferingDisplayText()) .diskOfferingDisplayText(in.getDiskOfferingDisplayText())
.diskOfferingId(in.getDiskOfferingId()) .diskOfferingId(in.getDiskOfferingId())
.diskOfferingName(in.getDiskOfferingName()) .diskOfferingName(in.getDiskOfferingName())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.hypervisor(in.getHypervisor()) .hypervisor(in.getHypervisor())
.isExtractable(in.isExtractable()) .isExtractable(in.isExtractable())
.jobId(in.getJobId()) .jobId(in.getJobId())
.jobStatus(in.getJobStatus()) .jobStatus(in.getJobStatus())
.name(in.getName()) .name(in.getName())
.serviceOfferingDisplayText(in.getServiceOfferingDisplayText()) .serviceOfferingDisplayText(in.getServiceOfferingDisplayText())
.serviceOfferingId(in.getServiceOfferingId()) .serviceOfferingId(in.getServiceOfferingId())
.serviceOfferingName(in.getServiceOfferingName()) .serviceOfferingName(in.getServiceOfferingName())
.size(in.getSize()) .size(in.getSize())
.snapshotId(in.getSnapshotId()) .snapshotId(in.getSnapshotId())
.state(in.getState()) .state(in.getState())
.storage(in.getStorage()) .storage(in.getStorage())
.storageType(in.getStorageType()) .storageType(in.getStorageType())
.type(in.getType()) .type(in.getType())
.virtualMachineId(in.getVirtualMachineId()) .virtualMachineId(in.getVirtualMachineId())
.vmDisplayName(in.getVmDisplayName()) .vmDisplayName(in.getVmDisplayName())
.vmName(in.getVmName()) .vmName(in.getVmName())
.vmState(in.getVmState()) .vmState(in.getVmState())
.zoneId(in.getZoneId()) .zoneId(in.getZoneId())
.zoneName(in.getZoneName()); .zoneName(in.getZoneName());
} }
} }
@ -459,54 +457,35 @@ public class Volume {
private final Date attached; private final Date attached;
private final Date created; private final Date created;
private final boolean destroyed; private final boolean destroyed;
@Named("deviceid")
private final String deviceId; private final String deviceId;
@Named("diskofferingdisplaytext")
private final String diskOfferingDisplayText; private final String diskOfferingDisplayText;
@Named("diskofferingid")
private final String diskOfferingId; private final String diskOfferingId;
@Named("diskofferingname")
private final String diskOfferingName; private final String diskOfferingName;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
private final String hypervisor; private final String hypervisor;
@Named("isextractable")
private final boolean isExtractable; private final boolean isExtractable;
@Named("jobid")
private final String jobId; private final String jobId;
@Named("jobstatus")
private final String jobStatus; private final String jobStatus;
private final String name; private final String name;
@Named("serviceofferingdisplaytext")
private final String serviceOfferingDisplayText; private final String serviceOfferingDisplayText;
@Named("serviceofferingid")
private final String serviceOfferingId; private final String serviceOfferingId;
@Named("serviceofferingname")
private final String serviceOfferingName; private final String serviceOfferingName;
private final long size; private final long size;
@Named("snapshotid")
private final String snapshotId; private final String snapshotId;
private final Volume.State state; private final Volume.State state;
private final String storage; private final String storage;
@Named("storagetype")
private final String storageType; private final String storageType;
private final Volume.Type type; private final Volume.Type type;
@Named("virtualmachineid")
private final String virtualMachineId; private final String virtualMachineId;
@Named("vmdisplayname")
private final String vmDisplayName; private final String vmDisplayName;
@Named("vmname")
private final String vmName; private final String vmName;
@Named("vmstate")
private final VirtualMachine.State vmState; private final VirtualMachine.State vmState;
@Named("zoneid")
private final String zoneId; private final String zoneId;
@Named("zonename")
private final String zoneName; private final String zoneName;
@ConstructorProperties({ @ConstructorProperties({
"id", "account", "attached", "created", "destroyed", "deviceid", "diskofferingdisplaytext", "diskofferingid", "diskofferingname", "domain", "domainid", "hypervisor", "isextractable", "jobid", "jobstatus", "name", "serviceofferingdisplaytext", "serviceofferingid", "serviceofferingname", "size", "snapshotid", "state", "storage", "storagetype", "type", "virtualmachineid", "vmdisplayname", "vmname", "vmstate", "zoneid", "zonename" "id", "account", "attached", "created", "destroyed", "deviceid", "diskofferingdisplaytext", "diskofferingid", "diskofferingname", "domain", "domainid", "hypervisor", "isextractable", "jobid", "jobstatus", "name", "serviceofferingdisplaytext", "serviceofferingid", "serviceofferingname", "size", "snapshotid", "state", "storage", "storagetype", "type", "virtualmachineid", "vmdisplayname", "vmname", "vmstate", "zoneid", "zonename"
}) })
protected Volume(String id, @Nullable String account, @Nullable Date attached, @Nullable Date created, boolean destroyed, protected Volume(String id, @Nullable String account, @Nullable Date attached, @Nullable Date created, boolean destroyed,
@Nullable String deviceId, @Nullable String diskOfferingDisplayText, @Nullable String diskOfferingId, @Nullable String deviceId, @Nullable String diskOfferingDisplayText, @Nullable String diskOfferingId,
@ -712,38 +691,38 @@ public class Volume {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
Volume that = Volume.class.cast(obj); Volume that = Volume.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.account, that.account) && Objects.equal(this.account, that.account)
&& Objects.equal(this.attached, that.attached) && Objects.equal(this.attached, that.attached)
&& Objects.equal(this.created, that.created) && Objects.equal(this.created, that.created)
&& Objects.equal(this.destroyed, that.destroyed) && Objects.equal(this.destroyed, that.destroyed)
&& Objects.equal(this.deviceId, that.deviceId) && Objects.equal(this.deviceId, that.deviceId)
&& Objects.equal(this.diskOfferingDisplayText, that.diskOfferingDisplayText) && Objects.equal(this.diskOfferingDisplayText, that.diskOfferingDisplayText)
&& Objects.equal(this.diskOfferingId, that.diskOfferingId) && Objects.equal(this.diskOfferingId, that.diskOfferingId)
&& Objects.equal(this.diskOfferingName, that.diskOfferingName) && Objects.equal(this.diskOfferingName, that.diskOfferingName)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.hypervisor, that.hypervisor) && Objects.equal(this.hypervisor, that.hypervisor)
&& Objects.equal(this.isExtractable, that.isExtractable) && Objects.equal(this.isExtractable, that.isExtractable)
&& Objects.equal(this.jobId, that.jobId) && Objects.equal(this.jobId, that.jobId)
&& Objects.equal(this.jobStatus, that.jobStatus) && Objects.equal(this.jobStatus, that.jobStatus)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.serviceOfferingDisplayText, that.serviceOfferingDisplayText) && Objects.equal(this.serviceOfferingDisplayText, that.serviceOfferingDisplayText)
&& Objects.equal(this.serviceOfferingId, that.serviceOfferingId) && Objects.equal(this.serviceOfferingId, that.serviceOfferingId)
&& Objects.equal(this.serviceOfferingName, that.serviceOfferingName) && Objects.equal(this.serviceOfferingName, that.serviceOfferingName)
&& Objects.equal(this.size, that.size) && Objects.equal(this.size, that.size)
&& Objects.equal(this.snapshotId, that.snapshotId) && Objects.equal(this.snapshotId, that.snapshotId)
&& Objects.equal(this.state, that.state) && Objects.equal(this.state, that.state)
&& Objects.equal(this.storage, that.storage) && Objects.equal(this.storage, that.storage)
&& Objects.equal(this.storageType, that.storageType) && Objects.equal(this.storageType, that.storageType)
&& Objects.equal(this.type, that.type) && Objects.equal(this.type, that.type)
&& Objects.equal(this.virtualMachineId, that.virtualMachineId) && Objects.equal(this.virtualMachineId, that.virtualMachineId)
&& Objects.equal(this.vmDisplayName, that.vmDisplayName) && Objects.equal(this.vmDisplayName, that.vmDisplayName)
&& Objects.equal(this.vmName, that.vmName) && Objects.equal(this.vmName, that.vmName)
&& Objects.equal(this.vmState, that.vmState) && Objects.equal(this.vmState, that.vmState)
&& Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.zoneId, that.zoneId)
&& Objects.equal(this.zoneName, that.zoneName); && Objects.equal(this.zoneName, that.zoneName);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("account", account).add("attached", attached).add("created", created).add("destroyed", destroyed) .add("id", id).add("account", account).add("attached", attached).add("created", created).add("destroyed", destroyed)
@ -755,7 +734,7 @@ public class Volume {
.add("storage", storage).add("storageType", storageType).add("type", type).add("virtualMachineId", virtualMachineId) .add("storage", storage).add("storageType", storageType).add("type", type).add("virtualMachineId", virtualMachineId)
.add("vmDisplayName", vmDisplayName).add("vmName", vmName).add("vmState", vmState).add("zoneId", zoneId).add("zoneName", zoneName); .add("vmDisplayName", vmDisplayName).add("vmName", vmName).add("vmState", vmState).add("zoneId", zoneId).add("zoneName", zoneName);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties; import java.beans.ConstructorProperties;
import java.util.List; import java.util.List;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -33,18 +31,18 @@ import com.google.common.collect.ImmutableList;
/** /**
* @author Adrian Cole, Andrei Savu * @author Adrian Cole, Andrei Savu
*/ */
public class Zone implements Comparable<Zone> { public class Zone implements Comparable<Zone> {
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }
public Builder<?> toBuilder() { public Builder<?> toBuilder() {
return new ConcreteBuilder().fromZone(this); return new ConcreteBuilder().fromZone(this);
} }
public static abstract class Builder<T extends Builder<T>> { public static abstract class Builder<T extends Builder<T>> {
protected abstract T self(); protected abstract T self();
protected String id; protected String id;
@ -64,8 +62,8 @@ public class Zone implements Comparable<Zone> {
protected AllocationState allocationState; protected AllocationState allocationState;
protected String dhcpProvider; protected String dhcpProvider;
protected String zoneToken; protected String zoneToken;
/** /**
* @see Zone#getId() * @see Zone#getId()
*/ */
public T id(String id) { public T id(String id) {
@ -73,7 +71,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getDescription() * @see Zone#getDescription()
*/ */
public T description(String description) { public T description(String description) {
@ -81,7 +79,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getDisplayText() * @see Zone#getDisplayText()
*/ */
public T displayText(String displayText) { public T displayText(String displayText) {
@ -89,7 +87,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getDNS() * @see Zone#getDNS()
*/ */
public T DNS(List<String> DNS) { public T DNS(List<String> DNS) {
@ -98,7 +96,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getDomain() * @see Zone#getDomain()
*/ */
public T domain(String domain) { public T domain(String domain) {
@ -106,7 +104,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getDomainId() * @see Zone#getDomainId()
*/ */
public T domainId(String domainId) { public T domainId(String domainId) {
@ -114,7 +112,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getGuestCIDRAddress() * @see Zone#getGuestCIDRAddress()
*/ */
public T guestCIDRAddress(String guestCIDRAddress) { public T guestCIDRAddress(String guestCIDRAddress) {
@ -122,7 +120,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getInternalDNS() * @see Zone#getInternalDNS()
*/ */
public T internalDNS(List<String> DNS) { public T internalDNS(List<String> DNS) {
@ -131,7 +129,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getName() * @see Zone#getName()
*/ */
public T name(String name) { public T name(String name) {
@ -139,7 +137,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getNetworkType() * @see Zone#getNetworkType()
*/ */
public T networkType(NetworkType networkType) { public T networkType(NetworkType networkType) {
@ -147,7 +145,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getVLAN() * @see Zone#getVLAN()
*/ */
public T VLAN(String VLAN) { public T VLAN(String VLAN) {
@ -155,7 +153,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#isSecurityGroupsEnabled() * @see Zone#isSecurityGroupsEnabled()
*/ */
public T securityGroupsEnabled(boolean securityGroupsEnabled) { public T securityGroupsEnabled(boolean securityGroupsEnabled) {
@ -163,7 +161,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getAllocationState() * @see Zone#getAllocationState()
*/ */
public T allocationState(AllocationState allocationState) { public T allocationState(AllocationState allocationState) {
@ -171,7 +169,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getDhcpProvider() * @see Zone#getDhcpProvider()
*/ */
public T dhcpProvider(String dhcpProvider) { public T dhcpProvider(String dhcpProvider) {
@ -179,7 +177,7 @@ public class Zone implements Comparable<Zone> {
return self(); return self();
} }
/** /**
* @see Zone#getZoneToken() * @see Zone#getZoneToken()
*/ */
public T zoneToken(String zoneToken) { public T zoneToken(String zoneToken) {
@ -191,24 +189,24 @@ public class Zone implements Comparable<Zone> {
return new Zone(id, description, displayText, DNS1, DNS2, domain, domainId, guestCIDRAddress, internalDNS1, internalDNS2, return new Zone(id, description, displayText, DNS1, DNS2, domain, domainId, guestCIDRAddress, internalDNS1, internalDNS2,
name, networkType, VLAN, securityGroupsEnabled, allocationState, dhcpProvider, zoneToken); name, networkType, VLAN, securityGroupsEnabled, allocationState, dhcpProvider, zoneToken);
} }
public T fromZone(Zone in) { public T fromZone(Zone in) {
return this return this
.id(in.getId()) .id(in.getId())
.description(in.getDescription()) .description(in.getDescription())
.displayText(in.getDisplayText()) .displayText(in.getDisplayText())
.DNS(in.getDNS()) .DNS(in.getDNS())
.domain(in.getDomain()) .domain(in.getDomain())
.domainId(in.getDomainId()) .domainId(in.getDomainId())
.guestCIDRAddress(in.getGuestCIDRAddress()) .guestCIDRAddress(in.getGuestCIDRAddress())
.internalDNS(in.getInternalDNS()) .internalDNS(in.getInternalDNS())
.name(in.getName()) .name(in.getName())
.networkType(in.getNetworkType()) .networkType(in.getNetworkType())
.VLAN(in.getVLAN()) .VLAN(in.getVLAN())
.securityGroupsEnabled(in.isSecurityGroupsEnabled()) .securityGroupsEnabled(in.isSecurityGroupsEnabled())
.allocationState(in.getAllocationState()) .allocationState(in.getAllocationState())
.dhcpProvider(in.getDhcpProvider()) .dhcpProvider(in.getDhcpProvider())
.zoneToken(in.getZoneToken()); .zoneToken(in.getZoneToken());
} }
} }
@ -221,41 +219,28 @@ public class Zone implements Comparable<Zone> {
private final String id; private final String id;
private final String description; private final String description;
@Named("displaytext")
private final String displayText; private final String displayText;
@Named("dns1")
private final String DNS1; private final String DNS1;
@Named("dns2")
private final String DNS2; private final String DNS2;
private final String domain; private final String domain;
@Named("domainid")
private final String domainId; private final String domainId;
@Named("guestcidraddress")
private final String guestCIDRAddress; private final String guestCIDRAddress;
@Named("internaldns1")
private final String internalDNS1; private final String internalDNS1;
@Named("internaldns2")
private final String internalDNS2; private final String internalDNS2;
private final String name; private final String name;
@Named("networktype")
private final NetworkType networkType; private final NetworkType networkType;
@Named("vlan")
private final String VLAN; private final String VLAN;
@Named("securitygroupsenabled")
private final boolean securityGroupsEnabled; private final boolean securityGroupsEnabled;
@Named("allocationstate")
private final AllocationState allocationState; private final AllocationState allocationState;
@Named("dhcpprovider")
private final String dhcpProvider; private final String dhcpProvider;
@Named("zonetoken")
private final String zoneToken; private final String zoneToken;
@ConstructorProperties({ @ConstructorProperties({
"id", "description", "displaytext", "dns1", "dns2", "domain", "domainid", "guestcidraddress", "internaldns1", "internaldns2", "name", "networktype", "vlan", "securitygroupsenabled", "allocationstate", "dhcpprovider", "zonetoken" "id", "description", "displaytext", "dns1", "dns2", "domain", "domainid", "guestcidraddress", "internaldns1", "internaldns2", "name", "networktype", "vlan", "securitygroupsenabled", "allocationstate", "dhcpprovider", "zonetoken"
}) })
protected Zone(String id, @Nullable String description, @Nullable String displayText, @Nullable String DNS1, @Nullable String DNS2, protected Zone(String id, @Nullable String description, @Nullable String displayText, @Nullable String DNS1, @Nullable String DNS2,
@Nullable String domain, @Nullable String domainId, @Nullable String guestCIDRAddress, @Nullable String internalDNS1, @Nullable String domain, @Nullable String domainId, @Nullable String guestCIDRAddress, @Nullable String internalDNS1,
@Nullable String internalDNS2, @Nullable String name, @Nullable NetworkType networkType, @Nullable String VLAN, @Nullable String internalDNS2, @Nullable String name, @Nullable NetworkType networkType, @Nullable String VLAN,
boolean securityGroupsEnabled, @Nullable AllocationState allocationState, @Nullable String dhcpProvider, boolean securityGroupsEnabled, @Nullable AllocationState allocationState, @Nullable String dhcpProvider,
@Nullable String zoneToken) { @Nullable String zoneToken) {
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
@ -415,24 +400,24 @@ public class Zone implements Comparable<Zone> {
if (obj == null || getClass() != obj.getClass()) return false; if (obj == null || getClass() != obj.getClass()) return false;
Zone that = Zone.class.cast(obj); Zone that = Zone.class.cast(obj);
return Objects.equal(this.id, that.id) return Objects.equal(this.id, that.id)
&& Objects.equal(this.description, that.description) && Objects.equal(this.description, that.description)
&& Objects.equal(this.displayText, that.displayText) && Objects.equal(this.displayText, that.displayText)
&& Objects.equal(this.DNS1, that.DNS1) && Objects.equal(this.DNS1, that.DNS1)
&& Objects.equal(this.DNS2, that.DNS2) && Objects.equal(this.DNS2, that.DNS2)
&& Objects.equal(this.domain, that.domain) && Objects.equal(this.domain, that.domain)
&& Objects.equal(this.domainId, that.domainId) && Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.guestCIDRAddress, that.guestCIDRAddress) && Objects.equal(this.guestCIDRAddress, that.guestCIDRAddress)
&& Objects.equal(this.internalDNS1, that.internalDNS1) && Objects.equal(this.internalDNS1, that.internalDNS1)
&& Objects.equal(this.internalDNS2, that.internalDNS2) && Objects.equal(this.internalDNS2, that.internalDNS2)
&& Objects.equal(this.name, that.name) && Objects.equal(this.name, that.name)
&& Objects.equal(this.networkType, that.networkType) && Objects.equal(this.networkType, that.networkType)
&& Objects.equal(this.VLAN, that.VLAN) && Objects.equal(this.VLAN, that.VLAN)
&& Objects.equal(this.securityGroupsEnabled, that.securityGroupsEnabled) && Objects.equal(this.securityGroupsEnabled, that.securityGroupsEnabled)
&& Objects.equal(this.allocationState, that.allocationState) && Objects.equal(this.allocationState, that.allocationState)
&& Objects.equal(this.dhcpProvider, that.dhcpProvider) && Objects.equal(this.dhcpProvider, that.dhcpProvider)
&& Objects.equal(this.zoneToken, that.zoneToken); && Objects.equal(this.zoneToken, that.zoneToken);
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper(this)
.add("id", id).add("description", description).add("displayText", displayText).add("DNS1", DNS1).add("DNS2", DNS2) .add("id", id).add("description", description).add("displayText", displayText).add("DNS1", DNS1).add("DNS2", DNS2)
@ -441,7 +426,7 @@ public class Zone implements Comparable<Zone> {
.add("securityGroupsEnabled", securityGroupsEnabled).add("allocationState", allocationState).add("dhcpProvider", dhcpProvider) .add("securityGroupsEnabled", securityGroupsEnabled).add("allocationState", allocationState).add("dhcpProvider", dhcpProvider)
.add("zoneToken", zoneToken); .add("zoneToken", zoneToken);
} }
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();

View File

@ -20,7 +20,6 @@ package org.jclouds.cloudstack.parse;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.Account; import org.jclouds.cloudstack.domain.Account;
import org.jclouds.cloudstack.domain.User; import org.jclouds.cloudstack.domain.User;
import org.jclouds.cloudstack.domain.Account.State; import org.jclouds.cloudstack.domain.Account.State;
@ -44,7 +43,7 @@ public class ListAccountsResponseTest extends BaseSetParserTest<Account> {
@Override @Override
protected Injector injector() { protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() { return Guice.createInjector(new GsonModule() {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -22,7 +22,6 @@ import java.util.Calendar;
import java.util.Set; import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.Alert; import org.jclouds.cloudstack.domain.Alert;
import org.jclouds.json.BaseSetParserTest; import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
@ -42,7 +41,7 @@ public class ListAlertsResponseTest extends BaseSetParserTest<Alert> {
@Override @Override
protected Injector injector() { protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() { return Guice.createInjector(new GsonModule() {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -20,7 +20,6 @@ package org.jclouds.cloudstack.parse;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.ConfigurationEntry; import org.jclouds.cloudstack.domain.ConfigurationEntry;
import org.jclouds.json.BaseSetParserTest; import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
@ -39,7 +38,7 @@ public class ListConfigurationEntriesResponseTest extends BaseSetParserTest<Conf
@Override @Override
protected Injector injector() { protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() { return Guice.createInjector(new GsonModule() {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -20,7 +20,6 @@ package org.jclouds.cloudstack.parse;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.Domain; import org.jclouds.cloudstack.domain.Domain;
import org.jclouds.json.BaseSetParserTest; import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
@ -39,7 +38,7 @@ public class ListDomainsResponseTest extends BaseSetParserTest<Domain> {
@Override @Override
protected Injector injector() { protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() { return Guice.createInjector(new GsonModule() {
@Override @Override
protected void configure() { protected void configure() {
bind(DateAdapter.class).to(Iso8601DateAdapter.class); bind(DateAdapter.class).to(Iso8601DateAdapter.class);

View File

@ -20,7 +20,6 @@ package org.jclouds.cloudstack.parse;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.FirewallRule; import org.jclouds.cloudstack.domain.FirewallRule;
import org.jclouds.json.BaseSetParserTest; import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
@ -40,7 +39,7 @@ public class ListFirewallRulesResponseTest extends BaseSetParserTest<FirewallRul
@Override @Override
protected Injector injector() { protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() { return Guice.createInjector(new GsonModule() {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.AllocationState; import org.jclouds.cloudstack.domain.AllocationState;
import org.jclouds.cloudstack.domain.Host; import org.jclouds.cloudstack.domain.Host;
import org.jclouds.date.internal.SimpleDateFormatDateService; import org.jclouds.date.internal.SimpleDateFormatDateService;
@ -49,7 +48,7 @@ public class ListHostsResponseTest extends BaseParserTest<Set<Host>, Set<Host>>
@Override @Override
protected Injector injector() { protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() { return Guice.createInjector(new GsonModule() {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -20,7 +20,6 @@ package org.jclouds.cloudstack.parse;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.LoadBalancerRule; import org.jclouds.cloudstack.domain.LoadBalancerRule;
import org.jclouds.json.BaseSetParserTest; import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
@ -41,7 +40,7 @@ public class ListLoadBalancerRulesResponseTest extends BaseSetParserTest<LoadBal
@Override @Override
protected Injector injector() { protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() { return Guice.createInjector(new GsonModule() {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -20,7 +20,6 @@ package org.jclouds.cloudstack.parse;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.PortForwardingRule; import org.jclouds.cloudstack.domain.PortForwardingRule;
import org.jclouds.json.BaseSetParserTest; import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
@ -40,7 +39,7 @@ public class ListPortForwardingRulesResponseTest extends BaseSetParserTest<PortF
@Override @Override
protected Injector injector() { protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() { return Guice.createInjector(new GsonModule() {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -20,7 +20,6 @@ package org.jclouds.cloudstack.parse;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.SshKeyPair; import org.jclouds.cloudstack.domain.SshKeyPair;
import org.jclouds.json.BaseSetParserTest; import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
@ -39,7 +38,7 @@ public class ListSSHKeyPairsResponseTest extends BaseSetParserTest<SshKeyPair> {
@Override @Override
protected Injector injector() { protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() { return Guice.createInjector(new GsonModule() {
@Override @Override
protected void configure() { protected void configure() {