Merge branch 'master' of github.com:jclouds/jclouds into 1.5.x

* 'master' of github.com:jclouds/jclouds: (148 commits)
  cloudservers test fixes
  more compatible delimiter as - doesn't work in rackspace
  cleanup ninefold properties
  removed duplicate test class
  Fixing a few more %d format errors.
  Issue 915: supports AdminAccess.adminHome, and UserAdd.home
  image extension related classes under extensions package
  image extension related classes under extensions package
  unraveled injector a bit
  cloudstack logging working
  Initial CloudStack 3.0 compatibility work.
  pretty json test
  Issue 936: fixes async multi-part upload of small blob
  fixed NPE
  Issue 938:TemplateBuilderSpec
  fixed tests
  fixed tests
  allow use of tenantId when specified numeric
  aws-ec2 works with tags now
  openstack-nova works with tags now
  ...
This commit is contained in:
Adrian Cole 2012-05-21 22:37:11 -06:00
commit 90a559b809
1027 changed files with 28991 additions and 9075 deletions

View File

@ -19,6 +19,7 @@
package org.jclouds.atmos.domain.internal;
import java.net.URI;
import java.util.Date;
import org.jclouds.atmos.domain.MutableContentMetadata;
import org.jclouds.io.ContentMetadataBuilder;
@ -154,8 +155,13 @@ public class DelegatingMutableContentMetadata implements MutableContentMetadata
}
@Override
public void setPropertiesFromHttpHeaders(Multimap<String, String> headers) {
delegate.setPropertiesFromHttpHeaders(headers);
public void setExpires(Date expires) {
delegate.setExpires(expires);
}
@Override
public Date getExpires() {
return delegate.getExpires();
}
@Override

View File

@ -19,7 +19,6 @@
package org.jclouds.atmos.functions;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.util.Throwables2.propagateOrNull;
import java.net.URI;
@ -30,6 +29,7 @@ import org.jclouds.rest.InvocationContext;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
/**
*
@ -44,7 +44,7 @@ public class ReturnEndpointIfAlreadyExists implements Function<Exception, URI>,
if (checkNotNull(from, "exception") instanceof KeyAlreadyExistsException) {
return endpoint;
}
return URI.class.cast(propagateOrNull(from));
throw Throwables.propagate(from);
}
@Override

View File

@ -21,6 +21,9 @@ package org.jclouds.atmos.blobstore;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.atmos.AtmosApiMetadata;
@ -32,6 +35,7 @@ import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.Blob.Factory;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
import org.jclouds.io.ContentMetadata;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
@ -89,6 +93,7 @@ public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest<AtmosAsyncCl
blob.getPayload().getContentMetadata().setContentLength(2l);
blob.getPayload().getContentMetadata().setContentMD5(new byte[] { 0, 2, 4, 8 });
blob.getPayload().getContentMetadata().setContentType("text/plain");
blob.getPayload().getContentMetadata().setExpires(new Date(1000));
HttpRequest request = signer.signPutBlob("container", blob);
@ -98,7 +103,7 @@ public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest<AtmosAsyncCl
request,
"Accept: */*\nDate: Thu, 05 Jun 2008 16:38:19 GMT\nx-emc-signature: aLpB1oQaCA27AXT6Nzam7s0f0pI=\nx-emc-uid: identity\n");
assertContentHeadersEqual(request, "text/plain", null, null, null, (long) 2l, new byte[] { 0, 2, 4, 8 });
assertContentHeadersEqual(request, "text/plain", null, null, null, (long) 2l, new byte[] { 0, 2, 4, 8 }, new Date(1000));
assertEquals(request.getFilters().size(), 0);
}

View File

@ -137,7 +137,7 @@ public class StubAtmosAsyncClient implements AtmosAsyncClient {
public ListenableFuture<Void> deletePath(String path) {
if (path.indexOf('/') == path.length() - 1) {
// chop off the trailing slash
return Futures.compose(blobStore.deleteContainerImpl(path.substring(0, path.length() - 1)),
return Futures.compose(blobStore.deleteContainerIfEmpty(path.substring(0, path.length() - 1)),
new Function<Boolean, Void>() {
public Void apply(Boolean from) {

View File

@ -45,13 +45,13 @@ public class BindBackupScheduleToJsonPayload extends BindToJsonPayload {
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, String> postParams) {
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
throw new IllegalStateException("Replace Backup Schedule needs an BackupSchedule object, not a Map");
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
checkArgument(toBind instanceof BackupSchedule, "this binder is only valid for BackupSchedules!");
return super.bindToRequest(request, ImmutableMap.of("backupSchedule", toBind));
return super.bindToRequest(request, (Object) ImmutableMap.of("backupSchedule", toBind));
}
}

View File

@ -22,10 +22,12 @@ import java.util.Map;
import javax.inject.Singleton;
import org.jclouds.cloudservers.compute.extensions.CloudServersImageExtension;
import org.jclouds.cloudservers.compute.functions.CloudServersImageToImage;
import org.jclouds.cloudservers.compute.functions.CloudServersImageToOperatingSystem;
import org.jclouds.cloudservers.compute.functions.FlavorToHardware;
import org.jclouds.cloudservers.compute.functions.ServerToNodeMetadata;
import org.jclouds.cloudservers.compute.predicates.GetImageWhenStatusActivePredicateWithResult;
import org.jclouds.cloudservers.compute.strategy.CloudServersComputeServiceAdapter;
import org.jclouds.cloudservers.domain.Flavor;
import org.jclouds.cloudservers.domain.Server;
@ -37,13 +39,17 @@ import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.extensions.ImageExtension;
import org.jclouds.compute.internal.BaseComputeService;
import org.jclouds.domain.Location;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.predicates.PredicateWithResult;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
@ -77,6 +83,12 @@ public class CloudServersComputeServiceContextModule extends
// we aren't converting location from a provider-specific type
bind(new TypeLiteral<Function<Location, Location>>() {
}).to((Class) IdentityFunction.class);
bind(new TypeLiteral<ImageExtension>() {
}).to(CloudServersImageExtension.class);
bind(new TypeLiteral<PredicateWithResult<Integer, Image>>() {
}).to(GetImageWhenStatusActivePredicateWithResult.class);
}
@ -112,6 +124,10 @@ public class CloudServersComputeServiceContextModule extends
Map<ServerStatus, NodeState> provideServerToNodeState() {
return serverToNodeState;
}
@Override
protected Optional<ImageExtension> provideImageExtension(Injector i) {
return Optional.of(i.getInstance(ImageExtension.class));
}
}

View File

@ -0,0 +1,120 @@
/**
* 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.cloudservers.compute.extensions;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import java.util.NoSuchElementException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.Constants;
import org.jclouds.cloudservers.CloudServersClient;
import org.jclouds.cloudservers.domain.Server;
import org.jclouds.compute.domain.CloneImageTemplate;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageTemplate;
import org.jclouds.compute.domain.ImageTemplateBuilder;
import org.jclouds.compute.extensions.ImageExtension;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.concurrent.Futures;
import org.jclouds.logging.Logger;
import org.jclouds.predicates.PredicateWithResult;
import org.jclouds.predicates.Retryables;
import com.google.common.util.concurrent.ListenableFuture;
/**
* CloudServers implementation of {@link ImageExtension}
*
* @author David Alves
*
*/
@Singleton
public class CloudServersImageExtension implements ImageExtension {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
private final CloudServersClient client;
private final ExecutorService executor;
private final PredicateWithResult<Integer, Image> imageAvailablePredicate;
@com.google.inject.Inject(optional = true)
@Named("IMAGE_MAX_WAIT")
private long maxWait = 3600;
@com.google.inject.Inject(optional = true)
@Named("IMAGE_WAIT_PERIOD")
private long waitPeriod = 1;
@Inject
public CloudServersImageExtension(CloudServersClient client,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
PredicateWithResult<Integer, Image> imageAvailablePredicate) {
this.client = checkNotNull(client);
this.executor = userThreads;
this.imageAvailablePredicate = imageAvailablePredicate;
}
@Override
public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
Server server = client.getServer(Integer.parseInt(id));
if (server == null)
throw new NoSuchElementException("Cannot find server with id: " + id);
CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
return template;
}
@Override
public ListenableFuture<Image> createImage(ImageTemplate template) {
checkState(template instanceof CloneImageTemplate,
" openstack-nova only supports creating images through cloning.");
CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
final org.jclouds.cloudservers.domain.Image image = client.createImageFromServer(cloneTemplate.getName(),
Integer.parseInt(cloneTemplate.getSourceNodeId()));
return Futures.makeListenable(executor.submit(new Callable<Image>() {
@Override
public Image call() throws Exception {
return Retryables.retryGettingResultOrFailing(imageAvailablePredicate, image.getId(), maxWait, waitPeriod,
TimeUnit.SECONDS, "Image was not created within the time limit, Giving up! [Limit: " + maxWait
+ " secs.]");
}
}), executor);
}
@Override
public boolean deleteImage(String id) {
try {
this.client.deleteImage(Integer.parseInt(id));
} catch (Exception e) {
return false;
}
return true;
}
}

View File

@ -19,6 +19,7 @@
package org.jclouds.cloudservers.compute.functions;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.compute.util.ComputeServiceUtils.addMetadataAndParseTagsFromCommaDelimitedValue;
import java.util.Map;
import java.util.NoSuchElementException;
@ -111,7 +112,7 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
builder.hostname(from.getName());
builder.location(new LocationBuilder().scope(LocationScope.HOST).id(from.getHostId()).description(
from.getHostId()).parent(location.get()).build());
builder.userMetadata(from.getMetadata());
addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata());
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName()));
builder.imageId(from.getImageId() + "");
builder.operatingSystem(parseOperatingSystem(from));

View File

@ -0,0 +1,99 @@
/**
* 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.cloudservers.compute.predicates;
import static com.google.common.base.Preconditions.checkNotNull;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import org.jclouds.cloudservers.CloudServersClient;
import org.jclouds.cloudservers.options.ListOptions;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger;
import org.jclouds.predicates.PredicateWithResult;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
/**
*
* @author David Alves
*
*/
public final class GetImageWhenStatusActivePredicateWithResult implements PredicateWithResult<Integer, Image> {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
private final CloudServersClient client;
private final Function<org.jclouds.cloudservers.domain.Image, Image> cloudserversImageToImage;
private org.jclouds.cloudservers.domain.Image result;
private RuntimeException lastFailure;
@Inject
public GetImageWhenStatusActivePredicateWithResult(CloudServersClient client,
Function<org.jclouds.cloudservers.domain.Image, Image> cloudserversImageToImage) {
this.client = client;
this.cloudserversImageToImage = cloudserversImageToImage;
}
@Override
public boolean apply(Integer input) {
result = checkNotNull(findImage(input));
switch (result.getStatus()) {
case ACTIVE:
logger.info("<< Image %s is available for use. %s", input, result);
return true;
case QUEUED:
case PREPARING:
case SAVING:
logger.debug("<< Image %s is not available yet. %s", input, result);
return false;
default:
lastFailure = new IllegalStateException("Image " + input + " was not created. " + result);
throw lastFailure;
}
}
@Override
public Image getResult() {
return cloudserversImageToImage.apply(result);
}
@Override
public Throwable getLastFailure() {
return lastFailure;
}
private org.jclouds.cloudservers.domain.Image findImage(final int id) {
return Iterables.tryFind(client.listImages(new ListOptions().withDetails()),
new Predicate<org.jclouds.cloudservers.domain.Image>() {
@Override
public boolean apply(org.jclouds.cloudservers.domain.Image input) {
return input.getId() == id;
}
}).orNull();
}
}

View File

@ -21,6 +21,7 @@ package org.jclouds.cloudservers.compute.strategy;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withMetadata;
import static org.jclouds.cloudservers.options.ListOptions.Builder.withDetails;
import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue;
import javax.inject.Inject;
import javax.inject.Singleton;
@ -59,11 +60,13 @@ public class CloudServersComputeServiceAdapter implements ComputeServiceAdapter<
Template template) {
Server server = client
.createServer(name, Integer.parseInt(template.getImage().getProviderId()), Integer.parseInt(template
.getHardware().getProviderId()), withMetadata(template.getOptions().getUserMetadata()));
.getHardware().getProviderId()), withMetadata(metadataAndTagsAsCommaDelimitedValue(template.getOptions())));
return new NodeAndInitialCredentials<Server>(server, server.getId() + "", LoginCredentials.builder().password(
server.getAdminPass()).build());
}
@Override
public Iterable<Flavor> listHardwareProfiles() {

View File

@ -138,8 +138,8 @@ public class Image {
@Override
public String toString() {
return "Image [created=" + created + ", id=" + id + ", name=" + name + ", serverId="
+ serverId + "]";
return "Image [created=" + created + ", id=" + id + ", name=" + name + ", serverId=" + serverId + ", status="
+ status + "]";
}
}

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudservers.domain;
import java.util.Map;
import com.google.common.base.Objects;
import com.google.common.collect.Maps;
/**
@ -109,6 +110,10 @@ public class Server {
return imageId;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
@ -141,86 +146,32 @@ public class Server {
return status;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((addresses == null) ? 0 : addresses.hashCode());
result = prime * result + ((adminPass == null) ? 0 : adminPass.hashCode());
result = prime * result + ((flavorId == null) ? 0 : flavorId.hashCode());
result = prime * result + ((hostId == null) ? 0 : hostId.hashCode());
result = prime * result + id;
result = prime * result + ((imageId == null) ? 0 : imageId.hashCode());
result = prime * result + ((metadata == null) ? 0 : metadata.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((sharedIpGroupId == null) ? 0 : sharedIpGroupId.hashCode());
return result;
return Objects.hashCode(id, name);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Server other = (Server) obj;
if (addresses == null) {
if (other.addresses != null)
return false;
} else if (!addresses.equals(other.addresses))
return false;
if (adminPass == null) {
if (other.adminPass != null)
return false;
} else if (!adminPass.equals(other.adminPass))
return false;
if (flavorId == null) {
if (other.flavorId != null)
return false;
} else if (!flavorId.equals(other.flavorId))
return false;
if (hostId == null) {
if (other.hostId != null)
return false;
} else if (!hostId.equals(other.hostId))
return false;
if (id != other.id)
return false;
if (imageId == null) {
if (other.imageId != null)
return false;
} else if (!imageId.equals(other.imageId))
return false;
if (metadata == null) {
if (other.metadata != null)
return false;
} else if (!metadata.equals(other.metadata))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (sharedIpGroupId == null) {
if (other.sharedIpGroupId != null)
return false;
} else if (!sharedIpGroupId.equals(other.sharedIpGroupId))
return false;
return true;
}
public void setName(String name) {
this.name = name;
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Server that = Server.class.cast(obj);
return Objects.equal(this.getId(), that.getId())
&& Objects.equal(this.name, that.name);
}
@Override
public String toString() {
return "Server [addresses=" + addresses + ", adminPass=" + adminPass + ", flavorId="
+ flavorId + ", hostId=" + hostId + ", id=" + id + ", imageId=" + imageId
+ ", metadata=" + metadata + ", name=" + name + ", sharedIpGroupId="
+ sharedIpGroupId + "]";
return Objects.toStringHelper("")
.add("id", getId())
.add("name", name)
.add("addresses", addresses)
.add("flavorId", flavorId)
.add("imageId", imageId)
.add("hostId", hostId)
.add("metadata", metadata)
.add("sharedIpGroupId", sharedIpGroupId).toString();
}
}

View File

@ -94,10 +94,10 @@ public class CreateServerOptions implements MapBinder {
private String publicIp;
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, String> postParams) {
ServerRequest server = new ServerRequest(checkNotNull(postParams.get("name"), "name parameter not present"),
Integer.parseInt(checkNotNull(postParams.get("imageId"), "imageId parameter not present")), Integer
.parseInt(checkNotNull(postParams.get("flavorId"), "flavorId parameter not present")));
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
ServerRequest server = new ServerRequest(checkNotNull(postParams.get("name"), "name parameter not present").toString(),
Integer.parseInt(checkNotNull(postParams.get("imageId"), "imageId parameter not present").toString()),
Integer.parseInt(checkNotNull(postParams.get("flavorId"), "flavorId parameter not present").toString()));
if (metadata.size() > 0)
server.metadata = metadata;
if (files.size() > 0)
@ -202,7 +202,7 @@ public class CreateServerOptions implements MapBinder {
public static class Builder {
/**
* @see CreateServerOptions#withFile(String,byte [])
* @see CreateServerOptions#withFile(String,byte[])
*/
public static CreateServerOptions withFile(String path, byte[] contents) {
CreateServerOptions options = new CreateServerOptions();

View File

@ -57,8 +57,8 @@ public class CreateSharedIpGroupOptions implements MapBinder {
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, String> postParams) {
SharedIpGroupRequest createRequest = new SharedIpGroupRequest(checkNotNull(postParams.get("name")), serverId);
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
SharedIpGroupRequest createRequest = new SharedIpGroupRequest(checkNotNull(postParams.get("name")).toString(), serverId);
return jsonBinder.bindToRequest(request, ImmutableMap.of("sharedIpGroup", createRequest));
}

View File

@ -43,7 +43,7 @@ public class RebuildServerOptions implements MapBinder {
Integer imageId;
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, String> postParams) {
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
Map<String, Integer> image = Maps.newHashMap();
if (imageId != null)
image.put("imageId", imageId);

View File

@ -53,6 +53,7 @@ import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.predicates.SocketOpen;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException;
import org.jclouds.sshj.config.SshjSshClientModule;
import org.jclouds.util.Strings2;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
@ -64,6 +65,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.net.HostAndPort;
import com.google.inject.Injector;
import com.google.inject.Module;
/**
* Tests behavior of {@code CloudServersClient}
@ -603,4 +605,9 @@ public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTes
client.deleteSharedIpGroup(sharedIpGroupId);
}
}
@Override
protected Module getSshModule() {
return new SshjSshClientModule();
}
}

View File

@ -0,0 +1,47 @@
/**
* 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.cloudservers.compute.extensions;
import org.jclouds.compute.extensions.ImageExtension;
import org.jclouds.compute.extensions.internal.BaseImageExtensionLiveTest;
import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.Test;
import com.google.inject.Module;
/**
* Live test for cloudservers {@link ImageExtension} implementation
*
* @author David Alves
*
*/
@Test(groups = "live", singleThreaded = true, testName = "CloudServersImageExtensionLiveTest")
public class CloudServersImageExtensionLiveTest extends BaseImageExtensionLiveTest {
public CloudServersImageExtensionLiveTest() {
provider = "cloudservers";
}
@Override
protected Module getSshModule() {
return new SshjSshClientModule();
}
}

View File

@ -0,0 +1,97 @@
/**
* 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.cloudservers.compute.predicates;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import java.net.URI;
import java.util.Map;
import org.jclouds.cloudservers.internal.BaseCloudServersComputeServiceExpectTest;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.Image;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.predicates.PredicateWithResult;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.net.HttpHeaders;
import com.google.inject.Injector;
/**
*
* @author David Alves
*
*/
@Test(groups = "unit", testName = "GetImageWhenStatusActivePredicateWithResultExpectTest")
public class GetImageWhenStatusActivePredicateWithResultExpectTest extends
BaseCloudServersComputeServiceExpectTest<Injector> {
private final HttpRequest listImagesDetail = HttpRequest
.builder()
.method("GET")
.endpoint(
URI.create("https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/detail?format=json&now=1257695648897"))
.headers(ImmutableMultimap.<String, String> builder()
.put(HttpHeaders.ACCEPT, "application/json")
.put("X-Auth-Token", authToken).build()).build();
private final HttpResponse listImagesResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/test_list_images_detail_imageextension.json")).build();
private final Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
.put(listImagesDetail, listImagesResponse).put(initialAuth, responseWithAuth).build();
public void testReturnsFalseOnQueuedAndSavingAndTrueOnActive() {
Injector injector = requestsSendResponses(requestResponseMap);
PredicateWithResult<Integer, Image> predicate = injector
.getInstance(GetImageWhenStatusActivePredicateWithResult.class);
assertTrue(predicate.apply(2));// ACTIVE
assertFalse(predicate.apply(743));// SAVING
assertFalse(predicate.apply(744));// QUEUED
assertFalse(predicate.apply(747));// PREPARING
}
public void testFailsOnOtherStatuses() {
Injector injector = requestsSendResponses(requestResponseMap);
PredicateWithResult<Integer, Image> predicate = injector
.getInstance(GetImageWhenStatusActivePredicateWithResult.class);
assertTrue(illegalStateExceptionThrown(predicate, 745));// UNRECOGNIZED
assertTrue(illegalStateExceptionThrown(predicate, 746));// UNKNOWN
assertTrue(illegalStateExceptionThrown(predicate, 748));// FAILED
}
private boolean illegalStateExceptionThrown(PredicateWithResult<Integer, Image> predicate, Integer id) {
try {
predicate.apply(id);
} catch (IllegalStateException e) {
return true;
}
return false;
}
@Override
public Injector apply(ComputeServiceContext input) {
return input.utils().injector();
}
}

View File

@ -0,0 +1,103 @@
/**
* 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.cloudservers.internal;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
import java.util.Date;
import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.cloudservers.CloudServersApiMetadata;
import org.jclouds.cloudservers.config.CloudServersRestClientModule;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
import org.jclouds.openstack.keystone.v1_1.internal.BaseKeystoneRestClientExpectTest;
import org.jclouds.rest.ConfiguresRestClient;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.inject.Module;
/**
*
* @author David Alves
*
*/
public abstract class BaseCloudServersComputeServiceExpectTest<T> extends BaseKeystoneRestClientExpectTest<T> implements
Function<ComputeServiceContext, T> {
public BaseCloudServersComputeServiceExpectTest() {
provider = "cloudservers";
}
protected static final String CONSTANT_DATE = "2009-11-08T15:54:08.897Z";
public static class TestAuthenticationServiceModule extends AuthenticationServiceModule {
@Override
protected void configure() {
super.configure();
}
}
@Override
protected Module createModule() {
return new TestCloudServersRestClientModule();
}
@ConfiguresRestClient
protected static class TestCloudServersRestClientModule extends CloudServersRestClientModule {
@Override
public Supplier<Date> provideCacheBusterDate() {
return new Supplier<Date>() {
public Date get() {
return new SimpleDateFormatDateService().iso8601DateParse(CONSTANT_DATE);
}
};
}
}
@Override
protected ApiMetadata createApiMetadata() {
return new CloudServersApiMetadata();
}
@Override
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(PROPERTY_REGIONS, "US");
overrides.setProperty(provider + ".endpoint", endpoint);
return overrides;
}
@Override
public T createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
return apply(createComputeServiceContext(fn, module, props));
}
private ComputeServiceContext createComputeServiceContext(Function<HttpRequest, HttpResponse> fn, Module module,
Properties props) {
return createInjector(fn, module, props).getInstance(ComputeServiceContext.class);
}
}

View File

@ -55,7 +55,7 @@ public class CreateServerOptionsTest {
private HttpRequest buildRequest(CreateServerOptions options) {
injector.injectMembers(options);
HttpRequest request = new HttpRequest(HttpMethod.POST, URI.create("http://localhost"));
options.bindToRequest(request, ImmutableMap.of("name", "foo", "imageId", "1", "flavorId", "2"));
options.bindToRequest(request, ImmutableMap.<String, Object>of("name", "foo", "imageId", "1", "flavorId", "2"));
return request;
}

View File

@ -53,7 +53,7 @@ public class CreateSharedIpGroupOptionsTest {
private HttpRequest buildRequest(CreateSharedIpGroupOptions options) {
injector.injectMembers(options);
HttpRequest request = new HttpRequest(HttpMethod.POST, URI.create("http://localhost"));
options.bindToRequest(request, ImmutableMap.of("name", "foo"));
options.bindToRequest(request, ImmutableMap.<String,Object>of("name", "foo"));
return request;
}

View File

@ -53,7 +53,7 @@ public class RebuildServerOptionsTest {
private HttpRequest buildRequest(RebuildServerOptions options) {
injector.injectMembers(options);
HttpRequest request = new HttpRequest(HttpMethod.POST, URI.create("http://localhost"));
options.bindToRequest(request, new HashMap<String, String>());
options.bindToRequest(request, new HashMap<String, Object>());
return request;
}

View File

@ -0,0 +1,65 @@
{
"images" : [
{
"id" : 2,
"name" : "CentOS 5.2",
"updated" : "2010-10-10T12:00:00Z",
"created" : "2010-08-10T12:00:00Z",
"status" : "ACTIVE"
},
{
"id" : 743,
"name" : "My Server Backup",
"serverId" : 12,
"updated" : "2010-10-10T12:00:00Z",
"created" : "2009-07-07T09:56:16-05:00",
"status" : "SAVING",
"progress" : 80
}
,
{
"id" : 744,
"name" : "My Server Backup",
"serverId" : 12,
"updated" : "2010-10-10T12:00:00Z",
"created" : "2009-07-07T09:56:16-05:00",
"status" : "QUEUED"
}
,
{
"id" : 745,
"name" : "My Server Backup",
"serverId" : 12,
"updated" : "2010-10-10T12:00:00Z",
"created" : "2009-07-07T09:56:16-05:00",
"status" : "UNRECOGNIZED"
}
,
{
"id" : 746,
"name" : "My Server Backup",
"serverId" : 12,
"updated" : "2010-10-10T12:00:00Z",
"created" : "2009-07-07T09:56:16-05:00",
"status" : "UNKNOWN"
}
,
{
"id" : 747,
"name" : "My Server Backup",
"serverId" : 12,
"updated" : "2010-10-10T12:00:00Z",
"created" : "2009-07-07T09:56:16-05:00",
"status" : "PREPARING"
}
,
{
"id" : 748,
"name" : "My Server Backup",
"serverId" : 12,
"updated" : "2010-10-10T12:00:00Z",
"created" : "2009-07-07T09:56:16-05:00",
"status" : "FAILED"
}
]
}

View File

@ -19,6 +19,7 @@
package org.jclouds.cloudsigma;
import static org.jclouds.cloudsigma.reference.CloudSigmaConstants.PROPERTY_VNC_PASSWORD;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
@ -67,6 +68,7 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
// from a race condition applying the password set script
properties.setProperty("jclouds.ssh.max-retries", "7");
properties.setProperty("jclouds.ssh.retry-auth", "true");
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,imageNameMatches=.*[Aa]utomated SSH Access.*,os64Bit=true");
return properties;
}

View File

@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkState;
import java.util.Map;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.MediaType;
@ -35,8 +36,10 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
/**
*
@ -53,7 +56,7 @@ public class BindCloneDriveOptionsToPlainTextString implements MapBinder {
}
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, String> postParams) {
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
"this binder is only valid for GeneratedHttpRequests!");
@SuppressWarnings("unchecked")
@ -62,10 +65,15 @@ public class BindCloneDriveOptionsToPlainTextString implements MapBinder {
CloneDriveOptions options = findOptionsInArgsOrNull(gRequest);
if (options != null) {
postParams = ImmutableMap.<String, String> builder().putAll(postParams).putAll(options.getOptions()).build();
postParams = ImmutableMap.<String, Object> builder().putAll(postParams).putAll(options.getOptions()).build();
}
request.setPayload(listOfMapsToListOfKeyValuesDelimitedByBlankLines.apply(ImmutableSet.of(postParams)));
request.setPayload(listOfMapsToListOfKeyValuesDelimitedByBlankLines.apply(ImmutableSet.of(Maps.transformValues(postParams, new Function<Object, String>() {
@Override
public String apply(@Nullable Object input) {
return input == null ? null : input.toString();
}
}))));
request.getPayload().getContentMetadata().setContentType(MediaType.TEXT_PLAIN);
return request;
}

View File

@ -43,7 +43,6 @@ import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.domain.Volume;
@ -59,7 +58,6 @@ import com.google.common.base.Predicates;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
@ -70,11 +68,6 @@ import com.google.inject.TypeLiteral;
public class CloudSigmaComputeServiceContextModule extends
ComputeServiceAdapterContextModule<ServerInfo, Hardware, DriveInfo, Location> {
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(OsFamily.UBUNTU).imageNameMatches(".*[Aa]utomated SSH Access.*").os64Bit(true);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void configure() {

View File

@ -47,16 +47,16 @@ public class BindCloneDriveOptionsToPlainTextStringTest {
BindCloneDriveOptionsToPlainTextString.class);
public void testDefault() throws IOException {
assertInputAndArgsCreatesPayload(ImmutableMap.of("name", "newdrive"), ImmutableList.<Object> of(),
assertInputAndArgsCreatesPayload(ImmutableMap.<String, Object>of("name", "newdrive"), ImmutableList.<Object> of(),
"name newdrive");
}
public void testWithSize() throws IOException {
assertInputAndArgsCreatesPayload(ImmutableMap.of("name", "newdrive"),
assertInputAndArgsCreatesPayload(ImmutableMap.<String, Object>of("name", "newdrive"),
ImmutableList.<Object> of(new CloneDriveOptions().size(1024)), "name newdrive\nsize 1024");
}
protected void assertInputAndArgsCreatesPayload(ImmutableMap<String, String> inputMap, List<Object> args,
protected void assertInputAndArgsCreatesPayload(ImmutableMap<String, Object> inputMap, List<Object> args,
String expected) {
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getArgs()).andReturn(args).atLeastOnce();

View File

@ -39,6 +39,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.base.Throwables;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.TypeLiteral;
@ -50,13 +51,13 @@ import com.google.inject.TypeLiteral;
@Test(groups = { "unit" })
public class BindServerToPlainTextStringTest {
public static String CREATED_SERVER;
public static final String CREATED_SERVER;
static {
try {
CREATED_SERVER = Strings2.toStringAndClose(BindServerToPlainTextStringTest.class
.getResourceAsStream("/create_server.txt"));
} catch (IOException e) {
CREATED_SERVER = null;
throw Throwables.propagate(e);
}
}
public static final Server SERVER = new Server.Builder()

View File

@ -94,10 +94,16 @@
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<artifactId>jclouds-slf4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>

View File

@ -106,11 +106,11 @@ public class CloudStackComputeServiceContextModule extends
bind(new TypeLiteral<Function<Template, OperatingSystem>>() {
}).to(TemplateToOperatingSystem.class);
install(new FactoryModuleBuilder().build(StaticNATVirtualMachineInNetwork.Factory.class));
bind(new TypeLiteral<CacheLoader<Long, Set<IPForwardingRule>>>() {
bind(new TypeLiteral<CacheLoader<String, Set<IPForwardingRule>>>() {
}).to(GetIPForwardingRulesByVirtualMachine.class);
bind(new TypeLiteral<CacheLoader<Long, Zone>>() {
bind(new TypeLiteral<CacheLoader<String, Zone>>() {
}).to(ZoneIdToZone.class);
bind(new TypeLiteral<Supplier<LoadingCache<Long, Zone>>>() {
bind(new TypeLiteral<Supplier<LoadingCache<String, Zone>>>() {
}).to(ZoneIdToZoneSupplier.class);
// to have the compute service adapter override default locations
install(new LocationsFromComputeServiceAdapterModule<VirtualMachine, ServiceOffering, Template, Zone>(){});
@ -119,12 +119,12 @@ public class CloudStackComputeServiceContextModule extends
@Provides
@Singleton
@Memoized
public Supplier<Map<Long, String>> listOSCategories(AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds,
public Supplier<Map<String, String>> listOSCategories(AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds,
final CloudStackClient client) {
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<Long, String>>(authException,
seconds, new Supplier<Map<Long, String>>() {
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, String>>(authException,
seconds, new Supplier<Map<String, String>>() {
@Override
public Map<Long, String> get() {
public Map<String, String> get() {
GuestOSClient guestOSClient = client.getGuestOSClient();
return guestOSClient.listOSCategories();
}
@ -134,17 +134,17 @@ public class CloudStackComputeServiceContextModule extends
@Provides
@Singleton
@Memoized
public Supplier<Map<Long, OSType>> listOSTypes(AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds,
public Supplier<Map<String, OSType>> listOSTypes(AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds,
final CloudStackClient client) {
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<Long, OSType>>(authException,
seconds, new Supplier<Map<Long, OSType>>() {
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, OSType>>(authException,
seconds, new Supplier<Map<String, OSType>>() {
@Override
public Map<Long, OSType> get() {
public Map<String, OSType> get() {
GuestOSClient guestOSClient = client.getGuestOSClient();
return Maps.uniqueIndex(guestOSClient.listOSTypes(), new Function<OSType, Long>() {
return Maps.uniqueIndex(guestOSClient.listOSTypes(), new Function<OSType, String>() {
@Override
public Long apply(OSType arg0) {
public String apply(OSType arg0) {
return arg0.getId();
}
});
@ -155,9 +155,9 @@ public class CloudStackComputeServiceContextModule extends
@Provides
@Singleton
@Memoized
public Supplier<Map<Long, Network>> listNetworks(AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds,
public Supplier<Map<String, Network>> listNetworks(AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds,
final NetworksForCurrentUser networksForCurrentUser) {
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<Long, Network>>(authException,
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Network>>(authException,
seconds, networksForCurrentUser);
}
@ -172,20 +172,20 @@ public class CloudStackComputeServiceContextModule extends
@Provides
@Singleton
protected Predicate<Long> jobComplete(JobComplete jobComplete) {
protected Predicate<String> jobComplete(JobComplete jobComplete) {
// TODO: parameterize
return new RetryablePredicate<Long>(jobComplete, 1200, 1, 5, TimeUnit.SECONDS);
return new RetryablePredicate<String>(jobComplete, 1200, 1, 5, TimeUnit.SECONDS);
}
@Provides
@Singleton
protected LoadingCache<Long, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine(
CacheLoader<Long, Set<IPForwardingRule>> getIPForwardingRules) {
protected LoadingCache<String, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine(
CacheLoader<String, Set<IPForwardingRule>> getIPForwardingRules) {
return CacheBuilder.newBuilder().build(getIPForwardingRules);
}
@Singleton
public static class GetIPForwardingRulesByVirtualMachine extends CacheLoader<Long, Set<IPForwardingRule>> {
public static class GetIPForwardingRulesByVirtualMachine extends CacheLoader<String, Set<IPForwardingRule>> {
private final CloudStackClient client;
@Inject
@ -198,7 +198,7 @@ public class CloudStackComputeServiceContextModule extends
* when there is no ip forwarding rule available for the VM
*/
@Override
public Set<IPForwardingRule> load(Long input) {
public Set<IPForwardingRule> load(String input) {
Set<IPForwardingRule> rules = client.getNATClient().getIPForwardingRulesForVirtualMachine(input);
return rules != null ? rules : ImmutableSet.<IPForwardingRule>of();
}

View File

@ -75,7 +75,7 @@ public class TemplateToImage implements Function<Template, Image> {
@Override
public boolean matches(Template from, Location input) {
return input.getId().equals(Long.toString(from.getZoneId()));
return input.getId().equals(from.getZoneId());
}
}
}

View File

@ -55,13 +55,13 @@ public class TemplateToOperatingSystem implements Function<Template, OperatingSy
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
private final Supplier<Map<Long, OSType>> osTypes;
private final Supplier<Map<Long, String>> osCategories;
private final Supplier<Map<String, OSType>> osTypes;
private final Supplier<Map<String, String>> osCategories;
private final Map<OsFamily, Map<String, String>> osVersionMap;
@Inject
public TemplateToOperatingSystem(@Memoized Supplier<Map<Long, OSType>> osTypes,
@Memoized Supplier<Map<Long, String>> osCategories, Map<OsFamily, Map<String, String>> osVersionMap) {
public TemplateToOperatingSystem(@Memoized Supplier<Map<String, OSType>> osTypes,
@Memoized Supplier<Map<String, String>> osCategories, Map<OsFamily, Map<String, String>> osVersionMap) {
this.osTypes = checkNotNull(osTypes, "osTypes");
this.osCategories = checkNotNull(osCategories, "osCategories");
this.osVersionMap = checkNotNull(osVersionMap, "osVersionMap");

View File

@ -78,13 +78,13 @@ public class VirtualMachineToNodeMetadata implements Function<VirtualMachine, No
private final FindLocationForVirtualMachine findLocationForVirtualMachine;
private final FindImageForVirtualMachine findImageForVirtualMachine;
private final LoadingCache<Long, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine;
private final LoadingCache<String, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine;
private final GroupNamingConvention nodeNamingConvention;
@Inject
VirtualMachineToNodeMetadata(FindLocationForVirtualMachine findLocationForVirtualMachine,
FindImageForVirtualMachine findImageForVirtualMachine,
LoadingCache<Long, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine,
LoadingCache<String, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine,
GroupNamingConvention.Factory namingConvention) {
this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
this.findLocationForVirtualMachine = checkNotNull(findLocationForVirtualMachine, "findLocationForVirtualMachine");
@ -178,7 +178,7 @@ public class VirtualMachineToNodeMetadata implements Function<VirtualMachine, No
@Override
public boolean matches(VirtualMachine from, Location input) {
return input.getId().equals(Long.toString(from.getZoneId()));
return input.getId().equals(from.getZoneId());
}
}
@ -192,7 +192,7 @@ public class VirtualMachineToNodeMetadata implements Function<VirtualMachine, No
@Override
public boolean matches(VirtualMachine from, Hardware input) {
return input.getProviderId().equals(Long.toString(from.getServiceOfferingId()));
return input.getProviderId().equals(from.getServiceOfferingId());
}
}

View File

@ -47,7 +47,7 @@ public class ZoneToLocation implements Function<Zone, Location> {
@Override
public Location apply(Zone zone) {
return new LocationBuilder().scope(LocationScope.ZONE).metadata(ImmutableMap.<String, Object> of())
.description(zone.getName()).id(Long.toString(zone.getId()))
.description(zone.getName()).id(zone.getId())
.parent(Iterables.getOnlyElement(provider.get())).build();
}

View File

@ -54,9 +54,9 @@ import com.google.common.collect.Sets;
*/
public class CloudStackTemplateOptions extends TemplateOptions implements Cloneable {
protected Set<Long> securityGroupIds = Sets.<Long> newLinkedHashSet();
protected Set<Long> networkIds = Sets.<Long> newLinkedHashSet();
protected Map<String, Long> ipsToNetworks = Maps.<String, Long>newLinkedHashMap();
protected Set<String> securityGroupIds = Sets.<String> newLinkedHashSet();
protected Set<String> networkIds = Sets.<String> newLinkedHashSet();
protected Map<String, String> ipsToNetworks = Maps.<String, String>newLinkedHashMap();
protected String ipOnDefaultNetwork;
protected String keyPair;
protected boolean setupStaticNat = true;
@ -85,7 +85,7 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
/**
* @see DeployVirtualMachineOptions#securityGroupId
*/
public CloudStackTemplateOptions securityGroupId(long securityGroupId) {
public CloudStackTemplateOptions securityGroupId(String securityGroupId) {
this.securityGroupIds.add(securityGroupId);
return this;
}
@ -93,19 +93,19 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
/**
* @see DeployVirtualMachineOptions#securityGroupIds
*/
public CloudStackTemplateOptions securityGroupIds(Iterable<Long> securityGroupIds) {
public CloudStackTemplateOptions securityGroupIds(Iterable<String> securityGroupIds) {
Iterables.addAll(this.securityGroupIds, checkNotNull(securityGroupIds, "securityGroupIds was null"));
return this;
}
public Set<Long> getSecurityGroupIds() {
public Set<String> getSecurityGroupIds() {
return securityGroupIds;
}
/**
* @see DeployVirtualMachineOptions#networkId
*/
public CloudStackTemplateOptions networkId(long networkId) {
public CloudStackTemplateOptions networkId(String networkId) {
this.networkIds.add(networkId);
return this;
}
@ -113,12 +113,12 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
/**
* @see DeployVirtualMachineOptions#networkIds
*/
public CloudStackTemplateOptions networkIds(Iterable<Long> networkIds) {
public CloudStackTemplateOptions networkIds(Iterable<String> networkIds) {
Iterables.addAll(this.networkIds, checkNotNull(networkIds, "networkIds was null"));
return this;
}
public Set<Long> getNetworkIds() {
public Set<String> getNetworkIds() {
return networkIds;
}
@ -146,12 +146,12 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
/**
* @see DeployVirtualMachineOptions#ipOnDefaultNetwork(String)
*/
public CloudStackTemplateOptions ipsToNetworks(Map<String, Long> ipsToNetworks) {
public CloudStackTemplateOptions ipsToNetworks(Map<String, String> ipsToNetworks) {
this.ipsToNetworks.putAll(ipsToNetworks);
return this;
}
public Map<String, Long> getIpsToNetworks() {
public Map<String, String> getIpsToNetworks() {
return ipsToNetworks;
}
@ -174,7 +174,7 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
/**
* @see CloudStackTemplateOptions#securityGroupId
*/
public static CloudStackTemplateOptions securityGroupId(long id) {
public static CloudStackTemplateOptions securityGroupId(String id) {
CloudStackTemplateOptions options = new CloudStackTemplateOptions();
return options.securityGroupId(id);
}
@ -182,7 +182,7 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
/**
* @see CloudStackTemplateOptions#securityGroupIds
*/
public static CloudStackTemplateOptions securityGroupIds(Iterable<Long> securityGroupIds) {
public static CloudStackTemplateOptions securityGroupIds(Iterable<String> securityGroupIds) {
CloudStackTemplateOptions options = new CloudStackTemplateOptions();
return options.securityGroupIds(securityGroupIds);
}
@ -190,7 +190,7 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
/**
* @see CloudStackTemplateOptions#networkId
*/
public static CloudStackTemplateOptions networkId(long id) {
public static CloudStackTemplateOptions networkId(String id) {
CloudStackTemplateOptions options = new CloudStackTemplateOptions();
return options.networkId(id);
}
@ -198,7 +198,7 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
/**
* @see CloudStackTemplateOptions#networkIds
*/
public static CloudStackTemplateOptions networkIds(Iterable<Long> networkIds) {
public static CloudStackTemplateOptions networkIds(Iterable<String> networkIds) {
CloudStackTemplateOptions options = new CloudStackTemplateOptions();
return options.networkIds(networkIds);
}
@ -214,7 +214,7 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
/**
* @see CloudStackTemplateOptions#ipsToNetworks
*/
public static CloudStackTemplateOptions ipsToNetworks(Map<String, Long> ipToNetworkMap) {
public static CloudStackTemplateOptions ipsToNetworks(Map<String, String> ipToNetworkMap) {
CloudStackTemplateOptions options = new CloudStackTemplateOptions();
return options.ipsToNetworks(ipToNetworkMap);
}

View File

@ -39,7 +39,7 @@ import com.google.common.collect.Iterables;
*/
public class AdvancedNetworkOptionsConverter implements OptionsConverter {
@Override
public DeployVirtualMachineOptions apply(CloudStackTemplateOptions templateOptions, Map<Long, Network> networks, long zoneId, DeployVirtualMachineOptions options) {
public DeployVirtualMachineOptions apply(CloudStackTemplateOptions templateOptions, Map<String, Network> networks, String zoneId, DeployVirtualMachineOptions options) {
// security groups not allowed.
// at least one network must be given to CloudStack,
// but jclouds will try to autodetect an appropriate network if none given.

View File

@ -31,7 +31,7 @@ import org.jclouds.cloudstack.options.DeployVirtualMachineOptions;
*/
public class BasicNetworkOptionsConverter implements OptionsConverter {
@Override
public DeployVirtualMachineOptions apply(CloudStackTemplateOptions templateOptions, Map<Long, Network> networks, long zoneId, DeployVirtualMachineOptions options) {
public DeployVirtualMachineOptions apply(CloudStackTemplateOptions templateOptions, Map<String, Network> networks, String zoneId, DeployVirtualMachineOptions options) {
// both security groups and networks are optional, and CloudStack will
// use the zone/user's default network/security group if none given
if (templateOptions.getSecurityGroupIds().size() > 0) {

View File

@ -81,24 +81,24 @@ public class CloudStackComputeServiceAdapter implements
protected Logger logger = Logger.NULL;
private final CloudStackClient client;
private final Predicate<Long> jobComplete;
private final Supplier<Map<Long, Network>> networkSupplier;
private final Predicate<String> jobComplete;
private final Supplier<Map<String, Network>> networkSupplier;
private final BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult;
private final Factory staticNATVMInNetwork;
private final CreatePortForwardingRulesForIP setupPortForwardingRulesForIP;
private final LoadingCache<Long, Set<IPForwardingRule>> vmToRules;
private final LoadingCache<String, Set<IPForwardingRule>> vmToRules;
private final Map<String, Credentials> credentialStore;
private final Map<NetworkType, ? extends OptionsConverter> optionsConverters;
private final Supplier<LoadingCache<Long, Zone>> zoneIdToZone;
private final Supplier<LoadingCache<String, Zone>> zoneIdToZone;
@Inject
public CloudStackComputeServiceAdapter(CloudStackClient client, Predicate<Long> jobComplete,
@Memoized Supplier<Map<Long, Network>> networkSupplier,
public CloudStackComputeServiceAdapter(CloudStackClient client, Predicate<String> jobComplete,
@Memoized Supplier<Map<String, Network>> networkSupplier,
BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult,
StaticNATVirtualMachineInNetwork.Factory staticNATVMInNetwork,
CreatePortForwardingRulesForIP setupPortForwardingRulesForIP, LoadingCache<Long, Set<IPForwardingRule>> vmToRules,
CreatePortForwardingRulesForIP setupPortForwardingRulesForIP, LoadingCache<String, Set<IPForwardingRule>> vmToRules,
Map<String, Credentials> credentialStore, Map<NetworkType, ? extends OptionsConverter> optionsConverters,
Supplier<LoadingCache<Long, Zone>> zoneIdToZone) {
Supplier<LoadingCache<String, Zone>> zoneIdToZone) {
this.client = checkNotNull(client, "client");
this.jobComplete = checkNotNull(jobComplete, "jobComplete");
this.networkSupplier = checkNotNull(networkSupplier, "networkSupplier");
@ -120,9 +120,9 @@ public class CloudStackComputeServiceAdapter implements
checkArgument(template.getOptions().getClass().isAssignableFrom(CloudStackTemplateOptions.class),
"options class %s should have been assignable from CloudStackTemplateOptions", template.getOptions()
.getClass());
Map<Long, Network> networks = networkSupplier.get();
Map<String, Network> networks = networkSupplier.get();
final long zoneId = Long.parseLong(template.getLocation().getId());
final String zoneId = template.getLocation().getId();
Zone zone = null;
try {
zone = zoneIdToZone.get().get(zoneId);
@ -155,10 +155,10 @@ public class CloudStackComputeServiceAdapter implements
}
}
long templateId = Long.parseLong(template.getImage().getId());
long serviceOfferingId = Long.parseLong(template.getHardware().getId());
String templateId = template.getImage().getId();
String serviceOfferingId = template.getHardware().getId();
logger.info("serviceOfferingId %d, templateId %d, zoneId %d, options %s%n", serviceOfferingId, templateId,
logger.info("serviceOfferingId %s, templateId %s, zoneId %s, options %s%n", serviceOfferingId, templateId,
zoneId, options);
AsyncCreateResponse job = client.getVirtualMachineClient().deployVirtualMachineInZone(zoneId, serviceOfferingId,
templateId, options);
@ -172,7 +172,7 @@ public class CloudStackComputeServiceAdapter implements
}
if (templateOptions.shouldSetupStaticNat()) {
// TODO: possibly not all network ids, do we want to do this
for (long networkId : options.getNetworkIds()) {
for (String networkId : options.getNetworkIds()) {
logger.debug(">> creating static NAT for virtualMachine(%s) in network(%s)", vm.getId(), networkId);
PublicIPAddress ip = staticNATVMInNetwork.create(networks.get(networkId)).apply(vm);
logger.trace("<< static NATed IPAddress(%s) to virtualMachine(%s)", ip.getId(), vm.getId());
@ -211,13 +211,13 @@ public class CloudStackComputeServiceAdapter implements
@Override
public VirtualMachine getNode(String id) {
long virtualMachineId = Long.parseLong(id);
String virtualMachineId = id;
return client.getVirtualMachineClient().getVirtualMachine(virtualMachineId);
}
@Override
public void destroyNode(String id) {
long virtualMachineId = Long.parseLong(id);
String virtualMachineId = id;
// There was a bug in 2.2.12 release happening when static nat IP address
// was being released, and corresponding firewall rules were left behind.
// So next time the same IP is allocated, it might be not be static nat
@ -231,7 +231,7 @@ public class CloudStackComputeServiceAdapter implements
// the following:
// 1) Delete IP forwarding rules associated with IP.
Set<Long> ipAddresses = deleteIPForwardingRulesForVMAndReturnDistinctIPs(virtualMachineId);
Set<String> ipAddresses = deleteIPForwardingRulesForVMAndReturnDistinctIPs(virtualMachineId);
// 2) Disable static nat rule for the IP.
disableStaticNATOnIPAddresses(ipAddresses);
@ -244,16 +244,16 @@ public class CloudStackComputeServiceAdapter implements
vmToRules.invalidate(virtualMachineId);
}
public void disassociateIPAddresses(Set<Long> ipAddresses) {
for (long ipAddress : ipAddresses) {
public void disassociateIPAddresses(Set<String> ipAddresses) {
for (String ipAddress : ipAddresses) {
logger.debug(">> disassociating IPAddress(%s)", ipAddress);
client.getAddressClient().disassociateIPAddress(ipAddress);
}
}
public void destroyVirtualMachine(long virtualMachineId) {
public void destroyVirtualMachine(String virtualMachineId) {
Long destroyVirtualMachine = client.getVirtualMachineClient().destroyVirtualMachine(virtualMachineId);
String destroyVirtualMachine = client.getVirtualMachineClient().destroyVirtualMachine(virtualMachineId);
if (destroyVirtualMachine != null) {
logger.debug(">> destroying virtualMachine(%s) job(%s)", virtualMachineId, destroyVirtualMachine);
awaitCompletion(destroyVirtualMachine);
@ -263,10 +263,10 @@ public class CloudStackComputeServiceAdapter implements
}
public void disableStaticNATOnIPAddresses(Set<Long> ipAddresses) {
Builder<Long> jobsToTrack = ImmutableSet.builder();
for (Long ipAddress : ipAddresses) {
Long disableStaticNAT = client.getNATClient().disableStaticNATOnPublicIP(ipAddress);
public void disableStaticNATOnIPAddresses(Set<String> ipAddresses) {
Builder<String> jobsToTrack = ImmutableSet.builder();
for (String ipAddress : ipAddresses) {
String disableStaticNAT = client.getNATClient().disableStaticNATOnPublicIP(ipAddress);
if (disableStaticNAT != null) {
logger.debug(">> disabling static NAT IPAddress(%s) job(%s)", ipAddress, disableStaticNAT);
jobsToTrack.add(disableStaticNAT);
@ -275,18 +275,18 @@ public class CloudStackComputeServiceAdapter implements
awaitCompletion(jobsToTrack.build());
}
public Set<Long> deleteIPForwardingRulesForVMAndReturnDistinctIPs(long virtualMachineId) {
Builder<Long> jobsToTrack = ImmutableSet.builder();
public Set<String> deleteIPForwardingRulesForVMAndReturnDistinctIPs(String virtualMachineId) {
Builder<String> jobsToTrack = ImmutableSet.builder();
// immutable doesn't permit duplicates
Set<Long> ipAddresses = Sets.newLinkedHashSet();
Set<String> ipAddresses = Sets.newLinkedHashSet();
Set<IPForwardingRule> forwardingRules = client.getNATClient().getIPForwardingRulesForVirtualMachine(
virtualMachineId);
for (IPForwardingRule rule : forwardingRules) {
if (!"Deleting".equals(rule.getState())) {
ipAddresses.add(rule.getIPAddressId());
Long deleteForwardingRule = client.getNATClient().deleteIPForwardingRule(rule.getId());
String deleteForwardingRule = client.getNATClient().deleteIPForwardingRule(rule.getId());
if (deleteForwardingRule != null) {
logger.debug(">> deleting IPForwardingRule(%s) job(%s)", rule.getId(), deleteForwardingRule);
jobsToTrack.add(deleteForwardingRule);
@ -297,22 +297,22 @@ public class CloudStackComputeServiceAdapter implements
return ipAddresses;
}
public void awaitCompletion(Iterable<Long> jobs) {
public void awaitCompletion(Iterable<String> jobs) {
logger.debug(">> awaiting completion of jobs(%s)", jobs);
for (long job : jobs)
for (String job : jobs)
awaitCompletion(job);
logger.trace("<< completed jobs(%s)", jobs);
}
public void awaitCompletion(long job) {
public void awaitCompletion(String job) {
boolean completed = jobComplete.apply(job);
logger.trace("<< job(%s) complete(%s)", job, completed);
}
@Override
public void rebootNode(String id) {
long virtualMachineId = Long.parseLong(id);
Long job = client.getVirtualMachineClient().rebootVirtualMachine(virtualMachineId);
String virtualMachineId = id;
String job = client.getVirtualMachineClient().rebootVirtualMachine(virtualMachineId);
if (job != null) {
logger.debug(">> rebooting virtualMachine(%s) job(%s)", virtualMachineId, job);
awaitCompletion(job);
@ -321,8 +321,8 @@ public class CloudStackComputeServiceAdapter implements
@Override
public void resumeNode(String id) {
long virtualMachineId = Long.parseLong(id);
Long job = client.getVirtualMachineClient().startVirtualMachine(Long.parseLong(id));
String virtualMachineId = id;
String job = client.getVirtualMachineClient().startVirtualMachine(id);
if (job != null) {
logger.debug(">> starting virtualMachine(%s) job(%s)", virtualMachineId, job);
awaitCompletion(job);
@ -331,8 +331,8 @@ public class CloudStackComputeServiceAdapter implements
@Override
public void suspendNode(String id) {
long virtualMachineId = Long.parseLong(id);
Long job = client.getVirtualMachineClient().stopVirtualMachine(Long.parseLong(id));
String virtualMachineId = id;
String job = client.getVirtualMachineClient().stopVirtualMachine(id);
if (job != null) {
logger.debug(">> stopping virtualMachine(%s) job(%s)", virtualMachineId, job);
awaitCompletion(job);

View File

@ -42,6 +42,6 @@ public interface OptionsConverter {
* @param options where the resulting set of options will be applied
* @return same as "options" parameter
*/
DeployVirtualMachineOptions apply(CloudStackTemplateOptions templateOptions, Map<Long, Network> networks, long zoneId, DeployVirtualMachineOptions options);
DeployVirtualMachineOptions apply(CloudStackTemplateOptions templateOptions, Map<String, Network> networks, String zoneId, DeployVirtualMachineOptions options);
}

View File

@ -80,11 +80,11 @@ public class CloudStackParserModule extends AbstractModule {
}
static final class PortForwardingRuleInternal {
private long id;
private String id;
@SerializedName("ipaddress")
private String IPAddress;
@SerializedName("ipaddressid")
private long IPAddressId;
private String IPAddressId;
@SerializedName("privateport")
private int privatePort;
private PortForwardingRule.Protocol protocol;
@ -94,7 +94,7 @@ public class CloudStackParserModule extends AbstractModule {
@SerializedName("virtualmachinedisplayname")
private String virtualMachineDisplayName;
@SerializedName("virtualmachineid")
public long virtualMachineId;
public String virtualMachineId;
@SerializedName("virtualmachinename")
private String virtualMachineName;
@SerializedName("cidrlist")
@ -132,7 +132,7 @@ public class CloudStackParserModule extends AbstractModule {
}
static final class FirewallRuleInternal {
private long id;
private String id;
@SerializedName("cidrlist")
private String CIDRs;
@SerializedName("startport")
@ -146,7 +146,7 @@ public class CloudStackParserModule extends AbstractModule {
@SerializedName("ipaddress")
private String ipAddress;
@SerializedName("ipaddressid")
private long ipAddressId;
private String ipAddressId;
private FirewallRule.Protocol protocol;
private FirewallRule.State state;
}
@ -173,27 +173,27 @@ public class CloudStackParserModule extends AbstractModule {
}
static final class LoadBalancerRuleInternal {
private long id;
private String id;
private String account;
private LoadBalancerRule.Algorithm algorithm;
private String description;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
private String name;
@SerializedName("privateport")
private int privatePort;
@SerializedName("publicip")
private String publicIP;
@SerializedName("publicipid")
private long publicIPId;
private String publicIPId;
@SerializedName("publicport")
private int publicPort;
private LoadBalancerRule.State state;
@SerializedName("cidrlist")
private String CIDRs;
@SerializedName("zoneId")
private long zoneId;
private String zoneId;
}
}
@ -224,12 +224,12 @@ public class CloudStackParserModule extends AbstractModule {
}
static final class AccountInternal {
private long id;
private String id;
@SerializedName("accounttype")
private Account.Type type;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("ipavailable")
private String IPsAvailable;
@SerializedName("iplimit")

View File

@ -27,6 +27,7 @@ import javax.annotation.Nullable;
import com.google.common.base.CaseFormat;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ForwardingSet;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
@ -42,11 +43,11 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
}
public static class Builder {
private long id;
private String id;
private Type type;
private String networkDomain;
private String domain;
private long domainId;
private String domainId;
private Long IPsAvailable;
private Long IPLimit;
private long IPs;
@ -71,7 +72,7 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
private long volumes;
private Set<User> users = ImmutableSet.of();
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -91,7 +92,7 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -284,14 +285,14 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
}
private long id;
private String id;
@SerializedName("accounttype")
private Type type;
@SerializedName("networkdomain")
private String networkDomain;
private String domain;
@SerializedName("domainId")
private long domainId;
private String domainId;
@SerializedName("ipsavailable")
private Long IPsAvailable;
@SerializedName("iplimit")
@ -336,7 +337,7 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
private long volumes;
private Set<User> users;
public Account(long id, Type type, String networkDomain, String domain, long domainId, Long IPsAvailable, Long IPLimit, long iPs,
public Account(String id, Type type, String networkDomain, String domain, String domainId, Long IPsAvailable, Long IPLimit, long iPs,
boolean cleanupRequired, String name, long receivedBytes, long sentBytes, Long snapshotsAvailable,
Long snapshotLimit, long snapshots, org.jclouds.cloudstack.domain.Account.State state,
Long templatesAvailable, Long templateLimit, long templates, Long VMsAvailable, Long VMLimit, long vMsRunning,
@ -381,7 +382,7 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
/**
* @return the id of the account
*/
public long getId() {
public String getId() {
return id;
}
@ -417,7 +418,7 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
/**
* @return id of the Domain the account belongs to
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -597,7 +598,7 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
@Override
public int compareTo(Account arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
@ -637,12 +638,7 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
return Objects.hashCode(domainId, id, name);
}
@Override
@ -653,16 +649,11 @@ public class Account extends ForwardingSet<User> implements Comparable<Account>
return false;
if (getClass() != obj.getClass())
return false;
Account other = (Account) obj;
if (domainId != other.domainId)
return false;
if (id != other.id)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
Account that = (Account) obj;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(name, that.name)) return false;
return true;
}

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import java.util.Date;
/**
@ -32,12 +34,12 @@ public class Alert implements Comparable<Alert> {
}
public static class Builder {
private long id;
private String id;
private String description;
private Date sent;
private String type;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -62,7 +64,7 @@ public class Alert implements Comparable<Alert> {
}
}
private long id;
private String id;
private String description;
private Date sent;
private String type;
@ -71,14 +73,14 @@ public class Alert implements Comparable<Alert> {
Alert() {
}
private Alert(long id, String description, Date sent, String type) {
private Alert(String id, String description, Date sent, String type) {
this.id = id;
this.description = description;
this.sent = sent;
this.type = type;
}
public long getId() {
public String getId() {
return id;
}
@ -99,23 +101,19 @@ public class Alert implements Comparable<Alert> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Alert alert = (Alert) o;
Alert that = (Alert) o;
if (id != alert.id) return false;
if (description != null ? !description.equals(alert.description) : alert.description != null) return false;
if (sent != null ? !sent.equals(alert.sent) : alert.sent != null) return false;
if (type != null ? !type.equals(alert.type) : alert.type != null) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(description, that.description)) return false;
if (!Objects.equal(sent, that.sent)) return false;
if (!Objects.equal(type, that.type)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (sent != null ? sent.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
return result;
return Objects.hashCode(id, description, sent, type);
}
@ -131,6 +129,6 @@ public class Alert implements Comparable<Alert> {
@Override
public int compareTo(Alert other) {
return Long.valueOf(this.getId()).compareTo(other.getId());
return this.getId().compareTo(other.getId());
}
}

View File

@ -19,6 +19,7 @@
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -81,19 +82,15 @@ public class ApiKeyPair implements Comparable<ApiKeyPair> {
ApiKeyPair that = (ApiKeyPair) o;
if (apiKey != null ? !apiKey.equals(that.apiKey) : that.apiKey != null)
return false;
if (secretKey != null ? !secretKey.equals(that.secretKey) : that.secretKey != null)
return false;
if (!Objects.equal(apiKey, that.apiKey)) return false;
if (!Objects.equal(secretKey, that.secretKey)) return false;
return true;
}
@Override
public int hashCode() {
int result = apiKey != null ? apiKey.hashCode() : 0;
result = 31 * result + (secretKey != null ? secretKey.hashCode() : 0);
return result;
return Objects.hashCode(apiKey, secretKey);
}
@Override

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -27,9 +28,9 @@ import com.google.gson.annotations.SerializedName;
public class AsyncCreateResponse {
public static final AsyncCreateResponse UNINITIALIZED = new AsyncCreateResponse();
private long id = -1;
private String id;
@SerializedName("jobid")
private long jobId = -1;
private String jobId;
/**
* present only for serializer
@ -39,7 +40,7 @@ public class AsyncCreateResponse {
}
public AsyncCreateResponse(long id, long jobId) {
public AsyncCreateResponse(String id, String jobId) {
this.id = id;
this.jobId = jobId;
}
@ -47,24 +48,20 @@ public class AsyncCreateResponse {
/**
* @return id of the resource being created
*/
public long getId() {
public String getId() {
return id;
}
/**
* @return id of the job in progress
*/
public long getJobId() {
public String getJobId() {
return jobId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + (int) (jobId ^ (jobId >>> 32));
return result;
return Objects.hashCode(id, jobId);
}
@Override
@ -75,11 +72,11 @@ public class AsyncCreateResponse {
return false;
if (getClass() != obj.getClass())
return false;
AsyncCreateResponse other = (AsyncCreateResponse) obj;
if (id != other.id)
return false;
if (jobId != other.jobId)
return false;
AsyncCreateResponse that = (AsyncCreateResponse) obj;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(jobId, that.jobId)) return false;
return true;
}

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.domain;
import java.util.Date;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -102,21 +103,21 @@ public class AsyncJob<T> {
}
public static class Builder<T> {
private long accountId = -1;
private String accountId;
private String cmd;
private Date created;
private long id = -1;
private long instanceId = -1;
private String id;
private String instanceId;
private String instanceType;
private int progress = -1;
private int progress;
private T result;
private ResultCode resultCode = ResultCode.UNKNOWN;
private String resultType;
private AsyncJobError error;
private Status status = Status.UNKNOWN;
private int userId = -1;
private String userId;
public Builder<T> accountId(long accountId) {
public Builder<T> accountId(String accountId) {
this.accountId = accountId;
return this;
}
@ -131,12 +132,12 @@ public class AsyncJob<T> {
return this;
}
public Builder<T> id(long id) {
public Builder<T> id(String id) {
this.id = id;
return this;
}
public Builder<T> instanceId(long instanceId) {
public Builder<T> instanceId(String instanceId) {
this.instanceId = instanceId;
return this;
}
@ -176,7 +177,7 @@ public class AsyncJob<T> {
return this;
}
public Builder<T> userId(int userId) {
public Builder<T> userId(String userId) {
this.userId = userId;
return this;
}
@ -194,17 +195,17 @@ public class AsyncJob<T> {
}
@SerializedName("accountid")
private long accountId = -1;
private String accountId;
private String cmd;
private Date created;
@SerializedName("jobid")
private long id = -1;
private String id;
@SerializedName("jobinstanceid")
private long instanceId = -1;
private String instanceId;
@SerializedName("jobinstancetype")
private String instanceType;
@SerializedName("jobprocstatus")
private int progress = -1;
private int progress;
@SerializedName("jobresult")
private T result;
@SerializedName("jobresultcode")
@ -214,11 +215,11 @@ public class AsyncJob<T> {
@SerializedName("jobstatus")
private Status status = Status.UNKNOWN;
@SerializedName("userid")
private int userId = -1;
private String userId;
private AsyncJobError error;
public AsyncJob(long accountId, String cmd, Date created, long id, long instanceId, String instanceType,
int progress, T result, ResultCode resultCode, String resultType, Status status, int userId, AsyncJobError error) {
public AsyncJob(String accountId, String cmd, Date created, String id, String instanceId, String instanceType,
int progress, T result, ResultCode resultCode, String resultType, Status status, String userId, AsyncJobError error) {
this.accountId = accountId;
this.cmd = cmd;
this.created = created;
@ -245,7 +246,7 @@ public class AsyncJob<T> {
/**
* @return the account that executed the async command
*/
public long getAccountId() {
public String getAccountId() {
return accountId;
}
@ -266,14 +267,14 @@ public class AsyncJob<T> {
/**
* @return async job ID
*/
public long getId() {
public String getId() {
return id;
}
/**
* @return the unique ID of the instance/entity object related to the job
*/
public long getInstanceId() {
public String getInstanceId() {
return instanceId;
}
@ -322,7 +323,7 @@ public class AsyncJob<T> {
/**
* @return the user that executed the async command
*/
public int getUserId() {
public String getUserId() {
return userId;
}
@ -346,22 +347,8 @@ public class AsyncJob<T> {
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (accountId ^ (accountId >>> 32));
result = prime * result + ((cmd == null) ? 0 : cmd.hashCode());
result = prime * result + ((created == null) ? 0 : created.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + (int) (instanceId ^ (instanceId >>> 32));
result = prime * result + ((instanceType == null) ? 0 : instanceType.hashCode());
result = prime * result + ((error == null) ? 0 : error.hashCode());
result = prime * result + progress;
result = prime * result + ((this.result == null) ? 0 : this.result.hashCode());
result = prime * result + resultCode.code();
result = prime * result + ((resultType == null) ? 0 : resultType.hashCode());
result = prime * result + status.code();
result = prime * result + userId;
return result;
return Objects.hashCode(accountId, cmd, created, id, instanceId, instanceType, error, progress,
result, resultCode, resultType, status, userId);
}
@Override
@ -372,51 +359,23 @@ public class AsyncJob<T> {
return false;
if (getClass() != obj.getClass())
return false;
AsyncJob<?> other = (AsyncJob<?>) obj;
if (accountId != other.accountId)
return false;
if (cmd == null) {
if (other.cmd != null)
return false;
} else if (!cmd.equals(other.cmd))
return false;
if (created == null) {
if (other.created != null)
return false;
} else if (!created.equals(other.created))
return false;
if (id != other.id)
return false;
if (instanceId != other.instanceId)
return false;
if (instanceType == null) {
if (other.instanceType != null)
return false;
} else if (!instanceType.equals(other.instanceType))
return false;
if (error == null) {
if (other.error != null)
return false;
} else if (!error.equals(other.error))
return false;
if (progress != other.progress)
return false;
if (result == null) {
if (other.result != null)
return false;
} else if (!result.equals(other.result))
return false;
if (resultCode != other.resultCode)
return false;
if (resultType == null) {
if (other.resultType != null)
return false;
} else if (!resultType.equals(other.resultType))
return false;
if (status != other.status)
return false;
if (userId != other.userId)
return false;
AsyncJob<?> that = (AsyncJob<?>) obj;
if (!Objects.equal(accountId, that.accountId)) return false;
if (!Objects.equal(cmd, that.cmd)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(instanceId, that.instanceId)) return false;
if (!Objects.equal(instanceType, that.instanceType)) return false;
if (!Objects.equal(error, that.error)) return false;
if (!Objects.equal(progress, that.progress)) return false;
if (!Objects.equal(result, that.result)) return false;
if (!Objects.equal(resultCode, that.resultCode)) return false;
if (!Objects.equal(resultType, that.resultType)) return false;
if (!Objects.equal(status, that.status)) return false;
if (!Objects.equal(userId, that.userId)) return false;
return true;
}

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -92,11 +93,7 @@ public class AsyncJobError {
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + errorCode.code();
result = prime * result + ((errorText == null) ? 0 : errorText.hashCode());
return result;
return Objects.hashCode(errorCode, errorText);
}
@Override
@ -107,14 +104,11 @@ public class AsyncJobError {
return false;
if (getClass() != obj.getClass())
return false;
AsyncJobError other = (AsyncJobError) obj;
if (errorCode != other.errorCode)
return false;
if (errorText == null) {
if (other.errorText != null)
return false;
} else if (!errorText.equals(other.errorText))
return false;
AsyncJobError that = (AsyncJobError) obj;
if (!Objects.equal(errorCode, that.errorCode)) return false;
if (!Objects.equal(errorText, that.errorText)) return false;
return true;
}

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -129,14 +130,7 @@ public class Capabilities {
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (canShareTemplates ? 1231 : 1237);
result = prime * result + ((cloudStackVersion == null) ? 0 : cloudStackVersion.hashCode());
result = prime * result + (securityGroupsEnabled ? 1231 : 1237);
result = prime * result + (firewallRuleUiEnabled ? 1231 : 1237);
result = prime * result + (supportELB ? 1231 : 1237);
return result;
return Objects.hashCode(canShareTemplates, cloudStackVersion, securityGroupsEnabled, firewallRuleUiEnabled, supportELB);
}
@Override
@ -147,20 +141,14 @@ public class Capabilities {
return false;
if (getClass() != obj.getClass())
return false;
Capabilities other = (Capabilities) obj;
if (canShareTemplates != other.canShareTemplates)
return false;
if (cloudStackVersion == null) {
if (other.cloudStackVersion != null)
return false;
} else if (!cloudStackVersion.equals(other.cloudStackVersion))
return false;
if (securityGroupsEnabled != other.securityGroupsEnabled)
return false;
if (firewallRuleUiEnabled != other.firewallRuleUiEnabled)
return false;
if (supportELB != other.supportELB)
return false;
Capabilities that = (Capabilities) obj;
if (!Objects.equal(canShareTemplates, that.canShareTemplates)) return false;
if (!Objects.equal(cloudStackVersion, that.cloudStackVersion)) return false;
if (!Objects.equal(securityGroupsEnabled, that.securityGroupsEnabled)) return false;
if (!Objects.equal(firewallRuleUiEnabled, that.firewallRuleUiEnabled)) return false;
if (!Objects.equal(supportELB, that.supportELB)) return false;
return true;
}

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName;
@ -43,10 +44,10 @@ public class Capacity implements Comparable<Capacity> {
private long capacityTotal;
private long capacityUsed;
private double percentUsed;
private long podId;
private String podId;
private String podName;
private Type type;
private long zoneId;
private String zoneId;
private String zoneName;
public Builder capacityTotal(long capacityTotal) {
@ -64,7 +65,7 @@ public class Capacity implements Comparable<Capacity> {
return this;
}
public Builder podId(long podId) {
public Builder podId(String podId) {
this.podId = podId;
return this;
}
@ -79,7 +80,7 @@ public class Capacity implements Comparable<Capacity> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -141,12 +142,12 @@ public class Capacity implements Comparable<Capacity> {
@SerializedName("percentused")
private double percentUsed;
@SerializedName("podid")
private long podId = -1;
private String podId;
@SerializedName("podname")
private String podName;
private Capacity.Type type;
@SerializedName("zoneid")
private long zoneId = -1;
private String zoneId;
@SerializedName("zonename")
private String zoneName;
@ -154,7 +155,7 @@ public class Capacity implements Comparable<Capacity> {
Capacity() {
}
public Capacity(long capacityTotal, long capacityUsed, double percentUsed, long podId, String podName, Type type, long zoneId, String zoneName) {
public Capacity(long capacityTotal, long capacityUsed, double percentUsed, String podId, String podName, Type type, String zoneId, String zoneName) {
this.capacityTotal = capacityTotal;
this.capacityUsed = capacityUsed;
this.percentUsed = percentUsed;
@ -177,7 +178,7 @@ public class Capacity implements Comparable<Capacity> {
return percentUsed;
}
public long getPodId() {
public String getPodId() {
return podId;
}
@ -189,7 +190,7 @@ public class Capacity implements Comparable<Capacity> {
return type;
}
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -202,34 +203,24 @@ public class Capacity implements Comparable<Capacity> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Capacity capacity = (Capacity) o;
Capacity that = (Capacity) o;
if (capacityTotal != capacity.capacityTotal) return false;
if (capacityUsed != capacity.capacityUsed) return false;
if (Double.compare(capacity.percentUsed, percentUsed) != 0) return false;
if (podId != capacity.podId) return false;
if (zoneId != capacity.zoneId) return false;
if (podName != null ? !podName.equals(capacity.podName) : capacity.podName != null) return false;
if (type != capacity.type) return false;
if (zoneName != null ? !zoneName.equals(capacity.zoneName) : capacity.zoneName != null) return false;
if (!Objects.equal(capacityTotal, that.capacityTotal)) return false;
if (!Objects.equal(capacityUsed, that.capacityUsed)) return false;
if (!Objects.equal(percentUsed, that.percentUsed)) return false;
if (!Objects.equal(podId, that.podId)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(podName, that.podName)) return false;
if (!Objects.equal(type, that.type)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
return true;
}
@Override
public int hashCode() {
int result;
long temp;
result = (int) (capacityTotal ^ (capacityTotal >>> 32));
result = 31 * result + (int) (capacityUsed ^ (capacityUsed >>> 32));
temp = percentUsed != +0.0d ? Double.doubleToLongBits(percentUsed) : 0L;
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + (int) (podId ^ (podId >>> 32));
result = 31 * result + (podName != null ? podName.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (zoneName != null ? zoneName.hashCode() : 0);
return result;
return Objects.hashCode(capacityTotal, capacityUsed, percentUsed, podId, podName,
type, zoneId, zoneName);
}
@Override
@ -248,9 +239,9 @@ public class Capacity implements Comparable<Capacity> {
@Override
public int compareTo(Capacity other) {
int comparison = Long.valueOf(this.zoneId).compareTo(other.zoneId);
int comparison = this.zoneId.compareTo(other.zoneId);
if (comparison != 0) return comparison;
comparison = Long.valueOf(this.podId).compareTo(other.podId);
comparison = this.podId.compareTo(other.podId);
if (comparison != 0) return comparison;
return Integer.valueOf(this.type.code).compareTo(other.type.code);
}

View File

@ -21,6 +21,7 @@ package org.jclouds.cloudstack.domain;
import static com.google.common.base.CaseFormat.UPPER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -56,18 +57,18 @@ public class Cluster implements Comparable<Cluster> {
}
public static class Builder {
private long id;
private String id;
private AllocationState allocationState;
private Host.ClusterType clusterType;
private String hypervisor;
private ManagedState managedState;
private String name;
private long podId;
private String podId;
private String podName;
private long zoneId;
private String zoneId;
private String zoneName;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -97,7 +98,7 @@ public class Cluster implements Comparable<Cluster> {
return this;
}
public Builder podId(long podId) {
public Builder podId(String podId) {
this.podId = podId;
return this;
}
@ -107,7 +108,7 @@ public class Cluster implements Comparable<Cluster> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -122,21 +123,21 @@ public class Cluster implements Comparable<Cluster> {
}
}
private long id;
private String id;
@SerializedName("allocationstate") private AllocationState allocationState;
@SerializedName("clustertype") private Host.ClusterType clusterType;
@SerializedName("hypervisortype") private String hypervisor;
@SerializedName("managedstate") private ManagedState managedState;
private String name;
@SerializedName("podid") private long podId;
@SerializedName("podid") private String podId;
@SerializedName("podname") private String podName;
@SerializedName("zoneid") private long zoneId;
@SerializedName("zoneid") private String zoneId;
@SerializedName("zonename") private String zoneName;
// Just for the serializer
Cluster() {}
public Cluster(long id, AllocationState allocationState, Host.ClusterType clusterType, String hypervisor, ManagedState managedState, String name, long podId, String podName, long zoneId, String zoneName) {
public Cluster(String id, AllocationState allocationState, Host.ClusterType clusterType, String hypervisor, ManagedState managedState, String name, String podId, String podName, String zoneId, String zoneName) {
this.id = id;
this.allocationState = allocationState;
this.clusterType = clusterType;
@ -149,7 +150,7 @@ public class Cluster implements Comparable<Cluster> {
this.zoneName = zoneName;
}
public long getId() {
public String getId() {
return id;
}
@ -173,7 +174,7 @@ public class Cluster implements Comparable<Cluster> {
return name;
}
public long getPodId() {
public String getPodId() {
return podId;
}
@ -181,7 +182,7 @@ public class Cluster implements Comparable<Cluster> {
return podName;
}
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -194,35 +195,26 @@ public class Cluster implements Comparable<Cluster> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Cluster cluster = (Cluster) o;
Cluster that = (Cluster) o;
if (id != cluster.id) return false;
if (podId != cluster.podId) return false;
if (zoneId != cluster.zoneId) return false;
if (allocationState != cluster.allocationState) return false;
if (clusterType != cluster.clusterType) return false;
if (hypervisor != null ? !hypervisor.equals(cluster.hypervisor) : cluster.hypervisor != null) return false;
if (managedState != cluster.managedState) return false;
if (name != null ? !name.equals(cluster.name) : cluster.name != null) return false;
if (podName != null ? !podName.equals(cluster.podName) : cluster.podName != null) return false;
if (zoneName != null ? !zoneName.equals(cluster.zoneName) : cluster.zoneName != null) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(podId, that.podId)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(allocationState, that.allocationState)) return false;
if (!Objects.equal(clusterType, that.clusterType)) return false;
if (!Objects.equal(hypervisor, that.hypervisor)) return false;
if (!Objects.equal(managedState, that.managedState)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(podName, that.podName)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (allocationState != null ? allocationState.hashCode() : 0);
result = 31 * result + (clusterType != null ? clusterType.hashCode() : 0);
result = 31 * result + (hypervisor != null ? hypervisor.hashCode() : 0);
result = 31 * result + (managedState != null ? managedState.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (int) (podId ^ (podId >>> 32));
result = 31 * result + (podName != null ? podName.hashCode() : 0);
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (zoneName != null ? zoneName.hashCode() : 0);
return result;
return Objects.hashCode(id, allocationState, clusterType, hypervisor, managedState, name, podId, podName,
zoneId, zoneName);
}
@Override
@ -243,6 +235,6 @@ public class Cluster implements Comparable<Cluster> {
@Override
public int compareTo(Cluster other) {
return Long.valueOf(this.id).compareTo(other.id);
return this.id.compareTo(other.id);
}
}

View File

@ -19,6 +19,8 @@
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
/**
* Representation of the API configuration entry response
*
@ -106,25 +108,17 @@ public class ConfigurationEntry implements Comparable<ConfigurationEntry> {
ConfigurationEntry that = (ConfigurationEntry) o;
if (category != null ? !category.equals(that.category) : that.category != null)
return false;
if (description != null ? !description.equals(that.description) : that.description != null)
return false;
if (name != null ? !name.equals(that.name) : that.name != null)
return false;
if (value != null ? !value.equals(that.value) : that.value != null)
return false;
if (!Objects.equal(category, that.category)) return false;
if (!Objects.equal(description, that.description)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(value, that.value)) return false;
return true;
}
@Override
public int hashCode() {
int result = category != null ? category.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (value != null ? value.hashCode() : 0);
return result;
return Objects.hashCode(category, description, name, value);
}
@Override

View File

@ -24,6 +24,7 @@ import java.util.Date;
import java.util.Set;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.google.gson.annotations.SerializedName;
@ -39,17 +40,17 @@ public class DiskOffering implements Comparable<DiskOffering> {
}
public static class Builder {
private long id;
private String id;
private String name;
private String displayText;
private Date created;
private String domain;
private long domainId;
private String domainId;
private int diskSize;
private boolean customized;
private Set<String> tags = ImmutableSet.of();
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -74,7 +75,7 @@ public class DiskOffering implements Comparable<DiskOffering> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -99,21 +100,21 @@ public class DiskOffering implements Comparable<DiskOffering> {
}
}
private long id;
private String id;
private String name;
@SerializedName("displaytext")
private String displayText;
private Date created;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("disksize")
private int diskSize;
@SerializedName("iscustomized")
private boolean customized;
private String tags;
public DiskOffering(long id, String name, String displayText, Date created, String domain, long domainId,
public DiskOffering(String id, String name, String displayText, Date created, String domain, String domainId,
int diskSize, boolean customized, Set<String> tags) {
this.id = id;
this.name = name;
@ -138,7 +139,7 @@ public class DiskOffering implements Comparable<DiskOffering> {
*
* @return the id of the disk offering
*/
public long getId() {
public String getId() {
return id;
}
@ -179,7 +180,7 @@ public class DiskOffering implements Comparable<DiskOffering> {
*
* @return the domain id of the disk offering
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -209,18 +210,7 @@ public class DiskOffering implements Comparable<DiskOffering> {
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((created == null) ? 0 : created.hashCode());
result = prime * result + (customized ? 1231 : 1237);
result = prime * result + diskSize;
result = prime * result + ((displayText == null) ? 0 : displayText.hashCode());
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
return result;
return Objects.hashCode(created, customized, diskSize, displayText, domain, domainId, id, name, tags);
}
@Override
@ -231,40 +221,18 @@ public class DiskOffering implements Comparable<DiskOffering> {
return false;
if (getClass() != obj.getClass())
return false;
DiskOffering other = (DiskOffering) obj;
if (created == null) {
if (other.created != null)
return false;
} else if (!created.equals(other.created))
return false;
if (customized != other.customized)
return false;
if (diskSize != other.diskSize)
return false;
if (displayText == null) {
if (other.displayText != null)
return false;
} else if (!displayText.equals(other.displayText))
return false;
if (domain == null) {
if (other.domain != null)
return false;
} else if (!domain.equals(other.domain))
return false;
if (domainId != other.domainId)
return false;
if (id != other.id)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (tags == null) {
if (other.tags != null)
return false;
} else if (!tags.equals(other.tags))
return false;
DiskOffering that = (DiskOffering) obj;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(customized, that.customized)) return false;
if (!Objects.equal(diskSize, that.diskSize)) return false;
if (!Objects.equal(displayText, that.displayText)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(tags, that.tags)) return false;
return true;
}
@ -285,7 +253,7 @@ public class DiskOffering implements Comparable<DiskOffering> {
@Override
public int compareTo(DiskOffering arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -19,6 +19,7 @@
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -34,15 +35,15 @@ public class Domain implements Comparable<Domain> {
public static class Builder {
private long id;
private String id;
private boolean hasChild;
private long level;
private String name;
private String networkDomain;
private long parentDomainId;
private String parentDomainId;
private String parentDomainName;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -67,7 +68,7 @@ public class Domain implements Comparable<Domain> {
return this;
}
public Builder parentDomainId(long parentDomainId) {
public Builder parentDomainId(String parentDomainId) {
this.parentDomainId = parentDomainId;
return this;
}
@ -87,7 +88,7 @@ public class Domain implements Comparable<Domain> {
Domain() {
}
private long id;
private String id;
@SerializedName("haschild")
private boolean hasChild;
private long level;
@ -95,12 +96,12 @@ public class Domain implements Comparable<Domain> {
@SerializedName("networkdomain")
private String networkDomain;
@SerializedName("parentdomainid")
private long parentDomainId;
private String parentDomainId;
@SerializedName("parentdomainname")
private String parentDomainName;
public Domain(long id, boolean hasChild, long level, String name, String networkDomain,
long parentDomainId, String parentDomainName) {
public Domain(String id, boolean hasChild, long level, String name, String networkDomain,
String parentDomainId, String parentDomainName) {
this.id = id;
this.hasChild = hasChild;
this.level = level;
@ -110,7 +111,7 @@ public class Domain implements Comparable<Domain> {
this.parentDomainName = parentDomainName;
}
public long getId() {
public String getId() {
return id;
}
@ -130,7 +131,7 @@ public class Domain implements Comparable<Domain> {
return networkDomain;
}
public long getParentDomainId() {
public String getParentDomainId() {
return parentDomainId;
}
@ -143,50 +144,40 @@ public class Domain implements Comparable<Domain> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Domain domain = (Domain) o;
Domain that = (Domain) o;
if (hasChild != domain.hasChild) return false;
if (id != domain.id) return false;
if (level != domain.level) return false;
if (parentDomainId != domain.parentDomainId) return false;
if (name != null ? !name.equals(domain.name) : domain.name != null)
return false;
if (networkDomain != null ? !networkDomain.equals(domain.networkDomain) : domain.networkDomain != null)
return false;
if (parentDomainName != null ? !parentDomainName.equals(domain.parentDomainName) : domain.parentDomainName != null)
return false;
if (!Objects.equal(hasChild, that.hasChild)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(level, that.level)) return false;
if (!Objects.equal(parentDomainId, that.parentDomainId)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(networkDomain, that.networkDomain)) return false;
if (!Objects.equal(parentDomainName, that.parentDomainName)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (hasChild ? 1 : 0);
result = 31 * result + (int) (level ^ (level >>> 32));
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (networkDomain != null ? networkDomain.hashCode() : 0);
result = 31 * result + (int) (parentDomainId ^ (parentDomainId >>> 32));
result = 31 * result + (parentDomainName != null ? parentDomainName.hashCode() : 0);
return result;
return Objects.hashCode(id, hasChild, level, name, networkDomain, parentDomainId, parentDomainName);
}
@Override
public String toString() {
return "Domain{" +
"id=" + id +
"id='" + id + '\'' +
", hasChild=" + hasChild +
", level=" + level +
", name='" + name + '\'' +
", networkDomain='" + networkDomain + '\'' +
", parentDomainId=" + parentDomainId +
", parentDomainId='" + parentDomainId + '\'' +
", parentDomainName='" + parentDomainName + '\'' +
'}';
}
@Override
public int compareTo(Domain arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
/**
* @author Andrei Savu
*/
@ -52,18 +54,15 @@ public class EncryptedPasswordAndPrivateKey {
EncryptedPasswordAndPrivateKey that = (EncryptedPasswordAndPrivateKey) o;
if (encryptedPassword != null ? !encryptedPassword.equals(that.encryptedPassword) : that.encryptedPassword != null)
return false;
if (privateKey != null ? !privateKey.equals(that.privateKey) : that.privateKey != null) return false;
if (!Objects.equal(encryptedPassword, that.encryptedPassword)) return false;
if (!Objects.equal(privateKey, that.privateKey)) return false;
return true;
}
@Override
public int hashCode() {
int result = encryptedPassword != null ? encryptedPassword.hashCode() : 0;
result = 31 * result + (privateKey != null ? privateKey.hashCode() : 0);
return result;
return Objects.hashCode(encryptedPassword, privateKey);
}
@Override

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import java.util.Date;
/**
@ -30,12 +32,12 @@ public class Event implements Comparable<Event> {
}
public static class Builder {
private long id;
private String id;
private String account;
private String description;
private Date created;
private String domain;
private long domainId;
private String domainId;
//TODO Change to enum : the event level (INFO, WARN, ERROR)
private String level;
private String parentId;
@ -44,7 +46,7 @@ public class Event implements Comparable<Event> {
private String type;
private String username;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -69,7 +71,7 @@ public class Event implements Comparable<Event> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -105,12 +107,12 @@ public class Event implements Comparable<Event> {
}
private long id;
private String id;
private String account;
private String description;
private Date created;
private String domain;
private long domainId;
private String domainId;
//TODO Change to enum : the event level (INFO, WARN, ERROR)
private String level;
private String parentId;
@ -119,7 +121,7 @@ public class Event implements Comparable<Event> {
private String type;
private String username;
public Event(long id, String account, String description, Date created, String domain, long domainId, String level,
public Event(String id, String account, String description, Date created, String domain, String domainId, String level,
String parentId, String state, String type, String username) {
this.id = id;
this.account = account;
@ -144,7 +146,7 @@ public class Event implements Comparable<Event> {
/**
* @return the ID of the event
*/
public long getId() {
public String getId() {
return id;
}
@ -180,7 +182,7 @@ public class Event implements Comparable<Event> {
/**
* @return the id of the account's domain
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -222,7 +224,7 @@ public class Event implements Comparable<Event> {
@Override
public int compareTo(Event arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
@Override
@ -230,37 +232,26 @@ public class Event implements Comparable<Event> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Event event = (Event) o;
Event that = (Event) o;
if (domainId != event.domainId) return false;
if (id != event.id) return false;
if (account != null ? !account.equals(event.account) : event.account != null) return false;
if (created != null ? !created.equals(event.created) : event.created != null) return false;
if (description != null ? !description.equals(event.description) : event.description != null) return false;
if (domain != null ? !domain.equals(event.domain) : event.domain != null) return false;
if (level != null ? !level.equals(event.level) : event.level != null) return false;
if (parentId != null ? !parentId.equals(event.parentId) : event.parentId != null) return false;
if (state != null ? !state.equals(event.state) : event.state != null) return false;
if (type != null ? !type.equals(event.type) : event.type != null) return false;
if (username != null ? !username.equals(event.username) : event.username != null) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(description, that.description)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(level, that.level)) return false;
if (!Objects.equal(parentId, that.parentId)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(type, that.type)) return false;
if (!Objects.equal(username, that.username)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (account != null ? account.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (created != null ? created.hashCode() : 0);
result = 31 * result + (domain != null ? domain.hashCode() : 0);
result = 31 * result + (int) (domainId ^ (domainId >>> 32));
result = 31 * result + (level != null ? level.hashCode() : 0);
result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
result = 31 * result + (state != null ? state.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (username != null ? username.hashCode() : 0);
return result;
return Objects.hashCode(id, account, description, created, domain, domainId, level, parentId, state, type, username);
}
@Override

View File

@ -21,6 +21,7 @@ package org.jclouds.cloudstack.domain;
import java.util.Set;
import com.google.common.base.CaseFormat;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.gson.annotations.SerializedName;
@ -77,7 +78,7 @@ public class FirewallRule implements Comparable<FirewallRule> {
}
public static class Builder {
private long id;
private String id;
private Set<String> CIDRs;
private int startPort;
@ -87,12 +88,12 @@ public class FirewallRule implements Comparable<FirewallRule> {
private String icmpType;
private String ipAddress;
private long ipAddressId;
private String ipAddressId;
private Protocol protocol;
private State state;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -127,7 +128,7 @@ public class FirewallRule implements Comparable<FirewallRule> {
return this;
}
public Builder ipAddressId(long ipAddressId) {
public Builder ipAddressId(String ipAddressId) {
this.ipAddressId = ipAddressId;
return this;
}
@ -148,7 +149,7 @@ public class FirewallRule implements Comparable<FirewallRule> {
}
}
private long id;
private String id;
@SerializedName("cidrlist")
private Set<String> CIDRs;
@SerializedName("startport")
@ -162,12 +163,12 @@ public class FirewallRule implements Comparable<FirewallRule> {
@SerializedName("ipaddress")
private String ipAddress;
@SerializedName("ipaddressid")
private long ipAddressId;
private String ipAddressId;
private Protocol protocol;
private State state;
public FirewallRule(long id, Set<String> CIDRs, int startPort, int endPort,
String icmpCode, String icmpType, String ipAddress, long ipAddressId,
public FirewallRule(String id, Set<String> CIDRs, int startPort, int endPort,
String icmpCode, String icmpType, String ipAddress, String ipAddressId,
Protocol protocol, State state) {
this.id = id;
this.CIDRs = ImmutableSet.copyOf(CIDRs);
@ -183,10 +184,10 @@ public class FirewallRule implements Comparable<FirewallRule> {
@Override
public int compareTo(FirewallRule arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
public long getId() {
public String getId() {
return id;
}
@ -214,7 +215,7 @@ public class FirewallRule implements Comparable<FirewallRule> {
return ipAddress;
}
public long getIpAddressId() {
public String getIpAddressId() {
return ipAddressId;
}
@ -233,40 +234,23 @@ public class FirewallRule implements Comparable<FirewallRule> {
FirewallRule that = (FirewallRule) o;
if (endPort != that.endPort) return false;
if (id != that.id) return false;
if (startPort != that.startPort) return false;
if (CIDRs != null ? !CIDRs.equals(that.CIDRs) : that.CIDRs != null)
return false;
if (icmpCode != null ? !icmpCode.equals(that.icmpCode) : that.icmpCode != null)
return false;
if (icmpType != null ? !icmpType.equals(that.icmpType) : that.icmpType != null)
return false;
if (ipAddress != null ? !ipAddress.equals(that.ipAddress) : that.ipAddress != null)
return false;
if (ipAddressId != that.ipAddressId)
return false;
if (protocol != null ? !protocol.equals(that.protocol) : that.protocol != null)
return false;
if (state != null ? !state.equals(that.state) : that.state != null)
return false;
if (!Objects.equal(endPort, that.endPort)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(startPort, that.startPort)) return false;
if (!Objects.equal(CIDRs, that.CIDRs)) return false;
if (!Objects.equal(icmpCode, that.icmpCode)) return false;
if (!Objects.equal(icmpType, that.icmpType)) return false;
if (!Objects.equal(ipAddress, that.ipAddress)) return false;
if (!Objects.equal(ipAddressId, that.ipAddressId)) return false;
if (!Objects.equal(protocol, that.protocol)) return false;
if (!Objects.equal(state, that.state)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (CIDRs != null ? CIDRs.hashCode() : 0);
result = 31 * result + startPort;
result = 31 * result + endPort;
result = 31 * result + (icmpCode != null ? icmpCode.hashCode() : 0);
result = 31 * result + (icmpType != null ? icmpType.hashCode() : 0);
result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0);
result = 31 * result + (int) (ipAddressId ^ (ipAddressId >>> 32));
result = 31 * result + (protocol != null ? protocol.hashCode() : 0);
result = 31 * result + (state != null ? state.hashCode() : 0);
return result;
return Objects.hashCode(endPort, id, startPort, CIDRs, icmpCode, icmpType, ipAddress, ipAddressId, protocol, state);
}
@Override

View File

@ -23,6 +23,7 @@ import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import java.util.Date;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -120,11 +121,11 @@ public class Host implements Comparable<Host> {
}
public static class Builder {
private long id;
private String id;
private AllocationState allocationState;
private int averageLoad;
private String capabilities;
private long clusterId;
private String clusterId;
private String clusterName;
private ClusterType clusterType;
private String cpuAllocated;
@ -142,28 +143,28 @@ public class Host implements Comparable<Host> {
private String hypervisor;
private String ipAddress;
private boolean localStorageActive;
private long jobId;
private String jobId;
private AsyncJob.Status jobStatus;
private Date lastPinged;
private long managementServerId;
private String managementServerId;
private long memoryAllocated;
private long memoryTotal;
private long memoryUsed;
private String name;
private long networkKbsRead;
private long networkKbsWrite;
private long osCategoryId;
private long osCategoryName;
private long podId;
private String osCategoryId;
private String osCategoryName;
private String podId;
private String podName;
private Date removed;
private State state;
private Type type;
private String version;
private long zoneId;
private String zoneId;
private String zoneName;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -183,7 +184,7 @@ public class Host implements Comparable<Host> {
return this;
}
public Builder clusterId(long clusterId) {
public Builder clusterId(String clusterId) {
this.clusterId = clusterId;
return this;
}
@ -273,7 +274,7 @@ public class Host implements Comparable<Host> {
return this;
}
public Builder jobId(long jobId) {
public Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
@ -288,7 +289,7 @@ public class Host implements Comparable<Host> {
return this;
}
public Builder managementServerId(long managementServerId) {
public Builder managementServerId(String managementServerId) {
this.managementServerId = managementServerId;
return this;
}
@ -323,17 +324,17 @@ public class Host implements Comparable<Host> {
return this;
}
public Builder osCategoryId(long osCategoryId) {
public Builder osCategoryId(String osCategoryId) {
this.osCategoryId = osCategoryId;
return this;
}
public Builder osCategoryName(long osCategoryName) {
public Builder osCategoryName(String osCategoryName) {
this.osCategoryName = osCategoryName;
return this;
}
public Builder podId(long podId) {
public Builder podId(String podId) {
this.podId = podId;
return this;
}
@ -363,7 +364,7 @@ public class Host implements Comparable<Host> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -387,7 +388,7 @@ public class Host implements Comparable<Host> {
}
}
private long id;
private String id;
@SerializedName("allocationstate")
private AllocationState allocationState;
@SerializedName("averageload")
@ -395,7 +396,7 @@ public class Host implements Comparable<Host> {
@SerializedName("capabilities")
private String capabilities;
@SerializedName("clusterid")
private long clusterId;
private String clusterId;
@SerializedName("clustername")
private String clusterName;
@SerializedName("clustertype")
@ -427,13 +428,13 @@ public class Host implements Comparable<Host> {
@SerializedName("islocalstorageactive")
private boolean localStorageActive;
@SerializedName("jobid")
private long jobId;
private String jobId;
@SerializedName("jobstatus")
private AsyncJob.Status jobStatus;
@SerializedName("lastpinged")
private Date lastPinged;
@SerializedName("managementserverid")
private long managementServerId;
private String managementServerId;
@SerializedName("memoryallocated")
private long memoryAllocated;
@SerializedName("memorytotal")
@ -446,11 +447,11 @@ public class Host implements Comparable<Host> {
@SerializedName("networkkbswrite")
private long networkKbsWrite;
@SerializedName("oscategoryid")
private long osCategoryId;
private String osCategoryId;
@SerializedName("oscategoryname")
private long osCategoryName;
private String osCategoryName;
@SerializedName("podid")
private long podId;
private String podId;
@SerializedName("podname")
private String podName;
private Date removed;
@ -458,7 +459,7 @@ public class Host implements Comparable<Host> {
private Type type;
private String version;
@SerializedName("zoneid")
private long zoneId;
private String zoneId;
@SerializedName("zonename")
private String zoneName;
@ -466,16 +467,16 @@ public class Host implements Comparable<Host> {
Host() {
}
public Host(long id, AllocationState allocationState, int averageLoad, String capabilities,
long clusterId, String clusterName, ClusterType clusterType, String cpuAllocated,
public Host(String id, AllocationState allocationState, int averageLoad, String capabilities,
String clusterId, String clusterName, ClusterType clusterType, String cpuAllocated,
int cpuNumber, int cpuSpeed, String cpuUsed, float cpuWithOverProvisioning,
Date created, Date disconnected, long diskSizeAllocated, long diskSizeTotal,
String events, boolean hasEnoughCapacity, String hostTags, String hypervisor,
String ipAddress, boolean localStorageActive, long jobId, AsyncJob.Status jobStatus,
Date lastPinged, long managementServerId, long memoryAllocated, long memoryTotal,
String ipAddress, boolean localStorageActive, String jobId, AsyncJob.Status jobStatus,
Date lastPinged, String managementServerId, long memoryAllocated, long memoryTotal,
long memoryUsed, String name, long networkKbsRead, long networkKbsWrite,
long osCategoryId, long osCategoryName, long podId, String podName, Date removed,
State state, Type type, String version, long zoneId, String zoneName) {
String osCategoryId, String osCategoryName, String podId, String podName, Date removed,
State state, Type type, String version, String zoneId, String zoneName) {
this.id = id;
this.allocationState = allocationState;
this.averageLoad = averageLoad;
@ -520,7 +521,7 @@ public class Host implements Comparable<Host> {
this.zoneName = zoneName;
}
public long getId() {
public String getId() {
return id;
}
@ -536,7 +537,7 @@ public class Host implements Comparable<Host> {
return capabilities;
}
public long getClusterId() {
public String getClusterId() {
return clusterId;
}
@ -608,7 +609,7 @@ public class Host implements Comparable<Host> {
return localStorageActive;
}
public long getJobId() {
public String getJobId() {
return jobId;
}
@ -620,7 +621,7 @@ public class Host implements Comparable<Host> {
return lastPinged;
}
public long getManagementServerId() {
public String getManagementServerId() {
return managementServerId;
}
@ -648,15 +649,15 @@ public class Host implements Comparable<Host> {
return networkKbsWrite;
}
public long getOsCategoryId() {
public String getOsCategoryId() {
return osCategoryId;
}
public long getOsCategoryName() {
public String getOsCategoryName() {
return osCategoryName;
}
public long getPodId() {
public String getPodId() {
return podId;
}
@ -680,7 +681,7 @@ public class Host implements Comparable<Host> {
return version;
}
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -693,101 +694,64 @@ public class Host implements Comparable<Host> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Host host = (Host) o;
Host that = (Host) o;
if (averageLoad != host.averageLoad) return false;
if (clusterId != host.clusterId) return false;
if (cpuNumber != host.cpuNumber) return false;
if (cpuSpeed != host.cpuSpeed) return false;
if (Float.compare(host.cpuWithOverProvisioning, cpuWithOverProvisioning) != 0) return false;
if (diskSizeAllocated != host.diskSizeAllocated) return false;
if (diskSizeTotal != host.diskSizeTotal) return false;
if (hasEnoughCapacity != host.hasEnoughCapacity) return false;
if (id != host.id) return false;
if (jobId != host.jobId) return false;
if (localStorageActive != host.localStorageActive) return false;
if (managementServerId != host.managementServerId) return false;
if (memoryAllocated != host.memoryAllocated) return false;
if (memoryTotal != host.memoryTotal) return false;
if (memoryUsed != host.memoryUsed) return false;
if (networkKbsRead != host.networkKbsRead) return false;
if (networkKbsWrite != host.networkKbsWrite) return false;
if (osCategoryId != host.osCategoryId) return false;
if (osCategoryName != host.osCategoryName) return false;
if (podId != host.podId) return false;
if (zoneId != host.zoneId) return false;
if (allocationState != host.allocationState) return false;
if (capabilities != null ? !capabilities.equals(host.capabilities) : host.capabilities != null) return false;
if (clusterName != null ? !clusterName.equals(host.clusterName) : host.clusterName != null) return false;
if (clusterType != host.clusterType) return false;
if (cpuAllocated != null ? !cpuAllocated.equals(host.cpuAllocated) : host.cpuAllocated != null) return false;
if (cpuUsed != null ? !cpuUsed.equals(host.cpuUsed) : host.cpuUsed != null) return false;
if (created != null ? !created.equals(host.created) : host.created != null) return false;
if (disconnected != null ? !disconnected.equals(host.disconnected) : host.disconnected != null) return false;
if (events != null ? !events.equals(host.events) : host.events != null) return false;
if (hostTags != null ? !hostTags.equals(host.hostTags) : host.hostTags != null) return false;
if (hypervisor != null ? !hypervisor.equals(host.hypervisor) : host.hypervisor != null) return false;
if (ipAddress != null ? !ipAddress.equals(host.ipAddress) : host.ipAddress != null) return false;
if (jobStatus != host.jobStatus) return false;
if (lastPinged != null ? !lastPinged.equals(host.lastPinged) : host.lastPinged != null) return false;
if (name != null ? !name.equals(host.name) : host.name != null) return false;
if (podName != null ? !podName.equals(host.podName) : host.podName != null) return false;
if (removed != null ? !removed.equals(host.removed) : host.removed != null) return false;
if (state != host.state) return false;
if (type != host.type) return false;
if (version != null ? !version.equals(host.version) : host.version != null) return false;
if (zoneName != null ? !zoneName.equals(host.zoneName) : host.zoneName != null) return false;
if (!Objects.equal(averageLoad, that.averageLoad)) return false;
if (!Objects.equal(clusterId, that.clusterId)) return false;
if (!Objects.equal(cpuNumber, that.cpuNumber)) return false;
if (!Objects.equal(cpuSpeed, that.cpuSpeed)) return false;
if (!Objects.equal(cpuWithOverProvisioning, that.cpuWithOverProvisioning)) return false;
if (!Objects.equal(diskSizeAllocated, that.diskSizeAllocated)) return false;
if (!Objects.equal(diskSizeTotal, that.diskSizeTotal)) return false;
if (!Objects.equal(hasEnoughCapacity, that.hasEnoughCapacity)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(jobId, that.jobId)) return false;
if (!Objects.equal(localStorageActive, that.localStorageActive)) return false;
if (!Objects.equal(managementServerId, that.managementServerId)) return false;
if (!Objects.equal(memoryAllocated, that.memoryAllocated)) return false;
if (!Objects.equal(memoryTotal, that.memoryTotal)) return false;
if (!Objects.equal(memoryUsed, that.memoryUsed)) return false;
if (!Objects.equal(networkKbsRead, that.networkKbsRead)) return false;
if (!Objects.equal(networkKbsWrite, that.networkKbsWrite)) return false;
if (!Objects.equal(osCategoryId, that.osCategoryId)) return false;
if (!Objects.equal(osCategoryName, that.osCategoryName)) return false;
if (!Objects.equal(podId, that.podId)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(allocationState, that.allocationState)) return false;
if (!Objects.equal(capabilities, that.capabilities)) return false;
if (!Objects.equal(clusterName, that.clusterName)) return false;
if (!Objects.equal(clusterType, that.clusterType)) return false;
if (!Objects.equal(cpuAllocated, that.cpuAllocated)) return false;
if (!Objects.equal(cpuUsed, that.cpuUsed)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(disconnected, that.disconnected)) return false;
if (!Objects.equal(events, that.events)) return false;
if (!Objects.equal(hostTags, that.hostTags)) return false;
if (!Objects.equal(hypervisor, that.hypervisor)) return false;
if (!Objects.equal(ipAddress, that.ipAddress)) return false;
if (!Objects.equal(jobStatus, that.jobStatus)) return false;
if (!Objects.equal(lastPinged, that.lastPinged)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(podName, that.podName)) return false;
if (!Objects.equal(removed, that.removed)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(type, that.type)) return false;
if (!Objects.equal(version, that.version)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (allocationState != null ? allocationState.hashCode() : 0);
result = 31 * result + averageLoad;
result = 31 * result + (capabilities != null ? capabilities.hashCode() : 0);
result = 31 * result + (int) (clusterId ^ (clusterId >>> 32));
result = 31 * result + (clusterName != null ? clusterName.hashCode() : 0);
result = 31 * result + (clusterType != null ? clusterType.hashCode() : 0);
result = 31 * result + (cpuAllocated != null ? cpuAllocated.hashCode() : 0);
result = 31 * result + cpuNumber;
result = 31 * result + cpuSpeed;
result = 31 * result + (cpuUsed != null ? cpuUsed.hashCode() : 0);
result = 31 * result + (cpuWithOverProvisioning != +0.0f ? Float.floatToIntBits(cpuWithOverProvisioning) : 0);
result = 31 * result + (created != null ? created.hashCode() : 0);
result = 31 * result + (disconnected != null ? disconnected.hashCode() : 0);
result = 31 * result + (int) (diskSizeAllocated ^ (diskSizeAllocated >>> 32));
result = 31 * result + (int) (diskSizeTotal ^ (diskSizeTotal >>> 32));
result = 31 * result + (events != null ? events.hashCode() : 0);
result = 31 * result + (hasEnoughCapacity ? 1 : 0);
result = 31 * result + (hostTags != null ? hostTags.hashCode() : 0);
result = 31 * result + (hypervisor != null ? hypervisor.hashCode() : 0);
result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0);
result = 31 * result + (localStorageActive ? 1 : 0);
result = 31 * result + (int) (jobId ^ (jobId >>> 32));
result = 31 * result + (jobStatus != null ? jobStatus.hashCode() : 0);
result = 31 * result + (lastPinged != null ? lastPinged.hashCode() : 0);
result = 31 * result + (int) (managementServerId ^ (managementServerId >>> 32));
result = 31 * result + (int) (memoryAllocated ^ (memoryAllocated >>> 32));
result = 31 * result + (int) (memoryTotal ^ (memoryTotal >>> 32));
result = 31 * result + (int) (memoryUsed ^ (memoryUsed >>> 32));
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (int) (networkKbsRead ^ (networkKbsRead >>> 32));
result = 31 * result + (int) (networkKbsWrite ^ (networkKbsWrite >>> 32));
result = 31 * result + (int) (osCategoryId ^ (osCategoryId >>> 32));
result = 31 * result + (int) (osCategoryName ^ (osCategoryName >>> 32));
result = 31 * result + (int) (podId ^ (podId >>> 32));
result = 31 * result + (podName != null ? podName.hashCode() : 0);
result = 31 * result + (removed != null ? removed.hashCode() : 0);
result = 31 * result + (state != null ? state.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (version != null ? version.hashCode() : 0);
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (zoneName != null ? zoneName.hashCode() : 0);
return result;
return Objects.hashCode(averageLoad, clusterId, cpuNumber, cpuSpeed, cpuWithOverProvisioning, diskSizeAllocated,
diskSizeTotal, hasEnoughCapacity, id, jobId, localStorageActive, managementServerId,
memoryAllocated, memoryTotal, memoryUsed, networkKbsRead, networkKbsWrite, osCategoryId,
osCategoryName, podId, zoneId, allocationState, capabilities, clusterName, clusterType,
cpuAllocated, cpuUsed, created, disconnected, events, hostTags, hypervisor, ipAddress,
jobStatus, lastPinged, name, podName, removed, state, type, version, zoneName);
}
@Override
public String toString() {
return "Host{" +
@ -838,6 +802,6 @@ public class Host implements Comparable<Host> {
@Override
public int compareTo(Host other) {
return Long.valueOf(this.getId()).compareTo(other.getId());
return this.getId().compareTo(other.getId());
}
}

View File

@ -21,6 +21,7 @@ package org.jclouds.cloudstack.domain;
import java.util.Collections;
import java.util.Set;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.gson.annotations.SerializedName;
@ -34,22 +35,22 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
public static class Builder {
private long id;
private String id;
private String IPAddress;
private long IPAddressId;
private String IPAddressId;
private int startPort;
private String protocol;
public int endPort;
private String state;
private String virtualMachineDisplayName;
public long virtualMachineId;
public String virtualMachineId;
private String virtualMachineName;
private Set<String> CIDRs = ImmutableSet.of();
private int privateEndPort;
private int publicEndPort;
public int publicPort;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -59,7 +60,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return this;
}
public Builder IPAddressId(long IPAddressId) {
public Builder IPAddressId(String IPAddressId) {
this.IPAddressId = IPAddressId;
return this;
}
@ -89,7 +90,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return this;
}
public Builder virtualMachineId(long virtualMachineId) {
public Builder virtualMachineId(String virtualMachineId) {
this.virtualMachineId = virtualMachineId;
return this;
}
@ -125,11 +126,11 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
}
private long id;
private String id;
@SerializedName("ipaddress")
private String IPAddress;
@SerializedName("ipaddressid")
private long IPAddressId;
private String IPAddressId;
@SerializedName("startport")
private int startPort;
private String protocol;
@ -139,7 +140,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
@SerializedName("virtualmachinedisplayname")
private String virtualMachineDisplayName;
@SerializedName("virtualmachineid")
public long virtualMachineId;
public String virtualMachineId;
@SerializedName("virtualmachinename")
private String virtualMachineName;
@SerializedName("publicport")
@ -156,8 +157,8 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
public IPForwardingRule(long id, String iPAddress, long iPAddressId, int startPort, String protocol, int endPort,
String state, String virtualMachineDisplayName, long virtualMachineId, String virtualMachineName,
public IPForwardingRule(String id, String iPAddress, String iPAddressId, int startPort, String protocol, int endPort,
String state, String virtualMachineDisplayName, String virtualMachineId, String virtualMachineName,
int publicEndPort, int publicPort, Set<String> CIDRs, int privateEndPort) {
this.id = id;
this.IPAddress = iPAddress;
@ -178,13 +179,13 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
@Override
public int compareTo(IPForwardingRule arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
/**
* @return the ID of the ip forwarding rule
*/
public long getId() {
public String getId() {
return id;
}
@ -198,7 +199,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
/**
* @return the public ip address id for the ip forwarding rule
*/
public long getIPAddressId() {
public String getIPAddressId() {
return IPAddressId;
}
@ -240,7 +241,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
/**
* @return the VM ID for the ip forwarding rule
*/
public long getVirtualMachineId() {
public String getVirtualMachineId() {
return virtualMachineId;
}
@ -280,76 +281,34 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((IPAddress == null) ? 0 : IPAddress.hashCode());
result = prime * result + (int) (IPAddressId ^ (IPAddressId >>> 32));
result = prime * result + endPort;
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((protocol == null) ? 0 : protocol.hashCode());
result = prime * result + startPort;
result = prime * result + publicEndPort;
result = prime * result + privateEndPort;
result = prime * result + publicPort;
result = prime * result + ((state == null) ? 0 : state.hashCode());
result = prime * result + ((virtualMachineDisplayName == null) ? 0 : virtualMachineDisplayName.hashCode());
result = prime * result + (int) (virtualMachineId ^ (virtualMachineId >>> 32));
result = prime * result + ((virtualMachineName == null) ? 0 : virtualMachineName.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IPForwardingRule that = (IPForwardingRule) o;
if (!Objects.equal(IPAddress, that.IPAddress)) return false;
if (!Objects.equal(IPAddressId, that.IPAddressId)) return false;
if (!Objects.equal(endPort, that.endPort)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(protocol, that.protocol)) return false;
if (!Objects.equal(startPort, that.startPort)) return false;
if (!Objects.equal(publicEndPort, that.publicEndPort)) return false;
if (!Objects.equal(privateEndPort, that.privateEndPort)) return false;
if (!Objects.equal(publicPort, that.publicPort)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(virtualMachineDisplayName, that.virtualMachineDisplayName)) return false;
if (!Objects.equal(virtualMachineId, that.virtualMachineId)) return false;
if (!Objects.equal(virtualMachineName, that.virtualMachineName)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
IPForwardingRule other = (IPForwardingRule) obj;
if (IPAddress == null) {
if (other.IPAddress != null)
return false;
} else if (!IPAddress.equals(other.IPAddress))
return false;
if (IPAddressId != other.IPAddressId)
return false;
if (endPort != other.endPort)
return false;
if (publicPort != other.publicPort)
return false;
if (publicEndPort != other.publicEndPort)
return false;
if (privateEndPort != other.privateEndPort)
return false;
if (id != other.id)
return false;
if (protocol == null) {
if (other.protocol != null)
return false;
} else if (!protocol.equals(other.protocol))
return false;
if (startPort != other.startPort)
return false;
if (state == null) {
if (other.state != null)
return false;
} else if (!state.equals(other.state))
return false;
if (virtualMachineDisplayName == null) {
if (other.virtualMachineDisplayName != null)
return false;
} else if (!virtualMachineDisplayName.equals(other.virtualMachineDisplayName))
return false;
if (virtualMachineId != other.virtualMachineId)
return false;
if (virtualMachineName == null) {
if (other.virtualMachineName != null)
return false;
} else if (!virtualMachineName.equals(other.virtualMachineName))
return false;
return true;
public int hashCode() {
return Objects.hashCode(IPAddress, IPAddressId, endPort, id, protocol, startPort, publicEndPort,
privateEndPort, publicPort, state, virtualMachineDisplayName,
virtualMachineId, virtualMachineName);
}
@Override

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Date;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -35,43 +36,43 @@ public class ISO implements Comparable<ISO> {
public static class Builder {
private long id;
private String id;
private String account;
private long accountId;
private String accountId;
private boolean bootable;
private String checksum;
private Date created;
private boolean crossZones;
private String displayText;
private String domain;
private long domainid;
private String domainid;
private String format;
private long hostId;
private String hostId;
private String hostName;
private String hypervisor;
private boolean isExtractable;
private boolean isFeatured;
private boolean isPublic;
private boolean isReady;
private long jobId;
private String jobId;
private String jobStatus;
private String name;
private long osTypeId;
private String osTypeId;
private String osTypeName;
private boolean passwordEnabled;
private Date removed;
private long size;
private long sourceTemplateId;
private String sourceTemplateId;
private String status;
private String templateTag;
private String templateType;
private long zoneId;
private String zoneId;
private String zoneName;
/**
* @param id the template ID
*/
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -87,7 +88,7 @@ public class ISO implements Comparable<ISO> {
/**
* @param accountId the account id to which the template belongs
*/
public Builder accountId(long accountId) {
public Builder accountId(String accountId) {
this.accountId = accountId;
return this;
}
@ -143,7 +144,7 @@ public class ISO implements Comparable<ISO> {
/**
* @param domainid the ID of the domain to which the template belongs
*/
public Builder domainid(long domainid) {
public Builder domainid(String domainid) {
this.domainid = domainid;
return this;
}
@ -159,7 +160,7 @@ public class ISO implements Comparable<ISO> {
/**
* @param hostId the ID of the secondary storage host for the template
*/
public Builder hostId(long hostId) {
public Builder hostId(String hostId) {
this.hostId = hostId;
return this;
}
@ -215,7 +216,7 @@ public class ISO implements Comparable<ISO> {
/**
* @param jobId shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the template
*/
public Builder jobId(long jobId) {
public Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
@ -239,7 +240,7 @@ public class ISO implements Comparable<ISO> {
/**
* @param osTypeId the ID of the OS type for this template.
*/
public Builder osTypeId(long osTypeId) {
public Builder osTypeId(String osTypeId) {
this.osTypeId = osTypeId;
return this;
}
@ -279,7 +280,7 @@ public class ISO implements Comparable<ISO> {
/**
* @param sourceTemplateId the template ID of the parent template if present
*/
public Builder sourceTemplateId(long sourceTemplateId) {
public Builder sourceTemplateId(String sourceTemplateId) {
this.sourceTemplateId = sourceTemplateId;
return this;
}
@ -311,7 +312,7 @@ public class ISO implements Comparable<ISO> {
/**
* @param zoneId the ID of the zone for this template
*/
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -326,10 +327,10 @@ public class ISO implements Comparable<ISO> {
}
private long id;
private String id;
private String account;
@SerializedName("accountid")
private long accountId;
private String accountId;
private boolean bootable;
private String checksum;
private Date created;
@ -338,10 +339,10 @@ public class ISO implements Comparable<ISO> {
private String displayText;
private String domain;
@SerializedName("domainId")
private long domainid;
private String domainid;
private String format;
@SerializedName("hostid")
private long hostId;
private String hostId;
@SerializedName("hostname")
private String hostName;
private String hypervisor;
@ -354,12 +355,12 @@ public class ISO implements Comparable<ISO> {
@SerializedName("isready")
private boolean isReady;
@SerializedName("jobid")
private long jobId;
private String jobId;
@SerializedName("jobstatus")
private String jobStatus;
private String name;
@SerializedName("ostypeid")
private long osTypeId;
private String osTypeId;
@SerializedName("ostypename")
private String osTypeName;
@SerializedName("passwordenabled")
@ -367,14 +368,14 @@ public class ISO implements Comparable<ISO> {
private Date removed;
private long size;
@SerializedName("sourcetemplateid")
private long sourceTemplateId;
private String sourceTemplateId;
private String status;
@SerializedName("templatetag")
private String templateTag;
@SerializedName("templatetype")
private String templateType;
@SerializedName("zoneid")
private long zoneId;
private String zoneId;
@SerializedName("zonename")
private String zoneName;
@ -387,7 +388,7 @@ public class ISO implements Comparable<ISO> {
/**
* @return the template ID
*/
public long getId() {
public String getId() {
return id;
}
@ -401,7 +402,7 @@ public class ISO implements Comparable<ISO> {
/**
* @return the account id to which the template belongs
*/
public long getAccountId() {
public String getAccountId() {
return accountId;
}
@ -450,7 +451,7 @@ public class ISO implements Comparable<ISO> {
/**
* @return the ID of the domain to which the template belongs
*/
public long getDomainid() {
public String getDomainid() {
return domainid;
}
@ -464,7 +465,7 @@ public class ISO implements Comparable<ISO> {
/**
* @return the ID of the secondary storage host for the template
*/
public long getHostId() {
public String getHostId() {
return hostId;
}
@ -513,7 +514,7 @@ public class ISO implements Comparable<ISO> {
/**
* @return shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the template
*/
public long getJobId() {
public String getJobId() {
return jobId;
}
@ -534,7 +535,7 @@ public class ISO implements Comparable<ISO> {
/**
* @return the ID of the OS type for this template.
*/
public long getOsTypeId() {
public String getOsTypeId() {
return osTypeId;
}
@ -569,7 +570,7 @@ public class ISO implements Comparable<ISO> {
/**
* @return the template ID of the parent template if present
*/
public long getSourceTemplateId() {
public String getSourceTemplateId() {
return sourceTemplateId;
}
@ -597,7 +598,7 @@ public class ISO implements Comparable<ISO> {
/**
* @return the ID of the zone for this template
*/
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -613,79 +614,50 @@ public class ISO implements Comparable<ISO> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ISO iso = (ISO) o;
ISO that = (ISO) o;
if (accountId != iso.accountId) return false;
if (bootable != iso.bootable) return false;
if (crossZones != iso.crossZones) return false;
if (domainid != iso.domainid) return false;
if (hostId != iso.hostId) return false;
if (id != iso.id) return false;
if (isExtractable != iso.isExtractable) return false;
if (isFeatured != iso.isFeatured) return false;
if (isPublic != iso.isPublic) return false;
if (isReady != iso.isReady) return false;
if (jobId != iso.jobId) return false;
if (osTypeId != iso.osTypeId) return false;
if (passwordEnabled != iso.passwordEnabled) return false;
if (size != iso.size) return false;
if (sourceTemplateId != iso.sourceTemplateId) return false;
if (zoneId != iso.zoneId) return false;
if (account != null ? !account.equals(iso.account) : iso.account != null) return false;
if (checksum != null ? !checksum.equals(iso.checksum) : iso.checksum != null) return false;
if (created != null ? !created.equals(iso.created) : iso.created != null) return false;
if (displayText != null ? !displayText.equals(iso.displayText) : iso.displayText != null) return false;
if (domain != null ? !domain.equals(iso.domain) : iso.domain != null) return false;
if (format != null ? !format.equals(iso.format) : iso.format != null) return false;
if (hostName != null ? !hostName.equals(iso.hostName) : iso.hostName != null) return false;
if (hypervisor != null ? !hypervisor.equals(iso.hypervisor) : iso.hypervisor != null) return false;
if (jobStatus != null ? !jobStatus.equals(iso.jobStatus) : iso.jobStatus != null) return false;
if (name != null ? !name.equals(iso.name) : iso.name != null) return false;
if (osTypeName != null ? !osTypeName.equals(iso.osTypeName) : iso.osTypeName != null) return false;
if (removed != null ? !removed.equals(iso.removed) : iso.removed != null) return false;
if (status != null ? !status.equals(iso.status) : iso.status != null) return false;
if (templateTag != null ? !templateTag.equals(iso.templateTag) : iso.templateTag != null) return false;
if (templateType != null ? !templateType.equals(iso.templateType) : iso.templateType != null) return false;
if (zoneName != null ? !zoneName.equals(iso.zoneName) : iso.zoneName != null) return false;
if (!Objects.equal(accountId, that.accountId)) return false;
if (!Objects.equal(bootable, that.bootable)) return false;
if (!Objects.equal(crossZones, that.crossZones)) return false;
if (!Objects.equal(domainid, that.domainid)) return false;
if (!Objects.equal(hostId, that.hostId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(isExtractable, that.isExtractable)) return false;
if (!Objects.equal(isPublic, that.isPublic)) return false;
if (!Objects.equal(isReady, that.isReady)) return false;
if (!Objects.equal(jobId, that.jobId)) return false;
if (!Objects.equal(osTypeId, that.osTypeId)) return false;
if (!Objects.equal(passwordEnabled, that.passwordEnabled)) return false;
if (!Objects.equal(size, that.size)) return false;
if (!Objects.equal(sourceTemplateId, that.sourceTemplateId)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(checksum, that.checksum)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(displayText, that.displayText)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(format, that.format)) return false;
if (!Objects.equal(hostName, that.hostName)) return false;
if (!Objects.equal(hypervisor, that.hypervisor)) return false;
if (!Objects.equal(jobStatus, that.jobStatus)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(osTypeName, that.osTypeName)) return false;
if (!Objects.equal(removed, that.removed)) return false;
if (!Objects.equal(status, that.status)) return false;
if (!Objects.equal(templateTag, that.templateTag)) return false;
if (!Objects.equal(templateType, that.templateType)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (account != null ? account.hashCode() : 0);
result = 31 * result + (int) (accountId ^ (accountId >>> 32));
result = 31 * result + (bootable ? 1 : 0);
result = 31 * result + (checksum != null ? checksum.hashCode() : 0);
result = 31 * result + (created != null ? created.hashCode() : 0);
result = 31 * result + (crossZones ? 1 : 0);
result = 31 * result + (displayText != null ? displayText.hashCode() : 0);
result = 31 * result + (domain != null ? domain.hashCode() : 0);
result = 31 * result + (int) (domainid ^ (domainid >>> 32));
result = 31 * result + (format != null ? format.hashCode() : 0);
result = 31 * result + (int) (hostId ^ (hostId >>> 32));
result = 31 * result + (hostName != null ? hostName.hashCode() : 0);
result = 31 * result + (hypervisor != null ? hypervisor.hashCode() : 0);
result = 31 * result + (isExtractable ? 1 : 0);
result = 31 * result + (isFeatured ? 1 : 0);
result = 31 * result + (isPublic ? 1 : 0);
result = 31 * result + (isReady ? 1 : 0);
result = 31 * result + (int) (jobId ^ (jobId >>> 32));
result = 31 * result + (jobStatus != null ? jobStatus.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (int) (osTypeId ^ (osTypeId >>> 32));
result = 31 * result + (osTypeName != null ? osTypeName.hashCode() : 0);
result = 31 * result + (passwordEnabled ? 1 : 0);
result = 31 * result + (removed != null ? removed.hashCode() : 0);
result = 31 * result + (int) (size ^ (size >>> 32));
result = 31 * result + (int) (sourceTemplateId ^ (sourceTemplateId >>> 32));
result = 31 * result + (status != null ? status.hashCode() : 0);
result = 31 * result + (templateTag != null ? templateTag.hashCode() : 0);
result = 31 * result + (templateType != null ? templateType.hashCode() : 0);
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (zoneName != null ? zoneName.hashCode() : 0);
return result;
return Objects.hashCode(accountId, bootable, crossZones, domainid, hostId, id, isExtractable,
isPublic, isReady, jobId, osTypeId, passwordEnabled, size, sourceTemplateId,
zoneId, account, checksum, created, displayText, domain, format, hostName,
hypervisor, jobStatus, name, osTypeName, removed, status, templateTag,
templateType, zoneName);
}
@Override
@ -728,7 +700,7 @@ public class ISO implements Comparable<ISO> {
@Override
public int compareTo(ISO other) {
return new Long(id).compareTo(other.getId());
return id.compareTo(other.getId());
}
public enum ISOFilter {

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.domain;
import java.util.Date;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -33,10 +34,10 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
public static class Builder {
private long id;
private long accountId;
private String id;
private String accountId;
private Date created;
private long extractId;
private String extractId;
private ExtractMode extractMode;
private String name;
private String state;
@ -44,13 +45,13 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
private String storageType;
private int uploadPercentage;
private String url;
private long zoneId;
private String zoneId;
private String zoneName;
/**
* @param id the id of extracted object
*/
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -58,7 +59,7 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
/**
* @param accountId the account id to which the extracted object belongs
*/
public Builder accountId(long accountId) {
public Builder accountId(String accountId) {
this.accountId = accountId;
return this;
}
@ -74,7 +75,7 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
/**
* @param extractId the upload id of extracted object
*/
public Builder extractId(long extractId) {
public Builder extractId(String extractId) {
this.extractId = extractId;
return this;
}
@ -138,7 +139,7 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
/**
* @param zoneId zone ID the object was extracted from
*/
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -153,11 +154,11 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
}
private long id;
private String id;
@SerializedName("accountid")
private long accountId;
private String accountId;
private Date created;
private long extractId;
private String extractId;
private ExtractMode extractMode;
private String name;
private String state;
@ -168,7 +169,7 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
private int uploadPercentage;
private String url;
@SerializedName("zoneid")
private long zoneId;
private String zoneId;
@SerializedName("zonename")
private String zoneName;
@ -181,14 +182,14 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
/**
* @return the id of extracted object
*/
public long getId() {
public String getId() {
return id;
}
/**
* @return the account id to which the extracted object belongs
*/
public long getAccountId() {
public String getAccountId() {
return accountId;
}
@ -202,7 +203,7 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
/**
* @return the upload id of extracted object
*/
public long getExtractId() {
public String getExtractId() {
return extractId;
}
@ -258,7 +259,7 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
/**
* @return zone ID the object was extracted from
*/
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -276,39 +277,26 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
ISOExtraction that = (ISOExtraction) o;
if (accountId != that.accountId) return false;
if (extractId != that.extractId) return false;
if (id != that.id) return false;
if (uploadPercentage != that.uploadPercentage) return false;
if (zoneId != that.zoneId) return false;
if (created != null ? !created.equals(that.created) : that.created != null) return false;
if (extractMode != that.extractMode) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (state != null ? !state.equals(that.state) : that.state != null) return false;
if (status != null ? !status.equals(that.status) : that.status != null) return false;
if (storageType != null ? !storageType.equals(that.storageType) : that.storageType != null) return false;
if (url != null ? !url.equals(that.url) : that.url != null) return false;
if (zoneName != null ? !zoneName.equals(that.zoneName) : that.zoneName != null) return false;
if (!Objects.equal(accountId, that.accountId)) return false;
if (!Objects.equal(extractId, that.extractId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(uploadPercentage, that.uploadPercentage)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(extractMode, that.extractMode)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(status, that.status)) return false;
if (!Objects.equal(storageType, that.storageType)) return false;
if (!Objects.equal(url, that.url)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (int) (accountId ^ (accountId >>> 32));
result = 31 * result + (created != null ? created.hashCode() : 0);
result = 31 * result + (int) (extractId ^ (extractId >>> 32));
result = 31 * result + (extractMode != null ? extractMode.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (state != null ? state.hashCode() : 0);
result = 31 * result + (status != null ? status.hashCode() : 0);
result = 31 * result + (storageType != null ? storageType.hashCode() : 0);
result = 31 * result + uploadPercentage;
result = 31 * result + (url != null ? url.hashCode() : 0);
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (zoneName != null ? zoneName.hashCode() : 0);
return result;
return Objects.hashCode(accountId, extractId, id, uploadPercentage, zoneId, created, extractMode, name, state, status, storageType, url, zoneName);
}
@Override
@ -332,7 +320,7 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
@Override
public int compareTo(ISOExtraction other) {
return new Long(id).compareTo(other.getId());
return id.compareTo(other.getId());
}
}

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.domain;
import java.util.Set;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -33,15 +34,15 @@ public class ISOPermissions implements Comparable<ISOPermissions> {
public static class Builder {
private long id;
private String id;
private String account;
private long domainId;
private String domainId;
private boolean isPublic;
/**
* @param id the template ID
*/
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -57,7 +58,7 @@ public class ISOPermissions implements Comparable<ISOPermissions> {
/**
* @param domainId the ID of the domain to which the template belongs
*/
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -72,11 +73,11 @@ public class ISOPermissions implements Comparable<ISOPermissions> {
}
private long id;
private String id;
@SerializedName("account")
private Set<String> accounts;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("ispublic")
private boolean isPublic;
@ -89,7 +90,7 @@ public class ISOPermissions implements Comparable<ISOPermissions> {
/**
* @return the template ID
*/
public long getId() {
public String getId() {
return id;
}
@ -103,7 +104,7 @@ public class ISOPermissions implements Comparable<ISOPermissions> {
/**
* @return the ID of the domain to which the template belongs
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -115,37 +116,23 @@ public class ISOPermissions implements Comparable<ISOPermissions> {
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ISOPermissions other = (ISOPermissions) obj;
if (accounts == null) {
if (other.accounts != null)
return false;
} else if (!accounts.equals(other.accounts))
return false;
if (domainId != other.domainId)
return false;
if (id != other.id)
return false;
if (isPublic != other.isPublic)
return false;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ISOPermissions that = (ISOPermissions) o;
if (!Objects.equal(accounts, that.accounts)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(isPublic, that.isPublic)) return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((accounts == null) ? 0 : accounts.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + (isPublic ? 1231 : 1237);
return result;
return Objects.hashCode(accounts, domainId, id, isPublic);
}
@Override
@ -160,7 +147,7 @@ public class ISOPermissions implements Comparable<ISOPermissions> {
@Override
public int compareTo(ISOPermissions other) {
return new Long(id).compareTo(other.getId());
return id.compareTo(other.getId());
}
}

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.domain;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -38,7 +39,7 @@ public class IngressRule implements Comparable<IngressRule> {
private int ICMPCode = -1;
private int ICMPType = -1;
private String protocol;
private long id = -1;
private String id;
private String securityGroupName;
private int startPort = -1;
@ -72,7 +73,7 @@ public class IngressRule implements Comparable<IngressRule> {
return this;
}
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -103,7 +104,7 @@ public class IngressRule implements Comparable<IngressRule> {
private int ICMPType = -1;
private String protocol;
@SerializedName("ruleid")
private long id = -1;
private String id;
@SerializedName("securitygroupname")
private String securityGroupName;
@SerializedName("startport")
@ -114,7 +115,7 @@ public class IngressRule implements Comparable<IngressRule> {
}
public IngressRule(String account, String CIDR, int endPort, int iCMPCode, int iCMPType, String protocol, long id,
public IngressRule(String account, String CIDR, int endPort, int iCMPCode, int iCMPType, String protocol, String id,
String securityGroupName, int startPort) {
if (account == null)
checkArgument(securityGroupName == null && CIDR != null,
@ -178,7 +179,7 @@ public class IngressRule implements Comparable<IngressRule> {
/**
* @return the id of the ingress rule
*/
public long getId() {
public String getId() {
return id;
}
@ -197,61 +198,28 @@ public class IngressRule implements Comparable<IngressRule> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((CIDR == null) ? 0 : CIDR.hashCode());
result = prime * result + ICMPCode;
result = prime * result + ICMPType;
result = prime * result + ((account == null) ? 0 : account.hashCode());
result = prime * result + endPort;
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((protocol == null) ? 0 : protocol.hashCode());
result = prime * result + ((securityGroupName == null) ? 0 : securityGroupName.hashCode());
result = prime * result + startPort;
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IngressRule that = (IngressRule) o;
if (!Objects.equal(CIDR, that.CIDR)) return false;
if (!Objects.equal(ICMPCode, that.ICMPCode)) return false;
if (!Objects.equal(ICMPType, that.ICMPType)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(endPort, that.endPort)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(protocol, that.protocol)) return false;
if (!Objects.equal(securityGroupName, that.securityGroupName)) return false;
if (!Objects.equal(startPort, that.startPort)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
IngressRule other = (IngressRule) obj;
if (CIDR == null) {
if (other.CIDR != null)
return false;
} else if (!CIDR.equals(other.CIDR))
return false;
if (ICMPCode != other.ICMPCode)
return false;
if (ICMPType != other.ICMPType)
return false;
if (account == null) {
if (other.account != null)
return false;
} else if (!account.equals(other.account))
return false;
if (endPort != other.endPort)
return false;
if (id != other.id)
return false;
if (protocol == null) {
if (other.protocol != null)
return false;
} else if (!protocol.equals(other.protocol))
return false;
if (securityGroupName == null) {
if (other.securityGroupName != null)
return false;
} else if (!securityGroupName.equals(other.securityGroupName))
return false;
if (startPort != other.startPort)
return false;
return true;
public int hashCode() {
return Objects.hashCode(CIDR, ICMPCode, ICMPType, account, endPort, id, protocol, securityGroupName, startPort);
}
@Override
@ -271,6 +239,6 @@ public class IngressRule implements Comparable<IngressRule> {
@Override
public int compareTo(IngressRule arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -60,17 +61,15 @@ public class JobResult implements Comparable<JobResult> {
JobResult that = (JobResult) o;
if (success != that.success) return false;
if (displayText != null ? !displayText.equals(that.displayText) : that.displayText != null) return false;
if (!Objects.equal(success, that.success)) return false;
if (!Objects.equal(displayText, that.displayText)) return false;
return true;
}
@Override
public int hashCode() {
int result = (success ? 1 : 0);
result = 31 * result + (displayText != null ? displayText.hashCode() : 0);
return result;
return Objects.hashCode(success, displayText);
}
@Override

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Set;
import com.google.common.base.CaseFormat;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.gson.annotations.SerializedName;
@ -71,22 +72,22 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
}
public static class Builder {
private long id;
private String id;
private String account;
private Algorithm algorithm;
private String description;
private String domain;
private long domainId;
private String domainId;
private String name;
private int privatePort;
private String publicIP;
private long publicIPId;
private String publicIPId;
private int publicPort;
private State state;
private Set<String> CIDRs = ImmutableSet.of();
private long zoneId;
private String zoneId;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -111,7 +112,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -131,7 +132,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
return this;
}
public Builder publicIPId(long publicIPId) {
public Builder publicIPId(String publicIPId) {
this.publicIPId = publicIPId;
return this;
}
@ -151,7 +152,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -162,36 +163,36 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
}
}
private long id;
private String id;
private String account;
private Algorithm algorithm;
private String description;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
private String name;
@SerializedName("privateport")
private int privatePort;
@SerializedName("publicip")
private String publicIP;
@SerializedName("publicipid")
private long publicIPId;
private String publicIPId;
@SerializedName("publicport")
private int publicPort;
private State state;
@SerializedName("cidrlist")
private Set<String> CIDRs;
@SerializedName("zoneId")
private long zoneId;
private String zoneId;
// for deserializer
LoadBalancerRule() {
}
public LoadBalancerRule(long id, String account, Algorithm algorithm, String description, String domain,
long domainId, String name, int privatePort, String publicIP, long publicIPId, int publicPort, State state,
long zoneId, Set<String> CIDRs) {
public LoadBalancerRule(String id, String account, Algorithm algorithm, String description, String domain,
String domainId, String name, int privatePort, String publicIP, String publicIPId, int publicPort, State state,
String zoneId, Set<String> CIDRs) {
this.id = id;
this.account = account;
this.algorithm = algorithm;
@ -212,7 +213,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
/**
* @return the load balancer rule ID
*/
public long getId() {
public String getId() {
return id;
}
@ -247,7 +248,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
/**
* @return the domain ID of the load balancer rule
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -275,7 +276,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
/**
* @return the public ip address id
*/
public long getPublicIPId() {
public String getPublicIPId() {
return publicIPId;
}
@ -301,95 +302,45 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
}
/**
* @return the id of the zone the rule belongs to
* @return the id of the zone the rule beStrings to
*/
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@Override
public int compareTo(LoadBalancerRule arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LoadBalancerRule that = (LoadBalancerRule) o;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(algorithm, that.algorithm)) return false;
if (!Objects.equal(description, that.description)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(privatePort, that.privatePort)) return false;
if (!Objects.equal(publicIP, that.publicIP)) return false;
if (!Objects.equal(publicIPId, that.publicIPId)) return false;
if (!Objects.equal(publicPort, that.publicPort)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(state, that.state)) return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((account == null) ? 0 : account.hashCode());
result = prime * result + ((algorithm == null) ? 0 : algorithm.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + privatePort;
result = prime * result + ((publicIP == null) ? 0 : publicIP.hashCode());
result = prime * result + (int) (publicIPId ^ (publicIPId >>> 32));
result = prime * result + publicPort;
result = prime * result + (int) (zoneId ^ (zoneId >>> 32));
result = prime * result + ((state == null) ? 0 : state.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
LoadBalancerRule other = (LoadBalancerRule) obj;
if (account == null) {
if (other.account != null)
return false;
} else if (!account.equals(other.account))
return false;
if (algorithm == null) {
if (other.algorithm != null)
return false;
} else if (!algorithm.equals(other.algorithm))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (domain == null) {
if (other.domain != null)
return false;
} else if (!domain.equals(other.domain))
return false;
if (domainId != other.domainId)
return false;
if (zoneId != other.zoneId)
return false;
if (id != other.id)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (privatePort != other.privatePort)
return false;
if (publicIP == null) {
if (other.publicIP != null)
return false;
} else if (!publicIP.equals(other.publicIP))
return false;
if (publicIPId != other.publicIPId)
return false;
if (publicPort != other.publicPort)
return false;
if (state == null) {
if (other.state != null)
return false;
} else if (!state.equals(other.state))
return false;
return true;
return Objects.hashCode(account, algorithm, description, domain, domainId, id, name, privatePort, publicIP, publicIPId, publicPort, zoneId, state);
}
@Override

View File

@ -19,6 +19,7 @@
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -35,9 +36,9 @@ public class LoginResponse implements Comparable<LoginResponse> {
public static class Builder {
private String username;
private long userId;
private String userId;
private String password;
private long domainId;
private String domainId;
private long timeout;
private boolean registered;
private String accountName;
@ -72,7 +73,7 @@ public class LoginResponse implements Comparable<LoginResponse> {
return this;
}
public Builder userId(long userId) {
public Builder userId(String userId) {
this.userId = userId;
return this;
}
@ -82,7 +83,7 @@ public class LoginResponse implements Comparable<LoginResponse> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -145,10 +146,10 @@ public class LoginResponse implements Comparable<LoginResponse> {
private final String username;
@SerializedName("userid")
private final long userId;
private final String userId;
private final String password;
@SerializedName("domainid")
private final long domainId;
private final String domainId;
private final long timeout;
private final boolean registered;
@SerializedName("account")
@ -166,7 +167,7 @@ public class LoginResponse implements Comparable<LoginResponse> {
private final String sessionKey;
private final String jSessionId;
public LoginResponse(String username, long userId, String password, long domainId, long timeout, boolean registered,
public LoginResponse(String username, String userId, String password, String domainId, long timeout, boolean registered,
String accountName, String firstName, String lastName, Account.Type accountType, String timezone,
String timezoneOffset, String sessionKey, String jSessionId) {
this.username = username;
@ -189,7 +190,7 @@ public class LoginResponse implements Comparable<LoginResponse> {
return username;
}
public long getUserId() {
public String getUserId() {
return userId;
}
@ -197,7 +198,7 @@ public class LoginResponse implements Comparable<LoginResponse> {
return password;
}
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -242,94 +243,35 @@ public class LoginResponse implements Comparable<LoginResponse> {
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
LoginResponse other = (LoginResponse) obj;
if (accountName == null) {
if (other.accountName != null)
return false;
} else if (!accountName.equals(other.accountName))
return false;
if (accountType == null) {
if (other.accountType != null)
return false;
} else if (!accountType.equals(other.accountType))
return false;
if (domainId != other.domainId)
return false;
if (firstName == null) {
if (other.firstName != null)
return false;
} else if (!firstName.equals(other.firstName))
return false;
if (jSessionId == null) {
if (other.jSessionId != null)
return false;
} else if (!jSessionId.equals(other.jSessionId))
return false;
if (lastName == null) {
if (other.lastName != null)
return false;
} else if (!lastName.equals(other.lastName))
return false;
if (password == null) {
if (other.password != null)
return false;
} else if (!password.equals(other.password))
return false;
if (registered != other.registered)
return false;
if (sessionKey == null) {
if (other.sessionKey != null)
return false;
} else if (!sessionKey.equals(other.sessionKey))
return false;
if (timeout != other.timeout)
return false;
if (timezone == null) {
if (other.timezone != null)
return false;
} else if (!timezone.equals(other.timezone))
return false;
if (timezoneOffset == null) {
if (other.timezoneOffset != null)
return false;
} else if (!timezoneOffset.equals(other.timezoneOffset))
return false;
if (userId != other.userId)
return false;
if (username == null) {
if (other.username != null)
return false;
} else if (!username.equals(other.username))
return false;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LoginResponse that = (LoginResponse) o;
if (!Objects.equal(accountName, that.accountName)) return false;
if (!Objects.equal(accountType, that.accountType)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(firstName, that.firstName)) return false;
if (!Objects.equal(jSessionId, that.jSessionId)) return false;
if (!Objects.equal(lastName, that.lastName)) return false;
if (!Objects.equal(password, that.password)) return false;
if (!Objects.equal(registered, that.registered)) return false;
if (!Objects.equal(sessionKey, that.sessionKey)) return false;
if (!Objects.equal(timeout, that.timeout)) return false;
if (!Objects.equal(timezone, that.timezone)) return false;
if (!Objects.equal(timezoneOffset, that.timezoneOffset)) return false;
if (!Objects.equal(userId, that.userId)) return false;
if (!Objects.equal(username, that.username)) return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((accountName == null) ? 0 : accountName.hashCode());
result = prime * result + ((accountType == null) ? 0 : accountType.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result + ((jSessionId == null) ? 0 : jSessionId.hashCode());
result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result + ((password == null) ? 0 : password.hashCode());
result = prime * result + (registered ? 1231 : 1237);
result = prime * result + ((sessionKey == null) ? 0 : sessionKey.hashCode());
result = prime * result + (int) (timeout ^ (timeout >>> 32));
result = prime * result + ((timezone == null) ? 0 : timezone.hashCode());
result = prime * result + ((timezoneOffset == null) ? 0 : timezoneOffset.hashCode());
result = prime * result + (int) (userId ^ (userId >>> 32));
result = prime * result + ((username == null) ? 0 : username.hashCode());
return result;
return Objects.hashCode(accountName, accountType, domainId, firstName, jSessionId, lastName,
password, registered, sessionKey, timeout, timezone, timezoneOffset,
userId, username);
}
@Override

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.domain;
import java.net.URI;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -32,7 +33,7 @@ public class NIC {
}
public static class Builder {
private long id;
private String id;
private URI broadcastURI;
private String gateway;
private String IPAddress;
@ -40,11 +41,11 @@ public class NIC {
private URI isolationURI;
private String netmask;
private String macAddress;
private long networkId;
private String networkId;
private TrafficType trafficType;
private GuestIPType guestIPType;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -84,7 +85,7 @@ public class NIC {
return this;
}
public Builder networkId(long networkId) {
public Builder networkId(String networkId) {
this.networkId = networkId;
return this;
}
@ -106,7 +107,7 @@ public class NIC {
}
}
private long id;
private String id;
@SerializedName("broadcasturi")
private URI broadcastURI;
private String gateway;
@ -120,7 +121,7 @@ public class NIC {
@SerializedName("macaddress")
private String macAddress;
@SerializedName("networkid")
private long networkId;
private String networkId;
@SerializedName("traffictype")
private TrafficType trafficType;
@SerializedName("type")
@ -133,8 +134,8 @@ public class NIC {
}
public NIC(long id, URI broadcastURI, String gateway, String iPAddress, boolean isDefault, URI isolationURI,
String netmask, String macAddress, long networkId, TrafficType trafficType, GuestIPType guestIPType) {
public NIC(String id, URI broadcastURI, String gateway, String iPAddress, boolean isDefault, URI isolationURI,
String netmask, String macAddress, String networkId, TrafficType trafficType, GuestIPType guestIPType) {
this.id = id;
this.broadcastURI = broadcastURI;
this.gateway = gateway;
@ -151,7 +152,7 @@ public class NIC {
/**
* the ID of the nic
*/
public long getId() {
public String getId() {
return id;
}
@ -207,7 +208,7 @@ public class NIC {
/**
* the ID of the corresponding network
*/
public long getNetworkId() {
public String getNetworkId() {
return networkId;
}
@ -226,73 +227,30 @@ public class NIC {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((IPAddress == null) ? 0 : IPAddress.hashCode());
result = prime * result + ((broadcastURI == null) ? 0 : broadcastURI.hashCode());
result = prime * result + ((gateway == null) ? 0 : gateway.hashCode());
result = prime * result + ((guestIPType == null) ? 0 : guestIPType.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + (isDefault ? 1231 : 1237);
result = prime * result + ((isolationURI == null) ? 0 : isolationURI.hashCode());
result = prime * result + ((netmask == null) ? 0 : netmask.hashCode());
result = prime * result + ((macAddress == null) ? 0 : macAddress.hashCode());
result = prime * result + (int) (networkId ^ (networkId >>> 32));
result = prime * result + ((trafficType == null) ? 0 : trafficType.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NIC that = (NIC) o;
if (!Objects.equal(IPAddress, that.IPAddress)) return false;
if (!Objects.equal(broadcastURI, that.broadcastURI)) return false;
if (!Objects.equal(gateway, that.gateway)) return false;
if (!Objects.equal(guestIPType, that.guestIPType)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(isDefault, that.isDefault)) return false;
if (!Objects.equal(isolationURI, that.isolationURI)) return false;
if (!Objects.equal(netmask, that.netmask)) return false;
if (!Objects.equal(macAddress, that.macAddress)) return false;
if (!Objects.equal(networkId, that.networkId)) return false;
if (!Objects.equal(trafficType, that.trafficType)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NIC other = (NIC) obj;
if (IPAddress == null) {
if (other.IPAddress != null)
return false;
} else if (!IPAddress.equals(other.IPAddress))
return false;
if (broadcastURI == null) {
if (other.broadcastURI != null)
return false;
} else if (!broadcastURI.equals(other.broadcastURI))
return false;
if (gateway == null) {
if (other.gateway != null)
return false;
} else if (!gateway.equals(other.gateway))
return false;
if (guestIPType != other.guestIPType)
return false;
if (id != other.id)
return false;
if (isDefault != other.isDefault)
return false;
if (isolationURI == null) {
if (other.isolationURI != null)
return false;
} else if (!isolationURI.equals(other.isolationURI))
return false;
if (netmask == null) {
if (other.netmask != null)
return false;
} else if (!netmask.equals(other.netmask))
return false;
if (macAddress == null) {
if (other.macAddress != null)
return false;
} else if (!macAddress.equals(other.macAddress))
return false;
if (networkId != other.networkId)
return false;
if (trafficType != other.trafficType)
return false;
return true;
public int hashCode() {
return Objects.hashCode(IPAddress, broadcastURI, gateway, guestIPType, id, isDefault, isolationURI, netmask, macAddress, networkId, trafficType);
}
@Override

View File

@ -28,6 +28,7 @@ import java.util.SortedSet;
import javax.annotation.Nullable;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -43,7 +44,7 @@ public class Network implements Comparable<Network> {
}
public static class Builder {
private long id;
private String id;
private String broadcastDomainType;
private URI broadcastURI;
private String displayText;
@ -58,24 +59,24 @@ public class Network implements Comparable<Network> {
private String networkDomain;
private String networkOfferingAvailability;
private String networkOfferingDisplayText;
private long networkOfferingId;
private String networkOfferingId;
private String networkOfferingName;
private long related;
private String related;
private String startIP;
private String name;
private String state;
private GuestIPType guestIPType;
private String VLAN;
private TrafficType trafficType;
private long zoneId;
private String zoneId;
private Set<? extends NetworkService> services = ImmutableSet.<NetworkService>of();
private String account;
private long domainId;
private String domainId;
private boolean securityGroupEnabled;
private Set<String> tags = ImmutableSet.of();
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -85,7 +86,7 @@ public class Network implements Comparable<Network> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -160,7 +161,7 @@ public class Network implements Comparable<Network> {
return this;
}
public Builder networkOfferingId(long networkOfferingId) {
public Builder networkOfferingId(String networkOfferingId) {
this.networkOfferingId = networkOfferingId;
return this;
}
@ -170,7 +171,7 @@ public class Network implements Comparable<Network> {
return this;
}
public Builder related(long related) {
public Builder related(String related) {
this.related = related;
return this;
}
@ -205,7 +206,7 @@ public class Network implements Comparable<Network> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -233,7 +234,7 @@ public class Network implements Comparable<Network> {
}
}
private long id;
private String id;
private String account;
@SerializedName("broadcastdomaintype")
private String broadcastDomainType;
@ -247,7 +248,7 @@ public class Network implements Comparable<Network> {
private String DNS2;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("endip")
private String endIP;
private String gateway;
@ -266,10 +267,10 @@ public class Network implements Comparable<Network> {
@SerializedName("networkofferingdisplaytext")
private String networkOfferingDisplayText;
@SerializedName("networkofferingid")
private long networkOfferingId;
private String networkOfferingId;
@SerializedName("networkofferingname")
private String networkOfferingName;
private long related;
private String related;
@SerializedName("startip")
private String startIP;
private String name;
@ -281,7 +282,7 @@ public class Network implements Comparable<Network> {
@SerializedName("traffictype")
private TrafficType trafficType;
@SerializedName("zoneid")
private long zoneId;
private String zoneId;
private String tags;
@SerializedName("securitygroupenabled")
private boolean securityGroupEnabled;
@ -296,12 +297,12 @@ public class Network implements Comparable<Network> {
}
public Network(long id, String broadcastDomainType, URI broadcastURI, String displayText,
List<String> DNS, String domain, long domainId, String endIP, String gateway, boolean isDefault,
public Network(String id, String broadcastDomainType, URI broadcastURI, String displayText,
List<String> DNS, String domain, String domainId, String endIP, String gateway, boolean isDefault,
boolean isShared, boolean isSystem, String netmask, String networkDomain, String networkOfferingAvailability,
String networkOfferingDisplayText, long networkOfferingId, String networkOfferingName, long related,
String networkOfferingDisplayText, String networkOfferingId, String networkOfferingName, String related,
String startIP, String name, String state, GuestIPType type, String vLAN, TrafficType trafficType,
long zoneId, Set<? extends NetworkService> services, Set<String> tags, boolean securityGroupEnabled,
String zoneId, Set<? extends NetworkService> services, Set<String> tags, boolean securityGroupEnabled,
String account) {
this.id = id;
this.broadcastDomainType = broadcastDomainType;
@ -339,7 +340,7 @@ public class Network implements Comparable<Network> {
/**
* @return network id
*/
public long getId() {
public String getId() {
return id;
}
@ -386,7 +387,7 @@ public class Network implements Comparable<Network> {
/**
* @return the domain id of the Network
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -498,7 +499,7 @@ public class Network implements Comparable<Network> {
/**
* @return network offering id the network is created from
*/
public long getNetworkOfferingId() {
public String getNetworkOfferingId() {
return networkOfferingId;
}
@ -512,7 +513,7 @@ public class Network implements Comparable<Network> {
/**
* @return related to what other network configuration
*/
public long getRelated() {
public String getRelated() {
return related;
}
@ -526,7 +527,7 @@ public class Network implements Comparable<Network> {
/**
* @return zone id of the network
*/
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -552,166 +553,52 @@ public class Network implements Comparable<Network> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((DNS1 == null) ? 0 : DNS1.hashCode());
result = prime * result + ((DNS2 == null) ? 0 : DNS2.hashCode());
result = prime * result + ((VLAN == null) ? 0 : VLAN.hashCode());
result = prime * result + ((broadcastDomainType == null) ? 0 : broadcastDomainType.hashCode());
result = prime * result + ((broadcastURI == null) ? 0 : broadcastURI.hashCode());
result = prime * result + ((displayText == null) ? 0 : displayText.hashCode());
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + ((endIP == null) ? 0 : endIP.hashCode());
result = prime * result + ((gateway == null) ? 0 : gateway.hashCode());
result = prime * result + ((guestIPType == null) ? 0 : guestIPType.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + (isDefault ? 1231 : 1237);
result = prime * result + (isShared ? 1231 : 1237);
result = prime * result + (isSystem ? 1231 : 1237);
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((netmask == null) ? 0 : netmask.hashCode());
result = prime * result + ((networkDomain == null) ? 0 : networkDomain.hashCode());
result = prime * result + ((networkOfferingAvailability == null) ? 0 : networkOfferingAvailability.hashCode());
result = prime * result + ((networkOfferingDisplayText == null) ? 0 : networkOfferingDisplayText.hashCode());
result = prime * result + (int) (networkOfferingId ^ (networkOfferingId >>> 32));
result = prime * result + ((networkOfferingName == null) ? 0 : networkOfferingName.hashCode());
result = prime * result + (int) (related ^ (related >>> 32));
result = prime * result + ((services == null) ? 0 : services.hashCode());
result = prime * result + ((startIP == null) ? 0 : startIP.hashCode());
result = prime * result + ((state == null) ? 0 : state.hashCode());
result = prime * result + ((trafficType == null) ? 0 : trafficType.hashCode());
result = prime * result + (int) (zoneId ^ (zoneId >>> 32));
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Network that = (Network) o;
if (!Objects.equal(DNS1, that.DNS1)) return false;
if (!Objects.equal(DNS2, that.DNS2)) return false;
if (!Objects.equal(VLAN, that.VLAN)) return false;
if (!Objects.equal(broadcastDomainType, that.broadcastDomainType)) return false;
if (!Objects.equal(broadcastURI, that.broadcastURI)) return false;
if (!Objects.equal(displayText, that.displayText)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(endIP, that.endIP)) return false;
if (!Objects.equal(gateway, that.gateway)) return false;
if (!Objects.equal(guestIPType, that.guestIPType)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(isDefault, that.isDefault)) return false;
if (!Objects.equal(isShared, that.isShared)) return false;
if (!Objects.equal(isSystem, that.isSystem)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(netmask, that.netmask)) return false;
if (!Objects.equal(networkDomain, that.networkDomain)) return false;
if (!Objects.equal(networkOfferingAvailability, that.networkOfferingAvailability)) return false;
if (!Objects.equal(networkOfferingDisplayText, that.networkOfferingDisplayText)) return false;
if (!Objects.equal(networkOfferingId, that.networkOfferingId)) return false;
if (!Objects.equal(networkOfferingName, that.networkOfferingName)) return false;
if (!Objects.equal(related, that.related)) return false;
if (!Objects.equal(services, that.services)) return false;
if (!Objects.equal(startIP, that.startIP)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(trafficType, that.trafficType)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(tags, that.tags)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Network other = (Network) obj;
if (DNS1 == null) {
if (other.DNS1 != null)
return false;
} else if (!DNS1.equals(other.DNS1))
return false;
if (DNS2 == null) {
if (other.DNS2 != null)
return false;
} else if (!DNS2.equals(other.DNS2))
return false;
if (VLAN == null) {
if (other.VLAN != null)
return false;
} else if (!VLAN.equals(other.VLAN))
return false;
if (broadcastDomainType == null) {
if (other.broadcastDomainType != null)
return false;
} else if (!broadcastDomainType.equals(other.broadcastDomainType))
return false;
if (broadcastURI == null) {
if (other.broadcastURI != null)
return false;
} else if (!broadcastURI.equals(other.broadcastURI))
return false;
if (displayText == null) {
if (other.displayText != null)
return false;
} else if (!displayText.equals(other.displayText))
return false;
if (domain == null) {
if (other.domain != null)
return false;
} else if (!domain.equals(other.domain))
return false;
if (endIP == null) {
if (other.endIP != null)
return false;
} else if (!endIP.equals(other.endIP))
return false;
if (gateway == null) {
if (other.gateway != null)
return false;
} else if (!gateway.equals(other.gateway))
return false;
if (guestIPType != other.guestIPType)
return false;
if (id != other.id)
return false;
if (isDefault != other.isDefault)
return false;
if (isShared != other.isShared)
return false;
if (isSystem != other.isSystem)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (netmask == null) {
if (other.netmask != null)
return false;
} else if (!netmask.equals(other.netmask))
return false;
if (networkDomain == null) {
if (other.networkDomain != null)
return false;
} else if (!networkDomain.equals(other.networkDomain))
return false;
if (networkOfferingAvailability == null) {
if (other.networkOfferingAvailability != null)
return false;
} else if (!networkOfferingAvailability.equals(other.networkOfferingAvailability))
return false;
if (networkOfferingDisplayText == null) {
if (other.networkOfferingDisplayText != null)
return false;
} else if (!networkOfferingDisplayText.equals(other.networkOfferingDisplayText))
return false;
if (networkOfferingId != other.networkOfferingId)
return false;
if (networkOfferingName == null) {
if (other.networkOfferingName != null)
return false;
} else if (!networkOfferingName.equals(other.networkOfferingName))
return false;
if (related != other.related)
return false;
if (services == null) {
if (other.services != null)
return false;
} else if (!services.equals(other.services))
return false;
if (startIP == null) {
if (other.startIP != null)
return false;
} else if (!startIP.equals(other.startIP))
return false;
if (state == null) {
if (other.state != null)
return false;
} else if (!state.equals(other.state))
return false;
if (trafficType != other.trafficType)
return false;
if (zoneId != other.zoneId)
return false;
if (tags == null) {
if (other.tags != null)
return false;
} else if (!tags.equals(other.tags))
return false;
if (domainId != other.domainId)
return false;
return true;
public int hashCode() {
return Objects.hashCode(DNS1, DNS2, VLAN, broadcastDomainType, broadcastURI, displayText, domain,
endIP, gateway, guestIPType, id, isDefault, isShared, isSystem, name,
netmask, networkDomain, networkOfferingAvailability, networkOfferingDisplayText,
networkOfferingId, networkOfferingName, related, services, startIP, state,
trafficType, zoneId, tags, domainId);
}
@Override
@ -753,6 +640,6 @@ public class Network implements Comparable<Network> {
@Override
public int compareTo(Network arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -26,6 +26,7 @@ import java.util.Set;
import javax.annotation.Nullable;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.google.gson.annotations.SerializedName;
@ -40,7 +41,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
}
public static class Builder {
private long id;
private String id;
private String name;
private String displayText;
private Date created;
@ -53,7 +54,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
private GuestIPType guestIPType;
private Set<String> tags = ImmutableSet.of();
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -119,7 +120,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
}
}
private long id;
private String id;
private String name;
@SerializedName("displaytext")
private String displayText;
@ -140,7 +141,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
private int networkRate = -1;
private String tags;
public NetworkOffering(long id, String name, String displayText, @Nullable Date created,
public NetworkOffering(String id, String name, String displayText, @Nullable Date created,
NetworkOfferingAvailabilityType availability, boolean supportsVLAN, @Nullable Integer maxConnections,
boolean isDefault, TrafficType trafficType, GuestIPType guestIPType, int networkRate, Set<String> tags) {
this.id = id;
@ -169,7 +170,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
*
* @return the id of the network offering
*/
public long getId() {
public String getId() {
return id;
}
@ -266,70 +267,29 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((availability == null) ? 0 : availability.hashCode());
result = prime * result + ((created == null) ? 0 : created.hashCode());
result = prime * result + ((displayText == null) ? 0 : displayText.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + (isDefault ? 1231 : 1237);
result = prime * result + ((maxConnections == null) ? 0 : maxConnections.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + (supportsVLAN ? 1231 : 1237);
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
result = prime * result + ((trafficType == null) ? 0 : trafficType.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NetworkOffering that = (NetworkOffering) o;
if (!Objects.equal(availability, that.availability)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(displayText, that.displayText)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(isDefault, that.isDefault)) return false;
if (!Objects.equal(maxConnections, that.maxConnections)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(supportsVLAN, that.supportsVLAN)) return false;
if (!Objects.equal(tags, that.tags)) return false;
if (!Objects.equal(trafficType, that.trafficType)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NetworkOffering other = (NetworkOffering) obj;
if (availability == null) {
if (other.availability != null)
return false;
} else if (!availability.equals(other.availability))
return false;
if (created == null) {
if (other.created != null)
return false;
} else if (!created.equals(other.created))
return false;
if (displayText == null) {
if (other.displayText != null)
return false;
} else if (!displayText.equals(other.displayText))
return false;
if (id != other.id)
return false;
if (isDefault != other.isDefault)
return false;
if (maxConnections == null) {
if (other.maxConnections != null)
return false;
} else if (!maxConnections.equals(other.maxConnections))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (supportsVLAN != other.supportsVLAN)
return false;
if (tags == null) {
if (other.tags != null)
return false;
} else if (!tags.equals(other.tags))
return false;
if (trafficType != other.trafficType)
return false;
return true;
public int hashCode() {
return Objects.hashCode(availability, created, displayText, id, isDefault, maxConnections, name, supportsVLAN, tags, trafficType);
}
@Override
@ -352,7 +312,7 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
@Override
public int compareTo(NetworkOffering arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -24,6 +24,7 @@ import java.util.Map;
import java.util.SortedSet;
import java.util.Map.Entry;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.ImmutableSortedSet;
@ -51,34 +52,21 @@ public class NetworkService implements Comparable<NetworkService> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NetworkService.Capability that = (NetworkService.Capability) o;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(value, that.value)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NetworkService.Capability other = (NetworkService.Capability) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
public int hashCode() {
return Objects.hashCode(name, value);
}
@Override
@ -128,34 +116,21 @@ public class NetworkService implements Comparable<NetworkService> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((capabilities == null) ? 0 : capabilities.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NetworkService that = (NetworkService) o;
if (!Objects.equal(capabilities, that.capabilities)) return false;
if (!Objects.equal(name, that.name)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NetworkService other = (NetworkService) obj;
if (capabilities == null) {
if (other.capabilities != null)
return false;
} else if (!capabilities.equals(other.capabilities))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
public int hashCode() {
return Objects.hashCode(capabilities, name);
}
@Override

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -31,16 +32,16 @@ public class OSType implements Comparable<OSType> {
}
public static class Builder {
private long id;
private long OSCategoryId;
private String id;
private String OSCategoryId;
private String description;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
public Builder OSCategoryId(long OSCategoryId) {
public Builder OSCategoryId(String OSCategoryId) {
this.OSCategoryId = OSCategoryId;
return this;
}
@ -60,12 +61,12 @@ public class OSType implements Comparable<OSType> {
}
private long id;
private String id;
@SerializedName("oscategoryid")
private long OSCategoryId;
private String OSCategoryId;
private String description;
public OSType(long id, long OSCategoryId, String description) {
public OSType(String id, String OSCategoryId, String description) {
this.id = id;
this.OSCategoryId = OSCategoryId;
this.description = description;
@ -74,14 +75,14 @@ public class OSType implements Comparable<OSType> {
/**
* @return the ID of the OS type
*/
public long getId() {
public String getId() {
return id;
}
/**
* @return the ID of the OS category
*/
public long getOSCategoryId() {
public String getOSCategoryId() {
return OSCategoryId;
}
@ -93,34 +94,22 @@ public class OSType implements Comparable<OSType> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (OSCategoryId ^ (OSCategoryId >>> 32));
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OSType that = (OSType) o;
if (!Objects.equal(OSCategoryId, that.OSCategoryId)) return false;
if (!Objects.equal(description, that.description)) return false;
if (!Objects.equal(id, that.id)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OSType other = (OSType) obj;
if (OSCategoryId != other.OSCategoryId)
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (id != other.id)
return false;
return true;
public int hashCode() {
return Objects.hashCode(OSCategoryId, description, id);
}
@Override
@ -134,7 +123,7 @@ public class OSType implements Comparable<OSType> {
@Override
public int compareTo(OSType arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -33,9 +34,9 @@ public class Pod implements Comparable<Pod> {
public static class Builder {
private long id;
private String id;
private String name;
private long zoneId;
private String zoneId;
private String zoneName;
private String gateway;
private String netmask;
@ -48,7 +49,7 @@ public class Pod implements Comparable<Pod> {
/**
* @param id the ID of the Pod
*/
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -64,7 +65,7 @@ public class Pod implements Comparable<Pod> {
/**
* @param zoneId the Zone ID of the Pod
*/
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -126,9 +127,9 @@ public class Pod implements Comparable<Pod> {
}
}
private long id;
private String id;
private String name;
@SerializedName("zoneid") private long zoneId;
@SerializedName("zoneid") private String zoneId;
@SerializedName("zonename") private String zoneName;
private String gateway;
private String netmask;
@ -139,7 +140,7 @@ public class Pod implements Comparable<Pod> {
/* Just for the serializer */
Pod() {}
public Pod(long id, String name, long zoneId, String zoneName, String gateway, String netmask, String startIp, String endIp, AllocationState allocationState) {
public Pod(String id, String name, String zoneId, String zoneName, String gateway, String netmask, String startIp, String endIp, AllocationState allocationState) {
this.id = id;
this.name = name;
this.zoneId = zoneId;
@ -154,7 +155,7 @@ public class Pod implements Comparable<Pod> {
/**
* @return id the ID of the Pod
*/
public long getId() {
public String getId() {
return id;
}
@ -168,7 +169,7 @@ public class Pod implements Comparable<Pod> {
/**
* @return zoneId the Zone ID of the Pod
*/
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -219,33 +220,24 @@ public class Pod implements Comparable<Pod> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Pod pod = (Pod) o;
Pod that = (Pod) o;
if (id != pod.id) return false;
if (zoneId != pod.zoneId) return false;
if (allocationState != pod.allocationState) return false;
if (endIp != null ? !endIp.equals(pod.endIp) : pod.endIp != null) return false;
if (gateway != null ? !gateway.equals(pod.gateway) : pod.gateway != null) return false;
if (name != null ? !name.equals(pod.name) : pod.name != null) return false;
if (netmask != null ? !netmask.equals(pod.netmask) : pod.netmask != null) return false;
if (startIp != null ? !startIp.equals(pod.startIp) : pod.startIp != null) return false;
if (zoneName != null ? !zoneName.equals(pod.zoneName) : pod.zoneName != null) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(allocationState, that.allocationState)) return false;
if (!Objects.equal(endIp, that.endIp)) return false;
if (!Objects.equal(gateway, that.gateway)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(netmask, that.netmask)) return false;
if (!Objects.equal(startIp, that.startIp)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (zoneName != null ? zoneName.hashCode() : 0);
result = 31 * result + (gateway != null ? gateway.hashCode() : 0);
result = 31 * result + (netmask != null ? netmask.hashCode() : 0);
result = 31 * result + (startIp != null ? startIp.hashCode() : 0);
result = 31 * result + (endIp != null ? endIp.hashCode() : 0);
result = 31 * result + (allocationState != null ? allocationState.hashCode() : 0);
return result;
return Objects.hashCode(id, zoneId, allocationState, endIp, gateway, name, netmask, startIp, zoneName);
}
@Override
@ -265,6 +257,6 @@ public class Pod implements Comparable<Pod> {
@Override
public int compareTo(Pod other) {
return Long.valueOf(this.id).compareTo(other.id);
return this.id.compareTo(other.id);
}
}

View File

@ -21,6 +21,7 @@ package org.jclouds.cloudstack.domain;
import java.util.Set;
import com.google.common.base.CaseFormat;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.gson.annotations.SerializedName;
@ -77,21 +78,21 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
public static class Builder {
private long id;
private String id;
private String IPAddress;
private long IPAddressId;
private String IPAddressId;
private int privatePort;
private Protocol protocol;
public int publicPort;
private State state;
private String virtualMachineDisplayName;
public long virtualMachineId;
public String virtualMachineId;
private String virtualMachineName;
private Set<String> CIDRs = ImmutableSet.of();
private int privateEndPort;
private int publicEndPort;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -101,7 +102,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return this;
}
public Builder IPAddressId(long IPAddressId) {
public Builder IPAddressId(String IPAddressId) {
this.IPAddressId = IPAddressId;
return this;
}
@ -131,7 +132,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
return this;
}
public Builder virtualMachineId(long virtualMachineId) {
public Builder virtualMachineId(String virtualMachineId) {
this.virtualMachineId = virtualMachineId;
return this;
}
@ -162,11 +163,11 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
}
private long id;
private String id;
@SerializedName("ipaddress")
private String IPAddress;
@SerializedName("ipaddressid")
private long IPAddressId;
private String IPAddressId;
@SerializedName("privateport")
private int privatePort;
private Protocol protocol;
@ -176,7 +177,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
@SerializedName("virtualmachinedisplayname")
private String virtualMachineDisplayName;
@SerializedName("virtualmachineid")
public long virtualMachineId;
public String virtualMachineId;
@SerializedName("virtualmachinename")
private String virtualMachineName;
@SerializedName("cidrlist")
@ -186,8 +187,8 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
@SerializedName("publicendport")
private int publicEndPort;
public PortForwardingRule(long id, String iPAddress, long iPAddressId, int privatePort, Protocol protocol,
int publicPort, State state, String virtualMachineDisplayName, long virtualMachineId,
public PortForwardingRule(String id, String iPAddress, String iPAddressId, int privatePort, Protocol protocol,
int publicPort, State state, String virtualMachineDisplayName, String virtualMachineId,
String virtualMachineName, Set<String> CIDRs, int privateEndPort, int publicEndPort) {
this.id = id;
this.IPAddress = iPAddress;
@ -206,13 +207,13 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
@Override
public int compareTo(PortForwardingRule arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
/**
* @return the ID of the port forwarding rule
*/
public long getId() {
public String getId() {
return id;
}
@ -226,7 +227,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
/**
* @return the public ip address id for the port forwarding rule
*/
public long getIPAddressId() {
public String getIPAddressId() {
return IPAddressId;
}
@ -268,7 +269,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
/**
* @return the VM ID for the port forwarding rule
*/
public long getVirtualMachineId() {
public String getVirtualMachineId() {
return virtualMachineId;
}
@ -301,67 +302,29 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((IPAddress == null) ? 0 : IPAddress.hashCode());
result = prime * result + (int) (IPAddressId ^ (IPAddressId >>> 32));
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + privatePort;
result = prime * result + ((protocol == null) ? 0 : protocol.hashCode());
result = prime * result + publicPort;
result = prime * result + ((state == null) ? 0 : state.hashCode());
result = prime * result + ((virtualMachineDisplayName == null) ? 0 : virtualMachineDisplayName.hashCode());
result = prime * result + (int) (virtualMachineId ^ (virtualMachineId >>> 32));
result = prime * result + ((virtualMachineName == null) ? 0 : virtualMachineName.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PortForwardingRule that = (PortForwardingRule) o;
if (!Objects.equal(IPAddress, that.IPAddress)) return false;
if (!Objects.equal(IPAddressId, that.IPAddressId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(privatePort, that.privatePort)) return false;
if (!Objects.equal(protocol, that.protocol)) return false;
if (!Objects.equal(publicPort, that.publicPort)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(virtualMachineDisplayName, that.virtualMachineDisplayName)) return false;
if (!Objects.equal(virtualMachineId, that.virtualMachineId)) return false;
if (!Objects.equal(virtualMachineName, that.virtualMachineName)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PortForwardingRule other = (PortForwardingRule) obj;
if (IPAddress == null) {
if (other.IPAddress != null)
return false;
} else if (!IPAddress.equals(other.IPAddress))
return false;
if (IPAddressId != other.IPAddressId)
return false;
if (id != other.id)
return false;
if (privatePort != other.privatePort)
return false;
if (protocol == null) {
if (other.protocol != null)
return false;
} else if (!protocol.equals(other.protocol))
return false;
if (privatePort != other.privatePort)
return false;
if (state == null) {
if (other.state != null)
return false;
} else if (!state.equals(other.state))
return false;
if (virtualMachineDisplayName == null) {
if (other.virtualMachineDisplayName != null)
return false;
} else if (!virtualMachineDisplayName.equals(other.virtualMachineDisplayName))
return false;
if (virtualMachineId != other.virtualMachineId)
return false;
if (virtualMachineName == null) {
if (other.virtualMachineName != null)
return false;
} else if (!virtualMachineName.equals(other.virtualMachineName))
return false;
return true;
public int hashCode() {
return Objects.hashCode(IPAddress, IPAddressId, id, privatePort, protocol, publicPort, state, virtualMachineDisplayName, virtualMachineId, virtualMachineName);
}
@Override

View File

@ -25,6 +25,7 @@ import java.util.Date;
import javax.annotation.Nullable;
import com.google.common.base.CaseFormat;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -37,29 +38,29 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
}
public static class Builder {
private long id;
private String id;
private String account;
private Date allocated;
private long associatedNetworkId;
private String associatedNetworkId;
private String domain;
private long domainId;
private String domainId;
private boolean usesVirtualNetwork;
private String IPAddress;
private boolean isSourceNAT;
private boolean isStaticNAT;
private long networkId;
private String networkId;
private State state;
private String virtualMachineDisplayName;
private long virtualMachineId = -1;
private String virtualMachineId;
private String virtualMachineName;
private long VLANId;
private String VLANId;
private String VLANName;
private long zoneId;
private String zoneId;
private String zoneName;
private Long jobId;
private String jobId;
private Integer jobStatus;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -74,7 +75,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
return this;
}
public Builder associatedNetworkId(long associatedNetworkId) {
public Builder associatedNetworkId(String associatedNetworkId) {
this.associatedNetworkId = associatedNetworkId;
return this;
}
@ -84,7 +85,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -109,7 +110,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
return this;
}
public Builder networkId(long networkId) {
public Builder networkId(String networkId) {
this.networkId = networkId;
return this;
}
@ -124,7 +125,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
return this;
}
public Builder virtualMachineId(long virtualMachineId) {
public Builder virtualMachineId(String virtualMachineId) {
this.virtualMachineId = virtualMachineId;
return this;
}
@ -134,7 +135,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
return this;
}
public Builder VLANId(long VLANId) {
public Builder VLANId(String VLANId) {
this.VLANId = VLANId;
return this;
}
@ -144,7 +145,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -154,7 +155,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
return this;
}
public Builder jobId(Long jobId) {
public Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
@ -171,14 +172,14 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
}
}
private long id;
private String id;
private String account;
private Date allocated;
@SerializedName("associatednetworkid")
private long associatedNetworkId;
private String associatedNetworkId;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("forvirtualnetwork")
private boolean usesVirtualNetwork;
@SerializedName("ipaddress")
@ -188,25 +189,25 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
@SerializedName("isstaticnat")
private boolean isStaticNAT;
@SerializedName("networkid")
private long networkId;
private String networkId;
private State state;
@SerializedName("virtualmachinedisplayname")
private String virtualMachineDisplayName;
@SerializedName("virtualmachineid")
private long virtualMachineId = -1;
private String virtualMachineId;
@SerializedName("virtualmachinename")
private String virtualMachineName;
@SerializedName("VLANid")
private long VLANId;
private String VLANId;
@SerializedName("VLANname")
private String VLANName;
@SerializedName("zoneid")
private long zoneId;
private String zoneId;
@SerializedName("zonename")
private String zoneName;
@SerializedName("jobid")
@Nullable
private Long jobId;
private String jobId;
@SerializedName("jobstatus")
@Nullable
private Integer jobStatus;
@ -234,10 +235,10 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
}
public PublicIPAddress(long id, String account, Date allocated, long associatedNetworkId, String domain,
long domainId, boolean usesVirtualNetwork, String iPAddress, boolean isSourceNAT, boolean isStaticNAT,
long networkId, State state, String virtualMachineDisplayName, long virtualMachineId,
String virtualMachineName, long VLANId, String VLANName, long zoneId, String zoneName, Long jobId,
public PublicIPAddress(String id, String account, Date allocated, String associatedNetworkId, String domain,
String domainId, boolean usesVirtualNetwork, String iPAddress, boolean isSourceNAT, boolean isStaticNAT,
String networkId, State state, String virtualMachineDisplayName, String virtualMachineId,
String virtualMachineName, String VLANId, String VLANName, String zoneId, String zoneName, String jobId,
Integer jobStatus) {
this.id = id;
this.account = account;
@ -265,13 +266,13 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
@Override
public int compareTo(PublicIPAddress arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
/**
* @return public IP address id
*/
public long getId() {
public String getId() {
return id;
}
@ -295,7 +296,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
* machine
*/
@Nullable
public Long getJobId() {
public String getJobId() {
return jobId;
}
@ -311,7 +312,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
/**
* @return the ID of the Network associated with the IP address
*/
public long getAssociatedNetworkId() {
public String getAssociatedNetworkId() {
return associatedNetworkId;
}
@ -325,7 +326,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
/**
* @return the domain ID the public IP address is associated with
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -360,7 +361,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
/**
* @return the ID of the Network where ip belongs to
*/
public long getNetworkId() {
public String getNetworkId() {
return networkId;
}
@ -384,7 +385,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
* @return virtual machine id the ip address is assigned to (not null only
* for static nat Ip)
*/
public long getVirtualMachineId() {
public String getVirtualMachineId() {
return virtualMachineId;
}
@ -399,7 +400,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
/**
* @return the ID of the VLAN associated with the IP address
*/
public long getVLANId() {
public String getVLANId() {
return VLANId;
}
@ -413,7 +414,7 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
/**
* @return the ID of the zone the public IP address belongs to
*/
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -425,117 +426,42 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((IPAddress == null) ? 0 : IPAddress.hashCode());
result = prime * result + (int) (VLANId ^ (VLANId >>> 32));
result = prime * result + ((VLANName == null) ? 0 : VLANName.hashCode());
result = prime * result + ((account == null) ? 0 : account.hashCode());
result = prime * result + ((allocated == null) ? 0 : allocated.hashCode());
result = prime * result + (int) (associatedNetworkId ^ (associatedNetworkId >>> 32));
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + (isSourceNAT ? 1231 : 1237);
result = prime * result + (isStaticNAT ? 1231 : 1237);
result = prime * result + (int) (networkId ^ (networkId >>> 32));
result = prime * result + ((state == null) ? 0 : state.hashCode());
result = prime * result + (usesVirtualNetwork ? 1231 : 1237);
result = prime * result + ((virtualMachineDisplayName == null) ? 0 : virtualMachineDisplayName.hashCode());
result = prime * result + (int) (virtualMachineId ^ (virtualMachineId >>> 32));
result = prime * result + ((virtualMachineName == null) ? 0 : virtualMachineName.hashCode());
result = prime * result + (int) (zoneId ^ (zoneId >>> 32));
result = prime * result + ((zoneName == null) ? 0 : zoneName.hashCode());
result = prime * result + ((jobStatus == null) ? 0 : jobStatus.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PublicIPAddress that = (PublicIPAddress) o;
if (!Objects.equal(IPAddress, that.IPAddress)) return false;
if (!Objects.equal(VLANId, that.VLANId)) return false;
if (!Objects.equal(VLANName, that.VLANName)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(allocated, that.allocated)) return false;
if (!Objects.equal(associatedNetworkId, that.associatedNetworkId)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(isSourceNAT, that.isSourceNAT)) return false;
if (!Objects.equal(isStaticNAT, that.isStaticNAT)) return false;
if (!Objects.equal(networkId, that.networkId)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(usesVirtualNetwork, that.usesVirtualNetwork)) return false;
if (!Objects.equal(virtualMachineDisplayName, that.virtualMachineDisplayName)) return false;
if (!Objects.equal(virtualMachineId, that.virtualMachineId)) return false;
if (!Objects.equal(virtualMachineName, that.virtualMachineName)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
if (!Objects.equal(jobStatus, that.jobStatus)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PublicIPAddress other = (PublicIPAddress) obj;
if (IPAddress == null) {
if (other.IPAddress != null)
return false;
} else if (!IPAddress.equals(other.IPAddress))
return false;
if (VLANId != other.VLANId)
return false;
if (VLANName == null) {
if (other.VLANName != null)
return false;
} else if (!VLANName.equals(other.VLANName))
return false;
if (account == null) {
if (other.account != null)
return false;
} else if (!account.equals(other.account))
return false;
if (allocated == null) {
if (other.allocated != null)
return false;
} else if (!allocated.equals(other.allocated))
return false;
if (associatedNetworkId != other.associatedNetworkId)
return false;
if (domain == null) {
if (other.domain != null)
return false;
} else if (!domain.equals(other.domain))
return false;
if (domainId != other.domainId)
return false;
if (id != other.id)
return false;
if (isSourceNAT != other.isSourceNAT)
return false;
if (isStaticNAT != other.isStaticNAT)
return false;
if (networkId != other.networkId)
return false;
if (state == null) {
if (other.state != null)
return false;
} else if (!state.equals(other.state))
return false;
if (usesVirtualNetwork != other.usesVirtualNetwork)
return false;
if (virtualMachineDisplayName == null) {
if (other.virtualMachineDisplayName != null)
return false;
} else if (!virtualMachineDisplayName.equals(other.virtualMachineDisplayName))
return false;
if (virtualMachineId != other.virtualMachineId)
return false;
if (virtualMachineName == null) {
if (other.virtualMachineName != null)
return false;
} else if (!virtualMachineName.equals(other.virtualMachineName))
return false;
if (zoneId != other.zoneId)
return false;
if (zoneName == null) {
if (other.zoneName != null)
return false;
} else if (!zoneName.equals(other.zoneName))
return false;
if (jobId == null) {
if (other.jobId != null)
return false;
} else if (!jobId.equals(other.jobId))
return false;
if (jobStatus == null) {
if (other.jobStatus != null)
return false;
} else if (!jobStatus.equals(other.jobStatus))
return false;
return true;
public int hashCode() {
return Objects.hashCode(IPAddress, VLANId, VLANName, account, allocated, associatedNetworkId,
domain, domainId, id, isSourceNAT, isStaticNAT, networkId, state,
usesVirtualNetwork, virtualMachineDisplayName, virtualMachineId,
virtualMachineName, zoneId, zoneName, jobStatus);
}
@Override

View File

@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName;
@ -41,7 +42,7 @@ public class ResourceLimit implements Comparable<ResourceLimit> {
private String account;
private String domain;
private long domainId;
private String domainId;
private int max;
private ResourceType resourceType;
@ -55,7 +56,7 @@ public class ResourceLimit implements Comparable<ResourceLimit> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -83,12 +84,12 @@ public class ResourceLimit implements Comparable<ResourceLimit> {
private String account;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
private int max;
@SerializedName("resourcetype")
private ResourceType resourceType;
public ResourceLimit(String account, String domain, long domainId, int max, ResourceType resourceType) {
public ResourceLimit(String account, String domain, String domainId, int max, ResourceType resourceType) {
this.account = account;
this.domain = domain;
this.domainId = domainId;
@ -104,7 +105,7 @@ public class ResourceLimit implements Comparable<ResourceLimit> {
return domain;
}
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -123,22 +124,18 @@ public class ResourceLimit implements Comparable<ResourceLimit> {
ResourceLimit that = (ResourceLimit) o;
if (domainId != that.domainId) return false;
if (max != that.max) return false;
if (resourceType != that.resourceType) return false;
if (!account.equals(that.account)) return false;
if (!domain.equals(that.domain)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(max, that.max)) return false;
if (!Objects.equal(resourceType, that.resourceType)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(domain, that.domain)) return false;
return true;
}
@Override
public int hashCode() {
int result = account.hashCode();
result = 31 * result + domain.hashCode();
result = 31 * result + (int) (domainId ^ (domainId >>> 32));
result = 31 * result + max;
return result;
return Objects.hashCode(domainId, max, resourceType, account, domain);
}
@Override

View File

@ -25,6 +25,7 @@ import java.util.SortedSet;
import javax.annotation.Nullable;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import com.google.gson.annotations.SerializedName;
@ -38,18 +39,18 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
}
public static class Builder {
private long id;
private String id;
private String account;
private String name;
private String description;
private String domain;
private long domainId;
private Long jobId;
private String domainId;
private String jobId;
private Integer jobStatus;
private Set<IngressRule> ingressRules = ImmutableSet.of();
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -74,12 +75,12 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
public Builder jobId(Long jobId) {
public Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
@ -99,16 +100,16 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
}
}
private long id;
private String id;
private String account;
private String name;
private String description;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("jobid")
@Nullable
private Long jobId;
private String jobId;
@SerializedName("jobstatus")
@Nullable
private Integer jobStatus;
@ -116,8 +117,8 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
// so that tests and serialization come out expected
private SortedSet<IngressRule> ingressRules = ImmutableSortedSet.<IngressRule>of();
public SecurityGroup(long id, String account, String name, String description, String domain, long domainId,
Long jobId, Integer jobStatus, Set<IngressRule> ingressRules) {
public SecurityGroup(String id, String account, String name, String description, String domain, String domainId,
String jobId, Integer jobStatus, Set<IngressRule> ingressRules) {
this.id = id;
this.account = account;
this.name = name;
@ -139,7 +140,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
/**
* @return the id of the security group
*/
public long getId() {
public String getId() {
return id;
}
@ -168,7 +169,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
/**
* @return the domain id of the security group
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -178,7 +179,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
* machine
*/
@Nullable
public Long getJobId() {
public String getJobId() {
return jobId;
}
@ -205,39 +206,22 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((jobStatus == null) ? 0 : jobStatus.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SecurityGroup that = (SecurityGroup) o;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(jobStatus, that.jobStatus)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SecurityGroup other = (SecurityGroup) obj;
if (domainId != other.domainId)
return false;
if (id != other.id)
return false;
if (jobId == null) {
if (other.jobId != null)
return false;
} else if (!jobId.equals(other.jobId))
return false;
if (jobStatus == null) {
if (other.jobStatus != null)
return false;
} else if (!jobStatus.equals(other.jobStatus))
return false;
return true;
public int hashCode() {
return Objects.hashCode(domainId, id, jobStatus);
}
@Override
@ -257,6 +241,6 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
@Override
public int compareTo(SecurityGroup arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -24,6 +24,7 @@ import java.util.Date;
import java.util.Set;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.google.gson.annotations.SerializedName;
@ -38,12 +39,12 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
public static class Builder {
private long id;
private String id;
private String name;
private String displayText;
private Date created;
private String domain;
private long domainId;
private String domainId;
private int cpuNumber;
private int cpuSpeed;
private int memory;
@ -58,7 +59,7 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
private Set<String> tags = ImmutableSet.of();
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -83,7 +84,7 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -156,14 +157,14 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
}
}
private long id;
private String id;
private String name;
@SerializedName("displaytext")
private String displayText;
private Date created;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("cpunumber")
private int cpuNumber;
@SerializedName("cpuspeed")
@ -188,7 +189,7 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
private boolean systemVmType;
public ServiceOffering(long id, String name, String displayText, Date created, String domain, long domainId,
public ServiceOffering(String id, String name, String displayText, Date created, String domain, String domainId,
int cpuNumber, int cpuSpeed, int memory, boolean haSupport, StorageType storageType, Set<String> tags,
boolean defaultUse, String hostTags, boolean systemOffering, boolean cpuUseLimited, long networkRate,
boolean systemVmType) {
@ -216,7 +217,7 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
/**
* @return the id of the service offering
*/
public long getId() {
public String getId() {
return id;
}
@ -252,7 +253,7 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
/**
* @return the domain id of the service offering
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -341,73 +342,31 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + cpuNumber;
result = prime * result + cpuSpeed;
result = prime * result + ((created == null) ? 0 : created.hashCode());
result = prime * result + ((displayText == null) ? 0 : displayText.hashCode());
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + (haSupport ? 1231 : 1237);
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + memory;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((storageType == null) ? 0 : storageType.hashCode());
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ServiceOffering that = (ServiceOffering) o;
if (!Objects.equal(cpuNumber, that.cpuNumber)) return false;
if (!Objects.equal(cpuSpeed, that.cpuSpeed)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(displayText, that.displayText)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(haSupport, that.haSupport)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(memory, that.memory)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(storageType, that.storageType)) return false;
if (!Objects.equal(tags, that.tags)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ServiceOffering other = (ServiceOffering) obj;
if (cpuNumber != other.cpuNumber)
return false;
if (cpuSpeed != other.cpuSpeed)
return false;
if (created == null) {
if (other.created != null)
return false;
} else if (!created.equals(other.created))
return false;
if (displayText == null) {
if (other.displayText != null)
return false;
} else if (!displayText.equals(other.displayText))
return false;
if (domain == null) {
if (other.domain != null)
return false;
} else if (!domain.equals(other.domain))
return false;
if (domainId != other.domainId)
return false;
if (haSupport != other.haSupport)
return false;
if (id != other.id)
return false;
if (memory != other.memory)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (storageType != other.storageType)
return false;
if (tags == null) {
if (other.tags != null)
return false;
} else if (!tags.equals(other.tags))
return false;
return true;
public int hashCode() {
return Objects.hashCode(cpuNumber, cpuSpeed, created, displayText, domain, domainId, haSupport, id, memory, name, storageType, tags);
}
@Override
@ -436,7 +395,7 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
@Override
public int compareTo(ServiceOffering arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -37,25 +37,25 @@ public class Snapshot implements Comparable<Snapshot> {
public static class Builder {
private long id;
private String id;
private String account;
private Date created;
private String domain;
private long domainId;
private String domainId;
private Interval interval;
private long jobId;
private String jobId;
private String jobStatus;
private String name;
private Type snapshotType;
private State state;
private long volumeId;
private String volumeId;
private String volumeName;
private Volume.Type volumeType;
/**
* @param id ID of the snapshot
*/
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -87,7 +87,7 @@ public class Snapshot implements Comparable<Snapshot> {
/**
* @param domainId the domain ID of the snapshot's account
*/
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -103,7 +103,7 @@ public class Snapshot implements Comparable<Snapshot> {
/**
* @param jobId the job ID associated with the snapshot. This is only displayed if the snapshot listed is part of a currently running asynchronous job.
*/
public Builder jobId(long jobId) {
public Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
@ -143,7 +143,7 @@ public class Snapshot implements Comparable<Snapshot> {
/**
* @param volumeId ID of the disk volume
*/
public Builder volumeId(long volumeId) {
public Builder volumeId(String volumeId) {
this.volumeId = volumeId;
return this;
}
@ -215,16 +215,16 @@ public class Snapshot implements Comparable<Snapshot> {
}
}
private long id;
private String id;
private String account;
private Date created;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("intervaltype")
private Interval interval;
@SerializedName("jobid")
private long jobId;
private String jobId;
@SerializedName("jobstatus")
private String jobStatus;
private String name;
@ -232,14 +232,14 @@ public class Snapshot implements Comparable<Snapshot> {
private Type snapshotType;
private State state;
@SerializedName("volumeid")
private long volumeId;
private String volumeId;
@SerializedName("volumename")
private String volumeName;
@SerializedName("volumetype")
private Volume.Type volumeType;
public Snapshot(long id, String account, Date created, String domain, long domainId, Interval interval, long jobId,
String jobStatus, String name, Type snapshotType, State state, long volumeId, String volumeName, Volume.Type volumeType) {
public Snapshot(String id, String account, Date created, String domain, String domainId, Interval interval, String jobId,
String jobStatus, String name, Type snapshotType, State state, String volumeId, String volumeName, Volume.Type volumeType) {
this.id = id;
this.account = account;
this.created = created;
@ -265,7 +265,7 @@ public class Snapshot implements Comparable<Snapshot> {
/**
* @return ID of the snapshot
*/
public long getId() {
public String getId() {
return id;
}
@ -293,7 +293,7 @@ public class Snapshot implements Comparable<Snapshot> {
/**
* @return the domain ID of the snapshot's account
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -307,7 +307,7 @@ public class Snapshot implements Comparable<Snapshot> {
/**
* @return the job ID associated with the snapshot. This is only displayed if the snapshot listed is part of a currently running asynchronous job.
*/
public long getJobId() {
public String getJobId() {
return jobId;
}
@ -342,7 +342,7 @@ public class Snapshot implements Comparable<Snapshot> {
/**
* @return ID of the disk volume
*/
public long getVolumeId() {
public String getVolumeId() {
return volumeId;
}
@ -387,21 +387,9 @@ public class Snapshot implements Comparable<Snapshot> {
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (account != null ? account.hashCode() : 0);
result = 31 * result + (created != null ? created.hashCode() : 0);
result = 31 * result + (domain != null ? domain.hashCode() : 0);
result = 31 * result + (int) (domainId ^ (domainId >>> 32));
result = 31 * result + (interval != null ? interval.hashCode() : 0);
result = 31 * result + (int) (jobId ^ (jobId >>> 32));
result = 31 * result + (jobStatus != null ? jobStatus.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (snapshotType != null ? snapshotType.hashCode() : 0);
result = 31 * result + (state != null ? state.hashCode() : 0);
result = 31 * result + (int) (volumeId ^ (volumeId >>> 32));
result = 31 * result + (volumeName != null ? volumeName.hashCode() : 0);
result = 31 * result + (volumeType != null ? volumeType.hashCode() : 0);
return result;
return Objects.hashCode(domainId, id, jobId, volumeId, account, created, domain,
interval, jobStatus, name, snapshotType, state, volumeName,
volumeType);
}
@Override
@ -426,6 +414,6 @@ public class Snapshot implements Comparable<Snapshot> {
@Override
public int compareTo(Snapshot other) {
return new Long(this.id).compareTo(other.getId());
return id.compareTo(other.getId());
}
}

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -31,17 +32,17 @@ public class SnapshotPolicy implements Comparable<SnapshotPolicy> {
public static class Builder {
private long id;
private String id;
private Snapshot.Interval interval;
private long numberToRetain;
private String schedule;
private String timezone;
private long volumeId;
private String volumeId;
/**
* @param id the ID of the snapshot policy
*/
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -81,7 +82,7 @@ public class SnapshotPolicy implements Comparable<SnapshotPolicy> {
/**
* @param volumeId ID of the disk volume
*/
public Builder volumeId(long volumeId) {
public Builder volumeId(String volumeId) {
this.volumeId = volumeId;
return this;
}
@ -91,7 +92,7 @@ public class SnapshotPolicy implements Comparable<SnapshotPolicy> {
}
}
private long id;
private String id;
@SerializedName("intervaltype")
private Snapshot.Interval interval;
@SerializedName("maxsnaps")
@ -99,9 +100,9 @@ public class SnapshotPolicy implements Comparable<SnapshotPolicy> {
private String schedule;
private String timezone;
@SerializedName("volumeid")
private long volumeId;
private String volumeId;
public SnapshotPolicy(long id, Snapshot.Interval interval, long numberToRetain, String schedule, String timezone, long volumeId) {
public SnapshotPolicy(String id, Snapshot.Interval interval, long numberToRetain, String schedule, String timezone, String volumeId) {
this.id = id;
this.interval = interval;
this.numberToRetain = numberToRetain;
@ -119,7 +120,7 @@ public class SnapshotPolicy implements Comparable<SnapshotPolicy> {
/**
* @return the ID of the snapshot policy
*/
public long getId() {
public String getId() {
return id;
}
@ -154,7 +155,7 @@ public class SnapshotPolicy implements Comparable<SnapshotPolicy> {
/**
* @return ID of the disk volume
*/
public long getVolumeId() {
public String getVolumeId() {
return volumeId;
}
@ -165,25 +166,19 @@ public class SnapshotPolicy implements Comparable<SnapshotPolicy> {
SnapshotPolicy that = (SnapshotPolicy) o;
if (id != that.id) return false;
if (numberToRetain != that.numberToRetain) return false;
if (volumeId != that.volumeId) return false;
if (interval != that.interval) return false;
if (schedule != null ? !schedule.equals(that.schedule) : that.schedule != null) return false;
if (timezone != null ? !timezone.equals(that.timezone) : that.timezone != null) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(numberToRetain, that.numberToRetain)) return false;
if (!Objects.equal(volumeId, that.volumeId)) return false;
if (!Objects.equal(interval, that.interval)) return false;
if (!Objects.equal(schedule, that.schedule)) return false;
if (!Objects.equal(timezone, that.timezone)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (interval != null ? interval.hashCode() : 0);
result = 31 * result + (int) (numberToRetain ^ (numberToRetain >>> 32));
result = 31 * result + (schedule != null ? schedule.hashCode() : 0);
result = 31 * result + (timezone != null ? timezone.hashCode() : 0);
result = 31 * result + (int) (volumeId ^ (volumeId >>> 32));
return result;
return Objects.hashCode(id, numberToRetain, volumeId, interval, schedule, timezone);
}
@Override
@ -200,7 +195,7 @@ public class SnapshotPolicy implements Comparable<SnapshotPolicy> {
@Override
public int compareTo(SnapshotPolicy other) {
return new Long(id).compareTo(other.getId());
return id.compareTo(other.getId());
}
}

View File

@ -19,6 +19,7 @@
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -85,42 +86,22 @@ public class SshKeyPair implements Comparable<SshKeyPair> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fingerprint == null) ? 0 : fingerprint.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((privateKey == null) ? 0 : privateKey.hashCode());
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return result;
SshKeyPair that = (SshKeyPair) o;
if (!Objects.equal(fingerprint, that.fingerprint)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(privateKey, that.privateKey)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SshKeyPair other = (SshKeyPair) obj;
if (fingerprint == null) {
if (other.fingerprint != null)
return false;
} else if (!fingerprint.equals(other.fingerprint))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (privateKey == null) {
if (other.privateKey != null)
return false;
} else if (!privateKey.equals(other.privateKey))
return false;
return true;
public int hashCode() {
return Objects.hashCode(fingerprint, name, privateKey);
}
@Override

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Date;
import com.google.common.base.CaseFormat;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -93,26 +94,26 @@ public class StoragePool implements Comparable<StoragePool> {
private Builder() {
}
private long id;
private String id;
private String name;
private String path;
private String tags;
private State state;
private Type type;
private long zoneId;
private String zoneId;
private String zoneName;
private long podId;
private String podId;
private String podName;
private long clusterId;
private String clusterId;
private String clusterName;
private Date created;
private long diskSizeAllocated;
private long diskSizeTotal;
private String ipAddress;
private Long jobId;
private String jobId;
private String jobStatus;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -142,7 +143,7 @@ public class StoragePool implements Comparable<StoragePool> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -152,7 +153,7 @@ public class StoragePool implements Comparable<StoragePool> {
return this;
}
public Builder podId(long podId) {
public Builder podId(String podId) {
this.podId = podId;
return this;
}
@ -162,7 +163,7 @@ public class StoragePool implements Comparable<StoragePool> {
return this;
}
public Builder clusterId(long clusterId) {
public Builder clusterId(String clusterId) {
this.clusterId = clusterId;
return this;
}
@ -192,7 +193,7 @@ public class StoragePool implements Comparable<StoragePool> {
return this;
}
public Builder jobId(Long jobId) {
public Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
@ -207,30 +208,30 @@ public class StoragePool implements Comparable<StoragePool> {
}
}
private long id;
private String id;
private String name;
private String path;
private String tags;
private State state;
private Type type;
@SerializedName("zoneid") private long zoneId;
@SerializedName("zoneid") private String zoneId;
@SerializedName("zonename") private String zoneName;
@SerializedName("podid") private long podId;
@SerializedName("podid") private String podId;
@SerializedName("podname") private String podName;
@SerializedName("clusterid") private long clusterId;
@SerializedName("clusterid") private String clusterId;
@SerializedName("clustername") private String clusterName;
private Date created;
@SerializedName("disksizeallocated") private long diskSizeAllocated;
@SerializedName("disksizetotal") private long diskSizeTotal;
@SerializedName("ipaddress") private String ipAddress;
@SerializedName("jobid") private Long jobId;
@SerializedName("jobid") private String jobId;
@SerializedName("jobstatus") private String jobStatus;
/* Exists only for the serializer */
StoragePool() {
}
public StoragePool(long id, String name, String path, String tags, State state, Type type, long zoneId, String zoneName, long podId, String podName, long clusterId, String clusterName, Date created, long diskSizeAllocated, long diskSizeTotal, String ipAddress, Long jobId, String jobStatus) {
public StoragePool(String id, String name, String path, String tags, State state, Type type, String zoneId, String zoneName, String podId, String podName, String clusterId, String clusterName, Date created, long diskSizeAllocated, long diskSizeTotal, String ipAddress, String jobId, String jobStatus) {
this.id = id;
this.name = name;
this.path = path;
@ -251,7 +252,7 @@ public class StoragePool implements Comparable<StoragePool> {
this.jobStatus = jobStatus;
}
public long getId() {
public String getId() {
return id;
}
@ -275,7 +276,7 @@ public class StoragePool implements Comparable<StoragePool> {
return type;
}
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -283,7 +284,7 @@ public class StoragePool implements Comparable<StoragePool> {
return zoneName;
}
public long getPodId() {
public String getPodId() {
return podId;
}
@ -291,7 +292,7 @@ public class StoragePool implements Comparable<StoragePool> {
return podName;
}
public long getClusterId() {
public String getClusterId() {
return clusterId;
}
@ -315,7 +316,7 @@ public class StoragePool implements Comparable<StoragePool> {
return ipAddress;
}
public Long getJobId() {
public String getJobId() {
return jobId;
}
@ -330,49 +331,33 @@ public class StoragePool implements Comparable<StoragePool> {
StoragePool that = (StoragePool) o;
if (clusterId != that.clusterId) return false;
if (diskSizeAllocated != that.diskSizeAllocated) return false;
if (diskSizeTotal != that.diskSizeTotal) return false;
if (id != that.id) return false;
if (podId != that.podId) return false;
if (zoneId != that.zoneId) return false;
if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
if (created != null ? !created.equals(that.created) : that.created != null) return false;
if (ipAddress != null ? !ipAddress.equals(that.ipAddress) : that.ipAddress != null) return false;
if (jobId != null ? !jobId.equals(that.jobId) : that.jobId != null) return false;
if (jobStatus != null ? !jobStatus.equals(that.jobStatus) : that.jobStatus != null) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (path != null ? !path.equals(that.path) : that.path != null) return false;
if (podName != null ? !podName.equals(that.podName) : that.podName != null) return false;
if (state != that.state) return false;
if (tags != null ? !tags.equals(that.tags) : that.tags != null) return false;
if (type != that.type) return false;
if (zoneName != null ? !zoneName.equals(that.zoneName) : that.zoneName != null) return false;
if (!Objects.equal(clusterId, that.clusterId)) return false;
if (!Objects.equal(diskSizeAllocated, that.diskSizeAllocated)) return false;
if (!Objects.equal(diskSizeTotal, that.diskSizeTotal)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(podId, that.podId)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(clusterName, that.clusterName)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(ipAddress, that.ipAddress)) return false;
if (!Objects.equal(jobId, that.jobId)) return false;
if (!Objects.equal(jobStatus, that.jobStatus)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(path, that.path)) return false;
if (!Objects.equal(podName, that.podName)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(tags, that.tags)) return false;
if (!Objects.equal(type, that.type)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (path != null ? path.hashCode() : 0);
result = 31 * result + (tags != null ? tags.hashCode() : 0);
result = 31 * result + (state != null ? state.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (zoneName != null ? zoneName.hashCode() : 0);
result = 31 * result + (int) (podId ^ (podId >>> 32));
result = 31 * result + (podName != null ? podName.hashCode() : 0);
result = 31 * result + (int) (clusterId ^ (clusterId >>> 32));
result = 31 * result + (clusterName != null ? clusterName.hashCode() : 0);
result = 31 * result + (created != null ? created.hashCode() : 0);
result = 31 * result + (int) (diskSizeAllocated ^ (diskSizeAllocated >>> 32));
result = 31 * result + (int) (diskSizeTotal ^ (diskSizeTotal >>> 32));
result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0);
result = 31 * result + (jobId != null ? jobId.hashCode() : 0);
result = 31 * result + (jobStatus != null ? jobStatus.hashCode() : 0);
return result;
return Objects.hashCode(clusterId, diskSizeAllocated, diskSizeTotal, id, podId, zoneId,
clusterName, created, ipAddress, jobId, jobStatus, name, path,
podName, state, tags, type, zoneName);
}
@Override
@ -401,6 +386,6 @@ public class StoragePool implements Comparable<StoragePool> {
@Override
public int compareTo(StoragePool other) {
return Long.valueOf(this.id).compareTo(other.id);
return this.id.compareTo(other.id);
}
}

View File

@ -24,6 +24,7 @@ import java.util.Date;
import javax.annotation.Nullable;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -35,16 +36,16 @@ public class Template implements Comparable<Template> {
}
public static class Builder {
private long id;
private String id;
private String displayText;
private String domain;
private long domainId;
private String domainId;
private String account;
private long accountId;
private String accountId;
private String zone;
private long zoneId;
private String zoneId;
private String OSType;
private long OSTypeId;
private String OSTypeId;
private String name;
private Type type;
private String status;
@ -60,15 +61,15 @@ public class Template implements Comparable<Template> {
private boolean isPublic;
private boolean ready;
private boolean passwordEnabled;
private Long jobId;
private String jobId;
private String jobStatus;
private String checksum;
private Long hostId;
private String hostId;
private String hostName;
private Long sourceTemplateId;
private String sourceTemplateId;
private String templateTag;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -83,7 +84,7 @@ public class Template implements Comparable<Template> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -93,7 +94,7 @@ public class Template implements Comparable<Template> {
return this;
}
public Builder accountId(long accountId) {
public Builder accountId(String accountId) {
this.accountId = accountId;
return this;
}
@ -103,7 +104,7 @@ public class Template implements Comparable<Template> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -113,7 +114,7 @@ public class Template implements Comparable<Template> {
return this;
}
public Builder OSTypeId(long OSTypeId) {
public Builder OSTypeId(String OSTypeId) {
this.OSTypeId = OSTypeId;
return this;
}
@ -193,7 +194,7 @@ public class Template implements Comparable<Template> {
return this;
}
public Builder jobId(Long jobId) {
public Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
@ -208,7 +209,7 @@ public class Template implements Comparable<Template> {
return this;
}
public Builder hostid(Long hostid) {
public Builder hostid(String hostid) {
this.hostId = hostid;
return this;
}
@ -218,7 +219,7 @@ public class Template implements Comparable<Template> {
return this;
}
public Builder sourceTemplateId(Long sourceTemplateId) {
public Builder sourceTemplateId(String sourceTemplateId) {
this.sourceTemplateId = sourceTemplateId;
return this;
}
@ -265,23 +266,23 @@ public class Template implements Comparable<Template> {
}
}
private long id;
private String id;
@SerializedName("displaytext")
private String displayText;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
private String account;
@SerializedName("accountid")
private long accountId;
private String accountId;
@SerializedName("zonename")
private String zone;
@SerializedName("zoneid")
private long zoneId;
private String zoneId;
@SerializedName("ostypename")
private String OSType;
@SerializedName("ostypeid")
private long OSTypeId;
private String OSTypeId;
private String name;
@SerializedName("templatetype")
private Type type;
@ -308,27 +309,27 @@ public class Template implements Comparable<Template> {
private boolean passwordEnabled;
@Nullable
@SerializedName("jobid")
private Long jobId;
private String jobId;
@SerializedName("jobstatus")
//TODO: this should be a type
private String jobStatus;
private String checksum;
@SerializedName("hostId")
private Long hostId;
private String hostId;
@SerializedName("hostname")
private String hostName;
@SerializedName("sourcetemplateid")
@Nullable
private Long sourceTemplateId;
private String sourceTemplateId;
@SerializedName("templatetag")
private String templateTag;
public Template(long id, String displayText, String domain, long domainId, String account, long accountId,
String zone, long zoneId, String oSType, long oSTypeId, String name, Type type, String status, Format format,
public Template(String id, String displayText, String domain, String domainId, String account, String accountId,
String zone, String zoneId, String oSType, String oSTypeId, String name, Type type, String status, Format format,
String hypervisor, Long size, Date created, Date removed, boolean crossZones, boolean bootable,
boolean extractable, boolean featured, boolean ispublic, boolean ready, boolean passwordEnabled, Long jobId,
String jobStatus, String checksum, Long hostId, String hostName, Long sourceTemplateId,
boolean extractable, boolean featured, boolean ispublic, boolean ready, boolean passwordEnabled, String jobId,
String jobStatus, String checksum, String hostId, String hostName, String sourceTemplateId,
String templateTag) {
this.id = id;
this.displayText = displayText;
@ -375,7 +376,7 @@ public class Template implements Comparable<Template> {
/**
* @return Template id
*/
public long getId() {
public String getId() {
return id;
}
@ -396,7 +397,7 @@ public class Template implements Comparable<Template> {
/**
* @return the ID of the domain to which the template beLongs
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -410,7 +411,7 @@ public class Template implements Comparable<Template> {
/**
* @return the ID of the account to which the template beLongs
*/
public long getAccountId() {
public String getAccountId() {
return accountId;
}
@ -424,7 +425,7 @@ public class Template implements Comparable<Template> {
/**
* @return the ID of the zone to which the template beLongs
*/
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -438,7 +439,7 @@ public class Template implements Comparable<Template> {
/**
* @return the ID of the OS type to which the template beLongs
*/
public long getOSTypeId() {
public String getOSTypeId() {
return OSTypeId;
}
@ -552,7 +553,7 @@ public class Template implements Comparable<Template> {
* pending jobs are acting on the template
*/
@Nullable
public Long getJobId() {
public String getJobId() {
return jobId;
}
@ -573,7 +574,7 @@ public class Template implements Comparable<Template> {
/**
* @return the ID of the secondary storage host for the template
*/
public Long getHostId() {
public String getHostId() {
return hostId;
}
@ -587,7 +588,7 @@ public class Template implements Comparable<Template> {
/**
* @return the template ID of the parent template if present
*/
public Long getSourceTemplateId() {
public String getSourceTemplateId() {
return sourceTemplateId;
}
@ -599,142 +600,56 @@ public class Template implements Comparable<Template> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((OSType == null) ? 0 : OSType.hashCode());
result = prime * result + (int) (OSTypeId ^ (OSTypeId >>> 32));
result = prime * result + ((account == null) ? 0 : account.hashCode());
result = prime * result + (int) (accountId ^ (accountId >>> 32));
result = prime * result + (bootable ? 1231 : 1237);
result = prime * result + ((created == null) ? 0 : created.hashCode());
result = prime * result + (crossZones ? 1231 : 1237);
result = prime * result + ((displayText == null) ? 0 : displayText.hashCode());
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + (extractable ? 1231 : 1237);
result = prime * result + (featured ? 1231 : 1237);
result = prime * result + ((format == null) ? 0 : format.hashCode());
result = prime * result + ((hypervisor == null) ? 0 : hypervisor.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + (ispublic ? 1231 : 1237);
result = prime * result + ((jobId == null) ? 0 : jobId.hashCode());
result = prime * result + ((jobStatus == null) ? 0 : jobStatus.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + (passwordEnabled ? 1231 : 1237);
result = prime * result + (ready ? 1231 : 1237);
result = prime * result + ((removed == null) ? 0 : removed.hashCode());
result = prime * result + ((size == null) ? 0 : size.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((zone == null) ? 0 : zone.hashCode());
result = prime * result + (int) (zoneId ^ (zoneId >>> 32));
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Template that = (Template) o;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(displayText, that.displayText)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(accountId, that.accountId)) return false;
if (!Objects.equal(zone, that.zone)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(OSType, that.OSType)) return false;
if (!Objects.equal(OSTypeId, that.OSTypeId)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(type, that.type)) return false;
if (!Objects.equal(status, that.status)) return false;
if (!Objects.equal(format, that.format)) return false;
if (!Objects.equal(hypervisor, that.hypervisor)) return false;
if (!Objects.equal(size, that.size)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(removed, that.removed)) return false;
if (!Objects.equal(crossZones, that.crossZones)) return false;
if (!Objects.equal(bootable, that.bootable)) return false;
if (!Objects.equal(extractable, that.extractable)) return false;
if (!Objects.equal(featured, that.featured)) return false;
if (!Objects.equal(ispublic, that.ispublic)) return false;
if (!Objects.equal(ready, that.ready)) return false;
if (!Objects.equal(passwordEnabled, that.passwordEnabled)) return false;
if (!Objects.equal(jobId, that.jobId)) return false;
if (!Objects.equal(jobStatus, that.jobStatus)) return false;
if (!Objects.equal(checksum, that.checksum)) return false;
if (!Objects.equal(hostId, that.hostId)) return false;
if (!Objects.equal(hostName, that.hostName)) return false;
if (!Objects.equal(sourceTemplateId, that.sourceTemplateId)) return false;
if (!Objects.equal(templateTag, that.templateTag)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Template other = (Template) obj;
if (OSType == null) {
if (other.OSType != null)
return false;
} else if (!OSType.equals(other.OSType))
return false;
if (OSTypeId != other.OSTypeId)
return false;
if (account == null) {
if (other.account != null)
return false;
} else if (!account.equals(other.account))
return false;
if (accountId != other.accountId)
return false;
if (bootable != other.bootable)
return false;
if (created == null) {
if (other.created != null)
return false;
} else if (!created.equals(other.created))
return false;
if (crossZones != other.crossZones)
return false;
if (displayText == null) {
if (other.displayText != null)
return false;
} else if (!displayText.equals(other.displayText))
return false;
if (domain == null) {
if (other.domain != null)
return false;
} else if (!domain.equals(other.domain))
return false;
if (domainId != other.domainId)
return false;
if (extractable != other.extractable)
return false;
if (featured != other.featured)
return false;
if (format != other.format)
return false;
if (hypervisor == null) {
if (other.hypervisor != null)
return false;
} else if (!hypervisor.equals(other.hypervisor))
return false;
if (id != other.id)
return false;
if (ispublic != other.ispublic)
return false;
if (jobId == null) {
if (other.jobId != null)
return false;
} else if (!jobId.equals(other.jobId))
return false;
if (jobStatus == null) {
if (other.jobStatus != null)
return false;
} else if (!jobStatus.equals(other.jobStatus))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (passwordEnabled != other.passwordEnabled)
return false;
if (ready != other.ready)
return false;
if (removed == null) {
if (other.removed != null)
return false;
} else if (!removed.equals(other.removed))
return false;
if (size == null) {
if (other.size != null)
return false;
} else if (!size.equals(other.size))
return false;
if (status == null) {
if (other.status != null)
return false;
} else if (!status.equals(other.status))
return false;
if (type != other.type)
return false;
if (zone == null) {
if (other.zone != null)
return false;
} else if (!zone.equals(other.zone))
return false;
if (zoneId != other.zoneId)
return false;
return true;
public int hashCode() {
return Objects.hashCode(id, displayText, domain, domainId, account, accountId,
zone, zoneId, OSType, OSTypeId, name, type, status, format,
hypervisor, size, created, removed, crossZones, bootable,
extractable, featured, ispublic, ready, passwordEnabled,
jobId, jobStatus, checksum, hostId, hostName,
sourceTemplateId, templateTag);
}
@Override
@ -777,6 +692,6 @@ public class Template implements Comparable<Template> {
@Override
public int compareTo(Template arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -34,10 +34,10 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
public static class Builder {
private long id;
private long accountId;
private String id;
private String accountId;
private Date created;
private long extractId;
private String extractId;
private ExtractMode extractMode;
private String name;
private String state;
@ -45,13 +45,13 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
private String storageType;
private int uploadPercentage;
private String url;
private long zoneId;
private String zoneId;
private String zoneName;
/**
* @param id the id of extracted object
*/
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -59,7 +59,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
/**
* @param accountId the account id to which the extracted object belongs
*/
public Builder accountId(long accountId) {
public Builder accountId(String accountId) {
this.accountId = accountId;
return this;
}
@ -75,7 +75,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
/**
* @param extractId the upload id of extracted object
*/
public Builder extractId(long extractId) {
public Builder extractId(String extractId) {
this.extractId = extractId;
return this;
}
@ -139,7 +139,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
/**
* @param zoneId zone ID the object was extracted from
*/
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -159,11 +159,11 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
}
}
private long id;
private String id;
@SerializedName("accountid")
private long accountId;
private String accountId;
private Date created;
private long extractId;
private String extractId;
private ExtractMode extractMode;
private String name;
private String state;
@ -174,15 +174,15 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
private int uploadPercentage;
private String url;
@SerializedName("zoneid")
private long zoneId;
private String zoneId;
/**
* Construct a new TemplateExtraction instance
*/
public TemplateExtraction(long id, long accountId, Date created, long extractId,
public TemplateExtraction(String id, String accountId, Date created, String extractId,
ExtractMode extractMode, String name, String state, String status,
String storageType, int uploadPercentage, String url,
long zoneId, String zoneName) {
String zoneId, String zoneName) {
this.id = id;
this.accountId = accountId;
this.created = created;
@ -211,14 +211,14 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
/**
* @return the id of extracted object
*/
public long getId() {
public String getId() {
return id;
}
/**
* @return the account id to which the extracted object belongs
*/
public long getAccountId() {
public String getAccountId() {
return accountId;
}
@ -232,7 +232,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
/**
* @return the upload id of extracted object
*/
public long getExtractId() {
public String getExtractId() {
return extractId;
}
@ -288,7 +288,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
/**
* @return zone ID the object was extracted from
*/
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -300,34 +300,32 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TemplateExtraction other = (TemplateExtraction) obj;
return id == other.id
&& accountId == other.accountId
&& Objects.equal(created, other.created)
&& extractId == other.extractId
&& Objects.equal(extractMode, other.extractMode)
&& Objects.equal(name, other.name)
&& Objects.equal(state, other.state)
&& Objects.equal(status, other.status)
&& Objects.equal(storageType, other.storageType)
&& uploadPercentage == other.uploadPercentage
&& Objects.equal(url, other.url)
&& zoneId == other.zoneId
&& Objects.equal(zoneName, other.zoneName);
TemplateExtraction that = (TemplateExtraction) o;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(accountId, that.accountId)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(extractId, that.extractId)) return false;
if (!Objects.equal(extractMode, that.extractMode)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(status, that.status)) return false;
if (!Objects.equal(storageType, that.storageType)) return false;
if (!Objects.equal(uploadPercentage, that.uploadPercentage)) return false;
if (!Objects.equal(url, that.url)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hashCode(id, accountId, created, extractId, extractMode,
name, state, status, storageType, uploadPercentage, url, zoneId, zoneName);
return Objects.hashCode(id, accountId, created, extractId, extractMode, name, state, status, storageType, uploadPercentage, url, zoneId, zoneName);
}
@Override
@ -351,7 +349,7 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
@Override
public int compareTo(TemplateExtraction other) {
return new Long(id).compareTo(other.id);
return id.compareTo(other.id);
}
}

View File

@ -31,11 +31,11 @@ public class TemplateMetadata {
public static class Builder {
private String name;
private long osTypeId;
private String osTypeId;
private String displayText;
private Long snapshotId;
private Long volumeId;
private Long virtualMachineId;
private String snapshotId;
private String volumeId;
private String virtualMachineId;
private Boolean passwordEnabled;
/**
@ -51,7 +51,7 @@ public class TemplateMetadata {
* @param osTypeId
* the ID of the OS Type that best represents the OS of this template.
*/
public Builder osTypeId(long osTypeId) {
public Builder osTypeId(String osTypeId) {
this.osTypeId = osTypeId;
return this;
}
@ -70,7 +70,7 @@ public class TemplateMetadata {
* the ID of the snapshot the template is being created from.
* Either this parameter, or volumeId has to be passed in
*/
public Builder snapshotId(Long snapshotId) {
public Builder snapshotId(String snapshotId) {
this.snapshotId = snapshotId;
return this;
}
@ -80,7 +80,7 @@ public class TemplateMetadata {
* the ID of the disk volume the template is being created from.
* Either this parameter, or snapshotId has to be passed in
*/
public Builder volumeId(Long volumeId) {
public Builder volumeId(String volumeId) {
this.volumeId = volumeId;
return this;
}
@ -89,7 +89,7 @@ public class TemplateMetadata {
* @param virtualMachineId
* the ID of the disk volume the template is being created from
*/
public Builder virtualMachineId(Long virtualMachineId) {
public Builder virtualMachineId(String virtualMachineId) {
this.virtualMachineId = virtualMachineId;
return this;
}
@ -113,15 +113,15 @@ public class TemplateMetadata {
}
private String name;
private long osTypeId;
private String osTypeId;
private String displayText;
private Long snapshotId;
private Long volumeId;
private Long virtualMachineId;;
private String snapshotId;
private String volumeId;
private String virtualMachineId;;
private Boolean passwordEnabled;
public TemplateMetadata(String name, long osTypeId, String displayText) {
public TemplateMetadata(String name, String osTypeId, String displayText) {
this.name = name;
this.osTypeId = osTypeId;
this.displayText = displayText;
@ -136,33 +136,33 @@ public class TemplateMetadata {
/**
* @return the ID of the snapshot the template is being created from
*/
public Long getSnapshotId() {
public String getSnapshotId() {
return snapshotId;
}
public void setSnapshotId(Long snapshotId) {
public void setSnapshotId(String snapshotId) {
this.snapshotId = snapshotId;
}
/**
* @return the ID of the disk volume the template is being created from
*/
public Long getVolumeId() {
public String getVolumeId() {
return volumeId;
}
public void setVolumeId(Long volumeId) {
public void setVolumeId(String volumeId) {
this.volumeId = volumeId;
}
/**
* @return Optional, VM ID
*/
public Long getVirtualMachineId() {
public String getVirtualMachineId() {
return virtualMachineId;
}
public void setVirtualMachineId(Long virtualMachineId) {
public void setVirtualMachineId(String virtualMachineId) {
this.virtualMachineId = virtualMachineId;
}
@ -187,7 +187,7 @@ public class TemplateMetadata {
/**
* @return the ID of the OS Type that best represents the OS of this template.
*/
public long getOsTypeId() {
public String getOsTypeId() {
return osTypeId;
}

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -30,12 +31,12 @@ public class TemplatePermission implements Comparable<TemplatePermission> {
}
public static class Builder {
private long id;
private String id;
private String account;
private long domainId;
private String domainId;
private boolean isPublic;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -45,7 +46,7 @@ public class TemplatePermission implements Comparable<TemplatePermission> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -60,9 +61,9 @@ public class TemplatePermission implements Comparable<TemplatePermission> {
}
}
private long id;
private String id;
private String account;
@SerializedName("domainid") private long domainId;
@SerializedName("domainid") private String domainId;
@SerializedName("ispublic") private boolean isPublic;
/**
@ -72,7 +73,7 @@ public class TemplatePermission implements Comparable<TemplatePermission> {
* @param domainId the ID of the domain to which the template belongs
* @param isPublic true if this template is a public template, false otherwise
*/
public TemplatePermission(long id, String account, long domainId, boolean isPublic) {
public TemplatePermission(String id, String account, String domainId, boolean isPublic) {
this.id = id;
this.account = account;
this.domainId = domainId;
@ -89,7 +90,7 @@ public class TemplatePermission implements Comparable<TemplatePermission> {
* Gets the template ID
* @return the template ID
*/
public long getId() {
public String getId() {
return id;
}
@ -105,7 +106,7 @@ public class TemplatePermission implements Comparable<TemplatePermission> {
* Gets the ID of the domain to which the template belongs
* @return the ID of the domain to which the template belongs
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -124,21 +125,17 @@ public class TemplatePermission implements Comparable<TemplatePermission> {
TemplatePermission that = (TemplatePermission) o;
if (domainId != that.domainId) return false;
if (id != that.id) return false;
if (isPublic != that.isPublic) return false;
if (account != null ? !account.equals(that.account) : that.account != null) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(isPublic, that.isPublic)) return false;
if (!Objects.equal(account, that.account)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (account != null ? account.hashCode() : 0);
result = 31 * result + (int) (domainId ^ (domainId >>> 32));
result = 31 * result + (isPublic ? 1 : 0);
return result;
return Objects.hashCode(domainId, id, isPublic, account);
}
@Override
@ -153,7 +150,7 @@ public class TemplatePermission implements Comparable<TemplatePermission> {
@Override
public int compareTo(TemplatePermission other) {
return new Long(id).compareTo(other.getId());
return id.compareTo(other.getId());
}
}

View File

@ -24,6 +24,7 @@ import java.util.Date;
import java.util.Map;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName;
@ -89,20 +90,20 @@ public class UsageRecord implements Comparable<UsageRecord> {
private Builder() {
}
private long id;
private String id;
private String description;
private long accountId;
private String accountId;
private String accountName;
private long domainId;
private String domainId;
private Date startDate;
private Date endDate;
private Date assignDate;
private long releaseDate;
private long zoneId;
private long virtualMachineId;
private String releaseDate;
private String zoneId;
private String virtualMachineId;
private String virtualMachineName;
private long serviceOfferingId;
private long templateId;
private String serviceOfferingId;
private String templateId;
private String ipAddress;
private boolean isSourceNAT;
private double rawUsageHours;
@ -110,7 +111,7 @@ public class UsageRecord implements Comparable<UsageRecord> {
private String type;
private UsageType usageType;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -120,7 +121,7 @@ public class UsageRecord implements Comparable<UsageRecord> {
return this;
}
public Builder accountId(long accountId) {
public Builder accountId(String accountId) {
this.accountId = accountId;
return this;
}
@ -130,7 +131,7 @@ public class UsageRecord implements Comparable<UsageRecord> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -150,17 +151,17 @@ public class UsageRecord implements Comparable<UsageRecord> {
return this;
}
public Builder releaseDate(long releaseDate) {
public Builder releaseDate(String releaseDate) {
this.releaseDate = releaseDate;
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
public Builder virtualMachineId(long virtualMachineId) {
public Builder virtualMachineId(String virtualMachineId) {
this.virtualMachineId = virtualMachineId;
return this;
}
@ -170,12 +171,12 @@ public class UsageRecord implements Comparable<UsageRecord> {
return this;
}
public Builder serviceOfferingId(long serviceOfferingId) {
public Builder serviceOfferingId(String serviceOfferingId) {
this.serviceOfferingId = serviceOfferingId;
return this;
}
public Builder templateId(long templateId) {
public Builder templateId(String templateId) {
this.templateId = templateId;
return this;
}
@ -215,20 +216,20 @@ public class UsageRecord implements Comparable<UsageRecord> {
}
}
@SerializedName("usageid") private long id;
@SerializedName("usageid") private String id;
private String description;
@SerializedName("accountid") private long accountId;
@SerializedName("accountid") private String accountId;
@SerializedName("account") private String accountName;
@SerializedName("domainid") private long domainId;
@SerializedName("domainid") private String domainId;
@SerializedName("startdate") private Date startDate;
@SerializedName("enddate") private Date endDate;
@SerializedName("assigndate") private Date assignDate;
@SerializedName("releasedate") private long releaseDate;
@SerializedName("zoneid") private long zoneId;
@SerializedName("virtualmachineid") private long virtualMachineId;
@SerializedName("releasedate") private String releaseDate;
@SerializedName("zoneid") private String zoneId;
@SerializedName("virtualmachineid") private String virtualMachineId;
@SerializedName("name") private String virtualMachineName;
@SerializedName("offeringid") private long serviceOfferingId;
@SerializedName("templateid") private long templateId;
@SerializedName("offeringid") private String serviceOfferingId;
@SerializedName("templateid") private String templateId;
@SerializedName("ipaddress") private String ipAddress;
@SerializedName("issourcenat") private boolean isSourceNAT;
@SerializedName("rawusage") private double rawUsageHours;
@ -240,7 +241,7 @@ public class UsageRecord implements Comparable<UsageRecord> {
UsageRecord(){
}
public UsageRecord(long id, String description, long accountId, String accountName, long domainId, Date startDate, Date endDate, Date assignDate, long releaseDate, long zoneId, long virtualMachineId, String virtualMachineName, long serviceOfferingId, long templateId, String ipAddress, boolean sourceNAT, double rawUsageHours, String usage, String type, UsageType usageType) {
public UsageRecord(String id, String description, String accountId, String accountName, String domainId, Date startDate, Date endDate, Date assignDate, String releaseDate, String zoneId, String virtualMachineId, String virtualMachineName, String serviceOfferingId, String templateId, String ipAddress, boolean sourceNAT, double rawUsageHours, String usage, String type, UsageType usageType) {
this.id = id;
this.description = description;
this.accountId = accountId;
@ -263,7 +264,7 @@ public class UsageRecord implements Comparable<UsageRecord> {
this.usageType = usageType;
}
public long getId() {
public String getId() {
return id;
}
@ -271,7 +272,7 @@ public class UsageRecord implements Comparable<UsageRecord> {
return description;
}
public long getAccountId() {
public String getAccountId() {
return accountId;
}
@ -279,7 +280,7 @@ public class UsageRecord implements Comparable<UsageRecord> {
return accountName;
}
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -295,15 +296,15 @@ public class UsageRecord implements Comparable<UsageRecord> {
return assignDate;
}
public long getReleaseDate() {
public String getReleaseDate() {
return releaseDate;
}
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
public long getVirtualMachineId() {
public String getVirtualMachineId() {
return virtualMachineId;
}
@ -311,11 +312,11 @@ public class UsageRecord implements Comparable<UsageRecord> {
return virtualMachineName;
}
public long getServiceOfferingId() {
public String getServiceOfferingId() {
return serviceOfferingId;
}
public long getTemplateId() {
public String getTemplateId() {
return templateId;
}
@ -350,57 +351,36 @@ public class UsageRecord implements Comparable<UsageRecord> {
UsageRecord that = (UsageRecord) o;
if (accountId != that.accountId) return false;
if (domainId != that.domainId) return false;
if (id != that.id) return false;
if (isSourceNAT != that.isSourceNAT) return false;
if (Double.compare(that.rawUsageHours, rawUsageHours) != 0) return false;
if (releaseDate != that.releaseDate) return false;
if (serviceOfferingId != that.serviceOfferingId) return false;
if (templateId != that.templateId) return false;
if (virtualMachineId != that.virtualMachineId) return false;
if (zoneId != that.zoneId) return false;
if (accountName != null ? !accountName.equals(that.accountName) : that.accountName != null) return false;
if (assignDate != null ? !assignDate.equals(that.assignDate) : that.assignDate != null) return false;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
if (endDate != null ? !endDate.equals(that.endDate) : that.endDate != null) return false;
if (ipAddress != null ? !ipAddress.equals(that.ipAddress) : that.ipAddress != null) return false;
if (startDate != null ? !startDate.equals(that.startDate) : that.startDate != null) return false;
if (type != null ? !type.equals(that.type) : that.type != null) return false;
if (usage != null ? !usage.equals(that.usage) : that.usage != null) return false;
if (usageType != that.usageType) return false;
if (virtualMachineName != null ? !virtualMachineName.equals(that.virtualMachineName) : that.virtualMachineName != null)
return false;
if (!Objects.equal(accountId, that.accountId)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(isSourceNAT, that.isSourceNAT)) return false;
if (!Objects.equal(rawUsageHours, that.rawUsageHours)) return false;
if (!Objects.equal(releaseDate, that.releaseDate)) return false;
if (!Objects.equal(serviceOfferingId, that.serviceOfferingId)) return false;
if (!Objects.equal(templateId, that.templateId)) return false;
if (!Objects.equal(virtualMachineId, that.virtualMachineId)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(accountName, that.accountName)) return false;
if (!Objects.equal(assignDate, that.assignDate)) return false;
if (!Objects.equal(description, that.description)) return false;
if (!Objects.equal(endDate, that.endDate)) return false;
if (!Objects.equal(ipAddress, that.ipAddress)) return false;
if (!Objects.equal(startDate, that.startDate)) return false;
if (!Objects.equal(type, that.type)) return false;
if (!Objects.equal(usage, that.usage)) return false;
if (!Objects.equal(usageType, that.usageType)) return false;
if (!Objects.equal(virtualMachineName, that.virtualMachineName)) return false;
return true;
}
@Override
public int hashCode() {
int result;
long temp;
result = (int) (id ^ (id >>> 32));
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (int) (accountId ^ (accountId >>> 32));
result = 31 * result + (accountName != null ? accountName.hashCode() : 0);
result = 31 * result + (int) (domainId ^ (domainId >>> 32));
result = 31 * result + (startDate != null ? startDate.hashCode() : 0);
result = 31 * result + (endDate != null ? endDate.hashCode() : 0);
result = 31 * result + (assignDate != null ? assignDate.hashCode() : 0);
result = 31 * result + (int) (releaseDate ^ (releaseDate >>> 32));
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (int) (virtualMachineId ^ (virtualMachineId >>> 32));
result = 31 * result + (virtualMachineName != null ? virtualMachineName.hashCode() : 0);
result = 31 * result + (int) (serviceOfferingId ^ (serviceOfferingId >>> 32));
result = 31 * result + (int) (templateId ^ (templateId >>> 32));
result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0);
result = 31 * result + (isSourceNAT ? 1 : 0);
temp = rawUsageHours != +0.0d ? Double.doubleToLongBits(rawUsageHours) : 0L;
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + (usage != null ? usage.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (usageType != null ? usageType.hashCode() : 0);
return result;
return Objects.hashCode(accountId, domainId, id, isSourceNAT, rawUsageHours, releaseDate,
serviceOfferingId, templateId, virtualMachineId, zoneId, accountName,
assignDate, description, endDate, ipAddress, startDate, type, usage,
usageType, virtualMachineName);
}
@Override
@ -431,6 +411,6 @@ public class UsageRecord implements Comparable<UsageRecord> {
@Override
public int compareTo(UsageRecord other) {
return Long.valueOf(this.id).compareTo(other.id);
return this.id.compareTo(other.id);
}
}

View File

@ -22,6 +22,7 @@ import java.util.Date;
import org.jclouds.cloudstack.domain.Account.Type;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -54,7 +55,7 @@ public class User implements Comparable<User> {
}
public static class Builder {
private long id;
private String id;
private String name;
private String firstName;
private String lastName;
@ -64,12 +65,12 @@ public class User implements Comparable<User> {
private String account;
private Account.Type accountType;
private String domain;
private long domainId;
private String domainId;
private String timeZone;
private String apiKey;
private String secretKey;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -119,7 +120,7 @@ public class User implements Comparable<User> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -153,7 +154,7 @@ public class User implements Comparable<User> {
}
private long id;
private String id;
@SerializedName("username")
private String name;
@SerializedName("firstname")
@ -168,7 +169,7 @@ public class User implements Comparable<User> {
private Account.Type accountType;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("timezone")
private String timeZone;
@SerializedName("apikey")
@ -176,8 +177,8 @@ public class User implements Comparable<User> {
@SerializedName("secretkey")
private String secretKey;
public User(long id, String name, String firstname, String lastname, String email, Date created, State state,
String account, Type accountType, String domain, long domainId, String timeZone, String apiKey,
public User(String id, String name, String firstname, String lastname, String email, Date created, State state,
String account, Type accountType, String domain, String domainId, String timeZone, String apiKey,
String secretKey) {
this.id = id;
this.name = name;
@ -199,7 +200,7 @@ public class User implements Comparable<User> {
*
* @return the user ID
*/
public long getId() {
public String getId() {
return id;
}
@ -279,7 +280,7 @@ public class User implements Comparable<User> {
*
* @return the domain ID of the user
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -309,38 +310,26 @@ public class User implements Comparable<User> {
@Override
public int compareTo(User arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User that = (User) o;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((account == null) ? 0 : account.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + (int) (id ^ (id >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (account == null) {
if (other.account != null)
return false;
} else if (!account.equals(other.account))
return false;
if (domainId != other.domainId)
return false;
if (id != other.id)
return false;
return true;
return Objects.hashCode(account, domainId, id);
}
@Override

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.domain;
import java.util.Date;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -33,14 +34,14 @@ public class VMGroup implements Comparable<VMGroup> {
public static class Builder {
private long id;
private String id;
private String account;
private Date created;
private String domain;
private long domainId;
private String domainId;
private String name;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -60,7 +61,7 @@ public class VMGroup implements Comparable<VMGroup> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -75,15 +76,15 @@ public class VMGroup implements Comparable<VMGroup> {
}
}
private long id;
private String id;
private String account;
private Date created;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
private String name;
public VMGroup(long id, String account, Date created, String domain, long domainId, String name) {
public VMGroup(String id, String account, Date created, String domain, String domainId, String name) {
this.id = id;
this.account = account;
this.created = created;
@ -101,7 +102,7 @@ public class VMGroup implements Comparable<VMGroup> {
/**
* @return the VMGroup's ID
*/
public long getId() {
public String getId() {
return id;
}
@ -129,7 +130,7 @@ public class VMGroup implements Comparable<VMGroup> {
/**
* @return the ID of the domain that contains the VMGroup
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -145,27 +146,21 @@ public class VMGroup implements Comparable<VMGroup> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VMGroup vmGroup = (VMGroup) o;
VMGroup that = (VMGroup) o;
if (domainId != vmGroup.domainId) return false;
if (id != vmGroup.id) return false;
if (account != null ? !account.equals(vmGroup.account) : vmGroup.account != null) return false;
if (created != null ? !created.equals(vmGroup.created) : vmGroup.created != null) return false;
if (domain != null ? !domain.equals(vmGroup.domain) : vmGroup.domain != null) return false;
if (name != null ? !name.equals(vmGroup.name) : vmGroup.name != null) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(name, that.name)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (account != null ? account.hashCode() : 0);
result = 31 * result + (created != null ? created.hashCode() : 0);
result = 31 * result + (domain != null ? domain.hashCode() : 0);
result = 31 * result + (int) (domainId ^ (domainId >>> 32));
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
return Objects.hashCode(domainId, id, account, created, domain, name);
}
@Override
@ -182,6 +177,6 @@ public class VMGroup implements Comparable<VMGroup> {
@Override
public int compareTo(VMGroup vmGroup) {
return new Long(id).compareTo(vmGroup.getId());
return id.compareTo(vmGroup.getId());
}
}

View File

@ -26,6 +26,7 @@ import java.util.Set;
import javax.annotation.Nullable;
import com.google.common.base.CaseFormat;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
@ -42,7 +43,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
}
public static class Builder {
private long id;
private String id;
private String account;
private long cpuCount;
private long cpuSpeed;
@ -50,19 +51,19 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
private String displayName;
private Date created;
private String domain;
private long domainId;
private String domainId;
private boolean usesVirtualNetwork;
private String group;
private long groupId;
private long guestOSId;
private String groupId;
private String guestOSId;
private boolean HAEnabled;
private long hostId;
private String hostId;
private String hostname;
private String IPAddress;
private String ISODisplayText;
private long ISOId;
private String ISOId;
private String ISOName;
private Long jobId;
private String jobId;
private Integer jobStatus;
private long memory;
private String name;
@ -70,21 +71,21 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
private Long networkKbsWrite;
private String password;
private boolean passwordEnabled;
private long rootDeviceId;
private String rootDeviceId;
private String rootDeviceType;
private long serviceOfferingId;
private String serviceOfferingId;
private String serviceOfferingName;
private State state;
private String templateDisplayText;
private long templateId;
private String templateId;
private String templateName;
private long zoneId;
private String zoneId;
private String zoneName;
private Set<NIC> nics = ImmutableSet.<NIC> of();
private String hypervisor;
private Set<SecurityGroup> securityGroups = ImmutableSet.<SecurityGroup> of();
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -124,7 +125,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -139,12 +140,12 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
return this;
}
public Builder groupId(long groupId) {
public Builder groupId(String groupId) {
this.groupId = groupId;
return this;
}
public Builder guestOSId(long guestOSId) {
public Builder guestOSId(String guestOSId) {
this.guestOSId = guestOSId;
return this;
}
@ -154,7 +155,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
return this;
}
public Builder hostId(long hostId) {
public Builder hostId(String hostId) {
this.hostId = hostId;
return this;
}
@ -174,7 +175,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
return this;
}
public Builder ISOId(long ISOId) {
public Builder ISOId(String ISOId) {
this.ISOId = ISOId;
return this;
}
@ -184,7 +185,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
return this;
}
public Builder jobId(Long jobId) {
public Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
@ -224,7 +225,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
return this;
}
public Builder rootDeviceId(long rootDeviceId) {
public Builder rootDeviceId(String rootDeviceId) {
this.rootDeviceId = rootDeviceId;
return this;
}
@ -234,7 +235,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
return this;
}
public Builder serviceOfferingId(long serviceOfferingId) {
public Builder serviceOfferingId(String serviceOfferingId) {
this.serviceOfferingId = serviceOfferingId;
return this;
}
@ -254,7 +255,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
return this;
}
public Builder templateId(long templateId) {
public Builder templateId(String templateId) {
this.templateId = templateId;
return this;
}
@ -264,7 +265,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -315,7 +316,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
}
private long id;
private String id;
private String account;
@SerializedName("cpunumber")
private long cpuCount;
@ -328,30 +329,30 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
private Date created;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("forvirtualnetwork")
private boolean usesVirtualNetwork;
private String group;
@SerializedName("groupid")
private long groupId;
private String groupId;
@SerializedName("guestosid")
private long guestOSId;
private String guestOSId;
@SerializedName("haenable")
private boolean HAEnabled;
@SerializedName("hostid")
private long hostId;
private String hostId;
private String hostname;
@SerializedName("ipaddress")
private String IPAddress;
@SerializedName("isodisplaytext")
private String ISODisplayText;
@SerializedName("isoid")
private long ISOId;
private String ISOId;
@SerializedName("isoname")
private String ISOName;
@SerializedName("jobid")
@Nullable
private Long jobId;
private String jobId;
@SerializedName("jobstatus")
@Nullable
private Integer jobStatus;
@ -366,22 +367,22 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
@SerializedName("passwordenabled")
private boolean passwordEnabled;
@SerializedName("rootdeviceid")
private long rootDeviceId;
private String rootDeviceId;
@SerializedName("rootdevicetype")
private String rootDeviceType;
@SerializedName("serviceofferingid")
private long serviceOfferingId;
private String serviceOfferingId;
@SerializedName("serviceofferingname")
private String serviceOfferingName;
private State state;
@SerializedName("templatedisplaytext")
private String templateDisplayText;
@SerializedName("templateid")
private long templateId;
private String templateId;
@SerializedName("templatename")
private String templateName;
@SerializedName("zoneid")
private long zoneId;
private String zoneId;
@SerializedName("zonename")
private String zoneName;
@SerializedName("nic")
@ -390,13 +391,13 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
@SerializedName("securitygroup")
private Set<SecurityGroup> securityGroups = ImmutableSet.<SecurityGroup> of();
public VirtualMachine(long id, String account, long cpuCount, long cpuSpeed, String cpuUsed, String displayName,
Date created, String domain, long domainId, boolean usesVirtualNetwork, String group, long groupId,
long guestOSId, boolean hAEnabled, long hostId, String hostname, String iPAddress, String iSODisplayText,
long iSOId, String iSOName, Long jobId, Integer jobStatus, long memory, String name, Long networkKbsRead,
Long networkKbsWrite, String password, boolean passwordEnabled, long rootDeviceId, String rootDeviceType,
Set<SecurityGroup> securityGroups, long serviceOfferingId, String serviceOfferingName, State state,
String templateDisplayText, long templateId, String templateName, long zoneId, String zoneName, Set<NIC> nics,
public VirtualMachine(String id, String account, long cpuCount, long cpuSpeed, String cpuUsed, String displayName,
Date created, String domain, String domainId, boolean usesVirtualNetwork, String group, String groupId,
String guestOSId, boolean hAEnabled, String hostId, String hostname, String iPAddress, String iSODisplayText,
String iSOId, String iSOName, String jobId, Integer jobStatus, long memory, String name, Long networkKbsRead,
Long networkKbsWrite, String password, boolean passwordEnabled, String rootDeviceId, String rootDeviceType,
Set<SecurityGroup> securityGroups, String serviceOfferingId, String serviceOfferingName, State state,
String templateDisplayText, String templateId, String templateName, String zoneId, String zoneName, Set<NIC> nics,
String hypervisor) {
Preconditions.checkArgument(Strings.isNullOrEmpty(cpuUsed) || cpuUsed.matches("^[0-9\\.]+%$"), "cpuUsed value should be a decimal number followed by %");
this.id = id;
@ -452,7 +453,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
/**
* @return the ID of the virtual machine
*/
public long getId() {
public String getId() {
return id;
}
@ -509,7 +510,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
/**
* @return the ID of the domain in which the virtual machine exists
*/
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -530,14 +531,14 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
/**
* @return the group ID of the virtual machine
*/
public long getGroupId() {
public String getGroupId() {
return groupId;
}
/**
* @return Os type ID of the virtual machine
*/
public long getGuestOSId() {
public String getGuestOSId() {
return guestOSId;
}
@ -551,7 +552,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
/**
* @return the ID of the host for the virtual machine
*/
public long getHostId() {
public String getHostId() {
return hostId;
}
@ -586,7 +587,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
/**
* @return the ID of the ISO attached to the virtual machine
*/
public long getISOId() {
public String getISOId() {
return ISOId;
}
@ -603,7 +604,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
* machine
*/
@Nullable
public Long getJobId() {
public String getJobId() {
return jobId;
}
@ -661,7 +662,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
/**
* @return device ID of the root volume
*/
public long getRootDeviceId() {
public String getRootDeviceId() {
return rootDeviceId;
}
@ -682,7 +683,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
/**
* @return the ID of the service offering of the virtual machine
*/
public long getServiceOfferingId() {
public String getServiceOfferingId() {
return serviceOfferingId;
}
@ -711,7 +712,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
* @return the ID of the template for the virtual machine. A -1 is returned
* if the virtual machine was created from an ISO file.
*/
public long getTemplateId() {
public String getTemplateId() {
return templateId;
}
@ -725,7 +726,7 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
/**
* @return the ID of the availablility zone for the virtual machine
*/
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -751,209 +752,67 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (HAEnabled ? 1231 : 1237);
result = prime * result + ((IPAddress == null) ? 0 : IPAddress.hashCode());
result = prime * result + ((ISODisplayText == null) ? 0 : ISODisplayText.hashCode());
result = prime * result + (int) (ISOId ^ (ISOId >>> 32));
result = prime * result + ((ISOName == null) ? 0 : ISOName.hashCode());
result = prime * result + ((account == null) ? 0 : account.hashCode());
result = prime * result + (int) (cpuCount ^ (cpuCount >>> 32));
result = prime * result + (int) (cpuSpeed ^ (cpuSpeed >>> 32));
result = prime * result + ((cpuUsed == null) ? 0 : cpuUsed.hashCode());
result = prime * result + ((created == null) ? 0 : created.hashCode());
result = prime * result + ((displayName == null) ? 0 : displayName.hashCode());
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + ((group == null) ? 0 : group.hashCode());
result = prime * result + (int) (groupId ^ (groupId >>> 32));
result = prime * result + (int) (guestOSId ^ (guestOSId >>> 32));
result = prime * result + (int) (hostId ^ (hostId >>> 32));
result = prime * result + ((hostname == null) ? 0 : hostname.hashCode());
result = prime * result + ((hypervisor == null) ? 0 : hypervisor.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((jobId == null) ? 0 : jobId.hashCode());
result = prime * result + ((jobStatus == null) ? 0 : jobStatus.hashCode());
result = prime * result + (int) (memory ^ (memory >>> 32));
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((networkKbsRead == null) ? 0 : networkKbsRead.hashCode());
result = prime * result + ((networkKbsWrite == null) ? 0 : networkKbsWrite.hashCode());
result = prime * result + ((nics == null) ? 0 : nics.hashCode());
result = prime * result + ((password == null) ? 0 : password.hashCode());
result = prime * result + (passwordEnabled ? 1231 : 1237);
result = prime * result + (int) (rootDeviceId ^ (rootDeviceId >>> 32));
result = prime * result + ((securityGroups == null) ? 0 : securityGroups.hashCode());
result = prime * result + (int) (serviceOfferingId ^ (serviceOfferingId >>> 32));
result = prime * result + ((serviceOfferingName == null) ? 0 : serviceOfferingName.hashCode());
result = prime * result + ((templateDisplayText == null) ? 0 : templateDisplayText.hashCode());
result = prime * result + (int) (templateId ^ (templateId >>> 32));
result = prime * result + ((templateName == null) ? 0 : templateName.hashCode());
result = prime * result + (usesVirtualNetwork ? 1231 : 1237);
result = prime * result + (int) (zoneId ^ (zoneId >>> 32));
result = prime * result + ((zoneName == null) ? 0 : zoneName.hashCode());
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VirtualMachine that = (VirtualMachine) o;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(cpuCount, that.cpuCount)) return false;
if (!Objects.equal(cpuSpeed, that.cpuSpeed)) return false;
if (!Objects.equal(cpuUsed, that.cpuUsed)) return false;
if (!Objects.equal(displayName, that.displayName)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(usesVirtualNetwork, that.usesVirtualNetwork)) return false;
if (!Objects.equal(group, that.group)) return false;
if (!Objects.equal(groupId, that.groupId)) return false;
if (!Objects.equal(guestOSId, that.guestOSId)) return false;
if (!Objects.equal(HAEnabled, that.HAEnabled)) return false;
if (!Objects.equal(hostId, that.hostId)) return false;
if (!Objects.equal(hostname, that.hostname)) return false;
if (!Objects.equal(IPAddress, that.IPAddress)) return false;
if (!Objects.equal(ISODisplayText, that.ISODisplayText)) return false;
if (!Objects.equal(ISOId, that.ISOId)) return false;
if (!Objects.equal(ISOName, that.ISOName)) return false;
if (!Objects.equal(jobId, that.jobId)) return false;
if (!Objects.equal(jobStatus, that.jobStatus)) return false;
if (!Objects.equal(memory, that.memory)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(networkKbsRead, that.networkKbsRead)) return false;
if (!Objects.equal(networkKbsWrite, that.networkKbsWrite)) return false;
if (!Objects.equal(password, that.password)) return false;
if (!Objects.equal(passwordEnabled, that.passwordEnabled)) return false;
if (!Objects.equal(rootDeviceId, that.rootDeviceId)) return false;
if (!Objects.equal(rootDeviceType, that.rootDeviceType)) return false;
if (!Objects.equal(securityGroups, that.securityGroups)) return false;
if (!Objects.equal(serviceOfferingId, that.serviceOfferingId)) return false;
if (!Objects.equal(serviceOfferingName, that.serviceOfferingName)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(templateDisplayText, that.templateDisplayText)) return false;
if (!Objects.equal(templateId, that.templateId)) return false;
if (!Objects.equal(templateName, that.templateName)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
if (!Objects.equal(nics, that.nics)) return false;
if (!Objects.equal(hypervisor, that.hypervisor)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VirtualMachine other = (VirtualMachine) obj;
if (HAEnabled != other.HAEnabled)
return false;
if (IPAddress == null) {
if (other.IPAddress != null)
return false;
} else if (!IPAddress.equals(other.IPAddress))
return false;
if (ISODisplayText == null) {
if (other.ISODisplayText != null)
return false;
} else if (!ISODisplayText.equals(other.ISODisplayText))
return false;
if (ISOId != other.ISOId)
return false;
if (ISOName == null) {
if (other.ISOName != null)
return false;
} else if (!ISOName.equals(other.ISOName))
return false;
if (account == null) {
if (other.account != null)
return false;
} else if (!account.equals(other.account))
return false;
if (cpuCount != other.cpuCount)
return false;
if (cpuSpeed != other.cpuSpeed)
return false;
if (cpuUsed == null) {
if (other.cpuUsed != null)
return false;
} else if (!cpuUsed.equals(other.cpuUsed))
return false;
if (created == null) {
if (other.created != null)
return false;
} else if (!created.equals(other.created))
return false;
if (displayName == null) {
if (other.displayName != null)
return false;
} else if (!displayName.equals(other.displayName))
return false;
if (domain == null) {
if (other.domain != null)
return false;
} else if (!domain.equals(other.domain))
return false;
if (domainId != other.domainId)
return false;
if (group == null) {
if (other.group != null)
return false;
} else if (!group.equals(other.group))
return false;
if (groupId != other.groupId)
return false;
if (guestOSId != other.guestOSId)
return false;
if (hostId != other.hostId)
return false;
if (hostname == null) {
if (other.hostname != null)
return false;
} else if (!hostname.equals(other.hostname))
return false;
if (hypervisor == null) {
if (other.hypervisor != null)
return false;
} else if (!hypervisor.equals(other.hypervisor))
return false;
if (id != other.id)
return false;
if (jobId == null) {
if (other.jobId != null)
return false;
} else if (!jobId.equals(other.jobId))
return false;
if (jobStatus == null) {
if (other.jobStatus != null)
return false;
} else if (!jobStatus.equals(other.jobStatus))
return false;
if (memory != other.memory)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (networkKbsRead == null) {
if (other.networkKbsRead != null)
return false;
} else if (!networkKbsRead.equals(other.networkKbsRead))
return false;
if (networkKbsWrite == null) {
if (other.networkKbsWrite != null)
return false;
} else if (!networkKbsWrite.equals(other.networkKbsWrite))
return false;
if (nics == null) {
if (other.nics != null)
return false;
} else if (!nics.equals(other.nics))
return false;
if (password == null) {
if (other.password != null)
return false;
} else if (!password.equals(other.password))
return false;
if (passwordEnabled != other.passwordEnabled)
return false;
if (rootDeviceId != other.rootDeviceId)
return false;
// rootDeviceType and state are volatile
if (securityGroups == null) {
if (other.securityGroups != null)
return false;
} else if (!securityGroups.equals(other.securityGroups))
return false;
if (serviceOfferingId != other.serviceOfferingId)
return false;
if (serviceOfferingName == null) {
if (other.serviceOfferingName != null)
return false;
} else if (!serviceOfferingName.equals(other.serviceOfferingName))
return false;
if (templateDisplayText == null) {
if (other.templateDisplayText != null)
return false;
} else if (!templateDisplayText.equals(other.templateDisplayText))
return false;
if (templateId != other.templateId)
return false;
if (templateName == null) {
if (other.templateName != null)
return false;
} else if (!templateName.equals(other.templateName))
return false;
if (usesVirtualNetwork != other.usesVirtualNetwork)
return false;
if (zoneId != other.zoneId)
return false;
if (zoneName == null) {
if (other.zoneName != null)
return false;
} else if (!zoneName.equals(other.zoneName))
return false;
return true;
public int hashCode() {
return Objects.hashCode(id, account, cpuCount, cpuSpeed, cpuUsed, displayName, created,
domain, domainId, usesVirtualNetwork, group, groupId, guestOSId,
HAEnabled, hostId, hostname, IPAddress, ISODisplayText, ISOId,
ISOName, jobId, jobStatus, memory, name, networkKbsRead,
networkKbsWrite, password, passwordEnabled, rootDeviceId,
rootDeviceType, securityGroups, serviceOfferingId,
serviceOfferingName, state, templateDisplayText, templateId,
templateName, zoneId, zoneName, nics, hypervisor);
}
@Override
@ -1005,6 +864,6 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
@Override
public int compareTo(VirtualMachine arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
/**
@ -33,23 +34,23 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
public static class Builder {
private long id;
private String id;
private String description;
private boolean forVirtualNetwork;
private long zoneId;
private String zoneId;
private String vlan;
private String account;
private long domainId;
private String domainId;
private String domain;
private long podId;
private String podId;
private String podName;
private String gateway;
private String netmask;
private String startIP;
private String endIP;
private long networkId;
private String networkId;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -64,16 +65,11 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
public Builder vlan(long vlan) {
this.vlan = vlan+"";
return this;
}
public Builder vlan(String vlan) {
this.vlan = vlan;
return this;
@ -84,7 +80,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -94,7 +90,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return this;
}
public Builder podId(long podId) {
public Builder podId(String podId) {
this.podId = podId;
return this;
}
@ -124,7 +120,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return this;
}
public Builder networkId(long networkId) {
public Builder networkId(String networkId) {
this.networkId = networkId;
return this;
}
@ -134,26 +130,26 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
}
}
private long id;
private String id;
private String description;
@SerializedName("forvirtualnetwork") private boolean forVirtualNetwork;
@SerializedName("zoneid") private long zoneId;
@SerializedName("zoneid") private String zoneId;
private String vlan;
private String account;
@SerializedName("domainid") private long domainId;
@SerializedName("domainid") private String domainId;
private String domain;
@SerializedName("podid") private long podId;
@SerializedName("podid") private String podId;
@SerializedName("podname") private String podName;
private String gateway;
private String netmask;
@SerializedName("startip") private String startIP;
@SerializedName("endip") private String endIP;
@SerializedName("networkid") private long networkId;
@SerializedName("networkid") private String networkId;
/* just for the deserializer */
VlanIPRange() {}
public VlanIPRange(long id, String description, boolean forVirtualNetwork, long zoneId, String vlan, String account, long domainId, String domain, long podId, String podName, String gateway, String netmask, String startIP, String endIP, long networkId) {
public VlanIPRange(String id, String description, boolean forVirtualNetwork, String zoneId, String vlan, String account, String domainId, String domain, String podId, String podName, String gateway, String netmask, String startIP, String endIP, String networkId) {
this.id = id;
this.description = description;
this.forVirtualNetwork = forVirtualNetwork;
@ -171,7 +167,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
this.networkId = networkId;
}
public long getId() {
public String getId() {
return id;
}
@ -183,7 +179,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return forVirtualNetwork;
}
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -195,7 +191,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return account;
}
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -203,7 +199,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return domain;
}
public long getPodId() {
public String getPodId() {
return podId;
}
@ -227,7 +223,7 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
return endIP;
}
public long getNetworkId() {
public String getNetworkId() {
return networkId;
}
@ -238,43 +234,30 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
VlanIPRange that = (VlanIPRange) o;
if (domainId != that.domainId) return false;
if (forVirtualNetwork != that.forVirtualNetwork) return false;
if (id != that.id) return false;
if (networkId != that.networkId) return false;
if (podId != that.podId) return false;
if (zoneId != that.zoneId) return false;
if (account != null ? !account.equals(that.account) : that.account != null) return false;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
if (domain != null ? !domain.equals(that.domain) : that.domain != null) return false;
if (endIP != null ? !endIP.equals(that.endIP) : that.endIP != null) return false;
if (gateway != null ? !gateway.equals(that.gateway) : that.gateway != null) return false;
if (netmask != null ? !netmask.equals(that.netmask) : that.netmask != null) return false;
if (podName != null ? !podName.equals(that.podName) : that.podName != null) return false;
if (startIP != null ? !startIP.equals(that.startIP) : that.startIP != null) return false;
if (vlan != null ? !vlan.equals(that.vlan) : that.vlan != null) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(forVirtualNetwork, that.forVirtualNetwork)) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(networkId, that.networkId)) return false;
if (!Objects.equal(podId, that.podId)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(description, that.description)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(endIP, that.endIP)) return false;
if (!Objects.equal(gateway, that.gateway)) return false;
if (!Objects.equal(netmask, that.netmask)) return false;
if (!Objects.equal(podName, that.podName)) return false;
if (!Objects.equal(startIP, that.startIP)) return false;
if (!Objects.equal(vlan, that.vlan)) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (forVirtualNetwork ? 1 : 0);
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (vlan != null ? vlan.hashCode() : 0);
result = 31 * result + (account != null ? account.hashCode() : 0);
result = 31 * result + (int) (domainId ^ (domainId >>> 32));
result = 31 * result + (domain != null ? domain.hashCode() : 0);
result = 31 * result + (int) (podId ^ (podId >>> 32));
result = 31 * result + (podName != null ? podName.hashCode() : 0);
result = 31 * result + (gateway != null ? gateway.hashCode() : 0);
result = 31 * result + (netmask != null ? netmask.hashCode() : 0);
result = 31 * result + (startIP != null ? startIP.hashCode() : 0);
result = 31 * result + (endIP != null ? endIP.hashCode() : 0);
result = 31 * result + (int) (networkId ^ (networkId >>> 32));
return result;
return Objects.hashCode(domainId, forVirtualNetwork, id, networkId, podId,
zoneId, account, description, domain, endIP, gateway,
netmask, podName, startIP, vlan);
}
@Override
@ -300,6 +283,6 @@ public class VlanIPRange implements Comparable<VlanIPRange> {
@Override
public int compareTo(VlanIPRange other) {
return Long.valueOf(this.id).compareTo(other.id);
return this.id.compareTo(other.id);
}
}

View File

@ -26,6 +26,7 @@ import java.util.Map;
import com.google.common.base.CaseFormat;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName;
@ -42,39 +43,39 @@ public class Volume implements Comparable<Volume> {
public static class Builder {
private long id;
private String id;
private String account;
private Date attached;
private Date created;
private boolean destroyed;
private long deviceId;
private String deviceId;
private String diskOfferingDisplayText;
private long diskOfferingId;
private String diskOfferingId;
private String diskOfferingName;
private String domain;
private long domainId;
private String domainId;
private String hypervisor;
private boolean isExtractable;
private long jobId;
private String jobId;
private String jobStatus;
private String name;
private String serviceOfferingDisplayText;
private long serviceOfferingId;
private String serviceOfferingId;
private String serviceOfferingName;
private long size;
private long snapshotId;
private String snapshotId;
private State state;
private String storage;
private String storageType;
private Type type;
private long virtualMachineId;
private String virtualMachineId;
private String vmDisplayName;
private String vmName;
private VirtualMachine.State vmState;
private long zoneId;
private String zoneId;
private String zoneName;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -99,7 +100,7 @@ public class Volume implements Comparable<Volume> {
return this;
}
public Builder deviceId(long deviceId) {
public Builder deviceId(String deviceId) {
this.deviceId = deviceId;
return this;
}
@ -109,7 +110,7 @@ public class Volume implements Comparable<Volume> {
return this;
}
public Builder diskOfferingId(long diskOfferingId) {
public Builder diskOfferingId(String diskOfferingId) {
this.diskOfferingId = diskOfferingId;
return this;
}
@ -124,7 +125,7 @@ public class Volume implements Comparable<Volume> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -139,7 +140,7 @@ public class Volume implements Comparable<Volume> {
return this;
}
public Builder jobId(long jobId) {
public Builder jobId(String jobId) {
this.jobId = jobId;
return this;
}
@ -159,7 +160,7 @@ public class Volume implements Comparable<Volume> {
return this;
}
public Builder serviceOfferingId(long serviceOfferingId) {
public Builder serviceOfferingId(String serviceOfferingId) {
this.serviceOfferingId = serviceOfferingId;
return this;
}
@ -174,7 +175,7 @@ public class Volume implements Comparable<Volume> {
return this;
}
public Builder snapshotId(long snapshotId) {
public Builder snapshotId(String snapshotId) {
this.snapshotId = snapshotId;
return this;
}
@ -199,7 +200,7 @@ public class Volume implements Comparable<Volume> {
return this;
}
public Builder virtualMachineId(long virtualMachineId) {
public Builder virtualMachineId(String virtualMachineId) {
this.virtualMachineId = virtualMachineId;
return this;
}
@ -219,7 +220,7 @@ public class Volume implements Comparable<Volume> {
return this;
}
public Builder zoneId(long zoneId) {
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@ -237,39 +238,39 @@ public class Volume implements Comparable<Volume> {
}
}
private long id;
private String id;
private String account;
private Date attached;
private Date created;
private boolean destroyed;
@SerializedName("deviceid")
private long deviceId;
private String deviceId;
@SerializedName("diskofferingdisplaytext")
private String diskOfferingDisplayText;
@SerializedName("diskofferingid")
private long diskOfferingId;
private String diskOfferingId;
@SerializedName("diskofferingname")
private String diskOfferingName;
private String domain;
@SerializedName("domainid")
private long domainId;
private String domainId;
private String hypervisor;
@SerializedName("isextractable")
private boolean isExtractable;
@SerializedName("jobid")
private long jobId;
private String jobId;
@SerializedName("jobstatus")
private String jobStatus;
private String name;
@SerializedName("serviceofferingdisplaytext")
private String serviceOfferingDisplayText;
@SerializedName("serviceofferingid")
private long serviceOfferingId;
private String serviceOfferingId;
@SerializedName("serviceofferingname")
private String serviceOfferingName;
private long size;
@SerializedName("snapshotid")
private long snapshotId;
private String snapshotId;
private State state;
private String storage;
@SerializedName("storagetype")
@ -277,7 +278,7 @@ public class Volume implements Comparable<Volume> {
private String storageType;
private Type type;
@SerializedName("virtualmachineid")
private long virtualMachineId;
private String virtualMachineId;
@SerializedName("vmdisplayname")
private String vmDisplayName;
@SerializedName("vmname")
@ -285,17 +286,17 @@ public class Volume implements Comparable<Volume> {
@SerializedName("vmstate")
private VirtualMachine.State vmState;
@SerializedName("zoneid")
private long zoneId;
private String zoneId;
@SerializedName("zonename")
private String zoneName;
public Volume(long id,String account, Date attached, Date created, boolean destroyed, long deviceId,
String diskOfferingDisplayText, long diskOfferingId, String diskOfferingName,
String domain, long domainId, String hypervisor, boolean extractable, long jobId,
String jobStatus, String name, String serviceOfferingDisplayText, long serviceOfferingId,
String serviceOfferingName, long size, long snapshotId, State state, String storage,
String storageType, Type type, long virtualMachineId, String vmDisplayName, String vmName,
VirtualMachine.State vmState, long zoneId, String zoneName) {
public Volume(String id,String account, Date attached, Date created, boolean destroyed, String deviceId,
String diskOfferingDisplayText, String diskOfferingId, String diskOfferingName,
String domain, String domainId, String hypervisor, boolean extractable, String jobId,
String jobStatus, String name, String serviceOfferingDisplayText, String serviceOfferingId,
String serviceOfferingName, long size, String snapshotId, State state, String storage,
String storageType, Type type, String virtualMachineId, String vmDisplayName, String vmName,
VirtualMachine.State vmState, String zoneId, String zoneName) {
this.id = id;
this.account = account;
this.attached = attached;
@ -333,7 +334,7 @@ public class Volume implements Comparable<Volume> {
Volume() {
}
public long getId() {
public String getId() {
return id;
}
@ -349,7 +350,7 @@ public class Volume implements Comparable<Volume> {
return destroyed;
}
public long getDeviceId() {
public String getDeviceId() {
return deviceId;
}
@ -357,7 +358,7 @@ public class Volume implements Comparable<Volume> {
return diskOfferingDisplayText;
}
public long getDiskOfferingId() {
public String getDiskOfferingId() {
return diskOfferingId;
}
@ -369,7 +370,7 @@ public class Volume implements Comparable<Volume> {
return domain;
}
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -381,7 +382,7 @@ public class Volume implements Comparable<Volume> {
return isExtractable;
}
public long getJobId() {
public String getJobId() {
return jobId;
}
@ -397,7 +398,7 @@ public class Volume implements Comparable<Volume> {
return serviceOfferingDisplayText;
}
public long getServiceOfferingId() {
public String getServiceOfferingId() {
return serviceOfferingId;
}
@ -409,7 +410,7 @@ public class Volume implements Comparable<Volume> {
return size;
}
public long getSnapshotId() {
public String getSnapshotId() {
return snapshotId;
}
@ -429,7 +430,7 @@ public class Volume implements Comparable<Volume> {
return type;
}
public long getVirtualMachineId() {
public String getVirtualMachineId() {
return virtualMachineId;
}
@ -445,7 +446,7 @@ public class Volume implements Comparable<Volume> {
return vmState;
}
public long getZoneId() {
public String getZoneId() {
return zoneId;
}
@ -459,7 +460,7 @@ public class Volume implements Comparable<Volume> {
@Override
public int compareTo(Volume volume) {
return Long.valueOf(this.id).compareTo(volume.id);
return this.id.compareTo(volume.id);
}
@ -468,86 +469,51 @@ public class Volume implements Comparable<Volume> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Volume volume = (Volume) o;
Volume that = (Volume) o;
if (deviceId != volume.deviceId) return false;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(account, that.account)) return false;
if (!Objects.equal(attached, that.attached)) return false;
if (!Objects.equal(created, that.created)) return false;
if (!Objects.equal(destroyed, that.destroyed)) return false;
if (!Objects.equal(deviceId, that.deviceId)) return false;
if (!Objects.equal(diskOfferingDisplayText, that.diskOfferingDisplayText)) return false;
if (!Objects.equal(diskOfferingId, that.diskOfferingId)) return false;
if (!Objects.equal(diskOfferingName, that.diskOfferingName)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(hypervisor, that.hypervisor)) return false;
if (!Objects.equal(isExtractable, that.isExtractable)) return false;
if (!Objects.equal(jobId, that.jobId)) return false;
if (!Objects.equal(jobStatus, that.jobStatus)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(serviceOfferingDisplayText, that.serviceOfferingDisplayText)) return false;
if (!Objects.equal(serviceOfferingId, that.serviceOfferingId)) return false;
if (!Objects.equal(serviceOfferingName, that.serviceOfferingName)) return false;
if (!Objects.equal(size, that.size)) return false;
if (!Objects.equal(snapshotId, that.snapshotId)) return false;
if (!Objects.equal(state, that.state)) return false;
if (!Objects.equal(storage, that.storage)) return false;
if (!Objects.equal(storageType, that.storageType)) return false;
if (!Objects.equal(type, that.type)) return false;
if (!Objects.equal(virtualMachineId, that.virtualMachineId)) return false;
if (!Objects.equal(vmDisplayName, that.vmDisplayName)) return false;
if (!Objects.equal(vmName, that.vmName)) return false;
if (!Objects.equal(vmState, that.vmState)) return false;
if (!Objects.equal(zoneId, that.zoneId)) return false;
if (!Objects.equal(zoneName, that.zoneName)) return false;
if (diskOfferingId != volume.diskOfferingId) return false;
if (domainId != volume.domainId) return false;
if (id != volume.id) return false;
if (isExtractable != volume.isExtractable) return false;
if (jobId != volume.jobId) return false;
if (serviceOfferingId != volume.serviceOfferingId) return false;
if (size != volume.size) return false;
if (snapshotId != volume.snapshotId) return false;
if (virtualMachineId != volume.virtualMachineId) return false;
if (zoneId != volume.zoneId) return false;
if (attached != null ? !attached.equals(volume.attached) : volume.attached != null) return false;
if (!created.equals(volume.created)) return false;
if (diskOfferingDisplayText != null ? !diskOfferingDisplayText.equals(volume.diskOfferingDisplayText) :
volume.diskOfferingDisplayText != null)
return false;
if (diskOfferingName != null ? !diskOfferingName.equals(volume.diskOfferingName) : volume.diskOfferingName != null)
return false;
if (!domain.equals(volume.domain)) return false;
if (hypervisor != null ? !hypervisor.equals(volume.hypervisor) : volume.hypervisor != null) return false;
if (jobStatus != null ? !jobStatus.equals(volume.jobStatus) : volume.jobStatus != null) return false;
if (name != null ? !name.equals(volume.name) : volume.name != null) return false;
if (serviceOfferingDisplayText != null ? !serviceOfferingDisplayText.equals(volume.serviceOfferingDisplayText) :
volume.serviceOfferingDisplayText != null)
return false;
if (serviceOfferingName != null ? !serviceOfferingName.equals(volume.serviceOfferingName) :
volume.serviceOfferingName != null)
return false;
if (state != null ? !state.equals(volume.state) : volume.state != null) return false;
if (storage != null ? !storage.equals(volume.storage) : volume.storage != null) return false;
if (storageType != null ? !storageType.equals(volume.storageType) : volume.storageType != null) return false;
if (type != null ? !type.equals(volume.type) : volume.type != null) return false;
if (vmDisplayName != null ? !vmDisplayName.equals(volume.vmDisplayName) : volume.vmDisplayName != null)
return false;
if (vmName != null ? !vmName.equals(volume.vmName) : volume.vmName != null) return false;
if (vmState != volume.vmState) return false;
if (zoneName != null ? !zoneName.equals(volume.zoneName) : volume.zoneName != null) return false;
if (account == null) {
if (volume.account != null)
return false;
} else if (!account.equals(volume.account))
return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (attached != null ? attached.hashCode() : 0);
result = 31 * result + created.hashCode();
result = 31 * result + (int) (deviceId ^ (deviceId >>> 32));
result = 31 * result + (diskOfferingDisplayText != null ? diskOfferingDisplayText.hashCode() : 0);
result = 31 * result + (int) (diskOfferingId ^ (diskOfferingId >>> 32));
result = 31 * result + (diskOfferingName != null ? diskOfferingName.hashCode() : 0);
result = 31 * result + domain.hashCode();
result = 31 * result + (int) (domainId ^ (domainId >>> 32));
result = 31 * result + (hypervisor != null ? hypervisor.hashCode() : 0);
result = 31 * result + (isExtractable ? 1 : 0);
result = 31 * result + (int) (jobId ^ (jobId >>> 32));
result = 31 * result + (jobStatus != null ? jobStatus.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (serviceOfferingDisplayText != null ? serviceOfferingDisplayText.hashCode() : 0);
result = 31 * result + (int) (serviceOfferingId ^ (serviceOfferingId >>> 32));
result = 31 * result + (serviceOfferingName != null ? serviceOfferingName.hashCode() : 0);
result = 31 * result + (int) (size ^ (size >>> 32));
result = 31 * result + (int) (snapshotId ^ (snapshotId >>> 32));
result = 31 * result + (state != null ? state.hashCode() : 0);
result = 31 * result + (storage != null ? storage.hashCode() : 0);
result = 31 * result + (storageType != null ? storageType.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (int) (virtualMachineId ^ (virtualMachineId >>> 32));
result = 31 * result + (vmDisplayName != null ? vmDisplayName.hashCode() : 0);
result = 31 * result + (vmName != null ? vmName.hashCode() : 0);
result = 31 * result + (vmState != null ? vmState.hashCode() : 0);
result = 31 * result + (int) (zoneId ^ (zoneId >>> 32));
result = 31 * result + (zoneName != null ? zoneName.hashCode() : 0);
return result;
return Objects.hashCode(id, account, attached, created, destroyed, deviceId, diskOfferingDisplayText,
diskOfferingId, diskOfferingName, domain, domainId, hypervisor,
isExtractable, jobId, jobStatus, name, serviceOfferingDisplayText,
serviceOfferingId, serviceOfferingName, size, snapshotId, state, storage,
storageType, type, virtualMachineId, vmDisplayName, vmName, vmState, zoneId,
zoneName);
}
@Override

View File

@ -24,6 +24,7 @@ import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.gson.annotations.SerializedName;
@ -37,12 +38,12 @@ public class Zone implements Comparable<Zone> {
}
public static class Builder {
private long id;
private String id;
private String description;
private String displayText;
private List<String> DNS = ImmutableList.of();
private String domain;
private long domainId;
private String domainId;
private String guestCIDRAddress;
private List<String> internalDNS = ImmutableList.of();
private String name;
@ -53,7 +54,7 @@ public class Zone implements Comparable<Zone> {
private String dhcpProvider;
private String zoneToken;
public Builder id(long id) {
public Builder id(String id) {
this.id = id;
return this;
}
@ -78,7 +79,7 @@ public class Zone implements Comparable<Zone> {
return this;
}
public Builder domainId(long domainId) {
public Builder domainId(String domainId) {
this.domainId = domainId;
return this;
}
@ -135,7 +136,7 @@ public class Zone implements Comparable<Zone> {
}
}
private long id;
private String id;
private String description;
@SerializedName("displaytext")
private String displayText;
@ -146,7 +147,7 @@ public class Zone implements Comparable<Zone> {
private String domain;
@Nullable
@SerializedName("domainid")
private long domainId;
private String domainId;
@SerializedName("guestcidraddress")
private String guestCIDRAddress;
@SerializedName("internaldns1")
@ -174,7 +175,7 @@ public class Zone implements Comparable<Zone> {
}
public Zone(long id, String description, String displayText, List<String> DNS, String domain, long domainId,
public Zone(String id, String description, String displayText, List<String> DNS, String domain, String domainId,
String guestCIDRAddress, List<String> internalDNS, String name, NetworkType networkType,
String vLAN, boolean securityGroupsEnabled, AllocationState allocationState, String dhcpProvider, String zoneToken) {
this.id = id;
@ -199,7 +200,7 @@ public class Zone implements Comparable<Zone> {
/**
* @return Zone id
*/
public long getId() {
public String getId() {
return id;
}
@ -240,7 +241,7 @@ public class Zone implements Comparable<Zone> {
* @return the ID of the containing domain, null for public zones
*/
@Nullable
public long getDomainId() {
public String getDomainId() {
return domainId;
}
@ -313,103 +314,39 @@ public class Zone implements Comparable<Zone> {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((DNS1 == null) ? 0 : DNS1.hashCode());
result = prime * result + ((DNS2 == null) ? 0 : DNS2.hashCode());
result = prime * result + ((VLAN == null) ? 0 : VLAN.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((displayText == null) ? 0 : displayText.hashCode());
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + (int) (domainId ^ (domainId >>> 32));
result = prime * result + ((guestCIDRAddress == null) ? 0 : guestCIDRAddress.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((internalDNS1 == null) ? 0 : internalDNS1.hashCode());
result = prime * result + ((internalDNS2 == null) ? 0 : internalDNS2.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((allocationState == null) ? 0 : allocationState.hashCode());
result = prime * result + ((networkType == null) ? 0 : networkType.hashCode());
result = prime * result + (securityGroupsEnabled ? 1231 : 1237);
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Zone that = (Zone) o;
if (!Objects.equal(id, that.id)) return false;
if (!Objects.equal(description, that.description)) return false;
if (!Objects.equal(displayText, that.displayText)) return false;
if (!Objects.equal(DNS1, that.DNS1)) return false;
if (!Objects.equal(DNS2, that.DNS2)) return false;
if (!Objects.equal(domain, that.domain)) return false;
if (!Objects.equal(domainId, that.domainId)) return false;
if (!Objects.equal(guestCIDRAddress, that.guestCIDRAddress)) return false;
if (!Objects.equal(internalDNS1, that.internalDNS1)) return false;
if (!Objects.equal(internalDNS2, that.internalDNS2)) return false;
if (!Objects.equal(name, that.name)) return false;
if (!Objects.equal(networkType, that.networkType)) return false;
if (!Objects.equal(VLAN, that.VLAN)) return false;
if (!Objects.equal(securityGroupsEnabled, that.securityGroupsEnabled)) return false;
if (!Objects.equal(allocationState, that.allocationState)) return false;
if (!Objects.equal(dhcpProvider, that.dhcpProvider)) return false;
if (!Objects.equal(zoneToken, that.zoneToken)) return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Zone other = (Zone) obj;
if (DNS1 == null) {
if (other.DNS1 != null)
return false;
} else if (!DNS1.equals(other.DNS1))
return false;
if (DNS2 == null) {
if (other.DNS2 != null)
return false;
} else if (!DNS2.equals(other.DNS2))
return false;
if (VLAN == null) {
if (other.VLAN != null)
return false;
} else if (!VLAN.equals(other.VLAN))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (allocationState == null) {
if (other.allocationState != null)
return false;
} else if (!allocationState.equals(other.allocationState))
return false;
if (displayText == null) {
if (other.displayText != null)
return false;
} else if (!displayText.equals(other.displayText))
return false;
if (domain == null) {
if (other.domain != null)
return false;
} else if (!domain.equals(other.domain))
return false;
if (domainId != other.domainId)
return false;
if (guestCIDRAddress == null) {
if (other.guestCIDRAddress != null)
return false;
} else if (!guestCIDRAddress.equals(other.guestCIDRAddress))
return false;
if (id != other.id)
return false;
if (internalDNS1 == null) {
if (other.internalDNS1 != null)
return false;
} else if (!internalDNS1.equals(other.internalDNS1))
return false;
if (internalDNS2 == null) {
if (other.internalDNS2 != null)
return false;
} else if (!internalDNS2.equals(other.internalDNS2))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (networkType == null) {
if (other.networkType != null)
return false;
} else if (!networkType.equals(other.networkType))
return false;
if (securityGroupsEnabled != other.securityGroupsEnabled)
return false;
return true;
public int hashCode() {
return Objects.hashCode(id, description, displayText, DNS1, DNS2, domain, domainId,
guestCIDRAddress, internalDNS1, internalDNS2, name, networkType, VLAN,
securityGroupsEnabled, allocationState, dhcpProvider,
zoneToken);
}
@Override
@ -437,6 +374,6 @@ public class Zone implements Comparable<Zone> {
@Override
public int compareTo(Zone arg0) {
return new Long(id).compareTo(arg0.getId());
return id.compareTo(arg0.getId());
}
}

View File

@ -53,7 +53,7 @@ public interface AccountAsyncClient {
* @see AccountClient#listAccounts
*/
@GET
@QueryParams(keys = "command", values = "listAccounts")
@QueryParams(keys = { "command", "listAll" }, values = { "listAccounts", "true" })
@SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@ -63,11 +63,11 @@ public interface AccountAsyncClient {
* @see AccountClient#getAccount
*/
@GET
@QueryParams(keys = "command", values = "listAccounts")
@QueryParams(keys = { "command", "listAll" }, values = { "listAccounts", "true" })
@SelectJson("account")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Account> getAccount(@QueryParam("id") long id);
ListenableFuture<Account> getAccount(@QueryParam("id") String id);
}

View File

@ -50,5 +50,5 @@ public interface AccountClient {
* Account to get
* @return Account or null if not found
*/
Account getAccount(long id);
Account getAccount(String id);
}

View File

@ -58,7 +58,7 @@ public interface AddressAsyncClient {
* @see AddressClient#listPublicIPAddresses
*/
@GET
@QueryParams(keys = "command", values = "listPublicIpAddresses")
@QueryParams(keys = { "command", "listAll" }, values = { "listPublicIpAddresses", "true" })
@SelectJson("publicipaddress")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@ -68,12 +68,12 @@ public interface AddressAsyncClient {
* @see AddressClient#getPublicIPAddress
*/
@GET
@QueryParams(keys = "command", values = "listPublicIpAddresses")
@QueryParams(keys = { "command", "listAll" }, values = { "listPublicIpAddresses", "true" })
@SelectJson("publicipaddress")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<PublicIPAddress> getPublicIPAddress(@QueryParam("id") long id);
ListenableFuture<PublicIPAddress> getPublicIPAddress(@QueryParam("id") String id);
/**
* @see AddressClient#associateIPAddressInZone
@ -82,7 +82,7 @@ public interface AddressAsyncClient {
@QueryParams(keys = "command", values = "associateIpAddress")
@Unwrap
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<AsyncCreateResponse> associateIPAddressInZone(@QueryParam("zoneid") long zoneId,
ListenableFuture<AsyncCreateResponse> associateIPAddressInZone(@QueryParam("zoneid") String zoneId,
AssociateIPAddressOptions... options);
/**
@ -91,6 +91,6 @@ public interface AddressAsyncClient {
@GET
@QueryParams(keys = "command", values = "disassociateIpAddress")
@ExceptionParser(ReturnVoidOnNotFoundOr404OrUnableToFindAccountOwner.class)
ListenableFuture<Void> disassociateIPAddress(@QueryParam("id") long id);
ListenableFuture<Void> disassociateIPAddress(@QueryParam("id") String id);
}

View File

@ -54,7 +54,7 @@ public interface AddressClient {
* IPAddress to get
* @return IPAddress or null if not found
*/
PublicIPAddress getPublicIPAddress(long id);
PublicIPAddress getPublicIPAddress(String id);
/**
* Acquires and associates a public IP to an account.
@ -64,7 +64,7 @@ public interface AddressClient {
* address from
* @return IPAddress
*/
AsyncCreateResponse associateIPAddressInZone(long zoneId, AssociateIPAddressOptions... options);
AsyncCreateResponse associateIPAddressInZone(String zoneId, AssociateIPAddressOptions... options);
/**
* Disassociates an ip address from the account.
@ -73,5 +73,5 @@ public interface AddressClient {
* the id of the public ip address to disassociate
*/
@Timeout(duration = 120, timeUnit = TimeUnit.SECONDS)
void disassociateIPAddress(long id);
void disassociateIPAddress(String id);
}

View File

@ -55,7 +55,7 @@ public interface AsyncJobAsyncClient {
* @see AsyncJobClient#listAsyncJobs
*/
@GET
@QueryParams(keys = "command", values = "listAsyncJobs")
@QueryParams(keys = { "command", "listAll" }, values = { "listAsyncJobs", "true" })
@ResponseParser(ParseAsyncJobsFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<AsyncJob<?>>> listAsyncJobs(ListAsyncJobsOptions... options);
@ -68,6 +68,6 @@ public interface AsyncJobAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseAsyncJobFromHttpResponse.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
<T> ListenableFuture<AsyncJob<T>> getAsyncJob(@QueryParam("jobid") long id);
<T> ListenableFuture<AsyncJob<T>> getAsyncJob(@QueryParam("jobid") String id);
}

View File

@ -51,5 +51,5 @@ public interface AsyncJobClient {
* asyncJob to get
* @return asyncJob or null if not found
*/
<T> AsyncJob<T> getAsyncJob(long id);
<T> AsyncJob<T> getAsyncJob(String id);
}

View File

@ -39,7 +39,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* @author Adrian Cole
*/
@RequestFilters(AuthenticationFilter.class)
@QueryParams(keys = "response", values = "json")
@QueryParams(keys = { "response", "listAll" }, values = { "json", "true" })
public interface ConfigurationAsyncClient {
/**

View File

@ -56,7 +56,7 @@ public interface DomainAccountAsyncClient extends AccountAsyncClient {
@SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Account> enableAccount(@QueryParam("account") String accountName, @QueryParam("domainid") long domainId);
ListenableFuture<Account> enableAccount(@QueryParam("account") String accountName, @QueryParam("domainid") String domainId);
/**
@ -68,6 +68,6 @@ public interface DomainAccountAsyncClient extends AccountAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<AsyncCreateResponse> disableAccount(@QueryParam("account") String accountName,
@QueryParam("domainid") long domainId, @QueryParam("lock") boolean onlyLock);
@QueryParam("domainid") String domainId, @QueryParam("lock") boolean onlyLock);
}

View File

@ -44,7 +44,7 @@ public interface DomainAccountClient extends AccountClient {
* @param domainId
* the domain ID
*/
Account enableAccount(String accountName, long domainId);
Account enableAccount(String accountName, String domainId);
/**
* Disable or lock an account
@ -56,6 +56,6 @@ public interface DomainAccountClient extends AccountClient {
* @param onlyLock
* only lock if true disable otherwise
*/
AsyncCreateResponse disableAccount(String accountName, long domainId, boolean onlyLock);
AsyncCreateResponse disableAccount(String accountName, String domainId, boolean onlyLock);
}

View File

@ -56,7 +56,7 @@ public interface DomainDomainAsyncClient {
* @see DomainDomainClient#listDomains
*/
@GET
@QueryParams(keys = "command", values = "listDomains")
@QueryParams(keys = { "command", "listAll" }, values = { "listDomains", "true" })
@SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@ -66,18 +66,18 @@ public interface DomainDomainAsyncClient {
* @see DomainDomainClient#getDomainById
*/
@GET
@QueryParams(keys = "command", values = "listDomains")
@QueryParams(keys = { "command", "listAll" }, values = { "listDomains", "true" })
@SelectJson("domain")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Domain> getDomainById(@QueryParam("id") long domainId);
ListenableFuture<Domain> getDomainById(@QueryParam("id") String domainId);
/**
* @see DomainDomainClient#listDomainChildren
*/
@GET
@QueryParams(keys = "command", values = "listDomainChildren")
@QueryParams(keys = { "command", "listAll" }, values = { "listDomainChildren", "true" })
@SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)

Some files were not shown because too many files have changed in this diff Show More