Package org.jclouds.apis

Examples of org.jclouds.apis.ApiMetadata


                                       + 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();
      if (am instanceof HttpApiMetadata) {
         this.api = HttpApiMetadata.class.cast(am).getApi();
      } else if (am instanceof org.jclouds.rest.RestApiMetadata) {
         this.api = org.jclouds.rest.RestApiMetadata.class.cast(am).getApi();
      } else {
View Full Code Here


   @Test
   public void testExpectedBindingsWhenBuildVersionAbsent() {

      ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
               IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");
      ApiMetadata apiMd = md.getApiMetadata().toBuilder().buildVersion(null).build();
      md = md.toBuilder().apiMetadata(apiMd).build();
      Supplier<Credentials> creds = Suppliers.<Credentials> ofInstance(LoginCredentials.builder().user("user").build());

      ExpectedBindings bindings = Guice.createInjector(new BindProviderMetadataContextAndCredentials(md, creds))
               .getInstance(ExpectedBindings.class);
View Full Code Here

   @Override
   public ProviderMetadata apply(Properties input) {
      Properties mutable = new Properties();
      mutable.putAll(input);
      ApiMetadata apiMetadata = this.apiMetadata.toBuilder()
                                    .name(getAndRemove(mutable, PROPERTY_API, this.apiMetadata.getName()))
                                    .version(getAndRemove(mutable, PROPERTY_API_VERSION, this.apiMetadata.getVersion()))
                                    .buildVersion(getAndRemove(mutable, PROPERTY_BUILD_VERSION, this.apiMetadata.getBuildVersion().orNull())).build();

      String endpoint = getAndRemove(mutable, PROPERTY_ENDPOINT, providerMetadata.isPresent() ? providerMetadata.get()
               .getEndpoint() : null);
     
      String providerId = getAndRemove(mutable, PROPERTY_PROVIDER, providerMetadata.isPresent() ? providerMetadata.get()
               .getId() : apiMetadata.getId());
     
      String isoCodes = getAndRemove(mutable, PROPERTY_ISO3166_CODES, providerMetadata.isPresent() ? Joiner.on(',').join(providerMetadata.get()
               .getIso3166Codes()) : "");
     
      ProviderMetadata providerMetadata = this.providerMetadata
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 ApiMetadata))
         return false;
      ApiMetadata that = ApiMetadata.class.cast(o);
      return equal(this.getId(), that.getId()) && equal(this.getName(), that.getName())
               && equal(this.getViews(), that.getViews());
   }
View Full Code Here

            .contentLength(payload.size())
            .build();
         blobStore.putBlob(containerName, blob);

         // Use Provider API
         ApiMetadata apiMetadata = context.unwrap().getProviderMetadata().getApiMetadata();
         Object object = null;
         if (apiMetadata instanceof S3ApiMetadata) {
            S3Client api = context.unwrapApi(S3Client.class);
            object = api.headObject(containerName, blobName);
         } else if (apiMetadata instanceof SwiftApiMetadata) {
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 ApiMetadata))
         return false;
      ApiMetadata that = ApiMetadata.class.cast(o);
      return equal(this.getId(), that.getId()) && equal(this.getName(), that.getName())
               && equal(this.getViews(), that.getViews());
   }
View Full Code Here

                                       + 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();
      if (am instanceof HttpApiMetadata) {
         this.api = HttpApiMetadata.class.cast(am).getApi();
      } else {
         throw new UnsupportedOperationException("unsupported base type: " + am);
      }
View Full Code Here

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

      ApiMetadata apiMd = md.getApiMetadata().toBuilder().buildVersion(null).build();
      md = md.toBuilder().apiMetadata(apiMd).build();
      Supplier<Credentials> creds = Suppliers.<Credentials> ofInstance(LoginCredentials.builder().user("user").build());

      ExpectedBindings bindings = Guice.createInjector(new BindProviderMetadataContextAndCredentials(md, creds))
               .getInstance(ExpectedBindings.class);
View Full Code Here

      this.views = views;
   }

   @Test
   public void testWithId() {
      ApiMetadata apiMetadata = Apis.withId(toTest.getId());

      assertEquals(toTest, apiMetadata);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.apis.ApiMetadata

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.