diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackParserModule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackParserModule.java deleted file mode 100644 index 4853cbe64d..0000000000 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackParserModule.java +++ /dev/null @@ -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, JsonDeserializer { - - 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.deserialize(json, PortForwardingRuleInternal.class)); - } - - public PortForwardingRule apply(PortForwardingRuleInternal in) { - Set 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, JsonDeserializer { - - 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.deserialize(json, FirewallRuleInternal.class)); - } - - public FirewallRule apply(FirewallRuleInternal in) { - Set 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, JsonDeserializer { - - 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.deserialize(json, LoadBalancerRuleInternal.class)); - } - - public LoadBalancerRule apply(LoadBalancerRuleInternal in) { - Set 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, JsonDeserializer { - - 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.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 users; - } - - private static Long nullIfUnlimited(String in) { - return in == null || "Unlimited".equals(in) ? null : new Long(in); - } - } - - @Override - protected void configure() { - bind(new TypeLiteral>() { - }).toInstance(ImmutableMap.of( - Account.class, new BreakGenericSetAdapter(), - LoadBalancerRule.class, new LoadBalancerRuleAdapter(), - PortForwardingRule.class, new PortForwardingRuleAdapter(), - FirewallRule.class, new FirewallRuleAdapter() - )); - } - -} diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java index 7bf1afd861..695d72864c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java @@ -33,86 +33,7 @@ import org.jclouds.cloudstack.CloudStackDomainClient; import org.jclouds.cloudstack.CloudStackGlobalAsyncClient; import org.jclouds.cloudstack.CloudStackGlobalClient; import org.jclouds.cloudstack.domain.LoginResponse; -import org.jclouds.cloudstack.features.AccountAsyncClient; -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.features.*; import org.jclouds.cloudstack.filters.AddSessionKeyAndJSessionIdToRequest; import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.QuerySigner; @@ -233,7 +154,6 @@ public class CloudStackRestClientModule extends RestClientModule>() { }).to(new TypeLiteral>() { }); - install(new CloudStackParserModule()); bind(CredentialType.class).toProvider(CredentialTypeFromPropertyOrDefault.class); // session client is used directly for filters and retry handlers, so let's bind it explicitly diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Account.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Account.java index 0cd19c6f5c..e96711538d 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Account.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Account.java @@ -24,8 +24,6 @@ import java.beans.ConstructorProperties; import java.util.Map; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.CaseFormat; @@ -119,7 +117,7 @@ public class Account extends ForwardingSet { return new ConcreteBuilder().fromAccount(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -424,58 +422,60 @@ public class Account extends ForwardingSet { } private final String id; - @Named("accounttype") private final Account.Type type; - @Named("networkdomain") private final String networkDomain; private final String domain; private final String domainId; - @Named("ipsavailable") private final Long IPsAvailable; - @Named("iplimit") private final Long IPLimit; - @Named("iptotal") private final long IPs; - @Named("iscleanuprequired") private final boolean cleanupRequired; private final String name; - @Named("receivedbytes") private final long receivedBytes; - @Named("sentbytes") private final long sentBytes; - @Named("snapshotavailable") private final Long snapshotsAvailable; private final Long snapshotLimit; - @Named("snapshottotal") private final long snapshots; private final Account.State state; - @Named("templateavailable") private final Long templatesAvailable; - @Named("templatelimit") private final Long templateLimit; - @Named("templatetotal") private final long templates; - @Named("vmavailable") private final Long VMsAvailable; - @Named("vmlimit") private final Long VMLimit; - @Named("vmrunning") private final long VMsRunning; - @Named("vmstopped") private final long VMsStopped; - @Named("vmtotal") private final long VMs; - @Named("volumeavailable") private final Long volumesAvailable; - @Named("volumelimit") private final Long volumeLimit; - @Named("volumetotal") private final long volumes; private final Set users; @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 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, @Nullable String domainId, @Nullable Long IPsAvailable, @Nullable Long IPLimit, long IPs, boolean cleanupRequired, @Nullable String name, long receivedBytes, long sentBytes, @Nullable Long snapshotsAvailable, @@ -554,7 +554,7 @@ public class Account extends ForwardingSet { /** * @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 public Long getIPsAvailable() { @@ -563,7 +563,7 @@ public class Account extends ForwardingSet { /** * @return the total number of public ip addresses this account can acquire, - or null if unlimited + * or null if unlimited */ @Nullable public Long getIPLimit() { @@ -608,7 +608,7 @@ public class Account extends ForwardingSet { /** * @return the total number of snapshots available for this account, or null - if unlimited + * if unlimited */ @Nullable public Long getSnapshotsAvailable() { @@ -617,7 +617,7 @@ public class Account extends ForwardingSet { /** * @return the total number of snapshots which can be stored by this account, - or null if unlimited + * or null if unlimited */ @Nullable public Long getSnapshotLimit() { @@ -641,7 +641,7 @@ public class Account extends ForwardingSet { /** * @return the total number of templates available to be created by this - account, or null if unlimited + * account, or null if unlimited */ @Nullable public Long getTemplatesAvailable() { @@ -650,7 +650,7 @@ public class Account extends ForwardingSet { /** * @return the total number of templates which can be created by this - account, or null if unlimited + * account, or null if unlimited */ @Nullable public Long getTemplateLimit() { @@ -659,7 +659,7 @@ public class Account extends ForwardingSet { /** * @return the total number of templates which have been created by this - account + * account */ public long getTemplates() { return this.templates; @@ -667,7 +667,7 @@ public class Account extends ForwardingSet { /** * @return the total number of virtual machines available for this account to - acquire, or null if unlimited + * acquire, or null if unlimited */ @Nullable public Long getVMsAvailable() { @@ -676,7 +676,7 @@ public class Account extends ForwardingSet { /** * @return the total number of virtual machines that can be deployed by this - account, or null if unlimited + * account, or null if unlimited */ @Nullable public Long getVMLimit() { @@ -714,7 +714,7 @@ public class Account extends ForwardingSet { /** * @return the total volume which can be used by this account, or null if - unlimited + * unlimited */ @Nullable public Long getVolumeLimit() { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Alert.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Alert.java index c28d0e0cd9..e7442d20c4 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Alert.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Alert.java @@ -43,7 +43,7 @@ public class Alert { return new ConcreteBuilder().fromAlert(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AllocationState.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AllocationState.java index cfba897428..f83408bf38 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AllocationState.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AllocationState.java @@ -30,7 +30,7 @@ public enum AllocationState { UNKNOWN; public static AllocationState fromValue(String value) { - try{ + try { return valueOf(value.toUpperCase()); } catch (IllegalArgumentException e) { return UNKNOWN; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ApiKeyPair.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ApiKeyPair.java index 659e4f837e..f485236b35 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ApiKeyPair.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ApiKeyPair.java @@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -42,7 +40,7 @@ public class ApiKeyPair { return new ConcreteBuilder().fromApiKeyPair(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String apiKey; @@ -82,9 +80,7 @@ public class ApiKeyPair { } } - @Named("apikey") private final String apiKey; - @Named("secretkey") private final String secretKey; @ConstructorProperties({ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncCreateResponse.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncCreateResponse.java index 613adfc9bc..72b2599a71 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncCreateResponse.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncCreateResponse.java @@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -43,7 +41,7 @@ public class AsyncCreateResponse { return new ConcreteBuilder().fromAsyncCreateResponse(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -84,7 +82,6 @@ public class AsyncCreateResponse { } private final String id; - @Named("jobid") private final String jobId; @ConstructorProperties({ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJob.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJob.java index 0ecb1e9e97..b76f8566f1 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJob.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJob.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -41,9 +39,9 @@ public class AsyncJob { * Valid job result codes */ public static enum ResultCode { - SUCCESS (0), - FAIL (530), - UNKNOWN (-1); + SUCCESS(0), + FAIL(530), + UNKNOWN(-1); private final int code; @@ -51,7 +49,9 @@ public class AsyncJob { this.code = code; } - public int code() { return this.code; } + public int code() { + return this.code; + } public static ResultCode fromValue(String value) { try { @@ -64,7 +64,7 @@ public class AsyncJob { default: return UNKNOWN; } - } catch(NumberFormatException e) { + } catch (NumberFormatException e) { return UNKNOWN; } } @@ -74,10 +74,10 @@ public class AsyncJob { * Valid async job statuses */ public static enum Status { - IN_PROGRESS (0), - SUCCEEDED (1), - FAILED (2), - UNKNOWN (-1); + IN_PROGRESS(0), + SUCCEEDED(1), + FAILED(2), + UNKNOWN(-1); private final int code; @@ -85,7 +85,9 @@ public class AsyncJob { this.code = code; } - public int code() { return this.code; } + public int code() { + return this.code; + } public static Status fromValue(String value) { try { @@ -106,7 +108,7 @@ public class AsyncJob { } } - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } @@ -114,7 +116,7 @@ public class AsyncJob { return new ConcreteBuilder().fromAsyncJob(this); } - public static abstract class Builder, S> { + public static abstract class Builder, S> { protected abstract T self(); protected String accountId; @@ -262,34 +264,24 @@ public class AsyncJob { } } - private static class ConcreteBuilder extends Builder,T> { + private static class ConcreteBuilder extends Builder, T> { @Override protected ConcreteBuilder self() { return this; } } - @Named("accountid") private final String accountId; private final String cmd; private final Date created; - @Named("jobid") private final String id; - @Named("jobinstanceid") private final String instanceId; - @Named("jobinstancetype") private final String instanceType; - @Named("jobprocstatus") private final int progress; - @Named("jobresult") private final S result; - @Named("jobresultcode") private final AsyncJob.ResultCode resultCode; - @Named("jobresulttype") private final String resultType; - @Named("jobstatus") private final AsyncJob.Status status; - @Named("userid") private final String userId; private final AsyncJobError error; @@ -412,7 +404,7 @@ public class AsyncJob { /** * @return the error related to this command, or null if no error or error - not yet encountered. + * not yet encountered. */ @Nullable public AsyncJobError getError() { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJobError.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJobError.java index 5e9b14a0b2..fd1a087b1c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJobError.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJobError.java @@ -20,15 +20,12 @@ package org.jclouds.cloudstack.domain; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; /** - * * @author Adrian Cole */ public class AsyncJobError { @@ -37,15 +34,15 @@ public class AsyncJobError { * Error codes for job errors */ public static enum ErrorCode { - INTERNAL_ERROR (530), - ACCOUNT_ERROR (531), + INTERNAL_ERROR(530), + ACCOUNT_ERROR(531), ACCOUNT_RESOURCE_LIMIT_ERROR(532), - INSUFFICIENT_CAPACITY_ERROR (533), - RESOURCE_UNAVAILABLE_ERROR (534), - RESOURCE_ALLOCATION_ERROR (535), - RESOURCE_IN_USE_ERROR (536), - NETWORK_RULE_CONFLICT_ERROR (537), - UNKNOWN (-1); + INSUFFICIENT_CAPACITY_ERROR(533), + RESOURCE_UNAVAILABLE_ERROR(534), + RESOURCE_ALLOCATION_ERROR(535), + RESOURCE_IN_USE_ERROR(536), + NETWORK_RULE_CONFLICT_ERROR(537), + UNKNOWN(-1); private final int code; @@ -53,19 +50,21 @@ public class AsyncJobError { this.code = code; } - public int code() { return this.code; } + public int code() { + return this.code; + } public static ErrorCode fromValue(String value) { try { int errorCode = Integer.parseInt(value); - for(ErrorCode candidate : values()) { + for (ErrorCode candidate : values()) { if (candidate.code() == errorCode) { return candidate; } } return UNKNOWN; - } catch(NumberFormatException e) { + } catch (NumberFormatException e) { return UNKNOWN; } } @@ -79,7 +78,7 @@ public class AsyncJobError { return new ConcreteBuilder().fromAsyncJobError(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected AsyncJobError.ErrorCode errorCode; @@ -119,9 +118,7 @@ public class AsyncJobError { } } - @Named("errorcode") private final ErrorCode errorCode; - @Named("errortext") private final String errorText; @ConstructorProperties({ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java index ab0a92decd..7f9c3cbb88 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java @@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -42,7 +40,7 @@ public class Capabilities { return new ConcreteBuilder().fromCapabilities(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String cloudStackVersion; @@ -112,11 +110,8 @@ public class Capabilities { } } - @Named("cloudstackversion") private final String cloudStackVersion; - @Named("securitygroupsenabled") private final boolean securityGroupsEnabled; - @Named("userpublictemplateenabled") private final boolean canShareTemplates; private final boolean firewallRuleUiEnabled; private final boolean supportELB; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capacity.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capacity.java index c2852fbf54..712f63ef6f 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capacity.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capacity.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Map; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Function; @@ -90,7 +88,7 @@ public class Capacity implements Comparable { return new ConcreteBuilder().fromCapacity(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected long capacityTotal; @@ -190,20 +188,13 @@ public class Capacity implements Comparable { } } - @Named("capacitytotal") private final long capacityTotal; - @Named("capacityused") private final long capacityUsed; - @Named("percentused") private final double percentUsed; - @Named("podid") private final String podId; - @Named("podname") private final String podName; private final Capacity.Type type; - @Named("zoneid") private final String zoneId; - @Named("zonename") private final String zoneName; @ConstructorProperties({ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Cluster.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Cluster.java index 969dce1d0f..12aa95a83c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Cluster.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Cluster.java @@ -24,8 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -48,7 +46,7 @@ public class Cluster implements Comparable { UNRECOGNIZED; public static ManagedState fromValue(String value) { - try{ + try { return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, value)); } catch (IllegalArgumentException e) { return UNRECOGNIZED; @@ -69,7 +67,7 @@ public class Cluster implements Comparable { return new ConcreteBuilder().fromCluster(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -190,22 +188,14 @@ public class Cluster implements Comparable { } private final String id; - @Named("allocationstate") private final AllocationState allocationState; - @Named("clustertype") private final Host.ClusterType clusterType; - @Named("hypervisortype") private final String hypervisor; - @Named("managedstate") private final Cluster.ManagedState managedState; private final String name; - @Named("podid") private final String podId; - @Named("podname") private final String podName; - @Named("zoneid") private final String zoneId; - @Named("zonename") private final String zoneName; @ConstructorProperties({ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ConfigurationEntry.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ConfigurationEntry.java index 129c911c01..dbc972ba29 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ConfigurationEntry.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ConfigurationEntry.java @@ -42,7 +42,7 @@ public class ConfigurationEntry implements Comparable { return new ConcreteBuilder().fromConfigurationEntry(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String category; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/DiskOffering.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/DiskOffering.java index 262a36c079..ba0a5874ed 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/DiskOffering.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/DiskOffering.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -45,7 +43,7 @@ public class DiskOffering implements Comparable { return new ConcreteBuilder().fromDiskOffering(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -157,15 +155,11 @@ public class DiskOffering implements Comparable { private final String id; private final String name; - @Named("displaytext") private final String displayText; private final Date created; private final String domain; - @Named("domainid") private final String domainId; - @Named("disksize") private final int diskSize; - @Named("iscustomized") private final boolean customized; private final String tags; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Domain.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Domain.java index c127bc998c..f2539901e4 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Domain.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Domain.java @@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -44,7 +42,7 @@ public class Domain implements Comparable { return new ConcreteBuilder().fromDomain(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -135,15 +133,11 @@ public class Domain implements Comparable { } private final String id; - @Named("haschild") private final boolean hasChild; private final long level; private final String name; - @Named("networkdomain") private final String networkDomain; - @Named("parentdomainid") private final String parentDomainId; - @Named("parentdomainname") private final String parentDomainName; @ConstructorProperties({ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/EncryptedPasswordAndPrivateKey.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/EncryptedPasswordAndPrivateKey.java index cf2ae210dd..b1f9a76d6b 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/EncryptedPasswordAndPrivateKey.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/EncryptedPasswordAndPrivateKey.java @@ -40,7 +40,7 @@ public class EncryptedPasswordAndPrivateKey { return new ConcreteBuilder().fromEncryptedPasswordAndPrivateKey(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String encryptedPassword; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Event.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Event.java index 27645bbb27..4459d6aec5 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Event.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Event.java @@ -43,7 +43,7 @@ public class Event implements Comparable { return new ConcreteBuilder().fromEvent(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -213,7 +213,7 @@ public class Event implements Comparable { /** * @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 public String getAccount() { @@ -286,7 +286,7 @@ public class Event implements Comparable { /** * @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 public String getUsername() { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/FirewallRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/FirewallRule.java index 12c43e7d5f..3ddbec09c3 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/FirewallRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/FirewallRule.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.CaseFormat; @@ -50,7 +48,7 @@ public class FirewallRule implements Comparable { public static Protocol fromValue(String value) { try { return valueOf(value.toUpperCase()); - } catch(IllegalArgumentException e) { + } catch (IllegalArgumentException e) { return UNKNOWN; } } @@ -63,17 +61,17 @@ public class FirewallRule implements Comparable { public static enum State { 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. 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 - // network elements, the rule will be deleted from database. + // network elements, the rule will be deleted from database. UNKNOWN; public static State fromValue(String value) { try { return valueOf(value.toUpperCase()); - } catch(IllegalArgumentException e) { + } catch (IllegalArgumentException e) { return UNKNOWN; } } @@ -92,7 +90,7 @@ public class FirewallRule implements Comparable { return new ConcreteBuilder().fromFirewallRule(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -217,19 +215,12 @@ public class FirewallRule implements Comparable { } private final String id; - @Named("cidrlist") private final Set CIDRs; - @Named("startport") private final int startPort; - @Named("endport") private final int endPort; - @Named("icmpcode") private final String icmpCode; - @Named("icmptype") private final String icmpType; - @Named("ipaddress") private final String ipAddress; - @Named("ipaddressid") private final String ipAddressId; private final FirewallRule.Protocol protocol; private final FirewallRule.State state; @@ -237,7 +228,19 @@ public class FirewallRule implements Comparable { @ConstructorProperties({ "id", "cidrlist", "startport", "endport", "icmpcode", "icmptype", "ipaddress", "ipaddressid", "protocol", "state" }) - protected FirewallRule(String id, @Nullable Set 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 splitStringOnCommas(String in) { + return in == null ? ImmutableSet.of() : ImmutableSet.copyOf(in.split(",")); + } + + + protected FirewallRule(String id, @Nullable Iterable CIDRs, int startPort, int endPort, @Nullable String icmpCode, @Nullable String icmpType, @Nullable String ipAddress, @Nullable String ipAddressId, @Nullable FirewallRule.Protocol protocol, @Nullable FirewallRule.State state) { this.id = checkNotNull(id, "id"); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/GuestIPType.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/GuestIPType.java index 76f12744e9..e2bc180ec8 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/GuestIPType.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/GuestIPType.java @@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.CaseFormat; /** - * * @author Adrian Cole * @see org.jclouds.cloudstack.features.OfferingClient#listNetworkOfferings */ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Host.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Host.java index 00f822fad2..7d9ea4a982 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Host.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Host.java @@ -25,8 +25,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -75,7 +73,7 @@ public class Host implements Comparable { public static State fromValue(String value) { try { return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, value)); - } catch(IllegalArgumentException e) { + } catch (IllegalArgumentException e) { return UNKNOWN; } } @@ -108,7 +106,7 @@ public class Host implements Comparable { } return valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, value)); - } catch(IllegalArgumentException e) { + } catch (IllegalArgumentException e) { return UNKNOWN; } } @@ -572,77 +570,46 @@ public class Host implements Comparable { } private final String id; - @Named("allocationstate") private final AllocationState allocationState; - @Named("averageload") private final int averageLoad; private final String capabilities; - @Named("clusterid") private final String clusterId; - @Named("clustername") private final String clusterName; - @Named("clustertype") private final Host.ClusterType clusterType; - @Named("cpuallocated") private final String cpuAllocated; - @Named("cpunumber") private final int cpuNumber; - @Named("cpuspeed") private final int cpuSpeed; - @Named("cpuused") private final String cpuUsed; - @Named("cpuwithoverprovisioning") private final float cpuWithOverProvisioning; private final Date created; private final Date disconnected; - @Named("disksizeallocated") private final long diskSizeAllocated; - @Named("disksizetotal") private final long diskSizeTotal; private final String events; - @Named("hasenoughcapacity") private final boolean hasEnoughCapacity; - @Named("hosttags") private final String hostTags; private final String hypervisor; - @Named("ipaddress") private final String ipAddress; - @Named("islocalstorageactive") private final boolean localStorageActive; - @Named("jobid") private final String jobId; - @Named("jobstatus") private final AsyncJob.Status jobStatus; - @Named("lastpinged") private final Date lastPinged; - @Named("managementserverid") private final String managementServerId; - @Named("memoryallocated") private final long memoryAllocated; - @Named("memorytotal") private final long memoryTotal; - @Named("memoryused") private final long memoryUsed; private final String name; - @Named("networkkbsread") private final long networkKbsRead; - @Named("networkkbswrite") private final long networkKbsWrite; - @Named("oscategoryid") private final String osCategoryId; - @Named("oscategoryname") private final String osCategoryName; - @Named("podid") private final String podId; - @Named("podname") private final String podName; private final Date removed; private final Host.State state; private final Host.Type type; private final String version; - @Named("zoneid") private final String zoneId; - @Named("zonename") private final String zoneName; @ConstructorProperties({ @@ -835,7 +802,7 @@ public class Host implements Comparable { public long getMemoryUsed() { return this.memoryUsed; } - + @Nullable public String getName() { return this.name; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java index f11ff41fcf..76524647a8 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -33,20 +31,20 @@ import com.google.common.collect.ImmutableSet; /** * Class IPForwardingRule - * + * * @author Adrian Cole -*/ + */ public class IPForwardingRule implements Comparable { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromIPForwardingRule(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -63,8 +61,8 @@ public class IPForwardingRule implements Comparable { protected Set CIDRs = ImmutableSet.of(); protected int privateEndPort; protected int publicEndPort; - - /** + + /** * @see IPForwardingRule#getId() */ public T id(String id) { @@ -72,7 +70,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getIPAddress() */ public T IPAddress(String IPAddress) { @@ -80,7 +78,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getIPAddressId() */ public T IPAddressId(String IPAddressId) { @@ -88,7 +86,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getStartPort() */ public T startPort(int startPort) { @@ -96,7 +94,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getProtocol() */ public T protocol(String protocol) { @@ -104,7 +102,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getEndPort() */ public T endPort(int endPort) { @@ -112,7 +110,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getState() */ public T state(String state) { @@ -120,7 +118,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getVirtualMachineDisplayName() */ public T virtualMachineDisplayName(String virtualMachineDisplayName) { @@ -128,7 +126,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getVirtualMachineId() */ public T virtualMachineId(String virtualMachineId) { @@ -136,7 +134,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getVirtualMachineName() */ public T virtualMachineName(String virtualMachineName) { @@ -144,7 +142,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getPublicPort() */ public T publicPort(int publicPort) { @@ -152,11 +150,11 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getCIDRs() */ public T CIDRs(Set CIDRs) { - this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); + this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); return self(); } @@ -164,7 +162,7 @@ public class IPForwardingRule implements Comparable { return CIDRs(ImmutableSet.copyOf(in)); } - /** + /** * @see IPForwardingRule#getPrivateEndPort() */ public T privateEndPort(int privateEndPort) { @@ -172,7 +170,7 @@ public class IPForwardingRule implements Comparable { return self(); } - /** + /** * @see IPForwardingRule#getPublicEndPort() */ public T publicEndPort(int publicEndPort) { @@ -184,23 +182,23 @@ public class IPForwardingRule implements Comparable { return new IPForwardingRule(id, IPAddress, IPAddressId, startPort, protocol, endPort, state, virtualMachineDisplayName, virtualMachineId, virtualMachineName, publicPort, CIDRs, privateEndPort, publicEndPort); } - + public T fromIPForwardingRule(IPForwardingRule in) { return this - .id(in.getId()) - .IPAddress(in.getIPAddress()) - .IPAddressId(in.getIPAddressId()) - .startPort(in.getStartPort()) - .protocol(in.getProtocol()) - .endPort(in.getEndPort()) - .state(in.getState()) - .virtualMachineDisplayName(in.getVirtualMachineDisplayName()) - .virtualMachineId(in.getVirtualMachineId()) - .virtualMachineName(in.getVirtualMachineName()) - .publicPort(in.getPublicPort()) - .CIDRs(in.getCIDRs()) - .privateEndPort(in.getPrivateEndPort()) - .publicEndPort(in.getPublicEndPort()); + .id(in.getId()) + .IPAddress(in.getIPAddress()) + .IPAddressId(in.getIPAddressId()) + .startPort(in.getStartPort()) + .protocol(in.getProtocol()) + .endPort(in.getEndPort()) + .state(in.getState()) + .virtualMachineDisplayName(in.getVirtualMachineDisplayName()) + .virtualMachineId(in.getVirtualMachineId()) + .virtualMachineName(in.getVirtualMachineName()) + .publicPort(in.getPublicPort()) + .CIDRs(in.getCIDRs()) + .privateEndPort(in.getPrivateEndPort()) + .publicEndPort(in.getPublicEndPort()); } } @@ -212,33 +210,22 @@ public class IPForwardingRule implements Comparable { } private final String id; - @Named("ipaddress") private final String IPAddress; - @Named("ipaddressid") private final String IPAddressId; - @Named("startport") private final int startPort; private final String protocol; - @Named("endport") private final int endPort; private final String state; - @Named("virtualmachinedisplayname") private final String virtualMachineDisplayName; - @Named("virtualmachineid") private final String virtualMachineId; - @Named("virtualmachinename") private final String virtualMachineName; - @Named("publicport") private final int publicPort; - @Named("cidrlist") private final Set CIDRs; - @Named("privateendport") private final int privateEndPort; - @Named("publicendport") private final int publicEndPort; @ConstructorProperties({ - "id", "ipaddress", "ipaddressid", "startport", "protocol", "endport", "state", "virtualmachinedisplayname", + "id", "ipaddress", "ipaddressid", "startport", "protocol", "endport", "state", "virtualmachinedisplayname", "virtualmachineid", "virtualmachinename", "publicport", "cidrlist", "privateendport", "publicendport" }) protected IPForwardingRule(String id, String IPAddress, String IPAddressId, int startPort, @Nullable String protocol, @@ -256,7 +243,7 @@ public class IPForwardingRule implements Comparable { this.virtualMachineId = virtualMachineId; this.virtualMachineName = virtualMachineName; this.publicPort = publicPort; - this.CIDRs = CIDRs == null ? ImmutableSet.of() : ImmutableSet.copyOf(CIDRs); + this.CIDRs = CIDRs == null ? ImmutableSet.of() : ImmutableSet.copyOf(CIDRs); this.privateEndPort = privateEndPort; this.publicEndPort = publicEndPort; } @@ -377,21 +364,21 @@ public class IPForwardingRule implements Comparable { if (obj == null || getClass() != obj.getClass()) return false; IPForwardingRule that = IPForwardingRule.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.IPAddress, that.IPAddress) - && Objects.equal(this.IPAddressId, that.IPAddressId) - && Objects.equal(this.startPort, that.startPort) - && Objects.equal(this.protocol, that.protocol) - && Objects.equal(this.endPort, that.endPort) - && Objects.equal(this.state, that.state) - && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) - && Objects.equal(this.virtualMachineId, that.virtualMachineId) - && Objects.equal(this.virtualMachineName, that.virtualMachineName) - && Objects.equal(this.publicPort, that.publicPort) - && Objects.equal(this.CIDRs, that.CIDRs) - && Objects.equal(this.privateEndPort, that.privateEndPort) - && Objects.equal(this.publicEndPort, that.publicEndPort); + && Objects.equal(this.IPAddress, that.IPAddress) + && Objects.equal(this.IPAddressId, that.IPAddressId) + && Objects.equal(this.startPort, that.startPort) + && Objects.equal(this.protocol, that.protocol) + && Objects.equal(this.endPort, that.endPort) + && Objects.equal(this.state, that.state) + && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) + && Objects.equal(this.virtualMachineId, that.virtualMachineId) + && Objects.equal(this.virtualMachineName, that.virtualMachineName) + && Objects.equal(this.publicPort, that.publicPort) + && Objects.equal(this.CIDRs, that.CIDRs) + && Objects.equal(this.privateEndPort, that.privateEndPort) + && Objects.equal(this.publicEndPort, that.publicEndPort); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .add("id", id).add("IPAddress", IPAddress).add("IPAddressId", IPAddressId).add("startPort", startPort) @@ -399,7 +386,7 @@ public class IPForwardingRule implements Comparable { .add("virtualMachineId", virtualMachineId).add("virtualMachineName", virtualMachineName).add("publicPort", publicPort) .add("CIDRs", CIDRs).add("privateEndPort", privateEndPort).add("publicEndPort", publicEndPort); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISO.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISO.java index d5a942e078..ca2019461d 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISO.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISO.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -32,35 +30,35 @@ import com.google.common.base.Objects.ToStringHelper; /** * Class ISO - * + * * @author Richard Downer -*/ + */ public class ISO { /** */ public static enum ISOFilter { - + featured, self, self_executable, executable, community, UNRECOGNIZED; - + public static ISOFilter fromValue(String format) { - try { - return valueOf(checkNotNull(format, "format")); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } + try { + return valueOf(checkNotNull(format, "format")); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } } } - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromISO(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -95,8 +93,8 @@ public class ISO { protected String templateType; protected String zoneId; protected String zoneName; - - /** + + /** * @see ISO#getId() */ public T id(String id) { @@ -104,7 +102,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getAccount() */ public T account(String account) { @@ -112,7 +110,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getAccountId() */ public T accountId(String accountId) { @@ -120,7 +118,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#isBootable() */ public T bootable(boolean bootable) { @@ -128,7 +126,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getChecksum() */ public T checksum(String checksum) { @@ -136,7 +134,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getCreated() */ public T created(Date created) { @@ -144,7 +142,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#isCrossZones() */ public T crossZones(boolean crossZones) { @@ -152,7 +150,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getDisplayText() */ public T displayText(String displayText) { @@ -160,7 +158,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getDomain() */ public T domain(String domain) { @@ -168,7 +166,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getDomainid() */ public T domainid(String domainid) { @@ -176,7 +174,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getFormat() */ public T format(String format) { @@ -184,7 +182,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getHostId() */ public T hostId(String hostId) { @@ -192,7 +190,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getHostName() */ public T hostName(String hostName) { @@ -200,7 +198,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getHypervisor() */ public T hypervisor(String hypervisor) { @@ -208,7 +206,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#isExtractable() */ public T isExtractable(boolean isExtractable) { @@ -216,7 +214,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#isFeatured() */ public T isFeatured(boolean isFeatured) { @@ -224,7 +222,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#isPublic() */ public T isPublic(boolean isPublic) { @@ -232,7 +230,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#isReady() */ public T isReady(boolean isReady) { @@ -240,7 +238,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getJobId() */ public T jobId(String jobId) { @@ -248,7 +246,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getJobStatus() */ public T jobStatus(String jobStatus) { @@ -256,7 +254,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getName() */ public T name(String name) { @@ -264,7 +262,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getOsTypeId() */ public T osTypeId(String osTypeId) { @@ -272,7 +270,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getOsTypeName() */ public T osTypeName(String osTypeName) { @@ -280,7 +278,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#isPasswordEnabled() */ public T passwordEnabled(boolean passwordEnabled) { @@ -288,7 +286,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getRemoved() */ public T removed(Date removed) { @@ -296,7 +294,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getSize() */ public T size(long size) { @@ -304,7 +302,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getSourceTemplateId() */ public T sourceTemplateId(String sourceTemplateId) { @@ -312,7 +310,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getStatus() */ public T status(String status) { @@ -320,7 +318,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getTemplateTag() */ public T templateTag(String templateTag) { @@ -328,7 +326,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getTemplateType() */ public T templateType(String templateType) { @@ -336,7 +334,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getZoneId() */ public T zoneId(String zoneId) { @@ -344,7 +342,7 @@ public class ISO { return self(); } - /** + /** * @see ISO#getZoneName() */ public T zoneName(String zoneName) { @@ -358,41 +356,41 @@ public class ISO { osTypeId, osTypeName, passwordEnabled, removed, size, sourceTemplateId, status, templateTag, templateType, zoneId, zoneName); } - + public T fromISO(ISO in) { return this - .id(in.getId()) - .account(in.getAccount()) - .accountId(in.getAccountId()) - .bootable(in.isBootable()) - .checksum(in.getChecksum()) - .created(in.getCreated()) - .crossZones(in.isCrossZones()) - .displayText(in.getDisplayText()) - .domain(in.getDomain()) - .domainid(in.getDomainid()) - .format(in.getFormat()) - .hostId(in.getHostId()) - .hostName(in.getHostName()) - .hypervisor(in.getHypervisor()) - .isExtractable(in.isExtractable()) - .isFeatured(in.isFeatured()) - .isPublic(in.isPublic()) - .isReady(in.isReady()) - .jobId(in.getJobId()) - .jobStatus(in.getJobStatus()) - .name(in.getName()) - .osTypeId(in.getOsTypeId()) - .osTypeName(in.getOsTypeName()) - .passwordEnabled(in.isPasswordEnabled()) - .removed(in.getRemoved()) - .size(in.getSize()) - .sourceTemplateId(in.getSourceTemplateId()) - .status(in.getStatus()) - .templateTag(in.getTemplateTag()) - .templateType(in.getTemplateType()) - .zoneId(in.getZoneId()) - .zoneName(in.getZoneName()); + .id(in.getId()) + .account(in.getAccount()) + .accountId(in.getAccountId()) + .bootable(in.isBootable()) + .checksum(in.getChecksum()) + .created(in.getCreated()) + .crossZones(in.isCrossZones()) + .displayText(in.getDisplayText()) + .domain(in.getDomain()) + .domainid(in.getDomainid()) + .format(in.getFormat()) + .hostId(in.getHostId()) + .hostName(in.getHostName()) + .hypervisor(in.getHypervisor()) + .isExtractable(in.isExtractable()) + .isFeatured(in.isFeatured()) + .isPublic(in.isPublic()) + .isReady(in.isReady()) + .jobId(in.getJobId()) + .jobStatus(in.getJobStatus()) + .name(in.getName()) + .osTypeId(in.getOsTypeId()) + .osTypeName(in.getOsTypeName()) + .passwordEnabled(in.isPasswordEnabled()) + .removed(in.getRemoved()) + .size(in.getSize()) + .sourceTemplateId(in.getSourceTemplateId()) + .status(in.getStatus()) + .templateTag(in.getTemplateTag()) + .templateType(in.getTemplateType()) + .zoneId(in.getZoneId()) + .zoneName(in.getZoneName()); } } @@ -405,58 +403,39 @@ public class ISO { private final String id; private final String account; - @Named("accountid") private final String accountId; private final boolean bootable; private final String checksum; private final Date created; private final boolean crossZones; - @Named("displaytext") private final String displayText; private final String domain; - @Named("domainId") private final String domainid; private final String format; - @Named("hostid") private final String hostId; - @Named("hostname") private final String hostName; private final String hypervisor; - @Named("isextractable") private final boolean isExtractable; - @Named("isfeatured") private final boolean isFeatured; - @Named("ispublic") private final boolean isPublic; - @Named("isready") private final boolean isReady; - @Named("jobid") private final String jobId; - @Named("jobstatus") private final String jobStatus; private final String name; - @Named("ostypeid") private final String osTypeId; - @Named("ostypename") private final String osTypeName; - @Named("passwordenabled") private final boolean passwordEnabled; private final Date removed; private final long size; - @Named("sourcetemplateid") private final String sourceTemplateId; private final String status; - @Named("templatetag") private final String templateTag; - @Named("templatetype") private final String templateType; - @Named("zoneid") private final String zoneId; - @Named("zonename") private final String zoneName; @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, @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; ISO that = ISO.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.account, that.account) - && Objects.equal(this.accountId, that.accountId) - && Objects.equal(this.bootable, that.bootable) - && Objects.equal(this.checksum, that.checksum) - && Objects.equal(this.created, that.created) - && Objects.equal(this.crossZones, that.crossZones) - && Objects.equal(this.displayText, that.displayText) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainid, that.domainid) - && Objects.equal(this.format, that.format) - && Objects.equal(this.hostId, that.hostId) - && Objects.equal(this.hostName, that.hostName) - && Objects.equal(this.hypervisor, that.hypervisor) - && Objects.equal(this.isExtractable, that.isExtractable) - && Objects.equal(this.isFeatured, that.isFeatured) - && Objects.equal(this.isPublic, that.isPublic) - && Objects.equal(this.isReady, that.isReady) - && Objects.equal(this.jobId, that.jobId) - && Objects.equal(this.jobStatus, that.jobStatus) - && Objects.equal(this.name, that.name) - && Objects.equal(this.osTypeId, that.osTypeId) - && Objects.equal(this.osTypeName, that.osTypeName) - && Objects.equal(this.passwordEnabled, that.passwordEnabled) - && Objects.equal(this.removed, that.removed) - && Objects.equal(this.size, that.size) - && Objects.equal(this.sourceTemplateId, that.sourceTemplateId) - && Objects.equal(this.status, that.status) - && Objects.equal(this.templateTag, that.templateTag) - && Objects.equal(this.templateType, that.templateType) - && Objects.equal(this.zoneId, that.zoneId) - && Objects.equal(this.zoneName, that.zoneName); + && Objects.equal(this.account, that.account) + && Objects.equal(this.accountId, that.accountId) + && Objects.equal(this.bootable, that.bootable) + && Objects.equal(this.checksum, that.checksum) + && Objects.equal(this.created, that.created) + && Objects.equal(this.crossZones, that.crossZones) + && Objects.equal(this.displayText, that.displayText) + && Objects.equal(this.domain, that.domain) + && Objects.equal(this.domainid, that.domainid) + && Objects.equal(this.format, that.format) + && Objects.equal(this.hostId, that.hostId) + && Objects.equal(this.hostName, that.hostName) + && Objects.equal(this.hypervisor, that.hypervisor) + && Objects.equal(this.isExtractable, that.isExtractable) + && Objects.equal(this.isFeatured, that.isFeatured) + && Objects.equal(this.isPublic, that.isPublic) + && Objects.equal(this.isReady, that.isReady) + && Objects.equal(this.jobId, that.jobId) + && Objects.equal(this.jobStatus, that.jobStatus) + && Objects.equal(this.name, that.name) + && Objects.equal(this.osTypeId, that.osTypeId) + && Objects.equal(this.osTypeName, that.osTypeName) + && Objects.equal(this.passwordEnabled, that.passwordEnabled) + && Objects.equal(this.removed, that.removed) + && Objects.equal(this.size, that.size) + && Objects.equal(this.sourceTemplateId, that.sourceTemplateId) + && Objects.equal(this.status, that.status) + && Objects.equal(this.templateTag, that.templateTag) + && Objects.equal(this.templateType, that.templateType) + && Objects.equal(this.zoneId, that.zoneId) + && Objects.equal(this.zoneName, that.zoneName); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .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("zoneId", zoneId).add("zoneName", zoneName); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java index 5b8604293a..244c5c2a2d 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -32,20 +30,20 @@ import com.google.common.base.Objects.ToStringHelper; /** * Class ISOExtraction - * + * * @author Richard Downer -*/ + */ public class ISOExtraction { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromISOExtraction(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -61,8 +59,8 @@ public class ISOExtraction { protected String url; protected String zoneId; protected String zoneName; - - /** + + /** * @see ISOExtraction#getId() */ public T id(String id) { @@ -70,7 +68,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getAccountId() */ public T accountId(String accountId) { @@ -78,7 +76,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getCreated() */ public T created(Date created) { @@ -86,7 +84,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getExtractId() */ public T extractId(String extractId) { @@ -94,7 +92,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getExtractMode() */ public T extractMode(ExtractMode extractMode) { @@ -102,7 +100,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getName() */ public T name(String name) { @@ -110,7 +108,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getState() */ public T state(String state) { @@ -118,7 +116,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getStatus() */ public T status(String status) { @@ -126,7 +124,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getStorageType() */ public T storageType(String storageType) { @@ -134,7 +132,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getUploadPercentage() */ public T uploadPercentage(int uploadPercentage) { @@ -142,7 +140,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getUrl() */ public T url(String url) { @@ -150,7 +148,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getZoneId() */ public T zoneId(String zoneId) { @@ -158,7 +156,7 @@ public class ISOExtraction { return self(); } - /** + /** * @see ISOExtraction#getZoneName() */ public T zoneName(String zoneName) { @@ -169,22 +167,22 @@ public class ISOExtraction { public ISOExtraction build() { return new ISOExtraction(id, accountId, created, extractId, extractMode, name, state, status, storageType, uploadPercentage, url, zoneId, zoneName); } - + public T fromISOExtraction(ISOExtraction in) { return this - .id(in.getId()) - .accountId(in.getAccountId()) - .created(in.getCreated()) - .extractId(in.getExtractId()) - .extractMode(in.getExtractMode()) - .name(in.getName()) - .state(in.getState()) - .status(in.getStatus()) - .storageType(in.getStorageType()) - .uploadPercentage(in.getUploadPercentage()) - .url(in.getUrl()) - .zoneId(in.getZoneId()) - .zoneName(in.getZoneName()); + .id(in.getId()) + .accountId(in.getAccountId()) + .created(in.getCreated()) + .extractId(in.getExtractId()) + .extractMode(in.getExtractMode()) + .name(in.getName()) + .state(in.getState()) + .status(in.getStatus()) + .storageType(in.getStorageType()) + .uploadPercentage(in.getUploadPercentage()) + .url(in.getUrl()) + .zoneId(in.getZoneId()) + .zoneName(in.getZoneName()); } } @@ -196,7 +194,6 @@ public class ISOExtraction { } private final String id; - @Named("accountid") private final String accountId; private final Date created; private final String extractId; @@ -204,18 +201,14 @@ public class ISOExtraction { private final String name; private final String state; private final String status; - @Named("storagetype") private final String storageType; - @Named("uploadpercentage") private final int uploadPercentage; private final String url; - @Named("zoneid") private final String zoneId; - @Named("zonename") private final String zoneName; @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, @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; ISOExtraction that = ISOExtraction.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.accountId, that.accountId) - && Objects.equal(this.created, that.created) - && Objects.equal(this.extractId, that.extractId) - && Objects.equal(this.extractMode, that.extractMode) - && Objects.equal(this.name, that.name) - && Objects.equal(this.state, that.state) - && Objects.equal(this.status, that.status) - && Objects.equal(this.storageType, that.storageType) - && Objects.equal(this.uploadPercentage, that.uploadPercentage) - && Objects.equal(this.url, that.url) - && Objects.equal(this.zoneId, that.zoneId) - && Objects.equal(this.zoneName, that.zoneName); + && Objects.equal(this.accountId, that.accountId) + && Objects.equal(this.created, that.created) + && Objects.equal(this.extractId, that.extractId) + && Objects.equal(this.extractMode, that.extractMode) + && Objects.equal(this.name, that.name) + && Objects.equal(this.state, that.state) + && Objects.equal(this.status, that.status) + && Objects.equal(this.storageType, that.storageType) + && Objects.equal(this.uploadPercentage, that.uploadPercentage) + && Objects.equal(this.url, that.url) + && Objects.equal(this.zoneId, that.zoneId) + && Objects.equal(this.zoneName, that.zoneName); } - + protected ToStringHelper string() { 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); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java index 03dbda69d3..afeffc45d1 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -33,28 +31,28 @@ import com.google.common.collect.ImmutableSet; /** * Class ISOPermissions - * + * * @author Richard Downer -*/ + */ public class ISOPermissions { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromISOPermissions(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; protected Set accounts = ImmutableSet.of(); protected String domainId; protected boolean isPublic; - - /** + + /** * @see ISOPermissions#getId() */ public T id(String id) { @@ -62,11 +60,11 @@ public class ISOPermissions { return self(); } - /** + /** * @see ISOPermissions#getAccounts() */ public T accounts(Set accounts) { - this.accounts = ImmutableSet.copyOf(checkNotNull(accounts, "accounts")); + this.accounts = ImmutableSet.copyOf(checkNotNull(accounts, "accounts")); return self(); } @@ -74,7 +72,7 @@ public class ISOPermissions { return accounts(ImmutableSet.copyOf(in)); } - /** + /** * @see ISOPermissions#getDomainId() */ public T domainId(String domainId) { @@ -82,7 +80,7 @@ public class ISOPermissions { return self(); } - /** + /** * @see ISOPermissions#isPublic() */ public T isPublic(boolean isPublic) { @@ -93,13 +91,13 @@ public class ISOPermissions { public ISOPermissions build() { return new ISOPermissions(id, accounts, domainId, isPublic); } - + public T fromISOPermissions(ISOPermissions in) { return this - .id(in.getId()) - .accounts(in.getAccounts()) - .domainId(in.getDomainId()) - .isPublic(in.isPublic()); + .id(in.getId()) + .accounts(in.getAccounts()) + .domainId(in.getDomainId()) + .isPublic(in.isPublic()); } } @@ -111,19 +109,16 @@ public class ISOPermissions { } private final String id; - @Named("account") private final Set accounts; - @Named("domainid") private final String domainId; - @Named("ispublic") private final boolean isPublic; @ConstructorProperties({ - "id", "account", "domainid", "ispublic" + "id", "account", "domainid", "ispublic" }) - protected ISOPermissions(String id, @Nullable Set accounts, @Nullable String domainId, boolean isPublic) { + protected ISOPermissions(String id, @Nullable Set accounts, @Nullable String domainId, boolean isPublic) { this.id = checkNotNull(id, "id"); - this.accounts = accounts == null ? ImmutableSet.of() : ImmutableSet.copyOf(accounts); + this.accounts = accounts == null ? ImmutableSet.of() : ImmutableSet.copyOf(accounts); this.domainId = domainId; this.isPublic = isPublic; } @@ -168,16 +163,16 @@ public class ISOPermissions { if (obj == null || getClass() != obj.getClass()) return false; ISOPermissions that = ISOPermissions.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.accounts, that.accounts) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.isPublic, that.isPublic); + && Objects.equal(this.accounts, that.accounts) + && Objects.equal(this.domainId, that.domainId) + && Objects.equal(this.isPublic, that.isPublic); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .add("id", id).add("accounts", accounts).add("domainId", domainId).add("isPublic", isPublic); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java index e400ca39a2..8b76f6db7b 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java @@ -22,28 +22,25 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; /** - * * @author Adrian Cole -*/ + */ public class IngressRule implements Comparable { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromIngressRule(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String account; @@ -55,8 +52,8 @@ public class IngressRule implements Comparable { protected String id; protected String securityGroupName; protected int startPort; - - /** + + /** * @see IngressRule#getAccount() */ public T account(String account) { @@ -64,7 +61,7 @@ public class IngressRule implements Comparable { return self(); } - /** + /** * @see IngressRule#getCIDR() */ public T CIDR(String CIDR) { @@ -72,7 +69,7 @@ public class IngressRule implements Comparable { return self(); } - /** + /** * @see IngressRule#getEndPort() */ public T endPort(int endPort) { @@ -80,7 +77,7 @@ public class IngressRule implements Comparable { return self(); } - /** + /** * @see IngressRule#getICMPCode() */ public T ICMPCode(int ICMPCode) { @@ -88,7 +85,7 @@ public class IngressRule implements Comparable { return self(); } - /** + /** * @see IngressRule#getICMPType() */ public T ICMPType(int ICMPType) { @@ -96,7 +93,7 @@ public class IngressRule implements Comparable { return self(); } - /** + /** * @see IngressRule#getProtocol() */ public T protocol(String protocol) { @@ -104,7 +101,7 @@ public class IngressRule implements Comparable { return self(); } - /** + /** * @see IngressRule#getId() */ public T id(String id) { @@ -112,7 +109,7 @@ public class IngressRule implements Comparable { return self(); } - /** + /** * @see IngressRule#getSecurityGroupName() */ public T securityGroupName(String securityGroupName) { @@ -120,7 +117,7 @@ public class IngressRule implements Comparable { return self(); } - /** + /** * @see IngressRule#getStartPort() */ public T startPort(int startPort) { @@ -131,18 +128,18 @@ public class IngressRule implements Comparable { public IngressRule build() { return new IngressRule(account, CIDR, endPort, ICMPCode, ICMPType, protocol, id, securityGroupName, startPort); } - + public T fromIngressRule(IngressRule in) { return this - .account(in.getAccount()) - .CIDR(in.getCIDR()) - .endPort(in.getEndPort()) - .ICMPCode(in.getICMPCode()) - .ICMPType(in.getICMPType()) - .protocol(in.getProtocol()) - .id(in.getId()) - .securityGroupName(in.getSecurityGroupName()) - .startPort(in.getStartPort()); + .account(in.getAccount()) + .CIDR(in.getCIDR()) + .endPort(in.getEndPort()) + .ICMPCode(in.getICMPCode()) + .ICMPType(in.getICMPType()) + .protocol(in.getProtocol()) + .id(in.getId()) + .securityGroupName(in.getSecurityGroupName()) + .startPort(in.getStartPort()); } } @@ -154,24 +151,17 @@ public class IngressRule implements Comparable { } private final String account; - @Named("cidr") private final String CIDR; - @Named("endport") private final int endPort; - @Named("icmpcode") private final int ICMPCode; - @Named("icmptype") private final int ICMPType; private final String protocol; - @Named("ruleid") private final String id; - @Named("securitygroupname") private final String securityGroupName; - @Named("startport") private final int startPort; @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, @Nullable String protocol, String id, @Nullable String securityGroupName, int startPort) { @@ -264,22 +254,22 @@ public class IngressRule implements Comparable { if (obj == null || getClass() != obj.getClass()) return false; IngressRule that = IngressRule.class.cast(obj); return Objects.equal(this.account, that.account) - && Objects.equal(this.CIDR, that.CIDR) - && Objects.equal(this.endPort, that.endPort) - && Objects.equal(this.ICMPCode, that.ICMPCode) - && Objects.equal(this.ICMPType, that.ICMPType) - && Objects.equal(this.protocol, that.protocol) - && Objects.equal(this.id, that.id) - && Objects.equal(this.securityGroupName, that.securityGroupName) - && Objects.equal(this.startPort, that.startPort); + && Objects.equal(this.CIDR, that.CIDR) + && Objects.equal(this.endPort, that.endPort) + && Objects.equal(this.ICMPCode, that.ICMPCode) + && Objects.equal(this.ICMPType, that.ICMPType) + && Objects.equal(this.protocol, that.protocol) + && Objects.equal(this.id, that.id) + && Objects.equal(this.securityGroupName, that.securityGroupName) + && Objects.equal(this.startPort, that.startPort); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .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); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/JobResult.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/JobResult.java index 732e5e60b4..2099e5b34e 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/JobResult.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/JobResult.java @@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -29,29 +27,29 @@ import com.google.common.base.Objects.ToStringHelper; /** * The result of an operation. - * + *

