当前位置: 首页>>代码示例>>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;未经允许,请勿转载。