Package org.jclouds.providers

Examples of org.jclouds.providers.ProviderMetadata


               .getId() : apiMetadata.getId());
     
      String isoCodes = getAndRemove(mutable, PROPERTY_ISO3166_CODES, providerMetadata.isPresent() ? Joiner.on(',').join(providerMetadata.get()
               .getIso3166Codes()) : "");
     
      ProviderMetadata providerMetadata = this.providerMetadata
               .or(AnonymousProviderMetadata.forApiWithEndpoint(apiMetadata, checkNotNull(endpoint, PROPERTY_ENDPOINT)))
               .toBuilder()
               .apiMetadata(apiMetadata)
               .id(providerId)
               .iso3166Codes(Splitter.on(',').omitEmptyStrings().split(isoCodes))
View Full Code Here


         return true;
      // subclass equivalence is ok, since we don't know the classloader
      // we'll get things from
      if (o == null || !(o instanceof ProviderMetadata))
         return false;
      ProviderMetadata that = ProviderMetadata.class.cast(o);
      return equal(this.getId(), that.getId()) && equal(this.getName(), that.getName())
               && equal(this.getApiMetadata(), that.getApiMetadata()) && equal(this.getEndpoint(), that.getEndpoint());
   }
View Full Code Here

import com.google.common.collect.ImmutableMap;

public class MessagingApiSmokeTest {
  public static void main(String[] args) {
    // Configure/Authenticate the Dyn Java Messaging client instance
    ProviderMetadata meta = Providers.withId("dyn-messaging");
    ContextBuilder ctx = ContextBuilder.newBuilder(meta);

    ctx.credentials(/* intentionally blank -> */"", "yourapikey");
    DynMessagingApi dyn = ctx.buildApi(DynMessagingApi.class);

View Full Code Here

         throw new IllegalArgumentException(INVALID_SYNTAX);

      // Args

      String providerId = args[0];
      ProviderMetadata provider = null;
      try {
         provider = Providers.withId(providerId);
      } catch(NoSuchElementException exception) {
         throw new IllegalArgumentException("provider " + providerId + " not in supported list: " + transform(Providers.all(), Providers.idFunction()));
      }
View Full Code Here

      Properties expanded = expandProperties(resolved);

      Supplier<Credentials> credentialsSupplier = buildCredentialsSupplier(expanded);

      ProviderMetadata providerMetadata = new UpdateProviderMetadataFromProperties(apiMetadata, this.providerMetadata)
            .apply(expanded);

      // We use either the specified name (optional) or a hash of provider/api, endpoint, api version & identity. Hash
      // is used to be something readable.
      return buildInjector(name.or(String.valueOf(Objects.hashCode(providerMetadata.getId(),
            providerMetadata.getEndpoint(), providerMetadata.getApiMetadata().getVersion(), credentialsSupplier))),
            providerMetadata, credentialsSupplier, modules);
   }
View Full Code Here

   protected ApiMetadata createApiMetadata() {
      return null;
   }

   protected Injector createInjector() {
      ProviderMetadata pm = createProviderMetadata();

      ContextBuilder builder = pm != null ? ContextBuilder.newBuilder(pm) : ContextBuilder.newBuilder(ApiMetadata.class
            .cast(checkNotNull(createApiMetadata(),
                  "either createApiMetadata or createProviderMetadata must be overridden")));
View Full Code Here

                              "provider ["
                                       + provider
                                       + "] is not setup as META-INF/services/org.jclouds.apis.ApiMetadata or META-INF/services/org.jclouds.providers.ProviderMetadata");
         }
      if (builder == null) {
         ProviderMetadata pm = createProviderMetadata();
         ApiMetadata am = (pm != null) ? pm.getApiMetadata() : checkNotNull(createApiMetadata(),
                  "either createApiMetadata or createProviderMetadata must be overridden");

         builder = pm != null ? ContextBuilder.newBuilder(pm) : ContextBuilder.newBuilder(am);
      }
      ApiMetadata am = builder.getApiMetadata();
View Full Code Here

                  .warning("provider ["
                        + provider
                        + "] is not setup as META-INF/services/org.jclouds.apis.ApiMetadata or META-INF/services/org.jclouds.providers.ProviderMetadata");
         }

      ProviderMetadata pm = createProviderMetadata();

      ContextBuilder builder = pm != null ? ContextBuilder.newBuilder(pm) : ContextBuilder
            .newBuilder(ApiMetadata.class.cast(checkNotNull(createApiMetadata(),
                  "either createApiMetadata or createProviderMetadata must be overridden")));
      return builder;
View Full Code Here

                  .warning("provider ["
                        + provider
                        + "] is not setup as META-INF/services/org.jclouds.apis.ApiMetadata or META-INF/services/org.jclouds.providers.ProviderMetadata");
         }

      ProviderMetadata pm = createProviderMetadata();

      ContextBuilder builder = pm != null ? ContextBuilder.newBuilder(pm) : ContextBuilder
            .newBuilder(ApiMetadata.class.cast(checkNotNull(createApiMetadata(),
                  "either createApiMetadata or createProviderMetadata must be overridden")));
      return builder;
View Full Code Here

@Test(groups = "unit", testName = "UpdateProviderMetadataFromPropertiesTest")
public class UpdateProviderMetadataFromPropertiesTest {

   @Test
   public void testProviderMetadataWithUpdatedEndpointUpdatesAndRetainsAllDefaultPropertiesExceptEndpoint() {
      ProviderMetadata md = forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");

      Properties props = new Properties();
      props.putAll(md.getDefaultProperties());
      props.setProperty(Constants.PROPERTY_ENDPOINT, "http://nonlocal");

      ProviderMetadata newMd = new UpdateProviderMetadataFromProperties(md).apply(props);

      assertEquals(newMd.getEndpoint(), "http://nonlocal");
      assertEquals(newMd.getDefaultProperties(), md.getDefaultProperties());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.providers.ProviderMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.