diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java index 9d9ca3714f..7888ee35ae 100644 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java +++ b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java @@ -31,7 +31,7 @@ import org.jclouds.http.RequiresHttp; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.vcloud.CommonVCloudClient; import org.jclouds.vcloud.config.VCloudExpressRestClientModule; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import com.google.common.base.Predicate; @@ -49,28 +49,28 @@ public class BlueLockVCloudExpressRestClientModule extends VCloudExpressRestClie @Override protected URI provideDefaultNetwork(CommonVCloudClient client) { org.jclouds.vcloud.domain.VDC vDC = client.findVDCInOrgNamed(null, null); - Map networks = vDC.getAvailableNetworks(); + Map networks = vDC.getAvailableNetworks(); checkState(networks.size() > 0, "No networks present in vDC: " + vDC.getName()); - return Iterables.getOnlyElement(Iterables.filter(networks.values(), new Predicate() { + return Iterables.getOnlyElement(Iterables.filter(networks.values(), new Predicate() { @Override - public boolean apply(NamedResource input) { + public boolean apply(ReferenceType input) { return input.getName().equals("Internal In and Out"); } - })).getId(); + })).getHref(); } @Override protected URI provideCatalog(Org org, @Named(PROPERTY_IDENTITY) final String user) { checkState(org.getCatalogs().size() > 0, "No catalogs present in org: " + org.getName()); - return Iterables.getOnlyElement(Iterables.filter(org.getCatalogs().values(), new Predicate() { + return Iterables.getOnlyElement(Iterables.filter(org.getCatalogs().values(), new Predicate() { @Override - public boolean apply(NamedResource input) { + public boolean apply(ReferenceType input) { return input.getName().startsWith(user); } - })).getId(); + })).getHref(); } } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/domain/VCloudLocation.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/domain/VCloudLocation.java index 58d440bcb7..1f5f0e31f0 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/domain/VCloudLocation.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/domain/VCloudLocation.java @@ -24,7 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import org.jclouds.domain.Location; import org.jclouds.domain.LocationScope; import org.jclouds.domain.internal.LocationImpl; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; /** * @@ -34,15 +34,15 @@ public class VCloudLocation extends LocationImpl { private static final long serialVersionUID = -5052812549904524841L; - private final NamedResource resource; + private final ReferenceType resource; - public VCloudLocation(NamedResource resource, Location parent) { + public VCloudLocation(ReferenceType resource, Location parent) { super(checkNotNull(resource, "resource").getType().endsWith("org+xml") ? LocationScope.REGION - : LocationScope.ZONE, resource.getId().toASCIIString(), resource.getName(), parent); + : LocationScope.ZONE, resource.getHref().toASCIIString(), resource.getName(), parent); this.resource = resource; } - public NamedResource getResource() { + public ReferenceType getResource() { return resource; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java index e6d71e63ac..8b668688b7 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java @@ -29,7 +29,7 @@ import javax.inject.Singleton; import org.jclouds.domain.Location; import org.jclouds.logging.Logger; import org.jclouds.vcloud.compute.domain.VCloudLocation; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import com.google.common.base.Supplier; @@ -55,12 +55,12 @@ public class FindLocationForResource { * @throws NoSuchElementException * if not found */ - public Location apply(NamedResource resource) { + public Location apply(ReferenceType resource) { for (Location input : locations.get()) { do { // The "name" isn't always present, ex inside a vApp we have a rel // link that only includes href and type. - if (VCloudLocation.class.cast(input).getResource().getId().equals(resource.getId())) + if (VCloudLocation.class.cast(input).getResource().getHref().equals(resource.getHref())) return input; input = input.getParent(); } while (input.getParent() != null); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java index b06992f465..bc41013650 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java @@ -30,7 +30,7 @@ import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy; import org.jclouds.domain.Location; import org.jclouds.vcloud.compute.domain.VCloudImage; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VAppTemplate; import com.google.common.base.Function; @@ -42,7 +42,7 @@ import com.google.common.collect.ImmutableMap; public class ImageForVAppTemplate implements Function { private final FindLocationForResource findLocationForResource; private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider; - private NamedResource parent; + private ReferenceType parent; @Inject protected ImageForVAppTemplate(FindLocationForResource findLocationForResource, @@ -51,7 +51,7 @@ public class ImageForVAppTemplate implements Function { this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider"); } - public ImageForVAppTemplate withParent(NamedResource parent) { + public ImageForVAppTemplate withParent(ReferenceType parent) { this.parent = parent; return this; } @@ -69,8 +69,8 @@ public class ImageForVAppTemplate implements Function { Location location = findLocationForResource.apply(checkNotNull(parent, "parent")); String name = getName(from.getName()); String desc = from.getDescription() != null ? from.getDescription() : from.getName(); - return new VCloudImage(from, from.getId().toASCIIString(), name, from.getId().toASCIIString(), location, from - .getId(), ImmutableMap. of(), os, desc, "", credentialsProvider.execute(from)); + return new VCloudImage(from, from.getHref().toASCIIString(), name, from.getHref().toASCIIString(), location, from + .getHref(), ImmutableMap. of(), os, desc, "", credentialsProvider.execute(from)); } protected String getName(String name) { diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVCloudExpressVAppTemplate.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVCloudExpressVAppTemplate.java index e7dd087916..0e48c92635 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVCloudExpressVAppTemplate.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVCloudExpressVAppTemplate.java @@ -30,7 +30,7 @@ import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy; import org.jclouds.domain.Location; import org.jclouds.vcloud.compute.domain.VCloudExpressImage; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; import com.google.common.base.Function; @@ -42,7 +42,7 @@ import com.google.common.collect.ImmutableMap; public class ImageForVCloudExpressVAppTemplate implements Function { private final FindLocationForResource findLocationForResource; private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider; - private NamedResource parent; + private ReferenceType parent; @Inject protected ImageForVCloudExpressVAppTemplate(FindLocationForResource findLocationForResource, @@ -51,7 +51,7 @@ public class ImageForVCloudExpressVAppTemplate implements Function of(), os, desc, "", credentialsProvider.execute(from)); + return new VCloudExpressImage(from, from.getHref().toASCIIString(), name, from.getHref().toASCIIString(), location, from + .getHref(), ImmutableMap. of(), os, desc, "", credentialsProvider.execute(from)); } protected String getName(String name) { diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/internal/CommonVCloudComputeClientImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/internal/CommonVCloudComputeClientImpl.java index b1a7a529d0..0a63209fbd 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/internal/CommonVCloudComputeClientImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/internal/CommonVCloudComputeClientImpl.java @@ -33,7 +33,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; import org.jclouds.vcloud.CommonVCloudClient; import org.jclouds.vcloud.compute.CommonVCloudComputeClient; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Task; @@ -45,7 +45,7 @@ import com.google.inject.Inject; * @author Adrian Cole */ @Singleton -public abstract class CommonVCloudComputeClientImpl implements CommonVCloudComputeClient { +public abstract class CommonVCloudComputeClientImpl implements CommonVCloudComputeClient { @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) protected Logger logger = Logger.NULL; @@ -69,7 +69,7 @@ public abstract class CommonVCloudComputeClientImpl protected Map parseResponse(T template, A vAppResponse) { Map config = Maps.newLinkedHashMap();// Allows nulls - config.put("id", vAppResponse.getId().toASCIIString()); + config.put("id", vAppResponse.getHref().toASCIIString()); config.put("username", null); config.put("password", null); return config; @@ -80,7 +80,7 @@ public abstract class CommonVCloudComputeClientImpl A vApp = refreshVApp(id); logger.debug(">> resetting vApp(%s)", vApp.getName()); Task task = reset(vApp); - if (!taskTester.apply(task.getId())) { + if (!taskTester.apply(task.getHref())) { throw new RuntimeException(String.format("failed to %s %s: %s", "resetVApp", vApp.getName(), task)); } logger.debug("<< on vApp(%s)", vApp.getName()); @@ -101,18 +101,18 @@ public abstract class CommonVCloudComputeClientImpl private void deleteVApp(A vApp) { logger.debug(">> deleting vApp(%s)", vApp.getName()); - client.deleteVApp(vApp.getId()); + client.deleteVApp(vApp.getHref()); } private A undeployVAppIfDeployed(A vApp) { if (getStatus(vApp).compareTo(Status.RESOLVED) > 0) { logger.debug(">> undeploying vApp(%s), current status: %s", vApp.getName(), getStatus(vApp)); Task task = undeploy(vApp); - if (!taskTester.apply(task.getId())) { + if (!taskTester.apply(task.getHref())) { // TODO timeout throw new RuntimeException(String.format("failed to %s %s: %s", "undeploy", vApp.getName(), task)); } - vApp = refreshVApp(vApp.getId()); + vApp = refreshVApp(vApp.getHref()); logger.debug("<< %s vApp(%s)", getStatus(vApp), vApp.getName()); } return vApp; @@ -124,11 +124,11 @@ public abstract class CommonVCloudComputeClientImpl if (getStatus(vApp).compareTo(Status.OFF) > 0) { logger.debug(">> powering off vApp(%s), current status: %s", vApp.getName(), getStatus(vApp)); Task task = powerOff(vApp); - if (!taskTester.apply(task.getId())) { + if (!taskTester.apply(task.getHref())) { // TODO timeout throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), task)); } - vApp = refreshVApp(vApp.getId()); + vApp = refreshVApp(vApp.getHref()); logger.debug("<< %s vApp(%s)", getStatus(vApp), vApp.getName()); } return vApp; diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/internal/VCloudComputeClientImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/internal/VCloudComputeClientImpl.java index a6806c3cee..c31800f190 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/internal/VCloudComputeClientImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/internal/VCloudComputeClientImpl.java @@ -67,15 +67,15 @@ public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl> deploying vApp(%s)", vAppResponse.getName()); - Task task = VCloudClient.class.cast(client).deployAndPowerOnVAppOrVm(vAppResponse.getId()); + Task task = VCloudClient.class.cast(client).deployAndPowerOnVAppOrVm(vAppResponse.getHref()); if (options.shouldBlockOnDeploy()) { - if (!taskTester.apply(task.getId())) { + if (!taskTester.apply(task.getHref())) { throw new RuntimeException(String.format("failed to %s %s: %s", "deploy and power on", vAppResponse .getName(), task)); } @@ -109,16 +109,16 @@ public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl> deploying vApp(%s)", vAppResponse.getName()); - Task task = VCloudExpressClient.class.cast(client).deployVApp(vAppResponse.getId()); + Task task = VCloudExpressClient.class.cast(client).deployVApp(vAppResponse.getHref()); if (options.shouldBlockOnDeploy()) { - if (!taskTester.apply(task.getId())) { + if (!taskTester.apply(task.getHref())) { throw new RuntimeException(String.format("failed to %s %s: %s", "deploy", vAppResponse.getName(), task)); } logger.debug("<< deployed vApp(%s)", vAppResponse.getName()); logger.debug(">> powering vApp(%s)", vAppResponse.getName()); - task = VCloudExpressClient.class.cast(client).powerOnVApp(vAppResponse.getId()); - if (!taskTester.apply(task.getId())) { + task = VCloudExpressClient.class.cast(client).powerOnVApp(vAppResponse.getHref()); + if (!taskTester.apply(task.getHref())) { throw new RuntimeException(String.format("failed to %s %s: %s", "powerOn", vAppResponse.getName(), task)); } logger.debug("<< on vApp(%s)", vAppResponse.getName()); @@ -115,16 +115,16 @@ public class VCloudExpressComputeClientImpl extends @Override protected Task powerOff(VCloudExpressVApp vApp) { - return VCloudExpressClient.class.cast(client).powerOffVApp(vApp.getId()); + return VCloudExpressClient.class.cast(client).powerOffVApp(vApp.getHref()); } @Override protected Task reset(VCloudExpressVApp vApp) { - return VCloudExpressClient.class.cast(client).resetVApp(vApp.getId()); + return VCloudExpressClient.class.cast(client).resetVApp(vApp.getHref()); } @Override protected Task undeploy(VCloudExpressVApp vApp) { - return VCloudExpressClient.class.cast(client).undeployVApp(vApp.getId()); + return VCloudExpressClient.class.cast(client).undeployVApp(vApp.getHref()); } } \ No newline at end of file diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudAddNodeWithTagStrategy.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudAddNodeWithTagStrategy.java index 7f0dc44392..4ccfdcc2bc 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudAddNodeWithTagStrategy.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudAddNodeWithTagStrategy.java @@ -73,11 +73,11 @@ public class VCloudAddNodeWithTagStrategy implements AddNodeWithTagStrategy { } protected NodeMetadata newCreateNodeResponse(String tag, Template template, Map metaMap, VApp vApp) { - return new NodeMetadataImpl(vApp.getId().toASCIIString(), vApp.getName(), vApp.getId().toASCIIString(), template - .getLocation(), vApp.getId(), ImmutableMap. of(), tag, template.getImage().getId(), + return new NodeMetadataImpl(vApp.getHref().toASCIIString(), vApp.getName(), vApp.getHref().toASCIIString(), template + .getLocation(), vApp.getHref(), ImmutableMap. of(), tag, template.getImage().getId(), getOperatingSystemForVAppOrDefaultTo(vApp, template.getImage().getOperatingSystem()), - vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getId()), - computeClient.getPrivateAddresses(vApp.getId()), ImmutableMap. of(), new Credentials( + vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getHref()), + computeClient.getPrivateAddresses(vApp.getHref()), ImmutableMap. of(), new Credentials( metaMap.get("username"), metaMap.get("password"))); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressAddNodeWithTagStrategy.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressAddNodeWithTagStrategy.java index 7ac660604e..2550f22750 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressAddNodeWithTagStrategy.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressAddNodeWithTagStrategy.java @@ -73,11 +73,11 @@ public class VCloudExpressAddNodeWithTagStrategy implements AddNodeWithTagStrate } protected NodeMetadata newCreateNodeResponse(String tag, Template template, Map metaMap, VCloudExpressVApp vApp) { - return new NodeMetadataImpl(vApp.getId().toASCIIString(), vApp.getName(), vApp.getId().toASCIIString(), template - .getLocation(), vApp.getId(), ImmutableMap. of(), tag, template.getImage().getId(), + return new NodeMetadataImpl(vApp.getHref().toASCIIString(), vApp.getName(), vApp.getHref().toASCIIString(), template + .getLocation(), vApp.getHref(), ImmutableMap. of(), tag, template.getImage().getId(), getOperatingSystemForVAppOrDefaultTo(vApp, template.getImage().getOperatingSystem()), - vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getId()), - computeClient.getPrivateAddresses(vApp.getId()), ImmutableMap. of(), new Credentials( + vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getHref()), + computeClient.getPrivateAddresses(vApp.getHref()), ImmutableMap. of(), new Credentials( metaMap.get("username"), metaMap.get("password"))); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressGetNodeMetadataStrategy.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressGetNodeMetadataStrategy.java index f244436920..e001141826 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressGetNodeMetadataStrategy.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressGetNodeMetadataStrategy.java @@ -84,7 +84,7 @@ public class VCloudExpressGetNodeMetadataStrategy implements GetNodeMetadataStra return null; String tag = parseTagFromName(from.getName()); Location location = findLocationForResourceInVDC.apply(from.getVDC()); - return new NodeMetadataImpl(in, from.getName(), in, location, from.getId(), ImmutableMap. of(), + return new NodeMetadataImpl(in, from.getName(), in, location, from.getHref(), ImmutableMap. of(), tag, null, from.getOsType() != null ? new CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(from .getOsType()), null, null, from.getOperatingSystemDescription()) : null, vAppStatusToNodeState .get(from.getStatus()), computeClient.getPublicAddresses(id), computeClient diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressListNodesStrategy.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressListNodesStrategy.java index f477c81d95..1f0123c667 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressListNodesStrategy.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressListNodesStrategy.java @@ -39,7 +39,7 @@ import org.jclouds.logging.Logger; import org.jclouds.vcloud.CommonVCloudClient; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.compute.functions.FindLocationForResource; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.endpoints.Org; import com.google.common.annotations.VisibleForTesting; @@ -71,11 +71,11 @@ public class VCloudExpressListNodesStrategy implements ListNodesStrategy { this.blackListVAppNames = ImmutableSet.copyOf(Splitter.on(',').split(blackListNodes)); } - private final Supplier> orgNameToEndpoint; + private final Supplier> orgNameToEndpoint; @Inject protected VCloudExpressListNodesStrategy(CommonVCloudClient client, - @Org Supplier> orgNameToEndpoint, VCloudExpressGetNodeMetadataStrategy getNodeMetadata, + @Org Supplier> orgNameToEndpoint, VCloudExpressGetNodeMetadataStrategy getNodeMetadata, FindLocationForResource findLocationForResourceInVDC) { this.client = client; this.orgNameToEndpoint = orgNameToEndpoint; @@ -87,8 +87,8 @@ public class VCloudExpressListNodesStrategy implements ListNodesStrategy { public Iterable list() { Set nodes = Sets.newHashSet(); for (String org : orgNameToEndpoint.get().keySet()) { - for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) { - for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) { + for (ReferenceType vdc : client.findOrgNamed(org).getVDCs().values()) { + for (ReferenceType resource : client.getVDC(vdc.getHref()).getResourceEntities().values()) { if (validVApp(resource)) { nodes.add(convertVAppToComputeMetadata(vdc, resource)); } @@ -98,22 +98,22 @@ public class VCloudExpressListNodesStrategy implements ListNodesStrategy { return nodes; } - private boolean validVApp(NamedResource resource) { + private boolean validVApp(ReferenceType resource) { return resource.getType().equals(VCloudMediaType.VAPP_XML) && !blackListVAppNames.contains(resource.getName()); } - private ComputeMetadata convertVAppToComputeMetadata(NamedResource vdc, NamedResource resource) { + private ComputeMetadata convertVAppToComputeMetadata(ReferenceType vdc, ReferenceType resource) { Location location = findLocationForResourceInVDC.apply(vdc); - return new ComputeMetadataImpl(ComputeType.NODE, resource.getId().toASCIIString(), resource.getName(), resource - .getId().toASCIIString(), location, null, ImmutableMap. of()); + return new ComputeMetadataImpl(ComputeType.NODE, resource.getHref().toASCIIString(), resource.getName(), resource + .getHref().toASCIIString(), location, null, ImmutableMap. of()); } @Override public Iterable listDetailsOnNodesMatching(Predicate filter) { Set nodes = Sets.newHashSet(); for (String org : orgNameToEndpoint.get().keySet()) { - for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) { - for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) { + for (ReferenceType vdc : client.findOrgNamed(org).getVDCs().values()) { + for (ReferenceType resource : client.getVDC(vdc.getHref()).getResourceEntities().values()) { if (validVApp(resource) && filter.apply(convertVAppToComputeMetadata(vdc, resource))) { addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource); } @@ -124,12 +124,12 @@ public class VCloudExpressListNodesStrategy implements ListNodesStrategy { } @VisibleForTesting - void addVAppToSetRetryingIfNotYetPresent(Set nodes, NamedResource vdc, NamedResource resource) { + void addVAppToSetRetryingIfNotYetPresent(Set nodes, ReferenceType vdc, ReferenceType resource) { NodeMetadata node = null; int i = 0; while (node == null && i++ < 3) { try { - node = getNodeMetadata.execute(resource.getId().toASCIIString()); + node = getNodeMetadata.execute(resource.getHref().toASCIIString()); nodes.add(node); } catch (NullPointerException e) { logger.warn("vApp %s not yet present in vdc %s", resource.getName(), vdc.getName()); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressRebootNodeStrategy.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressRebootNodeStrategy.java index 4628cb50d9..24ffd4aa74 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressRebootNodeStrategy.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudExpressRebootNodeStrategy.java @@ -55,7 +55,7 @@ public class VCloudExpressRebootNodeStrategy implements RebootNodeStrategy { public NodeMetadata execute(String in) { URI id = URI.create(checkNotNull(in, "node.id")); Task task = client.resetVApp(id); - taskTester.apply(task.getId()); + taskTester.apply(task.getHref()); return getNode.execute(in); } } \ No newline at end of file diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudGetNodeMetadataStrategy.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudGetNodeMetadataStrategy.java index d3ceb7071d..cf4d012e6c 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudGetNodeMetadataStrategy.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudGetNodeMetadataStrategy.java @@ -85,7 +85,7 @@ public class VCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy { return null; String tag = parseTagFromName(from.getName()); Location location = findLocationForResourceInVDC.apply(from.getVDC()); - return new NodeMetadataImpl(in, from.getName(), in, location, from.getId(), ImmutableMap. of(), + return new NodeMetadataImpl(in, from.getName(), in, location, from.getHref(), ImmutableMap. of(), tag, null, getOperatingSystemForVAppOrDefaultTo(from, null), vAppStatusToNodeState.get(from.getStatus()), computeClient.getPublicAddresses(id), computeClient .getPrivateAddresses(id), getExtra.apply(from), null); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudListNodesStrategy.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudListNodesStrategy.java index e002e09d04..78d4902f39 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudListNodesStrategy.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudListNodesStrategy.java @@ -39,7 +39,7 @@ import org.jclouds.logging.Logger; import org.jclouds.vcloud.CommonVCloudClient; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.compute.functions.FindLocationForResource; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.endpoints.Org; import com.google.common.annotations.VisibleForTesting; @@ -71,11 +71,11 @@ public class VCloudListNodesStrategy implements ListNodesStrategy { this.blackListVAppNames = ImmutableSet.copyOf(Splitter.on(',').split(blackListNodes)); } - private final Supplier> orgNameToEndpoint; + private final Supplier> orgNameToEndpoint; @Inject protected VCloudListNodesStrategy(CommonVCloudClient client, - @Org Supplier> orgNameToEndpoint, VCloudGetNodeMetadataStrategy getNodeMetadata, + @Org Supplier> orgNameToEndpoint, VCloudGetNodeMetadataStrategy getNodeMetadata, FindLocationForResource findLocationForResourceInVDC) { this.client = client; this.orgNameToEndpoint = orgNameToEndpoint; @@ -87,8 +87,8 @@ public class VCloudListNodesStrategy implements ListNodesStrategy { public Iterable list() { Set nodes = Sets.newHashSet(); for (String org : orgNameToEndpoint.get().keySet()) { - for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) { - for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) { + for (ReferenceType vdc : client.findOrgNamed(org).getVDCs().values()) { + for (ReferenceType resource : client.getVDC(vdc.getHref()).getResourceEntities().values()) { if (validVApp(resource)) { nodes.add(convertVAppToComputeMetadata(vdc, resource)); } @@ -98,22 +98,22 @@ public class VCloudListNodesStrategy implements ListNodesStrategy { return nodes; } - private boolean validVApp(NamedResource resource) { + private boolean validVApp(ReferenceType resource) { return resource.getType().equals(VCloudMediaType.VAPP_XML) && !blackListVAppNames.contains(resource.getName()); } - private ComputeMetadata convertVAppToComputeMetadata(NamedResource vdc, NamedResource resource) { + private ComputeMetadata convertVAppToComputeMetadata(ReferenceType vdc, ReferenceType resource) { Location location = findLocationForResourceInVDC.apply(vdc); - return new ComputeMetadataImpl(ComputeType.NODE, resource.getId().toASCIIString(), resource.getName(), resource - .getId().toASCIIString(), location, null, ImmutableMap. of()); + return new ComputeMetadataImpl(ComputeType.NODE, resource.getHref().toASCIIString(), resource.getName(), resource + .getHref().toASCIIString(), location, null, ImmutableMap. of()); } @Override public Iterable listDetailsOnNodesMatching(Predicate filter) { Set nodes = Sets.newHashSet(); for (String org : orgNameToEndpoint.get().keySet()) { - for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) { - for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) { + for (ReferenceType vdc : client.findOrgNamed(org).getVDCs().values()) { + for (ReferenceType resource : client.getVDC(vdc.getHref()).getResourceEntities().values()) { if (validVApp(resource) && filter.apply(convertVAppToComputeMetadata(vdc, resource))) { addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource); } @@ -124,12 +124,12 @@ public class VCloudListNodesStrategy implements ListNodesStrategy { } @VisibleForTesting - void addVAppToSetRetryingIfNotYetPresent(Set nodes, NamedResource vdc, NamedResource resource) { + void addVAppToSetRetryingIfNotYetPresent(Set nodes, ReferenceType vdc, ReferenceType resource) { NodeMetadata node = null; int i = 0; while (node == null && i++ < 3) { try { - node = getNodeMetadata.execute(resource.getId().toASCIIString()); + node = getNodeMetadata.execute(resource.getHref().toASCIIString()); nodes.add(node); } catch (NullPointerException e) { logger.warn("vApp %s not yet present in vdc %s", resource.getName(), vdc.getName()); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudRebootNodeStrategy.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudRebootNodeStrategy.java index 277da10632..2d4c56f612 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudRebootNodeStrategy.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudRebootNodeStrategy.java @@ -55,7 +55,7 @@ public class VCloudRebootNodeStrategy implements RebootNodeStrategy { public NodeMetadata execute(String in) { URI id = URI.create(checkNotNull(in, "node.id")); Task task = client.resetVAppOrVm(id); - taskTester.apply(task.getId()); + taskTester.apply(task.getHref()); return getNode.execute(in); } } \ No newline at end of file diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/suppliers/OrgAndVDCToLocationSupplier.java b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/suppliers/OrgAndVDCToLocationSupplier.java index ef055bd9c6..aa841d7da0 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/compute/suppliers/OrgAndVDCToLocationSupplier.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/compute/suppliers/OrgAndVDCToLocationSupplier.java @@ -29,7 +29,7 @@ import org.jclouds.domain.Location; import org.jclouds.domain.LocationScope; import org.jclouds.domain.internal.LocationImpl; import org.jclouds.vcloud.compute.domain.VCloudLocation; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import com.google.common.base.Supplier; @@ -41,12 +41,12 @@ import com.google.common.collect.Sets; @Singleton public class OrgAndVDCToLocationSupplier implements Supplier> { private final String providerName; - private final Supplier> orgNameToResource; + private final Supplier> orgNameToResource; private final Supplier> orgNameToVDCResource; @Inject OrgAndVDCToLocationSupplier(@org.jclouds.rest.annotations.Provider String providerName, - @org.jclouds.vcloud.endpoints.Org Supplier> orgNameToResource, + @org.jclouds.vcloud.endpoints.Org Supplier> orgNameToResource, Supplier> orgNameToVDCResource) { this.providerName = providerName; this.orgNameToResource = orgNameToResource; @@ -58,9 +58,9 @@ public class OrgAndVDCToLocationSupplier implements Supplier locations = Sets.newLinkedHashSet(); - for (NamedResource org : orgNameToResource.get().values()) { + for (ReferenceType org : orgNameToResource.get().values()) { Location orgL = new VCloudLocation(org, provider); - for (NamedResource vdc : orgNameToVDCResource.get().get(org.getName()).getVDCs().values()) { + for (ReferenceType vdc : orgNameToVDCResource.get().get(org.getName()).getVDCs().values()) { locations.add(new VCloudLocation(vdc, orgL)); } } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/config/CommonVCloudRestClientModule.java b/vcloud/core/src/main/java/org/jclouds/vcloud/config/CommonVCloudRestClientModule.java index e590abc2ba..bf80882657 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/config/CommonVCloudRestClientModule.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/config/CommonVCloudRestClientModule.java @@ -66,7 +66,7 @@ import org.jclouds.vcloud.CommonVCloudClient; import org.jclouds.vcloud.VCloudToken; import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VDC; @@ -162,7 +162,7 @@ public class CommonVCloudRestClientModule 0, "No vdcs present in org: " + org.getName()); - return get(org.getVDCs().values(), 0).getId(); + return get(org.getVDCs().values(), 0).getHref(); } @Provides @@ -170,7 +170,7 @@ public class CommonVCloudRestClientModule 0, "No catalogs present in org: " + org.getName()); - return get(org.getCatalogs().values(), 0).getId(); + return get(org.getCatalogs().values(), 0).getHref(); } @Provides @@ -246,26 +246,26 @@ public class CommonVCloudRestClientModule orgs) { - return getLast(orgs).getId(); + protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { + return getLast(orgs).getHref(); } @Provides @org.jclouds.vcloud.endpoints.Org @Singleton - protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { + protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { return getLast(orgs).getName(); } @Provides @org.jclouds.vcloud.endpoints.Org @Singleton - protected Supplier> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds, + protected Supplier> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgNameToOrgSupplier supplier) { - return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier>(authException, - seconds, new Supplier>() { + return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier>(authException, + seconds, new Supplier>() { @Override - public Map get() { + public Map get() { return supplier.get(); } }); @@ -310,7 +310,7 @@ public class CommonVCloudRestClientModule provideOrgs(Supplier cache, @Named(PROPERTY_IDENTITY) String user) { + protected Iterable provideOrgs(Supplier cache, @Named(PROPERTY_IDENTITY) String user) { VCloudSession discovery = cache.get(); checkState(discovery.getOrgs().size() > 0, "No orgs present for user: " + user); return discovery.getOrgs().values(); @@ -329,10 +329,10 @@ public class CommonVCloudRestClientModule authException = new AtomicReference(); - final static Function name = new Function() { + final static Function name = new Function() { @Override - public String apply(NamedResource from) { + public String apply(ReferenceType from) { return from.getName(); } @@ -351,7 +351,7 @@ public class CommonVCloudRestClientModule> { + private static class OrgNameToOrgSupplier implements Supplier> { private final Supplier sessionSupplier; @SuppressWarnings("unused") @@ -361,7 +361,7 @@ public class CommonVCloudRestClientModule get() { + public Map get() { return sessionSupplier.get().getOrgs(); } @@ -396,9 +396,9 @@ public class CommonVCloudRestClientModule networks = vDC.getAvailableNetworks(); + Map networks = vDC.getAvailableNetworks(); checkState(networks.size() > 0, "No networks present in vDC: " + vDC.getName()); - return get(networks.values(), 0).getId(); + return get(networks.values(), 0).getHref(); } catch (AuthorizationException e) { authException.set(e); throw e; @@ -541,7 +541,7 @@ public class CommonVCloudRestClientModule { +public interface Catalog extends ReferenceType, Map { /** * Reference to the org containing this vDC. * * @since vcloud api 1.0 * @return org, or null if this is a version before 1.0 where the org isn't present */ - NamedResource getOrg(); + ReferenceType getOrg(); /** * optional description diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java index e4479d434d..2be60f02f5 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java @@ -29,11 +29,11 @@ import com.google.inject.ImplementedBy; * @author Adrian Cole */ @ImplementedBy(CatalogItemImpl.class) -public interface CatalogItem extends NamedResource { +public interface CatalogItem extends ReferenceType { String getDescription(); - NamedResource getEntity(); + ReferenceType getEntity(); Map getProperties(); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Org.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Org.java index be3371764c..c7a11067bd 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Org.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Org.java @@ -38,7 +38,7 @@ import com.google.inject.ImplementedBy; * @author Adrian Cole */ @ImplementedBy(OrgImpl.class) -public interface Org extends NamedResource { +public interface Org extends ReferenceType { /** * optional description * @@ -58,12 +58,12 @@ public interface Org extends NamedResource { /** * @since vcloud api 0.8 */ - Map getCatalogs(); + Map getCatalogs(); /** * @since vcloud api 0.8 */ - Map getVDCs(); + Map getVDCs(); /** * If there are any queued, running, or recently completed tasks owned by a member of the @@ -72,12 +72,12 @@ public interface Org extends NamedResource { * @since vcloud api 0.8 */ @Nullable - NamedResource getTasksList(); + ReferenceType getTasksList(); /** * @since vcloud api 1.0 */ - Map getNetworks(); + Map getNetworks(); /** * read‐only container for Task elements. Each element in the container represents a queued, diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/NamedResource.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java similarity index 59% rename from vcloud/core/src/main/java/org/jclouds/vcloud/domain/NamedResource.java rename to vcloud/core/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java index 46c8e9a281..a1b9267a46 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/NamedResource.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java @@ -21,22 +21,35 @@ package org.jclouds.vcloud.domain; import java.net.URI; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.VCloudMediaType; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import com.google.inject.ImplementedBy; /** - * Location of a Rest resource + * Many container elements are populated with references to contained objects. Each reference + * consists of a hyperlink, an optional media type, and a name. * * @author Adrian Cole * */ -@ImplementedBy(NamedResourceImpl.class) -public interface NamedResource extends Comparable { - URI getId(); +@ImplementedBy(ReferenceTypeImpl.class) +public interface ReferenceType extends Comparable { + /** + * @return hyperlink to the referenced object + */ + URI getHref(); + /** + * @return name of the referenced object. + * + */ String getName(); + /** + * @return object type, expressed as the media type of the XML representing of the object + * @see VCloudMediaType + */ String getType(); } \ No newline at end of file diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Task.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Task.java index bc68374415..4bf0fa2db8 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Task.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Task.java @@ -33,7 +33,7 @@ import com.google.inject.ImplementedBy; * object’s XML representation. This element is read‐only. */ @ImplementedBy(TaskImpl.class) -public interface Task extends NamedResource { +public interface Task extends ReferenceType { /** * The current status of the task. */ @@ -60,7 +60,7 @@ public interface Task extends NamedResource { * being created. For delete operations, the owner is the deleted object, so this element is not * included. For all other operations, the owner is the object to which the request was made. */ - NamedResource getOwner(); + ReferenceType getOwner(); /** * error message or related information returned by the task diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VApp.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VApp.java index eca568ffe1..4468b92dcd 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VApp.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VApp.java @@ -32,14 +32,14 @@ import javax.annotation.Nullable; * * @author Adrian Cole */ -public interface VApp extends NamedResource { +public interface VApp extends ReferenceType { /** * Reference to the vdc containing this vApp. * * @since vcloud api 1.0 * @return vdc, or null if this is a version before 1.0 where the org isn't present */ - NamedResource getVDC(); + ReferenceType getVDC(); /** * The creation status of the vDC diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java index a720e2af4d..0c3cdc5f1b 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java @@ -35,14 +35,14 @@ import com.google.inject.ImplementedBy; * @author Adrian Cole */ @ImplementedBy(VAppTemplateImpl.class) -public interface VAppTemplate extends NamedResource { +public interface VAppTemplate extends ReferenceType { /** * Reference to the VDC containing this template. * * @since vcloud api 1.0 * @return org, or null if this is a version before 1.0 where the vdc isn't present */ - NamedResource getVDC(); + ReferenceType getVDC(); /** * @return creation status of the VAppTemplate. diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudExpressVApp.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudExpressVApp.java index 1739f6b479..8610a77466 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudExpressVApp.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudExpressVApp.java @@ -36,8 +36,8 @@ import com.google.inject.ImplementedBy; * @author Adrian Cole */ @ImplementedBy(VCloudExpressVAppImpl.class) -public interface VCloudExpressVApp extends NamedResource { - NamedResource getVDC(); +public interface VCloudExpressVApp extends ReferenceType { + ReferenceType getVDC(); Status getStatus(); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudExpressVAppTemplate.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudExpressVAppTemplate.java index 150214742e..19e0fd1591 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudExpressVAppTemplate.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudExpressVAppTemplate.java @@ -23,7 +23,7 @@ package org.jclouds.vcloud.domain; * * @author Adrian Cole */ -public interface VCloudExpressVAppTemplate extends NamedResource { +public interface VCloudExpressVAppTemplate extends ReferenceType { Status getStatus(); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java index c977d1079c..d89bb93651 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java @@ -28,5 +28,5 @@ import java.util.Map; public interface VCloudSession { String getVCloudToken(); - Map getOrgs(); + Map getOrgs(); } \ No newline at end of file diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VDC.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VDC.java index 4eadfeec0e..20b42f17ac 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VDC.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/VDC.java @@ -35,14 +35,14 @@ import com.google.inject.ImplementedBy; */ @org.jclouds.vcloud.endpoints.VDC @ImplementedBy(VDCImpl.class) -public interface VDC extends NamedResource { +public interface VDC extends ReferenceType { /** * Reference to the org containing this vDC. * * @since vcloud api 1.0 * @return org, or null if this is a version before 1.0 where the org isn't present */ - NamedResource getOrg(); + ReferenceType getOrg(); /** * The creation status of the vDC @@ -107,14 +107,14 @@ public interface VDC extends NamedResource { * * @since vcloud api 0.8 */ - Map getResourceEntities(); + Map getResourceEntities(); /** * container for OrgNetwork elements that represent organization networks contained by the vDC * * @since vcloud api 0.8 */ - Map getAvailableNetworks(); + Map getAvailableNetworks(); /** * maximum number of virtual NICs allowed in this vDC. Defaults to 0, which specifies an diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Vm.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Vm.java index 25e6eb5e72..a2e26b7a27 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Vm.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/Vm.java @@ -31,13 +31,13 @@ import javax.annotation.Nullable; * * @author Adrian Cole */ -public interface Vm extends NamedResource { +public interface Vm extends ReferenceType { /** * Reference to the {@link VApp} or {@link VAppTemplate} containing this vm. * * @since vcloud api 1.0 */ - NamedResource getParent(); + ReferenceType getParent(); /** * @return creation status of the Vm or null, if a part of a VAppTemplate diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java index 0616895544..df2c8c4512 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java @@ -27,7 +27,7 @@ import java.util.List; import java.util.Map; import org.jclouds.vcloud.domain.Catalog; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import com.google.common.collect.Iterables; @@ -40,26 +40,26 @@ import com.google.inject.internal.Nullable; * @author Adrian Cole * */ -public class CatalogImpl extends LinkedHashMap implements Catalog { +public class CatalogImpl extends LinkedHashMap implements Catalog { /** The serialVersionUID */ private static final long serialVersionUID = 8464716396538298809L; private final String name; private final String type; - private final URI id; - private final NamedResource org; + private final URI href; + private final ReferenceType org; @Nullable private final String description; private final List tasks = Lists.newArrayList(); private final boolean published; - public CatalogImpl(String name, String type, URI id, NamedResource org, @Nullable String description, - Map contents, Iterable tasks, boolean published) { + public CatalogImpl(String name, String type, URI href, ReferenceType org, @Nullable String description, + Map contents, Iterable tasks, boolean published) { this.name = checkNotNull(name, "name"); this.type = checkNotNull(type, "type"); this.org = org;// TODO: once <1.0 is killed check not null this.description = description; - this.id = checkNotNull(id, "id"); + this.href = checkNotNull(href, "href"); putAll(checkNotNull(contents, "contents")); Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks")); this.published = published; @@ -69,8 +69,8 @@ public class CatalogImpl extends LinkedHashMap implements * {@inheritDoc} */ @Override - public URI getId() { - return id; + public URI getHref() { + return href; } /** @@ -85,7 +85,7 @@ public class CatalogImpl extends LinkedHashMap implements * {@inheritDoc} */ @Override - public NamedResource getOrg() { + public ReferenceType getOrg() { return org; } @@ -125,7 +125,7 @@ public class CatalogImpl extends LinkedHashMap implements final int prime = 31; int result = super.hashCode(); result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((href == null) ? 0 : href.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((org == null) ? 0 : org.hashCode()); result = prime * result + ((tasks == null) ? 0 : tasks.hashCode()); @@ -147,10 +147,10 @@ public class CatalogImpl extends LinkedHashMap implements return false; } else if (!description.equals(other.description)) return false; - if (id == null) { - if (other.id != null) + if (href == null) { + if (other.href != null) return false; - } else if (!id.equals(other.id)) + } else if (!href.equals(other.href)) return false; if (name == null) { if (other.name != null) @@ -176,8 +176,8 @@ public class CatalogImpl extends LinkedHashMap implements } @Override - public int compareTo(NamedResource o) { - return (this == o) ? 0 : getId().compareTo(o.getId()); + public int compareTo(ReferenceType o) { + return (this == o) ? 0 : getHref().compareTo(o.getHref()); } } \ No newline at end of file diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java index e1e7e8cc02..437cd10138 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java @@ -28,7 +28,7 @@ import javax.annotation.Nullable; import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import com.google.common.collect.Maps; @@ -37,15 +37,15 @@ import com.google.common.collect.Maps; * @author Adrian Cole * */ -public class CatalogItemImpl extends NamedResourceImpl implements CatalogItem { +public class CatalogItemImpl extends ReferenceTypeImpl implements CatalogItem { /** The serialVersionUID */ private static final long serialVersionUID = 8464716396538298809L; private final String description; - private final NamedResource entity; + private final ReferenceType entity; private final Map properties = Maps.newLinkedHashMap(); - public CatalogItemImpl(String name, URI id, @Nullable String description, NamedResource entity, + public CatalogItemImpl(String name, URI id, @Nullable String description, ReferenceType entity, Map properties) { super(name, VCloudExpressMediaType.CATALOGITEM_XML, id); this.description = description; @@ -58,7 +58,7 @@ public class CatalogItemImpl extends NamedResourceImpl implements CatalogItem { return VCloudExpressMediaType.CATALOGITEM_XML; } - public NamedResource getEntity() { + public ReferenceType getEntity() { return entity; } @@ -73,7 +73,7 @@ public class CatalogItemImpl extends NamedResourceImpl implements CatalogItem { @Override public String toString() { - return "CatalogItemImpl [id=" + getId() + ", name=" + getName() + ", type=" + getType() + ", description=" + return "CatalogItemImpl [id=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description=" + getDescription() + ", entity=" + entity + ", properties=" + properties + "]"; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java index c0e72faf8c..d69cbec469 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java @@ -27,7 +27,7 @@ import java.util.Map; import javax.annotation.Nullable; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.Task; @@ -41,19 +41,19 @@ import com.google.common.collect.Maps; * @author Adrian Cole * */ -public class OrgImpl extends NamedResourceImpl implements Org { +public class OrgImpl extends ReferenceTypeImpl implements Org { private final String fullName; @Nullable private final String description; - private final Map catalogs = Maps.newLinkedHashMap(); - private final Map vdcs = Maps.newLinkedHashMap(); - private final Map networks = Maps.newLinkedHashMap(); - private final NamedResource tasksList; + private final Map catalogs = Maps.newLinkedHashMap(); + private final Map vdcs = Maps.newLinkedHashMap(); + private final Map networks = Maps.newLinkedHashMap(); + private final ReferenceType tasksList; private final List tasks = Lists.newArrayList(); public OrgImpl(String name, String type, URI id, String fullName, String description, - Map catalogs, Map vdcs, Map networks, - @Nullable NamedResource tasksList, Iterable tasks) { + Map catalogs, Map vdcs, Map networks, + @Nullable ReferenceType tasksList, Iterable tasks) { super(name, type, id); this.fullName = checkNotNull(fullName, "fullName"); this.description = description; @@ -75,22 +75,22 @@ public class OrgImpl extends NamedResourceImpl implements Org { } @Override - public Map getCatalogs() { + public Map getCatalogs() { return catalogs; } @Override - public Map getVDCs() { + public Map getVDCs() { return vdcs; } @Override - public Map getNetworks() { + public Map getNetworks() { return networks; } @Override - public NamedResource getTasksList() { + public ReferenceType getTasksList() { return tasksList; } @@ -161,13 +161,13 @@ public class OrgImpl extends NamedResourceImpl implements Org { } @Override - public int compareTo(NamedResource o) { - return (this == o) ? 0 : getId().compareTo(o.getId()); + public int compareTo(ReferenceType o) { + return (this == o) ? 0 : getHref().compareTo(o.getHref()); } @Override public String toString() { - return "[id=" + getId() + ", name=" + getName() + ", type=" + getType() + "]"; + return "[id=" + getHref() + ", name=" + getName() + ", type=" + getType() + "]"; } } \ No newline at end of file diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/NamedResourceImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java similarity index 75% rename from vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/NamedResourceImpl.java rename to vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java index f46835918e..af2397b1d9 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/NamedResourceImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java @@ -21,7 +21,7 @@ package org.jclouds.vcloud.domain.internal; import java.net.URI; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; /** * Location of a Rest resource @@ -29,15 +29,15 @@ import org.jclouds.vcloud.domain.NamedResource; * @author Adrian Cole * */ -public class NamedResourceImpl implements NamedResource { +public class ReferenceTypeImpl implements ReferenceType { private final String name; private final String type; - private final URI id; + private final URI href; - public NamedResourceImpl(String name, String type, URI id) { + public ReferenceTypeImpl(String name, String type, URI href) { this.name = name; this.type = type; - this.id = id; + this.href = href; } @Override @@ -51,20 +51,20 @@ public class NamedResourceImpl implements NamedResource { } @Override - public URI getId() { - return id; + public URI getHref() { + return href; } @Override - public int compareTo(NamedResource that) { - return (this == that) ? 0 : getId().compareTo(that.getId()); + public int compareTo(ReferenceType that) { + return (this == that) ? 0 : getHref().compareTo(that.getHref()); } @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((href == null) ? 0 : href.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; @@ -78,11 +78,11 @@ public class NamedResourceImpl implements NamedResource { return false; if (getClass() != obj.getClass()) return false; - NamedResourceImpl other = (NamedResourceImpl) obj; - if (id == null) { - if (other.id != null) + ReferenceTypeImpl other = (ReferenceTypeImpl) obj; + if (href == null) { + if (other.href != null) return false; - } else if (!id.equals(other.id)) + } else if (!href.equals(other.href)) return false; if (name == null) { if (other.name != null) @@ -99,6 +99,6 @@ public class NamedResourceImpl implements NamedResource { @Override public String toString() { - return "[id=" + id + ", name=" + name + ", type=" + type + "]"; + return "[href=" + href + ", name=" + name + ", type=" + type + "]"; } } \ No newline at end of file diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java index 79f16404cd..9c2dd14898 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java @@ -25,7 +25,7 @@ import java.net.URI; import java.util.Date; import org.jclouds.vcloud.VCloudMediaType; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.TaskStatus; @@ -36,7 +36,7 @@ import com.google.inject.internal.Nullable; * @author Adrian Cole * */ -public class TaskImpl extends NamedResourceImpl implements Task { +public class TaskImpl extends ReferenceTypeImpl implements Task { public static class ErrorImpl implements Error { private final String message; @@ -136,12 +136,12 @@ public class TaskImpl extends NamedResourceImpl implements Task { private final Date endTime; @Nullable private final Date expiryTime; - private final NamedResource owner; + private final ReferenceType owner; @Nullable private final Error error; public TaskImpl(URI id, TaskStatus status, Date startTime, @Nullable Date endTime, @Nullable Date expiryTime, - NamedResource owner, Error error) { + ReferenceType owner, Error error) { super(null, VCloudMediaType.TASK_XML, id); this.status = checkNotNull(status, "status"); this.startTime = startTime; @@ -162,7 +162,7 @@ public class TaskImpl extends NamedResourceImpl implements Task { } @Override - public NamedResource getOwner() { + public ReferenceType getOwner() { return owner; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java index 23b2b840a6..127913abc5 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java @@ -27,7 +27,7 @@ import java.util.Set; import javax.annotation.Nullable; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VApp; @@ -43,17 +43,17 @@ import com.google.common.collect.Sets; * @author Adrian Cole * */ -public class VAppImpl extends NamedResourceImpl implements VApp { +public class VAppImpl extends ReferenceTypeImpl implements VApp { private final Status status; - private final NamedResource vdc; + private final ReferenceType vdc; @Nullable private final String description; private final List tasks = Lists.newArrayList(); private final boolean ovfDescriptorUploaded; private final Set children = Sets.newLinkedHashSet(); - public VAppImpl(String name, String type, URI id, Status status, NamedResource vdc, @Nullable String description, + public VAppImpl(String name, String type, URI id, Status status, ReferenceType vdc, @Nullable String description, Iterable tasks, boolean ovfDescriptorUploaded, Iterable children) { super(name, type, id); this.status = checkNotNull(status, "status"); @@ -76,7 +76,7 @@ public class VAppImpl extends NamedResourceImpl implements VApp { * {@inheritDoc} */ @Override - public NamedResource getVDC() { + public ReferenceType getVDC() { return vdc; } @@ -160,7 +160,7 @@ public class VAppImpl extends NamedResourceImpl implements VApp { @Override public String toString() { - return "[id=" + getId() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status=" + return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status=" + status + "]"; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java index 61ee0cb356..8e8d1f5330 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java @@ -27,7 +27,7 @@ import java.util.Set; import javax.annotation.Nullable; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VAppTemplate; @@ -43,10 +43,10 @@ import com.google.common.collect.Sets; * @author Adrian Cole * */ -public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate { +public class VAppTemplateImpl extends ReferenceTypeImpl implements VAppTemplate { private final Status status; - private final NamedResource vdc; + private final ReferenceType vdc; @Nullable private final String description; private final List tasks = Lists.newArrayList(); @@ -54,7 +54,7 @@ public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate private final String vAppScopedLocalId; private final Set children = Sets.newLinkedHashSet(); - public VAppTemplateImpl(String name, String type, URI id, Status status, NamedResource vdc, + public VAppTemplateImpl(String name, String type, URI id, Status status, ReferenceType vdc, @Nullable String description, Iterable tasks, boolean ovfDescriptorUploaded, @Nullable String vAppScopedLocalId, Iterable children) { super(name, type, id); @@ -79,7 +79,7 @@ public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate * {@inheritDoc} */ @Override - public NamedResource getVDC() { + public ReferenceType getVDC() { return vdc; } @@ -177,7 +177,7 @@ public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate @Override public String toString() { - return "[id=" + getId() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status=" + return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status=" + status + "]"; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VCloudExpressVAppImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VCloudExpressVAppImpl.java index 313fc16a0f..260152f869 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VCloudExpressVAppImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VCloudExpressVAppImpl.java @@ -25,10 +25,10 @@ import java.net.URI; import java.util.Set; import org.jclouds.vcloud.VCloudExpressMediaType; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.ResourceAllocation; -import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.Status; +import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.VirtualSystem; import com.google.common.collect.ListMultimap; @@ -40,8 +40,8 @@ import com.google.common.collect.ListMultimap; */ public class VCloudExpressVAppImpl implements VCloudExpressVApp { private final String name; - private final URI id; - private final NamedResource vDC; + private final URI href; + private final ReferenceType vDC; private final Status status; private final Long size; private final ListMultimap networkToAddresses; @@ -53,11 +53,11 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp { /** The serialVersionUID */ private static final long serialVersionUID = 8464716396538298809L; - public VCloudExpressVAppImpl(String name, URI id, Status status, Long size, NamedResource vDC, + public VCloudExpressVAppImpl(String name, URI href, Status status, Long size, ReferenceType vDC, ListMultimap networkToAddresses, Integer osType, String operatingSystemDescription, VirtualSystem system, Set resourceAllocations) { this.name = checkNotNull(name, "name"); - this.id = checkNotNull(id, "id"); + this.href = checkNotNull(href, "href"); this.status = checkNotNull(status, "status"); this.size = size; this.vDC = vDC; @@ -99,7 +99,7 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp { } @Override - public NamedResource getVDC() { + public ReferenceType getVDC() { return vDC; } @@ -107,7 +107,7 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((href == null) ? 0 : href.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((networkToAddresses == null) ? 0 : networkToAddresses.hashCode()); result = prime * result + ((operatingSystemDescription == null) ? 0 : operatingSystemDescription.hashCode()); @@ -129,10 +129,10 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp { if (getClass() != obj.getClass()) return false; VCloudExpressVAppImpl other = (VCloudExpressVAppImpl) obj; - if (id == null) { - if (other.id != null) + if (href == null) { + if (other.href != null) return false; - } else if (!id.equals(other.id)) + } else if (!href.equals(other.href)) return false; if (name == null) { if (other.name != null) @@ -188,8 +188,8 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp { } @Override - public URI getId() { - return id; + public URI getHref() { + return href; } @Override @@ -199,7 +199,7 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp { @Override public String toString() { - return "[id=" + id + ", name=" + name + ", networkToAddresses=" + networkToAddresses + ", osType=" + osType + return "[href=" + href + ", name=" + name + ", networkToAddresses=" + networkToAddresses + ", osType=" + osType + ", operatingSystemDescription=" + operatingSystemDescription + ", resourceAllocationByType=" + resourceAllocations + ", size=" + size + ", status=" + status + ", system=" + system + ", vDC=" + vDC + "]"; @@ -211,8 +211,8 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp { } @Override - public int compareTo(NamedResource o) { - return (this == o) ? 0 : getId().compareTo(o.getId()); + public int compareTo(ReferenceType o) { + return (this == o) ? 0 : getHref().compareTo(o.getHref()); } } \ No newline at end of file diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VCloudExpressVAppTemplateImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VCloudExpressVAppTemplateImpl.java index 179b615982..85a0562549 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VCloudExpressVAppTemplateImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VCloudExpressVAppTemplateImpl.java @@ -32,7 +32,7 @@ import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; * @author Adrian Cole * */ -public class VCloudExpressVAppTemplateImpl extends NamedResourceImpl implements VCloudExpressVAppTemplate { +public class VCloudExpressVAppTemplateImpl extends ReferenceTypeImpl implements VCloudExpressVAppTemplate { /** The serialVersionUID */ private static final long serialVersionUID = 8464716396538298809L; diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java index acfb6c2d79..baa9a51b89 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java @@ -29,7 +29,7 @@ import javax.annotation.Nullable; import org.jclouds.vcloud.domain.AllocationModel; import org.jclouds.vcloud.domain.Capacity; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.VDCStatus; @@ -44,10 +44,10 @@ import com.google.common.collect.Maps; * @author Adrian Cole * */ -public class VDCImpl extends NamedResourceImpl implements VDC { +public class VDCImpl extends ReferenceTypeImpl implements VDC { private final VDCStatus status; - private final NamedResource org; + private final ReferenceType org; @Nullable private final String description; private final List tasks = Lists.newArrayList(); @@ -55,17 +55,17 @@ public class VDCImpl extends NamedResourceImpl implements VDC { private final Capacity storageCapacity; private final Capacity cpuCapacity; private final Capacity memoryCapacity; - private final Map resourceEntities = Maps.newLinkedHashMap(); - private final Map availableNetworks = Maps.newLinkedHashMap(); + private final Map resourceEntities = Maps.newLinkedHashMap(); + private final Map availableNetworks = Maps.newLinkedHashMap(); private final int nicQuota; private final int networkQuota; private final int vmQuota; private final boolean isEnabled; - public VDCImpl(String name, String type, URI id, VDCStatus status, NamedResource org, @Nullable String description, + public VDCImpl(String name, String type, URI id, VDCStatus status, ReferenceType org, @Nullable String description, Iterable tasks, AllocationModel allocationModel, @Nullable Capacity storageCapacity, @Nullable Capacity cpuCapacity, @Nullable Capacity memoryCapacity, - Map resourceEntities, Map availableNetworks, int nicQuota, + Map resourceEntities, Map availableNetworks, int nicQuota, int networkQuota, int vmQuota, boolean isEnabled) { super(name, type, id); this.status = checkNotNull(status, "status"); @@ -96,7 +96,7 @@ public class VDCImpl extends NamedResourceImpl implements VDC { * {@inheritDoc} */ @Override - public NamedResource getOrg() { + public ReferenceType getOrg() { return org; } @@ -152,7 +152,7 @@ public class VDCImpl extends NamedResourceImpl implements VDC { * {@inheritDoc} */ @Override - public Map getResourceEntities() { + public Map getResourceEntities() { return resourceEntities; } @@ -160,7 +160,7 @@ public class VDCImpl extends NamedResourceImpl implements VDC { * {@inheritDoc} */ @Override - public Map getAvailableNetworks() { + public Map getAvailableNetworks() { return availableNetworks; } @@ -289,7 +289,7 @@ public class VDCImpl extends NamedResourceImpl implements VDC { @Override public String toString() { - return "[id=" + getId() + ", name=" + getName() + ", org=" + org + ", description=" + description + ", status=" + return "[id=" + getHref() + ", name=" + getName() + ", org=" + org + ", description=" + description + ", status=" + status + ", isEnabled=" + isEnabled + "]"; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java index eed6f93006..1c37c0e5fc 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java @@ -26,7 +26,7 @@ import java.util.List; import javax.annotation.Nullable; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Vm; @@ -40,17 +40,17 @@ import com.google.common.collect.Lists; * @author Adrian Cole * */ -public class VmImpl extends NamedResourceImpl implements Vm { +public class VmImpl extends ReferenceTypeImpl implements Vm { @Nullable private final Status status; - private final NamedResource vApp; + private final ReferenceType vApp; @Nullable private final String description; private final List tasks = Lists.newArrayList(); private final String vAppScopedLocalId; - public VmImpl(String name, String type, URI id, @Nullable Status status, NamedResource vApp, + public VmImpl(String name, String type, URI id, @Nullable Status status, ReferenceType vApp, @Nullable String description, Iterable tasks, @Nullable String vAppScopedLocalId) { super(name, type, id); this.status = status; @@ -73,7 +73,7 @@ public class VmImpl extends NamedResourceImpl implements Vm { * {@inheritDoc} */ @Override - public NamedResource getParent() { + public ReferenceType getParent() { return vApp; } @@ -152,7 +152,7 @@ public class VmImpl extends NamedResourceImpl implements Vm { @Override public String toString() { - return "[id=" + getId() + ", name=" + getName() + ", vApp=" + vApp + ", description=" + description + ", status=" + return "[id=" + getHref() + ", name=" + getName() + ", vApp=" + vApp + ", description=" + description + ", status=" + status + "]"; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java index 0fed5f7fda..35ee2adfe2 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java @@ -24,7 +24,7 @@ import java.util.Set; import javax.annotation.Nullable; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.internal.VDCImpl; @@ -37,14 +37,14 @@ import com.google.inject.ImplementedBy; */ @org.jclouds.vcloud.endpoints.Network @ImplementedBy(VDCImpl.class) -public interface OrgNetwork extends NamedResource { +public interface OrgNetwork extends ReferenceType { /** * The org this network belongs to. * * @since vcloud api 0.9 */ @Nullable - NamedResource getOrg(); + ReferenceType getOrg(); /** * optional description @@ -78,7 +78,7 @@ public interface OrgNetwork extends NamedResource { * @since vcloud api 0.9 */ @Nullable - NamedResource getNetworkPool(); + ReferenceType getNetworkPool(); /** * list of external IP addresses that this network can use for NAT. @@ -105,7 +105,7 @@ public interface OrgNetwork extends NamedResource { * @since vcloud api 0.9 */ @Nullable - NamedResource getParentNetwork(); + ReferenceType getParentNetwork(); /** * defines how this network is connected to its ParentNetwork diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/VCloudExpressNetwork.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/VCloudExpressNetwork.java index 830b37f4dd..cfc8e1fb75 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/VCloudExpressNetwork.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/VCloudExpressNetwork.java @@ -23,7 +23,7 @@ import java.util.Set; import javax.annotation.Nullable; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.network.firewall.FirewallRule; import org.jclouds.vcloud.domain.network.nat.rules.PortForwardingRule; @@ -33,7 +33,7 @@ import org.jclouds.vcloud.domain.network.nat.rules.PortForwardingRule; * * @author Adrian Cole */ -public interface VCloudExpressNetwork extends NamedResource { +public interface VCloudExpressNetwork extends ReferenceType { /** * * @return Description of the network diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java index 022d25b900..5553cda31c 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java @@ -27,9 +27,9 @@ import java.util.Set; import javax.annotation.Nullable; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.domain.network.Features; import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.IpScope; @@ -43,19 +43,19 @@ import com.google.common.collect.Sets; * * @author Adrian Cole */ -public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork { +public class OrgNetworkImpl extends ReferenceTypeImpl implements OrgNetwork { @Nullable - private final NamedResource org; + private final ReferenceType org; @Nullable private final String description; private final List tasks = Lists.newArrayList(); private final Configuration configuration; @Nullable - private final NamedResource networkPool; + private final ReferenceType networkPool; private final Set allowedExternalIpAddresses = Sets.newLinkedHashSet(); - public OrgNetworkImpl(String name, String type, URI id, @Nullable NamedResource org, @Nullable String description, - Iterable tasks, Configuration configuration, @Nullable NamedResource networkPool, + public OrgNetworkImpl(String name, String type, URI id, @Nullable ReferenceType org, @Nullable String description, + Iterable tasks, Configuration configuration, @Nullable ReferenceType networkPool, Iterable allowedExternalIpAddresses) { super(name, type, id); this.org = org; @@ -72,11 +72,11 @@ public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork { @Nullable private final IpScope ipScope; @Nullable - private final NamedResource parentNetwork; + private final ReferenceType parentNetwork; private final FenceMode fenceMode; private final Features features; - public ConfigurationImpl(@Nullable IpScope ipScope, @Nullable NamedResource parentNetwork, FenceMode fenceMode, + public ConfigurationImpl(@Nullable IpScope ipScope, @Nullable ReferenceType parentNetwork, FenceMode fenceMode, @Nullable Features features) { this.ipScope = ipScope; this.parentNetwork = parentNetwork; @@ -96,7 +96,7 @@ public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork { * {@inheritDoc} */ @Override - public NamedResource getParentNetwork() { + public ReferenceType getParentNetwork() { return parentNetwork; } @@ -172,7 +172,7 @@ public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork { * {@inheritDoc} */ @Override - public NamedResource getOrg() { + public ReferenceType getOrg() { return org; } @@ -204,7 +204,7 @@ public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork { * {@inheritDoc} */ @Override - public NamedResource getNetworkPool() { + public ReferenceType getNetworkPool() { return networkPool; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/VCloudExpressNetworkImpl.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/VCloudExpressNetworkImpl.java index bb2724171c..b817802261 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/VCloudExpressNetworkImpl.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/VCloudExpressNetworkImpl.java @@ -22,8 +22,8 @@ package org.jclouds.vcloud.domain.network.internal; import java.net.URI; import java.util.Set; -import org.jclouds.vcloud.domain.NamedResource; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.VCloudExpressNetwork; import org.jclouds.vcloud.domain.network.firewall.FirewallRule; @@ -38,7 +38,7 @@ import com.google.inject.internal.Nullable; * @author Adrian Cole * */ -public class VCloudExpressNetworkImpl extends NamedResourceImpl implements VCloudExpressNetwork { +public class VCloudExpressNetworkImpl extends ReferenceTypeImpl implements VCloudExpressNetwork { /** The serialVersionUID */ private static final long serialVersionUID = 8464716396538298809L; @@ -123,8 +123,8 @@ public class VCloudExpressNetworkImpl extends NamedResourceImpl implements VClou } @Override - public int compareTo(NamedResource o) { - return (this == o) ? 0 : getId().compareTo(o.getId()); + public int compareTo(ReferenceType o) { + return (this == o) ? 0 : getHref().compareTo(o.getHref()); } @Override @@ -196,7 +196,7 @@ public class VCloudExpressNetworkImpl extends NamedResourceImpl implements VClou @Override public String toString() { - return "NetworkImpl [id=" + getId() + ", name=" + getName() + ", type=" + getType() + ", description=" + return "NetworkImpl [id=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description=" + description + ", dhcp=" + dhcp + ", dnsServers=" + dnsServers + ", fenceModes=" + fenceModes + ", firewallRules=" + firewallRules + ", gateway=" + gateway + ", natRules=" + natRules + ", netmask=" + netmask + "]"; diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/VCloudExpressOrgNetworkAdapter.java b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/VCloudExpressOrgNetworkAdapter.java index ca494c5d33..a4b3d57a67 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/VCloudExpressOrgNetworkAdapter.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/domain/network/internal/VCloudExpressOrgNetworkAdapter.java @@ -39,7 +39,7 @@ import com.google.common.collect.Iterables; public class VCloudExpressOrgNetworkAdapter extends OrgNetworkImpl { public VCloudExpressOrgNetworkAdapter(VCloudExpressNetwork in) { - super(in.getName(), in.getType(), in.getId(), null, in.getDescription(), ImmutableSet. of(), + super(in.getName(), in.getType(), in.getHref(), null, in.getDescription(), ImmutableSet. of(), parseConfiguration(in), null, ImmutableSet. of()); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllCatalogItemsInCatalog.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllCatalogItemsInCatalog.java index b9493a856b..546b082167 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllCatalogItemsInCatalog.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllCatalogItemsInCatalog.java @@ -37,7 +37,7 @@ import org.jclouds.vcloud.CommonVCloudAsyncClient; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import com.google.common.base.Function; import com.google.common.base.Predicate; @@ -64,22 +64,22 @@ public class AllCatalogItemsInCatalog implements Function apply(Catalog from) { - Iterable catalogItems = transformParallel(filter(from.values(), new Predicate() { + Iterable catalogItems = transformParallel(filter(from.values(), new Predicate() { @Override - public boolean apply(NamedResource input) { + public boolean apply(ReferenceType input) { return input.getType().equals(VCloudMediaType.CATALOGITEM_XML); } - }), new Function>() { + }), new Function>() { @SuppressWarnings("unchecked") @Override - public Future apply(NamedResource from) { - return (Future) aclient.getCatalogItem(from.getId()); + public Future apply(ReferenceType from) { + return (Future) aclient.getCatalogItem(from.getHref()); } - }, executor, null, logger, "catalogItems in " + from.getId()); + }, executor, null, logger, "catalogItems in " + from.getHref()); return catalogItems; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllCatalogsInOrg.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllCatalogsInOrg.java index d4580cca2a..8b7579699f 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllCatalogsInOrg.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllCatalogsInOrg.java @@ -34,7 +34,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; import org.jclouds.vcloud.CommonVCloudAsyncClient; import org.jclouds.vcloud.domain.Catalog; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import com.google.common.base.Function; @@ -60,11 +60,11 @@ public class AllCatalogsInOrg implements Function apply(final Org org) { Iterable catalogs = transformParallel(org.getCatalogs().values(), - new Function>() { + new Function>() { @SuppressWarnings("unchecked") @Override - public Future apply(NamedResource from) { - return (Future) aclient.getCatalog(from.getId()); + public Future apply(ReferenceType from) { + return (Future) aclient.getCatalog(from.getHref()); } }, executor, null, logger, "catalogs in " + org.getName()); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllVDCsInOrg.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllVDCsInOrg.java index a10a4a0ff9..65b06b06a2 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllVDCsInOrg.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/AllVDCsInOrg.java @@ -33,7 +33,7 @@ import org.jclouds.Constants; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; import org.jclouds.vcloud.CommonVCloudAsyncClient; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.VDC; @@ -61,11 +61,11 @@ public class AllVDCsInOrg implements Function> { public Iterable apply(final Org org) { Iterable catalogItems = transformParallel(org.getVDCs().values(), - new Function>() { + new Function>() { @SuppressWarnings("unchecked") @Override - public Future apply(NamedResource from) { - return (Future) aclient.getVDC(from.getId()); + public Future apply(ReferenceType from) { + return (Future) aclient.getVDC(from.getHref()); } }, executor, null, logger, "vdcs in org " + org.getName()); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameAndCatalogNameToEndpoint.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameAndCatalogNameToEndpoint.java index aae470399e..4de14aa51c 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameAndCatalogNameToEndpoint.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameAndCatalogNameToEndpoint.java @@ -28,7 +28,7 @@ import java.util.NoSuchElementException; import javax.inject.Inject; import javax.inject.Singleton; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.endpoints.Catalog; @@ -65,8 +65,8 @@ public class OrgNameAndCatalogNameToEndpoint implements Function { org = defaultOrg; try { - Map catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs(); - return catalog == null ? Iterables.getLast(catalogs.values()).getId() : catalogs.get(catalog).getId(); + Map catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs(); + return catalog == null ? Iterables.getLast(catalogs.values()).getHref() : catalogs.get(catalog).getHref(); } catch (NullPointerException e) { throw new NoSuchElementException(org + "/" + catalog + " not found in " + orgMap.get()); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameAndVDCNameToEndpoint.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameAndVDCNameToEndpoint.java index abbb52a4f5..cdc5747537 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameAndVDCNameToEndpoint.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameAndVDCNameToEndpoint.java @@ -28,7 +28,7 @@ import java.util.NoSuchElementException; import javax.inject.Inject; import javax.inject.Singleton; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.endpoints.VDC; @@ -65,8 +65,8 @@ public class OrgNameAndVDCNameToEndpoint implements Function { org = defaultOrg; try { - Map vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs(); - return vdc == null ? Iterables.getLast(vdcs.values()).getId() : vdcs.get(vdc).getId(); + Map vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs(); + return vdc == null ? Iterables.getLast(vdcs.values()).getHref() : vdcs.get(vdc).getHref(); } catch (NullPointerException e) { throw new NoSuchElementException(org + "/" + vdc + " not found in " + orgNameToVDCEndpoint.get()); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameCatalogNameItemNameToEndpoint.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameCatalogNameItemNameToEndpoint.java index faea9152c8..078d0bb408 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameCatalogNameItemNameToEndpoint.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameCatalogNameItemNameToEndpoint.java @@ -66,7 +66,7 @@ public class OrgNameCatalogNameItemNameToEndpoint implements Function catalogs = checkNotNull(orgCatalogMap.get().get(org)); - return catalogs.get(catalog).get(catalogItem).getId(); + return catalogs.get(catalog).get(catalogItem).getHref(); } catch (NullPointerException e) { throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in " + orgCatalogMap.get()); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameCatalogNameVAppTemplateNameToEndpoint.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameCatalogNameVAppTemplateNameToEndpoint.java index 3bf42faff2..1bbe1304a9 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameCatalogNameVAppTemplateNameToEndpoint.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameCatalogNameVAppTemplateNameToEndpoint.java @@ -67,7 +67,7 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function> catalogs = checkNotNull(orgCatalogItemMap.get().get(org)); - return catalogs.get(catalog).get(catalogItem).getEntity().getId(); + return catalogs.get(catalog).get(catalogItem).getEntity().getHref(); } catch (NullPointerException e) { throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in " + orgCatalogItemMap.get()); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java index 0e19d3bff1..dea47b2424 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java @@ -26,7 +26,7 @@ import java.util.NoSuchElementException; import javax.inject.Inject; import javax.inject.Singleton; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.endpoints.Org; import com.google.common.base.Function; @@ -38,19 +38,19 @@ import com.google.common.base.Supplier; */ @Singleton public class OrgNameToEndpoint implements Function { - private final Supplier> orgNameToEndpointSupplier; + private final Supplier> orgNameToEndpointSupplier; private final URI defaultUri; @Inject - public OrgNameToEndpoint(@Org Supplier> orgNameToEndpointSupplier, @Org URI defaultUri) { + public OrgNameToEndpoint(@Org Supplier> orgNameToEndpointSupplier, @Org URI defaultUri) { this.orgNameToEndpointSupplier = orgNameToEndpointSupplier; this.defaultUri = defaultUri; } public URI apply(Object from) { try { - Map orgNameToEndpoint = orgNameToEndpointSupplier.get(); - return from == null ? defaultUri : orgNameToEndpoint.get(from).getId(); + Map orgNameToEndpoint = orgNameToEndpointSupplier.get(); + return from == null ? defaultUri : orgNameToEndpoint.get(from).getHref(); } catch (NullPointerException e) { throw new NoSuchElementException("org " + from + " not found in " + orgNameToEndpointSupplier.get().keySet()); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java index 1085d83800..5d5e631f03 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java @@ -54,7 +54,7 @@ public class OrgNameToTasksListEndpoint implements Function { if (org == null) return defaultUri; try { - return checkNotNull(orgMap.get().get(org)).getTasksList().getId(); + return checkNotNull(orgMap.get().get(org)).getTasksList().getHref(); } catch (NullPointerException e) { throw new NoSuchElementException(org + " not found in " + orgMap.get()); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameVDCNameResourceEntityNameToEndpoint.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameVDCNameResourceEntityNameToEndpoint.java index 47e40ceabf..3b1a0ba16c 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameVDCNameResourceEntityNameToEndpoint.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgNameVDCNameResourceEntityNameToEndpoint.java @@ -66,7 +66,7 @@ public class OrgNameVDCNameResourceEntityNameToEndpoint implements Function vDCs = checkNotNull(orgVDCMap.get().get(org)); - return vDCs.get(vDC).getResourceEntities().get(entityName).getId(); + return vDCs.get(vDC).getResourceEntities().get(entityName).getHref(); } catch (NullPointerException e) { throw new NoSuchElementException(org + "/" + vDC + "/" + entityName + " not found in " + orgVDCMap.get()); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java index 00972c4a4e..164f0de1cf 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java @@ -80,7 +80,7 @@ public class OrgsForLocations implements Function, @Override public URI apply(Location from) { - return VCloudLocation.class.cast(from.getParent()).getResource().getId(); + return VCloudLocation.class.cast(from.getParent()).getResource().getHref(); } })), new Function>() { diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java index 1b87d4118f..9fbe102f2a 100755 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java @@ -36,7 +36,7 @@ import org.jclouds.http.HttpResponseException; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax.Factory; import org.jclouds.vcloud.VCloudToken; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.endpoints.Org; import org.jclouds.vcloud.xml.OrgListHandler; @@ -73,7 +73,7 @@ public class ParseLoginResponseFromHeaders implements Function org = factory.create(orgHandlerProvider.get()).parse( + final Map org = factory.create(orgHandlerProvider.get()).parse( from.getPayload().getInput()); return new VCloudSession() { @@ -83,7 +83,7 @@ public class ParseLoginResponseFromHeaders implements Function getOrgs() { + public Map getOrgs() { return org; } }; diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java index 464462a974..da0d624ab3 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java @@ -76,7 +76,7 @@ public class VAppTemplatesForCatalogItems implements @Override public Future apply(CatalogItem from) { return (Future) VCloudAsyncClient.class.cast(aclient).getVAppTemplate( - from.getEntity().getId()); + from.getEntity().getHref()); } }, executor, null, logger, "vappTemplates in"); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForResourceEntities.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForResourceEntities.java index 616cbacf28..534a7e0441 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForResourceEntities.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForResourceEntities.java @@ -36,7 +36,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.VCloudMediaType; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VAppTemplate; import com.google.common.base.Function; @@ -47,7 +47,7 @@ import com.google.common.base.Predicate; */ @Singleton public class VAppTemplatesForResourceEntities implements - Function, Iterable> { + Function, Iterable> { @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) public Logger logger = Logger.NULL; @@ -62,20 +62,20 @@ public class VAppTemplatesForResourceEntities implements } @Override - public Iterable apply(Iterable from) { - return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate() { + public Iterable apply(Iterable from) { + return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate() { @Override - public boolean apply(NamedResource input) { + public boolean apply(ReferenceType input) { return input.getType().equals(VCloudMediaType.VAPPTEMPLATE_XML); } - }), new Function>() { + }), new Function>() { @SuppressWarnings("unchecked") @Override - public Future apply(NamedResource from) { - return (Future) aclient.getVAppTemplate(from.getId()); + public Future apply(ReferenceType from) { + return (Future) aclient.getVAppTemplate(from.getHref()); } }, executor, null, logger, "vappTemplates in"); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressAllCatalogItemsInCatalog.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressAllCatalogItemsInCatalog.java index e94c7b3115..cbca9b5755 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressAllCatalogItemsInCatalog.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressAllCatalogItemsInCatalog.java @@ -37,7 +37,7 @@ import org.jclouds.vcloud.VCloudExpressAsyncClient; import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import com.google.common.base.Function; import com.google.common.base.Predicate; @@ -63,22 +63,22 @@ public class VCloudExpressAllCatalogItemsInCatalog implements Function apply(Catalog from) { - Iterable catalogItems = transformParallel(filter(from.values(), new Predicate() { + Iterable catalogItems = transformParallel(filter(from.values(), new Predicate() { @Override - public boolean apply(NamedResource input) { + public boolean apply(ReferenceType input) { return input.getType().equals(VCloudExpressMediaType.CATALOGITEM_XML); } - }), new Function>() { + }), new Function>() { @SuppressWarnings("unchecked") @Override - public Future apply(NamedResource from) { - return (Future) aclient.getCatalogItem(from.getId()); + public Future apply(ReferenceType from) { + return (Future) aclient.getCatalogItem(from.getHref()); } - }, executor, null, logger, "catalogItems in " + from.getId()); + }, executor, null, logger, "catalogItems in " + from.getHref()); return catalogItems; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressVAppTemplatesForCatalogItems.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressVAppTemplatesForCatalogItems.java index a2db5d2d1f..09d7258127 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressVAppTemplatesForCatalogItems.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressVAppTemplatesForCatalogItems.java @@ -74,7 +74,7 @@ public class VCloudExpressVAppTemplatesForCatalogItems implements @SuppressWarnings("unchecked") @Override public Future apply(CatalogItem from) { - return (Future) aclient.getVAppTemplate(from.getEntity().getId()); + return (Future) aclient.getVAppTemplate(from.getEntity().getHref()); } }, executor, null, logger, "vappTemplates in"); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressVAppTemplatesForResourceEntities.java b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressVAppTemplatesForResourceEntities.java index 255a6fae0b..b82c647473 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressVAppTemplatesForResourceEntities.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/functions/VCloudExpressVAppTemplatesForResourceEntities.java @@ -36,7 +36,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; import org.jclouds.vcloud.VCloudExpressAsyncClient; import org.jclouds.vcloud.VCloudExpressMediaType; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; import com.google.common.base.Function; @@ -47,7 +47,7 @@ import com.google.common.base.Predicate; */ @Singleton public class VCloudExpressVAppTemplatesForResourceEntities implements - Function, Iterable> { + Function, Iterable> { @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) public Logger logger = Logger.NULL; @@ -62,20 +62,20 @@ public class VCloudExpressVAppTemplatesForResourceEntities implements } @Override - public Iterable apply(Iterable from) { - return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate() { + public Iterable apply(Iterable from) { + return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate() { @Override - public boolean apply(NamedResource input) { + public boolean apply(ReferenceType input) { return input.getType().equals(VCloudExpressMediaType.VAPPTEMPLATE_XML); } - }), new Function>() { + }), new Function>() { @SuppressWarnings("unchecked") @Override - public Future apply(NamedResource from) { - return (Future) aclient.getVAppTemplate(from.getId()); + public Future apply(ReferenceType from) { + return (Future) aclient.getVAppTemplate(from.getHref()); } }, executor, null, logger, "vappTemplates in"); diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java b/vcloud/core/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java index 6fb5edee8f..6377644d75 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java @@ -57,7 +57,7 @@ public class TaskSuccess implements Predicate { Task task = client.getTask(taskId); logger.trace("%s: looking for status %s: currently: %s", task, TaskStatus.SUCCESS, task.getStatus()); if (task.getStatus() == TaskStatus.ERROR) - throw new RuntimeException("error on task: " + task.getId() + " error: " + task.getError()); + throw new RuntimeException("error on task: " + task.getHref() + " error: " + task.getError()); return task.getStatus() == TaskStatus.SUCCESS; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/util/Utils.java b/vcloud/core/src/main/java/org/jclouds/vcloud/util/Utils.java index 9ee575b608..99cd97dc25 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/util/Utils.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/util/Utils.java @@ -22,9 +22,9 @@ package org.jclouds.vcloud.util; import java.net.URI; import java.util.Map; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.domain.internal.TaskImpl.ErrorImpl; import org.xml.sax.Attributes; @@ -33,14 +33,14 @@ import org.xml.sax.Attributes; * @author Adrian Cole */ public class Utils { - public static NamedResource newNamedResource(Attributes attributes, String defaultType) { + public static ReferenceType newNamedResource(Attributes attributes, String defaultType) { String uri = attributes.getValue(attributes.getIndex("href")); String type = attributes.getValue(attributes.getIndex("type")); - return new NamedResourceImpl(attributes.getValue(attributes.getIndex("name")), type != null ? type : defaultType, + return new ReferenceTypeImpl(attributes.getValue(attributes.getIndex("name")), type != null ? type : defaultType, URI.create(uri)); } - public static NamedResource newNamedResource(Attributes attributes) { + public static ReferenceType newNamedResource(Attributes attributes) { return newNamedResource(attributes, null); } @@ -63,7 +63,7 @@ public class Utils { return attributes.getIndex(attr) >= 0 ? attributes.getValue(attributes.getIndex(attr)) : null; } - public static void putNamedResource(Map map, Attributes attributes) { + public static void putNamedResource(Map map, Attributes attributes) { map.put(attributes.getValue(attributes.getIndex("name")), newNamedResource(attributes)); } } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java index 2b10e3cd02..a4822604ea 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java @@ -29,7 +29,7 @@ import javax.inject.Inject; import org.jclouds.http.functions.ParseSax; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Catalog; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.internal.CatalogImpl; import org.jclouds.vcloud.util.Utils; @@ -53,16 +53,16 @@ public class CatalogHandler extends ParseSax.HandlerWithResult { private StringBuilder currentText = new StringBuilder(); - private NamedResource catalog; - private SortedMap contents = Maps.newTreeMap(); + private ReferenceType catalog; + private SortedMap contents = Maps.newTreeMap(); protected List tasks = Lists.newArrayList(); private String description; - private NamedResource org; + private ReferenceType org; private boolean published = true; public Catalog getResult() { - return new CatalogImpl(catalog.getName(), catalog.getType(), catalog.getId(), org, description, contents, tasks, + return new CatalogImpl(catalog.getName(), catalog.getType(), catalog.getHref(), org, description, contents, tasks, published); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java index 710bf357f2..5cc470e6ee 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java @@ -23,7 +23,7 @@ import java.util.SortedMap; import org.jclouds.http.functions.ParseSax; import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.internal.CatalogItemImpl; import org.jclouds.vcloud.util.Utils; import org.xml.sax.Attributes; @@ -37,15 +37,15 @@ import com.google.common.collect.Maps; public class CatalogItemHandler extends ParseSax.HandlerWithResult { private StringBuilder currentText = new StringBuilder(); - protected NamedResource catalogItem; - protected NamedResource entity; + protected ReferenceType catalogItem; + protected ReferenceType entity; protected String description; protected String key; protected SortedMap properties = Maps.newTreeMap(); public CatalogItem getResult() { - return new CatalogItemImpl(catalogItem.getName(), catalogItem.getId(), description, entity, properties); + return new CatalogItemImpl(catalogItem.getName(), catalogItem.getHref(), description, entity, properties); } @Override diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java index ab8b6d098d..0feccf5be2 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java @@ -28,7 +28,7 @@ import java.util.Map; import javax.inject.Inject; import org.jclouds.http.functions.ParseSax; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.internal.OrgImpl; @@ -52,18 +52,18 @@ public class OrgHandler extends ParseSax.HandlerWithResult { private StringBuilder currentText = new StringBuilder(); - protected NamedResource org; - protected Map vdcs = Maps.newLinkedHashMap(); - protected NamedResource tasksList; - protected Map catalogs = Maps.newLinkedHashMap(); - protected Map networks = Maps.newLinkedHashMap(); + protected ReferenceType org; + protected Map vdcs = Maps.newLinkedHashMap(); + protected ReferenceType tasksList; + protected Map catalogs = Maps.newLinkedHashMap(); + protected Map networks = Maps.newLinkedHashMap(); protected List tasks = Lists.newArrayList(); protected String description; protected String fullName; public Org getResult() { - return new OrgImpl(org.getName(), org.getType(), org.getId(), fullName != null ? fullName : org.getName(), + return new OrgImpl(org.getName(), org.getType(), org.getHref(), fullName != null ? fullName : org.getName(), description, catalogs, vdcs, networks, tasksList, tasks); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java index f54698853e..5505663033 100755 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java @@ -25,7 +25,7 @@ import static org.jclouds.vcloud.util.Utils.putNamedResource; import java.util.Map; import org.jclouds.http.functions.ParseSax; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -35,11 +35,11 @@ import com.google.common.collect.Maps; * @author Adrian Cole */ public class OrgListHandler extends - ParseSax.HandlerWithResult> { + ParseSax.HandlerWithResult> { - private Map org = Maps.newHashMap(); + private Map org = Maps.newHashMap(); - public Map getResult() { + public Map getResult() { return org; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java index 95c6da7d40..cbe0c743b3 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java @@ -28,7 +28,7 @@ import javax.inject.Inject; import org.jclouds.http.functions.ParseSax; import org.jclouds.vcloud.domain.MappingMode; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.network.DhcpService; import org.jclouds.vcloud.domain.network.Features; @@ -71,8 +71,8 @@ public class OrgNetworkHandler extends ParseSax.HandlerWithResult { protected StringBuilder currentText = new StringBuilder(); - protected NamedResource network; - protected NamedResource org; + protected ReferenceType network; + protected ReferenceType org; protected String orgDescription; protected List tasks = Lists.newArrayList(); @@ -89,7 +89,7 @@ public class OrgNetworkHandler extends ParseSax.HandlerWithResult { protected Set allocatedIpAddresses = Sets.newLinkedHashSet(); protected IpScope ipScope; - protected NamedResource parentNetwork; + protected ReferenceType parentNetwork; protected FenceMode fenceMode; protected boolean serviceEnabled; @@ -133,11 +133,11 @@ public class OrgNetworkHandler extends ParseSax.HandlerWithResult { protected Features features; protected OrgNetwork.Configuration configuration; - protected NamedResource networkPool; + protected ReferenceType networkPool; protected Set allowedExternalIpAddresses = Sets.newLinkedHashSet(); public OrgNetwork getResult() { - return new OrgNetworkImpl(network.getName(), network.getType(), network.getId(), org, orgDescription, tasks, + return new OrgNetworkImpl(network.getName(), network.getType(), network.getHref(), org, orgDescription, tasks, configuration, networkPool, allowedExternalIpAddresses); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java index 5a15743964..078c76c95a 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java @@ -27,7 +27,7 @@ import javax.inject.Inject; import org.jclouds.date.DateService; import org.jclouds.http.functions.ParseSax; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.TaskStatus; import org.jclouds.vcloud.domain.Task.Error; @@ -42,8 +42,8 @@ import org.xml.sax.SAXException; public class TaskHandler extends ParseSax.HandlerWithResult { protected final DateService dateService; - private NamedResource taskLink; - private NamedResource owner; + private ReferenceType taskLink; + private ReferenceType owner; private TaskStatus status; private Date startTime; private Date endTime; @@ -105,7 +105,7 @@ public class TaskHandler extends ParseSax.HandlerWithResult { @Override public void endElement(String uri, String localName, String qName) { if (qName.equalsIgnoreCase("Task")) { - this.task = new TaskImpl(taskLink.getId(), status, startTime, endTime, expiryTime, owner, error); + this.task = new TaskImpl(taskLink.getHref(), status, startTime, endTime, expiryTime, owner, error); taskLink = null; status = null; startTime = null; diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java index afa585572c..5d1714bba0 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java @@ -24,7 +24,7 @@ import java.util.SortedSet; import javax.inject.Inject; import org.jclouds.http.functions.ParseSax; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.TasksList; import org.jclouds.vcloud.domain.internal.TasksListImpl; @@ -41,7 +41,7 @@ public class TasksListHandler extends ParseSax.HandlerWithResult { private SortedSet tasks = Sets.newTreeSet(); private final TaskHandler taskHandler; - private NamedResource resource; + private ReferenceType resource; @Inject public TasksListHandler(TaskHandler taskHandler) { @@ -49,7 +49,7 @@ public class TasksListHandler extends ParseSax.HandlerWithResult { } public TasksList getResult() { - return new TasksListImpl(resource.getId(), tasks); + return new TasksListImpl(resource.getHref(), tasks); } @Override diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java index c764d4ba2e..491c3d5ef7 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java @@ -27,7 +27,7 @@ import java.util.Set; import javax.inject.Inject; import org.jclouds.http.functions.ParseSax; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VApp; @@ -56,9 +56,9 @@ public class VAppHandler extends ParseSax.HandlerWithResult { protected StringBuilder currentText = new StringBuilder(); - protected NamedResource template; + protected ReferenceType template; protected Status status; - protected NamedResource vdc; + protected ReferenceType vdc; protected String description; protected List tasks = Lists.newArrayList(); protected boolean ovfDescriptorUploaded = true; @@ -68,7 +68,7 @@ public class VAppHandler extends ParseSax.HandlerWithResult { protected Set children = Sets.newLinkedHashSet(); public VApp getResult() { - return new VAppImpl(template.getName(), template.getType(), template.getId(), status, vdc, description, tasks, + return new VAppImpl(template.getName(), template.getType(), template.getHref(), status, vdc, description, tasks, ovfDescriptorUploaded, children); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java index 967f7d2881..5dce65ec53 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java @@ -27,7 +27,7 @@ import java.util.Set; import javax.inject.Inject; import org.jclouds.http.functions.ParseSax; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VAppTemplate; @@ -56,9 +56,9 @@ public class VAppTemplateHandler extends ParseSax.HandlerWithResult tasks = Lists.newArrayList(); protected boolean ovfDescriptorUploaded = true; @@ -69,7 +69,7 @@ public class VAppTemplateHandler extends ParseSax.HandlerWithResult children = Sets.newLinkedHashSet(); public VAppTemplate getResult() { - return new VAppTemplateImpl(template.getName(), template.getType(), template.getId(), status, vdc, description, + return new VAppTemplateImpl(template.getName(), template.getType(), template.getHref(), status, vdc, description, tasks, ovfDescriptorUploaded, vAppScopedLocalId, children); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VCloudExpressNetworkHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VCloudExpressNetworkHandler.java index 74d2f5757f..db1f4ef11d 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VCloudExpressNetworkHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VCloudExpressNetworkHandler.java @@ -25,7 +25,7 @@ import javax.annotation.Resource; import org.jclouds.http.functions.ParseSax; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.VCloudExpressNetwork; import org.jclouds.vcloud.domain.network.firewall.FirewallPolicy; @@ -49,7 +49,7 @@ public class VCloudExpressNetworkHandler extends ParseSax.HandlerWithResult { private StringBuilder currentText = new StringBuilder(); - private NamedResource catalog; + private ReferenceType catalog; private String description; private Status status; public VCloudExpressVAppTemplate getResult() { - return new VCloudExpressVAppTemplateImpl(catalog.getName(), catalog.getId(), description, status); + return new VCloudExpressVAppTemplateImpl(catalog.getName(), catalog.getHref(), description, status); } @Override diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java index 00b0b2c830..cf18473389 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java @@ -30,7 +30,7 @@ import javax.inject.Inject; import org.jclouds.http.functions.ParseSax; import org.jclouds.vcloud.domain.AllocationModel; import org.jclouds.vcloud.domain.Capacity; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.VDCStatus; @@ -56,9 +56,9 @@ public class VDCHandler extends ParseSax.HandlerWithResult { protected StringBuilder currentText = new StringBuilder(); - protected NamedResource vDC; + protected ReferenceType vDC; protected VDCStatus status = VDCStatus.READY; - protected NamedResource org; + protected ReferenceType org; protected String description; protected List tasks = Lists.newArrayList(); protected AllocationModel allocationModel = AllocationModel.UNRECOGNIZED_MODEL; @@ -73,8 +73,8 @@ public class VDCHandler extends ParseSax.HandlerWithResult { protected int used = 0; protected long overhead = 0; - protected Map resourceEntities = Maps.newLinkedHashMap(); - protected Map availableNetworks = Maps.newLinkedHashMap(); + protected Map resourceEntities = Maps.newLinkedHashMap(); + protected Map availableNetworks = Maps.newLinkedHashMap(); protected int nicQuota; protected int networkQuota; @@ -82,7 +82,7 @@ public class VDCHandler extends ParseSax.HandlerWithResult { protected boolean isEnabled = true; public VDC getResult() { - return new VDCImpl(vDC.getName(), vDC.getType(), vDC.getId(), status, org, description, tasks, allocationModel, + return new VDCImpl(vDC.getName(), vDC.getType(), vDC.getHref(), status, org, description, tasks, allocationModel, storageCapacity, cpuCapacity, memoryCapacity, resourceEntities, availableNetworks, nicQuota, networkQuota, vmQuota, isEnabled); } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VmHandler.java b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VmHandler.java index 23f573cc34..bf2a25d2b7 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VmHandler.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/xml/VmHandler.java @@ -26,7 +26,7 @@ import java.util.List; import javax.inject.Inject; import org.jclouds.http.functions.ParseSax; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Vm; @@ -51,15 +51,15 @@ public class VmHandler extends ParseSax.HandlerWithResult { protected StringBuilder currentText = new StringBuilder(); - protected NamedResource vm; + protected ReferenceType vm; protected Status status; - protected NamedResource vdc; + protected ReferenceType vdc; protected String description; protected List tasks = Lists.newArrayList(); protected String vAppScopedLocalId; public Vm getResult() { - return new VmImpl(vm.getName(), vm.getType(), vm.getId(), status, vdc, description, tasks, vAppScopedLocalId); + return new VmImpl(vm.getName(), vm.getType(), vm.getHref(), status, vdc, description, tasks, vAppScopedLocalId); } @Override diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/CommonVCloudClientLiveTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/CommonVCloudClientLiveTest.java index f9587ddf5f..02d3dee616 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/CommonVCloudClientLiveTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/CommonVCloudClientLiveTest.java @@ -30,7 +30,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.rest.RestContext; import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VDC; @@ -69,11 +69,11 @@ public abstract class CommonVCloudClientLiveTest 0) { Task task = response.getTasks().last(); - assertEquals(connection.getTask(task.getId()).getId(), task.getId()); + assertEquals(connection.getTask(task.getHref()).getHref(), task.getHref()); } } diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java index 0f4678bd00..d284baabaa 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java @@ -49,13 +49,13 @@ import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.util.Utils; import org.jclouds.vcloud.config.VCloudRestClientModule; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.internal.CatalogImpl; import org.jclouds.vcloud.domain.internal.CatalogItemImpl; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.domain.internal.OrgImpl; import org.jclouds.vcloud.domain.internal.VDCImpl; import org.jclouds.vcloud.filters.SetVCloudTokenCookie; @@ -702,13 +702,13 @@ public class VCloudAsyncClientTest extends RestClientTest { } @Override - protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { + protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { return URI.create("https://vcenterprise.bluelock.com/api/v1.0/org"); } @Override - protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { + protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { return "org"; } @@ -744,8 +744,8 @@ public class VCloudAsyncClientTest extends RestClientTest { return Suppliers. ofInstance(new VCloudSession() { @Override - public Map getOrgs() { - return ImmutableMap. of("org", new NamedResourceImpl("org", + public Map getOrgs() { + return ImmutableMap. of("org", new ReferenceTypeImpl("org", VCloudMediaType.ORG_XML, URI.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"))); } @@ -791,15 +791,15 @@ public class VCloudAsyncClientTest extends RestClientTest { null, null, ImmutableMap - . of( + . of( "vapp", - new NamedResourceImpl( + new ReferenceTypeImpl( "vapp", "application/vnd.vmware.vcloud.vApp+xml", URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")), "network", - new NamedResourceImpl( + new ReferenceTypeImpl( "network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI @@ -819,15 +819,15 @@ public class VCloudAsyncClientTest extends RestClientTest { public Map get() { return ImmutableMap. of("org", new OrgImpl("org", null, URI .create("https://vcenterprise.bluelock.com/api/v1.0/org/1"), "org", "description", ImmutableMap - . of("catalog", new NamedResourceImpl("catalog", + . of("catalog", new ReferenceTypeImpl("catalog", VCloudMediaType.CATALOG_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))), ImmutableMap - . of("vdc", new NamedResourceImpl("vdc", VCloudMediaType.VDC_XML, URI + . of("vdc", new ReferenceTypeImpl("vdc", VCloudMediaType.VDC_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"))), ImmutableMap - . of("network", new NamedResourceImpl("network", + . of("network", new ReferenceTypeImpl("network", VCloudMediaType.NETWORK_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/network/1"))), - new NamedResourceImpl("tasksList", VCloudMediaType.TASKSLIST_XML, URI + new ReferenceTypeImpl("tasksList", VCloudMediaType.TASKSLIST_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")), ImmutableList . of())); } @@ -846,10 +846,10 @@ public class VCloudAsyncClientTest extends RestClientTest { ImmutableMap. of("catalog", new CatalogImpl("catalog", "type", URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), null, "description", - ImmutableMap. of("item", new NamedResourceImpl("item", + ImmutableMap. of("item", new ReferenceTypeImpl("item", "application/vnd.vmware.vcloud.catalogItem+xml", URI .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")), - "template", new NamedResourceImpl("template", + "template", new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))), ImmutableList. of(), true))); @@ -878,7 +878,7 @@ public class VCloudAsyncClientTest extends RestClientTest { URI .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"), "description", - new NamedResourceImpl( + new ReferenceTypeImpl( "template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI @@ -889,7 +889,7 @@ public class VCloudAsyncClientTest extends RestClientTest { } @Override - protected Iterable provideOrgs(Supplier cache, String user) { + protected Iterable provideOrgs(Supplier cache, String user) { return null; } diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudClientLiveTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudClientLiveTest.java index 535a9c19f0..45031cd26a 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudClientLiveTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudClientLiveTest.java @@ -25,7 +25,7 @@ import static org.testng.Assert.assertNotNull; import org.jclouds.rest.AuthorizationException; import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VDC; @@ -48,14 +48,14 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest orgs) { + protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { return URI.create("https://vcloud.safesecureweb.com/api/v0.8/org"); } @Override - protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { + protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { return "org"; } @@ -668,7 +668,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest provideOrgs(Supplier cache, @Named(PROPERTY_IDENTITY) String user) { + protected Iterable provideOrgs(Supplier cache, @Named(PROPERTY_IDENTITY) String user) { return null; } @@ -693,8 +693,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest ofInstance(new VCloudSession() { @Override - public Map getOrgs() { - return ImmutableMap. of("org", new NamedResourceImpl("org", + public Map getOrgs() { + return ImmutableMap. of("org", new ReferenceTypeImpl("org", VCloudExpressMediaType.ORG_XML, URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"))); } @@ -723,10 +723,10 @@ public class VCloudExpressAsyncClientTest extends RestClientTest of("vdc", new VDCImpl("vdc", null, URI .create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), null, null, "description", null, - null, null, null, null, ImmutableMap. of("vapp", - new NamedResourceImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI + null, null, null, null, ImmutableMap. of("vapp", + new ReferenceTypeImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1")), - "network", new NamedResourceImpl("network", + "network", new ReferenceTypeImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vdcItem/2"))), null, 0, 0, 0, false)))); @@ -744,13 +744,13 @@ public class VCloudExpressAsyncClientTest extends RestClientTest get() { return ImmutableMap. of("org", new OrgImpl("org", null, URI .create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "org", null, ImmutableMap - . of("catalog", new NamedResourceImpl("catalog", + . of("catalog", new ReferenceTypeImpl("catalog", VCloudExpressMediaType.CATALOG_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))), ImmutableMap - . of("vdc", new NamedResourceImpl("vdc", VCloudExpressMediaType.VDC_XML, + . of("vdc", new ReferenceTypeImpl("vdc", VCloudExpressMediaType.VDC_XML, URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))), ImmutableMap - . of(), - new NamedResourceImpl("tasksList", VCloudExpressMediaType.TASKSLIST_XML, URI + . of(), + new ReferenceTypeImpl("tasksList", VCloudExpressMediaType.TASKSLIST_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), ImmutableList . of())); } @@ -769,10 +769,10 @@ public class VCloudExpressAsyncClientTest extends RestClientTest of("catalog", new CatalogImpl("catalog", "type", URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"), null, "description", - ImmutableMap. of("item", new NamedResourceImpl("item", + ImmutableMap. of("item", new ReferenceTypeImpl("item", "application/vnd.vmware.vcloud.catalogItem+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1")), "template", - new NamedResourceImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI + new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"))), ImmutableList. of(), true))); } @@ -800,7 +800,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest of(), ImmutableList. of(), false)); + . of(), ImmutableList. of(), false)); } public void testTerremark() { @@ -72,66 +72,66 @@ public class CatalogHandlerTest { assertEquals(result.getName(), "Miami Environment 1"); assert result.getDescription() == null; - assertEquals(result.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")); - assertEquals(result.get("CentOS 5.3 (32-bit)"), new NamedResourceImpl("CentOS 5.3 (32-bit)", CATALOGITEM_XML, URI + assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")); + assertEquals(result.get("CentOS 5.3 (32-bit)"), new ReferenceTypeImpl("CentOS 5.3 (32-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/5"))); - assertEquals(result.get("CentOS 5.3 (64-bit)"), new NamedResourceImpl("CentOS 5.3 (64-bit)", CATALOGITEM_XML, URI + assertEquals(result.get("CentOS 5.3 (64-bit)"), new ReferenceTypeImpl("CentOS 5.3 (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/6"))); - assertEquals(result.get("RHEL 5.3 (32-bit)"), new NamedResourceImpl("RHEL 5.3 (32-bit)", CATALOGITEM_XML, URI + assertEquals(result.get("RHEL 5.3 (32-bit)"), new ReferenceTypeImpl("RHEL 5.3 (32-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/7"))); - assertEquals(result.get("RHEL 5.3 (64-bit)"), new NamedResourceImpl("RHEL 5.3 (64-bit)", CATALOGITEM_XML, URI + assertEquals(result.get("RHEL 5.3 (64-bit)"), new ReferenceTypeImpl("RHEL 5.3 (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/8"))); - assertEquals(result.get("Ubuntu JeOS 9.04 (32-bit)"), new NamedResourceImpl("Ubuntu JeOS 9.04 (32-bit)", + assertEquals(result.get("Ubuntu JeOS 9.04 (32-bit)"), new ReferenceTypeImpl("Ubuntu JeOS 9.04 (32-bit)", CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/11"))); - assertEquals(result.get("Ubuntu JeOS 9.04 (64-bit)"), new NamedResourceImpl("Ubuntu JeOS 9.04 (64-bit)", + assertEquals(result.get("Ubuntu JeOS 9.04 (64-bit)"), new ReferenceTypeImpl("Ubuntu JeOS 9.04 (64-bit)", CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/12"))); - assertEquals(result.get("Ubuntu Server 9.04 (32-bit)"), new NamedResourceImpl("Ubuntu Server 9.04 (32-bit)", + assertEquals(result.get("Ubuntu Server 9.04 (32-bit)"), new ReferenceTypeImpl("Ubuntu Server 9.04 (32-bit)", CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/9"))); - assertEquals(result.get("Ubuntu Server 9.04 (64-bit)"), new NamedResourceImpl("Ubuntu Server 9.04 (64-bit)", + assertEquals(result.get("Ubuntu Server 9.04 (64-bit)"), new ReferenceTypeImpl("Ubuntu Server 9.04 (64-bit)", CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/10"))); - assertEquals(result.get("Windows 2003 Enterprise R2 (32-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows 2003 Enterprise R2 (32-bit)"), new ReferenceTypeImpl( "Windows 2003 Enterprise R2 (32-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/1"))); - assertEquals(result.get("Windows 2003 Enterprise R2 (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows 2003 Enterprise R2 (64-bit)"), new ReferenceTypeImpl( "Windows 2003 Enterprise R2 (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/2"))); - assertEquals(result.get("Windows 2003 Standard R2 (32-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows 2003 Standard R2 (32-bit)"), new ReferenceTypeImpl( "Windows 2003 Standard R2 (32-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/3"))); - assertEquals(result.get("Windows 2003 Standard R2 (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows 2003 Standard R2 (64-bit)"), new ReferenceTypeImpl( "Windows 2003 Standard R2 (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/4"))); - assertEquals(result.get("Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)"), new ReferenceTypeImpl( "Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/23"))); - assertEquals(result.get("Windows Server 2008 Enterprise (32-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Server 2008 Enterprise (32-bit)"), new ReferenceTypeImpl( "Windows Server 2008 Enterprise (32-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/13"))); - assertEquals(result.get("Windows Server 2008 Enterprise (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Server 2008 Enterprise (64-bit)"), new ReferenceTypeImpl( "Windows Server 2008 Enterprise (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/15"))); - assertEquals(result.get("Windows Server 2008 Enterprise R2 (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Server 2008 Enterprise R2 (64-bit)"), new ReferenceTypeImpl( "Windows Server 2008 Enterprise R2 (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/16"))); - assertEquals(result.get("Windows Server 2008 Standard (32-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Server 2008 Standard (32-bit)"), new ReferenceTypeImpl( "Windows Server 2008 Standard (32-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/17"))); - assertEquals(result.get("Windows Server 2008 Standard (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Server 2008 Standard (64-bit)"), new ReferenceTypeImpl( "Windows Server 2008 Standard (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/18"))); - assertEquals(result.get("Windows Server 2008 Standard R2 (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Server 2008 Standard R2 (64-bit)"), new ReferenceTypeImpl( "Windows Server 2008 Standard R2 (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/19"))); - assertEquals(result.get("Windows Server 2008 Standard w.SQL 2008 Web (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Server 2008 Standard w.SQL 2008 Web (64-bit)"), new ReferenceTypeImpl( "Windows Server 2008 Standard w.SQL 2008 Web (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/14"))); - assertEquals(result.get("Windows Web Server 2008 (32-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Web Server 2008 (32-bit)"), new ReferenceTypeImpl( "Windows Web Server 2008 (32-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/20"))); - assertEquals(result.get("Windows Web Server 2008 (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Web Server 2008 (64-bit)"), new ReferenceTypeImpl( "Windows Web Server 2008 (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/21"))); - assertEquals(result.get("Windows Web Server 2008 R2 (64-bit)"), new NamedResourceImpl( + assertEquals(result.get("Windows Web Server 2008 R2 (64-bit)"), new ReferenceTypeImpl( "Windows Web Server 2008 R2 (64-bit)", CATALOGITEM_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22"))); } diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java index 757838a8fc..19601526d5 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java @@ -29,7 +29,7 @@ import org.jclouds.http.functions.ParseSax.Factory; import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.internal.CatalogItemImpl; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSortedMap; @@ -52,7 +52,7 @@ public class CatalogItemHandlerTest { assertEquals(result, new CatalogItemImpl("Windows 2008 Datacenter 64 Bit", URI .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"), "Windows 2008 Datacenter 64 Bit", - new NamedResourceImpl("Windows 2008 Datacenter 64 Bit", + new ReferenceTypeImpl("Windows 2008 Datacenter 64 Bit", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")), ImmutableSortedMap.of("Foo", "Bar", "Hello", "World" diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java index 474a31c426..5e41fbd5d2 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java @@ -32,7 +32,7 @@ import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Org; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; @@ -57,18 +57,18 @@ public class OrgHandlerTest { assertEquals(result.getName(), "ExampleOrg"); assertEquals(result.getFullName(), "ExampleOrg"); assertEquals(result.getDescription(), "Example Corp's Primary Organization."); - assertEquals(result.getId(), URI.create("http://vcloud.example.com/api/v1.0/org/5")); - assertEquals(result.getCatalogs(), ImmutableMap.of("Main Catalog", new NamedResourceImpl("Main Catalog", + assertEquals(result.getHref(), URI.create("http://vcloud.example.com/api/v1.0/org/5")); + assertEquals(result.getCatalogs(), ImmutableMap.of("Main Catalog", new ReferenceTypeImpl("Main Catalog", CATALOG_XML, URI.create("http://vcloud.example.com/api/v1.0/catalog/32")), "Shared Catalog", - new NamedResourceImpl("Shared Catalog", CATALOG_XML, URI + new ReferenceTypeImpl("Shared Catalog", CATALOG_XML, URI .create("http://vcloud.example.com/api/v1.0/catalog/37")))); - assertEquals(result.getVDCs(), ImmutableMap.of("ExampleVdc01", new NamedResourceImpl("ExampleVdc01", + assertEquals(result.getVDCs(), ImmutableMap.of("ExampleVdc01", new ReferenceTypeImpl("ExampleVdc01", VCloudMediaType.VDC_XML, URI.create("http://vcloud.example.com/api/v1.0/vdc/5")))); - assertEquals(result.getNetworks(), ImmutableMap.of("TestNetwork", new NamedResourceImpl("TestNetwork", + assertEquals(result.getNetworks(), ImmutableMap.of("TestNetwork", new ReferenceTypeImpl("TestNetwork", VCloudMediaType.NETWORK_XML, URI.create("http://vcloud.example.com/api/v1.0/network/14")), - "ProductionNetwork", new NamedResourceImpl("ProductionNetwork", VCloudMediaType.NETWORK_XML, URI + "ProductionNetwork", new ReferenceTypeImpl("ProductionNetwork", VCloudMediaType.NETWORK_XML, URI .create("http://vcloud.example.com/api/v1.0/network/54")))); - assertEquals(result.getTasksList(), new NamedResourceImpl(null, TASKSLIST_XML, URI + assertEquals(result.getTasksList(), new ReferenceTypeImpl(null, TASKSLIST_XML, URI .create("http://vcloud.example.com/api/v1.0/tasksList/5"))); } @@ -81,14 +81,14 @@ public class OrgHandlerTest { Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is); assertEquals(result.getName(), "adrian@jclouds.org"); assertEquals(result.getFullName(), "adrian@jclouds.org"); - assertEquals(result.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48")); - assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new NamedResourceImpl( + assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48")); + assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new ReferenceTypeImpl( "Miami Environment 1 Catalog", CATALOG_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")))); - assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new NamedResourceImpl( + assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new ReferenceTypeImpl( "Miami Environment 1", VCloudExpressMediaType.VDC_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")))); - assertEquals(result.getTasksList(), new NamedResourceImpl("Miami Environment 1 Tasks List", TASKSLIST_XML, URI + assertEquals(result.getTasksList(), new ReferenceTypeImpl("Miami Environment 1 Tasks List", TASKSLIST_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/32"))); } @@ -99,13 +99,13 @@ public class OrgHandlerTest { Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is); assertEquals(result.getName(), "Customer 188849"); assertEquals(result.getFullName(), "Customer 188849"); - assertEquals(result.getId(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849")); - assertEquals(result.getCatalogs(), ImmutableMap.of("HMS Shared Catalog", new NamedResourceImpl( + assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849")); + assertEquals(result.getCatalogs(), ImmutableMap.of("HMS Shared Catalog", new ReferenceTypeImpl( "HMS Shared Catalog", CATALOG_XML, URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1")))); - assertEquals(result.getVDCs(), ImmutableMap.of("188849 Virtual DataCenter", new NamedResourceImpl( + assertEquals(result.getVDCs(), ImmutableMap.of("188849 Virtual DataCenter", new ReferenceTypeImpl( "188849 Virtual DataCenter", VCloudExpressMediaType.VDC_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849")))); - assertEquals(result.getTasksList(), new NamedResourceImpl("188849 Task List", TASKSLIST_XML, URI + assertEquals(result.getTasksList(), new ReferenceTypeImpl("188849 Task List", TASKSLIST_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"))); } } diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java index fa51ff5798..71e30cd167 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java @@ -27,8 +27,8 @@ import java.util.Map; import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.vcloud.VCloudExpressMediaType; -import org.jclouds.vcloud.domain.NamedResource; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; @@ -44,8 +44,8 @@ public class OrgListHandlerTest extends BaseHandlerTest { public void testApplyInputStream() { InputStream is = getClass().getResourceAsStream("/orglist.xml"); - Map result = factory.create(injector.getInstance(OrgListHandler.class)).parse(is); - assertEquals(result, ImmutableMap.of("adrian@jclouds.org", new NamedResourceImpl("adrian@jclouds.org", + Map result = factory.create(injector.getInstance(OrgListHandler.class)).parse(is); + assertEquals(result, ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org", VCloudExpressMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48")))); } } diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java index 339d538c4e..9bbcd1b22e 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java @@ -28,7 +28,7 @@ import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax.Factory; import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.vcloud.VCloudMediaType; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.domain.network.DhcpService; import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.IpRange; @@ -54,9 +54,9 @@ public class OrgNetworkHandlerTest { Factory factory = injector.getInstance(ParseSax.Factory.class); OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is); assertEquals(result.getName(), "isolation01"); - assertEquals(result.getId(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/990419644")); + assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/990419644")); assertEquals(result.getType(), "application/vnd.vmware.vcloud.network+xml"); - assertEquals(result.getOrg(), new NamedResourceImpl(null, VCloudMediaType.ORG_XML, URI + assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014"))); assertEquals(result.getDescription(), null); assertEquals(result.getTasks(), ImmutableList.of()); @@ -85,9 +85,9 @@ public class OrgNetworkHandlerTest { Factory factory = injector.getInstance(ParseSax.Factory.class); OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is); assertEquals(result.getName(), "internet01"); - assertEquals(result.getId(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/758634723")); + assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/758634723")); assertEquals(result.getType(), "application/vnd.vmware.vcloud.network+xml"); - assertEquals(result.getOrg(), new NamedResourceImpl(null, VCloudMediaType.ORG_XML, URI + assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014"))); assertEquals(result.getDescription(), null); assertEquals(result.getTasks(), ImmutableList.of()); diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java index 3624411572..8229adef1c 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java @@ -29,7 +29,7 @@ import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.TaskStatus; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.domain.internal.TaskImpl; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -59,7 +59,7 @@ public class TaskHandlerTest extends BaseHandlerTest { Task expects = new TaskImpl(URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"), TaskStatus.RUNNING, dateService.iso8601DateParse("2010-08-23T02:09:52.443-04:00"), dateService .iso8601DateParse("9999-12-31T23:59:59.999-05:00"), dateService - .iso8601DateParse("2010-11-21T02:09:52.443-05:00"), new NamedResourceImpl("vApp_acole_2", + .iso8601DateParse("2010-11-21T02:09:52.443-05:00"), new ReferenceTypeImpl("vApp_acole_2", VCloudMediaType.VAPP_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320")) @@ -76,7 +76,7 @@ public class TaskHandlerTest extends BaseHandlerTest { Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is); Task expects = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"), TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"), dateService - .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new NamedResourceImpl("Server1", + .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new ReferenceTypeImpl("Server1", VCloudMediaType.VAPP_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null @@ -106,7 +106,7 @@ public class TaskHandlerTest extends BaseHandlerTest { .iso8601SecondsDateParse("2010-01-14T20:05:02Z"), dateService .iso8601SecondsDateParse("2010-01-15T20:05:02Z"), - new NamedResourceImpl("188849-96", VCloudMediaType.VAPP_XML, URI + new ReferenceTypeImpl("188849-96", VCloudMediaType.VAPP_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96")), null); assertEquals(result, expects); } @@ -118,7 +118,7 @@ public class TaskHandlerTest extends BaseHandlerTest { Task expects = new TaskImpl(URI.create("http://10.150.4.49/api/v0.8/task/23"), TaskStatus.ERROR, dateService .iso8601SecondsDateParse("2009-12-07T19:05:02Z"), dateService - .iso8601SecondsDateParse("2009-12-10T14:40:32Z"), null, new NamedResourceImpl("testapp1", + .iso8601SecondsDateParse("2009-12-10T14:40:32Z"), null, new ReferenceTypeImpl("testapp1", VCloudMediaType.VAPP_XML, URI.create("http://10.150.4.49/api/v0.8/vapp/1")), new TaskImpl.ErrorImpl( "Error processing job", 500, " Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00", null, null)); diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java index 2758efb1b0..306220951f 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java @@ -30,7 +30,7 @@ import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.TaskStatus; import org.jclouds.vcloud.domain.TasksList; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.domain.internal.TaskImpl; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -62,12 +62,12 @@ public class TasksListHandlerTest extends BaseHandlerTest { .create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/1")); Task task1 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3300"), TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:30:19.587Z"), dateService - .iso8601DateParse("2009-08-24T21:30:32.63Z"), null, new NamedResourceImpl("Server1", + .iso8601DateParse("2009-08-24T21:30:32.63Z"), null, new ReferenceTypeImpl("Server1", VCloudExpressMediaType.VAPP_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null); Task task2 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"), TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"), dateService - .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new NamedResourceImpl("Server1", + .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new ReferenceTypeImpl("Server1", VCloudExpressMediaType.VAPP_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null); assertEquals(result.getTasks(), ImmutableSortedSet.of(task1, task2)); diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java index a6d216e0fc..5aca724fed 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java @@ -31,7 +31,7 @@ import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.Vm; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; @@ -52,21 +52,21 @@ public class VAppHandlerTest { Factory factory = injector.getInstance(ParseSax.Factory.class); VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is); assertEquals(result.getName(), "vApp_acole_2"); - assertEquals(result.getId(), URI + assertEquals(result.getHref(), URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320")); assertEquals(result.getType(), "application/vnd.vmware.vcloud.vApp+xml"); assertEquals(result.getStatus(), Status.OFF); - assertEquals(result.getVDC(), new NamedResourceImpl(null, VCloudMediaType.VDC_XML, URI + assertEquals(result.getVDC(), new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"))); assertEquals(result.getDescription(), null); assertEquals(result.getTasks(), ImmutableList.of()); assert result.isOvfDescriptorUploaded(); Vm vm = Iterables.getOnlyElement(result.getChildren()); assertEquals(vm.getName(), "RHEL5"); - assertEquals(vm.getId(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248")); + assertEquals(vm.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248")); assertEquals(vm.getType(), "application/vnd.vmware.vcloud.vm+xml"); assertEquals(vm.getStatus(), Status.OFF); - assertEquals(vm.getParent(), new NamedResourceImpl(null, VCloudMediaType.VAPP_XML, URI + assertEquals(vm.getParent(), new ReferenceTypeImpl(null, VCloudMediaType.VAPP_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"))); assertEquals(vm.getDescription(), null); assertEquals(vm.getTasks(), ImmutableList.of()); diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java index 4118939021..e34b17993c 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java @@ -31,7 +31,7 @@ import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.VAppTemplate; import org.jclouds.vcloud.domain.Vm; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; @@ -52,11 +52,11 @@ public class VAppTemplateHandlerTest { Factory factory = injector.getInstance(ParseSax.Factory.class); VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is); assertEquals(result.getName(), "Ubuntu Template"); - assertEquals(result.getId(), URI + assertEquals(result.getHref(), URI .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921")); assertEquals(result.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml"); assertEquals(result.getStatus(), Status.OFF); - assertEquals(result.getVDC(), new NamedResourceImpl(null, VCloudMediaType.VDC_XML, URI + assertEquals(result.getVDC(), new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"))); assertEquals(result.getDescription(), null); assertEquals(result.getTasks(), ImmutableList.of()); @@ -64,11 +64,11 @@ public class VAppTemplateHandlerTest { assert result.isOvfDescriptorUploaded(); Vm vm = Iterables.getOnlyElement(result.getChildren()); assertEquals(vm.getName(), "Ubuntu1004"); - assertEquals(vm.getId(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194")); + assertEquals(vm.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194")); // NOTE this is vAppTemplate not VM! assertEquals(vm.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml"); assertEquals(vm.getStatus(), null); - assertEquals(vm.getParent(), new NamedResourceImpl(null, VCloudMediaType.VAPPTEMPLATE_XML, URI + assertEquals(vm.getParent(), new ReferenceTypeImpl(null, VCloudMediaType.VAPPTEMPLATE_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921"))); assertEquals(vm.getDescription(), null); assertEquals(vm.getTasks(), ImmutableList.of()); diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VCloudExpressVAppHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VCloudExpressVAppHandlerTest.java index 8d3daa837f..390d48181e 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VCloudExpressVAppHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VCloudExpressVAppHandlerTest.java @@ -36,7 +36,7 @@ import org.jclouds.vcloud.domain.ResourceType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.VirtualSystem; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.domain.internal.VCloudExpressVAppImpl; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -78,7 +78,7 @@ public class VCloudExpressVAppHandlerTest extends BaseHandlerTest { VCloudExpressVApp result = factory.create(injector.getInstance(VCloudExpressVAppHandler.class)).parse(is); VCloudExpressVApp expects = new VCloudExpressVAppImpl("centos53", URI - .create("http://10.150.4.49/api/v0.8/vApp/10"), Status.RESOLVED, 123456789l, new NamedResourceImpl(null, + .create("http://10.150.4.49/api/v0.8/vApp/10"), Status.RESOLVED, 123456789l, new ReferenceTypeImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI.create("http://10.150.4.49/api/v0.8/vdc/4")), ImmutableListMultimap. of(), null, null, null, ImmutableSet. of()); assertEquals(result, expects); @@ -106,10 +106,10 @@ public class VCloudExpressVAppHandlerTest extends BaseHandlerTest { null, 104857, "byte * 2^20")).build(); VCloudExpressVApp expects = new VCloudExpressVAppImpl("centos53", URI - .create("http://10.150.4.49/api/v0.8/vApp/10"), Status.ON, new Long(104857), new NamedResourceImpl(null, + .create("http://10.150.4.49/api/v0.8/vApp/10"), Status.ON, new Long(104857), new ReferenceTypeImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI.create("http://10.150.4.49/api/v0.8/vdc/4")), networkToAddresses, null, "Other Linux (32-bit)", system, resourceAllocations); - assertEquals(result.getId(), expects.getId()); + assertEquals(result.getHref(), expects.getHref()); assertEquals(result.getName(), expects.getName()); assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses()); assertEquals(result.getOperatingSystemDescription(), expects.getOperatingSystemDescription()); @@ -143,10 +143,10 @@ public class VCloudExpressVAppHandlerTest extends BaseHandlerTest { null, 10485760, "byte * 2^20")).build(); VCloudExpressVApp expects = new VCloudExpressVAppImpl("m1", URI.create("http://localhost:8000/api/v0.8/vApp/80"), - Status.ON, new Long(10485760), new NamedResourceImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI + Status.ON, new Long(10485760), new ReferenceTypeImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI .create("http://localhost:8000/api/v0.8/vdc/28")), networkToAddresses, null, "Microsoft Windows XP Professional (32-bit)", system, resourceAllocations); - assertEquals(result.getId(), expects.getId()); + assertEquals(result.getHref(), expects.getHref()); assertEquals(result.getName(), expects.getName()); assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses()); assertEquals(result.getOperatingSystemDescription(), expects.getOperatingSystemDescription()); diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java index 1646c97631..97fdad721f 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java @@ -31,10 +31,10 @@ import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.AllocationModel; import org.jclouds.vcloud.domain.Capacity; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.VDCStatus; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; @@ -55,10 +55,10 @@ public class VDCHandlerTest { Factory factory = injector.getInstance(ParseSax.Factory.class); VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is); assertEquals(result.getName(), "Jclouds-Commit-compG1xstorA01"); - assertEquals(result.getId(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")); + assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")); assertEquals(result.getType(), "application/vnd.vmware.vcloud.vdc+xml"); assertEquals(result.getStatus(), VDCStatus.READY); - assertEquals(result.getOrg(), new NamedResourceImpl(null, VCloudMediaType.ORG_XML, URI + assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014"))); assertEquals(result.getDescription(), null); assertEquals(result.getTasks(), ImmutableList.of()); @@ -66,11 +66,11 @@ public class VDCHandlerTest { assertEquals(result.getStorageCapacity(), new Capacity("MB", 1024000, 1024000, 0, 0)); assertEquals(result.getCpuCapacity(), new Capacity("MHz", 20000, 20000, 0, 0)); assertEquals(result.getMemoryCapacity(), new Capacity("MB", 30720, 30720, 0, 0)); - assertEquals(result.getResourceEntities(), ImmutableMap. of()); - assertEquals(result.getAvailableNetworks(), ImmutableMap.of("isolation01", new NamedResourceImpl("isolation01", + assertEquals(result.getResourceEntities(), ImmutableMap. of()); + assertEquals(result.getAvailableNetworks(), ImmutableMap.of("isolation01", new ReferenceTypeImpl("isolation01", "application/vnd.vmware.vcloud.network+xml", URI .create("https://vcenterprise.bluelock.com/api/v1.0/network/990419644")), "internet01", - new NamedResourceImpl("internet01", "application/vnd.vmware.vcloud.network+xml", URI + new ReferenceTypeImpl("internet01", "application/vnd.vmware.vcloud.network+xml", URI .create("https://vcenterprise.bluelock.com/api/v1.0/network/758634723")))); assertEquals(result.getNicQuota(), 0); assertEquals(result.getNetworkQuota(), 100); @@ -84,18 +84,18 @@ public class VDCHandlerTest { Factory factory = injector.getInstance(ParseSax.Factory.class); VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is); assertEquals(result.getName(), "Miami Environment 1"); - assertEquals(result.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")); + assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")); assertEquals(result.getDescription(), null); assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 100, 0, 8, 0)); assertEquals(result.getCpuCapacity(), new Capacity("hz * 10^6", 5000, 0, 0, 0)); assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 2^20", 10240, 0, 0, 0)); assertEquals(result.getVmQuota(), 0); - assertEquals(result.getResourceEntities(), ImmutableMap. of("adriantest", - new NamedResourceImpl("adriantest", VCloudExpressMediaType.VAPP_XML, URI + assertEquals(result.getResourceEntities(), ImmutableMap. of("adriantest", + new ReferenceTypeImpl("adriantest", VCloudExpressMediaType.VAPP_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124")), "centos-53", - new NamedResourceImpl("centos-53", VCloudExpressMediaType.VAPP_XML, URI + new ReferenceTypeImpl("centos-53", VCloudExpressMediaType.VAPP_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15120")))); - assertEquals(result.getAvailableNetworks(), ImmutableMap.of("10.114.34.128/26", new NamedResourceImpl( + assertEquals(result.getAvailableNetworks(), ImmutableMap.of("10.114.34.128/26", new ReferenceTypeImpl( "10.114.34.128/26", "application/vnd.vmware.vcloud.network+xml", URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708")))); } @@ -106,35 +106,35 @@ public class VDCHandlerTest { Factory factory = injector.getInstance(ParseSax.Factory.class); VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is); assertEquals(result.getName(), "vDC Name"); - assertEquals(result.getId(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849")); + assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849")); assertEquals(result.getDescription(), "vDC Name"); assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 0, 0, 40960, 0)); assertEquals(result.getCpuCapacity(), new Capacity("hz * 10^6", 0, 0, 2400, 0)); assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 10^9", 0, 0, 2, 0)); assertEquals(result.getVmQuota(), 0); - assertEquals(result.getResourceEntities(), new ImmutableMap.Builder().put( + assertEquals(result.getResourceEntities(), new ImmutableMap.Builder().put( "Plesk (Linux) 64-bit Template", - new NamedResourceImpl("Plesk (Linux) 64-bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml", + new ReferenceTypeImpl("Plesk (Linux) 64-bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1"))).put( "Windows 2008 Datacenter 64 Bit Template", - new NamedResourceImpl("Windows 2008 Datacenter 64 Bit Template", + new ReferenceTypeImpl("Windows 2008 Datacenter 64 Bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"))).put( "Cent OS 64 Bit Template", - new NamedResourceImpl("Cent OS 64 Bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI + new ReferenceTypeImpl("Cent OS 64 Bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"))).put( "cPanel (Linux) 64 Bit Template", - new NamedResourceImpl("cPanel (Linux) 64 Bit Template", + new ReferenceTypeImpl("cPanel (Linux) 64 Bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"))).put( "188849-1", - new NamedResourceImpl("188849-1", "application/vnd.vmware.vcloud.vApp+xml", URI + new ReferenceTypeImpl("188849-1", "application/vnd.vmware.vcloud.vApp+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1"))).put( "188849-2", - new NamedResourceImpl("188849-2", "application/vnd.vmware.vcloud.vApp+xml", URI + new ReferenceTypeImpl("188849-2", "application/vnd.vmware.vcloud.vApp+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-2"))).build()); - assertEquals(result.getAvailableNetworks(), ImmutableMap. of()); + assertEquals(result.getAvailableNetworks(), ImmutableMap. of()); } } diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java index 58a27d26bf..8198adfab3 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java @@ -30,7 +30,7 @@ import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Vm; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; @@ -50,11 +50,11 @@ public class VmHandlerTest { Factory factory = injector.getInstance(ParseSax.Factory.class); Vm result = factory.create(injector.getInstance(VmHandler.class)).parse(is); assertEquals(result.getName(), "RHEL5"); - assertEquals(result.getId(), URI + assertEquals(result.getHref(), URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248")); assertEquals(result.getType(), "application/vnd.vmware.vcloud.vm+xml"); assertEquals(result.getStatus(), Status.OFF); - assertEquals(result.getParent(), new NamedResourceImpl(null, VCloudMediaType.VAPP_XML, URI + assertEquals(result.getParent(), new ReferenceTypeImpl(null, VCloudMediaType.VAPP_XML, URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"))); assertEquals(result.getDescription(), null); assertEquals(result.getTasks(), ImmutableList.of()); diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/binders/BindVAppConfigurationToXmlPayload.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/binders/BindVAppConfigurationToXmlPayload.java index e4a60a76d6..6cebcf6d99 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/binders/BindVAppConfigurationToXmlPayload.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/binders/BindVAppConfigurationToXmlPayload.java @@ -210,6 +210,6 @@ public class BindVAppConfigurationToXmlPayload implements MapBinder, Function> creating InternetService in vDC %s:%s:%d", vApp.getVDC().getName(), protocol, port); - ip = TerremarkECloudClient.class.cast(client).activatePublicIpInVDC(vApp.getVDC().getId()); + ip = TerremarkECloudClient.class.cast(client).activatePublicIpInVDC(vApp.getVDC().getHref()); is = client.addInternetServiceToExistingIp(ip.getId(), vApp.getName() + "-" + port, protocol, port, withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(), vApp.getName()))); @@ -170,7 +170,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl private Set deleteInternetServicesAndNodesAssociatedWithVApp(VCloudExpressVApp vApp) { Set ipAddresses = Sets.newHashSet(); - SERVICE: for (InternetService service : client.getAllInternetServicesInVDC(vApp.getVDC().getId())) { + SERVICE: for (InternetService service : client.getAllInternetServicesInVDC(vApp.getVDC().getHref())) { for (Node node : client.getNodes(service.getId())) { if (vApp.getNetworkToAddresses().containsValue(node.getIpAddress())) { ipAddresses.add(service.getPublicIpAddress()); @@ -232,8 +232,8 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl private void powerOffAndWait(VCloudExpressVApp vApp) { logger.debug(">> powering off vApp(%s), current status: %s", vApp.getName(), vApp.getStatus()); - Task task = client.powerOffVApp(vApp.getId()); - if (!taskTester.apply(task.getId())) + Task task = client.powerOffVApp(vApp.getHref()); + if (!taskTester.apply(task.getHref())) throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), task)); } @@ -248,7 +248,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl } })); - if (!taskTester.apply(lastTask.getId())) + if (!taskTester.apply(lastTask.getHref())) throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), lastTask)); } catch (NoSuchElementException ex) { @@ -275,7 +275,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl VCloudExpressVApp vApp = client.getVApp(id); if (vApp != null) { Set ipAddresses = Sets.newHashSet(); - for (InternetService service : client.getAllInternetServicesInVDC(vApp.getVDC().getId())) { + for (InternetService service : client.getAllInternetServicesInVDC(vApp.getVDC().getHref())) { for (Node node : client.getNodes(service.getId())) { if (vApp.getNetworkToAddresses().containsValue(node.getIpAddress())) { ipAddresses.add(service.getPublicIpAddress().getAddress()); diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/functions/NodeMetadataToOrgAndName.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/functions/NodeMetadataToOrgAndName.java index 9fae544875..cf61611705 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/functions/NodeMetadataToOrgAndName.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/functions/NodeMetadataToOrgAndName.java @@ -66,7 +66,7 @@ public class NodeMetadataToOrgAndName implements Function> { + public static class OrgNameToKeysListSupplier implements Supplier> { protected final Supplier sessionSupplier; private final TerremarkVCloudExpressClient client; @@ -97,11 +97,11 @@ public class TerremarkVCloudExpressRestClientModule extends } @Override - public Map get() { - return Maps.transformValues(sessionSupplier.get().getOrgs(), new Function() { + public Map get() { + return Maps.transformValues(sessionSupplier.get().getOrgs(), new Function() { @Override - public NamedResource apply(NamedResource from) { + public ReferenceType apply(ReferenceType from) { return client.findOrgNamed(from.getName()).getKeysList(); } @@ -113,12 +113,12 @@ public class TerremarkVCloudExpressRestClientModule extends @Provides @Singleton @KeysList - protected Supplier> provideOrgToKeysListCache( + protected Supplier> provideOrgToKeysListCache( @Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgNameToKeysListSupplier supplier) { - return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier>(authException, - seconds, new Supplier>() { + return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier>(authException, + seconds, new Supplier>() { @Override - public Map get() { + public Map get() { return supplier.get(); } diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkCatalogItem.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkCatalogItem.java index 4ef4b8c0fd..64b345cb0d 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkCatalogItem.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkCatalogItem.java @@ -20,7 +20,7 @@ package org.jclouds.vcloud.terremark.domain; import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.terremark.domain.internal.TerremarkCatalogItemImpl; import com.google.inject.ImplementedBy; @@ -31,8 +31,8 @@ import com.google.inject.ImplementedBy; @ImplementedBy(TerremarkCatalogItemImpl.class) public interface TerremarkCatalogItem extends CatalogItem { - NamedResource getComputeOptions(); + ReferenceType getComputeOptions(); - NamedResource getCustomizationOptions(); + ReferenceType getCustomizationOptions(); } \ No newline at end of file diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkOrg.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkOrg.java index cb4f49d1e5..2f6ca0c428 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkOrg.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkOrg.java @@ -19,7 +19,7 @@ package org.jclouds.vcloud.terremark.domain; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.terremark.domain.internal.TerremarkOrgImpl; import org.jclouds.vcloud.terremark.endpoints.KeysList; @@ -34,6 +34,6 @@ import com.google.inject.ImplementedBy; public interface TerremarkOrg extends Org { @KeysList - NamedResource getKeysList(); + ReferenceType getKeysList(); } \ No newline at end of file diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkVDC.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkVDC.java index 7fe34a8b30..d588672605 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkVDC.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/TerremarkVDC.java @@ -19,7 +19,7 @@ package org.jclouds.vcloud.terremark.domain; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.endpoints.Catalog; import org.jclouds.vcloud.terremark.domain.internal.TerremarkVDCImpl; @@ -36,13 +36,13 @@ import com.google.inject.ImplementedBy; public interface TerremarkVDC extends VDC { @Catalog - NamedResource getCatalog(); + ReferenceType getCatalog(); @PublicIPs - NamedResource getPublicIps(); + ReferenceType getPublicIps(); @InternetServices - NamedResource getInternetServices(); + ReferenceType getInternetServices(); // TODO getDescription() // what is the type? } \ No newline at end of file diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkCatalogItemImpl.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkCatalogItemImpl.java index 0341a3b119..deb5ded0c1 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkCatalogItemImpl.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkCatalogItemImpl.java @@ -22,7 +22,7 @@ package org.jclouds.vcloud.terremark.domain.internal; import java.net.URI; import java.util.Map; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.internal.CatalogItemImpl; import org.jclouds.vcloud.terremark.domain.TerremarkCatalogItem; @@ -33,23 +33,23 @@ import org.jclouds.vcloud.terremark.domain.TerremarkCatalogItem; */ public class TerremarkCatalogItemImpl extends CatalogItemImpl implements TerremarkCatalogItem { - private final NamedResource computeOptions; - private final NamedResource customizationOptions; + private final ReferenceType computeOptions; + private final ReferenceType customizationOptions; - public TerremarkCatalogItemImpl(String name, URI id, String description, NamedResource computeOptions, - NamedResource customizationOptions, NamedResource entity, Map properties) { + public TerremarkCatalogItemImpl(String name, URI id, String description, ReferenceType computeOptions, + ReferenceType customizationOptions, ReferenceType entity, Map properties) { super(name, id, description, entity, properties); this.computeOptions = computeOptions; this.customizationOptions = customizationOptions; } @Override - public NamedResource getComputeOptions() { + public ReferenceType getComputeOptions() { return computeOptions; } @Override - public NamedResource getCustomizationOptions() { + public ReferenceType getCustomizationOptions() { return customizationOptions; } diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkOrgImpl.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkOrgImpl.java index e880fd33bc..2cf49ffea5 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkOrgImpl.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkOrgImpl.java @@ -24,7 +24,7 @@ import java.util.Map; import javax.annotation.Nullable; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.internal.OrgImpl; import org.jclouds.vcloud.terremark.domain.TerremarkOrg; @@ -39,17 +39,17 @@ import com.google.common.collect.ImmutableList; */ public class TerremarkOrgImpl extends OrgImpl implements TerremarkOrg { - private final NamedResource keysList; + private final ReferenceType keysList; - public TerremarkOrgImpl(String name, String type, URI id, String description, Map catalogs, - Map vdcs, Map networks, @Nullable NamedResource tasksList, - NamedResource keysList) { + public TerremarkOrgImpl(String name, String type, URI id, String description, Map catalogs, + Map vdcs, Map networks, @Nullable ReferenceType tasksList, + ReferenceType keysList) { super(name, type, id, name, description, catalogs, vdcs, networks, tasksList, ImmutableList. of()); this.keysList = keysList; } @Override - public NamedResource getKeysList() { + public ReferenceType getKeysList() { return keysList; } diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkVDCImpl.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkVDCImpl.java index 893548934f..366dc74411 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkVDCImpl.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/domain/internal/TerremarkVDCImpl.java @@ -28,7 +28,7 @@ import javax.annotation.Nullable; import org.jclouds.vcloud.domain.AllocationModel; import org.jclouds.vcloud.domain.Capacity; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VDCStatus; import org.jclouds.vcloud.domain.internal.VDCImpl; @@ -42,19 +42,19 @@ import org.jclouds.vcloud.terremark.domain.TerremarkVDC; */ public class TerremarkVDCImpl extends VDCImpl implements TerremarkVDC { - private final NamedResource catalog; - private final NamedResource publicIps; - private final NamedResource internetServices; + private final ReferenceType catalog; + private final ReferenceType publicIps; + private final ReferenceType internetServices; /** The serialVersionUID */ private static final long serialVersionUID = 8464716396538298809L; - public TerremarkVDCImpl(String name, String type, URI id, VDCStatus status, NamedResource org, + public TerremarkVDCImpl(String name, String type, URI id, VDCStatus status, ReferenceType org, @Nullable String description, Iterable tasks, AllocationModel allocationModel, @Nullable Capacity storageCapacity, @Nullable Capacity cpuCapacity, @Nullable Capacity memoryCapacity, - Map resourceEntities, Map availableNetworks, int nicQuota, - int networkQuota, int vmQuota, boolean isEnabled, NamedResource catalog, NamedResource publicIps, - NamedResource internetServices) { + Map resourceEntities, Map availableNetworks, int nicQuota, + int networkQuota, int vmQuota, boolean isEnabled, ReferenceType catalog, ReferenceType publicIps, + ReferenceType internetServices) { super(name, type, id, status, org, description, tasks, allocationModel, storageCapacity, cpuCapacity, memoryCapacity, resourceEntities, availableNetworks, nicQuota, networkQuota, vmQuota, isEnabled); this.catalog = checkNotNull(catalog, "catalog"); @@ -62,15 +62,15 @@ public class TerremarkVDCImpl extends VDCImpl implements TerremarkVDC { this.internetServices = checkNotNull(internetServices, "internetServices"); } - public NamedResource getCatalog() { + public ReferenceType getCatalog() { return catalog; } - public NamedResource getPublicIps() { + public ReferenceType getPublicIps() { return publicIps; } - public NamedResource getInternetServices() { + public ReferenceType getInternetServices() { return internetServices; } diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/OrgURIToKeysListEndpoint.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/OrgURIToKeysListEndpoint.java index a8607667c6..10352110ea 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/OrgURIToKeysListEndpoint.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/OrgURIToKeysListEndpoint.java @@ -54,12 +54,12 @@ public class OrgURIToKeysListEndpoint implements Function { @Override public URI apply(Org from) { - return from.getId(); + return from.getHref(); } }); try { - return TerremarkOrg.class.cast(uriToOrg.get(from == null ? defaultOrg : from)).getKeysList().getId(); + return TerremarkOrg.class.cast(uriToOrg.get(from == null ? defaultOrg : from)).getKeysList().getHref(); } catch (NullPointerException e) { throw new ResourceNotFoundException("org " + from + " not found in " + uriToOrg); } diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/VDCURIToInternetServicesEndpoint.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/VDCURIToInternetServicesEndpoint.java index 14ceffb310..566632d3fb 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/VDCURIToInternetServicesEndpoint.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/VDCURIToInternetServicesEndpoint.java @@ -51,7 +51,7 @@ public class VDCURIToInternetServicesEndpoint implements Function { public URI apply(Object from) { try { return TerremarkVDC.class.cast(orgVDCMap.get().get(from == null ? defaultVDC : from)).getInternetServices() - .getId(); + .getHref(); } catch (NullPointerException e) { throw new ResourceNotFoundException("vdc " + from + " not found in " + orgVDCMap.get()); } diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/VDCURIToPublicIPsEndpoint.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/VDCURIToPublicIPsEndpoint.java index 503e4508f3..88713cd5ad 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/VDCURIToPublicIPsEndpoint.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/functions/VDCURIToPublicIPsEndpoint.java @@ -50,7 +50,7 @@ public class VDCURIToPublicIPsEndpoint implements Function { public URI apply(Object from) { try { - return TerremarkVDC.class.cast(orgVDCMap.get().get(from == null ? defaultVDC : from)).getPublicIps().getId(); + return TerremarkVDC.class.cast(orgVDCMap.get().get(from == null ? defaultVDC : from)).getPublicIps().getHref(); } catch (NullPointerException e) { throw new ResourceNotFoundException("vdc " + from + " not found in " + orgVDCMap.get()); } diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkCatalogItemHandler.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkCatalogItemHandler.java index 593b2bf541..b32ddf6722 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkCatalogItemHandler.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkCatalogItemHandler.java @@ -21,7 +21,7 @@ package org.jclouds.vcloud.terremark.xml; import static org.jclouds.vcloud.util.Utils.newNamedResource; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.terremark.domain.TerremarkCatalogItem; import org.jclouds.vcloud.terremark.domain.internal.TerremarkCatalogItemImpl; import org.jclouds.vcloud.xml.CatalogItemHandler; @@ -33,11 +33,11 @@ import org.xml.sax.SAXException; */ public class TerremarkCatalogItemHandler extends CatalogItemHandler { - private NamedResource customizationOptions; - private NamedResource computeOptions; + private ReferenceType customizationOptions; + private ReferenceType computeOptions; public TerremarkCatalogItem getResult() { - return new TerremarkCatalogItemImpl(catalogItem.getName(), catalogItem.getId(), description, + return new TerremarkCatalogItemImpl(catalogItem.getName(), catalogItem.getHref(), description, computeOptions, customizationOptions, entity, properties); } diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkOrgHandler.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkOrgHandler.java index 6916f5db02..392c0438d1 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkOrgHandler.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkOrgHandler.java @@ -24,7 +24,7 @@ import static org.jclouds.vcloud.util.Utils.newNamedResource; import javax.inject.Inject; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.terremark.domain.TerremarkOrg; import org.jclouds.vcloud.terremark.domain.internal.TerremarkOrgImpl; import org.jclouds.vcloud.xml.OrgHandler; @@ -41,10 +41,10 @@ public class TerremarkOrgHandler extends OrgHandler { super(taskHandler); } - private NamedResource keysList; + private ReferenceType keysList; public TerremarkOrg getResult() { - return new TerremarkOrgImpl(org.getName(), org.getType(), org.getId(), description, catalogs, vdcs, networks, + return new TerremarkOrgImpl(org.getName(), org.getType(), org.getHref(), description, catalogs, vdcs, networks, tasksList, keysList); } diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkVDCHandler.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkVDCHandler.java index 1da3d42d76..06b7626605 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkVDCHandler.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/xml/TerremarkVDCHandler.java @@ -22,7 +22,7 @@ package org.jclouds.vcloud.terremark.xml; import javax.inject.Inject; import org.jclouds.vcloud.VCloudExpressMediaType; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.terremark.domain.TerremarkVDC; import org.jclouds.vcloud.terremark.domain.internal.TerremarkVDCImpl; @@ -42,13 +42,13 @@ public class TerremarkVDCHandler extends VDCHandler { super(taskHandler); } - private NamedResource catalog; - private NamedResource publicIps; - private NamedResource internetServices; + private ReferenceType catalog; + private ReferenceType publicIps; + private ReferenceType internetServices; public TerremarkVDC getResult() { VDC vDC = super.getResult(); - return new TerremarkVDCImpl(vDC.getName(), vDC.getType(), vDC.getId(), status, org, description, tasks, + return new TerremarkVDCImpl(vDC.getName(), vDC.getType(), vDC.getHref(), status, org, description, tasks, allocationModel, storageCapacity, cpuCapacity, memoryCapacity, resourceEntities, availableNetworks, nicQuota, networkQuota, vmQuota, isEnabled, catalog, publicIps, internetServices); } diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/InternetServiceLiveTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/InternetServiceLiveTest.java index c458e154c9..d45dc3d590 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/InternetServiceLiveTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/InternetServiceLiveTest.java @@ -58,7 +58,7 @@ public class InternetServiceLiveTest { @Test public void testGetAllInternetServices() throws Exception { - tmClient.getAllInternetServicesInVDC(tmClient.findVDCInOrgNamed(null, null).getId()); + tmClient.getAllInternetServicesInVDC(tmClient.findVDCInOrgNamed(null, null).getHref()); } private void delete(Set set) { @@ -77,7 +77,7 @@ public class InternetServiceLiveTest { @Test public void testGetAllPublicIps() throws Exception { - for (PublicIpAddress ip : tmClient.getPublicIpsAssociatedWithVDC(tmClient.findVDCInOrgNamed(null, null).getId())) { + for (PublicIpAddress ip : tmClient.getPublicIpsAssociatedWithVDC(tmClient.findVDCInOrgNamed(null, null).getHref())) { tmClient.getInternetServicesOnPublicIp(ip.getId()); } } diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkClientLiveTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkClientLiveTest.java index 7467621d9f..07c986fc8a 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkClientLiveTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkClientLiveTest.java @@ -50,7 +50,7 @@ import org.jclouds.ssh.jsch.config.JschSshClientModule; import org.jclouds.vcloud.VCloudExpressClientLiveTest; import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.domain.Catalog; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.ResourceAllocation; import org.jclouds.vcloud.domain.ResourceType; import org.jclouds.vcloud.domain.Status; @@ -107,14 +107,14 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes @Test public void testGetAllInternetServices() throws Exception { for (InternetService service : tmClient.getAllInternetServicesInVDC(tmClient.findVDCInOrgNamed(null, null) - .getId())) { + .getHref())) { assertNotNull(tmClient.getNodes(service.getId())); } } @Test public void testGetPublicIpsAssociatedWithVDC() throws Exception { - for (PublicIpAddress ip : tmClient.getPublicIpsAssociatedWithVDC(tmClient.findVDCInOrgNamed(null, null).getId())) { + for (PublicIpAddress ip : tmClient.getPublicIpsAssociatedWithVDC(tmClient.findVDCInOrgNamed(null, null).getHref())) { assertNotNull(tmClient.getInternetServicesOnPublicIp(ip.getId())); assertNotNull(tmClient.getPublicIp(ip.getId())); } @@ -123,10 +123,10 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes @Test public void testGetConfigCustomizationOptions() throws Exception { Catalog response = connection.findCatalogInOrgNamed(null, null); - for (NamedResource resource : response.values()) { + for (ReferenceType resource : response.values()) { if (resource.getType().equals(VCloudExpressMediaType.CATALOGITEM_XML)) { TerremarkCatalogItem item = tmClient.findCatalogItemInOrgCatalogNamed(null, null, resource.getName()); - assert tmClient.getCustomizationOptions(item.getCustomizationOptions().getId()) != null; + assert tmClient.getCustomizationOptions(item.getCustomizationOptions().getHref()) != null; } } } @@ -167,53 +167,53 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes // if this template supports setting the root password, let's add it to // our options CustomizationParameters customizationOptions = tmClient.getCustomizationOptions(item.getCustomizationOptions() - .getId()); + .getHref()); if (customizationOptions.canCustomizePassword()) instantiateOptions.withPassword("robotsarefun"); - VCloudExpressVAppTemplate vAppTemplate = tmClient.getVAppTemplate(item.getEntity().getId()); + VCloudExpressVAppTemplate vAppTemplate = tmClient.getVAppTemplate(item.getEntity().getHref()); // instantiate, noting vApp returned has minimal details - vApp = tmClient.instantiateVAppTemplateInVDC(vdc.getId(), vAppTemplate.getId(), serverName, instantiateOptions); + vApp = tmClient.instantiateVAppTemplateInVDC(vdc.getHref(), vAppTemplate.getHref(), serverName, instantiateOptions); assertEquals(vApp.getStatus(), Status.RESOLVED); // in terremark, this should be a no-op, as it should simply return the // above task, which is // already deploying - Task deployTask = tmClient.deployVApp(vApp.getId()); + Task deployTask = tmClient.deployVApp(vApp.getHref()); // check to see the result of calling deploy twice - deployTask = tmClient.deployVApp(vApp.getId()); - assertEquals(deployTask.getId(), deployTask.getId()); + deployTask = tmClient.deployVApp(vApp.getHref()); + assertEquals(deployTask.getHref(), deployTask.getHref()); - vApp = tmClient.getVApp(vApp.getId()); + vApp = tmClient.getVApp(vApp.getHref()); assertEquals(vApp.getStatus(), Status.RESOLVED); try {// per docs, this is not supported - tmClient.cancelTask(deployTask.getId()); + tmClient.cancelTask(deployTask.getHref()); } catch (HttpResponseException e) { assertEquals(e.getResponse().getStatusCode(), 501); } - assert successTester.apply(deployTask.getId()); + assert successTester.apply(deployTask.getHref()); System.out.printf("%d: done deploying vApp%n", System.currentTimeMillis()); - vApp = tmClient.getVApp(vApp.getId()); + vApp = tmClient.getVApp(vApp.getHref()); - NamedResource vAppResource = tmClient.findVDCInOrgNamed(null, null).getResourceEntities().get(serverName); - assertEquals(vAppResource.getId(), vApp.getId()); + ReferenceType vAppResource = tmClient.findVDCInOrgNamed(null, null).getResourceEntities().get(serverName); + assertEquals(vAppResource.getHref(), vApp.getHref()); int processorCount = 1; long memory = 512; verifyConfigurationOfVApp(vApp, serverName, expectedOs, processorCount, memory, hardDisk); assertEquals(vApp.getStatus(), Status.OFF); - assert successTester.apply(tmClient.powerOnVApp(vApp.getId()).getId()); + assert successTester.apply(tmClient.powerOnVApp(vApp.getHref()).getHref()); System.out.printf("%d: done powering on vApp%n", System.currentTimeMillis()); - vApp = tmClient.getVApp(vApp.getId()); + vApp = tmClient.getVApp(vApp.getHref()); assertEquals(vApp.getStatus(), Status.ON); } @@ -228,11 +228,11 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes PublicIpAddress ip; if (tmClient instanceof TerremarkVCloudExpressClient) { is = TerremarkVCloudExpressClient.class.cast(tmClient).addInternetServiceToVDC( - tmClient.findVDCInOrgNamed(null, null).getId(), "SSH", Protocol.TCP, 22); + tmClient.findVDCInOrgNamed(null, null).getHref(), "SSH", Protocol.TCP, 22); ip = is.getPublicIpAddress(); } else { ip = TerremarkECloudClient.class.cast(tmClient).activatePublicIpInVDC( - tmClient.findVDCInOrgNamed(null, null).getId()); + tmClient.findVDCInOrgNamed(null, null).getHref()); is = tmClient.addInternetServiceToExistingIp(ip.getId(), "SSH", Protocol.TCP, 22); } publicIp = ip.getAddress(); @@ -240,7 +240,7 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes @Test(enabled = true, dependsOnMethods = "testInstantiateAndPowerOn") public void testCloneVApp() throws IOException { - assert successTester.apply(tmClient.powerOffVApp(vApp.getId()).getId()); + assert successTester.apply(tmClient.powerOffVApp(vApp.getHref()).getHref()); System.out.printf("%d: done powering off vApp%n", System.currentTimeMillis()); StringBuffer name = new StringBuffer(); @@ -251,19 +251,19 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes CloneVAppOptions options = deploy().powerOn().withDescription("The description of " + newName); System.out.printf("%d: cloning vApp%n", System.currentTimeMillis()); - Task task = tmClient.cloneVAppInVDC(vdc.getId(), vApp.getId(), newName, options); + Task task = tmClient.cloneVAppInVDC(vdc.getHref(), vApp.getHref(), newName, options); // wait for the task to complete - assert successTester.apply(task.getId()); + assert successTester.apply(task.getHref()); System.out.printf("%d: done cloning vApp%n", System.currentTimeMillis()); - assert successTester.apply(tmClient.powerOnVApp(vApp.getId()).getId()); + assert successTester.apply(tmClient.powerOnVApp(vApp.getHref()).getHref()); System.out.printf("%d: done powering on vApp%n", System.currentTimeMillis()); // refresh task to get the new vApp location - task = tmClient.getTask(task.getId()); + task = tmClient.getTask(task.getHref()); - clone = tmClient.getVApp(task.getOwner().getId()); + clone = tmClient.getVApp(task.getOwner().getHref()); assertEquals(clone.getStatus(), Status.ON); assertEquals(clone.getName(), newName); @@ -301,20 +301,20 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes public void testLifeCycle() throws InterruptedException, ExecutionException, TimeoutException, IOException { try {// per docs, this is not supported - tmClient.undeployVApp(vApp.getId()); + tmClient.undeployVApp(vApp.getHref()); } catch (HttpResponseException e) { assertEquals(e.getResponse().getStatusCode(), 501); } try {// per docs, this is not supported - tmClient.suspendVApp(vApp.getId()); + tmClient.suspendVApp(vApp.getHref()); } catch (HttpResponseException e) { assertEquals(e.getResponse().getStatusCode(), 501); } - assert successTester.apply(tmClient.resetVApp(vApp.getId()).getId()); + assert successTester.apply(tmClient.resetVApp(vApp.getHref()).getHref()); - vApp = tmClient.getVApp(vApp.getId()); + vApp = tmClient.getVApp(vApp.getHref()); assertEquals(vApp.getStatus(), Status.ON); @@ -324,33 +324,33 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes // vApp = tmClient.getVApp(vApp.getId()); // assertEquals(vApp.getStatus(), VAppStatus.ON); - assert successTester.apply(tmClient.powerOffVApp(vApp.getId()).getId()); + assert successTester.apply(tmClient.powerOffVApp(vApp.getHref()).getHref()); - vApp = tmClient.getVApp(vApp.getId()); + vApp = tmClient.getVApp(vApp.getHref()); assertEquals(vApp.getStatus(), Status.OFF); } @Test(enabled = true, dependsOnMethods = "testLifeCycle") public void testConfigure() throws InterruptedException, ExecutionException, TimeoutException, IOException { - vApp = tmClient.getVApp(vApp.getId()); + vApp = tmClient.getVApp(vApp.getHref()); Task task = tmClient.configureVApp(vApp, changeNameTo("eduardo").changeMemoryTo(1536).changeProcessorCountTo(1) .addDisk(25 * 1048576).addDisk(25 * 1048576)); - assert successTester.apply(task.getId()); + assert successTester.apply(task.getHref()); - vApp = tmClient.getVApp(vApp.getId()); + vApp = tmClient.getVApp(vApp.getHref()); assertEquals(vApp.getName(), "eduardo"); assertEquals(find(vApp.getResourceAllocations(), resourceType(ResourceType.PROCESSOR)).getVirtualQuantity(), 1); assertEquals(find(vApp.getResourceAllocations(), resourceType(ResourceType.MEMORY)).getVirtualQuantity(), 1536); assertEquals(size(filter(vApp.getResourceAllocations(), resourceType(ResourceType.DISK_DRIVE))), 3); - assert successTester.apply(tmClient.powerOnVApp(vApp.getId()).getId()); + assert successTester.apply(tmClient.powerOnVApp(vApp.getHref()).getHref()); loopAndCheckPass(); - assert successTester.apply(tmClient.powerOffVApp(vApp.getId()).getId()); + assert successTester.apply(tmClient.powerOffVApp(vApp.getHref()).getHref()); // extract the disks on the vApp sorted by addressOnParent List disks = Lists.newArrayList(filter(vApp.getResourceAllocations(), @@ -359,9 +359,9 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes // delete the second disk task = tmClient.configureVApp(vApp, deleteDiskWithAddressOnParent(disks.get(1).getAddressOnParent())); - assert successTester.apply(task.getId()); + assert successTester.apply(task.getHref()); - assert successTester.apply(tmClient.powerOnVApp(vApp.getId()).getId()); + assert successTester.apply(tmClient.powerOnVApp(vApp.getHref()).getHref()); loopAndCheckPass(); } @@ -410,19 +410,19 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes tmClient.deleteInternetService(is.getId()); if (vApp != null) { try { - successTester.apply(tmClient.powerOffVApp(vApp.getId()).getId()); + successTester.apply(tmClient.powerOffVApp(vApp.getHref()).getHref()); } catch (Exception e) { } - tmClient.deleteVApp(vApp.getId()); + tmClient.deleteVApp(vApp.getHref()); } if (clone != null) { try { - successTester.apply(tmClient.powerOffVApp(clone.getId()).getId()); + successTester.apply(tmClient.powerOffVApp(clone.getHref()).getHref()); } catch (Exception e) { } - tmClient.deleteVApp(clone.getId()); + tmClient.deleteVApp(clone.getHref()); } } diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkECloudAsyncClientTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkECloudAsyncClientTest.java index c2ac5ae004..670206f27c 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkECloudAsyncClientTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkECloudAsyncClientTest.java @@ -47,7 +47,7 @@ import org.jclouds.util.Utils; import org.jclouds.vcloud.CommonVCloudClient; import org.jclouds.vcloud.VCloudExpressAsyncClientTest.VCloudRestClientModuleExtension.TestOrgCatalogItemSupplier; import org.jclouds.vcloud.VCloudExpressAsyncClientTest.VCloudRestClientModuleExtension.TestOrgCatalogSupplier; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.filters.SetVCloudTokenCookie; @@ -437,12 +437,12 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest orgs) { + protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { return URI.create("https://org"); } @Override - protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { + protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { return "org"; } @@ -457,7 +457,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest provideOrgs(Supplier cache, @Named(PROPERTY_IDENTITY) String user) { + protected Iterable provideOrgs(Supplier cache, @Named(PROPERTY_IDENTITY) String user) { return null; } diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudExpressAsyncClientTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudExpressAsyncClientTest.java index d684f0170b..b8ee8f3d7b 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudExpressAsyncClientTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudExpressAsyncClientTest.java @@ -54,12 +54,12 @@ import org.jclouds.vcloud.VCloudExpressAsyncClientTest.VCloudRestClientModuleExt import org.jclouds.vcloud.domain.AllocationModel; import org.jclouds.vcloud.domain.Capacity; import org.jclouds.vcloud.domain.Catalog; -import org.jclouds.vcloud.domain.NamedResource; +import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VDCStatus; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.filters.SetVCloudTokenCookie; import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions; import org.jclouds.vcloud.terremark.config.TerremarkVCloudExpressRestClientModule; @@ -617,12 +617,12 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest orgs) { + protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { return URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"); } @Override - protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { + protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) { return "org"; } @@ -638,7 +638,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest provideOrgs(Supplier cache, @Named(PROPERTY_IDENTITY) String user) { + protected Iterable provideOrgs(Supplier cache, @Named(PROPERTY_IDENTITY) String user) { return null; } @@ -650,13 +650,13 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest get() { - return Maps.transformValues(sessionSupplier.get().getOrgs(), new Function() { + public Map get() { + return Maps.transformValues(sessionSupplier.get().getOrgs(), new Function() { @Override - public NamedResource apply(NamedResource from) { - return new NamedResourceImpl(from.getName(), TerremarkVCloudExpressMediaType.KEYSLIST_XML, URI - .create(from.getId().toASCIIString() + "/keysList")); + public ReferenceType apply(ReferenceType from) { + return new ReferenceTypeImpl(from.getName(), TerremarkVCloudExpressMediaType.KEYSLIST_XML, URI + .create(from.getHref().toASCIIString() + "/keysList")); } }); @@ -676,15 +676,15 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest get() { return ImmutableMap. of("org", new TerremarkOrgImpl("org", null, URI .create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), null, ImmutableMap - . of("catalog", new NamedResourceImpl("catalog", + . of("catalog", new ReferenceTypeImpl("catalog", TerremarkVCloudExpressMediaType.CATALOG_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))), ImmutableMap - . of("vdc", new NamedResourceImpl("vdc", + . of("vdc", new ReferenceTypeImpl("vdc", TerremarkVCloudExpressMediaType.VDC_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))), ImmutableMap - . of(), new NamedResourceImpl("tasksList", + . of(), new ReferenceTypeImpl("tasksList", TerremarkVCloudExpressMediaType.TASKSLIST_XML, URI - .create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), new NamedResourceImpl( + .create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), new ReferenceTypeImpl( "keysList", TerremarkVCloudExpressMediaType.KEYSLIST_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/keysList/1")))); } @@ -705,16 +705,16 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest of(), AllocationModel.UNRECOGNIZED_MODEL, new Capacity("MB", 0, 0, 0, 0), new Capacity("MB", 0, 0, 0, 0), new Capacity("MB", 0, 0, 0, 0), - ImmutableMap. of("vapp", new NamedResourceImpl("vapp", + ImmutableMap. of("vapp", new ReferenceTypeImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1")), "network", - new NamedResourceImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI + new ReferenceTypeImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI .create("https://vcloud.safesecureweb.com/api/v0.8/vdcItem/2"))), ImmutableMap - . of(), 0, 0, 0, false, new NamedResourceImpl("catalog", + . of(), 0, 0, 0, false, new ReferenceTypeImpl("catalog", TerremarkVCloudExpressMediaType.CATALOG_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1")), - new NamedResourceImpl("publicIps", TerremarkVCloudExpressMediaType.PUBLICIPSLIST_XML, URI - .create("https://vcloud.safesecureweb.com/api/v0.8/publicIps/1")), new NamedResourceImpl( + new ReferenceTypeImpl("publicIps", TerremarkVCloudExpressMediaType.PUBLICIPSLIST_XML, URI + .create("https://vcloud.safesecureweb.com/api/v0.8/publicIps/1")), new ReferenceTypeImpl( "internetServices", TerremarkVCloudExpressMediaType.INTERNETSERVICESLIST_XML, URI .create("https://vcloud.safesecureweb.com/api/v0.8/internetServices/1"))))); } diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudExpressClientLiveTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudExpressClientLiveTest.java index abd94809d9..eb7dd42724 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudExpressClientLiveTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudExpressClientLiveTest.java @@ -58,7 +58,7 @@ public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTes Set response = vCloudExpressClient.listKeyPairsInOrg(null); assertNotNull(response); System.err.println(response); - assertEquals(response, vCloudExpressClient.listKeyPairsInOrg(org.getId())); + assertEquals(response, vCloudExpressClient.listKeyPairsInOrg(org.getHref())); } @Override @@ -67,11 +67,11 @@ public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTes TerremarkOrg org = vCloudExpressClient.findOrgNamed(null); try { - key = vCloudExpressClient.generateKeyPairInOrg(org.getId(), "livetest", false); + key = vCloudExpressClient.generateKeyPairInOrg(org.getHref(), "livetest", false); } catch (IllegalStateException e) { - key = vCloudExpressClient.findKeyPairInOrg(org.getId(), "livetest"); + key = vCloudExpressClient.findKeyPairInOrg(org.getHref(), "livetest"); vCloudExpressClient.deleteKeyPair(key.getId()); - key = vCloudExpressClient.generateKeyPairInOrg(org.getId(), "livetest", false); + key = vCloudExpressClient.generateKeyPairInOrg(org.getHref(), "livetest", false); } assertNotNull(key); System.err.println(key); @@ -79,7 +79,7 @@ public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTes assertNotNull(key.getPrivateKey()); assertNotNull(key.getFingerPrint()); assertEquals(key.isDefault(), false); - assertEquals(key.getFingerPrint(), vCloudExpressClient.findKeyPairInOrg(org.getId(), key.getName()) + assertEquals(key.getFingerPrint(), vCloudExpressClient.findKeyPairInOrg(org.getHref(), key.getName()) .getFingerPrint()); } diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClientTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClientTest.java index ceddae9c1e..94bf8ea352 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClientTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClientTest.java @@ -70,8 +70,8 @@ public class TerremarkVCloudComputeClientTest { // TODO make this call only once expect(client.getVAppTemplate(templateURI)).andReturn(template); - expect(vdc.getId()).andReturn(vdcURI); - expect(template.getId()).andReturn(templateURI); + expect(vdc.getHref()).andReturn(vdcURI); + expect(template.getHref()).andReturn(templateURI); expect( client.instantiateVAppTemplateInVDC(vdcURI, templateURI, "name", new TerremarkInstantiateVAppTemplateOptions().productProperty("password", "password"))) @@ -80,10 +80,10 @@ public class TerremarkVCloudComputeClientTest { URI vappLocation = URI.create("vapp"); URI taskLocation = URI.create("task"); - expect(vApp.getId()).andReturn(vappLocation).atLeastOnce(); + expect(vApp.getHref()).andReturn(vappLocation).atLeastOnce(); expect(vApp.getName()).andReturn("name").atLeastOnce(); expect(client.deployVApp(vappLocation)).andReturn(task); - expect(task.getId()).andReturn(taskLocation).atLeastOnce(); + expect(task.getHref()).andReturn(taskLocation).atLeastOnce(); Predicate successTester = createMock(Predicate.class); expect(successTester.apply(taskLocation)).andReturn(true).atLeastOnce(); expect(client.powerOnVApp(vappLocation)).andReturn(task); diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkCatalogItemHandlerTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkCatalogItemHandlerTest.java index 9866fadf33..6d516f5742 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkCatalogItemHandlerTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkCatalogItemHandlerTest.java @@ -29,7 +29,7 @@ import java.util.Properties; import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.config.SaxParserModule; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.terremark.TerremarkVCloudPropertiesBuilder; import org.jclouds.vcloud.terremark.domain.TerremarkCatalogItem; import org.jclouds.vcloud.terremark.domain.internal.TerremarkCatalogItemImpl; @@ -75,17 +75,17 @@ public class TerremarkCatalogItemHandlerTest extends BaseHandlerTest { "CentOS 5.3 (32-bit)", URI.create("https://services.vCloudexpress.terremark.com/api/v0.8a-13ext1.6/catalogItem/37-159"), null, - new NamedResourceImpl( + new ReferenceTypeImpl( "Compute Options", "application/vnd.tmrk.vcloudExpress.vappComputeOptionParameters+xml", URI .create("https://services.vCloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/template/37-159/options/compute")), - new NamedResourceImpl( + new ReferenceTypeImpl( "Customization Options", "application/vnd.tmrk.vcloudExpress.vappCustomizationParameters+xml", URI .create("https://services.vCloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/template/37-159/options/customization")), - new NamedResourceImpl("CentOS 5.3 (32-bit)", "application/vnd.vmware.vCloud.vAppTemplate+xml", URI + new ReferenceTypeImpl("CentOS 5.3 (32-bit)", "application/vnd.vmware.vCloud.vAppTemplate+xml", URI .create("https://services.vCloudexpress.terremark.com/api/v0.8a-ext1.6/vappTemplate/37")), ImmutableMap. of("LicensingCost", "0"))); } diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkOrgHandlerTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkOrgHandlerTest.java index b074547df4..ef687c17a7 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkOrgHandlerTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkOrgHandlerTest.java @@ -32,7 +32,7 @@ import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.vcloud.VCloudExpressMediaType; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressMediaType; import org.jclouds.vcloud.terremark.TerremarkVCloudPropertiesBuilder; import org.jclouds.vcloud.terremark.domain.TerremarkOrg; @@ -72,16 +72,16 @@ public class TerremarkOrgHandlerTest extends BaseHandlerTest { TerremarkOrg result = (TerremarkOrg) factory.create(injector.getInstance(TerremarkOrgHandler.class)).parse(is); assertEquals(result.getName(), "adrian@jclouds.org"); - assertEquals(result.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/org/48")); - assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new NamedResourceImpl( + assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/org/48")); + assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new ReferenceTypeImpl( "Miami Environment 1 Catalog", CATALOG_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/catalog")))); - assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new NamedResourceImpl( + assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new ReferenceTypeImpl( "Miami Environment 1", VCloudExpressMediaType.VDC_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32")))); - assertEquals(result.getTasksList(), new NamedResourceImpl("Miami Environment 1 Tasks List", TASKSLIST_XML, URI + assertEquals(result.getTasksList(), new ReferenceTypeImpl("Miami Environment 1 Tasks List", TASKSLIST_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/tasksList"))); - assertEquals(result.getKeysList(), new NamedResourceImpl("Keys", TerremarkVCloudExpressMediaType.KEYSLIST_XML, + assertEquals(result.getKeysList(), new ReferenceTypeImpl("Keys", TerremarkVCloudExpressMediaType.KEYSLIST_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/org/48/keys"))); } diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkVDCHandlerTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkVDCHandlerTest.java index ad173b8e0e..baf0b32f16 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkVDCHandlerTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/TerremarkVDCHandlerTest.java @@ -29,8 +29,8 @@ import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax.Factory; import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.vcloud.VCloudExpressMediaType; -import org.jclouds.vcloud.domain.NamedResource; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.terremark.domain.TerremarkVDC; import org.testng.annotations.Test; @@ -53,21 +53,21 @@ public class TerremarkVDCHandlerTest { TerremarkVDC result = (TerremarkVDC) factory.create(injector.getInstance(TerremarkVDCHandler.class)).parse(is); assertEquals(result.getName(), "Miami Environment 1"); - assertEquals(result.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")); - assertEquals(result.getResourceEntities(), ImmutableMap. of("adriantest", - new NamedResourceImpl("adriantest", VCloudExpressMediaType.VAPP_XML, URI + assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")); + assertEquals(result.getResourceEntities(), ImmutableMap. of("adriantest", + new ReferenceTypeImpl("adriantest", VCloudExpressMediaType.VAPP_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124")), "centos-53", - new NamedResourceImpl("centos-53", VCloudExpressMediaType.VAPP_XML, URI + new ReferenceTypeImpl("centos-53", VCloudExpressMediaType.VAPP_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15120")))); - assertEquals(result.getAvailableNetworks(), ImmutableMap.of("10.114.34.128/26", new NamedResourceImpl( + assertEquals(result.getAvailableNetworks(), ImmutableMap.of("10.114.34.128/26", new ReferenceTypeImpl( "10.114.34.128/26", "application/vnd.vmware.vcloud.network+xml", URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708")))); - assertEquals(result.getCatalog(), new NamedResourceImpl("Miami Environment 1", CATALOG_XML, URI + assertEquals(result.getCatalog(), new ReferenceTypeImpl("Miami Environment 1", CATALOG_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog"))); - assertEquals(result.getPublicIps(), new NamedResourceImpl("Public IPs", "application/xml", URI + assertEquals(result.getPublicIps(), new ReferenceTypeImpl("Public IPs", "application/xml", URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/publicIps"))); - assertEquals(result.getInternetServices(), new NamedResourceImpl("Internet Services", "application/xml", URI + assertEquals(result.getInternetServices(), new ReferenceTypeImpl("Internet Services", "application/xml", URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/internetServices"))); } } diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/VAppHandlerTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/VAppHandlerTest.java index 9ebb5fd499..30272d4d95 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/VAppHandlerTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/xml/VAppHandlerTest.java @@ -40,7 +40,7 @@ import org.jclouds.vcloud.domain.ResourceType; import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.VirtualSystem; -import org.jclouds.vcloud.domain.internal.NamedResourceImpl; +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; import org.jclouds.vcloud.xml.VCloudExpressVAppHandler; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -86,8 +86,8 @@ public class VAppHandlerTest extends BaseHandlerTest { assertEquals(result.getSize().longValue(), 4l); - assertEquals(result.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/13775")); - assertEquals(result.getVDC(), new NamedResourceImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI + assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/13775")); + assertEquals(result.getVDC(), new ReferenceTypeImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"))); } @@ -103,8 +103,8 @@ public class VAppHandlerTest extends BaseHandlerTest { assertEquals(result.getSize().longValue(), 10485760); assertEquals(result.getOperatingSystemDescription(), "Red Hat Enterprise Linux 5 (64-bit)"); - assertEquals(result.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16238")); - assertEquals(result.getVDC(), new NamedResourceImpl(null, VCloudExpressMediaType.VDC_XML, URI + assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16238")); + assertEquals(result.getVDC(), new ReferenceTypeImpl(null, VCloudExpressMediaType.VDC_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"))); assertEquals(result.getSystem(), new VirtualSystem(0, "Virtual Hardware Family", "centos-53", "vmx-07")); @@ -141,8 +141,8 @@ public class VAppHandlerTest extends BaseHandlerTest { assertEquals(vApp.getSize().longValue(), 30408704); assertEquals(vApp.getOperatingSystemDescription(), "Ubuntu Linux (32-bit)"); - assertEquals(vApp.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15639")); - assertEquals(vApp.getVDC(), new NamedResourceImpl(null, VCloudExpressMediaType.VDC_XML, URI + assertEquals(vApp.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15639")); + assertEquals(vApp.getVDC(), new ReferenceTypeImpl(null, VCloudExpressMediaType.VDC_XML, URI .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"))); assertEquals(vApp.getSystem(), new VirtualSystem(0, "Virtual Hardware Family", "eduardo", "vmx-07"));