* A handful of Cloudstack API calls return this structure when there is no domain model data to return - for example, * when deleting an object. - * + * * @author Richard Downer -*/ + */ public class JobResult { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromJobResult(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected boolean success; protected String displayText; - - /** + + /** * @see JobResult#isSuccess() */ public T success(boolean success) { @@ -59,7 +57,7 @@ public class JobResult { return self(); } - /** + /** * @see JobResult#getDisplayText() */ public T displayText(String displayText) { @@ -70,11 +68,11 @@ public class JobResult { public JobResult build() { return new JobResult(success, displayText); } - + public T fromJobResult(JobResult in) { return this - .success(in.isSuccess()) - .displayText(in.getDisplayText()); + .success(in.isSuccess()) + .displayText(in.getDisplayText()); } } @@ -86,11 +84,10 @@ public class JobResult { } private final boolean success; - @Named("displaytext") private final String displayText; @ConstructorProperties({ - "success", "displaytext" + "success", "displaytext" }) protected JobResult(boolean success, @Nullable String displayText) { this.success = success; @@ -117,13 +114,13 @@ public class JobResult { if (obj == null || getClass() != obj.getClass()) return false; JobResult that = JobResult.class.cast(obj); return Objects.equal(this.success, that.success) - && Objects.equal(this.displayText, that.displayText); + && Objects.equal(this.displayText, that.displayText); } - + protected ToStringHelper string() { return Objects.toStringHelper(this).add("success", success).add("displayText", displayText); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java index 3b1654d774..abec957dad 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.CaseFormat; @@ -34,58 +32,58 @@ import com.google.common.collect.ImmutableSet; /** * Class LoadBalancerRule - * + * * @author Adrian Cole -*/ + */ public class LoadBalancerRule { /** */ public static enum State { ADD, ACTIVE, UNRECOGNIZED; - + @Override 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) { - try { - return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; + try { + return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } } - } - + } public static enum Algorithm { SOURCE, ROUNDROBIN, LEASTCONN, UNRECOGNIZED; - + @Override public String toString() { - return name().toLowerCase(); + return name().toLowerCase(); } - + public static Algorithm fromValue(String algorithm) { - try { - return Algorithm.valueOf(checkNotNull(algorithm, "algorithm").toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; + try { + return Algorithm.valueOf(checkNotNull(algorithm, "algorithm").toUpperCase()); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } } - } - + } - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromLoadBalancerRule(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -102,8 +100,8 @@ public class LoadBalancerRule { protected LoadBalancerRule.State state; protected Set CIDRs = ImmutableSet.of(); protected String zoneId; - - /** + + /** * @see LoadBalancerRule#getId() */ public T id(String id) { @@ -111,7 +109,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getAccount() */ public T account(String account) { @@ -119,7 +117,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getAlgorithm() */ public T algorithm(LoadBalancerRule.Algorithm algorithm) { @@ -127,7 +125,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getDescription() */ public T description(String description) { @@ -135,7 +133,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getDomain() */ public T domain(String domain) { @@ -143,7 +141,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getDomainId() */ public T domainId(String domainId) { @@ -151,7 +149,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getName() */ public T name(String name) { @@ -159,7 +157,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getPrivatePort() */ public T privatePort(int privatePort) { @@ -167,7 +165,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getPublicIP() */ public T publicIP(String publicIP) { @@ -175,7 +173,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getPublicIPId() */ public T publicIPId(String publicIPId) { @@ -183,7 +181,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getPublicPort() */ public T publicPort(int publicPort) { @@ -191,7 +189,7 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getState() */ public T state(LoadBalancerRule.State state) { @@ -199,11 +197,11 @@ public class LoadBalancerRule { return self(); } - /** + /** * @see LoadBalancerRule#getCIDRs() */ public T CIDRs(Set CIDRs) { - this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); + this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); return self(); } @@ -211,7 +209,7 @@ public class LoadBalancerRule { return CIDRs(ImmutableSet.copyOf(in)); } - /** + /** * @see LoadBalancerRule#getZoneId() */ public T zoneId(String zoneId) { @@ -222,23 +220,23 @@ public class LoadBalancerRule { public LoadBalancerRule build() { return new LoadBalancerRule(id, account, algorithm, description, domain, domainId, name, privatePort, publicIP, publicIPId, publicPort, state, CIDRs, zoneId); } - + public T fromLoadBalancerRule(LoadBalancerRule in) { return this - .id(in.getId()) - .account(in.getAccount()) - .algorithm(in.getAlgorithm()) - .description(in.getDescription()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .name(in.getName()) - .privatePort(in.getPrivatePort()) - .publicIP(in.getPublicIP()) - .publicIPId(in.getPublicIPId()) - .publicPort(in.getPublicPort()) - .state(in.getState()) - .CIDRs(in.getCIDRs()) - .zoneId(in.getZoneId()); + .id(in.getId()) + .account(in.getAccount()) + .algorithm(in.getAlgorithm()) + .description(in.getDescription()) + .domain(in.getDomain()) + .domainId(in.getDomainId()) + .name(in.getName()) + .privatePort(in.getPrivatePort()) + .publicIP(in.getPublicIP()) + .publicIPId(in.getPublicIPId()) + .publicPort(in.getPublicPort()) + .state(in.getState()) + .CIDRs(in.getCIDRs()) + .zoneId(in.getZoneId()); } } @@ -254,29 +252,39 @@ public class LoadBalancerRule { private final LoadBalancerRule.Algorithm algorithm; private final String description; private final String domain; - @Named("domainid") private final String domainId; private final String name; - @Named("privateport") private final int privatePort; - @Named("publicip") private final String publicIP; - @Named("publicipid") private final String publicIPId; - @Named("publicport") private final int publicPort; private final LoadBalancerRule.State state; - @Named("cidrlist") private final Set CIDRs; private final String zoneId; + @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 splitStringOnCommas(String in) { + return in == null ? ImmutableSet.of() : ImmutableSet.copyOf(in.split(",")); + } + protected LoadBalancerRule(String id, @Nullable String account, @Nullable LoadBalancerRule.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 LoadBalancerRule.State state, @Nullable Set CIDRs, @Nullable String zoneId) { + @Nullable LoadBalancerRule.State state, @Nullable Iterable CIDRs, @Nullable String zoneId) { this.id = checkNotNull(id, "id"); this.account = account; this.algorithm = algorithm; @@ -289,7 +297,7 @@ public class LoadBalancerRule { this.publicIPId = publicIPId; this.publicPort = publicPort; this.state = state; - this.CIDRs = CIDRs == null ? ImmutableSet.of() : ImmutableSet.copyOf(CIDRs); + this.CIDRs = CIDRs == null ? ImmutableSet.of() : ImmutableSet.copyOf(CIDRs); this.zoneId = zoneId; } @@ -412,26 +420,26 @@ public class LoadBalancerRule { if (obj == null || getClass() != obj.getClass()) return false; LoadBalancerRule that = LoadBalancerRule.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.account, that.account) - && Objects.equal(this.algorithm, that.algorithm) - && Objects.equal(this.description, that.description) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.name, that.name) - && Objects.equal(this.privatePort, that.privatePort) - && Objects.equal(this.publicIP, that.publicIP) - && Objects.equal(this.publicIPId, that.publicIPId) - && Objects.equal(this.publicPort, that.publicPort) - && Objects.equal(this.state, that.state) - && Objects.equal(this.CIDRs, that.CIDRs) - && Objects.equal(this.zoneId, that.zoneId); + && Objects.equal(this.account, that.account) + && Objects.equal(this.algorithm, that.algorithm) + && Objects.equal(this.description, that.description) + && Objects.equal(this.domain, that.domain) + && Objects.equal(this.domainId, that.domainId) + && Objects.equal(this.name, that.name) + && Objects.equal(this.privatePort, that.privatePort) + && Objects.equal(this.publicIP, that.publicIP) + && Objects.equal(this.publicIPId, that.publicIPId) + && Objects.equal(this.publicPort, that.publicPort) + && Objects.equal(this.state, that.state) + && Objects.equal(this.CIDRs, that.CIDRs) + && Objects.equal(this.zoneId, that.zoneId); } - + protected ToStringHelper string() { 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); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoginResponse.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoginResponse.java index aac15b6746..6a5f0aa873 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoginResponse.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoginResponse.java @@ -20,8 +20,6 @@ package org.jclouds.cloudstack.domain; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -29,20 +27,20 @@ import com.google.common.base.Objects.ToStringHelper; /** * Representation of the login API call response - * + * * @author Andrei Savu -*/ + */ public class LoginResponse { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromLoginResponse(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String username; @@ -59,8 +57,8 @@ public class LoginResponse { protected String timezoneOffset; protected String sessionKey; protected String jSessionId; - - /** + + /** * @see LoginResponse#getUsername() */ public T username(String username) { @@ -68,7 +66,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getUserId() */ public T userId(String userId) { @@ -76,7 +74,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getPassword() */ public T password(String password) { @@ -84,7 +82,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getDomainId() */ public T domainId(String domainId) { @@ -92,7 +90,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getTimeout() */ public T timeout(long timeout) { @@ -100,7 +98,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#isRegistered() */ public T registered(boolean registered) { @@ -108,7 +106,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getAccountName() */ public T accountName(String accountName) { @@ -116,7 +114,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getFirstName() */ public T firstName(String firstName) { @@ -124,7 +122,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getLastName() */ public T lastName(String lastName) { @@ -132,7 +130,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getAccountType() */ public T accountType(Account.Type accountType) { @@ -140,7 +138,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getTimezone() */ public T timezone(String timezone) { @@ -148,7 +146,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getTimezoneOffset() */ public T timezoneOffset(String timezoneOffset) { @@ -156,7 +154,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getSessionKey() */ public T sessionKey(String sessionKey) { @@ -164,7 +162,7 @@ public class LoginResponse { return self(); } - /** + /** * @see LoginResponse#getJSessionId() */ public T jSessionId(String jSessionId) { @@ -175,23 +173,23 @@ public class LoginResponse { public LoginResponse build() { return new LoginResponse(username, userId, password, domainId, timeout, registered, accountName, firstName, lastName, accountType, timezone, timezoneOffset, sessionKey, jSessionId); } - + public T fromLoginResponse(LoginResponse in) { return this - .username(in.getUsername()) - .userId(in.getUserId()) - .password(in.getPassword()) - .domainId(in.getDomainId()) - .timeout(in.getTimeout()) - .registered(in.isRegistered()) - .accountName(in.getAccountName()) - .firstName(in.getFirstName()) - .lastName(in.getLastName()) - .accountType(in.getAccountType()) - .timezone(in.getTimezone()) - .timezoneOffset(in.getTimezoneOffset()) - .sessionKey(in.getSessionKey()) - .jSessionId(in.getJSessionId()); + .username(in.getUsername()) + .userId(in.getUserId()) + .password(in.getPassword()) + .domainId(in.getDomainId()) + .timeout(in.getTimeout()) + .registered(in.isRegistered()) + .accountName(in.getAccountName()) + .firstName(in.getFirstName()) + .lastName(in.getLastName()) + .accountType(in.getAccountType()) + .timezone(in.getTimezone()) + .timezoneOffset(in.getTimezoneOffset()) + .sessionKey(in.getSessionKey()) + .jSessionId(in.getJSessionId()); } } @@ -203,30 +201,22 @@ public class LoginResponse { } private final String username; - @Named("userid") private final String userId; private final String password; - @Named("domainid") private final String domainId; private final long timeout; private final boolean registered; - @Named("account") private final String accountName; - @Named("firstname") private final String firstName; - @Named("lastname") private final String lastName; - @Named("type") private final Account.Type accountType; private final String timezone; - @Named("timezoneoffset") private final String timezoneOffset; - @Named("sessionkey") private final String sessionKey; private final String jSessionId; @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) { this.username = username; @@ -324,26 +314,26 @@ public class LoginResponse { if (obj == null || getClass() != obj.getClass()) return false; LoginResponse that = LoginResponse.class.cast(obj); return Objects.equal(this.username, that.username) - && Objects.equal(this.userId, that.userId) - && Objects.equal(this.password, that.password) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.timeout, that.timeout) - && Objects.equal(this.registered, that.registered) - && Objects.equal(this.accountName, that.accountName) - && Objects.equal(this.firstName, that.firstName) - && Objects.equal(this.lastName, that.lastName) - && Objects.equal(this.accountType, that.accountType) - && Objects.equal(this.timezone, that.timezone) - && Objects.equal(this.timezoneOffset, that.timezoneOffset) - && Objects.equal(this.sessionKey, that.sessionKey) - && Objects.equal(this.jSessionId, that.jSessionId); + && Objects.equal(this.userId, that.userId) + && Objects.equal(this.password, that.password) + && Objects.equal(this.domainId, that.domainId) + && Objects.equal(this.timeout, that.timeout) + && Objects.equal(this.registered, that.registered) + && Objects.equal(this.accountName, that.accountName) + && Objects.equal(this.firstName, that.firstName) + && Objects.equal(this.lastName, that.lastName) + && Objects.equal(this.accountType, that.accountType) + && Objects.equal(this.timezone, that.timezone) + && Objects.equal(this.timezoneOffset, that.timezoneOffset) + && Objects.equal(this.sessionKey, that.sessionKey) + && Objects.equal(this.jSessionId, that.jSessionId); } - + protected ToStringHelper string() { 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); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NIC.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NIC.java index e9c9b8dbc8..836c91348e 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NIC.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NIC.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.net.URI; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -32,20 +30,20 @@ import com.google.common.base.Objects.ToStringHelper; /** * Class NIC - * + * * @author Adrian Cole -*/ + */ public class NIC { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromNIC(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -59,8 +57,8 @@ public class NIC { protected String networkId; protected TrafficType trafficType; protected GuestIPType guestIPType; - - /** + + /** * @see NIC#getId() */ public T id(String id) { @@ -68,7 +66,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#getBroadcastURI() */ public T broadcastURI(URI broadcastURI) { @@ -76,7 +74,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#getGateway() */ public T gateway(String gateway) { @@ -84,7 +82,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#getIPAddress() */ public T IPAddress(String IPAddress) { @@ -92,7 +90,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#isDefault() */ public T isDefault(boolean isDefault) { @@ -100,7 +98,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#getIsolationURI() */ public T isolationURI(URI isolationURI) { @@ -108,7 +106,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#getNetmask() */ public T netmask(String netmask) { @@ -116,7 +114,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#getMacAddress() */ public T macAddress(String macAddress) { @@ -124,7 +122,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#getNetworkId() */ public T networkId(String networkId) { @@ -132,7 +130,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#getTrafficType() */ public T trafficType(TrafficType trafficType) { @@ -140,7 +138,7 @@ public class NIC { return self(); } - /** + /** * @see NIC#getGuestIPType() */ public T guestIPType(GuestIPType guestIPType) { @@ -151,20 +149,20 @@ public class NIC { public NIC build() { return new NIC(id, broadcastURI, gateway, IPAddress, isDefault, isolationURI, netmask, macAddress, networkId, trafficType, guestIPType); } - + public T fromNIC(NIC in) { return this - .id(in.getId()) - .broadcastURI(in.getBroadcastURI()) - .gateway(in.getGateway()) - .IPAddress(in.getIPAddress()) - .isDefault(in.isDefault()) - .isolationURI(in.getIsolationURI()) - .netmask(in.getNetmask()) - .macAddress(in.getMacAddress()) - .networkId(in.getNetworkId()) - .trafficType(in.getTrafficType()) - .guestIPType(in.getGuestIPType()); + .id(in.getId()) + .broadcastURI(in.getBroadcastURI()) + .gateway(in.getGateway()) + .IPAddress(in.getIPAddress()) + .isDefault(in.isDefault()) + .isolationURI(in.getIsolationURI()) + .netmask(in.getNetmask()) + .macAddress(in.getMacAddress()) + .networkId(in.getNetworkId()) + .trafficType(in.getTrafficType()) + .guestIPType(in.getGuestIPType()); } } @@ -176,27 +174,19 @@ public class NIC { } private final String id; - @Named("broadcasturi") private final URI broadcastURI; private final String gateway; - @Named("ipaddress") private final String IPAddress; - @Named("isdefault") private final boolean isDefault; - @Named("isolationuri") private final URI isolationURI; private final String netmask; - @Named("macaddress") private final String macAddress; - @Named("networkid") private final String networkId; - @Named("traffictype") private final TrafficType trafficType; - @Named("type") private final GuestIPType guestIPType; @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, @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; NIC that = NIC.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.broadcastURI, that.broadcastURI) - && Objects.equal(this.gateway, that.gateway) - && Objects.equal(this.IPAddress, that.IPAddress) - && Objects.equal(this.isDefault, that.isDefault) - && Objects.equal(this.isolationURI, that.isolationURI) - && Objects.equal(this.netmask, that.netmask) - && Objects.equal(this.macAddress, that.macAddress) - && Objects.equal(this.networkId, that.networkId) - && Objects.equal(this.trafficType, that.trafficType) - && Objects.equal(this.guestIPType, that.guestIPType); + && Objects.equal(this.broadcastURI, that.broadcastURI) + && Objects.equal(this.gateway, that.gateway) + && Objects.equal(this.IPAddress, that.IPAddress) + && Objects.equal(this.isDefault, that.isDefault) + && Objects.equal(this.isolationURI, that.isolationURI) + && Objects.equal(this.netmask, that.netmask) + && Objects.equal(this.macAddress, that.macAddress) + && Objects.equal(this.networkId, that.networkId) + && Objects.equal(this.trafficType, that.trafficType) + && Objects.equal(this.guestIPType, that.guestIPType); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .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("networkId", networkId).add("trafficType", trafficType).add("guestIPType", guestIPType); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java index 5cc209fa3e..457edd049c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java @@ -25,8 +25,6 @@ import java.net.URI; import java.util.List; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -36,20 +34,20 @@ import com.google.common.collect.ImmutableSortedSet; /** * Class Network - * + * * @author Adrian Cole -*/ + */ public class Network { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromNetwork(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -83,8 +81,8 @@ public class Network { protected String tags; protected boolean securityGroupEnabled; protected Set services = ImmutableSortedSet.of(); - - /** + + /** * @see Network#getId() */ public T id(String id) { @@ -92,7 +90,7 @@ public class Network { return self(); } - /** + /** * @see Network#getAccount() */ public T account(String account) { @@ -100,7 +98,7 @@ public class Network { return self(); } - /** + /** * @see Network#getBroadcastDomainType() */ public T broadcastDomainType(String broadcastDomainType) { @@ -108,7 +106,7 @@ public class Network { return self(); } - /** + /** * @see Network#getBroadcastURI() */ public T broadcastURI(URI broadcastURI) { @@ -116,7 +114,7 @@ public class Network { return self(); } - /** + /** * @see Network#getDisplayText() */ public T displayText(String displayText) { @@ -132,7 +130,8 @@ public class Network { if (DNS.size() > 1) this.DNS2 = DNS.get(1); return self(); } - /** + + /** * @see Network#getDomain() */ public T domain(String domain) { @@ -140,7 +139,7 @@ public class Network { return self(); } - /** + /** * @see Network#getDomainId() */ public T domainId(String domainId) { @@ -148,7 +147,7 @@ public class Network { return self(); } - /** + /** * @see Network#getEndIP() */ public T endIP(String endIP) { @@ -156,7 +155,7 @@ public class Network { return self(); } - /** + /** * @see Network#getGateway() */ public T gateway(String gateway) { @@ -164,7 +163,7 @@ public class Network { return self(); } - /** + /** * @see Network#isDefault() */ public T isDefault(boolean isDefault) { @@ -172,7 +171,7 @@ public class Network { return self(); } - /** + /** * @see Network#isShared() */ public T isShared(boolean isShared) { @@ -180,7 +179,7 @@ public class Network { return self(); } - /** + /** * @see Network#isSystem() */ public T isSystem(boolean isSystem) { @@ -188,7 +187,7 @@ public class Network { return self(); } - /** + /** * @see Network#getNetmask() */ public T netmask(String netmask) { @@ -196,7 +195,7 @@ public class Network { return self(); } - /** + /** * @see Network#getNetworkDomain() */ public T networkDomain(String networkDomain) { @@ -204,7 +203,7 @@ public class Network { return self(); } - /** + /** * @see Network#getNetworkOfferingAvailability() */ public T networkOfferingAvailability(String networkOfferingAvailability) { @@ -212,7 +211,7 @@ public class Network { return self(); } - /** + /** * @see Network#getNetworkOfferingDisplayText() */ public T networkOfferingDisplayText(String networkOfferingDisplayText) { @@ -220,7 +219,7 @@ public class Network { return self(); } - /** + /** * @see Network#getNetworkOfferingId() */ public T networkOfferingId(String networkOfferingId) { @@ -228,7 +227,7 @@ public class Network { return self(); } - /** + /** * @see Network#getNetworkOfferingName() */ public T networkOfferingName(String networkOfferingName) { @@ -236,7 +235,7 @@ public class Network { return self(); } - /** + /** * @see Network#getRelated() */ public T related(String related) { @@ -244,7 +243,7 @@ public class Network { return self(); } - /** + /** * @see Network#getStartIP() */ public T startIP(String startIP) { @@ -252,7 +251,7 @@ public class Network { return self(); } - /** + /** * @see Network#getName() */ public T name(String name) { @@ -260,7 +259,7 @@ public class Network { return self(); } - /** + /** * @see Network#getState() */ public T state(String state) { @@ -268,7 +267,7 @@ public class Network { return self(); } - /** + /** * @see Network#getGuestIPType() */ public T guestIPType(GuestIPType guestIPType) { @@ -276,7 +275,7 @@ public class Network { return self(); } - /** + /** * @see Network#getVLAN() */ public T VLAN(String VLAN) { @@ -284,7 +283,7 @@ public class Network { return self(); } - /** + /** * @see Network#getTrafficType() */ public T trafficType(TrafficType trafficType) { @@ -292,7 +291,7 @@ public class Network { return self(); } - /** + /** * @see Network#getZoneId() */ public T zoneId(String zoneId) { @@ -300,7 +299,7 @@ public class Network { return self(); } - /** + /** * @see Network#getTags() */ public T tags(String tags) { @@ -308,7 +307,7 @@ public class Network { return self(); } - /** + /** * @see Network#isSecurityGroupEnabled() */ public T securityGroupEnabled(boolean securityGroupEnabled) { @@ -316,7 +315,7 @@ public class Network { return self(); } - /** + /** * @see Network#getServices() */ public T services(Set services) { @@ -327,39 +326,39 @@ public class Network { 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); } - + public T fromNetwork(Network in) { return this - .id(in.getId()) - .account(in.getAccount()) - .broadcastDomainType(in.getBroadcastDomainType()) - .broadcastURI(in.getBroadcastURI()) - .displayText(in.getDisplayText()) - .DNS(in.getDNS()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .endIP(in.getEndIP()) - .gateway(in.getGateway()) - .isDefault(in.isDefault()) - .isShared(in.isShared()) - .isSystem(in.isSystem()) - .netmask(in.getNetmask()) - .networkDomain(in.getNetworkDomain()) - .networkOfferingAvailability(in.getNetworkOfferingAvailability()) - .networkOfferingDisplayText(in.getNetworkOfferingDisplayText()) - .networkOfferingId(in.getNetworkOfferingId()) - .networkOfferingName(in.getNetworkOfferingName()) - .related(in.getRelated()) - .startIP(in.getStartIP()) - .name(in.getName()) - .state(in.getState()) - .guestIPType(in.getGuestIPType()) - .VLAN(in.getVLAN()) - .trafficType(in.getTrafficType()) - .zoneId(in.getZoneId()) - .tags(in.getTags()) - .securityGroupEnabled(in.isSecurityGroupEnabled()) - .services(in.getServices()); + .id(in.getId()) + .account(in.getAccount()) + .broadcastDomainType(in.getBroadcastDomainType()) + .broadcastURI(in.getBroadcastURI()) + .displayText(in.getDisplayText()) + .DNS(in.getDNS()) + .domain(in.getDomain()) + .domainId(in.getDomainId()) + .endIP(in.getEndIP()) + .gateway(in.getGateway()) + .isDefault(in.isDefault()) + .isShared(in.isShared()) + .isSystem(in.isSystem()) + .netmask(in.getNetmask()) + .networkDomain(in.getNetworkDomain()) + .networkOfferingAvailability(in.getNetworkOfferingAvailability()) + .networkOfferingDisplayText(in.getNetworkOfferingDisplayText()) + .networkOfferingId(in.getNetworkOfferingId()) + .networkOfferingName(in.getNetworkOfferingName()) + .related(in.getRelated()) + .startIP(in.getStartIP()) + .name(in.getName()) + .state(in.getState()) + .guestIPType(in.getGuestIPType()) + .VLAN(in.getVLAN()) + .trafficType(in.getTrafficType()) + .zoneId(in.getZoneId()) + .tags(in.getTags()) + .securityGroupEnabled(in.isSecurityGroupEnabled()) + .services(in.getServices()); } } @@ -372,60 +371,38 @@ public class Network { private final String id; private final String account; - @Named("broadcastdomaintype") private final String broadcastDomainType; - @Named("broadcasturi") private final URI broadcastURI; - @Named("displaytext") private final String displayText; - @Named("dns1") private final String DNS1; - @Named("dns2") private final String DNS2; private final String domain; - @Named("domainid") private final String domainId; - @Named("endip") private final String endIP; private final String gateway; - @Named("isdefault") private final boolean isDefault; - @Named("isshared") private final boolean isShared; - @Named("issystem") private final boolean isSystem; private final String netmask; - @Named("networkdomain") private final String networkDomain; - @Named("networkofferingavailability") private final String networkOfferingAvailability; - @Named("networkofferingdisplaytext") private final String networkOfferingDisplayText; - @Named("networkofferingid") private final String networkOfferingId; - @Named("networkofferingname") private final String networkOfferingName; private final String related; - @Named("startip") private final String startIP; private final String name; private final String state; - @Named("type") private final GuestIPType guestIPType; - @Named("vlan") private final String VLAN; - @Named("traffictype") private final TrafficType trafficType; - @Named("zoneid") private final String zoneId; private final String tags; - @Named("securitygroupenabled") private final boolean securityGroupEnabled; - @Named("service") private final Set services; @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, @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; Network that = Network.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.account, that.account) - && Objects.equal(this.broadcastDomainType, that.broadcastDomainType) - && Objects.equal(this.broadcastURI, that.broadcastURI) - && Objects.equal(this.displayText, that.displayText) - && Objects.equal(this.DNS1, that.DNS1) - && Objects.equal(this.DNS2, that.DNS2) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.endIP, that.endIP) - && Objects.equal(this.gateway, that.gateway) - && Objects.equal(this.isDefault, that.isDefault) - && Objects.equal(this.isShared, that.isShared) - && Objects.equal(this.isSystem, that.isSystem) - && Objects.equal(this.netmask, that.netmask) - && Objects.equal(this.networkDomain, that.networkDomain) - && Objects.equal(this.networkOfferingAvailability, that.networkOfferingAvailability) - && Objects.equal(this.networkOfferingDisplayText, that.networkOfferingDisplayText) - && Objects.equal(this.networkOfferingId, that.networkOfferingId) - && Objects.equal(this.networkOfferingName, that.networkOfferingName) - && Objects.equal(this.related, that.related) - && Objects.equal(this.startIP, that.startIP) - && Objects.equal(this.name, that.name) - && Objects.equal(this.state, that.state) - && Objects.equal(this.guestIPType, that.guestIPType) - && Objects.equal(this.VLAN, that.VLAN) - && Objects.equal(this.trafficType, that.trafficType) - && Objects.equal(this.zoneId, that.zoneId) - && Objects.equal(this.tags, that.tags) - && Objects.equal(this.securityGroupEnabled, that.securityGroupEnabled) - && Objects.equal(this.services, that.services); + && Objects.equal(this.account, that.account) + && Objects.equal(this.broadcastDomainType, that.broadcastDomainType) + && Objects.equal(this.broadcastURI, that.broadcastURI) + && Objects.equal(this.displayText, that.displayText) + && Objects.equal(this.DNS1, that.DNS1) + && Objects.equal(this.DNS2, that.DNS2) + && Objects.equal(this.domain, that.domain) + && Objects.equal(this.domainId, that.domainId) + && Objects.equal(this.endIP, that.endIP) + && Objects.equal(this.gateway, that.gateway) + && Objects.equal(this.isDefault, that.isDefault) + && Objects.equal(this.isShared, that.isShared) + && Objects.equal(this.isSystem, that.isSystem) + && Objects.equal(this.netmask, that.netmask) + && Objects.equal(this.networkDomain, that.networkDomain) + && Objects.equal(this.networkOfferingAvailability, that.networkOfferingAvailability) + && Objects.equal(this.networkOfferingDisplayText, that.networkOfferingDisplayText) + && Objects.equal(this.networkOfferingId, that.networkOfferingId) + && Objects.equal(this.networkOfferingName, that.networkOfferingName) + && Objects.equal(this.related, that.related) + && Objects.equal(this.startIP, that.startIP) + && Objects.equal(this.name, that.name) + && Objects.equal(this.state, that.state) + && Objects.equal(this.guestIPType, that.guestIPType) + && Objects.equal(this.VLAN, that.VLAN) + && Objects.equal(this.trafficType, that.trafficType) + && Objects.equal(this.zoneId, that.zoneId) + && Objects.equal(this.tags, that.tags) + && Objects.equal(this.securityGroupEnabled, that.securityGroupEnabled) + && Objects.equal(this.services, that.services); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .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("zoneId", zoneId).add("tags", tags).add("securityGroupEnabled", securityGroupEnabled).add("services", services); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOffering.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOffering.java index f71a4a5a18..876b5245d6 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOffering.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOffering.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -32,20 +30,20 @@ import com.google.common.base.Objects.ToStringHelper; /** * Class NetworkOffering - * + * * @author Adrian Cole -*/ + */ public class NetworkOffering implements Comparable { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromNetworkOffering(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -60,8 +58,8 @@ public class NetworkOffering implements Comparable { protected GuestIPType guestIPType; protected int networkRate; protected String tags; - - /** + + /** * @see NetworkOffering#getId() */ public T id(String id) { @@ -69,7 +67,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#getName() */ public T name(String name) { @@ -77,7 +75,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#getDisplayText() */ public T displayText(String displayText) { @@ -85,7 +83,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#getCreated() */ public T created(Date created) { @@ -93,7 +91,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#getAvailability() */ public T availability(NetworkOfferingAvailabilityType availability) { @@ -101,7 +99,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#getMaxConnections() */ public T maxConnections(Integer maxConnections) { @@ -109,7 +107,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#isDefault() */ public T isDefault(boolean isDefault) { @@ -117,7 +115,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#supportsVLAN() */ public T supportsVLAN(boolean supportsVLAN) { @@ -125,7 +123,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#getTrafficType() */ public T trafficType(TrafficType trafficType) { @@ -133,7 +131,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#getGuestIPType() */ public T guestIPType(GuestIPType guestIPType) { @@ -141,7 +139,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#getNetworkRate() */ public T networkRate(int networkRate) { @@ -149,7 +147,7 @@ public class NetworkOffering implements Comparable { return self(); } - /** + /** * @see NetworkOffering#getTags() */ public T tags(String tags) { @@ -160,21 +158,21 @@ public class NetworkOffering implements Comparable { public NetworkOffering build() { return new NetworkOffering(id, name, displayText, created, availability, maxConnections, isDefault, supportsVLAN, trafficType, guestIPType, networkRate, tags); } - + public T fromNetworkOffering(NetworkOffering in) { return this - .id(in.getId()) - .name(in.getName()) - .displayText(in.getDisplayText()) - .created(in.getCreated()) - .availability(in.getAvailability()) - .maxConnections(in.getMaxConnections()) - .isDefault(in.isDefault()) - .supportsVLAN(in.supportsVLAN()) - .trafficType(in.getTrafficType()) - .guestIPType(in.getGuestIPType()) - .networkRate(in.getNetworkRate()) - .tags(in.getTags()); + .id(in.getId()) + .name(in.getName()) + .displayText(in.getDisplayText()) + .created(in.getCreated()) + .availability(in.getAvailability()) + .maxConnections(in.getMaxConnections()) + .isDefault(in.isDefault()) + .supportsVLAN(in.supportsVLAN()) + .trafficType(in.getTrafficType()) + .guestIPType(in.getGuestIPType()) + .networkRate(in.getNetworkRate()) + .tags(in.getTags()); } } @@ -187,26 +185,19 @@ public class NetworkOffering implements Comparable { private final String id; private final String name; - @Named("displaytext") private final String displayText; private final Date created; private final NetworkOfferingAvailabilityType availability; - @Named("maxconnections") private final Integer maxConnections; - @Named("isdefault") private final boolean isDefault; - @Named("specifyvlan") private final boolean supportsVLAN; - @Named("traffictype") private final TrafficType trafficType; - @Named("guestiptype") private final GuestIPType guestIPType; - @Named("networkrate") private final int networkRate; private final String tags; @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) { this.id = checkNotNull(id, "id"); @@ -264,7 +255,7 @@ public class NetworkOffering implements Comparable { /** * @return the max number of concurrent connection the network offering - supports + * supports */ @Nullable public Integer getMaxConnections() { @@ -327,24 +318,24 @@ public class NetworkOffering implements Comparable { if (obj == null || getClass() != obj.getClass()) return false; NetworkOffering that = NetworkOffering.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.name, that.name) - && Objects.equal(this.displayText, that.displayText) - && Objects.equal(this.created, that.created) - && Objects.equal(this.availability, that.availability) - && Objects.equal(this.maxConnections, that.maxConnections) - && Objects.equal(this.isDefault, that.isDefault) - && Objects.equal(this.supportsVLAN, that.supportsVLAN) - && Objects.equal(this.trafficType, that.trafficType) - && Objects.equal(this.guestIPType, that.guestIPType) - && Objects.equal(this.networkRate, that.networkRate) - && Objects.equal(this.tags, that.tags); + && Objects.equal(this.name, that.name) + && Objects.equal(this.displayText, that.displayText) + && Objects.equal(this.created, that.created) + && Objects.equal(this.availability, that.availability) + && Objects.equal(this.maxConnections, that.maxConnections) + && Objects.equal(this.isDefault, that.isDefault) + && Objects.equal(this.supportsVLAN, that.supportsVLAN) + && Objects.equal(this.trafficType, that.trafficType) + && Objects.equal(this.guestIPType, that.guestIPType) + && Objects.equal(this.networkRate, that.networkRate) + && Objects.equal(this.tags, that.tags); } - + protected ToStringHelper string() { 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); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOfferingAvailabilityType.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOfferingAvailabilityType.java index 8de9036edc..dfcd671975 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOfferingAvailabilityType.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOfferingAvailabilityType.java @@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.CaseFormat; /** - * * @author Andrei Savu */ public enum NetworkOfferingAvailabilityType { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkService.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkService.java index 158e0ef336..a0d8738ad5 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkService.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkService.java @@ -24,8 +24,6 @@ import java.beans.ConstructorProperties; import java.util.Map; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -52,7 +50,7 @@ public class NetworkService implements Comparable { return new ConcreteBuilder().fromCapability(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String name; @@ -83,7 +81,7 @@ public class NetworkService implements Comparable { .name(in.getName()) .value(in.getValue()); } - + } private static class ConcreteBuilder extends Builder { @@ -142,7 +140,7 @@ public class NetworkService implements Comparable { return name.compareTo(o.getName()); } } - + public static Builder builder() { return new ConcreteBuilder(); } @@ -194,7 +192,6 @@ public class NetworkService implements Comparable { } private final String name; - @Named("capability") private final Set capabilities; @ConstructorProperties({ @@ -217,7 +214,7 @@ public class NetworkService implements Comparable { } return returnVal.build(); } - + @Override public int hashCode() { return Objects.hashCode(name, capabilities); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkType.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkType.java index ded2b0c5be..318613566c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkType.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkType.java @@ -25,7 +25,6 @@ import org.jclouds.cloudstack.features.TemplateClient; import com.google.common.base.CaseFormat; /** - * * @author Adrian Cole * @see TemplateClient#listZones */ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/OSType.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/OSType.java index 4ca638ab3a..51da1ea364 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/OSType.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/OSType.java @@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -44,7 +42,7 @@ public class OSType implements Comparable { return new ConcreteBuilder().fromOSType(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -95,7 +93,6 @@ public class OSType implements Comparable { } private final String id; - @Named("oscategoryid") private final String OSCategoryId; private final String description; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Pod.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Pod.java index 6dc5366a13..bf6e8d8478 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Pod.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Pod.java @@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -31,20 +29,20 @@ import com.google.common.base.Objects.ToStringHelper; /** * Represents a Pod in CloudStack. - * + * * @author Richard Downer -*/ + */ public class Pod implements Comparable { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromPod(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -56,8 +54,8 @@ public class Pod implements Comparable { protected String startIp; protected String endIp; protected AllocationState allocationState; - - /** + + /** * @see Pod#getId() */ public T id(String id) { @@ -65,7 +63,7 @@ public class Pod implements Comparable { return self(); } - /** + /** * @see Pod#getName() */ public T name(String name) { @@ -73,7 +71,7 @@ public class Pod implements Comparable { return self(); } - /** + /** * @see Pod#getZoneId() */ public T zoneId(String zoneId) { @@ -81,7 +79,7 @@ public class Pod implements Comparable { return self(); } - /** + /** * @see Pod#getZoneName() */ public T zoneName(String zoneName) { @@ -89,7 +87,7 @@ public class Pod implements Comparable { return self(); } - /** + /** * @see Pod#getGateway() */ public T gateway(String gateway) { @@ -97,7 +95,7 @@ public class Pod implements Comparable { return self(); } - /** + /** * @see Pod#getNetmask() */ public T netmask(String netmask) { @@ -105,7 +103,7 @@ public class Pod implements Comparable { return self(); } - /** + /** * @see Pod#getStartIp() */ public T startIp(String startIp) { @@ -113,7 +111,7 @@ public class Pod implements Comparable { return self(); } - /** + /** * @see Pod#getEndIp() */ public T endIp(String endIp) { @@ -121,7 +119,7 @@ public class Pod implements Comparable { return self(); } - /** + /** * @see Pod#getAllocationState() */ public T allocationState(AllocationState allocationState) { @@ -132,18 +130,18 @@ public class Pod implements Comparable { public Pod build() { return new Pod(id, name, zoneId, zoneName, gateway, netmask, startIp, endIp, allocationState); } - + public T fromPod(Pod in) { return this - .id(in.getId()) - .name(in.getName()) - .zoneId(in.getZoneId()) - .zoneName(in.getZoneName()) - .gateway(in.getGateway()) - .netmask(in.getNetmask()) - .startIp(in.getStartIp()) - .endIp(in.getEndIp()) - .allocationState(in.getAllocationState()); + .id(in.getId()) + .name(in.getName()) + .zoneId(in.getZoneId()) + .zoneName(in.getZoneName()) + .gateway(in.getGateway()) + .netmask(in.getNetmask()) + .startIp(in.getStartIp()) + .endIp(in.getEndIp()) + .allocationState(in.getAllocationState()); } } @@ -156,21 +154,16 @@ public class Pod implements Comparable { private final String id; private final String name; - @Named("zoneid") private final String zoneId; - @Named("zonename") private final String zoneName; private final String gateway; private final String netmask; - @Named("startip") private final String startIp; - @Named("endip") private final String endIp; - @Named("allocationstate") private final AllocationState allocationState; @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) { this.id = checkNotNull(id, "id"); @@ -266,21 +259,21 @@ public class Pod implements Comparable { if (obj == null || getClass() != obj.getClass()) return false; Pod that = Pod.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.name, that.name) - && Objects.equal(this.zoneId, that.zoneId) - && Objects.equal(this.zoneName, that.zoneName) - && Objects.equal(this.gateway, that.gateway) - && Objects.equal(this.netmask, that.netmask) - && Objects.equal(this.startIp, that.startIp) - && Objects.equal(this.endIp, that.endIp) - && Objects.equal(this.allocationState, that.allocationState); + && Objects.equal(this.name, that.name) + && Objects.equal(this.zoneId, that.zoneId) + && Objects.equal(this.zoneName, that.zoneName) + && Objects.equal(this.gateway, that.gateway) + && Objects.equal(this.netmask, that.netmask) + && Objects.equal(this.startIp, that.startIp) + && Objects.equal(this.endIp, that.endIp) + && Objects.equal(this.allocationState, that.allocationState); } - + protected ToStringHelper string() { 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); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java index 73f317a964..6aab67de7a 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.CaseFormat; @@ -34,9 +32,9 @@ import com.google.common.collect.ImmutableSet; /** * Class PortForwardingRule - * + * * @author Adrian Cole, Andrei Savu -*/ + */ public class PortForwardingRule implements Comparable { public static enum Protocol { @@ -61,11 +59,11 @@ public class PortForwardingRule implements Comparable { public static enum State { 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. 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 - // network elements, the rule will be deleted from database. + // network elements, the rule will be deleted from database. UNKNOWN; public static State fromValue(String value) { @@ -82,15 +80,15 @@ public class PortForwardingRule implements Comparable { } } - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromPortForwardingRule(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -106,8 +104,8 @@ public class PortForwardingRule implements Comparable { protected Set CIDRs = ImmutableSet.of(); protected int privateEndPort; protected int publicEndPort; - - /** + + /** * @see PortForwardingRule#getId() */ public T id(String id) { @@ -115,7 +113,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getIPAddress() */ public T IPAddress(String IPAddress) { @@ -123,7 +121,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getIPAddressId() */ public T IPAddressId(String IPAddressId) { @@ -131,7 +129,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getPrivatePort() */ public T privatePort(int privatePort) { @@ -139,7 +137,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getProtocol() */ public T protocol(Protocol protocol) { @@ -147,7 +145,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getPublicPort() */ public T publicPort(int publicPort) { @@ -155,7 +153,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getState() */ public T state(State state) { @@ -163,7 +161,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getVirtualMachineDisplayName() */ public T virtualMachineDisplayName(String virtualMachineDisplayName) { @@ -171,7 +169,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getVirtualMachineId() */ public T virtualMachineId(String virtualMachineId) { @@ -179,7 +177,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getVirtualMachineName() */ public T virtualMachineName(String virtualMachineName) { @@ -187,11 +185,11 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getCIDRs() */ public T CIDRs(Set CIDRs) { - this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); + this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); return self(); } @@ -199,7 +197,7 @@ public class PortForwardingRule implements Comparable { return CIDRs(ImmutableSet.copyOf(in)); } - /** + /** * @see PortForwardingRule#getPrivateEndPort() */ public T privateEndPort(int privateEndPort) { @@ -207,7 +205,7 @@ public class PortForwardingRule implements Comparable { return self(); } - /** + /** * @see PortForwardingRule#getPublicEndPort() */ public T publicEndPort(int publicEndPort) { @@ -219,22 +217,22 @@ public class PortForwardingRule implements Comparable { return new PortForwardingRule(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state, virtualMachineDisplayName, virtualMachineId, virtualMachineName, CIDRs, privateEndPort, publicEndPort); } - + public T fromPortForwardingRule(PortForwardingRule in) { return this - .id(in.getId()) - .IPAddress(in.getIPAddress()) - .IPAddressId(in.getIPAddressId()) - .privatePort(in.getPrivatePort()) - .protocol(in.getProtocol()) - .publicPort(in.getPublicPort()) - .state(in.getState()) - .virtualMachineDisplayName(in.getVirtualMachineDisplayName()) - .virtualMachineId(in.getVirtualMachineId()) - .virtualMachineName(in.getVirtualMachineName()) - .CIDRs(in.getCIDRs()) - .privateEndPort(in.getPrivateEndPort()) - .publicEndPort(in.getPublicEndPort()); + .id(in.getId()) + .IPAddress(in.getIPAddress()) + .IPAddressId(in.getIPAddressId()) + .privatePort(in.getPrivatePort()) + .protocol(in.getProtocol()) + .publicPort(in.getPublicPort()) + .state(in.getState()) + .virtualMachineDisplayName(in.getVirtualMachineDisplayName()) + .virtualMachineId(in.getVirtualMachineId()) + .virtualMachineName(in.getVirtualMachineName()) + .CIDRs(in.getCIDRs()) + .privateEndPort(in.getPrivateEndPort()) + .publicEndPort(in.getPublicEndPort()); } } @@ -246,33 +244,36 @@ public class PortForwardingRule implements Comparable { } private final String id; - @Named("ipaddress") private final String IPAddress; - @Named("ipaddressid") private final String IPAddressId; - @Named("privateport") private final int privatePort; private final PortForwardingRule.Protocol protocol; - @Named("publicport") private final int publicPort; private final PortForwardingRule.State state; - @Named("virtualmachinedisplayname") private final String virtualMachineDisplayName; - @Named("virtualmachineid") private final String virtualMachineId; - @Named("virtualmachinename") private final String virtualMachineName; - @Named("cidrlist") private final Set CIDRs; - @Named("privateendport") private final int privateEndPort; - @Named("publicendport") private final int publicEndPort; @ConstructorProperties({ - "id", "ipaddress", "ipaddressid", "privateport", "protocol", "publicport", "state", "virtualmachinedisplayname", + "id", "ipaddress", "ipaddressid", "privateport", "protocol", "publicport", "state", "virtualmachinedisplayname", "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 splitStringOnCommas(String in) { + return in == null ? ImmutableSet.of() : ImmutableSet.copyOf(in.split(",")); + } + protected 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, @@ -287,7 +288,7 @@ public class PortForwardingRule implements Comparable { this.virtualMachineDisplayName = virtualMachineDisplayName; this.virtualMachineId = virtualMachineId; this.virtualMachineName = virtualMachineName; - this.CIDRs = CIDRs == null ? ImmutableSet.of() : ImmutableSet.copyOf(CIDRs); + this.CIDRs = CIDRs == null ? ImmutableSet.of() : ImmutableSet.copyOf(CIDRs); this.privateEndPort = privateEndPort; this.publicEndPort = publicEndPort; } @@ -401,20 +402,20 @@ public class PortForwardingRule implements Comparable { if (obj == null || getClass() != obj.getClass()) return false; PortForwardingRule that = PortForwardingRule.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.IPAddress, that.IPAddress) - && Objects.equal(this.IPAddressId, that.IPAddressId) - && Objects.equal(this.privatePort, that.privatePort) - && Objects.equal(this.protocol, that.protocol) - && Objects.equal(this.publicPort, that.publicPort) - && Objects.equal(this.state, that.state) - && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) - && Objects.equal(this.virtualMachineId, that.virtualMachineId) - && Objects.equal(this.virtualMachineName, that.virtualMachineName) - && Objects.equal(this.CIDRs, that.CIDRs) - && Objects.equal(this.privateEndPort, that.privateEndPort) - && Objects.equal(this.publicEndPort, that.publicEndPort); + && Objects.equal(this.IPAddress, that.IPAddress) + && Objects.equal(this.IPAddressId, that.IPAddressId) + && Objects.equal(this.privatePort, that.privatePort) + && Objects.equal(this.protocol, that.protocol) + && Objects.equal(this.publicPort, that.publicPort) + && Objects.equal(this.state, that.state) + && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) + && Objects.equal(this.virtualMachineId, that.virtualMachineId) + && Objects.equal(this.virtualMachineName, that.virtualMachineName) + && Objects.equal(this.CIDRs, that.CIDRs) + && Objects.equal(this.privateEndPort, that.privateEndPort) + && Objects.equal(this.publicEndPort, that.publicEndPort); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .add("id", id).add("IPAddress", IPAddress).add("IPAddressId", IPAddressId).add("privatePort", privatePort) @@ -422,7 +423,7 @@ public class PortForwardingRule implements Comparable { .add("virtualMachineId", virtualMachineId).add("virtualMachineName", virtualMachineName).add("CIDRs", CIDRs) .add("privateEndPort", privateEndPort).add("publicEndPort", publicEndPort); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java index 12c759a60c..7601b43d29 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.CaseFormat; @@ -33,40 +31,40 @@ import com.google.common.base.Objects.ToStringHelper; /** * Class PublicIPAddress - * + * * @author Adrian Cole -*/ + */ public class PublicIPAddress { /** */ public static enum State { ALLOCATING, ALLOCATED, RELEASING, UNRECOGNIZED; - + @Override 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) { - try { - return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; + try { + return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } } - } - + } - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromPublicIPAddress(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -90,8 +88,8 @@ public class PublicIPAddress { protected String zoneName; protected String jobId; protected Integer jobStatus; - - /** + + /** * @see PublicIPAddress#getId() */ public T id(String id) { @@ -99,7 +97,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getAccount() */ public T account(String account) { @@ -107,7 +105,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getAllocated() */ public T allocated(Date allocated) { @@ -115,7 +113,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getAssociatedNetworkId() */ public T associatedNetworkId(String associatedNetworkId) { @@ -123,7 +121,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getDomain() */ public T domain(String domain) { @@ -131,7 +129,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getDomainId() */ public T domainId(String domainId) { @@ -139,7 +137,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#isUsesVirtualNetwork() */ public T usesVirtualNetwork(boolean usesVirtualNetwork) { @@ -147,7 +145,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getIPAddress() */ public T IPAddress(String IPAddress) { @@ -155,7 +153,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#isSourceNAT() */ public T isSourceNAT(boolean isSourceNAT) { @@ -163,7 +161,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#isStaticNAT() */ public T isStaticNAT(boolean isStaticNAT) { @@ -171,7 +169,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getNetworkId() */ public T networkId(String networkId) { @@ -179,7 +177,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getState() */ public T state(PublicIPAddress.State state) { @@ -187,7 +185,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getVirtualMachineDisplayName() */ public T virtualMachineDisplayName(String virtualMachineDisplayName) { @@ -195,7 +193,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getVirtualMachineId() */ public T virtualMachineId(String virtualMachineId) { @@ -203,7 +201,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getVirtualMachineName() */ public T virtualMachineName(String virtualMachineName) { @@ -211,7 +209,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getVLANId() */ public T VLANId(String VLANId) { @@ -219,7 +217,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getVLANName() */ public T VLANName(String VLANName) { @@ -227,7 +225,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getZoneId() */ public T zoneId(String zoneId) { @@ -235,7 +233,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getZoneName() */ public T zoneName(String zoneName) { @@ -243,7 +241,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getJobId() */ public T jobId(String jobId) { @@ -251,7 +249,7 @@ public class PublicIPAddress { return self(); } - /** + /** * @see PublicIPAddress#getJobStatus() */ public T jobStatus(Integer jobStatus) { @@ -262,30 +260,30 @@ public class PublicIPAddress { 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); } - + public T fromPublicIPAddress(PublicIPAddress in) { return this - .id(in.getId()) - .account(in.getAccount()) - .allocated(in.getAllocated()) - .associatedNetworkId(in.getAssociatedNetworkId()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .usesVirtualNetwork(in.isUsesVirtualNetwork()) - .IPAddress(in.getIPAddress()) - .isSourceNAT(in.isSourceNAT()) - .isStaticNAT(in.isStaticNAT()) - .networkId(in.getNetworkId()) - .state(in.getState()) - .virtualMachineDisplayName(in.getVirtualMachineDisplayName()) - .virtualMachineId(in.getVirtualMachineId()) - .virtualMachineName(in.getVirtualMachineName()) - .VLANId(in.getVLANId()) - .VLANName(in.getVLANName()) - .zoneId(in.getZoneId()) - .zoneName(in.getZoneName()) - .jobId(in.getJobId()) - .jobStatus(in.getJobStatus()); + .id(in.getId()) + .account(in.getAccount()) + .allocated(in.getAllocated()) + .associatedNetworkId(in.getAssociatedNetworkId()) + .domain(in.getDomain()) + .domainId(in.getDomainId()) + .usesVirtualNetwork(in.isUsesVirtualNetwork()) + .IPAddress(in.getIPAddress()) + .isSourceNAT(in.isSourceNAT()) + .isStaticNAT(in.isStaticNAT()) + .networkId(in.getNetworkId()) + .state(in.getState()) + .virtualMachineDisplayName(in.getVirtualMachineDisplayName()) + .virtualMachineId(in.getVirtualMachineId()) + .virtualMachineName(in.getVirtualMachineName()) + .VLANId(in.getVLANId()) + .VLANName(in.getVLANName()) + .zoneId(in.getZoneId()) + .zoneName(in.getZoneName()) + .jobId(in.getJobId()) + .jobStatus(in.getJobStatus()); } } @@ -299,43 +297,27 @@ public class PublicIPAddress { private final String id; private final String account; private final Date allocated; - @Named("associatednetworkid") private final String associatedNetworkId; private final String domain; - @Named("domainid") private final String domainId; - @Named("forvirtualnetwork") private final boolean usesVirtualNetwork; - @Named("ipaddress") private final String IPAddress; - @Named("issourcenat") private final boolean isSourceNAT; - @Named("isstaticnat") private final boolean isStaticNAT; - @Named("networkid") private final String networkId; private final PublicIPAddress.State state; - @Named("virtualmachinedisplayname") private final String virtualMachineDisplayName; - @Named("virtualmachineid") private final String virtualMachineId; - @Named("virtualmachinename") private final String virtualMachineName; - @Named("VLANid") private final String VLANId; - @Named("VLANname") private final String VLANName; - @Named("zoneid") private final String zoneId; - @Named("zonename") private final String zoneName; - @Named("jobid") private final String jobId; - @Named("jobstatus") private final Integer jobStatus; @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", "VLANname", "zoneid", "zonename", "jobid", "jobstatus" }) @@ -454,7 +436,7 @@ public class PublicIPAddress { /** * @return State of the ip address. Can be: Allocating, Allocated and - Releasing + * Releasing */ @Nullable public PublicIPAddress.State getState() { @@ -463,7 +445,7 @@ public class PublicIPAddress { /** * @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 public String getVirtualMachineDisplayName() { @@ -472,7 +454,7 @@ public class PublicIPAddress { /** * @return virtual machine id the ip address is assigned to (not null only - for static nat Ip) + * for static nat Ip) */ @Nullable public String getVirtualMachineId() { @@ -481,7 +463,7 @@ public class PublicIPAddress { /** * @return virtual machine name the ip address is assigned to (not null only - for static nat Ip) + * for static nat Ip) */ @Nullable public String getVirtualMachineName() { @@ -522,8 +504,8 @@ public class PublicIPAddress { /** * @return shows the current pending asynchronous job ID. This tag is not - returned if no current pending jobs are acting on the virtual - machine + * returned if no current pending jobs are acting on the virtual + * machine */ @Nullable public String getJobId() { @@ -549,28 +531,28 @@ public class PublicIPAddress { if (obj == null || getClass() != obj.getClass()) return false; PublicIPAddress that = PublicIPAddress.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.account, that.account) - && Objects.equal(this.allocated, that.allocated) - && Objects.equal(this.associatedNetworkId, that.associatedNetworkId) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.usesVirtualNetwork, that.usesVirtualNetwork) - && Objects.equal(this.IPAddress, that.IPAddress) - && Objects.equal(this.isSourceNAT, that.isSourceNAT) - && Objects.equal(this.isStaticNAT, that.isStaticNAT) - && Objects.equal(this.networkId, that.networkId) - && Objects.equal(this.state, that.state) - && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) - && Objects.equal(this.virtualMachineId, that.virtualMachineId) - && Objects.equal(this.virtualMachineName, that.virtualMachineName) - && Objects.equal(this.VLANId, that.VLANId) - && Objects.equal(this.VLANName, that.VLANName) - && Objects.equal(this.zoneId, that.zoneId) - && Objects.equal(this.zoneName, that.zoneName) - && Objects.equal(this.jobId, that.jobId) - && Objects.equal(this.jobStatus, that.jobStatus); + && Objects.equal(this.account, that.account) + && Objects.equal(this.allocated, that.allocated) + && Objects.equal(this.associatedNetworkId, that.associatedNetworkId) + && Objects.equal(this.domain, that.domain) + && Objects.equal(this.domainId, that.domainId) + && Objects.equal(this.usesVirtualNetwork, that.usesVirtualNetwork) + && Objects.equal(this.IPAddress, that.IPAddress) + && Objects.equal(this.isSourceNAT, that.isSourceNAT) + && Objects.equal(this.isStaticNAT, that.isStaticNAT) + && Objects.equal(this.networkId, that.networkId) + && Objects.equal(this.state, that.state) + && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) + && Objects.equal(this.virtualMachineId, that.virtualMachineId) + && Objects.equal(this.virtualMachineName, that.virtualMachineName) + && Objects.equal(this.VLANId, that.VLANId) + && Objects.equal(this.VLANName, that.VLANName) + && Objects.equal(this.zoneId, that.zoneId) + && Objects.equal(this.zoneName, that.zoneName) + && Objects.equal(this.jobId, that.jobId) + && Objects.equal(this.jobStatus, that.jobStatus); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .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("zoneName", zoneName).add("jobId", jobId).add("jobStatus", jobStatus); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java index 300dcc4231..6066556f3b 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Map; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Function; @@ -35,9 +33,9 @@ import com.google.common.collect.Maps; /** * Class ResourceLimit - * + * * @author Vijay Kiran -*/ + */ public class ResourceLimit { /** @@ -83,7 +81,7 @@ public class ResourceLimit { this.code = code; } - public int getCode(){ + public int getCode() { return code; } @@ -98,15 +96,15 @@ public class ResourceLimit { } } - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromResourceLimit(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String account; @@ -114,8 +112,8 @@ public class ResourceLimit { protected String domainId; protected int max; protected ResourceType resourceType; - - /** + + /** * @see ResourceLimit#getAccount() */ public T account(String account) { @@ -123,7 +121,7 @@ public class ResourceLimit { return self(); } - /** + /** * @see ResourceLimit#getDomain() */ public T domain(String domain) { @@ -131,7 +129,7 @@ public class ResourceLimit { return self(); } - /** + /** * @see ResourceLimit#getDomainId() */ public T domainId(String domainId) { @@ -139,7 +137,7 @@ public class ResourceLimit { return self(); } - /** + /** * @see ResourceLimit#getMax() */ public T max(int max) { @@ -147,7 +145,7 @@ public class ResourceLimit { return self(); } - /** + /** * @see ResourceLimit#getResourceType() */ public T resourceType(ResourceType resourceType) { @@ -158,14 +156,14 @@ public class ResourceLimit { public ResourceLimit build() { return new ResourceLimit(account, domain, domainId, max, resourceType); } - + public T fromResourceLimit(ResourceLimit in) { return this - .account(in.getAccount()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .max(in.getMax()) - .resourceType(in.getResourceType()); + .account(in.getAccount()) + .domain(in.getDomain()) + .domainId(in.getDomainId()) + .max(in.getMax()) + .resourceType(in.getResourceType()); } } @@ -178,14 +176,12 @@ public class ResourceLimit { private final String account; private final String domain; - @Named("domainid") private final String domainId; private final int max; - @Named("resourcetype") private final ResourceLimit.ResourceType resourceType; @ConstructorProperties({ - "account", "domain", "domainid", "max", "resourcetype" + "account", "domain", "domainid", "max", "resourcetype" }) protected ResourceLimit(@Nullable String account, @Nullable String domain, @Nullable String domainId, int max, @Nullable ResourceType resourceType) { @@ -231,17 +227,17 @@ public class ResourceLimit { if (obj == null || getClass() != obj.getClass()) return false; ResourceLimit that = ResourceLimit.class.cast(obj); return Objects.equal(this.account, that.account) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.max, that.max) - && Objects.equal(this.resourceType, that.resourceType); + && Objects.equal(this.domain, that.domain) + && Objects.equal(this.domainId, that.domainId) + && Objects.equal(this.max, that.max) + && Objects.equal(this.resourceType, that.resourceType); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .add("account", account).add("domain", domain).add("domainId", domainId).add("max", max).add("resourceType", resourceType); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java index 2076a016e0..210752ce0f 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -34,20 +32,20 @@ import com.google.common.collect.ImmutableSortedSet; /** * Class SecurityGroup - * + * * @author Adrian Cole -*/ + */ public class SecurityGroup implements Comparable { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromSecurityGroup(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -59,8 +57,8 @@ public class SecurityGroup implements Comparable { protected String jobId; protected Integer jobStatus; protected Set ingressRules; - - /** + + /** * @see SecurityGroup#getId() */ public T id(String id) { @@ -68,7 +66,7 @@ public class SecurityGroup implements Comparable { return self(); } - /** + /** * @see SecurityGroup#getAccount() */ public T account(String account) { @@ -76,7 +74,7 @@ public class SecurityGroup implements Comparable { return self(); } - /** + /** * @see SecurityGroup#getName() */ public T name(String name) { @@ -84,7 +82,7 @@ public class SecurityGroup implements Comparable { return self(); } - /** + /** * @see SecurityGroup#getDescription() */ public T description(String description) { @@ -92,7 +90,7 @@ public class SecurityGroup implements Comparable { return self(); } - /** + /** * @see SecurityGroup#getDomain() */ public T domain(String domain) { @@ -100,7 +98,7 @@ public class SecurityGroup implements Comparable { return self(); } - /** + /** * @see SecurityGroup#getDomainId() */ public T domainId(String domainId) { @@ -108,7 +106,7 @@ public class SecurityGroup implements Comparable { return self(); } - /** + /** * @see SecurityGroup#getJobId() */ public T jobId(String jobId) { @@ -116,7 +114,7 @@ public class SecurityGroup implements Comparable { return self(); } - /** + /** * @see SecurityGroup#getJobStatus() */ public T jobStatus(Integer jobStatus) { @@ -124,7 +122,7 @@ public class SecurityGroup implements Comparable { return self(); } - /** + /** * @see SecurityGroup#getIngressRules() */ public T ingressRules(Set ingressRules) { @@ -135,18 +133,18 @@ public class SecurityGroup implements Comparable { public SecurityGroup build() { return new SecurityGroup(id, account, name, description, domain, domainId, jobId, jobStatus, ingressRules); } - + public T fromSecurityGroup(SecurityGroup in) { return this - .id(in.getId()) - .account(in.getAccount()) - .name(in.getName()) - .description(in.getDescription()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .jobId(in.getJobId()) - .jobStatus(in.getJobStatus()) - .ingressRules(in.getIngressRules()); + .id(in.getId()) + .account(in.getAccount()) + .name(in.getName()) + .description(in.getDescription()) + .domain(in.getDomain()) + .domainId(in.getDomainId()) + .jobId(in.getJobId()) + .jobStatus(in.getJobStatus()) + .ingressRules(in.getIngressRules()); } } @@ -162,17 +160,13 @@ public class SecurityGroup implements Comparable { private final String name; private final String description; private final String domain; - @Named("domainid") private final String domainId; - @Named("jobid") private final String jobId; - @Named("jobstatus") private final Integer jobStatus; - @Named("ingressrule") private final Set ingressRules; @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, @Nullable String domain, @Nullable String domainId, @Nullable String jobId, @Nullable Integer jobStatus, @@ -237,8 +231,8 @@ public class SecurityGroup implements Comparable { /** * @return shows the current pending asynchronous job ID. This tag is not - returned if no current pending jobs are acting on the virtual - machine + * returned if no current pending jobs are acting on the virtual + * machine */ @Nullable public String getJobId() { @@ -271,21 +265,21 @@ public class SecurityGroup implements Comparable { if (obj == null || getClass() != obj.getClass()) return false; SecurityGroup that = SecurityGroup.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.account, that.account) - && Objects.equal(this.name, that.name) - && Objects.equal(this.description, that.description) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.jobId, that.jobId) - && Objects.equal(this.jobStatus, that.jobStatus) - && Objects.equal(this.ingressRules, that.ingressRules); + && Objects.equal(this.account, that.account) + && Objects.equal(this.name, that.name) + && Objects.equal(this.description, that.description) + && Objects.equal(this.domain, that.domain) + && Objects.equal(this.domainId, that.domainId) + && Objects.equal(this.jobId, that.jobId) + && Objects.equal(this.jobStatus, that.jobStatus) + && Objects.equal(this.ingressRules, that.ingressRules); } - + protected ToStringHelper string() { 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); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java index b192cf9172..7011e64a7f 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java @@ -24,8 +24,6 @@ import java.beans.ConstructorProperties; import java.util.Date; import java.util.Set; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Joiner; @@ -252,33 +250,21 @@ public class ServiceOffering implements Comparable { private final String id; private final String name; - @Named("displaytext") private final String displayText; private final Date created; private final String domain; - @Named("domainid") private final String domainId; - @Named("cpunumber") private final int cpuNumber; - @Named("cpuspeed") private final int cpuSpeed; private final int memory; - @Named("offerha") private final boolean haSupport; - @Named("storagetype") private final StorageType storageType; private final String tags; - @Named("defaultuse") private final boolean defaultUse; - @Named("hosttags") private final String hostTags; - @Named("issystem") private final boolean systemOffering; - @Named("limitcpuuse") private final boolean cpuUseLimited; - @Named("networkrate") private final long networkRate; - @Named("systemvmtype") private final boolean systemVmType; @ConstructorProperties({ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java index 7e84da0993..546b8492fb 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.CaseFormat; @@ -261,23 +259,15 @@ public class Snapshot { private final String account; private final Date created; private final String domain; - @Named("domainid") private final String domainId; - @Named("intervaltype") private final Snapshot.Interval interval; - @Named("jobid") private final String jobId; - @Named("jobstatus") private final String jobStatus; private final String name; - @Named("snapshottype") private final Snapshot.Type snapshotType; private final Snapshot.State state; - @Named("volumeid") private final String volumeId; - @Named("volumename") private final String volumeName; - @Named("volumetype") private final Volume.Type volumeType; @ConstructorProperties({ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicy.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicy.java index 3651a5641d..28c2a040da 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicy.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicy.java @@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -31,20 +29,20 @@ import com.google.common.base.Objects.ToStringHelper; /** * Class SnapshotPolicy - * + * * @author Richard Downer -*/ + */ public class SnapshotPolicy { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromSnapshotPolicy(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -53,8 +51,8 @@ public class SnapshotPolicy { protected String schedule; protected String timezone; protected String volumeId; - - /** + + /** * @see SnapshotPolicy#getId() */ public T id(String id) { @@ -62,7 +60,7 @@ public class SnapshotPolicy { return self(); } - /** + /** * @see SnapshotPolicy#getInterval() */ public T interval(Snapshot.Interval interval) { @@ -70,7 +68,7 @@ public class SnapshotPolicy { return self(); } - /** + /** * @see SnapshotPolicy#getNumberToRetain() */ public T numberToRetain(long numberToRetain) { @@ -78,7 +76,7 @@ public class SnapshotPolicy { return self(); } - /** + /** * @see SnapshotPolicy#getSchedule() */ public T schedule(String schedule) { @@ -86,7 +84,7 @@ public class SnapshotPolicy { return self(); } - /** + /** * @see SnapshotPolicy#getTimezone() */ public T timezone(String timezone) { @@ -94,7 +92,7 @@ public class SnapshotPolicy { return self(); } - /** + /** * @see SnapshotPolicy#getVolumeId() */ public T volumeId(String volumeId) { @@ -105,15 +103,15 @@ public class SnapshotPolicy { public SnapshotPolicy build() { return new SnapshotPolicy(id, interval, numberToRetain, schedule, timezone, volumeId); } - + public T fromSnapshotPolicy(SnapshotPolicy in) { return this - .id(in.getId()) - .interval(in.getInterval()) - .numberToRetain(in.getNumberToRetain()) - .schedule(in.getSchedule()) - .timezone(in.getTimezone()) - .volumeId(in.getVolumeId()); + .id(in.getId()) + .interval(in.getInterval()) + .numberToRetain(in.getNumberToRetain()) + .schedule(in.getSchedule()) + .timezone(in.getTimezone()) + .volumeId(in.getVolumeId()); } } @@ -125,17 +123,14 @@ public class SnapshotPolicy { } private final String id; - @Named("intervaltype") private final Snapshot.Interval interval; - @Named("maxsnaps") private final long numberToRetain; private final String schedule; private final String timezone; - @Named("volumeid") private final String volumeId; @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, @Nullable String timezone, @Nullable String volumeId) { @@ -204,19 +199,19 @@ public class SnapshotPolicy { if (obj == null || getClass() != obj.getClass()) return false; SnapshotPolicy that = SnapshotPolicy.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.interval, that.interval) - && Objects.equal(this.numberToRetain, that.numberToRetain) - && Objects.equal(this.schedule, that.schedule) - && Objects.equal(this.timezone, that.timezone) - && Objects.equal(this.volumeId, that.volumeId); + && Objects.equal(this.interval, that.interval) + && Objects.equal(this.numberToRetain, that.numberToRetain) + && Objects.equal(this.schedule, that.schedule) + && Objects.equal(this.timezone, that.timezone) + && Objects.equal(this.volumeId, that.volumeId); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .add("id", id).add("interval", interval).add("numberToRetain", numberToRetain).add("schedule", schedule).add("timezone", timezone) .add("volumeId", volumeId); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicySchedule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicySchedule.java index d006ce79da..b28bcad10c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicySchedule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicySchedule.java @@ -28,26 +28,26 @@ import com.google.common.base.Objects.ToStringHelper; /** * Describes the schedule of a snapshot policy. * - * @see org.jclouds.cloudstack.util.SnapshotPolicySchedules * @author Richard Downer -*/ + * @see org.jclouds.cloudstack.util.SnapshotPolicySchedules + */ public class SnapshotPolicySchedule { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromSnapshotPolicySchedule(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected Snapshot.Interval interval; protected String time; - - /** + + /** * @see SnapshotPolicySchedule#getInterval() */ public T interval(Snapshot.Interval interval) { @@ -55,7 +55,7 @@ public class SnapshotPolicySchedule { return self(); } - /** + /** * @see SnapshotPolicySchedule#getTime() */ public T time(String time) { @@ -66,11 +66,11 @@ public class SnapshotPolicySchedule { public SnapshotPolicySchedule build() { return new SnapshotPolicySchedule(interval, time); } - + public T fromSnapshotPolicySchedule(SnapshotPolicySchedule in) { return this - .interval(in.getInterval()) - .time(in.getTime()); + .interval(in.getInterval()) + .time(in.getTime()); } } @@ -85,7 +85,7 @@ public class SnapshotPolicySchedule { private final String time; @ConstructorProperties({ - "interval", "time" + "interval", "time" }) protected SnapshotPolicySchedule(@Nullable Snapshot.Interval interval, @Nullable String time) { this.interval = interval; @@ -113,14 +113,14 @@ public class SnapshotPolicySchedule { if (obj == null || getClass() != obj.getClass()) return false; SnapshotPolicySchedule that = SnapshotPolicySchedule.class.cast(obj); return Objects.equal(this.interval, that.interval) - && Objects.equal(this.time, that.time); + && Objects.equal(this.time, that.time); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .add("interval", interval).add("time", time); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SshKeyPair.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SshKeyPair.java index c1dcfcad7d..bfa9533c81 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SshKeyPair.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SshKeyPair.java @@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -31,27 +29,27 @@ import com.google.common.base.Objects.ToStringHelper; /** * Class SshKeyPair - * + * * @author Vijay Kiran -*/ + */ public class SshKeyPair { - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromSshKeyPair(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String fingerprint; protected String name; protected String privateKey; - - /** + + /** * @see SshKeyPair#getFingerprint() */ public T fingerprint(String fingerprint) { @@ -59,7 +57,7 @@ public class SshKeyPair { return self(); } - /** + /** * @see SshKeyPair#getName() */ public T name(String name) { @@ -67,7 +65,7 @@ public class SshKeyPair { return self(); } - /** + /** * @see SshKeyPair#getPrivateKey() */ public T privateKey(String privateKey) { @@ -78,12 +76,12 @@ public class SshKeyPair { public SshKeyPair build() { return new SshKeyPair(fingerprint, name, privateKey); } - + public T fromSshKeyPair(SshKeyPair in) { return this - .fingerprint(in.getFingerprint()) - .name(in.getName()) - .privateKey(in.getPrivateKey()); + .fingerprint(in.getFingerprint()) + .name(in.getName()) + .privateKey(in.getPrivateKey()); } } @@ -96,11 +94,10 @@ public class SshKeyPair { private final String fingerprint; private final String name; - @Named("privatekey") private final String privateKey; @ConstructorProperties({ - "fingerprint", "name", "privatekey" + "fingerprint", "name", "privatekey" }) protected SshKeyPair(@Nullable String fingerprint, String name, @Nullable String privateKey) { this.fingerprint = fingerprint; @@ -133,15 +130,15 @@ public class SshKeyPair { if (obj == null || getClass() != obj.getClass()) return false; SshKeyPair that = SshKeyPair.class.cast(obj); return Objects.equal(this.fingerprint, that.fingerprint) - && Objects.equal(this.name, that.name) - && Objects.equal(this.privateKey, that.privateKey); + && Objects.equal(this.name, that.name) + && Objects.equal(this.privateKey, that.privateKey); } - + protected ToStringHelper string() { return Objects.toStringHelper(this) .add("fingerprint", fingerprint).add("name", name).add("privateKey", privateKey); } - + @Override public String toString() { return string().toString(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/StoragePool.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/StoragePool.java index aa1d8fc533..5416c07c24 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/StoragePool.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/StoragePool.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.CaseFormat; @@ -33,9 +31,9 @@ import com.google.common.base.Objects.ToStringHelper; /** * Represents a storage pool in CloudStack - * + * * @author Richard Downer -*/ + */ public class StoragePool implements Comparable { public enum State { @@ -75,30 +73,30 @@ public class StoragePool implements Comparable { EXT, OCFS2, UNRECOGNIZED; - + @Override 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) { - try { - return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type"))); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } + try { + return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type"))); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } } } - public static Builder builder() { + public static Builder builder() { return new ConcreteBuilder(); } - - public Builder toBuilder() { + + public Builder toBuilder() { return new ConcreteBuilder().fromStoragePool(this); } - public static abstract class Builder> { + public static abstract class Builder> { protected abstract T self(); protected String id; @@ -119,8 +117,8 @@ public class StoragePool implements Comparable { protected String ipAddress; protected String jobId; protected String jobStatus; - - /** + + /** * @see StoragePool#getId() */ public T id(String id) { @@ -128,7 +126,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getName() */ public T name(String name) { @@ -136,7 +134,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getPath() */ public T path(String path) { @@ -144,7 +142,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getTags() */ public T tags(String tags) { @@ -152,7 +150,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getState() */ public T state(StoragePool.State state) { @@ -160,7 +158,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getType() */ public T type(StoragePool.Type type) { @@ -168,7 +166,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getZoneId() */ public T zoneId(String zoneId) { @@ -176,7 +174,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getZoneName() */ public T zoneName(String zoneName) { @@ -184,7 +182,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getPodId() */ public T podId(String podId) { @@ -192,7 +190,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getPodName() */ public T podName(String podName) { @@ -200,7 +198,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getClusterId() */ public T clusterId(String clusterId) { @@ -208,7 +206,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getClusterName() */ public T clusterName(String clusterName) { @@ -216,7 +214,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getCreated() */ public T created(Date created) { @@ -224,7 +222,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getDiskSizeAllocated() */ public T diskSizeAllocated(long diskSizeAllocated) { @@ -232,7 +230,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getDiskSizeTotal() */ public T diskSizeTotal(long diskSizeTotal) { @@ -240,7 +238,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getIpAddress() */ public T ipAddress(String ipAddress) { @@ -248,7 +246,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getJobId() */ public T jobId(String jobId) { @@ -256,7 +254,7 @@ public class StoragePool implements Comparable { return self(); } - /** + /** * @see StoragePool#getJobStatus() */ public T jobStatus(String jobStatus) { @@ -267,27 +265,27 @@ public class StoragePool implements Comparable { public StoragePool build() { 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) { return this - .id(in.getId()) - .name(in.getName()) - .path(in.getPath()) - .tags(in.getTags()) - .state(in.getState()) - .type(in.getType()) - .zoneId(in.getZoneId()) - .zoneName(in.getZoneName()) - .podId(in.getPodId()) - .podName(in.getPodName()) - .clusterId(in.getClusterId()) - .clusterName(in.getClusterName()) - .created(in.getCreated()) - .diskSizeAllocated(in.getDiskSizeAllocated()) - .diskSizeTotal(in.getDiskSizeTotal()) - .ipAddress(in.getIpAddress()) - .jobId(in.getJobId()) - .jobStatus(in.getJobStatus()); + .id(in.getId()) + .name(in.getName()) + .path(in.getPath()) + .tags(in.getTags()) + .state(in.getState()) + .type(in.getType()) + .zoneId(in.getZoneId()) + .zoneName(in.getZoneName()) + .podId(in.getPodId()) + .podName(in.getPodName()) + .clusterId(in.getClusterId()) + .clusterName(in.getClusterName()) + .created(in.getCreated()) + .diskSizeAllocated(in.getDiskSizeAllocated()) + .diskSizeTotal(in.getDiskSizeTotal()) + .ipAddress(in.getIpAddress()) + .jobId(in.getJobId()) + .jobStatus(in.getJobStatus()); } } @@ -304,32 +302,21 @@ public class StoragePool implements Comparable { private final String tags; private final StoragePool.State state; private final StoragePool.Type type; - @Named("zoneid") private final String zoneId; - @Named("zonename") private final String zoneName; - @Named("podid") private final String podId; - @Named("podname") private final String podName; - @Named("clusterid") private final String clusterId; - @Named("clustername") private final String clusterName; private final Date created; - @Named("disksizeallocated") private final long diskSizeAllocated; - @Named("disksizetotal") private final long diskSizeTotal; - @Named("ipaddress") private final String ipAddress; - @Named("jobid") private final String jobId; - @Named("jobstatus") private final String jobStatus; @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) { this.id = checkNotNull(id, "id"); @@ -450,35 +437,35 @@ public class StoragePool implements Comparable { if (obj == null || getClass() != obj.getClass()) return false; StoragePool that = StoragePool.class.cast(obj); return Objects.equal(this.id, that.id) - && Objects.equal(this.name, that.name) - && Objects.equal(this.path, that.path) - && Objects.equal(this.tags, that.tags) - && Objects.equal(this.state, that.state) - && Objects.equal(this.type, that.type) - && Objects.equal(this.zoneId, that.zoneId) - && Objects.equal(this.zoneName, that.zoneName) - && Objects.equal(this.podId, that.podId) - && Objects.equal(this.podName, that.podName) - && Objects.equal(this.clusterId, that.clusterId) - && Objects.equal(this.clusterName, that.clusterName) - && Objects.equal(this.created, that.created) - && Objects.equal(this.diskSizeAllocated, that.diskSizeAllocated) - && Objects.equal(this.diskSizeTotal, that.diskSizeTotal) - && Objects.equal(this.ipAddress, that.ipAddress) - && Objects.equal(this.jobId, that.jobId) - && Objects.equal(this.jobStatus, that.jobStatus); + && Objects.equal(this.name, that.name) + && Objects.equal(this.path, that.path) + && Objects.equal(this.tags, that.tags) + && Objects.equal(this.state, that.state) + && Objects.equal(this.type, that.type) + && Objects.equal(this.zoneId, that.zoneId) + && Objects.equal(this.zoneName, that.zoneName) + && Objects.equal(this.podId, that.podId) + && Objects.equal(this.podName, that.podName) + && Objects.equal(this.clusterId, that.clusterId) + && Objects.equal(this.clusterName, that.clusterName) + && Objects.equal(this.created, that.created) + && Objects.equal(this.diskSizeAllocated, that.diskSizeAllocated) + && Objects.equal(this.diskSizeTotal, that.diskSizeTotal) + && Objects.equal(this.ipAddress, that.ipAddress) + && Objects.equal(this.jobId, that.jobId) + && Objects.equal(this.jobStatus, that.jobStatus); } - + protected ToStringHelper string() { 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); } - + @Override public String toString() { return string().toString(); } - + @Override public int compareTo(StoragePool other) { return this.id.compareTo(other.id); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/StorageType.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/StorageType.java index d2b3d10124..d6baf06fc1 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/StorageType.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/StorageType.java @@ -25,7 +25,6 @@ import org.jclouds.cloudstack.features.OfferingClient; import com.google.common.base.CaseFormat; /** - * * @author Adrian Cole * @see OfferingClient#listServiceOfferings */ diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Template.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Template.java index 92f382e9f8..0891c839a2 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Template.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Template.java @@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.beans.ConstructorProperties; import java.util.Date; -import javax.inject.Named; - import org.jclouds.javax.annotation.Nullable; import com.google.common.base.Objects; @@ -32,57 +30,57 @@ import com.google.common.base.Objects.ToStringHelper; /** * @author Adrian Cole -*/ + */ public class Template implements Comparable