mirror of https://github.com/apache/jclouds.git
changed bindings that imply i/o to Supplier<X>
This commit is contained in:
parent
39c79f6ffa
commit
dadd4f6515
|
@ -52,6 +52,7 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
|||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.jamesmurty.utils.XMLBuilder;
|
||||
|
@ -67,7 +68,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
|
|||
protected final String ns;
|
||||
protected final String schema;
|
||||
protected final BindToStringPayload stringBinder;
|
||||
protected final ReferenceType defaultNetwork;
|
||||
protected final Supplier<ReferenceType> defaultNetwork;
|
||||
protected final FenceMode defaultFenceMode;
|
||||
protected final LoadingCache<URI, VAppTemplate> templateCache;
|
||||
protected final Function<VAppTemplate, String> defaultNetworkNameInTemplate;
|
||||
|
@ -76,7 +77,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
|
|||
public BindInstantiateVAppTemplateParamsToXmlPayload(LoadingCache<URI, VAppTemplate> templateCache,
|
||||
@Network Function<VAppTemplate, String> defaultNetworkNameInTemplate, BindToStringPayload stringBinder,
|
||||
@Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema,
|
||||
@Network ReferenceType network, FenceMode fenceMode) {
|
||||
@Network Supplier<ReferenceType> network, FenceMode fenceMode) {
|
||||
this.templateCache = templateCache;
|
||||
this.defaultNetworkNameInTemplate = defaultNetworkNameInTemplate;
|
||||
this.ns = ns;
|
||||
|
@ -98,7 +99,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
|
|||
Set<NetworkConfig> networkConfig = null;
|
||||
|
||||
NetworkConfigDecorator networkConfigDecorator = new NetworkConfigDecorator(templateCache.getUnchecked(template),
|
||||
defaultNetwork.getHref(), defaultFenceMode, defaultNetworkNameInTemplate);
|
||||
defaultNetwork.get().getHref(), defaultFenceMode, defaultNetworkNameInTemplate);
|
||||
|
||||
InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ import org.jclouds.vcloud.functions.VAppTemplatesInOrg;
|
|||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
|
@ -108,8 +110,16 @@ public class VCloudComputeServiceDependenciesModule extends AbstractModule {
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
public NetworkConfig networkConfig(@Network ReferenceType network, FenceMode defaultFenceMode) {
|
||||
return new NetworkConfig(network.getName(), network.getHref(), defaultFenceMode);
|
||||
public Supplier<NetworkConfig> networkConfig(@Network Supplier<ReferenceType> network,
|
||||
final FenceMode defaultFenceMode) {
|
||||
return Suppliers.compose(new Function<ReferenceType, NetworkConfig>() {
|
||||
|
||||
@Override
|
||||
public NetworkConfig apply(ReferenceType input) {
|
||||
return new NetworkConfig(input.getName(), input.getHref(), defaultFenceMode);
|
||||
}
|
||||
|
||||
}, network);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ import org.jclouds.vcloud.domain.network.NetworkConfig;
|
|||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
|
@ -72,13 +73,13 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
protected final VCloudClient client;
|
||||
protected final Predicate<URI> successTester;
|
||||
protected final LoadingCache<URI, VAppTemplate> vAppTemplates;
|
||||
protected final NetworkConfig defaultNetworkConfig;
|
||||
protected final Supplier<NetworkConfig> defaultNetworkConfig;
|
||||
protected final String buildVersion;
|
||||
|
||||
@Inject
|
||||
protected InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn(VCloudClient client,
|
||||
Predicate<URI> successTester, LoadingCache<URI, VAppTemplate> vAppTemplates,
|
||||
NetworkConfig defaultNetworkConfig, @Named(PROPERTY_BUILD_VERSION) String buildVersion) {
|
||||
Supplier<NetworkConfig> defaultNetworkConfig, @Named(PROPERTY_BUILD_VERSION) String buildVersion) {
|
||||
this.client = client;
|
||||
this.successTester = successTester;
|
||||
this.vAppTemplates = vAppTemplates;
|
||||
|
@ -142,9 +143,9 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
// if we only have a disconnected network, let's add a new section for the upstream
|
||||
// TODO: remove the disconnected entry
|
||||
if (networkWithNoIpAllocation.apply(networkToConnect))
|
||||
config = defaultNetworkConfig;
|
||||
config = defaultNetworkConfig.get();
|
||||
else
|
||||
config = defaultNetworkConfig.toBuilder().networkName(networkToConnect.getName()).build();
|
||||
config = defaultNetworkConfig.get().toBuilder().networkName(networkToConnect.getName()).build();
|
||||
|
||||
// note that in VCD 1.5, the network name after instantiation will be the same as the parent
|
||||
InstantiateVAppTemplateOptions options = addNetworkConfig(config);
|
||||
|
|
|
@ -34,13 +34,14 @@ import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfig
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Singleton
|
||||
public class DefaultOrgForUser implements Function<String, ReferenceType> {
|
||||
public class DefaultOrgForUser implements Function<String, Supplier<ReferenceType>> {
|
||||
|
||||
private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
|
||||
private final Supplier<VCloudSession> sessionSupplier;
|
||||
|
@ -55,10 +56,16 @@ public class DefaultOrgForUser implements Function<String, ReferenceType> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ReferenceType apply(String user) {
|
||||
VCloudSession session = sessionSupplier.get();
|
||||
checkState(session != null, "could not retrieve Session at %s", user);
|
||||
return selector.apply(session.getOrgs().values());
|
||||
public Supplier<ReferenceType> apply(final String user) {
|
||||
return Suppliers.compose(new Function<VCloudSession, ReferenceType>() {
|
||||
|
||||
@Override
|
||||
public ReferenceType apply(VCloudSession session) {
|
||||
checkState(session != null, "could not retrieve Session at %s", user);
|
||||
return selector.apply(session.getOrgs().values());
|
||||
}
|
||||
|
||||
}, sessionSupplier);
|
||||
}
|
||||
|
||||
}
|
|
@ -57,7 +57,7 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
|
|||
@Provides
|
||||
@org.jclouds.vcloud.endpoints.Org
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultOrg(DefaultOrgForUser defaultOrgURIForUser,
|
||||
protected Supplier<ReferenceType> provideDefaultOrg(DefaultOrgForUser defaultOrgURIForUser,
|
||||
@Named(PROPERTY_IDENTITY) String user) {
|
||||
return defaultOrgURIForUser.apply(user);
|
||||
}
|
||||
|
@ -72,17 +72,17 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
|
|||
@Provides
|
||||
@org.jclouds.vcloud.endpoints.TasksList
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultTasksList(DefaultTasksListForOrg defaultTasksListURIForOrg,
|
||||
@org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg) {
|
||||
return defaultTasksListURIForOrg.apply(defaultOrg);
|
||||
protected Supplier<ReferenceType> provideDefaultTasksList(DefaultTasksListForOrg defaultTasksListURIForOrg,
|
||||
@org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.compose(defaultTasksListURIForOrg, defaultOrg);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@org.jclouds.vcloud.endpoints.Catalog
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultCatalog(DefaultCatalogForOrg defaultCatalogURIForOrg,
|
||||
@org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg) {
|
||||
return defaultCatalogURIForOrg.apply(defaultOrg);
|
||||
protected Supplier<ReferenceType> provideDefaultCatalog(DefaultCatalogForOrg defaultCatalogURIForOrg,
|
||||
@org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.compose(defaultCatalogURIForOrg, defaultOrg);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -146,9 +146,9 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
|
|||
@Provides
|
||||
@org.jclouds.vcloud.endpoints.VDC
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultVDC(DefaultVDCForOrg defaultVDCURIForOrg,
|
||||
@org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg) {
|
||||
return defaultVDCURIForOrg.apply(defaultOrg);
|
||||
protected Supplier<ReferenceType> provideDefaultVDC(DefaultVDCForOrg defaultVDCURIForOrg,
|
||||
@org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.compose(defaultVDCURIForOrg, defaultOrg);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -161,9 +161,9 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
|
|||
@Provides
|
||||
@org.jclouds.vcloud.endpoints.Network
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultNetwork(DefaultNetworkForVDC defaultNetworkURIForVDC,
|
||||
@org.jclouds.vcloud.endpoints.VDC ReferenceType defaultVDC) {
|
||||
return defaultNetworkURIForVDC.apply(defaultVDC);
|
||||
protected Supplier<ReferenceType> provideDefaultNetwork(DefaultNetworkForVDC defaultNetworkURIForVDC,
|
||||
@org.jclouds.vcloud.endpoints.VDC Supplier<ReferenceType> defaultVDC) {
|
||||
return Suppliers.compose(defaultNetworkURIForVDC, defaultVDC);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -316,8 +316,15 @@ public class VCloudRestClientModule extends RestClientModule<VCloudClient, VClou
|
|||
|
||||
@VCloudToken
|
||||
@Provides
|
||||
String provideVCloudToken(Supplier<VCloudSession> cache) {
|
||||
return checkNotNull(cache.get().getVCloudToken(), "No token present in session");
|
||||
@Singleton
|
||||
Supplier<String> provideVCloudToken(Supplier<VCloudSession> cache) {
|
||||
return Suppliers.compose(new Function<VCloudSession, String>() {
|
||||
|
||||
@Override
|
||||
public String apply(VCloudSession input) {
|
||||
return checkNotNull(input.getVCloudToken(), "No token present in session");
|
||||
}
|
||||
}, cache);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -419,9 +426,16 @@ public class VCloudRestClientModule extends RestClientModule<VCloudClient, VClou
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
protected Org provideOrg(Supplier<Map<String, Org>> orgSupplier,
|
||||
@org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg) {
|
||||
return orgSupplier.get().get(defaultOrg.getName());
|
||||
protected Supplier<Org> provideOrg(final Supplier<Map<String, Org>> orgSupplier,
|
||||
@org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.compose(new Function<ReferenceType, Org>() {
|
||||
|
||||
@Override
|
||||
public Org apply(ReferenceType input) {
|
||||
return orgSupplier.get().get(input.getName());
|
||||
|
||||
}
|
||||
}, defaultOrg);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.vcloud.filters;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
import javax.inject.Singleton;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
|
||||
|
@ -29,6 +28,8 @@ import org.jclouds.http.HttpRequestFilter;
|
|||
import org.jclouds.http.utils.ModifyRequest;
|
||||
import org.jclouds.vcloud.VCloudToken;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
/**
|
||||
* Adds the VCloud Token to the request as a cookie
|
||||
*
|
||||
|
@ -37,10 +38,10 @@ import org.jclouds.vcloud.VCloudToken;
|
|||
*/
|
||||
@Singleton
|
||||
public class SetVCloudTokenCookie implements HttpRequestFilter {
|
||||
private Provider<String> vcloudTokenProvider;
|
||||
private Supplier<String> vcloudTokenProvider;
|
||||
|
||||
@Inject
|
||||
public SetVCloudTokenCookie(@VCloudToken Provider<String> authTokenProvider) {
|
||||
public SetVCloudTokenCookie(@VCloudToken Supplier<String> authTokenProvider) {
|
||||
this.vcloudTokenProvider = authTokenProvider;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,13 @@ import com.google.common.collect.Iterables;
|
|||
@Singleton
|
||||
public class OrgNameAndCatalogNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, Org>> orgMap;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final ReferenceType defaultCatalog;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultCatalog;
|
||||
|
||||
@Inject
|
||||
public OrgNameAndCatalogNameToEndpoint(Supplier<Map<String, Org>> orgMap,
|
||||
@org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg, @Catalog ReferenceType defaultCatalog) {
|
||||
@org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg,
|
||||
@Catalog Supplier<ReferenceType> defaultCatalog) {
|
||||
this.orgMap = orgMap;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultCatalog = defaultCatalog;
|
||||
|
@ -59,9 +60,9 @@ public class OrgNameAndCatalogNameToEndpoint implements Function<Object, URI> {
|
|||
Object org = Iterables.get(orgCatalog, 0);
|
||||
Object catalog = Iterables.get(orgCatalog, 1);
|
||||
if (org == null && catalog == null)
|
||||
return defaultCatalog.getHref();
|
||||
return defaultCatalog.get().getHref();
|
||||
else if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
|
||||
try {
|
||||
Map<String, ReferenceType> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs();
|
||||
|
|
|
@ -42,12 +42,12 @@ import com.google.common.collect.Iterables;
|
|||
@Singleton
|
||||
public class OrgNameAndVDCNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, Org>> orgNameToVDCEndpoint;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final ReferenceType defaultVDC;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultVDC;
|
||||
|
||||
@Inject
|
||||
public OrgNameAndVDCNameToEndpoint(Supplier<Map<String, Org>> orgNameToVDCEndpoint,
|
||||
@org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg, @VDC ReferenceType defaultVDC) {
|
||||
@org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
|
||||
this.orgNameToVDCEndpoint = orgNameToVDCEndpoint;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultVDC = defaultVDC;
|
||||
|
@ -59,9 +59,9 @@ public class OrgNameAndVDCNameToEndpoint implements Function<Object, URI> {
|
|||
Object org = Iterables.get(orgVdc, 0);
|
||||
Object vdc = Iterables.get(orgVdc, 1);
|
||||
if (org == null && vdc == null)
|
||||
return defaultVDC.getHref();
|
||||
return defaultVDC.get().getHref();
|
||||
else if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
|
||||
try {
|
||||
Map<String, ReferenceType> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs();
|
||||
|
|
|
@ -42,13 +42,13 @@ import com.google.common.collect.Iterables;
|
|||
@Singleton
|
||||
public class OrgNameCatalogNameItemNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>> orgCatalogMap;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final ReferenceType defaultCatalog;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultCatalog;
|
||||
|
||||
@Inject
|
||||
public OrgNameCatalogNameItemNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>> orgCatalogMap,
|
||||
@Org ReferenceType defaultOrg, @Catalog ReferenceType defaultCatalog) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
|
||||
this.orgCatalogMap = orgCatalogMap;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultCatalog = defaultCatalog;
|
||||
|
@ -61,9 +61,9 @@ public class OrgNameCatalogNameItemNameToEndpoint implements Function<Object, UR
|
|||
Object catalog = Iterables.get(orgCatalog, 1);
|
||||
Object catalogItem = Iterables.get(orgCatalog, 2);
|
||||
if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
if (catalog == null)
|
||||
catalog = defaultCatalog.getName();
|
||||
catalog = defaultCatalog.get().getName();
|
||||
try {
|
||||
Map<String, org.jclouds.vcloud.domain.Catalog> catalogs = checkNotNull(orgCatalogMap.get().get(org));
|
||||
return catalogs.get(catalog).get(catalogItem).getHref();
|
||||
|
|
|
@ -43,13 +43,13 @@ import com.google.common.collect.Iterables;
|
|||
@Singleton
|
||||
public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> orgCatalogItemMap;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final ReferenceType defaultCatalog;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultCatalog;
|
||||
|
||||
@Inject
|
||||
public OrgNameCatalogNameVAppTemplateNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> orgCatalogItemMap,
|
||||
@Org ReferenceType defaultOrg, @Catalog ReferenceType defaultCatalog) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
|
||||
this.orgCatalogItemMap = orgCatalogItemMap;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultCatalog = defaultCatalog;
|
||||
|
@ -62,9 +62,9 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
|
|||
Object catalog = Iterables.get(orgCatalog, 1);
|
||||
Object catalogItem = Iterables.get(orgCatalog, 2);
|
||||
if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
if (catalog == null)
|
||||
catalog = defaultCatalog.getName();
|
||||
catalog = defaultCatalog.get().getName();
|
||||
Map<String, Map<String, Map<String, CatalogItem>>> orgCatalogItemMap = this.orgCatalogItemMap.get();
|
||||
|
||||
if (!orgCatalogItemMap.containsKey(org))
|
||||
|
|
|
@ -38,11 +38,11 @@ import com.google.common.base.Supplier;
|
|||
@Singleton
|
||||
public class OrgNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
|
||||
@Inject
|
||||
public OrgNameToEndpoint(@Org Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier,
|
||||
@Org ReferenceType defaultOrg) {
|
||||
@Org Supplier<ReferenceType> defaultOrg) {
|
||||
this.orgNameToEndpointSupplier = orgNameToEndpointSupplier;
|
||||
this.defaultOrg = defaultOrg;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class OrgNameToEndpoint implements Function<Object, URI> {
|
|||
public URI apply(Object from) {
|
||||
try {
|
||||
Map<String, ReferenceType> orgNameToEndpoint = orgNameToEndpointSupplier.get();
|
||||
return from == null ? defaultOrg.getHref() : orgNameToEndpoint.get(from).getHref();
|
||||
return from == null ? defaultOrg.get().getHref() : orgNameToEndpoint.get(from).getHref();
|
||||
} catch (NullPointerException e) {
|
||||
throw new NoSuchElementException("org " + from + " not found in " + orgNameToEndpointSupplier.get().keySet());
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ import com.google.common.base.Supplier;
|
|||
@Singleton
|
||||
public class OrgNameToTasksListEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, Org>> orgMap;
|
||||
private final ReferenceType defaultTasksList;
|
||||
private final Supplier<ReferenceType> defaultTasksList;
|
||||
|
||||
@Inject
|
||||
public OrgNameToTasksListEndpoint(Supplier<Map<String, Org>> orgMap,
|
||||
@TasksList ReferenceType defaultTasksList) {
|
||||
@TasksList Supplier<ReferenceType> defaultTasksList) {
|
||||
this.orgMap = orgMap;
|
||||
this.defaultTasksList = defaultTasksList;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class OrgNameToTasksListEndpoint implements Function<Object, URI> {
|
|||
public URI apply(Object from) {
|
||||
Object org = from;
|
||||
if (org == null)
|
||||
return defaultTasksList.getHref();
|
||||
return defaultTasksList.get().getHref();
|
||||
try {
|
||||
return checkNotNull(orgMap.get().get(org)).getTasksList().getHref();
|
||||
} catch (NullPointerException e) {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class OrgNameVDCNameNetworkNameToEndpoint extends OrgNameVDCNameResourceN
|
|||
@Inject
|
||||
public OrgNameVDCNameNetworkNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap,
|
||||
@Org ReferenceType defaultOrg, @VDC ReferenceType defaultVDC) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
|
||||
super(orgVDCMap, defaultOrg, defaultVDC);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class OrgNameVDCNameResourceEntityNameToEndpoint extends OrgNameVDCNameRe
|
|||
@Inject
|
||||
public OrgNameVDCNameResourceEntityNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap,
|
||||
@Org ReferenceType defaultOrg, @VDC ReferenceType defaultVDC) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
|
||||
super(orgVDCMap, defaultOrg, defaultVDC);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,13 +41,13 @@ import com.google.common.collect.Iterables;
|
|||
public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<Object, URI>{
|
||||
|
||||
protected final Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap;
|
||||
protected final ReferenceType defaultOrg;
|
||||
protected final ReferenceType defaultVDC;
|
||||
protected final Supplier<ReferenceType> defaultOrg;
|
||||
protected final Supplier<ReferenceType> defaultVDC;
|
||||
|
||||
@Inject
|
||||
public OrgNameVDCNameResourceNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap,
|
||||
@Org ReferenceType defaultOrg, @org.jclouds.vcloud.endpoints.VDC ReferenceType defaultVDC) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @org.jclouds.vcloud.endpoints.VDC Supplier<ReferenceType> defaultVDC) {
|
||||
this.orgVDCMap = orgVDCMap;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultVDC = defaultVDC;
|
||||
|
@ -60,9 +60,9 @@ public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<
|
|||
Object vDC = Iterables.get(orgVDC, 1);
|
||||
Object resource = Iterables.get(orgVDC, 2);
|
||||
if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
if (vDC == null)
|
||||
vDC = defaultVDC.getName();
|
||||
vDC = defaultVDC.get().getName();
|
||||
Map<String, Map<String, org.jclouds.vcloud.domain.VDC>> orgToVDCs = orgVDCMap.get();
|
||||
checkState(orgToVDCs != null, "could not get map of org name to vdcs!");
|
||||
Map<String, org.jclouds.vcloud.domain.VDC> vDCs = orgToVDCs.get(org);
|
||||
|
|
|
@ -55,15 +55,16 @@ public class DefaultVDC implements ImplicitLocationSupplier {
|
|||
|
||||
@Singleton
|
||||
public static class IsDefaultVDC implements Predicate<Location> {
|
||||
private final ReferenceType defaultVDC;
|
||||
private final Supplier<ReferenceType> defaultVDCSupplier;
|
||||
|
||||
@Inject
|
||||
IsDefaultVDC(@VDC ReferenceType defaultVDC) {
|
||||
this.defaultVDC = checkNotNull(defaultVDC, "defaultVDC");
|
||||
IsDefaultVDC(@VDC Supplier<ReferenceType> defaultVDCSupplier) {
|
||||
this.defaultVDCSupplier = checkNotNull(defaultVDCSupplier, "defaultVDCSupplier");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Location input) {
|
||||
ReferenceType defaultVDC = defaultVDCSupplier.get();
|
||||
return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.getHref().toASCIIString());
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
@ -102,9 +104,9 @@ public class BindInstantiateVAppTemplateParamsToXmlPayloadTest {
|
|||
@Network
|
||||
@Provides
|
||||
@Singleton
|
||||
ReferenceType provideNetwork() {
|
||||
return new ReferenceTypeImpl(null, null, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1990"));
|
||||
Supplier<ReferenceType> provideNetwork() {
|
||||
return Suppliers.<ReferenceType>ofInstance(new ReferenceTypeImpl(null, null, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1990")));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals;
|
|||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.inject.Provider;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
|
@ -30,6 +29,8 @@ import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
|||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
|
@ -40,7 +41,7 @@ public class SetVCloudTokenCookieTest {
|
|||
|
||||
@BeforeTest
|
||||
void setUp() {
|
||||
filter = new SetVCloudTokenCookie(new Provider<String>() {
|
||||
filter = new SetVCloudTokenCookie(new Supplier<String>() {
|
||||
public String get() {
|
||||
return "token";
|
||||
}
|
||||
|
|
|
@ -139,9 +139,9 @@ public abstract class BaseVCloudAsyncClientTest<T> extends RestClientTest<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Org provideOrg(Supplier<Map<String, Org>> orgSupplier,
|
||||
@org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg) {
|
||||
return ORG;
|
||||
protected Supplier<Org> provideOrg(Supplier<Map<String, Org>> orgSupplier,
|
||||
@org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.ofInstance(ORG);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,14 +150,18 @@ public abstract class BaseVCloudAsyncClientTest<T> extends RestClientTest<T> {
|
|||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.vcloud.endpoints.Org.class).toInstance(ORG_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.vcloud.endpoints.Catalog.class).toInstance(
|
||||
CATALOG_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.vcloud.endpoints.TasksList.class).toInstance(
|
||||
TASKSLIST_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.vcloud.endpoints.VDC.class).toInstance(VDC_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.vcloud.endpoints.Network.class).toInstance(
|
||||
NETWORK_REF);
|
||||
TypeLiteral<Supplier<ReferenceType>> refTypeSupplier = new TypeLiteral<Supplier<ReferenceType>>() {
|
||||
};
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Org.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(ORG_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Catalog.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(CATALOG_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.TasksList.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(TASKSLIST_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.VDC.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(VDC_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Network.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(NETWORK_REF));
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.jclouds.trmk.vcloud_0_8.endpoints.Network;
|
|||
import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions.NetworkConfig;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
|
@ -67,13 +68,13 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
|
|||
private final BindToStringPayload stringBinder;
|
||||
protected final Map<ResourceType, String> virtualHardwareToInstanceId = ImmutableMap.of(ResourceType.PROCESSOR, "1",
|
||||
ResourceType.MEMORY, "2", ResourceType.DISK_DRIVE, "9");
|
||||
private final ReferenceType defaultNetwork;
|
||||
private final Supplier<ReferenceType> defaultNetwork;
|
||||
private final String defaultFenceMode;
|
||||
|
||||
@Inject
|
||||
public BindInstantiateVAppTemplateParamsToXmlPayload(BindToStringPayload stringBinder,
|
||||
@Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema,
|
||||
@Network ReferenceType network, @Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
|
||||
@Network Supplier<ReferenceType> network, @Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
|
||||
this.ns = ns;
|
||||
this.schema = schema;
|
||||
this.stringBinder = stringBinder;
|
||||
|
@ -93,7 +94,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
|
|||
SortedMap<ResourceType, String> virtualHardwareQuantity = Maps.newTreeMap();
|
||||
|
||||
InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);
|
||||
String network = (defaultNetwork != null) ? defaultNetwork.getHref().toASCIIString() : null;
|
||||
String network = (defaultNetwork != null) ? defaultNetwork.get().getHref().toASCIIString() : null;
|
||||
String fenceMode = defaultFenceMode;
|
||||
String networkName = name;
|
||||
if (options != null) {
|
||||
|
|
|
@ -34,13 +34,14 @@ import org.jclouds.trmk.vcloud_0_8.suppliers.OnlyReferenceTypeFirstWithNameMatch
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Singleton
|
||||
public class DefaultOrgForUser implements Function<String, ReferenceType> {
|
||||
public class DefaultOrgForUser implements Function<String, Supplier<ReferenceType>> {
|
||||
|
||||
private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
|
||||
private final Supplier<VCloudSession> sessionSupplier;
|
||||
|
@ -55,10 +56,16 @@ public class DefaultOrgForUser implements Function<String, ReferenceType> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ReferenceType apply(String user) {
|
||||
VCloudSession session = sessionSupplier.get();
|
||||
checkState(session != null, "could not retrieve Session at %s", user);
|
||||
return selector.apply(session.getOrgs().values());
|
||||
public Supplier<ReferenceType> apply(final String user) {
|
||||
return Suppliers.compose(new Function<VCloudSession, ReferenceType>() {
|
||||
|
||||
@Override
|
||||
public ReferenceType apply(VCloudSession session) {
|
||||
checkState(session != null, "could not retrieve Session at %s", user);
|
||||
return selector.apply(session.getOrgs().values());
|
||||
}
|
||||
|
||||
}, sessionSupplier);
|
||||
}
|
||||
|
||||
}
|
|
@ -54,7 +54,7 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
|
|||
@Provides
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultOrg(DefaultOrgForUser defaultOrgURIForUser,
|
||||
protected Supplier<ReferenceType> provideDefaultOrg(DefaultOrgForUser defaultOrgURIForUser,
|
||||
@Named(PROPERTY_IDENTITY) String user) {
|
||||
return defaultOrgURIForUser.apply(user);
|
||||
}
|
||||
|
@ -69,9 +69,9 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
|
|||
@Provides
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.TasksList
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultTasksList(DefaultTasksListForOrg defaultTasksListURIForOrg,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultOrg) {
|
||||
return defaultTasksListURIForOrg.apply(defaultOrg);
|
||||
protected Supplier<ReferenceType> provideDefaultTasksList(DefaultTasksListForOrg defaultTasksListURIForOrg,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.compose(defaultTasksListURIForOrg, defaultOrg);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -84,9 +84,9 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
|
|||
@Provides
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Catalog
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultCatalog(DefaultCatalogForOrg defaultCatalogURIForOrg,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultOrg) {
|
||||
return defaultCatalogURIForOrg.apply(defaultOrg);
|
||||
protected Supplier<ReferenceType> provideDefaultCatalog(DefaultCatalogForOrg defaultCatalogURIForOrg,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.compose(defaultCatalogURIForOrg, defaultOrg);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -121,9 +121,9 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
|
|||
@Provides
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.VDC
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultVDC(DefaultVDCForOrg defaultVDCURIForOrg,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultOrg) {
|
||||
return defaultVDCURIForOrg.apply(defaultOrg);
|
||||
protected Supplier<ReferenceType> provideDefaultVDC(DefaultVDCForOrg defaultVDCURIForOrg,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.compose(defaultVDCURIForOrg, defaultOrg);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -136,9 +136,9 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
|
|||
@Provides
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Network
|
||||
@Singleton
|
||||
protected ReferenceType provideDefaultNetwork(DefaultNetworkForVDC defaultNetworkURIForVDC,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.VDC ReferenceType defaultVDC) {
|
||||
return defaultNetworkURIForVDC.apply(defaultVDC);
|
||||
protected Supplier<ReferenceType> provideDefaultNetwork(DefaultNetworkForVDC defaultNetworkURIForVDC,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.VDC Supplier<ReferenceType> defaultVDC) {
|
||||
return Suppliers.compose(defaultNetworkURIForVDC, defaultVDC);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -352,10 +352,17 @@ public class TerremarkVCloudRestClientModule<S extends TerremarkVCloudClient, A
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
protected org.jclouds.trmk.vcloud_0_8.domain.Org provideOrg(
|
||||
Supplier<Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Org>> orgSupplier,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultOrg) {
|
||||
return orgSupplier.get().get(defaultOrg.getName());
|
||||
protected Supplier<org.jclouds.trmk.vcloud_0_8.domain.Org> provideOrg(
|
||||
final Supplier<Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Org>> orgSupplier,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.compose(new Function<ReferenceType, org.jclouds.trmk.vcloud_0_8.domain.Org>() {
|
||||
|
||||
@Override
|
||||
public org.jclouds.trmk.vcloud_0_8.domain.Org apply(ReferenceType input) {
|
||||
return orgSupplier.get().get(input.getName());
|
||||
|
||||
}
|
||||
}, defaultOrg);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -42,12 +42,12 @@ import com.google.common.collect.Iterables;
|
|||
@Singleton
|
||||
public class OrgNameAndCatalogNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, ? extends Org>> orgMap;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final ReferenceType defaultCatalog;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultCatalog;
|
||||
|
||||
@Inject
|
||||
public OrgNameAndCatalogNameToEndpoint(Supplier<Map<String, ? extends Org>> orgMap,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultOrg, @Catalog ReferenceType defaultCatalog) {
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
|
||||
this.orgMap = orgMap;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultCatalog = defaultCatalog;
|
||||
|
@ -59,9 +59,9 @@ public class OrgNameAndCatalogNameToEndpoint implements Function<Object, URI> {
|
|||
Object org = Iterables.get(orgCatalog, 0);
|
||||
Object catalog = Iterables.get(orgCatalog, 1);
|
||||
if (org == null && catalog == null)
|
||||
return defaultCatalog.getHref();
|
||||
return defaultCatalog.get().getHref();
|
||||
else if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
|
||||
try {
|
||||
Map<String, ReferenceType> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs();
|
||||
|
|
|
@ -42,12 +42,12 @@ import com.google.common.collect.Iterables;
|
|||
@Singleton
|
||||
public class OrgNameAndTasksListNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, ? extends Org>> orgMap;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final ReferenceType defaultTasksList;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultTasksList;
|
||||
|
||||
@Inject
|
||||
public OrgNameAndTasksListNameToEndpoint(Supplier<Map<String, ? extends Org>> orgMap,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultOrg, @TasksList ReferenceType defaultTasksList) {
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg, @TasksList Supplier<ReferenceType> defaultTasksList) {
|
||||
this.orgMap = orgMap;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultTasksList = defaultTasksList;
|
||||
|
@ -59,9 +59,9 @@ public class OrgNameAndTasksListNameToEndpoint implements Function<Object, URI>
|
|||
Object org = Iterables.get(orgTasksList, 0);
|
||||
Object tasksList = Iterables.get(orgTasksList, 1);
|
||||
if (org == null && tasksList == null)
|
||||
return defaultTasksList.getHref();
|
||||
return defaultTasksList.get().getHref();
|
||||
else if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
|
||||
try {
|
||||
Map<String, ReferenceType> tasksLists = checkNotNull(orgMap.get().get(org)).getTasksLists();
|
||||
|
|
|
@ -42,12 +42,12 @@ import com.google.common.collect.Iterables;
|
|||
@Singleton
|
||||
public class OrgNameAndVDCNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, ? extends Org>> orgNameToVDCEndpoint;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final ReferenceType defaultVDC;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultVDC;
|
||||
|
||||
@Inject
|
||||
public OrgNameAndVDCNameToEndpoint(Supplier<Map<String, ? extends Org>> orgNameToVDCEndpoint,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultOrg, @VDC ReferenceType defaultVDC) {
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
|
||||
this.orgNameToVDCEndpoint = orgNameToVDCEndpoint;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultVDC = defaultVDC;
|
||||
|
@ -59,9 +59,9 @@ public class OrgNameAndVDCNameToEndpoint implements Function<Object, URI> {
|
|||
Object org = Iterables.get(orgVdc, 0);
|
||||
Object vdc = Iterables.get(orgVdc, 1);
|
||||
if (org == null && vdc == null)
|
||||
return defaultVDC.getHref();
|
||||
return defaultVDC.get().getHref();
|
||||
else if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
|
||||
try {
|
||||
Map<String, ReferenceType> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs();
|
||||
|
|
|
@ -42,13 +42,13 @@ import com.google.common.collect.Iterables;
|
|||
@Singleton
|
||||
public class OrgNameCatalogNameItemNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog>>> orgCatalogMap;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final ReferenceType defaultCatalog;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultCatalog;
|
||||
|
||||
@Inject
|
||||
public OrgNameCatalogNameItemNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog>>> orgCatalogMap,
|
||||
@Org ReferenceType defaultOrg, @Catalog ReferenceType defaultCatalog) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
|
||||
this.orgCatalogMap = orgCatalogMap;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultCatalog = defaultCatalog;
|
||||
|
@ -61,9 +61,9 @@ public class OrgNameCatalogNameItemNameToEndpoint implements Function<Object, UR
|
|||
Object catalog = Iterables.get(orgCatalog, 1);
|
||||
Object catalogItem = Iterables.get(orgCatalog, 2);
|
||||
if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
if (catalog == null)
|
||||
catalog = defaultCatalog.getName();
|
||||
catalog = defaultCatalog.get().getName();
|
||||
try {
|
||||
Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog> catalogs = checkNotNull(orgCatalogMap.get().get(org));
|
||||
return catalogs.get(catalog).get(catalogItem).getHref();
|
||||
|
|
|
@ -43,13 +43,13 @@ import com.google.common.collect.Iterables;
|
|||
@Singleton
|
||||
public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.CatalogItem>>>> orgCatalogItemMap;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final ReferenceType defaultCatalog;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultCatalog;
|
||||
|
||||
@Inject
|
||||
public OrgNameCatalogNameVAppTemplateNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.CatalogItem>>>> orgCatalogItemMap,
|
||||
@Org ReferenceType defaultOrg, @Catalog ReferenceType defaultCatalog) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
|
||||
this.orgCatalogItemMap = orgCatalogItemMap;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultCatalog = defaultCatalog;
|
||||
|
@ -62,9 +62,9 @@ public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements Function<Ob
|
|||
Object catalog = Iterables.get(orgCatalog, 1);
|
||||
Object catalogItem = Iterables.get(orgCatalog, 2);
|
||||
if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
if (catalog == null)
|
||||
catalog = defaultCatalog.getName();
|
||||
catalog = defaultCatalog.get().getName();
|
||||
Map<String, Map<String, Map<String, ? extends CatalogItem>>> orgCatalogItemMap = this.orgCatalogItemMap.get();
|
||||
|
||||
if (!orgCatalogItemMap.containsKey(org))
|
||||
|
|
|
@ -38,11 +38,11 @@ import com.google.common.base.Supplier;
|
|||
@Singleton
|
||||
public class OrgNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier;
|
||||
private final ReferenceType defaultOrg;
|
||||
private final Supplier<ReferenceType> defaultOrg;
|
||||
|
||||
@Inject
|
||||
public OrgNameToEndpoint(@Org Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier,
|
||||
@Org ReferenceType defaultOrg) {
|
||||
@Org Supplier<ReferenceType> defaultOrg) {
|
||||
this.orgNameToEndpointSupplier = orgNameToEndpointSupplier;
|
||||
this.defaultOrg = defaultOrg;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class OrgNameToEndpoint implements Function<Object, URI> {
|
|||
public URI apply(Object from) {
|
||||
try {
|
||||
Map<String, ReferenceType> orgNameToEndpoint = orgNameToEndpointSupplier.get();
|
||||
return from == null ? defaultOrg.getHref() : orgNameToEndpoint.get(from).getHref();
|
||||
return from == null ? defaultOrg.get().getHref() : orgNameToEndpoint.get(from).getHref();
|
||||
} catch (NullPointerException e) {
|
||||
throw new NoSuchElementException("org " + from + " not found in " + orgNameToEndpointSupplier.get().keySet());
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class OrgNameVDCNameNetworkNameToEndpoint extends OrgNameVDCNameResourceN
|
|||
@Inject
|
||||
public OrgNameVDCNameNetworkNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>> orgVDCMap,
|
||||
@Org ReferenceType defaultOrg, @VDC ReferenceType defaultVDC) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
|
||||
super(orgVDCMap, defaultOrg, defaultVDC);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class OrgNameVDCNameResourceEntityNameToEndpoint extends OrgNameVDCNameRe
|
|||
@Inject
|
||||
public OrgNameVDCNameResourceEntityNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>> orgVDCMap,
|
||||
@Org ReferenceType defaultOrg, @VDC ReferenceType defaultVDC) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
|
||||
super(orgVDCMap, defaultOrg, defaultVDC);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,13 +41,13 @@ import com.google.common.collect.Iterables;
|
|||
public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<Object, URI>{
|
||||
|
||||
protected final Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>> orgVDCMap;
|
||||
protected final ReferenceType defaultOrg;
|
||||
protected final ReferenceType defaultVDC;
|
||||
protected final Supplier<ReferenceType> defaultOrg;
|
||||
protected final Supplier<ReferenceType> defaultVDC;
|
||||
|
||||
@Inject
|
||||
public OrgNameVDCNameResourceNameToEndpoint(
|
||||
Supplier<Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>> orgVDCMap,
|
||||
@Org ReferenceType defaultOrg, @org.jclouds.trmk.vcloud_0_8.endpoints.VDC ReferenceType defaultVDC) {
|
||||
@Org Supplier<ReferenceType> defaultOrg, @org.jclouds.trmk.vcloud_0_8.endpoints.VDC Supplier<ReferenceType> defaultVDC) {
|
||||
this.orgVDCMap = orgVDCMap;
|
||||
this.defaultOrg = defaultOrg;
|
||||
this.defaultVDC = defaultVDC;
|
||||
|
@ -60,9 +60,9 @@ public abstract class OrgNameVDCNameResourceNameToEndpoint implements Function<
|
|||
Object vDC = Iterables.get(orgVDC, 1);
|
||||
Object resource = Iterables.get(orgVDC, 2);
|
||||
if (org == null)
|
||||
org = defaultOrg.getName();
|
||||
org = defaultOrg.get().getName();
|
||||
if (vDC == null)
|
||||
vDC = defaultVDC.getName();
|
||||
vDC = defaultVDC.get().getName();
|
||||
Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>> orgToVDCs = orgVDCMap.get();
|
||||
checkState(orgToVDCs != null, "could not get map of org name to vdcs!");
|
||||
Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC> vDCs = orgToVDCs.get(org);
|
||||
|
|
|
@ -36,10 +36,10 @@ import com.google.common.collect.Maps;
|
|||
public abstract class OrgURIToEndpoint implements Function<Object, URI> {
|
||||
|
||||
protected final Supplier<Map<String, ? extends Org>> orgMap;
|
||||
protected final ReferenceType defaultOrg;
|
||||
protected final Supplier<ReferenceType> defaultOrg;
|
||||
|
||||
public OrgURIToEndpoint(Supplier<Map<String, ? extends Org>> orgMap,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultUri) {
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultUri) {
|
||||
this.orgMap = orgMap;
|
||||
this.defaultOrg = defaultUri;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public abstract class OrgURIToEndpoint implements Function<Object, URI> {
|
|||
|
||||
});
|
||||
try {
|
||||
Org org = uriToOrg.get(from == null ? defaultOrg.getHref() : from);
|
||||
Org org = uriToOrg.get(from == null ? defaultOrg.get().getHref() : from);
|
||||
return getUriFromOrg(org);
|
||||
} catch (NullPointerException e) {
|
||||
throw new ResourceNotFoundException("org " + from + " not found in: " + uriToOrg, e);
|
||||
|
|
|
@ -38,7 +38,7 @@ import com.google.common.base.Supplier;
|
|||
public class OrgURIToKeysListEndpoint extends OrgURIToEndpoint implements Function<Object, URI> {
|
||||
@Inject
|
||||
public OrgURIToKeysListEndpoint(Supplier<Map<String, ? extends Org>> orgMap,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultUri) {
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultUri) {
|
||||
super(orgMap, defaultUri);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,18 +38,18 @@ import com.google.common.base.Supplier;
|
|||
@Singleton
|
||||
public class VDCURIToInternetServicesEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<URI, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>> orgVDCMap;
|
||||
private final ReferenceType defaultVDC;
|
||||
private final Supplier<ReferenceType> defaultVDC;
|
||||
|
||||
@Inject
|
||||
public VDCURIToInternetServicesEndpoint(
|
||||
Supplier<Map<URI, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>> orgVDCMap, @VDC ReferenceType defaultVDC) {
|
||||
Supplier<Map<URI, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>> orgVDCMap, @VDC Supplier<ReferenceType> defaultVDC) {
|
||||
this.orgVDCMap = orgVDCMap;
|
||||
this.defaultVDC = defaultVDC;
|
||||
}
|
||||
|
||||
public URI apply(Object from) {
|
||||
try {
|
||||
return orgVDCMap.get().get(from == null ? defaultVDC.getHref() : from).getInternetServices().getHref();
|
||||
return orgVDCMap.get().get(from == null ? defaultVDC.get().getHref() : from).getInternetServices().getHref();
|
||||
} catch (NullPointerException e) {
|
||||
throw new ResourceNotFoundException("vdc " + from + " not found in " + orgVDCMap.get());
|
||||
}
|
||||
|
|
|
@ -38,18 +38,18 @@ import com.google.common.base.Supplier;
|
|||
@Singleton
|
||||
public class VDCURIToPublicIPsEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<URI, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>> orgVDCMap;
|
||||
private final ReferenceType defaultVDC;
|
||||
private final Supplier<ReferenceType> defaultVDC;
|
||||
|
||||
@Inject
|
||||
public VDCURIToPublicIPsEndpoint(Supplier<Map<URI, ? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>> orgVDCMap,
|
||||
@VDC ReferenceType defaultVDC) {
|
||||
@VDC Supplier<ReferenceType> defaultVDC) {
|
||||
this.orgVDCMap = orgVDCMap;
|
||||
this.defaultVDC = defaultVDC;
|
||||
}
|
||||
|
||||
public URI apply(Object from) {
|
||||
try {
|
||||
return orgVDCMap.get().get(from == null ? defaultVDC.getHref() : from).getPublicIps().getHref();
|
||||
return orgVDCMap.get().get(from == null ? defaultVDC.get().getHref() : from).getPublicIps().getHref();
|
||||
} catch (NullPointerException e) {
|
||||
throw new ResourceNotFoundException("vdc " + from + " not found in " + orgVDCMap.get());
|
||||
}
|
||||
|
|
|
@ -40,16 +40,16 @@ import com.google.common.base.Supplier;
|
|||
public class DefaultVDC implements ImplicitLocationSupplier {
|
||||
@Singleton
|
||||
public static final class IsDefaultVDC implements Predicate<Location> {
|
||||
private final ReferenceType defaultVDC;
|
||||
private final Supplier<ReferenceType> defaultVDC;
|
||||
|
||||
@Inject
|
||||
IsDefaultVDC(@VDC ReferenceType defaultVDC) {
|
||||
IsDefaultVDC(@VDC Supplier<ReferenceType> defaultVDC) {
|
||||
this.defaultVDC = checkNotNull(defaultVDC, "defaultVDC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Location input) {
|
||||
return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.getHref().toASCIIString());
|
||||
return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.get().getHref().toASCIIString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,6 +41,8 @@ import org.nnsoft.guice.rocoto.Rocoto;
|
|||
import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
|
@ -68,8 +70,9 @@ public class BindInstantiateVAppTemplateParamsToXmlPayloadTest {
|
|||
@Network
|
||||
@Provides
|
||||
@Singleton
|
||||
ReferenceType provideNetwork() {
|
||||
return new ReferenceTypeImpl(null, null, URI.create("https://vcloud.safesecureweb.com/network/1990"));
|
||||
Supplier<ReferenceType> provideNetwork() {
|
||||
return Suppliers.<ReferenceType>ofInstance(new ReferenceTypeImpl(null, null, URI
|
||||
.create("https://vcloud.safesecureweb.com/network/1990")));
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import com.google.common.base.Supplier;
|
|||
public class OrgURIToDataCentersListEndpoint extends OrgURIToEndpoint implements Function<Object, URI> {
|
||||
@Inject
|
||||
public OrgURIToDataCentersListEndpoint(Supplier<Map<String, ? extends Org>> orgMap,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultUri) {
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultUri) {
|
||||
super(orgMap, defaultUri);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import com.google.common.base.Supplier;
|
|||
public class OrgURIToTagsListEndpoint extends OrgURIToEndpoint implements Function<Object, URI> {
|
||||
@Inject
|
||||
public OrgURIToTagsListEndpoint(Supplier<Map<String, ? extends Org>> orgMap,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultUri) {
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultUri) {
|
||||
super(orgMap, defaultUri);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ import com.google.common.base.Suppliers;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -138,9 +139,9 @@ public abstract class BaseTerremarkECloudAsyncClientTest<T> extends RestClientTe
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Org provideOrg(Supplier<Map<String, ? extends Org>> orgSupplier,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultOrg) {
|
||||
return ORG;
|
||||
protected Supplier<Org> provideOrg(Supplier<Map<String, ? extends Org>> orgSupplier,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.ofInstance(ORG);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,16 +150,18 @@ public abstract class BaseTerremarkECloudAsyncClientTest<T> extends RestClientTe
|
|||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Org.class).toInstance(
|
||||
ORG_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Catalog.class).toInstance(
|
||||
CATALOG_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.TasksList.class)
|
||||
.toInstance(TASKSLIST_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.VDC.class).toInstance(
|
||||
VDC_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Network.class).toInstance(
|
||||
NETWORK_REF);
|
||||
TypeLiteral<Supplier<ReferenceType>> refTypeSupplier = new TypeLiteral<Supplier<ReferenceType>>() {
|
||||
};
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Org.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(ORG_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Catalog.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(CATALOG_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.TasksList.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(TASKSLIST_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.VDC.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(VDC_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Network.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(NETWORK_REF));
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -680,9 +680,9 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest<Terrem
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Org provideOrg(Supplier<Map<String, ? extends Org>> orgSupplier,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org ReferenceType defaultOrg) {
|
||||
return ORG;
|
||||
protected Supplier<Org> provideOrg(Supplier<Map<String, ? extends Org>> orgSupplier,
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<ReferenceType> defaultOrg) {
|
||||
return Suppliers.ofInstance(ORG);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -691,16 +691,18 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest<Terrem
|
|||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Org.class).toInstance(
|
||||
ORG_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Catalog.class).toInstance(
|
||||
CATALOG_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.TasksList.class)
|
||||
.toInstance(TASKSLIST_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.VDC.class).toInstance(
|
||||
VDC_REF);
|
||||
bind(ReferenceType.class).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Network.class).toInstance(
|
||||
NETWORK_REF);
|
||||
TypeLiteral<Supplier<ReferenceType>> refTypeSupplier = new TypeLiteral<Supplier<ReferenceType>>() {
|
||||
};
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Org.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(ORG_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Catalog.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(CATALOG_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.TasksList.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(TASKSLIST_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.VDC.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(VDC_REF));
|
||||
bind(refTypeSupplier).annotatedWith(org.jclouds.trmk.vcloud_0_8.endpoints.Network.class).toInstance(
|
||||
Suppliers.<ReferenceType> ofInstance(NETWORK_REF));
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue