private ImmutableSortedSet<String> getAllProviders() { // correct the classloader so that jclouds extensions can be found Thread.currentThread().setContextClassLoader(Apis.class.getClassLoader()); // TODO: apis need endpoints, providers don't; do something smarter // with this stuff :) Builder<String> builder = ImmutableSet.<String> builder(); builder.addAll(Iterables.transform(Apis.viewableAs(ComputeServiceContext.class), Apis.idFunction())); builder.addAll(Iterables.transform(Providers.viewableAs(ComputeServiceContext.class), Providers.idFunction())); return ImmutableSortedSet.copyOf(builder.build()); }
private ImmutableSortedSet<String> getAllProviders() { // correct the classloader so that extensions can be found Thread.currentThread().setContextClassLoader(Apis.class.getClassLoader()); // TODO: apis need endpoints, providers don't; do something smarter // with this stuff :) Builder<String> builder = ImmutableSet.<String> builder(); builder.addAll(Iterables.transform(Apis.viewableAs(BlobStoreContext.class), Apis.idFunction())); builder.addAll(Iterables.transform(Providers.viewableAs(BlobStoreContext.class), Providers.idFunction())); return ImmutableSortedSet.copyOf(builder.build()); }
/** * looks up a provider or api with the given id * * @param providerOrApi * id of the provider or api * @return means to build a context to that provider * @throws NoSuchElementException * if the id was not configured. */ public static ContextBuilder newBuilder(String providerOrApi) throws NoSuchElementException { try { try { return ContextBuilder.newBuilder(Providers.withId(providerOrApi)); } catch (NoSuchElementException e) { return ContextBuilder.newBuilder(Apis.withId(providerOrApi)); } } catch (NoSuchElementException e) { Builder<String, String> builder = ImmutableMultimap.<String, String> builder(); builder.putAll("providers", transform(Providers.all(), Providers.idFunction())); builder.putAll("apis", transform(Apis.all(), Apis.idFunction())); throw new NoSuchElementException(String.format("key [%s] not in the list of providers or apis: %s", providerOrApi, builder.build())); } }
/** * looks up a provider or api with the given id * * @param providerOrApi * id of the provider or api * @return means to build a context to that provider * @throws NoSuchElementException * if the id was not configured. */ public static ContextBuilder newBuilder(String providerOrApi) throws NoSuchElementException { try { try { return ContextBuilder.newBuilder(Providers.withId(providerOrApi)); } catch (NoSuchElementException e) { return ContextBuilder.newBuilder(Apis.withId(providerOrApi)); } } catch (NoSuchElementException e) { Builder<String, String> builder = ImmutableMultimap.<String, String> builder(); builder.putAll("providers", transform(Providers.all(), Providers.idFunction())); builder.putAll("apis", transform(Apis.all(), Apis.idFunction())); throw new NoSuchElementException(String.format("key [%s] not in the list of providers or apis: %s", providerOrApi, builder.build())); } }
/** * looks up a provider or api with the given id * * @param providerOrApi * id of the provider or api * @return means to build a context to that provider * @throws NoSuchElementException * if the id was not configured. */ public static ContextBuilder newBuilder(String providerOrApi) throws NoSuchElementException { try { try { return ContextBuilder.newBuilder(Providers.withId(providerOrApi)); } catch (NoSuchElementException e) { return ContextBuilder.newBuilder(Apis.withId(providerOrApi)); } } catch (NoSuchElementException e) { Builder<String, String> builder = ImmutableMultimap.<String, String> builder(); builder.putAll("providers", transform(Providers.all(), Providers.idFunction())); builder.putAll("apis", transform(Apis.all(), Apis.idFunction())); throw new NoSuchElementException(String.format("key [%s] not in the list of providers or apis: %s", providerOrApi, builder.build())); } }
/** * looks up a provider or api with the given id * * @param providerOrApi * id of the provider or api * @return means to build a context to that provider * @throws NoSuchElementException * if the id was not configured. */ public static ContextBuilder newBuilder(String providerOrApi) throws NoSuchElementException { try { try { return ContextBuilder.newBuilder(Providers.withId(providerOrApi)); } catch (NoSuchElementException e) { return ContextBuilder.newBuilder(Apis.withId(providerOrApi)); } } catch (NoSuchElementException e) { Builder<String, String> builder = ImmutableMultimap.<String, String> builder(); builder.putAll("providers", transform(Providers.all(), Providers.idFunction())); builder.putAll("apis", transform(Apis.all(), Apis.idFunction())); throw new NoSuchElementException(String.format("key [%s] not in the list of providers or apis: %s", providerOrApi, builder.build())); } }
/** * looks up a provider or api with the given id * * @param providerOrApi * id of the provider or api * @return means to build a context to that provider * @throws NoSuchElementException * if the id was not configured. */ public static ContextBuilder newBuilder(String providerOrApi) throws NoSuchElementException { try { try { return ContextBuilder.newBuilder(Providers.withId(providerOrApi)); } catch (NoSuchElementException e) { return ContextBuilder.newBuilder(Apis.withId(providerOrApi)); } } catch (NoSuchElementException e) { Builder<String, String> builder = ImmutableMultimap.<String, String> builder(); builder.putAll("providers", transform(Providers.all(), Providers.idFunction())); builder.putAll("apis", transform(Apis.all(), Apis.idFunction())); throw new NoSuchElementException(String.format("key [%s] not in the list of providers or apis: %s", providerOrApi, builder.build())); } }
/** * looks up a provider or api with the given id * * @param providerOrApi * id of the provider or api * @return means to build a context to that provider * @throws NoSuchElementException * if the id was not configured. */ public static ContextBuilder newBuilder(String providerOrApi) throws NoSuchElementException { try { try { return ContextBuilder.newBuilder(Providers.withId(providerOrApi)); } catch (NoSuchElementException e) { return ContextBuilder.newBuilder(Apis.withId(providerOrApi)); } } catch (NoSuchElementException e) { Builder<String, String> builder = ImmutableMultimap.<String, String> builder(); builder.putAll("providers", transform(Providers.all(), Providers.idFunction())); builder.putAll("apis", transform(Apis.all(), Apis.idFunction())); throw new NoSuchElementException(String.format("key [%s] not in the list of providers or apis: %s", providerOrApi, builder.build())); } }
public abstract class JcloudsMachineProvider implements MachineProvider,Closeable { private static final Map<String, ApiMetadata> allApis = Maps.uniqueIndex(Apis.viewableAs(ComputeServiceContext.class), Apis.idFunction());