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.rest.ConfiguresRestClient;
import org.jclouds.vcloud.CommonVCloudClient; import org.jclouds.vcloud.CommonVCloudClient;
import org.jclouds.vcloud.config.VCloudExpressRestClientModule; 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.Org;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
@ -49,28 +49,28 @@ public class BlueLockVCloudExpressRestClientModule extends VCloudExpressRestClie
@Override @Override
protected URI provideDefaultNetwork(CommonVCloudClient client) { protected URI provideDefaultNetwork(CommonVCloudClient client) {
org.jclouds.vcloud.domain.VDC vDC = client.findVDCInOrgNamed(null, null); 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()); 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 @Override
public boolean apply(NamedResource input) { public boolean apply(ReferenceType input) {
return input.getName().equals("Internal In and Out"); return input.getName().equals("Internal In and Out");
} }
})).getId(); })).getHref();
} }
@Override @Override
protected URI provideCatalog(Org org, @Named(PROPERTY_IDENTITY) final String user) { protected URI provideCatalog(Org org, @Named(PROPERTY_IDENTITY) final String user) {
checkState(org.getCatalogs().size() > 0, "No catalogs present in org: " + org.getName()); 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 @Override
public boolean apply(NamedResource input) { public boolean apply(ReferenceType input) {
return input.getName().startsWith(user); 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.Location;
import org.jclouds.domain.LocationScope; import org.jclouds.domain.LocationScope;
import org.jclouds.domain.internal.LocationImpl; 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 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 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; this.resource = resource;
} }
public NamedResource getResource() { public ReferenceType getResource() {
return resource; return resource;
} }

View File

@ -29,7 +29,7 @@ import javax.inject.Singleton;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.vcloud.compute.domain.VCloudLocation; 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; import com.google.common.base.Supplier;
@ -55,12 +55,12 @@ public class FindLocationForResource {
* @throws NoSuchElementException * @throws NoSuchElementException
* if not found * if not found
*/ */
public Location apply(NamedResource resource) { public Location apply(ReferenceType resource) {
for (Location input : locations.get()) { for (Location input : locations.get()) {
do { do {
// The "name" isn't always present, ex inside a vApp we have a rel // The "name" isn't always present, ex inside a vApp we have a rel
// link that only includes href and type. // 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; return input;
input = input.getParent(); input = input.getParent();
} while (input.getParent() != null); } 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.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.vcloud.compute.domain.VCloudImage; 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 org.jclouds.vcloud.domain.VAppTemplate;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -42,7 +42,7 @@ import com.google.common.collect.ImmutableMap;
public class ImageForVAppTemplate implements Function<VAppTemplate, Image> { public class ImageForVAppTemplate implements Function<VAppTemplate, Image> {
private final FindLocationForResource findLocationForResource; private final FindLocationForResource findLocationForResource;
private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider; private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
private NamedResource parent; private ReferenceType parent;
@Inject @Inject
protected ImageForVAppTemplate(FindLocationForResource findLocationForResource, protected ImageForVAppTemplate(FindLocationForResource findLocationForResource,
@ -51,7 +51,7 @@ public class ImageForVAppTemplate implements Function<VAppTemplate, Image> {
this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider"); this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider");
} }
public ImageForVAppTemplate withParent(NamedResource parent) { public ImageForVAppTemplate withParent(ReferenceType parent) {
this.parent = parent; this.parent = parent;
return this; return this;
} }
@ -69,8 +69,8 @@ public class ImageForVAppTemplate implements Function<VAppTemplate, Image> {
Location location = findLocationForResource.apply(checkNotNull(parent, "parent")); Location location = findLocationForResource.apply(checkNotNull(parent, "parent"));
String name = getName(from.getName()); String name = getName(from.getName());
String desc = from.getDescription() != null ? from.getDescription() : from.getName(); String desc = from.getDescription() != null ? from.getDescription() : from.getName();
return new VCloudImage(from, from.getId().toASCIIString(), name, from.getId().toASCIIString(), location, from return new VCloudImage(from, from.getHref().toASCIIString(), name, from.getHref().toASCIIString(), location, from
.getId(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from)); .getHref(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from));
} }
protected String getName(String name) { 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.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.vcloud.compute.domain.VCloudExpressImage; 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 org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -42,7 +42,7 @@ import com.google.common.collect.ImmutableMap;
public class ImageForVCloudExpressVAppTemplate implements Function<VCloudExpressVAppTemplate, Image> { public class ImageForVCloudExpressVAppTemplate implements Function<VCloudExpressVAppTemplate, Image> {
private final FindLocationForResource findLocationForResource; private final FindLocationForResource findLocationForResource;
private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider; private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
private NamedResource parent; private ReferenceType parent;
@Inject @Inject
protected ImageForVCloudExpressVAppTemplate(FindLocationForResource findLocationForResource, protected ImageForVCloudExpressVAppTemplate(FindLocationForResource findLocationForResource,
@ -51,7 +51,7 @@ public class ImageForVCloudExpressVAppTemplate implements Function<VCloudExpress
this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider"); this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider");
} }
public ImageForVCloudExpressVAppTemplate withParent(NamedResource parent) { public ImageForVCloudExpressVAppTemplate withParent(ReferenceType parent) {
this.parent = parent; this.parent = parent;
return this; return this;
} }
@ -69,8 +69,8 @@ public class ImageForVCloudExpressVAppTemplate implements Function<VCloudExpress
Location location = findLocationForResource.apply(checkNotNull(parent, "parent")); Location location = findLocationForResource.apply(checkNotNull(parent, "parent"));
String name = getName(from.getName()); String name = getName(from.getName());
String desc = from.getDescription() != null ? from.getDescription() : from.getName(); String desc = from.getDescription() != null ? from.getDescription() : from.getName();
return new VCloudExpressImage(from, from.getId().toASCIIString(), name, from.getId().toASCIIString(), location, from return new VCloudExpressImage(from, from.getHref().toASCIIString(), name, from.getHref().toASCIIString(), location, from
.getId(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from)); .getHref(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from));
} }
protected String getName(String name) { 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.logging.Logger;
import org.jclouds.vcloud.CommonVCloudClient; import org.jclouds.vcloud.CommonVCloudClient;
import org.jclouds.vcloud.compute.CommonVCloudComputeClient; 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.Status;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
@ -45,7 +45,7 @@ import com.google.inject.Inject;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Singleton @Singleton
public abstract class CommonVCloudComputeClientImpl<T, A extends NamedResource> implements CommonVCloudComputeClient { public abstract class CommonVCloudComputeClientImpl<T, A extends ReferenceType> implements CommonVCloudComputeClient {
@Resource @Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER) @Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL; 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) { protected Map<String, String> parseResponse(T template, A vAppResponse) {
Map<String, String> config = Maps.newLinkedHashMap();// Allows nulls 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("username", null);
config.put("password", null); config.put("password", null);
return config; return config;
@ -80,7 +80,7 @@ public abstract class CommonVCloudComputeClientImpl<T, A extends NamedResource>
A vApp = refreshVApp(id); A vApp = refreshVApp(id);
logger.debug(">> resetting vApp(%s)", vApp.getName()); logger.debug(">> resetting vApp(%s)", vApp.getName());
Task task = reset(vApp); 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)); throw new RuntimeException(String.format("failed to %s %s: %s", "resetVApp", vApp.getName(), task));
} }
logger.debug("<< on vApp(%s)", vApp.getName()); logger.debug("<< on vApp(%s)", vApp.getName());
@ -101,18 +101,18 @@ public abstract class CommonVCloudComputeClientImpl<T, A extends NamedResource>
private void deleteVApp(A vApp) { private void deleteVApp(A vApp) {
logger.debug(">> deleting vApp(%s)", vApp.getName()); logger.debug(">> deleting vApp(%s)", vApp.getName());
client.deleteVApp(vApp.getId()); client.deleteVApp(vApp.getHref());
} }
private A undeployVAppIfDeployed(A vApp) { private A undeployVAppIfDeployed(A vApp) {
if (getStatus(vApp).compareTo(Status.RESOLVED) > 0) { if (getStatus(vApp).compareTo(Status.RESOLVED) > 0) {
logger.debug(">> undeploying vApp(%s), current status: %s", vApp.getName(), getStatus(vApp)); logger.debug(">> undeploying vApp(%s), current status: %s", vApp.getName(), getStatus(vApp));
Task task = undeploy(vApp); Task task = undeploy(vApp);
if (!taskTester.apply(task.getId())) { if (!taskTester.apply(task.getHref())) {
// TODO timeout // TODO timeout
throw new RuntimeException(String.format("failed to %s %s: %s", "undeploy", vApp.getName(), task)); 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()); logger.debug("<< %s vApp(%s)", getStatus(vApp), vApp.getName());
} }
return vApp; return vApp;
@ -124,11 +124,11 @@ public abstract class CommonVCloudComputeClientImpl<T, A extends NamedResource>
if (getStatus(vApp).compareTo(Status.OFF) > 0) { if (getStatus(vApp).compareTo(Status.OFF) > 0) {
logger.debug(">> powering off vApp(%s), current status: %s", vApp.getName(), getStatus(vApp)); logger.debug(">> powering off vApp(%s), current status: %s", vApp.getName(), getStatus(vApp));
Task task = powerOff(vApp); Task task = powerOff(vApp);
if (!taskTester.apply(task.getId())) { if (!taskTester.apply(task.getHref())) {
// TODO timeout // TODO timeout
throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), task)); 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()); logger.debug("<< %s vApp(%s)", getStatus(vApp), vApp.getName());
} }
return vApp; return vApp;

View File

@ -67,15 +67,15 @@ public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl<VAppT
VDC vdc = client.getVDC(VDC); VDC vdc = client.getVDC(VDC);
VAppTemplate template = VCloudClient.class.cast(client).getVAppTemplate(templateId); 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); name, options);
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName()); logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
logger.debug(">> deploying 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 (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 throw new RuntimeException(String.format("failed to %s %s: %s", "deploy and power on", vAppResponse
.getName(), task)); .getName(), task));
} }
@ -109,16 +109,16 @@ public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl<VAppT
@Override @Override
protected Task powerOff(VApp vApp) { protected Task powerOff(VApp vApp) {
return VCloudClient.class.cast(client).powerOffVAppOrVm(vApp.getId()); return VCloudClient.class.cast(client).powerOffVAppOrVm(vApp.getHref());
} }
@Override @Override
protected Task reset(VApp vApp) { protected Task reset(VApp vApp) {
return VCloudClient.class.cast(client).resetVAppOrVm(vApp.getId()); return VCloudClient.class.cast(client).resetVAppOrVm(vApp.getHref());
} }
@Override @Override
protected Task undeploy(VApp vApp) { 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); VDC vdc = client.getVDC(VDC);
VCloudExpressVAppTemplate template = VCloudExpressClient.class.cast(client).getVAppTemplate(templateId); VCloudExpressVAppTemplate template = VCloudExpressClient.class.cast(client).getVAppTemplate(templateId);
VCloudExpressVApp vAppResponse = VCloudExpressClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(), VCloudExpressVApp vAppResponse = VCloudExpressClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getHref(),
template.getId(), name, options); template.getHref(), name, options);
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName()); logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
logger.debug(">> deploying 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 (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)); throw new RuntimeException(String.format("failed to %s %s: %s", "deploy", vAppResponse.getName(), task));
} }
logger.debug("<< deployed vApp(%s)", vAppResponse.getName()); logger.debug("<< deployed vApp(%s)", vAppResponse.getName());
logger.debug(">> powering vApp(%s)", vAppResponse.getName()); logger.debug(">> powering vApp(%s)", vAppResponse.getName());
task = VCloudExpressClient.class.cast(client).powerOnVApp(vAppResponse.getId()); task = VCloudExpressClient.class.cast(client).powerOnVApp(vAppResponse.getHref());
if (!taskTester.apply(task.getId())) { if (!taskTester.apply(task.getHref())) {
throw new RuntimeException(String.format("failed to %s %s: %s", "powerOn", vAppResponse.getName(), task)); throw new RuntimeException(String.format("failed to %s %s: %s", "powerOn", vAppResponse.getName(), task));
} }
logger.debug("<< on vApp(%s)", vAppResponse.getName()); logger.debug("<< on vApp(%s)", vAppResponse.getName());
@ -115,16 +115,16 @@ public class VCloudExpressComputeClientImpl extends
@Override @Override
protected Task powerOff(VCloudExpressVApp vApp) { protected Task powerOff(VCloudExpressVApp vApp) {
return VCloudExpressClient.class.cast(client).powerOffVApp(vApp.getId()); return VCloudExpressClient.class.cast(client).powerOffVApp(vApp.getHref());
} }
@Override @Override
protected Task reset(VCloudExpressVApp vApp) { protected Task reset(VCloudExpressVApp vApp) {
return VCloudExpressClient.class.cast(client).resetVApp(vApp.getId()); return VCloudExpressClient.class.cast(client).resetVApp(vApp.getHref());
} }
@Override @Override
protected Task undeploy(VCloudExpressVApp vApp) { 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) { 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 return new NodeMetadataImpl(vApp.getHref().toASCIIString(), vApp.getName(), vApp.getHref().toASCIIString(), template
.getLocation(), vApp.getId(), ImmutableMap.<String, String> of(), tag, template.getImage().getId(), .getLocation(), vApp.getHref(), ImmutableMap.<String, String> of(), tag, template.getImage().getId(),
getOperatingSystemForVAppOrDefaultTo(vApp, template.getImage().getOperatingSystem()), getOperatingSystemForVAppOrDefaultTo(vApp, template.getImage().getOperatingSystem()),
vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getId()), vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getHref()),
computeClient.getPrivateAddresses(vApp.getId()), ImmutableMap.<String, String> of(), new Credentials( computeClient.getPrivateAddresses(vApp.getHref()), ImmutableMap.<String, String> of(), new Credentials(
metaMap.get("username"), metaMap.get("password"))); 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) { 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 return new NodeMetadataImpl(vApp.getHref().toASCIIString(), vApp.getName(), vApp.getHref().toASCIIString(), template
.getLocation(), vApp.getId(), ImmutableMap.<String, String> of(), tag, template.getImage().getId(), .getLocation(), vApp.getHref(), ImmutableMap.<String, String> of(), tag, template.getImage().getId(),
getOperatingSystemForVAppOrDefaultTo(vApp, template.getImage().getOperatingSystem()), getOperatingSystemForVAppOrDefaultTo(vApp, template.getImage().getOperatingSystem()),
vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getId()), vAppStatusToNodeState.get(vApp.getStatus()), computeClient.getPublicAddresses(vApp.getHref()),
computeClient.getPrivateAddresses(vApp.getId()), ImmutableMap.<String, String> of(), new Credentials( computeClient.getPrivateAddresses(vApp.getHref()), ImmutableMap.<String, String> of(), new Credentials(
metaMap.get("username"), metaMap.get("password"))); metaMap.get("username"), metaMap.get("password")));
} }

View File

