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


                                       + 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

      overrides.put(AWSEC2Constants.PROPERTY_EC2_AMI_QUERY, "state=available;image-type=machine;root-device-type=ebs;name=*" + searchTerm.trim() + "*");
    }
    overrides.put(AWSEC2Constants.PROPERTY_EC2_CC_REGIONS, this.location);

    ProviderMetadata selectedProvider = selectedCloud.getProvider();
    ApiMetadata selectedApi = selectedCloud.getApi();
    if (selectedProvider != null && selectedProvider != JClouds.EMPTY_PROVIDER) {
      context = ContextBuilder.newBuilder(selectedProvider)
                    .credentials(selectedCloud.getIdentity(), selectedCloud.getCredential())
                    .overrides(overrides)
                    .modules(ImmutableSet.<Module> of(new Log4JLoggingModule(),
View Full Code Here

    }
    }   
   
    public static ComputeService createComputeService(CloudDetails details) {
        ProviderMetadata selectedProvider = details.getProvider();
        ApiMetadata selectedApi = details.getApi();

        if (selectedProvider == JClouds.EMPTY_PROVIDER &&
          selectedApi == JClouds.EMPTY_API) return null;
       
        String identity = details.getIdentity();
View Full Code Here

      }
    });
        apiNameField.addSelectionChangedListener(new ISelectionChangedListener() {
      @Override
      public void selectionChanged(SelectionChangedEvent event) {
        ApiMetadata item = (ApiMetadata)Selections.getFirstSelection(event.getSelection());
        providerNameField.getCombo().setEnabled(item == JClouds.EMPTY_API);
        validate();
      }
    });

        ProviderMetadata provider = details.getProvider();
        if (provider != null) {
            providerNameField.setSelection(new StructuredSelection(provider));
        }
        ApiMetadata api = details.getApi();
        if (api != null) {
            apiNameField.setSelection(new StructuredSelection(api));
        }

        endpointField = createBeanPropertyTextField(inner, details, "endpoint", Messages.jclouds_endpointLabel, Messages.jclouds_endpointTooltip);
View Full Code Here

    /* (non-Javadoc)
     * @see org.fusesource.ide.commons.ui.form.FormSupport#isValid()
     */
    @Override
    public boolean isValid() {
      ApiMetadata api = (ApiMetadata)Selections.getFirstSelection(apiNameField.getSelection());
      ProviderMetadata provider = (ProviderMetadata)Selections.getFirstSelection(providerNameField.getSelection());
      return super.isValid() && ((api != JClouds.EMPTY_API && endpointField.getText().trim().length()>0) || provider != JClouds.EMPTY_PROVIDER);
    }
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

      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.