Issue 386: fixed find method in vcloud

This commit is contained in:
Adrian Cole 2010-10-31 11:37:44 -07:00
parent a45532f05c
commit ad61d6e071
7 changed files with 259 additions and 210 deletions

View File

@ -95,15 +95,14 @@ import com.google.inject.name.Names;
import domain.VCloudVersionsAsyncClient; import domain.VCloudVersionsAsyncClient;
/** /**
* Configures the VCloud authentication service connection, including logging * Configures the VCloud authentication service connection, including logging and http transport.
* and http transport.
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequiresHttp @RequiresHttp
@ConfiguresRestClient @ConfiguresRestClient
public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extends CommonVCloudAsyncClient> extends public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extends CommonVCloudAsyncClient> extends
RestClientModule<S, A> { RestClientModule<S, A> {
public CommonVCloudRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) { public CommonVCloudRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {
super(syncClientType, asyncClientType); super(syncClientType, asyncClientType);
@ -146,29 +145,39 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Singleton @Singleton
@org.jclouds.vcloud.endpoints.VDC @org.jclouds.vcloud.endpoints.VDC
protected Supplier<Map<String, String>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds, protected Supplier<Map<String, String>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
final Supplier<Map<String, ? extends Org>> orgToVDCSupplier) { final Supplier<Map<String, ? extends Org>> orgToVDCSupplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, String>>(authException, seconds, return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, String>>(authException, seconds,
new Supplier<Map<String, String>>() { new Supplier<Map<String, String>>() {
@Override @Override
public Map<String, String> get() { public Map<String, String> get() {
Map<String, String> returnVal = newLinkedHashMap(); Map<String, String> returnVal = newLinkedHashMap();
for (Entry<String, ? extends Org> orgr : orgToVDCSupplier.get().entrySet()) { for (Entry<String, ? extends Org> orgr : orgToVDCSupplier.get().entrySet()) {
for (String vdc : orgr.getValue().getVDCs().keySet()) { for (String vdc : orgr.getValue().getVDCs().keySet()) {
returnVal.put(vdc, orgr.getKey()); returnVal.put(vdc, orgr.getKey());
}
} }
return returnVal;
} }
return returnVal; });
}
});
} }
@Provides @Provides
@org.jclouds.vcloud.endpoints.VDC @org.jclouds.vcloud.endpoints.VDC
@Singleton @Singleton
protected URI provideDefaultVDC(Org org) { protected URI provideDefaultVDC(Org org, @org.jclouds.vcloud.endpoints.VDC String defaultVDC) {
checkState(org.getVDCs().size() > 0, "No vdcs present in org: " + org.getName()); checkState(org.getVDCs().size() > 0, "No vdcs present in org %s", org.getName());
return get(org.getVDCs().values(), 0).getHref(); return checkNotNull(org.getVDCs().get(defaultVDC), "vdc %s not present in org %s", defaultVDC, org.getName())
.getHref();
}
@Provides
@org.jclouds.vcloud.endpoints.VDC
@Singleton
protected String provideDefaultVDCName(@org.jclouds.vcloud.endpoints.VDC Supplier<Map<String, String>> vDCtoOrgSupplier) {
Map<String, String> vDCtoOrg = vDCtoOrgSupplier.get();
checkState(vDCtoOrg.keySet().size() > 0, "No vdcs present!");
return get(vDCtoOrg.keySet(), 0);
} }
@Provides @Provides
@ -182,15 +191,15 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Provides @Provides
@Singleton @Singleton
protected Supplier<Map<String, ? extends Org>> provideOrgMapCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds, protected Supplier<Map<String, ? extends Org>> provideOrgMapCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
final OrgMapSupplier supplier) { final OrgMapSupplier supplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, ? extends Org>>(authException, return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, ? extends Org>>(authException,
seconds, new Supplier<Map<String, ? extends Org>>() { seconds, new Supplier<Map<String, ? extends Org>>() {
@Override @Override
public Map<String, ? extends Org> get() { public Map<String, ? extends Org> get() {
return supplier.get(); return supplier.get();
} }
}); });
} }
@Provides @Provides
@ -199,7 +208,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
URI provideOrgListURI(Supplier<VCloudSession> sessionSupplier) { URI provideOrgListURI(Supplier<VCloudSession> sessionSupplier) {
VCloudSession session = sessionSupplier.get(); VCloudSession session = sessionSupplier.get();
return URI.create(Iterables.getLast(session.getOrgs().values()).getHref().toASCIIString().replaceAll("org/.*", return URI.create(Iterables.getLast(session.getOrgs().values()).getHref().toASCIIString().replaceAll("org/.*",
"org")); "org"));
} }
@Singleton @Singleton
@ -209,7 +218,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Inject @Inject
protected OrgMapSupplier(Supplier<VCloudSession> sessionSupplier, protected OrgMapSupplier(Supplier<VCloudSession> sessionSupplier,
Function<Iterable<String>, Iterable<? extends Org>> organizationsForNames) { Function<Iterable<String>, Iterable<? extends Org>> organizationsForNames) {
this.sessionSupplier = sessionSupplier; this.sessionSupplier = sessionSupplier;
this.organizationsForNames = organizationsForNames; this.organizationsForNames = organizationsForNames;
} }
@ -222,13 +231,13 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Singleton @Singleton
public static class OrgCatalogSupplier implements public static class OrgCatalogSupplier implements
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> { Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> {
protected final Supplier<Map<String, ? extends Org>> orgSupplier; protected final Supplier<Map<String, ? extends Org>> orgSupplier;
private final Function<Org, Iterable<? extends org.jclouds.vcloud.domain.Catalog>> allCatalogsInOrg; private final Function<Org, Iterable<? extends org.jclouds.vcloud.domain.Catalog>> allCatalogsInOrg;
@Inject @Inject
protected OrgCatalogSupplier(Supplier<Map<String, ? extends Org>> orgSupplier, protected OrgCatalogSupplier(Supplier<Map<String, ? extends Org>> orgSupplier,
Function<Org, Iterable<? extends org.jclouds.vcloud.domain.Catalog>> allCatalogsInOrg) { Function<Org, Iterable<? extends org.jclouds.vcloud.domain.Catalog>> allCatalogsInOrg) {
this.orgSupplier = orgSupplier; this.orgSupplier = orgSupplier;
this.allCatalogsInOrg = allCatalogsInOrg; this.allCatalogsInOrg = allCatalogsInOrg;
} }
@ -236,16 +245,16 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Override @Override
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() { public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() {
return transformValues( return transformValues(
transformValues(orgSupplier.get(), allCatalogsInOrg), transformValues(orgSupplier.get(), allCatalogsInOrg),
new Function<Iterable<? extends org.jclouds.vcloud.domain.Catalog>, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>() { new Function<Iterable<? extends org.jclouds.vcloud.domain.Catalog>, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>() {
@Override @Override
public Map<String, ? extends org.jclouds.vcloud.domain.Catalog> apply( public Map<String, ? extends org.jclouds.vcloud.domain.Catalog> apply(
Iterable<? extends org.jclouds.vcloud.domain.Catalog> from) { Iterable<? extends org.jclouds.vcloud.domain.Catalog> from) {
return uniqueIndex(from, name); return uniqueIndex(from, name);
} }
}); });
} }
} }
@ -276,27 +285,27 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@org.jclouds.vcloud.endpoints.Org @org.jclouds.vcloud.endpoints.Org
@Singleton @Singleton
protected Supplier<Map<String, ReferenceType>> 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, ReferenceType>>(authException, return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, ReferenceType>>(authException,
seconds, new Supplier<Map<String, ReferenceType>>() { seconds, new Supplier<Map<String, ReferenceType>>() {
@Override @Override
public Map<String, ReferenceType> get() { public Map<String, ReferenceType> get() {
return supplier.get(); return supplier.get();
} }
}); });
} }
@Provides @Provides
@Singleton @Singleton
protected Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>> provideURIToVDC( protected Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>> provideURIToVDC(
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final URItoVDC supplier) { @Named(PROPERTY_SESSION_INTERVAL) long seconds, final URItoVDC supplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>( return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>(
authException, seconds, new Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>() { authException, seconds, new Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>() {
@Override @Override
public Map<URI, ? extends org.jclouds.vcloud.domain.VDC> get() { public Map<URI, ? extends org.jclouds.vcloud.domain.VDC> get() {
return supplier.get(); return supplier.get();
} }
}); });
} }
@Singleton @Singleton
@ -311,24 +320,24 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Override @Override
public Map<URI, ? extends org.jclouds.vcloud.domain.VDC> get() { public Map<URI, ? extends org.jclouds.vcloud.domain.VDC> get() {
return uniqueIndex( return uniqueIndex(
concat(transform( concat(transform(
orgVDCMap.get().values(), orgVDCMap.get().values(),
new Function<Map<String, ? extends org.jclouds.vcloud.domain.VDC>, Iterable<? extends org.jclouds.vcloud.domain.VDC>>() { new Function<Map<String, ? extends org.jclouds.vcloud.domain.VDC>, Iterable<? extends org.jclouds.vcloud.domain.VDC>>() {
@Override @Override
public Iterable<? extends org.jclouds.vcloud.domain.VDC> apply( public Iterable<? extends org.jclouds.vcloud.domain.VDC> apply(
Map<String, ? extends org.jclouds.vcloud.domain.VDC> from) { Map<String, ? extends org.jclouds.vcloud.domain.VDC> from) {
return from.values(); return from.values();
} }
})), new Function<org.jclouds.vcloud.domain.VDC, URI>() { })), new Function<org.jclouds.vcloud.domain.VDC, URI>() {
@Override @Override
public URI apply(org.jclouds.vcloud.domain.VDC from) { public URI apply(org.jclouds.vcloud.domain.VDC from) {
return from.getHref(); return from.getHref();
} }
}); });
} }
} }
@ -357,7 +366,8 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Singleton @Singleton
@org.jclouds.vcloud.endpoints.VCloudLogin @org.jclouds.vcloud.endpoints.VCloudLogin
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService, protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
@Named(PROPERTY_API_VERSION) String version) throws InterruptedException, ExecutionException, TimeoutException { @Named(PROPERTY_API_VERSION) String version) throws InterruptedException, ExecutionException,
TimeoutException {
SortedMap<String, URI> versions = versionService.getSupportedVersions().get(180, TimeUnit.SECONDS); SortedMap<String, URI> versions = versionService.getSupportedVersions().get(180, TimeUnit.SECONDS);
checkState(versions.size() > 0, "No versions present"); checkState(versions.size() > 0, "No versions present");
checkState(versions.containsKey(version), "version " + version + " not present in: " + versions); checkState(versions.containsKey(version), "version " + version + " not present in: " + versions);
@ -391,7 +401,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@org.jclouds.vcloud.endpoints.Catalog @org.jclouds.vcloud.endpoints.Catalog
@Singleton @Singleton
protected String provideCatalogName( protected String provideCatalogName(
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogs) { Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogs) {
return getLast(getLast(catalogs.get().values()).keySet()); return getLast(getLast(catalogs.get().values()).keySet());
} }
@ -399,7 +409,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Network @Network
@Singleton @Singleton
protected URI provideDefaultNetwork(@org.jclouds.vcloud.endpoints.VDC URI defaultVDC, CommonVCloudClient client, protected URI provideDefaultNetwork(@org.jclouds.vcloud.endpoints.VDC URI defaultVDC, CommonVCloudClient client,
Injector injector) { Injector injector) {
if (authException.get() != null) if (authException.get() != null)
throw authException.get(); throw authException.get();
try { try {
@ -410,18 +420,23 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
return Iterables.getLast(networks.values()).getHref(); return Iterables.getLast(networks.values()).getHref();
try { try {
String networkName = injector.getInstance(Key.get(String.class, Names String networkName = injector.getInstance(Key.get(String.class, Names
.named(PROPERTY_VCLOUD_DEFAULT_NETWORK))); .named(PROPERTY_VCLOUD_DEFAULT_NETWORK)));
ReferenceType network = networks.get(networkName); ReferenceType network = networks.get(networkName);
checkState(network != null, String.format("network named %s not in %s", networkName, networks.keySet())); checkState(network != null, String.format("network named %s not in %s", networkName, networks.keySet()));
return network.getHref(); return network.getHref();
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
// TODO FIXME XXX: In Terremark Enterprise environment with multiple VDC's this does not work well. // TODO FIXME XXX: In Terremark Enterprise environment with multiple VDC's this does not
// Each VDC will have differnt network subnets. So we cannot assume the default VDC's networks will // work well.
// work with non-default VDC's. So make PROPERTY_VCLOUD_DEFAULT_NETWORK optional. If this property // Each VDC will have differnt network subnets. So we cannot assume the default VDC's
// is not set, they are expected to add NetworkConfig to the options when launching a server. // networks will
// work with non-default VDC's. So make PROPERTY_VCLOUD_DEFAULT_NETWORK optional. If
// this property
// is not set, they are expected to add NetworkConfig to the options when launching a
// server.
return null; return null;
//throw new IllegalStateException(String.format("you must specify the property %s as one of %s", // throw new
// PROPERTY_VCLOUD_DEFAULT_NETWORK, networks.keySet()), e); // IllegalStateException(String.format("you must specify the property %s as one of %s",
// PROPERTY_VCLOUD_DEFAULT_NETWORK, networks.keySet()), e);
} }
} catch (AuthorizationException e) { } catch (AuthorizationException e) {
authException.set(e); authException.set(e);
@ -445,48 +460,49 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Provides @Provides
@Singleton @Singleton
protected Predicate<URI> successTester(Injector injector, protected Predicate<URI> successTester(Injector injector,
@Named(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED) long completed) { @Named(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED) long completed) {
return new RetryablePredicate<URI>(injector.getInstance(TaskSuccess.class), completed); return new RetryablePredicate<URI>(injector.getInstance(TaskSuccess.class), completed);
} }
@Provides @Provides
@Singleton @Singleton
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> provideOrgCatalogItemMapSupplierCache( protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> provideOrgCatalogItemMapSupplierCache(
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgCatalogSupplier supplier) { @Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgCatalogSupplier supplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>>( return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>>(
authException, seconds, authException, seconds,
new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>>() { new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>>() {
@Override @Override
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() { public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() {
return supplier.get(); return supplier.get();
} }
}); });
} }
@Provides @Provides
@Singleton @Singleton
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache( protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) { @Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>( return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>(
authException, seconds, new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>() { authException, seconds,
@Override new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>() {
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() { @Override
return supplier.get(); public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
} return supplier.get();
}
}); });
} }
@Singleton @Singleton
public static class OrgVDCSupplier implements public static class OrgVDCSupplier implements
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> { Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> {
protected final Supplier<Map<String, ? extends Org>> orgSupplier; protected final Supplier<Map<String, ? extends Org>> orgSupplier;
private final Function<Org, Iterable<? extends org.jclouds.vcloud.domain.VDC>> allVDCsInOrg; private final Function<Org, Iterable<? extends org.jclouds.vcloud.domain.VDC>> allVDCsInOrg;
@Inject @Inject
protected OrgVDCSupplier(Supplier<Map<String, ? extends Org>> orgSupplier, protected OrgVDCSupplier(Supplier<Map<String, ? extends Org>> orgSupplier,
Function<Org, Iterable<? extends org.jclouds.vcloud.domain.VDC>> allVDCsInOrg) { Function<Org, Iterable<? extends org.jclouds.vcloud.domain.VDC>> allVDCsInOrg) {
this.orgSupplier = orgSupplier; this.orgSupplier = orgSupplier;
this.allVDCsInOrg = allVDCsInOrg; this.allVDCsInOrg = allVDCsInOrg;
} }
@ -494,29 +510,29 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Override @Override
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() { public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
return transformValues( return transformValues(
transformValues(orgSupplier.get(), allVDCsInOrg), transformValues(orgSupplier.get(), allVDCsInOrg),
new Function<Iterable<? extends org.jclouds.vcloud.domain.VDC>, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>() { new Function<Iterable<? extends org.jclouds.vcloud.domain.VDC>, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>() {
@Override @Override
public Map<String, ? extends org.jclouds.vcloud.domain.VDC> apply( public Map<String, ? extends org.jclouds.vcloud.domain.VDC> apply(
Iterable<? extends org.jclouds.vcloud.domain.VDC> from) { Iterable<? extends org.jclouds.vcloud.domain.VDC> from) {
return uniqueIndex(from, name); return uniqueIndex(from, name);
} }
}); });
} }
} }
@Singleton @Singleton
public static class OrgCatalogItemSupplier implements public static class OrgCatalogItemSupplier implements
Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> { Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> {
protected final Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogSupplier; protected final Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogSupplier;
private final Function<org.jclouds.vcloud.domain.Catalog, Iterable<? extends CatalogItem>> allCatalogItemsInCatalog; private final Function<org.jclouds.vcloud.domain.Catalog, Iterable<? extends CatalogItem>> allCatalogItemsInCatalog;
@Inject @Inject
protected OrgCatalogItemSupplier( protected OrgCatalogItemSupplier(
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogSupplier, Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogSupplier,
Function<org.jclouds.vcloud.domain.Catalog, Iterable<? extends CatalogItem>> allCatalogItemsInCatalog) { Function<org.jclouds.vcloud.domain.Catalog, Iterable<? extends CatalogItem>> allCatalogItemsInCatalog) {
this.catalogSupplier = catalogSupplier; this.catalogSupplier = catalogSupplier;
this.allCatalogItemsInCatalog = allCatalogItemsInCatalog; this.allCatalogItemsInCatalog = allCatalogItemsInCatalog;
} }
@ -524,39 +540,40 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
@Override @Override
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() { public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
return transformValues( return transformValues(
catalogSupplier.get(), catalogSupplier.get(),
new Function<Map<String, ? extends org.jclouds.vcloud.domain.Catalog>, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>() { new Function<Map<String, ? extends org.jclouds.vcloud.domain.Catalog>, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>() {
@Override @Override
public Map<String, Map<String, ? extends CatalogItem>> apply( public Map<String, Map<String, ? extends CatalogItem>> apply(
Map<String, ? extends org.jclouds.vcloud.domain.Catalog> from) { Map<String, ? extends org.jclouds.vcloud.domain.Catalog> from) {
return transformValues( return transformValues(
from, from,
new Function<org.jclouds.vcloud.domain.Catalog, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>() { new Function<org.jclouds.vcloud.domain.Catalog, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>() {
@Override @Override
public Map<String, ? extends CatalogItem> apply(org.jclouds.vcloud.domain.Catalog from) { public Map<String, ? extends CatalogItem> apply(
return uniqueIndex(allCatalogItemsInCatalog.apply(from), name); org.jclouds.vcloud.domain.Catalog from) {
} return uniqueIndex(allCatalogItemsInCatalog.apply(from), name);
}); }
});
} }
}); });
} }
} }
@Provides @Provides
@Singleton @Singleton
protected Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> provideOrgCatalogItemSupplierCache( protected Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> provideOrgCatalogItemSupplierCache(
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgCatalogItemSupplier supplier) { @Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgCatalogItemSupplier supplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>>( return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>>(
authException, seconds, authException, seconds,
new Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>>() { new Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>>() {
@Override @Override
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() { public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
return supplier.get(); return supplier.get();
} }
}); });
} }
@Provides @Provides

View File

@ -852,10 +852,15 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
} }
@Override @Override
protected URI provideDefaultVDC(Org org) { protected URI provideDefaultVDC(Org org, @org.jclouds.vcloud.endpoints.VDC String defaultVDC) {
return URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"); return URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1");
} }
@Override
protected String provideDefaultVDCName(@org.jclouds.vcloud.endpoints.VDC Supplier<Map<String, String>> vDCtoOrgSupplier) {
return "vdc";
}
@Override @Override
protected URI provideDefaultNetwork(URI vdc, CommonVCloudClient client, Injector injector) { protected URI provideDefaultNetwork(URI vdc, CommonVCloudClient client, Injector injector) {
return URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1990"); return URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1990");

View File

@ -120,12 +120,10 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
String.class, InstantiateVAppTemplateOptions[].class); String.class, InstantiateVAppTemplateOptions[].class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI .create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"), "my-vapp", .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"), "my-vapp", processorCount(1)
processorCount(1).memory(512).disk(1024) .memory(512).disk(1024).addNetworkConfig(
.addNetworkConfig( new NetworkConfig(null, URI.create("https://vcloud.safesecureweb.com/network/1990"),
new NetworkConfig(null, URI FenceMode.BRIDGED)));
.create("https://vcloud.safesecureweb.com/network/1990"),
FenceMode.BRIDGED)));
assertRequestLineEquals(request, assertRequestLineEquals(request,
"POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1"); "POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
@ -685,10 +683,16 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
} }
@Override @Override
protected URI provideDefaultVDC(Org org) { protected URI provideDefaultVDC(Org org, @org.jclouds.vcloud.endpoints.VDC String defaultVDC) {
return URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"); return URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1");
} }
@Override
protected String provideDefaultVDCName(
@org.jclouds.vcloud.endpoints.VDC Supplier<Map<String, String>> vDCtoOrgSupplier) {
return "vdc";
}
@Override @Override
protected URI provideDefaultNetwork(URI vdc, CommonVCloudClient client, Injector injector) { protected URI provideDefaultNetwork(URI vdc, CommonVCloudClient client, Injector injector) {
return URI.create("https://vcloud.safesecureweb.com/network/1990"); return URI.create("https://vcloud.safesecureweb.com/network/1990");

View File

@ -30,6 +30,7 @@ import org.jclouds.rest.RestContext;
import org.jclouds.ssh.jsch.config.JschSshClientModule; import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.VCloudAsyncClient;
import org.jclouds.vcloud.VCloudClient; import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.domain.VApp;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@ -63,6 +64,11 @@ public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
assertEquals(node.getType(), ComputeType.NODE); assertEquals(node.getType(), ComputeType.NODE);
NodeMetadata allData = client.getNodeMetadata(node.getId()); NodeMetadata allData = client.getNodeMetadata(node.getId());
System.out.println(allData.getHardware()); System.out.println(allData.getHardware());
RestContext<VCloudClient, VCloudAsyncClient> tmContext = new ComputeServiceContextFactory().createContext(
provider, identity, credential).getProviderSpecificContext();
VApp vApp = tmContext.getApi().findVAppInOrgVDCNamed(null, null, allData.getName());
assertEquals(vApp.getName(), allData.getName());
} }
} }
} }

View File

@ -43,7 +43,9 @@ import org.jclouds.compute.strategy.DestroyNodeStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy; import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy; import org.jclouds.compute.strategy.ListNodesStrategy;
import org.jclouds.compute.strategy.RebootNodeStrategy; import org.jclouds.compute.strategy.RebootNodeStrategy;
import org.jclouds.compute.strategy.ResumeNodeStrategy;
import org.jclouds.compute.strategy.RunNodesAndAddToSetStrategy; import org.jclouds.compute.strategy.RunNodesAndAddToSetStrategy;
import org.jclouds.compute.strategy.SuspendNodeStrategy;
import org.jclouds.compute.util.ComputeUtils; import org.jclouds.compute.util.ComputeUtils;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
@ -69,14 +71,17 @@ public class TerremarkVCloudComputeService extends BaseComputeService {
@Memoized Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy, @Memoized Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy,
GetNodeMetadataStrategy getNodeMetadataStrategy, RunNodesAndAddToSetStrategy runNodesAndAddToSetStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy, RunNodesAndAddToSetStrategy runNodesAndAddToSetStrategy,
RebootNodeStrategy rebootNodeStrategy, DestroyNodeStrategy destroyNodeStrategy, RebootNodeStrategy rebootNodeStrategy, DestroyNodeStrategy destroyNodeStrategy,
ResumeNodeStrategy resumeNodeStrategy, SuspendNodeStrategy suspendNodeStrategy,
Provider<TemplateBuilder> templateBuilderProvider, Provider<TemplateOptions> templateOptionsProvider, Provider<TemplateBuilder> templateBuilderProvider, Provider<TemplateOptions> templateOptionsProvider,
@Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning, @Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, Timeouts timeouts, @Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated,
@Named("NODE_SUSPENDED") Predicate<NodeMetadata> nodeSuspended, ComputeUtils utils, Timeouts timeouts,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, CleanupOrphanKeys cleanupOrphanKeys, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, CleanupOrphanKeys cleanupOrphanKeys,
ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap, NodeMetadataToOrgAndName nodeToOrgAndName) { ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap, NodeMetadataToOrgAndName nodeToOrgAndName) {
super(context, credentialStore, images, sizes, locations, listNodesStrategy, getNodeMetadataStrategy, super(context, credentialStore, images, sizes, locations, listNodesStrategy, getNodeMetadataStrategy,
runNodesAndAddToSetStrategy, rebootNodeStrategy, destroyNodeStrategy, templateBuilderProvider, runNodesAndAddToSetStrategy, rebootNodeStrategy, destroyNodeStrategy, resumeNodeStrategy,
templateOptionsProvider, nodeRunning, nodeTerminated, utils, timeouts, executor); suspendNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning, nodeTerminated,
nodeSuspended, utils, timeouts, executor);
this.cleanupOrphanKeys = cleanupOrphanKeys; this.cleanupOrphanKeys = cleanupOrphanKeys;
} }

View File

@ -309,20 +309,20 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
} }
public void testGetKeyPairInOrg() throws SecurityException, NoSuchMethodException, IOException { public void testGetKeyPairInOrg() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkECloudAsyncClient.class.getMethod("findKeyPairInOrg", URI.class, String.class); Method method = TerremarkECloudAsyncClient.class.getMethod("findKeyPairInOrg", URI.class, String.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "keyPair"); .create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "keyPair");
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/keysList/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/keysList/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.ecloud.keysList+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.ecloud.keysList+xml\n");
assertPayloadEquals(request, null, null, false); assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, KeyPairByNameHandler.class); assertSaxResponseParserClassEquals(method, KeyPairByNameHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
public void testConfigureNodeWithDescription() throws SecurityException, NoSuchMethodException, IOException { public void testConfigureNodeWithDescription() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkECloudAsyncClient.class.getMethod("configureNode", URI.class, String.class, Method method = TerremarkECloudAsyncClient.class.getMethod("configureNode", URI.class, String.class,
@ -409,56 +409,56 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
} }
public void testListKeyPairsInOrg() throws SecurityException, NoSuchMethodException, IOException { public void testListKeyPairsInOrg() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkECloudAsyncClient.class.getMethod("listKeyPairsInOrg", URI.class); Method method = TerremarkECloudAsyncClient.class.getMethod("listKeyPairsInOrg", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/org/1")); .create("https://vcloud.safesecureweb.com/api/v0.8/org/1"));
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/keysList/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/keysList/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.ecloud.keysList+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.ecloud.keysList+xml\n");
assertPayloadEquals(request, null, null, false); assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, KeyPairsHandler.class); assertSaxResponseParserClassEquals(method, KeyPairsHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@Test(expectedExceptions = ResourceNotFoundException.class) @Test(expectedExceptions = ResourceNotFoundException.class)
public void testListKeyPairsInOrgNotFound() throws SecurityException, NoSuchMethodException, IOException { public void testListKeyPairsInOrgNotFound() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkECloudAsyncClient.class.getMethod("listKeyPairsInOrg", URI.class); Method method = TerremarkECloudAsyncClient.class.getMethod("listKeyPairsInOrg", URI.class);
processor.createRequest(method, URI.create("d")); processor.createRequest(method, URI.create("d"));
} }
public void testGetKeyPair() throws SecurityException, NoSuchMethodException, IOException { public void testGetKeyPair() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkECloudAsyncClient.class.getMethod("getKeyPair", URI.class); Method method = TerremarkECloudAsyncClient.class.getMethod("getKeyPair", URI.class);
HttpRequest request = processor.createRequest(method, URI.create("https://vcloud/extensions/key/12")); HttpRequest request = processor.createRequest(method, URI.create("https://vcloud/extensions/key/12"));
assertRequestLineEquals(request, "GET https://vcloud/extensions/key/12 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud/extensions/key/12 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/xml\n");
assertPayloadEquals(request, null, null, false); assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, KeyPairHandler.class); assertSaxResponseParserClassEquals(method, KeyPairHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException { public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkECloudAsyncClient.class.getMethod("deleteKeyPair", URI.class); Method method = TerremarkECloudAsyncClient.class.getMethod("deleteKeyPair", URI.class);
HttpRequest request = processor.createRequest(method, URI.create("https://vcloud/extensions/key/12")); HttpRequest request = processor.createRequest(method, URI.create("https://vcloud/extensions/key/12"));
assertRequestLineEquals(request, "DELETE https://vcloud/extensions/key/12 HTTP/1.1"); assertRequestLineEquals(request, "DELETE https://vcloud/extensions/key/12 HTTP/1.1");
assertNonPayloadHeadersEqual(request, ""); assertNonPayloadHeadersEqual(request, "");
assertPayloadEquals(request, null, null, false); assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
public void testGetNode() throws SecurityException, NoSuchMethodException, IOException { public void testGetNode() throws SecurityException, NoSuchMethodException, IOException {
Method method = TerremarkECloudAsyncClient.class.getMethod("getNode", URI.class); Method method = TerremarkECloudAsyncClient.class.getMethod("getNode", URI.class);
@ -530,8 +530,9 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
@Override @Override
public ReferenceType apply(ReferenceType from) { public ReferenceType apply(ReferenceType from) {
return new ReferenceTypeImpl(from.getName(), TerremarkECloudMediaType.KEYSLIST_XML, URI return new ReferenceTypeImpl(from.getName(), TerremarkECloudMediaType.KEYSLIST_XML, URI.create(from
.create(from.getHref().toASCIIString() + "/keysList")); .getHref().toASCIIString()
+ "/keysList"));
} }
}); });
} }
@ -549,13 +550,12 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
return ImmutableMap.<String, Org> of("org", new TerremarkOrgImpl("org", null, URI return ImmutableMap.<String, Org> of("org", new TerremarkOrgImpl("org", null, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), null, ImmutableMap .create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), null, ImmutableMap
.<String, ReferenceType> of("catalog", new ReferenceTypeImpl("catalog", .<String, ReferenceType> of("catalog", new ReferenceTypeImpl("catalog",
TerremarkECloudMediaType.CATALOG_XML, URI TerremarkECloudMediaType.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, ReferenceType> of("vdc", new ReferenceTypeImpl("vdc", .<String, ReferenceType> of("vdc", new ReferenceTypeImpl("vdc", TerremarkECloudMediaType.VDC_XML,
TerremarkECloudMediaType.VDC_XML, URI URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))), ImmutableMap
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))), ImmutableMap
.<String, ReferenceType> of(), new ReferenceTypeImpl("tasksList", .<String, ReferenceType> of(), new ReferenceTypeImpl("tasksList",
TerremarkECloudMediaType.TASKSLIST_XML, URI TerremarkECloudMediaType.TASKSLIST_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), new ReferenceTypeImpl( .create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), new ReferenceTypeImpl(
"keysList", TerremarkECloudMediaType.KEYSLIST_XML, URI "keysList", TerremarkECloudMediaType.KEYSLIST_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/keysList/1")))); .create("https://vcloud.safesecureweb.com/api/v0.8/keysList/1"))));
@ -593,10 +593,16 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
} }
@Override @Override
protected URI provideDefaultVDC(Org org) { protected URI provideDefaultVDC(Org org, @org.jclouds.vcloud.endpoints.VDC String defaultVDC) {
return URI.create("https://vdc/1"); return URI.create("https://vdc/1");
} }
@Override
protected String provideDefaultVDCName(
@org.jclouds.vcloud.endpoints.VDC Supplier<Map<String, String>> vDCtoOrgSupplier) {
return "vdc";
}
@Override @Override
protected URI provideDefaultNetwork(URI vdc, CommonVCloudClient client, Injector injector) { protected URI provideDefaultNetwork(URI vdc, CommonVCloudClient client, Injector injector) {
return URI.create("https://vcloud.safesecureweb.com/network/1990"); return URI.create("https://vcloud.safesecureweb.com/network/1990");

View File

@ -729,10 +729,16 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest<Terrem
} }
@Override @Override
protected URI provideDefaultVDC(Org org) { protected URI provideDefaultVDC(Org org, @org.jclouds.vcloud.endpoints.VDC String defaultVDC) {
return URI.create("https://vdc/1"); return URI.create("https://vdc/1");
} }
@Override
protected String provideDefaultVDCName(
@org.jclouds.vcloud.endpoints.VDC Supplier<Map<String, String>> vDCtoOrgSupplier) {
return "vdc";
}
@Override @Override
protected String provideCatalogName(Supplier<Map<String, Map<String, ? extends Catalog>>> catalogs) { protected String provideCatalogName(Supplier<Map<String, Map<String, ? extends Catalog>>> catalogs) {
return "catalog"; return "catalog";