@ -84,7 +84,7 @@ public class VCloudExpressGetNodeMetadataStrategy implements GetNodeMetadataStra
return null; return null;
String tag = parseTagFromName(from.getName()); String tag = parseTagFromName(from.getName());
Location location = findLocationForResourceInVDC.apply(from.getVDC()); 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 tag, null, from.getOsType() != null ? new CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(from
.getOsType()), null, null, from.getOperatingSystemDescription()) : null, vAppStatusToNodeState .getOsType()), null, null, from.getOperatingSystemDescription()) : null, vAppStatusToNodeState
.get(from.getStatus()), computeClient.getPublicAddresses(id), computeClient .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.CommonVCloudClient;
import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.compute.functions.FindLocationForResource; 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 org.jclouds.vcloud.endpoints.Org;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
@ -71,11 +71,11 @@ public class VCloudExpressListNodesStrategy implements ListNodesStrategy {
this.blackListVAppNames = ImmutableSet.copyOf(Splitter.on(',').split(blackListNodes)); this.blackListVAppNames = ImmutableSet.copyOf(Splitter.on(',').split(blackListNodes));
} }
private final Supplier<Map<String, NamedResource>> orgNameToEndpoint; private final Supplier<Map<String, ReferenceType>> orgNameToEndpoint;
@Inject @Inject
protected VCloudExpressListNodesStrategy(CommonVCloudClient client, protected VCloudExpressListNodesStrategy(CommonVCloudClient client,
@Org Supplier<Map<String, NamedResource>> orgNameToEndpoint, VCloudExpressGetNodeMetadataStrategy getNodeMetadata, @Org Supplier<Map<String, ReferenceType>> orgNameToEndpoint, VCloudExpressGetNodeMetadataStrategy getNodeMetadata,
FindLocationForResource findLocationForResourceInVDC) { FindLocationForResource findLocationForResourceInVDC) {
this.client = client; this.client = client;
this.orgNameToEndpoint = orgNameToEndpoint; this.orgNameToEndpoint = orgNameToEndpoint;
@ -87,8 +87,8 @@ public class VCloudExpressListNodesStrategy implements ListNodesStrategy {
public Iterable<ComputeMetadata> list() { public Iterable<ComputeMetadata> list() {
Set<ComputeMetadata> nodes = Sets.newHashSet(); Set<ComputeMetadata> nodes = Sets.newHashSet();
for (String org : orgNameToEndpoint.get().keySet()) { for (String org : orgNameToEndpoint.get().keySet()) {
for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) { for (ReferenceType vdc : client.findOrgNamed(org).getVDCs().values()) {
for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) { for (ReferenceType resource : client.getVDC(vdc.getHref()).getResourceEntities().values()) {
if (validVApp(resource)) { if (validVApp(resource)) {
nodes.add(convertVAppToComputeMetadata(vdc, resource)); nodes.add(convertVAppToComputeMetadata(vdc, resource));
} }
@ -98,22 +98,22 @@ public class VCloudExpressListNodesStrategy implements ListNodesStrategy {
return nodes; return nodes;
} }
private boolean validVApp(NamedResource resource) { private boolean validVApp(ReferenceType resource) {
return resource.getType().equals(VCloudMediaType.VAPP_XML) && !blackListVAppNames.contains(resource.getName()); 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); Location location = findLocationForResourceInVDC.apply(vdc);
return new ComputeMetadataImpl(ComputeType.NODE, resource.getId().toASCIIString(), resource.getName(), resource return new ComputeMetadataImpl(ComputeType.NODE, resource.getHref().toASCIIString(), resource.getName(), resource
.getId().toASCIIString(), location, null, ImmutableMap.<String, String> of()); .getHref().toASCIIString(), location, null, ImmutableMap.<String, String> of());
} }
@Override @Override
public Iterable<NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) { public Iterable<NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) {
Set<NodeMetadata> nodes = Sets.newHashSet(); Set<NodeMetadata> nodes = Sets.newHashSet();
for (String org : orgNameToEndpoint.get().keySet()) { for (String org : orgNameToEndpoint.get().keySet()) {
for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) { for (ReferenceType vdc : client.findOrgNamed(org).getVDCs().values()) {
for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) { for (ReferenceType resource : client.getVDC(vdc.getHref()).getResourceEntities().values()) {
if (validVApp(resource) && filter.apply(convertVAppToComputeMetadata(vdc, resource))) { if (validVApp(resource) && filter.apply(convertVAppToComputeMetadata(vdc, resource))) {
addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource); addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource);
} }
@ -124,12 +124,12 @@ public class VCloudExpressListNodesStrategy implements ListNodesStrategy {
} }
@VisibleForTesting @VisibleForTesting
void addVAppToSetRetryingIfNotYetPresent(Set<NodeMetadata> nodes, NamedResource vdc, NamedResource resource) { void addVAppToSetRetryingIfNotYetPresent(Set<NodeMetadata> nodes, ReferenceType vdc, ReferenceType resource) {
NodeMetadata node = null; NodeMetadata node = null;
int i = 0; int i = 0;
while (node == null && i++ < 3) { while (node == null && i++ < 3) {
try { try {
node = getNodeMetadata.execute(resource.getId().toASCIIString()); node = getNodeMetadata.execute(resource.getHref().toASCIIString());
nodes.add(node); nodes.add(node);
} catch (NullPointerException e) { } catch (NullPointerException e) {
logger.warn("vApp %s not yet present in vdc %s", resource.getName(), vdc.getName()); 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) { public NodeMetadata execute(String in) {
URI id = URI.create(checkNotNull(in, "node.id")); URI id = URI.create(checkNotNull(in, "node.id"));
Task task = client.resetVApp(id); Task task = client.resetVApp(id);
taskTester.apply(task.getId()); taskTester.apply(task.getHref());
return getNode.execute(in); return getNode.execute(in);
} }
} }

View File

@ -85,7 +85,7 @@ public class VCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy {
return null; return null;
String tag = parseTagFromName(from.getName()); String tag = parseTagFromName(from.getName());
Location location = findLocationForResourceInVDC.apply(from.getVDC()); 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), tag, null, getOperatingSystemForVAppOrDefaultTo(from, null),
vAppStatusToNodeState.get(from.getStatus()), computeClient.getPublicAddresses(id), computeClient vAppStatusToNodeState.get(from.getStatus()), computeClient.getPublicAddresses(id), computeClient
.getPrivateAddresses(id), getExtra.apply(from), null); .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.CommonVCloudClient;
import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.compute.functions.FindLocationForResource; 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 org.jclouds.vcloud.endpoints.Org;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
@ -71,11 +71,11 @@ public class VCloudListNodesStrategy implements ListNodesStrategy {
this.blackListVAppNames = ImmutableSet.copyOf(Splitter.on(',').split(blackListNodes)); this.blackListVAppNames = ImmutableSet.copyOf(Splitter.on(',').split(blackListNodes));
} }
private final Supplier<Map<String, NamedResource>> orgNameToEndpoint; private final Supplier<Map<String, ReferenceType>> orgNameToEndpoint;
@Inject @Inject
protected VCloudListNodesStrategy(CommonVCloudClient client, protected VCloudListNodesStrategy(CommonVCloudClient client,
@Org Supplier<Map<String, NamedResource>> orgNameToEndpoint, VCloudGetNodeMetadataStrategy getNodeMetadata, @Org Supplier<Map<String, ReferenceType>> orgNameToEndpoint, VCloudGetNodeMetadataStrategy getNodeMetadata,
FindLocationForResource findLocationForResourceInVDC) { FindLocationForResource findLocationForResourceInVDC) {
this.client = client; this.client = client;
this.orgNameToEndpoint = orgNameToEndpoint; this.orgNameToEndpoint = orgNameToEndpoint;
@ -87,8 +87,8 @@ public class VCloudListNodesStrategy implements ListNodesStrategy {
public Iterable<ComputeMetadata> list() { public Iterable<ComputeMetadata> list() {
Set<ComputeMetadata> nodes = Sets.newHashSet(); Set<ComputeMetadata> nodes = Sets.newHashSet();
for (String org : orgNameToEndpoint.get().keySet()) { for (String org : orgNameToEndpoint.get().keySet()) {
for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) { for (ReferenceType vdc : client.findOrgNamed(org).getVDCs().values()) {
for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) { for (ReferenceType resource : client.getVDC(vdc.getHref()).getResourceEntities().values()) {
if (validVApp(resource)) { if (validVApp(resource)) {
nodes.add(convertVAppToComputeMetadata(vdc, resource)); nodes.add(convertVAppToComputeMetadata(vdc, resource));
} }
@ -98,22 +98,22 @@ public class VCloudListNodesStrategy implements ListNodesStrategy {
return nodes; return nodes;
} }
private boolean validVApp(NamedResource resource) { private boolean validVApp(ReferenceType resource) {
return resource.getType().equals(VCloudMediaType.VAPP_XML) && !blackListVAppNames.contains(resource.getName()); 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); Location location = findLocationForResourceInVDC.apply(vdc);
return new ComputeMetadataImpl(ComputeType.NODE, resource.getId().toASCIIString(), resource.getName(), resource return new ComputeMetadataImpl(ComputeType.NODE, resource.getHref().toASCIIString(), resource.getName(), resource
.getId().toASCIIString(), location, null, ImmutableMap.<String, String> of()); .getHref().toASCIIString(), location, null, ImmutableMap.<String, String> of());
} }
@Override @Override
public Iterable<NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) { public Iterable<NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) {
Set<NodeMetadata> nodes = Sets.newHashSet(); Set<NodeMetadata> nodes = Sets.newHashSet();
for (String org : orgNameToEndpoint.get().keySet()) { for (String org : orgNameToEndpoint.get().keySet()) {
for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) { for (ReferenceType vdc : client.findOrgNamed(org).getVDCs().values()) {
for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) { for (ReferenceType resource : client.getVDC(vdc.getHref()).getResourceEntities().values()) {
if (validVApp(resource) && filter.apply(convertVAppToComputeMetadata(vdc, resource))) { if (validVApp(resource) && filter.apply(convertVAppToComputeMetadata(vdc, resource))) {
addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource); addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource);
} }
@ -124,12 +124,12 @@ public class VCloudListNodesStrategy implements ListNodesStrategy {
} }
@VisibleForTesting @VisibleForTesting
void addVAppToSetRetryingIfNotYetPresent(Set<NodeMetadata> nodes, NamedResource vdc, NamedResource resource) { void addVAppToSetRetryingIfNotYetPresent(Set<NodeMetadata> nodes, ReferenceType vdc, ReferenceType resource) {
NodeMetadata node = null; NodeMetadata node = null;
int i = 0; int i = 0;
while (node == null && i++ < 3) { while (node == null && i++ < 3) {
try { try {
node = getNodeMetadata.execute(resource.getId().toASCIIString()); node = getNodeMetadata.execute(resource.getHref().toASCIIString());
nodes.add(node); nodes.add(node);
} catch (NullPointerException e) { } catch (NullPointerException e) {
logger.warn("vApp %s not yet present in vdc %s", resource.getName(), vdc.getName()); 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) { public NodeMetadata execute(String in) {
URI id = URI.create(checkNotNull(in, "node.id")); URI id = URI.create(checkNotNull(in, "node.id"));
Task task = client.resetVAppOrVm(id); Task task = client.resetVAppOrVm(id);
taskTester.apply(task.getId()); taskTester.apply(task.getHref());
return getNode.execute(in); return getNode.execute(in);
} }
} }

View File

@ -29,7 +29,7 @@ import org.jclouds.domain.Location;
import org.jclouds.domain.LocationScope; import org.jclouds.domain.LocationScope;
import org.jclouds.domain.internal.LocationImpl; import org.jclouds.domain.internal.LocationImpl;
import org.jclouds.vcloud.compute.domain.VCloudLocation; 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 org.jclouds.vcloud.domain.Org;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
@ -41,12 +41,12 @@ import com.google.common.collect.Sets;
@Singleton @Singleton
public class OrgAndVDCToLocationSupplier implements Supplier<Set<? extends Location>> { public class OrgAndVDCToLocationSupplier implements Supplier<Set<? extends Location>> {
private final String providerName; 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; private final Supplier<Map<String, ? extends Org>> orgNameToVDCResource;
@Inject @Inject
OrgAndVDCToLocationSupplier(@org.jclouds.rest.annotations.Provider String providerName, 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) { Supplier<Map<String, ? extends Org>> orgNameToVDCResource) {
this.providerName = providerName; this.providerName = providerName;
this.orgNameToResource = orgNameToResource; this.orgNameToResource = orgNameToResource;
@ -58,9 +58,9 @@ public class OrgAndVDCToLocationSupplier implements Supplier<Set<? extends Locat
Location provider = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null); Location provider = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
Set<Location> locations = Sets.newLinkedHashSet(); Set<Location> locations = Sets.newLinkedHashSet();
for (NamedResource org : orgNameToResource.get().values()) { for (ReferenceType org : orgNameToResource.get().values()) {
Location orgL = new VCloudLocation(org, provider); 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)); 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.VCloudToken;
import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem; 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.Org;
import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VCloudSession;
import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.VDC;
@ -162,7 +162,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Singleton @Singleton
protected URI provideDefaultVDC(Org org) { protected URI provideDefaultVDC(Org org) {
checkState(org.getVDCs().size() > 0, "No vdcs present in org: " + org.getName()); 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 @Provides
@ -170,7 +170,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Singleton @Singleton
protected URI provideCatalog(Org org, @Named(PROPERTY_IDENTITY) String user) { protected URI provideCatalog(Org org, @Named(PROPERTY_IDENTITY) String user) {
checkState(org.getCatalogs().size() > 0, "No catalogs present in org: " + org.getName()); 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 @Provides
@ -246,26 +246,26 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Provides @Provides
@org.jclouds.vcloud.endpoints.Org @org.jclouds.vcloud.endpoints.Org
@Singleton @Singleton
protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable<NamedResource> orgs) { protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable<ReferenceType> orgs) {
return getLast(orgs).getId(); return getLast(orgs).getHref();
} }
@Provides @Provides
@org.jclouds.vcloud.endpoints.Org @org.jclouds.vcloud.endpoints.Org
@Singleton @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(); return getLast(orgs).getName();
} }
@Provides @Provides
@org.jclouds.vcloud.endpoints.Org @org.jclouds.vcloud.endpoints.Org
@Singleton @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) { final OrgNameToOrgSupplier supplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, NamedResource>>(authException, return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, ReferenceType>>(authException,
seconds, new Supplier<Map<String, NamedResource>>() { seconds, new Supplier<Map<String, ReferenceType>>() {
@Override @Override
public Map<String, NamedResource> get() { public Map<String, ReferenceType> get() {
return supplier.get(); return supplier.get();
} }
}); });
@ -310,7 +310,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Override @Override
public URI apply(org.jclouds.vcloud.domain.VDC from) { 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 @Provides
@org.jclouds.vcloud.endpoints.Org @org.jclouds.vcloud.endpoints.Org
@Singleton @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(); VCloudSession discovery = cache.get();
checkState(discovery.getOrgs().size() > 0, "No orgs present for user: " + user); checkState(discovery.getOrgs().size() > 0, "No orgs present for user: " + user);
return discovery.getOrgs().values(); return discovery.getOrgs().values();
@ -329,10 +329,10 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
protected AtomicReference<AuthorizationException> authException = new AtomicReference<AuthorizationException>(); 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 @Override
public String apply(NamedResource from) { public String apply(ReferenceType from) {
return from.getName(); return from.getName();
} }
@ -351,7 +351,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
} }
@Singleton @Singleton
private static class OrgNameToOrgSupplier implements Supplier<Map<String, NamedResource>> { private static class OrgNameToOrgSupplier implements Supplier<Map<String, ReferenceType>> {
private final Supplier<VCloudSession> sessionSupplier; private final Supplier<VCloudSession> sessionSupplier;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ -361,7 +361,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
} }
@Override @Override
public Map<String, NamedResource> get() { public Map<String, ReferenceType> get() {
return sessionSupplier.get().getOrgs(); return sessionSupplier.get().getOrgs();
} }
@ -396,9 +396,9 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
throw authException.get(); throw authException.get();
try { try {
org.jclouds.vcloud.domain.VDC vDC = client.findVDCInOrgNamed(null, null); 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()); 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) { } catch (AuthorizationException e) {
authException.set(e); authException.set(e);
throw e; throw e;
@ -541,7 +541,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@TasksList @TasksList
@Singleton @Singleton
protected URI provideDefaultTasksList(Org org) { protected URI provideDefaultTasksList(Org org) {
return org.getTasksList().getId(); return org.getTasksList().getHref();
} }
@Override @Override

View File

@ -33,14 +33,14 @@ import com.google.inject.ImplementedBy;
*/ */
@org.jclouds.vcloud.endpoints.Catalog @org.jclouds.vcloud.endpoints.Catalog
@ImplementedBy(CatalogImpl.class) @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. * Reference to the org containing this vDC.
* *
* @since vcloud api 1.0 * @since vcloud api 1.0
* @return org, or null if this is a version before 1.0 where the org isn't present * @return org, or null if this is a version before 1.0 where the org isn't present
*/ */
NamedResource getOrg(); ReferenceType getOrg();
/** /**
* optional description * optional description

View File

@ -29,11 +29,11 @@ import com.google.inject.ImplementedBy;
* @author Adrian Cole * @author Adrian Cole
*/ */
@ImplementedBy(CatalogItemImpl.class) @ImplementedBy(CatalogItemImpl.class)
public interface CatalogItem extends NamedResource { public interface CatalogItem extends ReferenceType {
String getDescription(); String getDescription();
NamedResource getEntity(); ReferenceType getEntity();
Map<String, String> getProperties(); Map<String, String> getProperties();

View File

@ -38,7 +38,7 @@ import com.google.inject.ImplementedBy;
* @author Adrian Cole * @author Adrian Cole
*/ */
@ImplementedBy(OrgImpl.class) @ImplementedBy(OrgImpl.class)
public interface Org extends NamedResource { public interface Org extends ReferenceType {
/** /**
* optional description * optional description
* *
@ -58,12 +58,12 @@ public interface Org extends NamedResource {
/** /**
* @since vcloud api 0.8 * @since vcloud api 0.8
*/ */
Map<String, NamedResource> getCatalogs(); Map<String, ReferenceType> getCatalogs();
/** /**
* @since vcloud api 0.8 * @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 * 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 * @since vcloud api 0.8
*/ */
@Nullable @Nullable
NamedResource getTasksList(); ReferenceType getTasksList();
/** /**
* @since vcloud api 1.0 * @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, * 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 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; 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 * @author Adrian Cole
* *
*/ */
@ImplementedBy(NamedResourceImpl.class) @ImplementedBy(ReferenceTypeImpl.class)
public interface NamedResource extends Comparable<NamedResource> { public interface ReferenceType extends Comparable<ReferenceType> {
URI getId(); /**
* @return hyperlink to the referenced object
*/
URI getHref();
/**
* @return name of the referenced object.
*
*/
String getName(); String getName();
/**
* @return object type, expressed as the media type of the XML representing of the object
* @see VCloudMediaType
*/
String getType(); String getType();
} }

View File

@ -33,7 +33,7 @@ import com.google.inject.ImplementedBy;
* objects XML representation. This element is readonly. * objects XML representation. This element is readonly.
*/ */
@ImplementedBy(TaskImpl.class) @ImplementedBy(TaskImpl.class)
public interface Task extends NamedResource { public interface Task extends ReferenceType {
/** /**
* The current status of the task. * 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 * 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. * 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 * error message or related information returned by the task

View File

@ -32,14 +32,14 @@ import javax.annotation.Nullable;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface VApp extends NamedResource { public interface VApp extends ReferenceType {
/** /**
* Reference to the vdc containing this vApp. * Reference to the vdc containing this vApp.
* *
* @since vcloud api 1.0 * @since vcloud api 1.0
* @return vdc, or null if this is a version before 1.0 where the org isn't present * @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 * The creation status of the vDC

View File

@ -35,14 +35,14 @@ import com.google.inject.ImplementedBy;
* @author Adrian Cole * @author Adrian Cole
*/ */
@ImplementedBy(VAppTemplateImpl.class) @ImplementedBy(VAppTemplateImpl.class)
public interface VAppTemplate extends NamedResource { public interface VAppTemplate extends ReferenceType {
/** /**
* Reference to the VDC containing this template. * Reference to the VDC containing this template.
* *
* @since vcloud api 1.0 * @since vcloud api 1.0
* @return org, or null if this is a version before 1.0 where the vdc isn't present * @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. * @return creation status of the VAppTemplate.

View File

@ -36,8 +36,8 @@ import com.google.inject.ImplementedBy;
* @author Adrian Cole * @author Adrian Cole
*/ */
@ImplementedBy(VCloudExpressVAppImpl.class) @ImplementedBy(VCloudExpressVAppImpl.class)
public interface VCloudExpressVApp extends NamedResource { public interface VCloudExpressVApp extends ReferenceType {
NamedResource getVDC(); ReferenceType getVDC();
Status getStatus(); Status getStatus();

View File

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

View File

@ -28,5 +28,5 @@ import java.util.Map;
public interface VCloudSession { public interface VCloudSession {
String getVCloudToken(); 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 @org.jclouds.vcloud.endpoints.VDC
@ImplementedBy(VDCImpl.class) @ImplementedBy(VDCImpl.class)
public interface VDC extends NamedResource { public interface VDC extends ReferenceType {
/** /**
* Reference to the org containing this vDC. * Reference to the org containing this vDC.
* *
* @since vcloud api 1.0 * @since vcloud api 1.0
* @return org, or null if this is a version before 1.0 where the org isn't present * @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 * The creation status of the vDC
@ -107,14 +107,14 @@ public interface VDC extends NamedResource {
* *
* @since vcloud api 0.8 * @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 * container for OrgNetwork elements that represent organization networks contained by the vDC
* *
* @since vcloud api 0.8 * @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 * 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 * @author Adrian Cole
*/ */
public interface Vm extends NamedResource { public interface Vm extends ReferenceType {
/** /**
* Reference to the {@link VApp} or {@link VAppTemplate} containing this vm. * Reference to the {@link VApp} or {@link VAppTemplate} containing this vm.
* *
* @since vcloud api 1.0 * @since vcloud api 1.0
*/ */
NamedResource getParent(); ReferenceType getParent();
/** /**
* @return creation status of the Vm or null, if a part of a VAppTemplate * @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 java.util.Map;
import org.jclouds.vcloud.domain.Catalog; 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.Task;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@ -40,26 +40,26 @@ import com.google.inject.internal.Nullable;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class CatalogImpl extends LinkedHashMap<String, NamedResource> implements Catalog { public class CatalogImpl extends LinkedHashMap<String, ReferenceType> implements Catalog {
/** The serialVersionUID */ /** The serialVersionUID */
private static final long serialVersionUID = 8464716396538298809L; private static final long serialVersionUID = 8464716396538298809L;
private final String name; private final String name;
private final String type; private final String type;
private final URI id; private final URI href;
private final NamedResource org; private final ReferenceType org;
@Nullable @Nullable
private final String description; private final String description;
private final List<Task> tasks = Lists.newArrayList(); private final List<Task> tasks = Lists.newArrayList();
private final boolean published; private final boolean published;
public CatalogImpl(String name, String type, URI id, NamedResource org, @Nullable String description, public CatalogImpl(String name, String type, URI href, ReferenceType org, @Nullable String description,
Map<String, NamedResource> contents, Iterable<Task> tasks, boolean published) { Map<String, ReferenceType> contents, Iterable<Task> tasks, boolean published) {
this.name = checkNotNull(name, "name"); this.name = checkNotNull(name, "name");
this.type = checkNotNull(type, "type"); this.type = checkNotNull(type, "type");
this.org = org;// TODO: once <1.0 is killed check not null this.org = org;// TODO: once <1.0 is killed check not null
this.description = description; this.description = description;
this.id = checkNotNull(id, "id"); this.href = checkNotNull(href, "href");
putAll(checkNotNull(contents, "contents")); putAll(checkNotNull(contents, "contents"));
Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks")); Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
this.published = published; this.published = published;
@ -69,8 +69,8 @@ public class CatalogImpl extends LinkedHashMap<String, NamedResource> implements
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public URI getId() { public URI getHref() {
return id; return href;
} }
/** /**
@ -85,7 +85,7 @@ public class CatalogImpl extends LinkedHashMap<String, NamedResource> implements
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public NamedResource getOrg() { public ReferenceType getOrg() {
return org; return org;
} }
@ -125,7 +125,7 @@ public class CatalogImpl extends LinkedHashMap<String, NamedResource> implements
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
result = prime * result + ((description == null) ? 0 : description.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 + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((org == null) ? 0 : org.hashCode()); result = prime * result + ((org == null) ? 0 : org.hashCode());
result = prime * result + ((tasks == null) ? 0 : tasks.hashCode()); result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
@ -147,10 +147,10 @@ public class CatalogImpl extends LinkedHashMap<String, NamedResource> implements
return false; return false;
} else if (!description.equals(other.description)) } else if (!description.equals(other.description))
return false; return false;
if (id == null) { if (href == null) {
if (other.id != null) if (other.href != null)
return false; return false;
} else if (!id.equals(other.id)) } else if (!href.equals(other.href))
return false; return false;
if (name == null) { if (name == null) {
if (other.name != null) if (other.name != null)
@ -176,8 +176,8 @@ public class CatalogImpl extends LinkedHashMap<String, NamedResource> implements
} }
@Override @Override
public int compareTo(NamedResource o) { public int compareTo(ReferenceType o) {
return (this == o) ? 0 : getId().compareTo(o.getId()); 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.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.NamedResource; import org.jclouds.vcloud.domain.ReferenceType;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -37,15 +37,15 @@ import com.google.common.collect.Maps;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class CatalogItemImpl extends NamedResourceImpl implements CatalogItem { public class CatalogItemImpl extends ReferenceTypeImpl implements CatalogItem {
/** The serialVersionUID */ /** The serialVersionUID */
private static final long serialVersionUID = 8464716396538298809L; private static final long serialVersionUID = 8464716396538298809L;
private final String description; private final String description;
private final NamedResource entity; private final ReferenceType entity;
private final Map<String, String> properties = Maps.newLinkedHashMap(); 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) { Map<String, String> properties) {
super(name, VCloudExpressMediaType.CATALOGITEM_XML, id); super(name, VCloudExpressMediaType.CATALOGITEM_XML, id);
this.description = description; this.description = description;
@ -58,7 +58,7 @@ public class CatalogItemImpl extends NamedResourceImpl implements CatalogItem {
return VCloudExpressMediaType.CATALOGITEM_XML; return VCloudExpressMediaType.CATALOGITEM_XML;
} }
public NamedResource getEntity() { public ReferenceType getEntity() {
return entity; return entity;
} }
@ -73,7 +73,7 @@ public class CatalogItemImpl extends NamedResourceImpl implements CatalogItem {
@Override @Override
public String toString() { 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 + "]"; + getDescription() + ", entity=" + entity + ", properties=" + properties + "]";
} }

View File

@ -27,7 +27,7 @@ import java.util.Map;
import javax.annotation.Nullable; 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.Org;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
@ -41,19 +41,19 @@ import com.google.common.collect.Maps;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class OrgImpl extends NamedResourceImpl implements Org { public class OrgImpl extends ReferenceTypeImpl implements Org {
private final String fullName; private final String fullName;
@Nullable @Nullable
private final String description; private final String description;
private final Map<String, NamedResource> catalogs = Maps.newLinkedHashMap(); private final Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
private final Map<String, NamedResource> vdcs = Maps.newLinkedHashMap(); private final Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
private final Map<String, NamedResource> networks = Maps.newLinkedHashMap(); private final Map<String, ReferenceType> networks = Maps.newLinkedHashMap();
private final NamedResource tasksList; private final ReferenceType tasksList;
private final List<Task> tasks = Lists.newArrayList(); private final List<Task> tasks = Lists.newArrayList();
public OrgImpl(String name, String type, URI id, String fullName, String description, public OrgImpl(String name, String type, URI id, String fullName, String description,
Map<String, NamedResource> catalogs, Map<String, NamedResource> vdcs, Map<String, NamedResource> networks, Map<String, ReferenceType> catalogs, Map<String, ReferenceType> vdcs, Map<String, ReferenceType> networks,
@Nullable NamedResource tasksList, Iterable<Task> tasks) { @Nullable ReferenceType tasksList, Iterable<Task> tasks) {
super(name, type, id); super(name, type, id);
this.fullName = checkNotNull(fullName, "fullName"); this.fullName = checkNotNull(fullName, "fullName");
this.description = description; this.description = description;
@ -75,22 +75,22 @@ public class OrgImpl extends NamedResourceImpl implements Org {
} }
@Override @Override
public Map<String, NamedResource> getCatalogs() { public Map<String, ReferenceType> getCatalogs() {
return catalogs; return catalogs;
} }
@Override @Override
public Map<String, NamedResource> getVDCs() { public Map<String, ReferenceType> getVDCs() {
return vdcs; return vdcs;
} }
@Override @Override
public Map<String, NamedResource> getNetworks() { public Map<String, ReferenceType> getNetworks() {
return networks; return networks;
} }
@Override @Override
public NamedResource getTasksList() { public ReferenceType getTasksList() {
return tasksList; return tasksList;
} }
@ -161,13 +161,13 @@ public class OrgImpl extends NamedResourceImpl implements Org {
} }
@Override @Override
public int compareTo(NamedResource o) { public int compareTo(ReferenceType o) {
return (this == o) ? 0 : getId().compareTo(o.getId()); return (this == o) ? 0 : getHref().compareTo(o.getHref());
} }
@Override @Override
public String toString() { 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 java.net.URI;
import org.jclouds.vcloud.domain.NamedResource; import org.jclouds.vcloud.domain.ReferenceType;
/** /**
* Location of a Rest resource * Location of a Rest resource
@ -29,15 +29,15 @@ import org.jclouds.vcloud.domain.NamedResource;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class NamedResourceImpl implements NamedResource { public class ReferenceTypeImpl implements ReferenceType {
private final String name; private final String name;
private final String type; 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.name = name;
this.type = type; this.type = type;
this.id = id; this.href = href;
} }
@Override @Override
@ -51,20 +51,20 @@ public class NamedResourceImpl implements NamedResource {
} }
@Override @Override
public URI getId() { public URI getHref() {
return id; return href;
} }
@Override @Override
public int compareTo(NamedResource that) { public int compareTo(ReferenceType that) {
return (this == that) ? 0 : getId().compareTo(that.getId()); return (this == that) ? 0 : getHref().compareTo(that.getHref());
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; 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 + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode());
return result; return result;
@ -78,11 +78,11 @@ public class NamedResourceImpl implements NamedResource {
return false; return false;
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
NamedResourceImpl other = (NamedResourceImpl) obj; ReferenceTypeImpl other = (ReferenceTypeImpl) obj;
if (id == null) { if (href == null) {
if (other.id != null) if (other.href != null)
return false; return false;
} else if (!id.equals(other.id)) } else if (!href.equals(other.href))
return false; return false;
if (name == null) { if (name == null) {
if (other.name != null) if (other.name != null)
@ -99,6 +99,6 @@ public class NamedResourceImpl implements NamedResource {
@Override @Override
public String toString() { 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 java.util.Date;
import org.jclouds.vcloud.VCloudMediaType; 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.Task;
import org.jclouds.vcloud.domain.TaskStatus; import org.jclouds.vcloud.domain.TaskStatus;
@ -36,7 +36,7 @@ import com.google.inject.internal.Nullable;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class TaskImpl extends NamedResourceImpl implements Task { public class TaskImpl extends ReferenceTypeImpl implements Task {
public static class ErrorImpl implements Error { public static class ErrorImpl implements Error {
private final String message; private final String message;
@ -136,12 +136,12 @@ public class TaskImpl extends NamedResourceImpl implements Task {
private final Date endTime; private final Date endTime;
@Nullable @Nullable
private final Date expiryTime; private final Date expiryTime;
private final NamedResource owner; private final ReferenceType owner;
@Nullable @Nullable
private final Error error; private final Error error;
public TaskImpl(URI id, TaskStatus status, Date startTime, @Nullable Date endTime, @Nullable Date expiryTime, 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); super(null, VCloudMediaType.TASK_XML, id);
this.status = checkNotNull(status, "status"); this.status = checkNotNull(status, "status");
this.startTime = startTime; this.startTime = startTime;
@ -162,7 +162,7 @@ public class TaskImpl extends NamedResourceImpl implements Task {
} }
@Override @Override
public NamedResource getOwner() { public ReferenceType getOwner() {
return owner; return owner;
} }

View File

@ -27,7 +27,7 @@ import java.util.Set;
import javax.annotation.Nullable; 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.Status;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VApp;
@ -43,17 +43,17 @@ import com.google.common.collect.Sets;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class VAppImpl extends NamedResourceImpl implements VApp { public class VAppImpl extends ReferenceTypeImpl implements VApp {
private final Status status; private final Status status;
private final NamedResource vdc; private final ReferenceType vdc;
@Nullable @Nullable
private final String description; private final String description;
private final List<Task> tasks = Lists.newArrayList(); private final List<Task> tasks = Lists.newArrayList();
private final boolean ovfDescriptorUploaded; private final boolean ovfDescriptorUploaded;
private final Set<Vm> children = Sets.newLinkedHashSet(); 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) { Iterable<Task> tasks, boolean ovfDescriptorUploaded, Iterable<? extends Vm> children) {
super(name, type, id); super(name, type, id);
this.status = checkNotNull(status, "status"); this.status = checkNotNull(status, "status");
@ -76,7 +76,7 @@ public class VAppImpl extends NamedResourceImpl implements VApp {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public NamedResource getVDC() { public ReferenceType getVDC() {
return vdc; return vdc;
} }
@ -160,7 +160,7 @@ public class VAppImpl extends NamedResourceImpl implements VApp {
@Override @Override
public String toString() { public String toString() {
return "[id=" + getId() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status=" return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status="
+ status + "]"; + status + "]";
} }

View File

@ -27,7 +27,7 @@ import java.util.Set;
import javax.annotation.Nullable; 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.Status;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VAppTemplate; import org.jclouds.vcloud.domain.VAppTemplate;
@ -43,10 +43,10 @@ import com.google.common.collect.Sets;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate { public class VAppTemplateImpl extends ReferenceTypeImpl implements VAppTemplate {
private final Status status; private final Status status;
private final NamedResource vdc; private final ReferenceType vdc;
@Nullable @Nullable
private final String description; private final String description;
private final List<Task> tasks = Lists.newArrayList(); private final List<Task> tasks = Lists.newArrayList();
@ -54,7 +54,7 @@ public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate
private final String vAppScopedLocalId; private final String vAppScopedLocalId;
private final Set<Vm> children = Sets.newLinkedHashSet(); 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 description, Iterable<Task> tasks, boolean ovfDescriptorUploaded,
@Nullable String vAppScopedLocalId, Iterable<? extends Vm> children) { @Nullable String vAppScopedLocalId, Iterable<? extends Vm> children) {
super(name, type, id); super(name, type, id);
@ -79,7 +79,7 @@ public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public NamedResource getVDC() { public ReferenceType getVDC() {
return vdc; return vdc;
} }
@ -177,7 +177,7 @@ public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate
@Override @Override
public String toString() { public String toString() {
return "[id=" + getId() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status=" return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status="
+ status + "]"; + status + "]";
} }

View File

@ -25,10 +25,10 @@ import java.net.URI;
import java.util.Set; import java.util.Set;
import org.jclouds.vcloud.VCloudExpressMediaType; 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.ResourceAllocation;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VirtualSystem; import org.jclouds.vcloud.domain.VirtualSystem;
import com.google.common.collect.ListMultimap; import com.google.common.collect.ListMultimap;
@ -40,8 +40,8 @@ import com.google.common.collect.ListMultimap;
*/ */
public class VCloudExpressVAppImpl implements VCloudExpressVApp { public class VCloudExpressVAppImpl implements VCloudExpressVApp {
private final String name; private final String name;
private final URI id; private final URI href;
private final NamedResource vDC; private final ReferenceType vDC;
private final Status status; private final Status status;
private final Long size; private final Long size;
private final ListMultimap<String, String> networkToAddresses; private final ListMultimap<String, String> networkToAddresses;
@ -53,11 +53,11 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp {
/** The serialVersionUID */ /** The serialVersionUID */
private static final long serialVersionUID = 8464716396538298809L; 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, ListMultimap<String, String> networkToAddresses, Integer osType, String operatingSystemDescription,
VirtualSystem system, Set<ResourceAllocation> resourceAllocations) { VirtualSystem system, Set<ResourceAllocation> resourceAllocations) {
this.name = checkNotNull(name, "name"); this.name = checkNotNull(name, "name");
this.id = checkNotNull(id, "id"); this.href = checkNotNull(href, "href");
this.status = checkNotNull(status, "status"); this.status = checkNotNull(status, "status");
this.size = size; this.size = size;
this.vDC = vDC; this.vDC = vDC;
@ -99,7 +99,7 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp {
} }
@Override @Override
public NamedResource getVDC() { public ReferenceType getVDC() {
return vDC; return vDC;
} }
@ -107,7 +107,7 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; 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 + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((networkToAddresses == null) ? 0 : networkToAddresses.hashCode()); result = prime * result + ((networkToAddresses == null) ? 0 : networkToAddresses.hashCode());
result = prime * result + ((operatingSystemDescription == null) ? 0 : operatingSystemDescription.hashCode()); result = prime * result + ((operatingSystemDescription == null) ? 0 : operatingSystemDescription.hashCode());
@ -129,10 +129,10 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
VCloudExpressVAppImpl other = (VCloudExpressVAppImpl) obj; VCloudExpressVAppImpl other = (VCloudExpressVAppImpl) obj;
if (id == null) { if (href == null) {
if (other.id != null) if (other.href != null)
return false; return false;
} else if (!id.equals(other.id)) } else if (!href.equals(other.href))
return false; return false;
if (name == null) { if (name == null) {
if (other.name != null) if (other.name != null)
@ -188,8 +188,8 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp {
} }
@Override @Override
public URI getId() { public URI getHref() {
return id; return href;
} }
@Override @Override
@ -199,7 +199,7 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp {
@Override @Override
public String toString() { public String toString() {
return "[id=" + id + ", name=" + name + ", networkToAddresses=" + networkToAddresses + ", osType=" + osType return "[href=" + href + ", name=" + name + ", networkToAddresses=" + networkToAddresses + ", osType=" + osType
+ ", operatingSystemDescription=" + operatingSystemDescription + ", resourceAllocationByType=" + ", operatingSystemDescription=" + operatingSystemDescription + ", resourceAllocationByType="
+ resourceAllocations + ", size=" + size + ", status=" + status + ", system=" + system + ", vDC=" + vDC + resourceAllocations + ", size=" + size + ", status=" + status + ", system=" + system + ", vDC=" + vDC
+ "]"; + "]";
@ -211,8 +211,8 @@ public class VCloudExpressVAppImpl implements VCloudExpressVApp {
} }
@Override @Override
public int compareTo(NamedResource o) { public int compareTo(ReferenceType o) {
return (this == o) ? 0 : getId().compareTo(o.getId()); return (this == o) ? 0 : getHref().compareTo(o.getHref());
} }
} }

View File

@ -32,7 +32,7 @@ import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class VCloudExpressVAppTemplateImpl extends NamedResourceImpl implements VCloudExpressVAppTemplate { public class VCloudExpressVAppTemplateImpl extends ReferenceTypeImpl implements VCloudExpressVAppTemplate {
/** The serialVersionUID */ /** The serialVersionUID */
private static final long serialVersionUID = 8464716396538298809L; 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.AllocationModel;
import org.jclouds.vcloud.domain.Capacity; 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.Task;
import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.domain.VDCStatus; import org.jclouds.vcloud.domain.VDCStatus;
@ -44,10 +44,10 @@ import com.google.common.collect.Maps;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class VDCImpl extends NamedResourceImpl implements VDC { public class VDCImpl extends ReferenceTypeImpl implements VDC {
private final VDCStatus status; private final VDCStatus status;
private final NamedResource org; private final ReferenceType org;
@Nullable @Nullable
private final String description; private final String description;
private final List<Task> tasks = Lists.newArrayList(); 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 storageCapacity;
private final Capacity cpuCapacity; private final Capacity cpuCapacity;
private final Capacity memoryCapacity; private final Capacity memoryCapacity;
private final Map<String, NamedResource> resourceEntities = Maps.newLinkedHashMap(); private final Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap();
private final Map<String, NamedResource> availableNetworks = Maps.newLinkedHashMap(); private final Map<String, ReferenceType> availableNetworks = Maps.newLinkedHashMap();
private final int nicQuota; private final int nicQuota;
private final int networkQuota; private final int networkQuota;
private final int vmQuota; private final int vmQuota;
private final boolean isEnabled; 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, Iterable<Task> tasks, AllocationModel allocationModel, @Nullable Capacity storageCapacity,
@Nullable Capacity cpuCapacity, @Nullable Capacity memoryCapacity, @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) { int networkQuota, int vmQuota, boolean isEnabled) {
super(name, type, id); super(name, type, id);
this.status = checkNotNull(status, "status"); this.status = checkNotNull(status, "status");
@ -96,7 +96,7 @@ public class VDCImpl extends NamedResourceImpl implements VDC {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public NamedResource getOrg() { public ReferenceType getOrg() {
return org; return org;
} }
@ -152,7 +152,7 @@ public class VDCImpl extends NamedResourceImpl implements VDC {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Map<String, NamedResource> getResourceEntities() { public Map<String, ReferenceType> getResourceEntities() {
return resourceEntities; return resourceEntities;
} }
@ -160,7 +160,7 @@ public class VDCImpl extends NamedResourceImpl implements VDC {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Map<String, NamedResource> getAvailableNetworks() { public Map<String, ReferenceType> getAvailableNetworks() {
return availableNetworks; return availableNetworks;
} }
@ -289,7 +289,7 @@ public class VDCImpl extends NamedResourceImpl implements VDC {
@Override @Override
public String toString() { 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 + "]"; + status + ", isEnabled=" + isEnabled + "]";
} }

View File

@ -26,7 +26,7 @@ import java.util.List;
import javax.annotation.Nullable; 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.Status;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.Vm; import org.jclouds.vcloud.domain.Vm;
@ -40,17 +40,17 @@ import com.google.common.collect.Lists;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class VmImpl extends NamedResourceImpl implements Vm { public class VmImpl extends ReferenceTypeImpl implements Vm {
@Nullable @Nullable
private final Status status; private final Status status;
private final NamedResource vApp; private final ReferenceType vApp;
@Nullable @Nullable
private final String description; private final String description;
private final List<Task> tasks = Lists.newArrayList(); private final List<Task> tasks = Lists.newArrayList();
private final String vAppScopedLocalId; 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) { @Nullable String description, Iterable<Task> tasks, @Nullable String vAppScopedLocalId) {
super(name, type, id); super(name, type, id);
this.status = status; this.status = status;
@ -73,7 +73,7 @@ public class VmImpl extends NamedResourceImpl implements Vm {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public NamedResource getParent() { public ReferenceType getParent() {
return vApp; return vApp;
} }
@ -152,7 +152,7 @@ public class VmImpl extends NamedResourceImpl implements Vm {
@Override @Override
public String toString() { public String toString() {
return "[id=" + getId() + ", name=" + getName() + ", vApp=" + vApp + ", description=" + description + ", status=" return "[id=" + getHref() + ", name=" + getName() + ", vApp=" + vApp + ", description=" + description + ", status="
+ status + "]"; + status + "]";
} }

View File

@ -24,7 +24,7 @@ import java.util.Set;
import javax.annotation.Nullable; 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.Task;
import org.jclouds.vcloud.domain.internal.VDCImpl; import org.jclouds.vcloud.domain.internal.VDCImpl;
@ -37,14 +37,14 @@ import com.google.inject.ImplementedBy;
*/ */
@org.jclouds.vcloud.endpoints.Network @org.jclouds.vcloud.endpoints.Network
@ImplementedBy(VDCImpl.class) @ImplementedBy(VDCImpl.class)
public interface OrgNetwork extends NamedResource { public interface OrgNetwork extends ReferenceType {
/** /**
* The org this network belongs to. * The org this network belongs to.
* *
* @since vcloud api 0.9 * @since vcloud api 0.9
*/ */
@Nullable @Nullable
NamedResource getOrg(); ReferenceType getOrg();
/** /**
* optional description * optional description
@ -78,7 +78,7 @@ public interface OrgNetwork extends NamedResource {
* @since vcloud api 0.9 * @since vcloud api 0.9
*/ */
@Nullable @Nullable
NamedResource getNetworkPool(); ReferenceType getNetworkPool();
/** /**
* list of external IP addresses that this network can use for NAT. * 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 * @since vcloud api 0.9
*/ */
@Nullable @Nullable
NamedResource getParentNetwork(); ReferenceType getParentNetwork();
/** /**
* defines how this network is connected to its ParentNetwork * defines how this network is connected to its ParentNetwork

View File

@ -23,7 +23,7 @@ import java.util.Set;
import javax.annotation.Nullable; 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.firewall.FirewallRule;
import org.jclouds.vcloud.domain.network.nat.rules.PortForwardingRule; 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 * @author Adrian Cole
*/ */
public interface VCloudExpressNetwork extends NamedResource { public interface VCloudExpressNetwork extends ReferenceType {
/** /**
* *
* @return Description of the network * @return Description of the network

View File

@ -27,9 +27,9 @@ import java.util.Set;
import javax.annotation.Nullable; 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.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.Features;
import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.FenceMode;
import org.jclouds.vcloud.domain.network.IpScope; import org.jclouds.vcloud.domain.network.IpScope;
@ -43,19 +43,19 @@ import com.google.common.collect.Sets;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork { public class OrgNetworkImpl extends ReferenceTypeImpl implements OrgNetwork {
@Nullable @Nullable
private final NamedResource org; private final ReferenceType org;
@Nullable @Nullable
private final String description; private final String description;
private final List<Task> tasks = Lists.newArrayList(); private final List<Task> tasks = Lists.newArrayList();
private final Configuration configuration; private final Configuration configuration;
@Nullable @Nullable
private final NamedResource networkPool; private final ReferenceType networkPool;
private final Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet(); private final Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet();
public OrgNetworkImpl(String name, String type, URI id, @Nullable NamedResource org, @Nullable String description, public OrgNetworkImpl(String name, String type, URI id, @Nullable ReferenceType org, @Nullable String description,
Iterable<Task> tasks, Configuration configuration, @Nullable NamedResource networkPool, Iterable<Task> tasks, Configuration configuration, @Nullable ReferenceType networkPool,
Iterable<String> allowedExternalIpAddresses) { Iterable<String> allowedExternalIpAddresses) {
super(name, type, id); super(name, type, id);
this.org = org; this.org = org;
@ -72,11 +72,11 @@ public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork {
@Nullable @Nullable
private final IpScope ipScope; private final IpScope ipScope;
@Nullable @Nullable
private final NamedResource parentNetwork; private final ReferenceType parentNetwork;
private final FenceMode fenceMode; private final FenceMode fenceMode;
private final Features features; 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) { @Nullable Features features) {
this.ipScope = ipScope; this.ipScope = ipScope;
this.parentNetwork = parentNetwork; this.parentNetwork = parentNetwork;
@ -96,7 +96,7 @@ public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public NamedResource getParentNetwork() { public ReferenceType getParentNetwork() {
return parentNetwork; return parentNetwork;
} }
@ -172,7 +172,7 @@ public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public NamedResource getOrg() { public ReferenceType getOrg() {
return org; return org;
} }
@ -204,7 +204,7 @@ public class OrgNetworkImpl extends NamedResourceImpl implements OrgNetwork {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public NamedResource getNetworkPool() { public ReferenceType getNetworkPool() {
return networkPool; return networkPool;
} }

View File

@ -22,8 +22,8 @@ package org.jclouds.vcloud.domain.network.internal;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import org.jclouds.vcloud.domain.NamedResource; import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.internal.NamedResourceImpl; import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.FenceMode;
import org.jclouds.vcloud.domain.network.VCloudExpressNetwork; import org.jclouds.vcloud.domain.network.VCloudExpressNetwork;
import org.jclouds.vcloud.domain.network.firewall.FirewallRule; import org.jclouds.vcloud.domain.network.firewall.FirewallRule;
@ -38,7 +38,7 @@ import com.google.inject.internal.Nullable;
* @author Adrian Cole * @author Adrian Cole
* *
*/ */
public class VCloudExpressNetworkImpl extends NamedResourceImpl implements VCloudExpressNetwork { public class VCloudExpressNetworkImpl extends ReferenceTypeImpl implements VCloudExpressNetwork {
/** The serialVersionUID */ /** The serialVersionUID */
private static final long serialVersionUID = 8464716396538298809L; private static final long serialVersionUID = 8464716396538298809L;
@ -123,8 +123,8 @@ public class VCloudExpressNetworkImpl extends NamedResourceImpl implements VClou
} }
@Override @Override
public int compareTo(NamedResource o) { public int compareTo(ReferenceType o) {
return (this == o) ? 0 : getId().compareTo(o.getId()); return (this == o) ? 0 : getHref().compareTo(o.getHref());
} }
@Override @Override
@ -196,7 +196,7 @@ public class VCloudExpressNetworkImpl extends NamedResourceImpl implements VClou
@Override @Override
public String toString() { 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 + description + ", dhcp=" + dhcp + ", dnsServers=" + dnsServers + ", fenceModes=" + fenceModes
+ ", firewallRules=" + firewallRules + ", gateway=" + gateway + ", natRules=" + natRules + ", netmask=" + ", firewallRules=" + firewallRules + ", gateway=" + gateway + ", natRules=" + natRules + ", netmask="
+ netmask + "]"; + netmask + "]";

View File

@ -39,7 +39,7 @@ import com.google.common.collect.Iterables;
public class VCloudExpressOrgNetworkAdapter extends OrgNetworkImpl { public class VCloudExpressOrgNetworkAdapter extends OrgNetworkImpl {
public VCloudExpressOrgNetworkAdapter(VCloudExpressNetwork in) { 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()); 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.VCloudMediaType;
import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem; 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.Function;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
@ -64,22 +64,22 @@ public class AllCatalogItemsInCatalog implements Function<Catalog, Iterable<? ex
@Override @Override
public Iterable<? extends CatalogItem> apply(Catalog from) { 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 @Override
public boolean apply(NamedResource input) { public boolean apply(ReferenceType input) {
return input.getType().equals(VCloudMediaType.CATALOGITEM_XML); return input.getType().equals(VCloudMediaType.CATALOGITEM_XML);
} }
}), new Function<NamedResource, Future<CatalogItem>>() { }), new Function<ReferenceType, Future<CatalogItem>>() {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Future<CatalogItem> apply(NamedResource from) { public Future<CatalogItem> apply(ReferenceType from) {
return (Future<CatalogItem>) aclient.getCatalogItem(from.getId()); return (Future<CatalogItem>) aclient.getCatalogItem(from.getHref());
} }
}, executor, null, logger, "catalogItems in " + from.getId()); }, executor, null, logger, "catalogItems in " + from.getHref());
return catalogItems; return catalogItems;
} }

View File

@ -34,7 +34,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.vcloud.CommonVCloudAsyncClient; import org.jclouds.vcloud.CommonVCloudAsyncClient;
import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.NamedResource; import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.Org;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -60,11 +60,11 @@ public class AllCatalogsInOrg implements Function<Org, Iterable<? extends Catalo
@Override @Override
public Iterable<? extends Catalog> apply(final Org org) { public Iterable<? extends Catalog> apply(final Org org) {
Iterable<Catalog> catalogs = transformParallel(org.getCatalogs().values(), Iterable<Catalog> catalogs = transformParallel(org.getCatalogs().values(),
new Function<NamedResource, Future<Catalog>>() { new Function<ReferenceType, Future<Catalog>>() {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Future<Catalog> apply(NamedResource from) { public Future<Catalog> apply(ReferenceType from) {
return (Future<Catalog>) aclient.getCatalog(from.getId()); return (Future<Catalog>) aclient.getCatalog(from.getHref());
} }
}, executor, null, logger, "catalogs in " + org.getName()); }, 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.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.vcloud.CommonVCloudAsyncClient; 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.Org;
import org.jclouds.vcloud.domain.VDC; 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) { public Iterable<? extends VDC> apply(final Org org) {
Iterable<VDC> catalogItems = transformParallel(org.getVDCs().values(), Iterable<VDC> catalogItems = transformParallel(org.getVDCs().values(),
new Function<NamedResource, Future<VDC>>() { new Function<ReferenceType, Future<VDC>>() {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Future<VDC> apply(NamedResource from) { public Future<VDC> apply(ReferenceType from) {
return (Future<VDC>) aclient.getVDC(from.getId()); return (Future<VDC>) aclient.getVDC(from.getHref());
} }
}, executor, null, logger, "vdcs in org " + org.getName()); }, 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.Inject;
import javax.inject.Singleton; 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.domain.Org;
import org.jclouds.vcloud.endpoints.Catalog; import org.jclouds.vcloud.endpoints.Catalog;
@ -65,8 +65,8 @@ public class OrgNameAndCatalogNameToEndpoint implements Function<Object, URI> {
org = defaultOrg; org = defaultOrg;
try { try {
Map<String, NamedResource> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs(); Map<String, ReferenceType> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs();
return catalog == null ? Iterables.getLast(catalogs.values()).getId() : catalogs.get(catalog).getId(); return catalog == null ? Iterables.getLast(catalogs.values()).getHref() : catalogs.get(catalog).getHref();
} catch (NullPointerException e) { } catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + catalog + " not found in " + orgMap.get()); 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.Inject;
import javax.inject.Singleton; 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.domain.Org;
import org.jclouds.vcloud.endpoints.VDC; import org.jclouds.vcloud.endpoints.VDC;
@ -65,8 +65,8 @@ public class OrgNameAndVDCNameToEndpoint implements Function<Object, URI> {
org = defaultOrg; org = defaultOrg;
try { try {
Map<String, NamedResource> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs(); Map<String, ReferenceType> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs();
return vdc == null ? Iterables.getLast(vdcs.values()).getId() : vdcs.get(vdc).getId(); return vdc == null ? Iterables.getLast(vdcs.values()).getHref() : vdcs.get(vdc).getHref();
} catch (NullPointerException e) { } catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + vdc + " not found in " + orgNameToVDCEndpoint.get()); 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; catalog = defaultCatalog;
try { try {
Map<String, ? extends org.jclouds.vcloud.domain.Catalog> catalogs = checkNotNull(orgCatalogMap.get().get(org)); 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) { } catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in " throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in "
+ orgCatalogMap.get()); + orgCatalogMap.get());

View File

@ -67,7 +67,7 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
catalog = defaultCatalog; catalog = defaultCatalog;
try { try {
Map<String, Map<String, ? extends CatalogItem>> catalogs = checkNotNull(orgCatalogItemMap.get().get(org)); 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) { } catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in " throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in "
+ orgCatalogItemMap.get()); + orgCatalogItemMap.get());

View File

@ -26,7 +26,7 @@ import java.util.NoSuchElementException;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.vcloud.domain.NamedResource; import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.endpoints.Org; import org.jclouds.vcloud.endpoints.Org;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -38,19 +38,19 @@ import com.google.common.base.Supplier;
*/ */
@Singleton @Singleton
public class OrgNameToEndpoint implements Function<Object, URI> { 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; private final URI defaultUri;
@Inject @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.orgNameToEndpointSupplier = orgNameToEndpointSupplier;
this.defaultUri = defaultUri; this.defaultUri = defaultUri;
} }
public URI apply(Object from) { public URI apply(Object from) {
try { try {
Map<String, NamedResource> orgNameToEndpoint = orgNameToEndpointSupplier.get(); Map<String, ReferenceType> orgNameToEndpoint = orgNameToEndpointSupplier.get();
return from == null ? defaultUri : orgNameToEndpoint.get(from).getId(); return from == null ? defaultUri : orgNameToEndpoint.get(from).getHref();
} catch (NullPointerException e) { } catch (NullPointerException e) {
throw new NoSuchElementException("org " + from + " not found in " + orgNameToEndpointSupplier.get().keySet()); 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) if (org == null)
return defaultUri; return defaultUri;
try { try {
return checkNotNull(orgMap.get().get(org)).getTasksList().getId(); return checkNotNull(orgMap.get().get(org)).getTasksList().getHref();
} catch (NullPointerException e) { } catch (NullPointerException e) {
throw new NoSuchElementException(org + " not found in " + orgMap.get()); throw new NoSuchElementException(org + " not found in " + orgMap.get());
} }

View File

@ -66,7 +66,7 @@ public class OrgNameVDCNameResourceEntityNameToEndpoint implements Function<Obje
vDC = defaultVDC; vDC = defaultVDC;
try { try {
Map<String, ? extends org.jclouds.vcloud.domain.VDC> vDCs = checkNotNull(orgVDCMap.get().get(org)); 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) { } catch (NullPointerException e) {
throw new NoSuchElementException(org + "/" + vDC + "/" + entityName + " not found in " + orgVDCMap.get()); 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 @Override
public URI apply(Location from) { 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>>() { })), 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;
import org.jclouds.http.functions.ParseSax.Factory; import org.jclouds.http.functions.ParseSax.Factory;
import org.jclouds.vcloud.VCloudToken; 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.domain.VCloudSession;
import org.jclouds.vcloud.endpoints.Org; import org.jclouds.vcloud.endpoints.Org;
import org.jclouds.vcloud.xml.OrgListHandler; import org.jclouds.vcloud.xml.OrgListHandler;
@ -73,7 +73,7 @@ public class ParseLoginResponseFromHeaders implements Function<HttpResponse, VCl
boolean matchFound = matcher.find(); boolean matchFound = matcher.find();
try { try {
if (matchFound) { 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()); from.getPayload().getInput());
return new VCloudSession() { return new VCloudSession() {
@ -83,7 +83,7 @@ public class ParseLoginResponseFromHeaders implements Function<HttpResponse, VCl
} }
@Org @Org
public Map<String, NamedResource> getOrgs() { public Map<String, ReferenceType> getOrgs() {
return org; return org;
} }
}; };

View File

@ -76,7 +76,7 @@ public class VAppTemplatesForCatalogItems implements
@Override @Override
public Future<VAppTemplate> apply(CatalogItem from) { public Future<VAppTemplate> apply(CatalogItem from) {
return (Future<VAppTemplate>) VCloudAsyncClient.class.cast(aclient).getVAppTemplate( return (Future<VAppTemplate>) VCloudAsyncClient.class.cast(aclient).getVAppTemplate(
from.getEntity().getId()); from.getEntity().getHref());
} }
}, executor, null, logger, "vappTemplates in"); }, 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.logging.Logger;
import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.VCloudAsyncClient;
import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.domain.NamedResource; import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.VAppTemplate; import org.jclouds.vcloud.domain.VAppTemplate;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -47,7 +47,7 @@ import com.google.common.base.Predicate;
*/ */
@Singleton @Singleton
public class VAppTemplatesForResourceEntities implements public class VAppTemplatesForResourceEntities implements
Function<Iterable<? extends NamedResource>, Iterable<? extends VAppTemplate>> { Function<Iterable<? extends ReferenceType>, Iterable<? extends VAppTemplate>> {
@Resource @Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER) @Named(ComputeServiceConstants.COMPUTE_LOGGER)
public Logger logger = Logger.NULL; public Logger logger = Logger.NULL;
@ -62,20 +62,20 @@ public class VAppTemplatesForResourceEntities implements
} }
@Override @Override
public Iterable<? extends VAppTemplate> apply(Iterable<? extends NamedResource> from) { public Iterable<? extends VAppTemplate> apply(Iterable<? extends ReferenceType> from) {
return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<NamedResource>() { return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<ReferenceType>() {
@Override @Override
public boolean apply(NamedResource input) { public boolean apply(ReferenceType input) {
return input.getType().equals(VCloudMediaType.VAPPTEMPLATE_XML); return input.getType().equals(VCloudMediaType.VAPPTEMPLATE_XML);
} }
}), new Function<NamedResource, Future<VAppTemplate>>() { }), new Function<ReferenceType, Future<VAppTemplate>>() {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Future<VAppTemplate> apply(NamedResource from) { public Future<VAppTemplate> apply(ReferenceType from) {
return (Future<VAppTemplate>) aclient.getVAppTemplate(from.getId()); return (Future<VAppTemplate>) aclient.getVAppTemplate(from.getHref());
} }
}, executor, null, logger, "vappTemplates in"); }, 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.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem; 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.Function;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
@ -63,22 +63,22 @@ public class VCloudExpressAllCatalogItemsInCatalog implements Function<Catalog,
@Override @Override
public Iterable<? extends CatalogItem> apply(Catalog from) { 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 @Override
public boolean apply(NamedResource input) { public boolean apply(ReferenceType input) {
return input.getType().equals(VCloudExpressMediaType.CATALOGITEM_XML); return input.getType().equals(VCloudExpressMediaType.CATALOGITEM_XML);
} }
}), new Function<NamedResource, Future<CatalogItem>>() { }), new Function<ReferenceType, Future<CatalogItem>>() {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Future<CatalogItem> apply(NamedResource from) { public Future<CatalogItem> apply(ReferenceType from) {
return (Future<CatalogItem>) aclient.getCatalogItem(from.getId()); return (Future<CatalogItem>) aclient.getCatalogItem(from.getHref());
} }
}, executor, null, logger, "catalogItems in " + from.getId()); }, executor, null, logger, "catalogItems in " + from.getHref());
return catalogItems; return catalogItems;
} }

View File

@ -74,7 +74,7 @@ public class VCloudExpressVAppTemplatesForCatalogItems implements
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Future<VCloudExpressVAppTemplate> apply(CatalogItem from) { 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"); }, 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.logging.Logger;
import org.jclouds.vcloud.VCloudExpressAsyncClient; import org.jclouds.vcloud.VCloudExpressAsyncClient;
import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.NamedResource; import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -47,7 +47,7 @@ import com.google.common.base.Predicate;
*/ */
@Singleton @Singleton
public class VCloudExpressVAppTemplatesForResourceEntities implements public class VCloudExpressVAppTemplatesForResourceEntities implements
Function<Iterable<? extends NamedResource>, Iterable<? extends VCloudExpressVAppTemplate>> { Function<Iterable<? extends ReferenceType>, Iterable<? extends VCloudExpressVAppTemplate>> {
@Resource @Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER) @Named(ComputeServiceConstants.COMPUTE_LOGGER)
public Logger logger = Logger.NULL; public Logger logger = Logger.NULL;
@ -62,20 +62,20 @@ public class VCloudExpressVAppTemplatesForResourceEntities implements
} }
@Override @Override
public Iterable<? extends VCloudExpressVAppTemplate> apply(Iterable<? extends NamedResource> from) { public Iterable<? extends VCloudExpressVAppTemplate> apply(Iterable<? extends ReferenceType> from) {
return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<NamedResource>() { return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<ReferenceType>() {
@Override @Override
public boolean apply(NamedResource input) { public boolean apply(ReferenceType input) {
return input.getType().equals(VCloudExpressMediaType.VAPPTEMPLATE_XML); return input.getType().equals(VCloudExpressMediaType.VAPPTEMPLATE_XML);
} }
}), new Function<NamedResource, Future<VCloudExpressVAppTemplate>>() { }), new Function<ReferenceType, Future<VCloudExpressVAppTemplate>>() {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Future<VCloudExpressVAppTemplate> apply(NamedResource from) { public Future<VCloudExpressVAppTemplate> apply(ReferenceType from) {
return (Future<VCloudExpressVAppTemplate>) aclient.getVAppTemplate(from.getId()); return (Future<VCloudExpressVAppTemplate>) aclient.getVAppTemplate(from.getHref());
} }
}, executor, null, logger, "vappTemplates in"); }, executor, null, logger, "vappTemplates in");

View File

@ -57,7 +57,7 @@ public class TaskSuccess implements Predicate<URI> {
Task task = client.getTask(taskId); Task task = client.getTask(taskId);
logger.trace("%s: looking for status %s: currently: %s", task, TaskStatus.SUCCESS, task.getStatus()); logger.trace("%s: looking for status %s: currently: %s", task, TaskStatus.SUCCESS, task.getStatus());
if (task.getStatus() == TaskStatus.ERROR) 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; return task.getStatus() == TaskStatus.SUCCESS;
} }

View File

@ -22,9 +22,9 @@ package org.jclouds.vcloud.util;
import java.net.URI; import java.net.URI;
import java.util.Map; 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.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.jclouds.vcloud.domain.internal.TaskImpl.ErrorImpl;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
@ -33,14 +33,14 @@ import org.xml.sax.Attributes;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class Utils { 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 uri = attributes.getValue(attributes.getIndex("href"));
String type = attributes.getValue(attributes.getIndex("type")); 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)); URI.create(uri));
} }
public static NamedResource newNamedResource(Attributes attributes) { public static ReferenceType newNamedResource(Attributes attributes) {
return newNamedResource(attributes, null); return newNamedResource(attributes, null);
} }
@ -63,7 +63,7 @@ public class Utils {
return attributes.getIndex(attr) >= 0 ? attributes.getValue(attributes.getIndex(attr)) : null; 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)); 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.http.functions.ParseSax;
import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.domain.Catalog; 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.Task;
import org.jclouds.vcloud.domain.internal.CatalogImpl; import org.jclouds.vcloud.domain.internal.CatalogImpl;
import org.jclouds.vcloud.util.Utils; import org.jclouds.vcloud.util.Utils;
@ -53,16 +53,16 @@ public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
private NamedResource catalog; private ReferenceType catalog;
private SortedMap<String, NamedResource> contents = Maps.newTreeMap(); private SortedMap<String, ReferenceType> contents = Maps.newTreeMap();
protected List<Task> tasks = Lists.newArrayList(); protected List<Task> tasks = Lists.newArrayList();
private String description; private String description;
private NamedResource org; private ReferenceType org;
private boolean published = true; private boolean published = true;
public Catalog getResult() { 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); published);
} }

View File

@ -23,7 +23,7 @@ import java.util.SortedMap;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.vcloud.domain.CatalogItem; 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.domain.internal.CatalogItemImpl;
import org.jclouds.vcloud.util.Utils; import org.jclouds.vcloud.util.Utils;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
@ -37,15 +37,15 @@ import com.google.common.collect.Maps;
public class CatalogItemHandler extends ParseSax.HandlerWithResult<CatalogItem> { public class CatalogItemHandler extends ParseSax.HandlerWithResult<CatalogItem> {
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
protected NamedResource catalogItem; protected ReferenceType catalogItem;
protected NamedResource entity; protected ReferenceType entity;
protected String description; protected String description;
protected String key; protected String key;
protected SortedMap<String, String> properties = Maps.newTreeMap(); protected SortedMap<String, String> properties = Maps.newTreeMap();
public CatalogItem getResult() { public CatalogItem getResult() {
return new CatalogItemImpl(catalogItem.getName(), catalogItem.getId(), description, entity, properties); return new CatalogItemImpl(catalogItem.getName(), catalogItem.getHref(), description, entity, properties);
} }
@Override @Override

View File

@ -28,7 +28,7 @@ import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import org.jclouds.http.functions.ParseSax; 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.Org;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.internal.OrgImpl; import org.jclouds.vcloud.domain.internal.OrgImpl;
@ -52,18 +52,18 @@ public class OrgHandler extends ParseSax.HandlerWithResult<Org> {
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
protected NamedResource org; protected ReferenceType org;
protected Map<String, NamedResource> vdcs = Maps.newLinkedHashMap(); protected Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
protected NamedResource tasksList; protected ReferenceType tasksList;
protected Map<String, NamedResource> catalogs = Maps.newLinkedHashMap(); protected Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
protected Map<String, NamedResource> networks = Maps.newLinkedHashMap(); protected Map<String, ReferenceType> networks = Maps.newLinkedHashMap();
protected List<Task> tasks = Lists.newArrayList(); protected List<Task> tasks = Lists.newArrayList();
protected String description; protected String description;
protected String fullName; protected String fullName;
public Org getResult() { 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); 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 java.util.Map;
import org.jclouds.http.functions.ParseSax; 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.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@ -35,11 +35,11 @@ import com.google.common.collect.Maps;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class OrgListHandler extends 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; return org;
} }

View File

@ -28,7 +28,7 @@ import javax.inject.Inject;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.vcloud.domain.MappingMode; 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.Task;
import org.jclouds.vcloud.domain.network.DhcpService; import org.jclouds.vcloud.domain.network.DhcpService;
import org.jclouds.vcloud.domain.network.Features; import org.jclouds.vcloud.domain.network.Features;
@ -71,8 +71,8 @@ public class OrgNetworkHandler extends ParseSax.HandlerWithResult<OrgNetwork> {
protected StringBuilder currentText = new StringBuilder(); protected StringBuilder currentText = new StringBuilder();
protected NamedResource network; protected ReferenceType network;
protected NamedResource org; protected ReferenceType org;
protected String orgDescription; protected String orgDescription;
protected List<Task> tasks = Lists.newArrayList(); protected List<Task> tasks = Lists.newArrayList();
@ -89,7 +89,7 @@ public class OrgNetworkHandler extends ParseSax.HandlerWithResult<OrgNetwork> {
protected Set<String> allocatedIpAddresses = Sets.newLinkedHashSet(); protected Set<String> allocatedIpAddresses = Sets.newLinkedHashSet();
protected IpScope ipScope; protected IpScope ipScope;
protected NamedResource parentNetwork; protected ReferenceType parentNetwork;
protected FenceMode fenceMode; protected FenceMode fenceMode;
protected boolean serviceEnabled; protected boolean serviceEnabled;
@ -133,11 +133,11 @@ public class OrgNetworkHandler extends ParseSax.HandlerWithResult<OrgNetwork> {
protected Features features; protected Features features;
protected OrgNetwork.Configuration configuration; protected OrgNetwork.Configuration configuration;
protected NamedResource networkPool; protected ReferenceType networkPool;
protected Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet(); protected Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet();
public OrgNetwork getResult() { 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); configuration, networkPool, allowedExternalIpAddresses);
} }

View File

@ -27,7 +27,7 @@ import javax.inject.Inject;
import org.jclouds.date.DateService; import org.jclouds.date.DateService;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.logging.Logger; 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.Task;
import org.jclouds.vcloud.domain.TaskStatus; import org.jclouds.vcloud.domain.TaskStatus;
import org.jclouds.vcloud.domain.Task.Error; import org.jclouds.vcloud.domain.Task.Error;
@ -42,8 +42,8 @@ import org.xml.sax.SAXException;
public class TaskHandler extends ParseSax.HandlerWithResult<Task> { public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
protected final DateService dateService; protected final DateService dateService;
private NamedResource taskLink; private ReferenceType taskLink;
private NamedResource owner; private ReferenceType owner;
private TaskStatus status; private TaskStatus status;
private Date startTime; private Date startTime;
private Date endTime; private Date endTime;
@ -105,7 +105,7 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
@Override @Override
public void endElement(String uri, String localName, String qName) { public void endElement(String uri, String localName, String qName) {
if (qName.equalsIgnoreCase("Task")) { 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; taskLink = null;
status = null; status = null;
startTime = null; startTime = null;

View File

@ -24,7 +24,7 @@ import java.util.SortedSet;
import javax.inject.Inject; import javax.inject.Inject;
import org.jclouds.http.functions.ParseSax; 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.Task;
import org.jclouds.vcloud.domain.TasksList; import org.jclouds.vcloud.domain.TasksList;
import org.jclouds.vcloud.domain.internal.TasksListImpl; 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 SortedSet<Task> tasks = Sets.newTreeSet();
private final TaskHandler taskHandler; private final TaskHandler taskHandler;
private NamedResource resource; private ReferenceType resource;
@Inject @Inject
public TasksListHandler(TaskHandler taskHandler) { public TasksListHandler(TaskHandler taskHandler) {
@ -49,7 +49,7 @@ public class TasksListHandler extends ParseSax.HandlerWithResult<TasksList> {
} }
public TasksList getResult() { public TasksList getResult() {
return new TasksListImpl(resource.getId(), tasks); return new TasksListImpl(resource.getHref(), tasks);
} }
@Override @Override

View File

@ -27,7 +27,7 @@ import java.util.Set;
import javax.inject.Inject; import javax.inject.Inject;
import org.jclouds.http.functions.ParseSax; 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.Status;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VApp;
@ -56,9 +56,9 @@ public class VAppHandler extends ParseSax.HandlerWithResult<VApp> {
protected StringBuilder currentText = new StringBuilder(); protected StringBuilder currentText = new StringBuilder();
protected NamedResource template; protected ReferenceType template;
protected Status status; protected Status status;
protected NamedResource vdc; protected ReferenceType vdc;
protected String description; protected String description;
protected List<Task> tasks = Lists.newArrayList(); protected List<Task> tasks = Lists.newArrayList();
protected boolean ovfDescriptorUploaded = true; protected boolean ovfDescriptorUploaded = true;
@ -68,7 +68,7 @@ public class VAppHandler extends ParseSax.HandlerWithResult<VApp> {
protected Set<Vm> children = Sets.newLinkedHashSet(); protected Set<Vm> children = Sets.newLinkedHashSet();
public VApp getResult() { 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); ovfDescriptorUploaded, children);
} }

View File

@ -27,7 +27,7 @@ import java.util.Set;
import javax.inject.Inject; import javax.inject.Inject;
import org.jclouds.http.functions.ParseSax; 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.Status;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VAppTemplate; import org.jclouds.vcloud.domain.VAppTemplate;
@ -56,9 +56,9 @@ public class VAppTemplateHandler extends ParseSax.HandlerWithResult<VAppTemplate
protected StringBuilder currentText = new StringBuilder(); protected StringBuilder currentText = new StringBuilder();
protected NamedResource template; protected ReferenceType template;
protected Status status; protected Status status;
protected NamedResource vdc; protected ReferenceType vdc;
protected String description; protected String description;
protected List<Task> tasks = Lists.newArrayList(); protected List<Task> tasks = Lists.newArrayList();
protected boolean ovfDescriptorUploaded = true; protected boolean ovfDescriptorUploaded = true;
@ -69,7 +69,7 @@ public class VAppTemplateHandler extends ParseSax.HandlerWithResult<VAppTemplate
protected Set<Vm> children = Sets.newLinkedHashSet(); protected Set<Vm> children = Sets.newLinkedHashSet();
public VAppTemplate getResult() { 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); tasks, ovfDescriptorUploaded, vAppScopedLocalId, children);
} }

View File

@ -25,7 +25,7 @@ import javax.annotation.Resource;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.logging.Logger; 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.FenceMode;
import org.jclouds.vcloud.domain.network.VCloudExpressNetwork; import org.jclouds.vcloud.domain.network.VCloudExpressNetwork;
import org.jclouds.vcloud.domain.network.firewall.FirewallPolicy; 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 StringBuilder currentText = new StringBuilder();
private NamedResource network; private ReferenceType network;
private String description; private String description;
@ -71,7 +71,7 @@ public class VCloudExpressNetworkHandler extends ParseSax.HandlerWithResult<VClo
private int sourcePort; private int sourcePort;
public VCloudExpressNetwork getResult() { 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); 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.http.functions.ParseSax;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.vcloud.VCloudExpressMediaType; 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.ResourceAllocation;
import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Status;
@ -75,7 +75,7 @@ public class VCloudExpressVAppHandler extends ParseSax.HandlerWithResult<VCloudE
protected Integer osType; protected Integer osType;
protected URI location; protected URI location;
protected Long size; protected Long size;
protected NamedResource vDC; protected ReferenceType vDC;
public VCloudExpressVApp getResult() { public VCloudExpressVApp getResult() {
return new VCloudExpressVAppImpl(name, location, status, size, vDC, networkToAddresses, osType, operatingSystemDescription, 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 { public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (qName.equals("VApp")) { if (qName.equals("VApp")) {
NamedResource resource = Utils.newNamedResource(attributes); ReferenceType resource = Utils.newNamedResource(attributes);
name = resource.getName(); name = resource.getName();
location = resource.getId(); location = resource.getHref();
String statusString = attributes.getValue(attributes.getIndex("status")); String statusString = attributes.getValue(attributes.getIndex("status"));
if (apiVersion.indexOf("0.8") != -1 && "2".equals(statusString)) if (apiVersion.indexOf("0.8") != -1 && "2".equals(statusString))
status = Status.OFF; status = Status.OFF;

View File

@ -20,7 +20,7 @@
package org.jclouds.vcloud.xml; package org.jclouds.vcloud.xml;
import org.jclouds.http.functions.ParseSax; 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.Status;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppTemplateImpl; import org.jclouds.vcloud.domain.internal.VCloudExpressVAppTemplateImpl;
@ -34,12 +34,12 @@ import org.xml.sax.SAXException;
public class VCloudExpressVAppTemplateHandler extends ParseSax.HandlerWithResult<VCloudExpressVAppTemplate> { public class VCloudExpressVAppTemplateHandler extends ParseSax.HandlerWithResult<VCloudExpressVAppTemplate> {
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
private NamedResource catalog; private ReferenceType catalog;
private String description; private String description;
private Status status; private Status status;
public VCloudExpressVAppTemplate getResult() { public VCloudExpressVAppTemplate getResult() {
return new VCloudExpressVAppTemplateImpl(catalog.getName(), catalog.getId(), description, status); return new VCloudExpressVAppTemplateImpl(catalog.getName(), catalog.getHref(), description, status);
} }
@Override @Override

View File

@ -30,7 +30,7 @@ import javax.inject.Inject;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.vcloud.domain.AllocationModel; import org.jclouds.vcloud.domain.AllocationModel;
import org.jclouds.vcloud.domain.Capacity; 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.Task;
import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.domain.VDCStatus; import org.jclouds.vcloud.domain.VDCStatus;
@ -56,9 +56,9 @@ public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
protected StringBuilder currentText = new StringBuilder(); protected StringBuilder currentText = new StringBuilder();
protected NamedResource vDC; protected ReferenceType vDC;
protected VDCStatus status = VDCStatus.READY; protected VDCStatus status = VDCStatus.READY;
protected NamedResource org; protected ReferenceType org;
protected String description; protected String description;
protected List<Task> tasks = Lists.newArrayList(); protected List<Task> tasks = Lists.newArrayList();
protected AllocationModel allocationModel = AllocationModel.UNRECOGNIZED_MODEL; protected AllocationModel allocationModel = AllocationModel.UNRECOGNIZED_MODEL;
@ -73,8 +73,8 @@ public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
protected int used = 0; protected int used = 0;
protected long overhead = 0; protected long overhead = 0;
protected Map<String, NamedResource> resourceEntities = Maps.newLinkedHashMap(); protected Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap();
protected Map<String, NamedResource> availableNetworks = Maps.newLinkedHashMap(); protected Map<String, ReferenceType> availableNetworks = Maps.newLinkedHashMap();
protected int nicQuota; protected int nicQuota;
protected int networkQuota; protected int networkQuota;
@ -82,7 +82,7 @@ public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
protected boolean isEnabled = true; protected boolean isEnabled = true;
public VDC getResult() { 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, storageCapacity, cpuCapacity, memoryCapacity, resourceEntities, availableNetworks, nicQuota,
networkQuota, vmQuota, isEnabled); networkQuota, vmQuota, isEnabled);
} }

View File

@ -26,7 +26,7 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import org.jclouds.http.functions.ParseSax; 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.Status;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.Vm; import org.jclouds.vcloud.domain.Vm;
@ -51,15 +51,15 @@ public class VmHandler extends ParseSax.HandlerWithResult<Vm> {
protected StringBuilder currentText = new StringBuilder(); protected StringBuilder currentText = new StringBuilder();
protected NamedResource vm; protected ReferenceType vm;
protected Status status; protected Status status;
protected NamedResource vdc; protected ReferenceType vdc;
protected String description; protected String description;
protected List<Task> tasks = Lists.newArrayList(); protected List<Task> tasks = Lists.newArrayList();
protected String vAppScopedLocalId; protected String vAppScopedLocalId;
public Vm getResult() { 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 @Override

View File

@ -30,7 +30,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem; 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.Org;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.VDC;
@ -69,11 +69,11 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test @Test
public void testCatalog() throws Exception { public void testCatalog() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) { for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId()); Catalog response = connection.getCatalog(cat.getHref());
assertNotNull(response); assertNotNull(response);
assertNotNull(response.getName()); assertNotNull(response.getName());
assertNotNull(response.getId()); assertNotNull(response.getHref());
assertEquals(connection.findCatalogInOrgNamed(null, response.getName()), response); assertEquals(connection.findCatalogInOrgNamed(null, response.getName()), response);
} }
} }
@ -81,9 +81,9 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test @Test
public void testGetOrgNetwork() throws Exception { public void testGetOrgNetwork() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource resource : org.getNetworks().values()) { for (ReferenceType resource : org.getNetworks().values()) {
if (resource.getType().equals(VCloudMediaType.NETWORK_XML)) { if (resource.getType().equals(VCloudMediaType.NETWORK_XML)) {
OrgNetwork item = connection.getNetwork(resource.getId()); OrgNetwork item = connection.getNetwork(resource.getHref());
assertNotNull(item); assertNotNull(item);
} }
} }
@ -92,11 +92,11 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test @Test
public void testGetVDCNetwork() throws Exception { public void testGetVDCNetwork() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) { for (ReferenceType vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId()); VDC response = connection.getVDC(vdc.getHref());
for (NamedResource resource : response.getAvailableNetworks().values()) { for (ReferenceType resource : response.getAvailableNetworks().values()) {
if (resource.getType().equals(VCloudMediaType.NETWORK_XML)) { if (resource.getType().equals(VCloudMediaType.NETWORK_XML)) {
OrgNetwork item = connection.getNetwork(resource.getId()); OrgNetwork item = connection.getNetwork(resource.getHref());
assertNotNull(item); assertNotNull(item);
} }
} }
@ -106,11 +106,11 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test @Test
public void testGetCatalogItem() throws Exception { public void testGetCatalogItem() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) { for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId()); Catalog response = connection.getCatalog(cat.getHref());
for (NamedResource resource : response.values()) { for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) { if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.getCatalogItem(resource.getId()); CatalogItem item = connection.getCatalogItem(resource.getHref());
verifyCatalogItem(item); verifyCatalogItem(item);
} }
} }
@ -121,7 +121,7 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
assertNotNull(item); assertNotNull(item);
assertNotNull(item); assertNotNull(item);
assertNotNull(item.getEntity()); assertNotNull(item.getEntity());
assertNotNull(item.getId()); assertNotNull(item.getHref());
assertNotNull(item.getProperties()); assertNotNull(item.getProperties());
assertNotNull(item.getType()); assertNotNull(item.getType());
} }
@ -129,9 +129,9 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test @Test
public void testFindCatalogItem() throws Exception { public void testFindCatalogItem() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) { for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId()); Catalog response = connection.getCatalog(cat.getHref());
for (NamedResource resource : response.values()) { for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) { if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.findCatalogItemInOrgCatalogNamed(org.getName(), response.getName(), CatalogItem item = connection.findCatalogItemInOrgCatalogNamed(org.getName(), response.getName(),
resource.getName()); resource.getName());
@ -144,14 +144,14 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
@Test @Test
public void testDefaultVDC() throws Exception { public void testDefaultVDC() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) { for (ReferenceType vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId()); VDC response = connection.getVDC(vdc.getHref());
assertNotNull(response); assertNotNull(response);
assertNotNull(response.getName()); assertNotNull(response.getName());
assertNotNull(response.getId()); assertNotNull(response.getHref());
assertNotNull(response.getResourceEntities()); assertNotNull(response.getResourceEntities());
assertNotNull(response.getAvailableNetworks()); 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()); assertNotNull(response.getTasks());
if (response.getTasks().size() > 0) { if (response.getTasks().size() > 0) {
Task task = response.getTasks().last(); 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.rest.internal.RestAnnotationProcessor;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import org.jclouds.vcloud.config.VCloudRestClientModule; 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.Org;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VCloudSession;
import org.jclouds.vcloud.domain.internal.CatalogImpl; import org.jclouds.vcloud.domain.internal.CatalogImpl;
import org.jclouds.vcloud.domain.internal.CatalogItemImpl; 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.OrgImpl;
import org.jclouds.vcloud.domain.internal.VDCImpl; import org.jclouds.vcloud.domain.internal.VDCImpl;
import org.jclouds.vcloud.filters.SetVCloudTokenCookie; import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
@ -702,13 +702,13 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
} }
@Override @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"); return URI.create("https://vcenterprise.bluelock.com/api/v1.0/org");
} }
@Override @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"; return "org";
} }
@ -744,8 +744,8 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() { return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
@Override @Override
public Map<String, NamedResource> getOrgs() { public Map<String, ReferenceType> getOrgs() {
return ImmutableMap.<String, NamedResource> of("org", new NamedResourceImpl("org", return ImmutableMap.<String, ReferenceType> of("org", new ReferenceTypeImpl("org",
VCloudMediaType.ORG_XML, URI.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"))); 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,
null, null,
ImmutableMap ImmutableMap
.<String, NamedResource> of( .<String, ReferenceType> of(
"vapp", "vapp",
new NamedResourceImpl( new ReferenceTypeImpl(
"vapp", "vapp",
"application/vnd.vmware.vcloud.vApp+xml", "application/vnd.vmware.vcloud.vApp+xml",
URI URI
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")), .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")),
"network", "network",
new NamedResourceImpl( new ReferenceTypeImpl(
"network", "network",
"application/vnd.vmware.vcloud.vAppTemplate+xml", "application/vnd.vmware.vcloud.vAppTemplate+xml",
URI URI
@ -819,15 +819,15 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
public Map<String, Org> get() { public Map<String, Org> get() {
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"), "org", "description", ImmutableMap .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 VCloudMediaType.CATALOG_XML, URI
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))), ImmutableMap .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 .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 VCloudMediaType.NETWORK_XML, URI
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1"))), .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 .create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")), ImmutableList
.<Task> of())); .<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", 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", 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 "application/vnd.vmware.vcloud.catalogItem+xml", URI
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")), .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 "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))), .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))),
ImmutableList.<Task> of(), true))); ImmutableList.<Task> of(), true)));
@ -878,7 +878,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
URI URI
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"), .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"),
"description", "description",
new NamedResourceImpl( new ReferenceTypeImpl(
"template", "template",
"application/vnd.vmware.vcloud.vAppTemplate+xml", "application/vnd.vmware.vcloud.vAppTemplate+xml",
URI URI
@ -889,7 +889,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
} }
@Override @Override
protected Iterable<NamedResource> provideOrgs(Supplier<VCloudSession> cache, String user) { protected Iterable<ReferenceType> provideOrgs(Supplier<VCloudSession> cache, String user) {
return null; return null;
} }

View File

@ -25,7 +25,7 @@ import static org.testng.Assert.assertNotNull;
import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.AuthorizationException;
import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem; 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.Org;
import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.VDC;
@ -48,14 +48,14 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
@Test @Test
public void testGetVAppTemplate() throws Exception { public void testGetVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) { for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId()); Catalog response = connection.getCatalog(cat.getHref());
for (NamedResource resource : response.values()) { for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) { 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)) { if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
try { try {
assertNotNull(connection.getVAppTemplate(item.getEntity().getId())); assertNotNull(connection.getVAppTemplate(item.getEntity().getHref()));
} catch (AuthorizationException e) { } catch (AuthorizationException e) {
} }
@ -68,12 +68,12 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
@Test @Test
public void testGetVApp() throws Exception { public void testGetVApp() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) { for (ReferenceType vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId()); VDC response = connection.getVDC(vdc.getHref());
for (NamedResource item : response.getResourceEntities().values()) { for (ReferenceType item : response.getResourceEntities().values()) {
if (item.getType().equals(VCloudMediaType.VAPP_XML)) { if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
try { try {
VApp app = connection.getVApp(item.getId()); VApp app = connection.getVApp(item.getHref());
assertNotNull(app); assertNotNull(app);
} catch (RuntimeException e) { } catch (RuntimeException e) {
@ -87,12 +87,12 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
@Test @Test
public void testGetVm() throws Exception { public void testGetVm() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) { for (ReferenceType vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId()); VDC response = connection.getVDC(vdc.getHref());
for (NamedResource item : response.getResourceEntities().values()) { for (ReferenceType item : response.getResourceEntities().values()) {
if (item.getType().equals(VCloudMediaType.VAPP_XML)) { if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
try { try {
VApp app = connection.getVApp(item.getId()); VApp app = connection.getVApp(item.getHref());
assertNotNull(app); assertNotNull(app);
} catch (RuntimeException e) { } catch (RuntimeException e) {
@ -105,11 +105,11 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
@Test @Test
public void testFindVAppTemplate() throws Exception { public void testFindVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
for (NamedResource cat : org.getCatalogs().values()) { for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = connection.getCatalog(cat.getId()); Catalog response = connection.getCatalog(cat.getHref());
for (NamedResource resource : response.values()) { for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) { 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)) { if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
try { try {
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item 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.rest.internal.RestAnnotationProcessor;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import org.jclouds.vcloud.config.VCloudExpressRestClientModule; 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.Org;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VCloudSession;
import org.jclouds.vcloud.domain.internal.CatalogImpl; import org.jclouds.vcloud.domain.internal.CatalogImpl;
import org.jclouds.vcloud.domain.internal.CatalogItemImpl; 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.OrgImpl;
import org.jclouds.vcloud.domain.internal.VDCImpl; import org.jclouds.vcloud.domain.internal.VDCImpl;
import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.FenceMode;
@ -646,13 +646,13 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
} }
@Override @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"); return URI.create("https://vcloud.safesecureweb.com/api/v0.8/org");
} }
@Override @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"; return "org";
} }
@ -668,7 +668,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
} }
@Override @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; return null;
} }
@ -693,8 +693,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() { return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
@Override @Override
public Map<String, NamedResource> getOrgs() { public Map<String, ReferenceType> getOrgs() {
return ImmutableMap.<String, NamedResource> of("org", new NamedResourceImpl("org", return ImmutableMap.<String, ReferenceType> of("org", new ReferenceTypeImpl("org",
VCloudExpressMediaType.ORG_XML, URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"))); 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 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, .create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), null, null, "description", null,
null, null, null, null, ImmutableMap.<String, NamedResource> of("vapp", null, null, null, null, ImmutableMap.<String, ReferenceType> of("vapp",
new NamedResourceImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI new ReferenceTypeImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1")), .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 "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vdcItem/2"))), .create("https://vcloud.safesecureweb.com/api/v0.8/vdcItem/2"))),
null, 0, 0, 0, false)))); null, 0, 0, 0, false))));
@ -744,13 +744,13 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public Map<String, Org> get() { public Map<String, Org> get() {
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "org", null, ImmutableMap .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 VCloudExpressMediaType.CATALOG_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))), ImmutableMap .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 URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))), ImmutableMap
.<String, NamedResource> of(), .<String, ReferenceType> of(),
new NamedResourceImpl("tasksList", VCloudExpressMediaType.TASKSLIST_XML, URI new ReferenceTypeImpl("tasksList", VCloudExpressMediaType.TASKSLIST_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), ImmutableList .create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), ImmutableList
.<Task> of())); .<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", 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", 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 "application/vnd.vmware.vcloud.catalogItem+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1")), "template", .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"))), .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"))),
ImmutableList.<Task> of(), true))); ImmutableList.<Task> of(), true)));
} }
@ -800,7 +800,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
URI URI
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"), .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"),
"description", "description",
new NamedResourceImpl( new ReferenceTypeImpl(
"template", "template",
"application/vnd.vmware.vcloud.vAppTemplate+xml", "application/vnd.vmware.vcloud.vAppTemplate+xml",
URI URI

View File

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

View File

@ -97,7 +97,7 @@ public class VCloudComputeClientLiveTest {
InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties( InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties(
ImmutableMap.of("foo", "bar")); 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); Expectation expectation = expectationMap.get(toTest);
VApp vApp = client.getVApp(id); 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( InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties(
ImmutableMap.of("foo", "bar")); 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); Expectation expectation = expectationMap.get(toTest);
VCloudExpressVApp vApp = client.getVApp(id); VCloudExpressVApp vApp = client.getVApp(id);

View File

@ -55,7 +55,7 @@ public class VCloudExpressOrgNetworkAdapterTest {
VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is); VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is);
OrgNetwork result = new VCloudExpressOrgNetworkAdapter(in); OrgNetwork result = new VCloudExpressOrgNetworkAdapter(in);
assertEquals(result.getName(), "10.114.34.128/26"); 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.getType(), "application/vnd.vmware.vcloud.network+xml");
assertEquals(result.getOrg(), null); assertEquals(result.getOrg(), null);
assertEquals(result.getDescription(), null); assertEquals(result.getDescription(), null);
@ -85,7 +85,7 @@ public class VCloudExpressOrgNetworkAdapterTest {
VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is); VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is);
OrgNetwork result = new VCloudExpressOrgNetworkAdapter(in); OrgNetwork result = new VCloudExpressOrgNetworkAdapter(in);
assertEquals(result.getName(), "Pod03_Private"); 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.getType(), null);
assertEquals(result.getOrg(), null); assertEquals(result.getOrg(), null);
assertEquals(result.getDescription(), "Pod 03 Private Network"); 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.io.Payloads;
import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.VCloudSession; 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.BeforeTest;
import org.testng.annotations.Test; 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=/"); response.getHeaders().put(HttpHeaders.SET_COOKIE, "vcloud-token=9er4d061-4bff-48fa-84b1-5da7166764d2; path=/");
VCloudSession reply = parser.apply(response); VCloudSession reply = parser.apply(response);
assertEquals(reply.getVCloudToken(), "9er4d061-4bff-48fa-84b1-5da7166764d2"); 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")))); 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=/"); "vcloud-token=c9f232506df9b65d7b7d97b7499eddd7; Domain=.bluelock.com; Path=/");
VCloudSession reply = parser.apply(response); VCloudSession reply = parser.apply(response);
assertEquals(reply.getVCloudToken(), "c9f232506df9b65d7b7d97b7499eddd7"); 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")))); 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.ParseSax.Factory;
import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.http.functions.config.SaxParserModule;
import org.jclouds.vcloud.domain.Catalog; 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.Task;
import org.jclouds.vcloud.domain.internal.CatalogImpl; 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 org.testng.annotations.Test;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -58,10 +58,10 @@ public class CatalogHandlerTest {
factory = injector.getInstance(ParseSax.Factory.class); factory = injector.getInstance(ParseSax.Factory.class);
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(is); Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
assertEquals(result, new CatalogImpl("Jclouds-private", "application/vnd.vmware.vcloud.catalog+xml", URI 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 "application/vnd.vmware.vcloud.org+xml", URI
.create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")), null, ImmutableMap .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() { public void testTerremark() {
@ -72,66 +72,66 @@ public class CatalogHandlerTest {
assertEquals(result.getName(), "Miami Environment 1"); assertEquals(result.getName(), "Miami Environment 1");
assert result.getDescription() == null; assert result.getDescription() == null;
assertEquals(result.getId(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")); 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 NamedResourceImpl("CentOS 5.3 (32-bit)", CATALOGITEM_XML, URI 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"))); .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"))); .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"))); .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"))); .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"))); 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"))); 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"))); 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"))); 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 "Windows 2003 Enterprise R2 (32-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/1"))); .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 "Windows 2003 Enterprise R2 (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/2"))); .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 "Windows 2003 Standard R2 (32-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/3"))); .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 "Windows 2003 Standard R2 (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/4"))); .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 "Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/23"))); .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 "Windows Server 2008 Enterprise (32-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/13"))); .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 "Windows Server 2008 Enterprise (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/15"))); .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 "Windows Server 2008 Enterprise R2 (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/16"))); .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 "Windows Server 2008 Standard (32-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/17"))); .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 "Windows Server 2008 Standard (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/18"))); .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 "Windows Server 2008 Standard R2 (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/19"))); .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 "Windows Server 2008 Standard w.SQL 2008 Web (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/14"))); .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 "Windows Web Server 2008 (32-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/20"))); .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 "Windows Web Server 2008 (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/21"))); .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 "Windows Web Server 2008 R2 (64-bit)", CATALOGITEM_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22"))); .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.http.functions.config.SaxParserModule;
import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.internal.CatalogItemImpl; 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 org.testng.annotations.Test;
import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ImmutableSortedMap;
@ -52,7 +52,7 @@ public class CatalogItemHandlerTest {
assertEquals(result, new CatalogItemImpl("Windows 2008 Datacenter 64 Bit", URI 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", .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 "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")), .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")),
ImmutableSortedMap.of("Foo", "Bar", "Hello", "World" 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.VCloudExpressMediaType;
import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.domain.Org; 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 org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -57,18 +57,18 @@ public class OrgHandlerTest {
assertEquals(result.getName(), "ExampleOrg"); assertEquals(result.getName(), "ExampleOrg");
assertEquals(result.getFullName(), "ExampleOrg"); assertEquals(result.getFullName(), "ExampleOrg");
assertEquals(result.getDescription(), "Example Corp's Primary Organization."); assertEquals(result.getDescription(), "Example Corp's Primary Organization.");
assertEquals(result.getId(), URI.create("http://vcloud.example.com/api/v1.0/org/5")); assertEquals(result.getHref(), URI.create("http://vcloud.example.com/api/v1.0/org/5"));
assertEquals(result.getCatalogs(), ImmutableMap.of("Main Catalog", new NamedResourceImpl("Main Catalog", 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", 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")))); .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")))); 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")), 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")))); .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"))); .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); Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
assertEquals(result.getName(), "adrian@jclouds.org"); assertEquals(result.getName(), "adrian@jclouds.org");
assertEquals(result.getFullName(), "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.getHref(), 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.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new ReferenceTypeImpl(
"Miami Environment 1 Catalog", CATALOG_XML, URI "Miami Environment 1 Catalog", CATALOG_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")))); .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 "Miami Environment 1", VCloudExpressMediaType.VDC_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")))); .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"))); .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); Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
assertEquals(result.getName(), "Customer 188849"); assertEquals(result.getName(), "Customer 188849");
assertEquals(result.getFullName(), "Customer 188849"); assertEquals(result.getFullName(), "Customer 188849");
assertEquals(result.getId(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849")); assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849"));
assertEquals(result.getCatalogs(), ImmutableMap.of("HMS Shared Catalog", new NamedResourceImpl( 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")))); "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 "188849 Virtual DataCenter", VCloudExpressMediaType.VDC_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849")))); .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"))); .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.http.functions.BaseHandlerTest;
import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.NamedResource; import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.internal.NamedResourceImpl; import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -44,8 +44,8 @@ public class OrgListHandlerTest extends BaseHandlerTest {
public void testApplyInputStream() { public void testApplyInputStream() {
InputStream is = getClass().getResourceAsStream("/orglist.xml"); InputStream is = getClass().getResourceAsStream("/orglist.xml");
Map<String, NamedResource> result = factory.create(injector.getInstance(OrgListHandler.class)).parse(is); Map<String, ReferenceType> result = factory.create(injector.getInstance(OrgListHandler.class)).parse(is);
assertEquals(result, ImmutableMap.of("adrian@jclouds.org", new NamedResourceImpl("adrian@jclouds.org", 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")))); 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.ParseSax.Factory;
import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.http.functions.config.SaxParserModule;
import org.jclouds.vcloud.VCloudMediaType; 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.DhcpService;
import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.FenceMode;
import org.jclouds.vcloud.domain.network.IpRange; import org.jclouds.vcloud.domain.network.IpRange;
@ -54,9 +54,9 @@ public class OrgNetworkHandlerTest {
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is); OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is);
assertEquals(result.getName(), "isolation01"); 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.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"))); .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
assertEquals(result.getDescription(), null); assertEquals(result.getDescription(), null);
assertEquals(result.getTasks(), ImmutableList.of()); assertEquals(result.getTasks(), ImmutableList.of());
@ -85,9 +85,9 @@ public class OrgNetworkHandlerTest {
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is); OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is);
assertEquals(result.getName(), "internet01"); 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.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"))); .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
assertEquals(result.getDescription(), null); assertEquals(result.getDescription(), null);
assertEquals(result.getTasks(), ImmutableList.of()); 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.VCloudMediaType;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.TaskStatus; 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.jclouds.vcloud.domain.internal.TaskImpl;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; 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"), 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 TaskStatus.RUNNING, dateService.iso8601DateParse("2010-08-23T02:09:52.443-04:00"), dateService
.iso8601DateParse("9999-12-31T23:59:59.999-05: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 VCloudMediaType.VAPP_XML, URI
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320")) .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 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"), 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 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 VCloudMediaType.VAPP_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null .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-14T20:05:02Z"), dateService
.iso8601SecondsDateParse("2010-01-15T20:05:02Z"), .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); .create("https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96")), null);
assertEquals(result, expects); 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 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-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( 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", "Error processing job", 500, " Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00",
null, null)); null, null));

View File

@ -30,7 +30,7 @@ import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.TaskStatus; import org.jclouds.vcloud.domain.TaskStatus;
import org.jclouds.vcloud.domain.TasksList; 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.jclouds.vcloud.domain.internal.TaskImpl;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; 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")); .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"), 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 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 VCloudExpressMediaType.VAPP_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null); .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"), 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 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 VCloudExpressMediaType.VAPP_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null); .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null);
assertEquals(result.getTasks(), ImmutableSortedSet.of(task1, task2)); 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.Status;
import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.Vm; 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 org.testng.annotations.Test;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -52,21 +52,21 @@ public class VAppHandlerTest {
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is); VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
assertEquals(result.getName(), "vApp_acole_2"); 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")); .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"));
assertEquals(result.getType(), "application/vnd.vmware.vcloud.vApp+xml"); assertEquals(result.getType(), "application/vnd.vmware.vcloud.vApp+xml");
assertEquals(result.getStatus(), Status.OFF); 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"))); .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")));
assertEquals(result.getDescription(), null); assertEquals(result.getDescription(), null);
assertEquals(result.getTasks(), ImmutableList.of()); assertEquals(result.getTasks(), ImmutableList.of());
assert result.isOvfDescriptorUploaded(); assert result.isOvfDescriptorUploaded();
Vm vm = Iterables.getOnlyElement(result.getChildren()); Vm vm = Iterables.getOnlyElement(result.getChildren());
assertEquals(vm.getName(), "RHEL5"); 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.getType(), "application/vnd.vmware.vcloud.vm+xml");
assertEquals(vm.getStatus(), Status.OFF); 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"))); .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320")));
assertEquals(vm.getDescription(), null); assertEquals(vm.getDescription(), null);
assertEquals(vm.getTasks(), ImmutableList.of()); 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.Status;
import org.jclouds.vcloud.domain.VAppTemplate; import org.jclouds.vcloud.domain.VAppTemplate;
import org.jclouds.vcloud.domain.Vm; 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 org.testng.annotations.Test;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -52,11 +52,11 @@ public class VAppTemplateHandlerTest {
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is); VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
assertEquals(result.getName(), "Ubuntu Template"); assertEquals(result.getName(), "Ubuntu Template");
assertEquals(result.getId(), URI assertEquals(result.getHref(), URI
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921")); .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921"));
assertEquals(result.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml"); assertEquals(result.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
assertEquals(result.getStatus(), Status.OFF); 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"))); .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")));
assertEquals(result.getDescription(), null); assertEquals(result.getDescription(), null);
assertEquals(result.getTasks(), ImmutableList.of()); assertEquals(result.getTasks(), ImmutableList.of());
@ -64,11 +64,11 @@ public class VAppTemplateHandlerTest {
assert result.isOvfDescriptorUploaded(); assert result.isOvfDescriptorUploaded();
Vm vm = Iterables.getOnlyElement(result.getChildren()); Vm vm = Iterables.getOnlyElement(result.getChildren());
assertEquals(vm.getName(), "Ubuntu1004"); 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! // NOTE this is vAppTemplate not VM!
assertEquals(vm.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml"); assertEquals(vm.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
assertEquals(vm.getStatus(), null); 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"))); .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921")));
assertEquals(vm.getDescription(), null); assertEquals(vm.getDescription(), null);
assertEquals(vm.getTasks(), ImmutableList.of()); 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.Status;
import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VirtualSystem; 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.jclouds.vcloud.domain.internal.VCloudExpressVAppImpl;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; 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 result = factory.create(injector.getInstance(VCloudExpressVAppHandler.class)).parse(is);
VCloudExpressVApp expects = new VCloudExpressVAppImpl("centos53", URI 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")), "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()); ImmutableListMultimap.<String, String> of(), null, null, null, ImmutableSet.<ResourceAllocation> of());
assertEquals(result, expects); assertEquals(result, expects);
@ -106,10 +106,10 @@ public class VCloudExpressVAppHandlerTest extends BaseHandlerTest {
null, 104857, "byte * 2^20")).build(); null, 104857, "byte * 2^20")).build();
VCloudExpressVApp expects = new VCloudExpressVAppImpl("centos53", URI 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")), "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); 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.getName(), expects.getName());
assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses()); assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses());
assertEquals(result.getOperatingSystemDescription(), expects.getOperatingSystemDescription()); assertEquals(result.getOperatingSystemDescription(), expects.getOperatingSystemDescription());
@ -143,10 +143,10 @@ public class VCloudExpressVAppHandlerTest extends BaseHandlerTest {
null, 10485760, "byte * 2^20")).build(); null, 10485760, "byte * 2^20")).build();
VCloudExpressVApp expects = new VCloudExpressVAppImpl("m1", URI.create("http://localhost:8000/api/v0.8/vApp/80"), 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, .create("http://localhost:8000/api/v0.8/vdc/28")), networkToAddresses, null,
"Microsoft Windows XP Professional (32-bit)", system, resourceAllocations); "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.getName(), expects.getName());
assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses()); assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses());
assertEquals(result.getOperatingSystemDescription(), expects.getOperatingSystemDescription()); 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.VCloudMediaType;
import org.jclouds.vcloud.domain.AllocationModel; import org.jclouds.vcloud.domain.AllocationModel;
import org.jclouds.vcloud.domain.Capacity; 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.VDC;
import org.jclouds.vcloud.domain.VDCStatus; 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 org.testng.annotations.Test;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -55,10 +55,10 @@ public class VDCHandlerTest {
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is); VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
assertEquals(result.getName(), "Jclouds-Commit-compG1xstorA01"); 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.getType(), "application/vnd.vmware.vcloud.vdc+xml");
assertEquals(result.getStatus(), VDCStatus.READY); 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"))); .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
assertEquals(result.getDescription(), null); assertEquals(result.getDescription(), null);
assertEquals(result.getTasks(), ImmutableList.of()); assertEquals(result.getTasks(), ImmutableList.of());
@ -66,11 +66,11 @@ public class VDCHandlerTest {
assertEquals(result.getStorageCapacity(), new Capacity("MB", 1024000, 1024000, 0, 0)); assertEquals(result.getStorageCapacity(), new Capacity("MB", 1024000, 1024000, 0, 0));
assertEquals(result.getCpuCapacity(), new Capacity("MHz", 20000, 20000, 0, 0)); assertEquals(result.getCpuCapacity(), new Capacity("MHz", 20000, 20000, 0, 0));
assertEquals(result.getMemoryCapacity(), new Capacity("MB", 30720, 30720, 0, 0)); assertEquals(result.getMemoryCapacity(), new Capacity("MB", 30720, 30720, 0, 0));
assertEquals(result.getResourceEntities(), ImmutableMap.<String, NamedResource> of()); assertEquals(result.getResourceEntities(), ImmutableMap.<String, ReferenceType> of());
assertEquals(result.getAvailableNetworks(), ImmutableMap.of("isolation01", new NamedResourceImpl("isolation01", assertEquals(result.getAvailableNetworks(), ImmutableMap.of("isolation01", new ReferenceTypeImpl("isolation01",
"application/vnd.vmware.vcloud.network+xml", URI "application/vnd.vmware.vcloud.network+xml", URI
.create("https://vcenterprise.bluelock.com/api/v1.0/network/990419644")), "internet01", .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")))); .create("https://vcenterprise.bluelock.com/api/v1.0/network/758634723"))));
assertEquals(result.getNicQuota(), 0); assertEquals(result.getNicQuota(), 0);
assertEquals(result.getNetworkQuota(), 100); assertEquals(result.getNetworkQuota(), 100);
@ -84,18 +84,18 @@ public class VDCHandlerTest {
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is); VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
assertEquals(result.getName(), "Miami Environment 1"); 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.getDescription(), null);
assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 100, 0, 8, 0)); 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.getCpuCapacity(), new Capacity("hz * 10^6", 5000, 0, 0, 0));
assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 2^20", 10240, 0, 0, 0)); assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 2^20", 10240, 0, 0, 0));
assertEquals(result.getVmQuota(), 0); assertEquals(result.getVmQuota(), 0);
assertEquals(result.getResourceEntities(), ImmutableMap.<String, NamedResource> of("adriantest", assertEquals(result.getResourceEntities(), ImmutableMap.<String, ReferenceType> of("adriantest",
new NamedResourceImpl("adriantest", VCloudExpressMediaType.VAPP_XML, URI new ReferenceTypeImpl("adriantest", VCloudExpressMediaType.VAPP_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124")), "centos-53", .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")))); .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 "10.114.34.128/26", "application/vnd.vmware.vcloud.network+xml", URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708")))); .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); Factory factory = injector.getInstance(ParseSax.Factory.class);
VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is); VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
assertEquals(result.getName(), "vDC Name"); 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.getDescription(), "vDC Name");
assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 0, 0, 40960, 0)); 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.getCpuCapacity(), new Capacity("hz * 10^6", 0, 0, 2400, 0));
assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 10^9", 0, 0, 2, 0)); assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 10^9", 0, 0, 2, 0));
assertEquals(result.getVmQuota(), 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", "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( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1"))).put(
"Windows 2008 Datacenter 64 Bit Template", "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 "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"))).put( .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"))).put(
"Cent OS 64 Bit Template", "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( .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"))).put(
"cPanel (Linux) 64 Bit Template", "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 "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"))).put( .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"))).put(
"188849-1", "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( .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1"))).put(
"188849-2", "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()); .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.VCloudMediaType;
import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.Vm; 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 org.testng.annotations.Test;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -50,11 +50,11 @@ public class VmHandlerTest {
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
Vm result = factory.create(injector.getInstance(VmHandler.class)).parse(is); Vm result = factory.create(injector.getInstance(VmHandler.class)).parse(is);
assertEquals(result.getName(), "RHEL5"); assertEquals(result.getName(), "RHEL5");
assertEquals(result.getId(), URI assertEquals(result.getHref(), URI
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248")); .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248"));
assertEquals(result.getType(), "application/vnd.vmware.vcloud.vm+xml"); assertEquals(result.getType(), "application/vnd.vmware.vcloud.vm+xml");
assertEquals(result.getStatus(), Status.OFF); 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"))); .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320")));
assertEquals(result.getDescription(), null); assertEquals(result.getDescription(), null);
assertEquals(result.getTasks(), ImmutableList.of()); assertEquals(result.getTasks(), ImmutableList.of());

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