當前位置: 首頁>>代碼示例>>Java>>正文


Java ContextBuilder.overrides方法代碼示例

本文整理匯總了Java中org.jclouds.ContextBuilder.overrides方法的典型用法代碼示例。如果您正苦於以下問題:Java ContextBuilder.overrides方法的具體用法?Java ContextBuilder.overrides怎麽用?Java ContextBuilder.overrides使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jclouds.ContextBuilder的用法示例。


在下文中一共展示了ContextBuilder.overrides方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: withCompute

import org.jclouds.ContextBuilder; //導入方法依賴的package包/類
private <T> T withCompute(ComputeTask<T> task) throws HekateException {
    ContextBuilder builder = ContextBuilder.newBuilder(provider)
        .credentialsSupplier(credentials::get)
        .modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()));

    if (!properties.isEmpty()) {
        builder.overrides(properties);
    }

    if (endpoint != null && !endpoint.trim().isEmpty()) {
        builder.endpoint(endpoint.trim());
    }

    try (ComputeServiceContext ctx = builder.buildView(ComputeServiceContext.class)) {
        return task.execute(ctx);
    }
}
 
開發者ID:hekate-io,項目名稱:hekate,代碼行數:18,代碼來源:CloudSeedNodeProvider.java

示例2: createContext

import org.jclouds.ContextBuilder; //導入方法依賴的package包/類
private BlobStoreContext createContext() {
    ContextBuilder builder = ContextBuilder.newBuilder(provider)
        .credentialsSupplier(credentials::get)
        .modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()));

    if (!properties.isEmpty()) {
        builder.overrides(properties);
    }

    return builder.buildView(BlobStoreContext.class);
}
 
開發者ID:hekate-io,項目名稱:hekate,代碼行數:12,代碼來源:CloudStoreSeedNodeProvider.java

示例3: createContextBuilder

import org.jclouds.ContextBuilder; //導入方法依賴的package包/類
private static ContextBuilder createContextBuilder(ObjectProperties objectProperties) {
    // Create a Guice module that configures binds the function
    Module customLookupModule = new AbstractModule() {
        @Override
        protected void configure() {
            bind(LoginPortForContainer.class).to(NodeSshPortLookup.class).in(Scopes.SINGLETON);
        }
    };

    final ContextBuilder contextBuilder = ContextBuilder.newBuilder("docker")
            // REST API of docker daemon
            .endpoint(objectProperties.getProperty(Config.CloudProvider.Docker.ENDPOINT))
            // values are only valid for TLS protected endpoints (https://...), but still must be present for plain tcp (http://...)
            .credentials(
                    objectProperties.getProperty(Config.CloudProvider.Docker.TLS_CERT_PATH, Config.CloudProvider.Docker.TLS_CERT_PATH),
                    objectProperties.getProperty(Config.CloudProvider.Docker.TLS_KEY_PATH, Config.CloudProvider.Docker.TLS_KEY_PATH))
            .apiVersion(objectProperties.getProperty(Config.CloudProvider.Docker.API_VERSION, "1.21"))
            .modules(ImmutableSet.of(customLookupModule, new SLF4JLoggingModule(), new DynamicSshClientModule(), new SocketFinderOnlyPublicInterfacesModule()));
    final String caCertPath = objectProperties.getProperty(Config.CloudProvider.Docker.TLS_CA_CERT_PATH);
    if (!Strings.isNullOrEmpty(caCertPath)) {
        // if provided, configure the CA cert path in the ContextBuilder overrides
        Properties defaultPropertyOverrides = new Properties();
        defaultPropertyOverrides.setProperty(DockerApiMetadata.DOCKER_CA_CERT_PATH, caCertPath);
        contextBuilder.overrides(defaultPropertyOverrides);
    }
    return contextBuilder;
}
 
開發者ID:wildfly-extras,項目名稱:sunstone,代碼行數:28,代碼來源:DockerCloudProvider.java

示例4: start

import org.jclouds.ContextBuilder; //導入方法依賴的package包/類
@Override
public void start() {
   key2StringMapper = Util.getInstance(configuration.key2StringMapper(), initializationContext.getCache()
         .getAdvancedCache().getClassLoader());
   key2StringMapper.setMarshaller(initializationContext.getMarshaller());

   ContextBuilder contextBuilder = ContextBuilder.newBuilder(configuration.provider()).credentials(configuration.identity(), configuration.credential());
   if(configuration.overrides() != null)
      contextBuilder.overrides(configuration.overrides());
   if(configuration.endpoint() != null && !configuration.endpoint().isEmpty())
      contextBuilder.endpoint(configuration.endpoint());

   blobStoreContext = contextBuilder.buildView(BlobStoreContext.class);

   blobStore = blobStoreContext.getBlobStore();
   String cacheName = configuration.normalizeCacheNames() ? 
         initializationContext.getCache().getName().replaceAll("[^a-zA-Z0-9-]", "-") 
         : initializationContext.getCache().getName();
   containerName = String.format("%s-%s", configuration.container(), cacheName);

   if (!blobStore.containerExists(containerName)) {
      Location location = null;
      if (configuration.location() != null ) {
         location = new LocationBuilder()
            .scope(LocationScope.REGION)
            .id(configuration.location())
            .description(String.format("Infinispan cache store for %s", containerName))
            .build();
      }
      blobStore.createContainerInLocation(location, containerName);

      //make sure container is created
      if(!blobStore.containerExists(containerName)) {
         try {
            log.waitingForContainer();
            TimeUnit.SECONDS.sleep(10);
         } catch (InterruptedException e) {
            throw new PersistenceException(String.format("Aborted when creating blob container %s", containerName));
         }
         if(!blobStore.containerExists(containerName)) {
            throw new PersistenceException(String.format("Unable to create blob container %s", containerName));
         }
      }
   }
}
 
開發者ID:infinispan,項目名稱:infinispan-cachestore-cloud,代碼行數:46,代碼來源:CloudStore.java


注:本文中的org.jclouds.ContextBuilder.overrides方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。