Examples of ContextBuilder


Examples of org.jclouds.ContextBuilder

                        + "] 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

Examples of org.jclouds.ContextBuilder

            return map;
        }
    }

    private BlobStore createBlobStore(String providerOrApi, String identity, String credential, Iterable<? extends Module> modules, Properties props) {
        ContextBuilder builder = ContextBuilder.newBuilder(providerOrApi).credentials(identity, credential).modules(modules).overrides(props);
        BlobStoreContext context = builder.build(BlobStoreContext.class);
        BlobStore blobStore = context.getBlobStore();
        return blobStore;
    }
View Full Code Here

Examples of org.jclouds.ContextBuilder

                        + "] 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

Examples of org.jclouds.ContextBuilder

                        + "] 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

Examples of org.jclouds.ContextBuilder

        Iterable<Module> modules =
            ImmutableSet.<Module> of(new SshjSshClientModule(), new SLF4JLoggingModule(),
                                     new EnterpriseConfigurationModule());

        // build context
        ContextBuilder builder =
            ContextBuilder.newBuilder(iaas.getProvider())
                          .credentials(iaas.getIdentity(), iaas.getCredential()).modules(modules)
                          .overrides(properties);

        // set the compute service object
        iaas.setComputeService(builder.buildView(ComputeServiceContext.class).getComputeService());
    }
View Full Code Here

Examples of org.jclouds.ContextBuilder

        Properties chefConfig = new Properties();
        chefConfig.put(ChefProperties.CHEF_VALIDATOR_NAME, validatorName);
        chefConfig.put(ChefProperties.CHEF_VALIDATOR_CREDENTIAL, validatorCredential);

        ContextBuilder builder = null;
        if (apiMetadata != null) {
            builder = ContextBuilder.newBuilder(apiMetadata).overrides(chefConfig);
        }

        if (!Strings.isNullOrEmpty(endpoint)) {
            builder = builder.endpoint(endpoint);
        }

        builder = builder.name(name).modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()));
        builder = builder.name(name).credentials(clientName, clientCredential).overrides(chefConfig);

        ChefContext context = builder.build(ChefContext.class);
        ChefService service = context.getChefService();
        return service;
    }
View Full Code Here

Examples of org.jclouds.ContextBuilder

   protected ApiMetadata createApiMetadata() {
      return null;
   }

   protected Injector createInjector(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
      ContextBuilder builder = null;
      if (provider != null)
         try {
            builder = ContextBuilder.newBuilder(provider).credentials(identity, credential);
         } catch (NoSuchElementException e) {
            Logger
                     .getAnonymousLogger()
                     .warning(
                              "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();
      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 {
         throw new UnsupportedOperationException("unsupported base type: " + am);
      }
      // isolate tests from eachother, as default credentialStore is static
      return builder.credentials(identity, credential).modules(
               ImmutableSet.of(new ExpectModule(fn), new NullLoggingModule(), new CredentialStoreModule(new CopyInputStreamInputSupplierMap(
                     new ConcurrentHashMap<String, InputSupplier<InputStream>>())), module)).overrides(props)
               .buildInjector();
   }
View Full Code Here

Examples of org.jclouds.ContextBuilder

   }

   @Override
   protected ContextBuilder newBuilder() {
      ProviderMetadata pm = createProviderMetadata();
      ContextBuilder builder = ContextBuilder.newBuilder(pm);
      return builder;
   }
View Full Code Here

Examples of org.jclouds.ContextBuilder

        Iterable<Module> modules =
            ImmutableSet.<Module> of(new SshjSshClientModule(), new SLF4JLoggingModule(),
                                     new EnterpriseConfigurationModule());

        // build context
        ContextBuilder builder =
            ContextBuilder.newBuilder(iaas.getProvider())
                          .credentials(iaas.getIdentity(), iaas.getCredential()).modules(modules)
                          .overrides(properties);

        // set the compute service object
        iaas.setComputeService(builder.buildView(ComputeServiceContext.class).getComputeService());
    }
View Full Code Here

Examples of org.jclouds.ContextBuilder

                        + "] 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
TOP
Copyright © 2018 www.massapi.com. 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.