@Provides @Singleton @org.jclouds.trmk.vcloud_0_8.endpoints.VDC protected Supplier<Map<String, String>> provideVDCtoORG( Supplier<Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Org>> orgNameToOrgSupplier) { return Suppliers2.compose( new Function< Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Org>, Map<String, String>>() { @Override public Map<String, String> apply( Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Org> arg0) { Builder<String, String> returnVal = ImmutableMap.builder(); for (Entry<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Org> orgr : arg0.entrySet()) { for (String vdc : orgr.getValue().getVDCs().keySet()) { returnVal.put(vdc, orgr.getKey()); } } return returnVal.build(); } }, orgNameToOrgSupplier); }
@Provides @Singleton 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 Suppliers2.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 @Singleton @OrgList protected Supplier<URI> provideOrgListURI(Supplier<VCloudSession> sessionSupplier) { return Suppliers2.compose( new Function<VCloudSession, URI>() { @Override public URI apply(VCloudSession arg0) { return URI.create( getLast(arg0.getOrgs().values()) .getHref() .toASCIIString() .replaceAll("org/.*", "org")); } @Override public String toString() { return "orgListURI()"; } }, sessionSupplier); }
@Override public Map<String, Supplier<URI>> get() { return Maps.transformValues(api.getDatacenters(), Suppliers2.<URI>ofInstanceFunction()); }