Issue 280: renamed NamedResource to ReferenceType as that is the correct name in the vcloud api

This commit is contained in:
Adrian Cole 2010-08-24 10:59:38 -07:00
parent 72bf4e2d63
commit c6d046494e
129 changed files with 785 additions and 772 deletions

View File

@ -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<String, NamedResource> networks = vDC.getAvailableNetworks();
Map<String, ReferenceType> networks = vDC.getAvailableNetworks();
checkState(networks.size() > 0, "No networks present in vDC: " + vDC.getName());
return Iterables.getOnlyElement(Iterables.filter(networks.values(), new Predicate<NamedResource>() {
return Iterables.getOnlyElement(Iterables.filter(networks.values(), new Predicate<ReferenceType>() {
@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<NamedResource>() {
return Iterables.getOnlyElement(Iterables.filter(org.getCatalogs().values(), new Predicate<ReferenceType>() {
@Override
public boolean apply(NamedResource input) {
public boolean apply(ReferenceType input) {
return input.getName().startsWith(user);
}
})).getId();
})).getHref();
}
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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<VAppTemplate, Image> {
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<VAppTemplate, Image> {
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<VAppTemplate, Image> {
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.<String, String> of(), os, desc, "", credentialsProvider.execute(from));
return new VCloudImage(from, from.getHref().toASCIIString(), name, from.getHref().toASCIIString(), location, from
.getHref(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from));
}
protected String getName(String name) {

View File

@ -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<VCloudExpressVAppTemplate, Image> {
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<VCloudExpress
this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider");
}
public ImageForVCloudExpressVAppTemplate withParent(NamedResource parent) {
public ImageForVCloudExpressVAppTemplate withParent(ReferenceType parent) {
this.parent = parent;
return this;
}
@ -69,8 +69,8 @@ public class ImageForVCloudExpressVAppTemplate implements Function<VCloudExpress
Location location = findLocationForResource.apply(checkNotNull(parent, "parent"));
String name = getName(from.getName());
String desc = from.getDescription() != null ? from.getDescription() : from.getName();
return new VCloudExpressImage(from, from.getId().toASCIIString(), name, from.getId().toASCIIString(), location, from
.getId(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from));
return new VCloudExpressImage(from, from.getHref().toASCIIString(), name, from.getHref().toASCIIString(), location, from
.getHref(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from));
}
protected String getName(String name) {

View File

@ -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<T, A extends NamedResource> implements CommonVCloudComputeClient {
public abstract class CommonVCloudComputeClientImpl<T, A extends ReferenceType> implements CommonVCloudComputeClient {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
@ -69,7 +69,7 @@ public abstract class CommonVCloudComputeClientImpl<T, A extends NamedResource>
protected Map<String, String> parseResponse(T template, A vAppResponse) {
Map<String, String> 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<T, A extends NamedResource>
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<T, A extends NamedResource>
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<T, A extends NamedResource>
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;

View File

@ -67,15 +67,15 @@ public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl<VAppT
VDC vdc = client.getVDC(VDC);
VAppTemplate template = VCloudClient.class.cast(client).getVAppTemplate(templateId);
VApp vAppResponse = VCloudClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(), template.getId(),
VApp vAppResponse = VCloudClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getHref(), template.getHref(),
name, options);
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
logger.debug(">> 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<VAppT
@Override
protected Task powerOff(VApp vApp) {
return VCloudClient.class.cast(client).powerOffVAppOrVm(vApp.getId());
return VCloudClient.class.cast(client).powerOffVAppOrVm(vApp.getHref());
}
@Override
protected Task reset(VApp vApp) {
return VCloudClient.class.cast(client).resetVAppOrVm(vApp.getId());
return VCloudClient.class.cast(client).resetVAppOrVm(vApp.getHref());
}
@Override
protected Task undeploy(VApp vApp) {
return VCloudClient.class.cast(client).undeployAndSaveStateOfVAppOrVm(vApp.getId());
return VCloudClient.class.cast(client).undeployAndSaveStateOfVAppOrVm(vApp.getHref());
}
}

View File

@ -69,22 +69,22 @@ public class VCloudExpressComputeClientImpl extends
VDC vdc = client.getVDC(VDC);
VCloudExpressVAppTemplate template = VCloudExpressClient.class.cast(client).getVAppTemplate(templateId);
VCloudExpressVApp vAppResponse = VCloudExpressClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(),
template.getId(), name, options);
VCloudExpressVApp vAppResponse = VCloudExpressClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getHref(),
template.getHref(), name, options);
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
logger.debug(">> 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());
}
}

View File

@ -73,11 +73,11 @@ public class VCloudAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
}
protected NodeMetadata newCreateNodeResponse(String tag, Template template, Map<String, String> metaMap, VApp vApp) {
return new NodeMetadataImpl(vApp.getId().toASCIIString(), vApp.getName(), vApp.getId().toASCIIString(), template
.getLocation(), vApp.getId(), ImmutableMap.<String, String> of(), tag, template.getImage().getId(),
return new NodeMetadataImpl(vApp.getHref().toASCIIString(), vApp.getName(), vApp.getHref().toASCIIString(), template
.getLocation(), vApp.getHref(), ImmutableMap.<String, String> of(), tag, template.getImage().getId(),
getOperatingSystemForVAppOrDefaultTo(vApp, template.getImage().getOperatingSystem()),
vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getId()),
computeClient.getPrivateAddresses(vApp.getId()), ImmutableMap.<String, String> of(), new Credentials(
vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getHref()),
computeClient.getPrivateAddresses(vApp.getHref()), ImmutableMap.<String, String> of(), new Credentials(
metaMap.get("username"), metaMap.get("password")));
}

View File

@ -73,11 +73,11 @@ public class VCloudExpressAddNodeWithTagStrategy implements AddNodeWithTagStrate
}
protected NodeMetadata newCreateNodeResponse(String tag, Template template, Map<String, String> metaMap, VCloudExpressVApp vApp) {
return new NodeMetadataImpl(vApp.getId().toASCIIString(), vApp.getName(), vApp.getId().toASCIIString(), template
.getLocation(), vApp.getId(), ImmutableMap.<String, String> of(), tag, template.getImage().getId(),
return new NodeMetadataImpl(vApp.getHref().toASCIIString(), vApp.getName(), vApp.getHref().toASCIIString(), template
.getLocation(), vApp.getHref(), ImmutableMap.<String, String> of(), tag, template.getImage().getId(),
getOperatingSystemForVAppOrDefaultTo(vApp, template.getImage().getOperatingSystem()),
vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getId()),
computeClient.getPrivateAddresses(vApp.getId()), ImmutableMap.<String, String> of(), new Credentials(
vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getHref()),
computeClient.getPrivateAddresses(vApp.getHref()), ImmutableMap.<String, String> of(), new Credentials(
metaMap.get("username"), metaMap.get("password")));
}

View File

@ -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.<String, String> of(),
return new NodeMetadataImpl(in, from.getName(), in, location, from.getHref(), ImmutableMap.<String, String> 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

View File

@ -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<Map<String, NamedResource>> orgNameToEndpoint;
private final Supplier<Map<String, ReferenceType>> orgNameToEndpoint;
@Inject
protected VCloudExpressListNodesStrategy(CommonVCloudClient client,
@Org Supplier<Map<String, NamedResource>> orgNameToEndpoint, VCloudExpressGetNodeMetadataStrategy getNodeMetadata,
@Org Supplier<Map<String, ReferenceType>> orgNameToEndpoint, VCloudExpressGetNodeMetadataStrategy getNodeMetadata,
FindLocationForResource findLocationForResourceInVDC) {
this.client = client;
this.orgNameToEndpoint = orgNameToEndpoint;
@ -87,8 +87,8 @@ public class VCloudExpressListNodesStrategy implements ListNodesStrategy {
public Iterable<ComputeMetadata> list() {
Set<ComputeMetadata> 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.<String, String> of());
return new ComputeMetadataImpl(ComputeType.NODE, resource.getHref().toASCIIString(), resource.getName(), resource
.getHref().toASCIIString(), location, null, ImmutableMap.<String, String> of());
}
@Override
public Iterable<NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) {
Set<NodeMetadata> 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<NodeMetadata> nodes, NamedResource vdc, NamedResource resource) {
void addVAppToSetRetryingIfNotYetPresent(Set<NodeMetadata> 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());

View File

@ -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);
}
}

View File

@ -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.<String, String> of(),
return new NodeMetadataImpl(in, from.getName(), in, location, from.getHref(), ImmutableMap.<String, String> of(),
tag, null, getOperatingSystemForVAppOrDefaultTo(from, null),
vAppStatusToNodeState.get(from.getStatus()), computeClient.getPublicAddresses(id), computeClient
.getPrivateAddresses(id), getExtra.apply(from), null);

View File

@ -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<Map<String, NamedResource>> orgNameToEndpoint;
private final Supplier<Map<String, ReferenceType>> orgNameToEndpoint;
@Inject
protected VCloudListNodesStrategy(CommonVCloudClient client,
@Org Supplier<Map<String, NamedResource>> orgNameToEndpoint, VCloudGetNodeMetadataStrategy getNodeMetadata,
@Org Supplier<Map<String, ReferenceType>> orgNameToEndpoint, VCloudGetNodeMetadataStrategy getNodeMetadata,
FindLocationForResource findLocationForResourceInVDC) {
this.client = client;
this.orgNameToEndpoint = orgNameToEndpoint;
@ -87,8 +87,8 @@ public class VCloudListNodesStrategy implements ListNodesStrategy {
public Iterable<ComputeMetadata> list() {
Set<ComputeMetadata> 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.<String, String> of());
return new ComputeMetadataImpl(ComputeType.NODE, resource.getHref().toASCIIString(), resource.getName(), resource
.getHref().toASCIIString(), location, null, ImmutableMap.<String, String> of());
}
@Override
public Iterable<NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) {
Set<NodeMetadata> 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<NodeMetadata> nodes, NamedResource vdc, NamedResource resource) {
void addVAppToSetRetryingIfNotYetPresent(Set<NodeMetadata> 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());

View File

@ -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);
}
}

View File

@ -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<Set<? extends Location>> {
private final String providerName;
private final Supplier<Map<String, NamedResource>> orgNameToResource;
private final Supplier<Map<String, ReferenceType>> orgNameToResource;
private final Supplier<Map<String, ? extends Org>> orgNameToVDCResource;
@Inject
OrgAndVDCToLocationSupplier(@org.jclouds.rest.annotations.Provider String providerName,
@org.jclouds.vcloud.endpoints.Org Supplier<Map<String, NamedResource>> orgNameToResource,
@org.jclouds.vcloud.endpoints.Org Supplier<Map<String, ReferenceType>> orgNameToResource,
Supplier<Map<String, ? extends Org>> orgNameToVDCResource) {
this.providerName = providerName;
this.orgNameToResource = orgNameToResource;
@ -58,9 +58,9 @@ public class OrgAndVDCToLocationSupplier implements Supplier<Set<? extends Locat
Location provider = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
Set<Location> 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));
}
}

View File

@ -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<S extends CommonVCloudClient, A extend
@Singleton
protected URI provideDefaultVDC(Org org) {
checkState(org.getVDCs().size() > 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<S extends CommonVCloudClient, A extend
@Singleton
protected URI provideCatalog(Org org, @Named(PROPERTY_IDENTITY) String user) {
checkState(org.getCatalogs().size() > 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<S extends CommonVCloudClient, A extend
@Provides
@org.jclouds.vcloud.endpoints.Org
@Singleton
protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable<NamedResource> orgs) {
return getLast(orgs).getId();
protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable<ReferenceType> orgs) {
return getLast(orgs).getHref();
}
@Provides
@org.jclouds.vcloud.endpoints.Org
@Singleton
protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable<NamedResource> orgs) {
protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable<ReferenceType> orgs) {
return getLast(orgs).getName();
}
@Provides
@org.jclouds.vcloud.endpoints.Org
@Singleton
protected Supplier<Map<String, NamedResource>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
protected Supplier<Map<String, ReferenceType>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
final OrgNameToOrgSupplier supplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, NamedResource>>(authException,
seconds, new Supplier<Map<String, NamedResource>>() {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, ReferenceType>>(authException,
seconds, new Supplier<Map<String, ReferenceType>>() {
@Override
public Map<String, NamedResource> get() {
public Map<String, ReferenceType> get() {
return supplier.get();
}
});
@ -310,7 +310,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Override
public URI apply(org.jclouds.vcloud.domain.VDC from) {
return from.getId();
return from.getHref();
}
});
@ -321,7 +321,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Provides
@org.jclouds.vcloud.endpoints.Org
@Singleton
protected Iterable<NamedResource> provideOrgs(Supplier<VCloudSession> cache, @Named(PROPERTY_IDENTITY) String user) {
protected Iterable<ReferenceType> provideOrgs(Supplier<VCloudSession> 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<S extends CommonVCloudClient, A extend
protected AtomicReference<AuthorizationException> authException = new AtomicReference<AuthorizationException>();
final static Function<NamedResource, String> name = new Function<NamedResource, String>() {
final static Function<ReferenceType, String> name = new Function<ReferenceType, String>() {
@Override
public String apply(NamedResource from) {
public String apply(ReferenceType from) {
return from.getName();
}
@ -351,7 +351,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
}
@Singleton
private static class OrgNameToOrgSupplier implements Supplier<Map<String, NamedResource>> {
private static class OrgNameToOrgSupplier implements Supplier<Map<String, ReferenceType>> {
private final Supplier<VCloudSession> sessionSupplier;
@SuppressWarnings("unused")
@ -361,7 +361,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
}
@Override
public Map<String, NamedResource> get() {
public Map<String, ReferenceType> get() {
return sessionSupplier.get().getOrgs();
}
@ -396,9 +396,9 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
throw authException.get();
try {
org.jclouds.vcloud.domain.VDC vDC = client.findVDCInOrgNamed(null, null);
Map<String, NamedResource> networks = vDC.getAvailableNetworks();
Map<String, ReferenceType> 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<S extends CommonVCloudClient, A extend
@TasksList
@Singleton
protected URI provideDefaultTasksList(Org org) {
return org.getTasksList().getId();
return org.getTasksList().getHref();
}
@Override

View File

@ -33,14 +33,14 @@ import com.google.inject.ImplementedBy;
*/
@org.jclouds.vcloud.endpoints.Catalog
@ImplementedBy(CatalogImpl.class)
public interface Catalog extends NamedResource, Map<String, NamedResource> {
public interface Catalog extends ReferenceType, Map<String, 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();
/**
* optional description

View File

@ -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<String, String> getProperties();

View File

@ -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<String, NamedResource> getCatalogs();
Map<String, ReferenceType> getCatalogs();
/**
* @since vcloud api 0.8
*/
Map<String, NamedResource> getVDCs();
Map<String, ReferenceType> 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<String, NamedResource> getNetworks();
Map<String, ReferenceType> getNetworks();
/**
* readonly container for Task elements. Each element in the container represents a queued,

View File

@ -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<NamedResource> {
URI getId();
@ImplementedBy(ReferenceTypeImpl.class)
public interface ReferenceType extends Comparable<ReferenceType> {
/**
* @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();
}

View File

@ -33,7 +33,7 @@ import com.google.inject.ImplementedBy;
* objects XML representation. This element is readonly.
*/
@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

View File

@ -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

View File

@ -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.

View File

@ -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();

View File

@ -23,7 +23,7 @@ package org.jclouds.vcloud.domain;
*
* @author Adrian Cole
*/
public interface VCloudExpressVAppTemplate extends NamedResource {
public interface VCloudExpressVAppTemplate extends ReferenceType {
Status getStatus();

View File

@ -28,5 +28,5 @@ import java.util.Map;
public interface VCloudSession {
String getVCloudToken();
Map<String, NamedResource> getOrgs();
Map<String, ReferenceType> getOrgs();
}

View File

@ -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<String, NamedResource> getResourceEntities();
Map<String, ReferenceType> getResourceEntities();
/**
* container for OrgNetwork elements that represent organization networks contained by the vDC
*
* @since vcloud api 0.8
*/
Map<String, NamedResource> getAvailableNetworks();
Map<String, ReferenceType> getAvailableNetworks();
/**
* maximum number of virtual NICs allowed in this vDC. Defaults to 0, which specifies an

View File

@ -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

View File

@ -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<String, NamedResource> implements Catalog {
public class CatalogImpl extends LinkedHashMap<String, ReferenceType> 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<Task> tasks = Lists.newArrayList();
private final boolean published;
public CatalogImpl(String name, String type, URI id, NamedResource org, @Nullable String description,
Map<String, NamedResource> contents, Iterable<Task> tasks, boolean published) {
public CatalogImpl(String name, String type, URI href, ReferenceType org, @Nullable String description,
Map<String, ReferenceType> contents, Iterable<Task> 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<String, NamedResource> implements
* {@inheritDoc}
*/
@Override
public URI getId() {
return id;
public URI getHref() {
return href;
}
/**
@ -85,7 +85,7 @@ public class CatalogImpl extends LinkedHashMap<String, NamedResource> implements
* {@inheritDoc}
*/
@Override
public NamedResource getOrg() {
public ReferenceType getOrg() {
return org;
}
@ -125,7 +125,7 @@ public class CatalogImpl extends LinkedHashMap<String, NamedResource> 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<String, NamedResource> 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<String, NamedResource> 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());
}
}

View File

@ -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<String, String> 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<String, String> 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 + "]";
}

View File

@ -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<String, NamedResource> catalogs = Maps.newLinkedHashMap();
private final Map<String, NamedResource> vdcs = Maps.newLinkedHashMap();
private final Map<String, NamedResource> networks = Maps.newLinkedHashMap();
private final NamedResource tasksList;
private final Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
private final Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
private final Map<String, ReferenceType> networks = Maps.newLinkedHashMap();
private final ReferenceType tasksList;
private final List<Task> tasks = Lists.newArrayList();
public OrgImpl(String name, String type, URI id, String fullName, String description,
Map<String, NamedResource> catalogs, Map<String, NamedResource> vdcs, Map<String, NamedResource> networks,
@Nullable NamedResource tasksList, Iterable<Task> tasks) {
Map<String, ReferenceType> catalogs, Map<String, ReferenceType> vdcs, Map<String, ReferenceType> networks,
@Nullable ReferenceType tasksList, Iterable<Task> 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<String, NamedResource> getCatalogs() {
public Map<String, ReferenceType> getCatalogs() {
return catalogs;
}
@Override
public Map<String, NamedResource> getVDCs() {
public Map<String, ReferenceType> getVDCs() {
return vdcs;
}
@Override
public Map<String, NamedResource> getNetworks() {
public Map<String, ReferenceType> 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() + "]";
}
}

View File

@ -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 + "]";
}
}

View File

@ -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;
}

View File

@ -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<Task> tasks = Lists.newArrayList();
private final boolean ovfDescriptorUploaded;
private final Set<Vm> 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<Task> tasks, boolean ovfDescriptorUploaded, Iterable<? extends Vm> 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 + "]";
}

View File

@ -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<Task> tasks = Lists.newArrayList();
@ -54,7 +54,7 @@ public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate
private final String vAppScopedLocalId;
private final Set<Vm> 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<Task> tasks, boolean ovfDescriptorUploaded,
@Nullable String vAppScopedLocalId, Iterable<? extends Vm> 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 + "]";
}

View File

@ -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<String, String> 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<String, String> networkToAddresses, Integer osType, String operatingSystemDescription,
VirtualSystem system, Set<ResourceAllocation> 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());
}
}

View File

@ -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;

View File

@ -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<Task> 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<String, NamedResource> resourceEntities = Maps.newLinkedHashMap();
private final Map<String, NamedResource> availableNetworks = Maps.newLinkedHashMap();
private final Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap();
private final Map<String, ReferenceType> 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<Task> tasks, AllocationModel allocationModel, @Nullable Capacity storageCapacity,
@Nullable Capacity cpuCapacity, @Nullable Capacity memoryCapacity,
Map<String, NamedResource> resourceEntities, Map<String, NamedResource> availableNetworks, int nicQuota,
Map<String, ReferenceType> resourceEntities, Map<String, ReferenceType> 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<String, NamedResource> getResourceEntities() {
public Map<String, ReferenceType> getResourceEntities() {
return resourceEntities;
}
@ -160,7 +160,7 @@ public class VDCImpl extends NamedResourceImpl implements VDC {
* {@inheritDoc}
*/
@Override
public Map<String, NamedResource> getAvailableNetworks() {
public Map<String, ReferenceType> 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 + "]";
}

View File

@ -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<Task> 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<Task> 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 + "]";
}

View File

@ -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

View File

@ -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

View File

@ -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<Task> tasks = Lists.newArrayList();
private final Configuration configuration;
@Nullable
private final NamedResource networkPool;
private final ReferenceType networkPool;
private final Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet();
public OrgNetworkImpl(String name, String type, URI id, @Nullable NamedResource org, @Nullable String description,
Iterable<Task> tasks, Configuration configuration, @Nullable NamedResource networkPool,
public OrgNetworkImpl(String name, String type, URI id, @Nullable ReferenceType org, @Nullable String description,
Iterable<Task> tasks, Configuration configuration, @Nullable ReferenceType networkPool,
Iterable<String> 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;
}

View File

@ -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 + "]";

View File

@ -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.<Task> of(),
super(in.getName(), in.getType(), in.getHref(), null, in.getDescription(), ImmutableSet.<Task> of(),
parseConfiguration(in), null, ImmutableSet.<String> of());
}

View File

@ -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<Catalog, Iterable<? ex
@Override
public Iterable<? extends CatalogItem> apply(Catalog from) {
Iterable<CatalogItem> catalogItems = transformParallel(filter(from.values(), new Predicate<NamedResource>() {
Iterable<CatalogItem> catalogItems = transformParallel(filter(from.values(), new Predicate<ReferenceType>() {
@Override
public boolean apply(NamedResource input) {
public boolean apply(ReferenceType input) {
return input.getType().equals(VCloudMediaType.CATALOGITEM_XML);
}
}), new Function<NamedResource, Future<CatalogItem>>() {
}), new Function<ReferenceType, Future<CatalogItem>>() {
@SuppressWarnings("unchecked")
@Override
public Future<CatalogItem> apply(NamedResource from) {
return (Future<CatalogItem>) aclient.getCatalogItem(from.getId());
public Future<CatalogItem> apply(ReferenceType from) {
return (Future<CatalogItem>) aclient.getCatalogItem(from.getHref());
}
}, executor, null, logger, "catalogItems in " + from.getId());
}, executor, null, logger, "catalogItems in " + from.getHref());
return catalogItems;
}

View File

@ -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<Org, Iterable<? extends Catalo
@Override
public Iterable<? extends Catalog> apply(final Org org) {
Iterable<Catalog> catalogs = transformParallel(org.getCatalogs().values(),
new Function<NamedResource, Future<Catalog>>() {
new Function<ReferenceType, Future<Catalog>>() {
@SuppressWarnings("unchecked")
@Override
public Future<Catalog> apply(NamedResource from) {
return (Future<Catalog>) aclient.getCatalog(from.getId());
public Future<Catalog> apply(ReferenceType from) {
return (Future<Catalog>) aclient.getCatalog(from.getHref());
}
}, executor, null, logger, "catalogs in " + org.getName());

View File

@ -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<Org, Iterable<? extends VDC>> {
public Iterable<? extends VDC> apply(final Org org) {
Iterable<VDC> catalogItems = transformParallel(org.getVDCs().values(),
new Function<NamedResource, Future<VDC>>() {
new Function<ReferenceType, Future<VDC>>() {
@SuppressWarnings("unchecked")
@Override
public Future<VDC> apply(NamedResource from) {
return (Future<VDC>) aclient.getVDC(from.getId());
public Future<VDC> apply(ReferenceType from) {
return (Future<VDC>) aclient.getVDC(from.getHref());
}
}, executor, null, logger, "vdcs in org " + org.getName());

View File

@ -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<Object, URI> {
org = defaultOrg;
try {
Map<String, NamedResource> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs();
return catalog == null ? Iterables.getLast(catalogs.values()).getId() : catalogs.get(catalog).getId();
Map<String, ReferenceType> 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());
}

View File

@ -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<Object, URI> {
org = defaultOrg;
try {
Map<String, NamedResource> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs();
return vdc == null ? Iterables.getLast(vdcs.values()).getId() : vdcs.get(vdc).getId();
Map<String, ReferenceType> 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());
}

View File

@ -66,7 +66,7 @@ public class OrgNameCatalogNameItemNameToEndpoint implements Function<Object, UR
catalog = defaultCatalog;
try {
Map<String, ? extends org.jclouds.vcloud.domain.Catalog> 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());

View File

@ -67,7 +67,7 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
catalog = defaultCatalog;
try {
Map<String, Map<String, ? extends CatalogItem>> 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());

View File

@ -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<Object, URI> {
private final Supplier<Map<String, NamedResource>> orgNameToEndpointSupplier;
private final Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier;
private final URI defaultUri;
@Inject
public OrgNameToEndpoint(@Org Supplier<Map<String, NamedResource>> orgNameToEndpointSupplier, @Org URI defaultUri) {
public OrgNameToEndpoint(@Org Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier, @Org URI defaultUri) {
this.orgNameToEndpointSupplier = orgNameToEndpointSupplier;
this.defaultUri = defaultUri;
}
public URI apply(Object from) {
try {
Map<String, NamedResource> orgNameToEndpoint = orgNameToEndpointSupplier.get();
return from == null ? defaultUri : orgNameToEndpoint.get(from).getId();
Map<String, ReferenceType> 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());
}

View File

@ -54,7 +54,7 @@ public class OrgNameToTasksListEndpoint implements Function<Object, URI> {
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());
}

View File

@ -66,7 +66,7 @@ public class OrgNameVDCNameResourceEntityNameToEndpoint implements Function<Obje
vDC = defaultVDC;
try {
Map<String, ? extends org.jclouds.vcloud.domain.VDC> 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());
}

View File

@ -80,7 +80,7 @@ public class OrgsForLocations implements Function<Iterable<? extends Location>,
@Override
public URI apply(Location from) {
return VCloudLocation.class.cast(from.getParent()).getResource().getId();
return VCloudLocation.class.cast(from.getParent()).getResource().getHref();
}
})), new Function<URI, Future<Org>>() {

View File

@ -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<HttpResponse, VCl
boolean matchFound = matcher.find();
try {
if (matchFound) {
final Map<String, NamedResource> org = factory.create(orgHandlerProvider.get()).parse(
final Map<String, ReferenceType> org = factory.create(orgHandlerProvider.get()).parse(
from.getPayload().getInput());
return new VCloudSession() {
@ -83,7 +83,7 @@ public class ParseLoginResponseFromHeaders implements Function<HttpResponse, VCl
}
@Org
public Map<String, NamedResource> getOrgs() {
public Map<String, ReferenceType> getOrgs() {
return org;
}
};

View File

@ -76,7 +76,7 @@ public class VAppTemplatesForCatalogItems implements
@Override
public Future<VAppTemplate> apply(CatalogItem from) {
return (Future<VAppTemplate>) VCloudAsyncClient.class.cast(aclient).getVAppTemplate(
from.getEntity().getId());
from.getEntity().getHref());
}
}, executor, null, logger, "vappTemplates in");

View File

@ -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<? extends NamedResource>, Iterable<? extends VAppTemplate>> {
Function<Iterable<? extends ReferenceType>, Iterable<? extends VAppTemplate>> {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
public Logger logger = Logger.NULL;
@ -62,20 +62,20 @@ public class VAppTemplatesForResourceEntities implements
}
@Override
public Iterable<? extends VAppTemplate> apply(Iterable<? extends NamedResource> from) {
return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<NamedResource>() {
public Iterable<? extends VAppTemplate> apply(Iterable<? extends ReferenceType> from) {
return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<ReferenceType>() {
@Override
public boolean apply(NamedResource input) {
public boolean apply(ReferenceType input) {
return input.getType().equals(VCloudMediaType.VAPPTEMPLATE_XML);
}
}), new Function<NamedResource, Future<VAppTemplate>>() {
}), new Function<ReferenceType, Future<VAppTemplate>>() {
@SuppressWarnings("unchecked")
@Override
public Future<VAppTemplate> apply(NamedResource from) {
return (Future<VAppTemplate>) aclient.getVAppTemplate(from.getId());
public Future<VAppTemplate> apply(ReferenceType from) {
return (Future<VAppTemplate>) aclient.getVAppTemplate(from.getHref());
}
}, executor, null, logger, "vappTemplates in");

View File

@ -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<Catalog,
@Override
public Iterable<? extends CatalogItem> apply(Catalog from) {
Iterable<CatalogItem> catalogItems = transformParallel(filter(from.values(), new Predicate<NamedResource>() {
Iterable<CatalogItem> catalogItems = transformParallel(filter(from.values(), new Predicate<ReferenceType>() {
@Override
public boolean apply(NamedResource input) {
public boolean apply(ReferenceType input) {
return input.getType().equals(VCloudExpressMediaType.CATALOGITEM_XML);
}
}), new Function<NamedResource, Future<CatalogItem>>() {
}), new Function<ReferenceType, Future<CatalogItem>>() {
@SuppressWarnings("unchecked")
@Override
public Future<CatalogItem> apply(NamedResource from) {
return (Future<CatalogItem>) aclient.getCatalogItem(from.getId());
public Future<CatalogItem> apply(ReferenceType from) {
return (Future<CatalogItem>) aclient.getCatalogItem(from.getHref());
}
}, executor, null, logger, "catalogItems in " + from.getId());
}, executor, null, logger, "catalogItems in " + from.getHref());
return catalogItems;
}

View File

@ -74,7 +74,7 @@ public class VCloudExpressVAppTemplatesForCatalogItems implements
@SuppressWarnings("unchecked")
@Override
public Future<VCloudExpressVAppTemplate> apply(CatalogItem from) {
return (Future<VCloudExpressVAppTemplate>) aclient.getVAppTemplate(from.getEntity().getId());
return (Future<VCloudExpressVAppTemplate>) aclient.getVAppTemplate(from.getEntity().getHref());
}
}, executor, null, logger, "vappTemplates in");

View File

@ -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<? extends NamedResource>, Iterable<? extends VCloudExpressVAppTemplate>> {
Function<Iterable<? extends ReferenceType>, Iterable<? extends VCloudExpressVAppTemplate>> {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
public Logger logger = Logger.NULL;
@ -62,20 +62,20 @@ public class VCloudExpressVAppTemplatesForResourceEntities implements
}
@Override
public Iterable<? extends VCloudExpressVAppTemplate> apply(Iterable<? extends NamedResource> from) {
return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<NamedResource>() {
public Iterable<? extends VCloudExpressVAppTemplate> apply(Iterable<? extends ReferenceType> from) {
return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<ReferenceType>() {
@Override
public boolean apply(NamedResource input) {
public boolean apply(ReferenceType input) {
return input.getType().equals(VCloudExpressMediaType.VAPPTEMPLATE_XML);
}
}), new Function<NamedResource, Future<VCloudExpressVAppTemplate>>() {
}), new Function<ReferenceType, Future<VCloudExpressVAppTemplate>>() {
@SuppressWarnings("unchecked")
@Override
public Future<VCloudExpressVAppTemplate> apply(NamedResource from) {
return (Future<VCloudExpressVAppTemplate>) aclient.getVAppTemplate(from.getId());
public Future<VCloudExpressVAppTemplate> apply(ReferenceType from) {
return (Future<VCloudExpressVAppTemplate>) aclient.getVAppTemplate(from.getHref());
}
}, executor, null, logger, "vappTemplates in");

View File

@ -57,7 +57,7 @@ public class TaskSuccess implements Predicate<URI> {
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;
}

View File

@ -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<String, NamedResource> map, Attributes attributes) {
public static void putNamedResource(Map<String, ReferenceType> map, Attributes attributes) {
map.put(attributes.getValue(attributes.getIndex("name")), newNamedResource(attributes));
}
}

View File

@ -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<Catalog> {
private StringBuilder currentText = new StringBuilder();
private NamedResource catalog;
private SortedMap<String, NamedResource> contents = Maps.newTreeMap();
private ReferenceType catalog;
private SortedMap<String, ReferenceType> contents = Maps.newTreeMap();
protected List<Task> 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);
}

View File

@ -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<CatalogItem> {
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<String, String> 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

View File

@ -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<Org> {
private StringBuilder currentText = new StringBuilder();
protected NamedResource org;
protected Map<String, NamedResource> vdcs = Maps.newLinkedHashMap();
protected NamedResource tasksList;
protected Map<String, NamedResource> catalogs = Maps.newLinkedHashMap();
protected Map<String, NamedResource> networks = Maps.newLinkedHashMap();
protected ReferenceType org;
protected Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
protected ReferenceType tasksList;
protected Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
protected Map<String, ReferenceType> networks = Maps.newLinkedHashMap();
protected List<Task> 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);
}

View File

@ -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<Map<String, NamedResource>> {
ParseSax.HandlerWithResult<Map<String, ReferenceType>> {
private Map<String, NamedResource> org = Maps.newHashMap();
private Map<String, ReferenceType> org = Maps.newHashMap();
public Map<String, NamedResource> getResult() {
public Map<String, ReferenceType> getResult() {
return org;
}

View File

@ -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<OrgNetwork> {
protected StringBuilder currentText = new StringBuilder();
protected NamedResource network;
protected NamedResource org;
protected ReferenceType network;
protected ReferenceType org;
protected String orgDescription;
protected List<Task> tasks = Lists.newArrayList();
@ -89,7 +89,7 @@ public class OrgNetworkHandler extends ParseSax.HandlerWithResult<OrgNetwork> {
protected Set<String> 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<OrgNetwork> {
protected Features features;
protected OrgNetwork.Configuration configuration;
protected NamedResource networkPool;
protected ReferenceType networkPool;
protected Set<String> 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);
}

View File

@ -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<Task> {
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<Task> {
@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;

View File

@ -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<TasksList> {
private SortedSet<Task> 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<TasksList> {
}
public TasksList getResult() {
return new TasksListImpl(resource.getId(), tasks);
return new TasksListImpl(resource.getHref(), tasks);
}
@Override

View File

@ -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<VApp> {
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<Task> tasks = Lists.newArrayList();
protected boolean ovfDescriptorUploaded = true;
@ -68,7 +68,7 @@ public class VAppHandler extends ParseSax.HandlerWithResult<VApp> {
protected Set<Vm> 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);
}

View File

@ -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<VAppTemplate
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<Task> tasks = Lists.newArrayList();
protected boolean ovfDescriptorUploaded = true;
@ -69,7 +69,7 @@ public class VAppTemplateHandler extends ParseSax.HandlerWithResult<VAppTemplate
protected Set<Vm> 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);
}

View File

@ -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<VClo
private StringBuilder currentText = new StringBuilder();
private NamedResource network;
private ReferenceType network;
private String description;
@ -71,7 +71,7 @@ public class VCloudExpressNetworkHandler extends ParseSax.HandlerWithResult<VClo
private int sourcePort;
public VCloudExpressNetwork getResult() {
return new VCloudExpressNetworkImpl(network.getName(), network.getType(), network.getId(), description,
return new VCloudExpressNetworkImpl(network.getName(), network.getType(), network.getHref(), description,
dnsServers, gateway, netmask, fenceModes, dhcp, natRules, firewallRules);
}

View File

@ -31,7 +31,7 @@ import javax.inject.Named;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.logging.Logger;
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;
@ -75,7 +75,7 @@ public class VCloudExpressVAppHandler extends ParseSax.HandlerWithResult<VCloudE
protected Integer osType;
protected URI location;
protected Long size;
protected NamedResource vDC;
protected ReferenceType vDC;
public VCloudExpressVApp getResult() {
return new VCloudExpressVAppImpl(name, location, status, size, vDC, networkToAddresses, osType, operatingSystemDescription,
@ -84,9 +84,9 @@ public class VCloudExpressVAppHandler extends ParseSax.HandlerWithResult<VCloudE
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (qName.equals("VApp")) {
NamedResource resource = Utils.newNamedResource(attributes);
ReferenceType resource = Utils.newNamedResource(attributes);
name = resource.getName();
location = resource.getId();
location = resource.getHref();
String statusString = attributes.getValue(attributes.getIndex("status"));
if (apiVersion.indexOf("0.8") != -1 && "2".equals(statusString))
status = Status.OFF;

View File

@ -20,7 +20,7 @@
package org.jclouds.vcloud.xml;
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.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppTemplateImpl;
@ -34,12 +34,12 @@ import org.xml.sax.SAXException;
public class VCloudExpressVAppTemplateHandler extends ParseSax.HandlerWithResult<VCloudExpressVAppTemplate> {
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

View File

@ -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<VDC> {
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<Task> tasks = Lists.newArrayList();
protected AllocationModel allocationModel = AllocationModel.UNRECOGNIZED_MODEL;
@ -73,8 +73,8 @@ public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
protected int used = 0;
protected long overhead = 0;
protected Map<String, NamedResource> resourceEntities = Maps.newLinkedHashMap();
protected Map<String, NamedResource> availableNetworks = Maps.newLinkedHashMap();
protected Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap();
protected Map<String, ReferenceType> availableNetworks = Maps.newLinkedHashMap();
protected int nicQuota;
protected int networkQuota;
@ -82,7 +82,7 @@ public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
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);
}

View File

@ -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<Vm> {
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<Task> 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

View File

@ -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<S extends CommonVCloudClient, A
@Test
public void testCatalog() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId());
for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getHref());
assertNotNull(response);
assertNotNull(response.getName());
assertNotNull(response.getId());
assertNotNull(response.getHref());
assertEquals(connection.findCatalogInOrgNamed(null, response.getName()), response);
}
}
@ -81,9 +81,9 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test
public void testGetOrgNetwork() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource resource : org.getNetworks().values()) {
for (ReferenceType resource : org.getNetworks().values()) {
if (resource.getType().equals(VCloudMediaType.NETWORK_XML)) {
OrgNetwork item = connection.getNetwork(resource.getId());
OrgNetwork item = connection.getNetwork(resource.getHref());
assertNotNull(item);
}
}
@ -92,11 +92,11 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test
public void testGetVDCNetwork() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId());
for (NamedResource resource : response.getAvailableNetworks().values()) {
for (ReferenceType vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getHref());
for (ReferenceType resource : response.getAvailableNetworks().values()) {
if (resource.getType().equals(VCloudMediaType.NETWORK_XML)) {
OrgNetwork item = connection.getNetwork(resource.getId());
OrgNetwork item = connection.getNetwork(resource.getHref());
assertNotNull(item);
}
}
@ -106,11 +106,11 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test
public void testGetCatalogItem() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId());
for (NamedResource resource : response.values()) {
for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getHref());
for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.getCatalogItem(resource.getId());
CatalogItem item = connection.getCatalogItem(resource.getHref());
verifyCatalogItem(item);
}
}
@ -121,7 +121,7 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
assertNotNull(item);
assertNotNull(item);
assertNotNull(item.getEntity());
assertNotNull(item.getId());
assertNotNull(item.getHref());
assertNotNull(item.getProperties());
assertNotNull(item.getType());
}
@ -129,9 +129,9 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test
public void testFindCatalogItem() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId());
for (NamedResource resource : response.values()) {
for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getHref());
for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.findCatalogItemInOrgCatalogNamed(org.getName(), response.getName(),
resource.getName());
@ -144,14 +144,14 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test
public void testDefaultVDC() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId());
for (ReferenceType vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getHref());
assertNotNull(response);
assertNotNull(response.getName());
assertNotNull(response.getId());
assertNotNull(response.getHref());
assertNotNull(response.getResourceEntities());
assertNotNull(response.getAvailableNetworks());
assertEquals(connection.getVDC(response.getId()), response);
assertEquals(connection.getVDC(response.getHref()), response);
}
}
@ -172,7 +172,7 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
assertNotNull(response.getTasks());
if (response.getTasks().size() > 0) {
Task task = response.getTasks().last();
assertEquals(connection.getTask(task.getId()).getId(), task.getId());
assertEquals(connection.getTask(task.getHref()).getHref(), task.getHref());
}
}

View File

@ -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<VCloudAsyncClient> {
}
@Override
protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable<NamedResource> orgs) {
protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable<ReferenceType> orgs) {
return URI.create("https://vcenterprise.bluelock.com/api/v1.0/org");
}
@Override
protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable<NamedResource> orgs) {
protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable<ReferenceType> orgs) {
return "org";
}
@ -744,8 +744,8 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
@Override
public Map<String, NamedResource> getOrgs() {
return ImmutableMap.<String, NamedResource> of("org", new NamedResourceImpl("org",
public Map<String, ReferenceType> getOrgs() {
return ImmutableMap.<String, ReferenceType> 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<VCloudAsyncClient> {
null,
null,
ImmutableMap
.<String, NamedResource> of(
.<String, ReferenceType> 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<VCloudAsyncClient> {
public Map<String, Org> get() {
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"), "org", "description", ImmutableMap
.<String, NamedResource> of("catalog", new NamedResourceImpl("catalog",
.<String, ReferenceType> of("catalog", new ReferenceTypeImpl("catalog",
VCloudMediaType.CATALOG_XML, URI
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))), ImmutableMap
.<String, NamedResource> of("vdc", new NamedResourceImpl("vdc", VCloudMediaType.VDC_XML, URI
.<String, ReferenceType> of("vdc", new ReferenceTypeImpl("vdc", VCloudMediaType.VDC_XML, URI
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"))), ImmutableMap
.<String, NamedResource> of("network", new NamedResourceImpl("network",
.<String, ReferenceType> 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
.<Task> of()));
}
@ -846,10 +846,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of("catalog", new CatalogImpl("catalog", "type",
URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), null, "description",
ImmutableMap.<String, NamedResource> of("item", new NamedResourceImpl("item",
ImmutableMap.<String, ReferenceType> 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.<Task> of(), true)));
@ -878,7 +878,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
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<VCloudAsyncClient> {
}
@Override
protected Iterable<NamedResource> provideOrgs(Supplier<VCloudSession> cache, String user) {
protected Iterable<ReferenceType> provideOrgs(Supplier<VCloudSession> cache, String user) {
return null;
}

View File

@ -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<VCloudClien
@Test
public void testGetVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId());
for (NamedResource resource : response.values()) {
for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getHref());
for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.getCatalogItem(resource.getId());
CatalogItem item = connection.getCatalogItem(resource.getHref());
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
try {
assertNotNull(connection.getVAppTemplate(item.getEntity().getId()));
assertNotNull(connection.getVAppTemplate(item.getEntity().getHref()));
} catch (AuthorizationException e) {
}
@ -68,12 +68,12 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
@Test
public void testGetVApp() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId());
for (NamedResource item : response.getResourceEntities().values()) {
for (ReferenceType vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getHref());
for (ReferenceType item : response.getResourceEntities().values()) {
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
try {
VApp app = connection.getVApp(item.getId());
VApp app = connection.getVApp(item.getHref());
assertNotNull(app);
} catch (RuntimeException e) {
@ -87,12 +87,12 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
@Test
public void testGetVm() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId());
for (NamedResource item : response.getResourceEntities().values()) {
for (ReferenceType vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getHref());
for (ReferenceType item : response.getResourceEntities().values()) {
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
try {
VApp app = connection.getVApp(item.getId());
VApp app = connection.getVApp(item.getHref());
assertNotNull(app);
} catch (RuntimeException e) {
@ -105,11 +105,11 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
@Test
public void testFindVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId());
for (NamedResource resource : response.values()) {
for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getHref());
for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.getCatalogItem(resource.getId());
CatalogItem item = connection.getCatalogItem(resource.getHref());
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
try {
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item

View File

@ -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.VCloudExpressRestClientModule;
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.domain.network.FenceMode;
@ -646,13 +646,13 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
}
@Override
protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable<NamedResource> orgs) {
protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable<ReferenceType> orgs) {
return URI.create("https://vcloud.safesecureweb.com/api/v0.8/org");
}
@Override
protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable<NamedResource> orgs) {
protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable<ReferenceType> orgs) {
return "org";
}
@ -668,7 +668,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
}
@Override
protected Iterable<NamedResource> provideOrgs(Supplier<VCloudSession> cache, @Named(PROPERTY_IDENTITY) String user) {
protected Iterable<ReferenceType> provideOrgs(Supplier<VCloudSession> cache, @Named(PROPERTY_IDENTITY) String user) {
return null;
}
@ -693,8 +693,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
@Override
public Map<String, NamedResource> getOrgs() {
return ImmutableMap.<String, NamedResource> of("org", new NamedResourceImpl("org",
public Map<String, ReferenceType> getOrgs() {
return ImmutableMap.<String, ReferenceType> 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<VCloudExpressAs
ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> 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.<String, NamedResource> of("vapp",
new NamedResourceImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI
null, null, null, null, ImmutableMap.<String, ReferenceType> 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<VCloudExpressAs
public Map<String, Org> get() {
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "org", null, ImmutableMap
.<String, NamedResource> of("catalog", new NamedResourceImpl("catalog",
.<String, ReferenceType> of("catalog", new ReferenceTypeImpl("catalog",
VCloudExpressMediaType.CATALOG_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))), ImmutableMap
.<String, NamedResource> of("vdc", new NamedResourceImpl("vdc", VCloudExpressMediaType.VDC_XML,
.<String, ReferenceType> of("vdc", new ReferenceTypeImpl("vdc", VCloudExpressMediaType.VDC_XML,
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))), ImmutableMap
.<String, NamedResource> of(),
new NamedResourceImpl("tasksList", VCloudExpressMediaType.TASKSLIST_XML, URI
.<String, ReferenceType> of(),
new ReferenceTypeImpl("tasksList", VCloudExpressMediaType.TASKSLIST_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), ImmutableList
.<Task> of()));
}
@ -769,10 +769,10 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of("catalog", new CatalogImpl("catalog", "type",
URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"), null, "description",
ImmutableMap.<String, NamedResource> of("item", new NamedResourceImpl("item",
ImmutableMap.<String, ReferenceType> 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.<Task> of(), true)));
}
@ -800,7 +800,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
URI
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"),
"description",
new NamedResourceImpl(
new ReferenceTypeImpl(
"template",
"application/vnd.vmware.vcloud.vAppTemplate+xml",
URI

View File

@ -24,7 +24,7 @@ import static org.testng.Assert.assertNotNull;
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.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VDC;
@ -47,13 +47,13 @@ public class VCloudExpressClientLiveTest extends
@Test
public void testGetVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId());
for (NamedResource resource : response.values()) {
for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getHref());
for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.getCatalogItem(resource.getId());
CatalogItem item = connection.getCatalogItem(resource.getHref());
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
assertNotNull(connection.getVAppTemplate(item.getEntity().getId()));
assertNotNull(connection.getVAppTemplate(item.getEntity().getHref()));
}
}
}
@ -63,12 +63,12 @@ public class VCloudExpressClientLiveTest extends
@Test
public void testGetVApp() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId());
for (NamedResource item : response.getResourceEntities().values()) {
for (ReferenceType vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getHref());
for (ReferenceType item : response.getResourceEntities().values()) {
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
try {
VCloudExpressVApp app = connection.getVApp(item.getId());
VCloudExpressVApp app = connection.getVApp(item.getHref());
assertNotNull(app);
} catch (RuntimeException e) {
@ -81,11 +81,11 @@ public class VCloudExpressClientLiveTest extends
@Test
public void testFindVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId());
for (NamedResource resource : response.values()) {
for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getHref());
for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.getCatalogItem(resource.getId());
CatalogItem item = connection.getCatalogItem(resource.getHref());
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item
.getEntity().getName()));

View File

@ -97,7 +97,7 @@ public class VCloudComputeClientLiveTest {
InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties(
ImmutableMap.of("foo", "bar"));
id = URI.create(computeClient.start(null, template.getId(), templateName, options).get("id"));
id = URI.create(computeClient.start(null, template.getHref(), templateName, options).get("id"));
Expectation expectation = expectationMap.get(toTest);
VApp vApp = client.getVApp(id);

View File

@ -97,7 +97,7 @@ public class VCloudExpressComputeClientLiveTest {
InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties(
ImmutableMap.of("foo", "bar"));
id = URI.create(computeClient.start(null, template.getId(), templateName, options).get("id"));
id = URI.create(computeClient.start(null, template.getHref(), templateName, options).get("id"));
Expectation expectation = expectationMap.get(toTest);
VCloudExpressVApp vApp = client.getVApp(id);

View File

@ -55,7 +55,7 @@ public class VCloudExpressOrgNetworkAdapterTest {
VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is);
OrgNetwork result = new VCloudExpressOrgNetworkAdapter(in);
assertEquals(result.getName(), "10.114.34.128/26");
assertEquals(result.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"));
assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"));
assertEquals(result.getType(), "application/vnd.vmware.vcloud.network+xml");
assertEquals(result.getOrg(), null);
assertEquals(result.getDescription(), null);
@ -85,7 +85,7 @@ public class VCloudExpressOrgNetworkAdapterTest {
VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is);
OrgNetwork result = new VCloudExpressOrgNetworkAdapter(in);
assertEquals(result.getName(), "Pod03_Private");
assertEquals(result.getId(), URI.create("https://express3.bluelock.com/api/v0.8/network/1"));
assertEquals(result.getHref(), URI.create("https://express3.bluelock.com/api/v0.8/network/1"));
assertEquals(result.getType(), null);
assertEquals(result.getOrg(), null);
assertEquals(result.getDescription(), "Pod 03 Private Network");

View File

@ -30,7 +30,7 @@ import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.io.Payloads;
import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.VCloudSession;
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@ -58,7 +58,7 @@ public class ParseLoginResponseFromHeadersTest extends BaseHandlerTest {
response.getHeaders().put(HttpHeaders.SET_COOKIE, "vcloud-token=9er4d061-4bff-48fa-84b1-5da7166764d2; path=/");
VCloudSession reply = parser.apply(response);
assertEquals(reply.getVCloudToken(), "9er4d061-4bff-48fa-84b1-5da7166764d2");
assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new NamedResourceImpl("adrian@jclouds.org",
assertEquals(reply.getOrgs(), 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"))));
}
@ -74,7 +74,7 @@ public class ParseLoginResponseFromHeadersTest extends BaseHandlerTest {
"vcloud-token=c9f232506df9b65d7b7d97b7499eddd7; Domain=.bluelock.com; Path=/");
VCloudSession reply = parser.apply(response);
assertEquals(reply.getVCloudToken(), "c9f232506df9b65d7b7d97b7499eddd7");
assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new NamedResourceImpl("adrian@jclouds.org",
assertEquals(reply.getOrgs(), 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"))));
}

View File

@ -29,10 +29,10 @@ import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.ParseSax.Factory;
import org.jclouds.http.functions.config.SaxParserModule;
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.domain.internal.NamedResourceImpl;
import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
@ -58,10 +58,10 @@ public class CatalogHandlerTest {
factory = injector.getInstance(ParseSax.Factory.class);
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
assertEquals(result, new CatalogImpl("Jclouds-private", "application/vnd.vmware.vcloud.catalog+xml", URI
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081"), new NamedResourceImpl(null,
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081"), new ReferenceTypeImpl(null,
"application/vnd.vmware.vcloud.org+xml", URI
.create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")), null, ImmutableMap
.<String, NamedResource> of(), ImmutableList.<Task> of(), false));
.<String, ReferenceType> of(), ImmutableList.<Task> 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")));
}

View File

@ -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"

View File

@ -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")));
}
}

View File

@ -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<String, NamedResource> result = factory.create(injector.getInstance(OrgListHandler.class)).parse(is);
assertEquals(result, ImmutableMap.of("adrian@jclouds.org", new NamedResourceImpl("adrian@jclouds.org",
Map<String, ReferenceType> 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"))));
}
}

View File

@ -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());

View File

@ -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));

View File

@ -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));

View File

@ -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());

View File

@ -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());

View File

@ -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.<String, String> of(), null, null, null, ImmutableSet.<ResourceAllocation> 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());

View File

@ -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.<String, NamedResource> of());
assertEquals(result.getAvailableNetworks(), ImmutableMap.of("isolation01", new NamedResourceImpl("isolation01",
assertEquals(result.getResourceEntities(), ImmutableMap.<String, ReferenceType> 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.<String, NamedResource> of("adriantest",
new NamedResourceImpl("adriantest", VCloudExpressMediaType.VAPP_XML, URI
assertEquals(result.getResourceEntities(), ImmutableMap.<String, ReferenceType> 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<String, NamedResource>().put(
assertEquals(result.getResourceEntities(), new ImmutableMap.Builder<String, ReferenceType>().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.<String, NamedResource> of());
assertEquals(result.getAvailableNetworks(), ImmutableMap.<String, ReferenceType> of());
}
}

View File

@ -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());

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