当前位置: 首页>>代码示例>>Java>>正文


Java Constants类代码示例

本文整理汇总了Java中org.jclouds.Constants的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Constants类属于org.jclouds包,在下文中一共展示了Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DimensionDataCloudControllerComputeService

import org.jclouds.Constants; //导入依赖的package包/类
@Inject
protected DimensionDataCloudControllerComputeService(ComputeServiceContext context, Map<String, Credentials> credentialStore,
                                                     @Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Hardware>> sizes,
                                                     @Memoized Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy,
                                                     GetImageStrategy getImageStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
                                                     CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy,
                                                     DestroyNodeStrategy destroyNodeStrategy, ResumeNodeStrategy startNodeStrategy,
                                                     SuspendNodeStrategy stopNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
                                                     @Named("DEFAULT") Provider<TemplateOptions> templateOptionsProvider,
                                                     @Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
                                                     @Named(TIMEOUT_NODE_TERMINATED) Predicate<AtomicReference<NodeMetadata>> nodeTerminated,
                                                     @Named(TIMEOUT_NODE_SUSPENDED) Predicate<AtomicReference<NodeMetadata>> nodeSuspended,
                                                     InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
                                                     RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
                                                     PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
                                                     @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
                                                     CleanupServer cleanupServer,
                                                     Optional<ImageExtension> imageExtension,
                                                     Optional<SecurityGroupExtension> securityGroupExtension) {
   super(context, credentialStore, images, sizes, locations, listNodesStrategy, getImageStrategy,
            getNodeMetadataStrategy, runNodesAndAddToSetStrategy, rebootNodeStrategy, destroyNodeStrategy,
            startNodeStrategy, stopNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
            nodeTerminated, nodeSuspended, initScriptRunnerFactory, initAdminAccess, runScriptOnNodeFactory,
            persistNodeCredentials, timeouts, userExecutor, imageExtension, securityGroupExtension);
   this.cleanupServer = checkNotNull(cleanupServer, "cleanupServer");
}
 
开发者ID:cloudsoft,项目名称:amp-dimensiondata,代码行数:27,代码来源:DimensionDataCloudControllerComputeService.java

示例2: setupProperties

import org.jclouds.Constants; //导入依赖的package包/类
@Override
protected Properties setupProperties() {
    try {
        proxy = TestUtils.setupAndStartProxy();
    } catch (Exception e) {
        throw propagate(e);
    }
    Properties props = super.setupProperties();
    identity = "test:tester";
    credential = "testing";
    endpoint = proxy.getEndpoint().toString() + "/auth/v1.0";
    props.setProperty(KeystoneProperties.CREDENTIAL_TYPE, "tempAuthCredentials");
    props.setProperty(Constants.PROPERTY_IDENTITY, identity);
    props.setProperty(Constants.PROPERTY_CREDENTIAL, credential);
    props.setProperty(Constants.PROPERTY_ENDPOINT, endpoint);
    return props;
}
 
开发者ID:bouncestorage,项目名称:swiftproxy,代码行数:18,代码来源:JcloudsIntegrationTest.java

示例3: setupAndStartProxy

import org.jclouds.Constants; //导入依赖的package包/类
public static SwiftProxy setupAndStartProxy() throws Exception {
    Properties properties = new Properties();
    try (InputStream is = Resources.asByteSource(Resources.getResource(
            "swiftproxy.conf")).openStream()) {
        properties.load(is);
    }

    String provider = properties.getProperty(Constants.PROPERTY_PROVIDER);
    String credential = properties.getProperty(Constants.PROPERTY_CREDENTIAL);
    if (provider != null && credential != null && provider.equals("google-cloud-storage")) {
        File credentialFile = new File(credential);
        if (credentialFile.exists()) {
            credential = Files.toString(credentialFile,
                    StandardCharsets.UTF_8);
        }
        properties.put(Constants.PROPERTY_CREDENTIAL, credential);
    }

    SwiftProxy proxy = SwiftProxy.Builder.builder()
            .overrides(properties)
            .build();
    proxy.start();
    return proxy;
}
 
开发者ID:bouncestorage,项目名称:swiftproxy,代码行数:25,代码来源:TestUtils.java

示例4: setupProperties

import org.jclouds.Constants; //导入依赖的package包/类
@Override
protected Properties setupProperties() {
    TestUtils.S3ProxyLaunchInfo info;
    try {
        info = TestUtils.startS3Proxy("s3proxy.conf");
        s3Proxy = info.getS3Proxy();
        context = info.getBlobStore().getContext();
        blobStoreType = context.unwrap().getProviderMetadata().getId();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    Properties props = super.setupProperties();
    props.setProperty(Constants.PROPERTY_IDENTITY, info.getS3Identity());
    props.setProperty(Constants.PROPERTY_CREDENTIAL,
            info.getS3Credential());
    props.setProperty(Constants.PROPERTY_ENDPOINT,
            info.getEndpoint().toString() + info.getServicePath());
    props.setProperty(Constants.PROPERTY_STRIP_EXPECT_HEADER, "true");
    props.setProperty(S3Constants.PROPERTY_S3_SERVICE_PATH,
            info.getServicePath());
    endpoint = info.getEndpoint().toString() + info.getServicePath();
    return props;
}
 
开发者ID:gaul,项目名称:s3proxy,代码行数:24,代码来源:JcloudsS3ClientLiveTest.java

示例5: setupProperties

import org.jclouds.Constants; //导入依赖的package包/类
@Override
protected Properties setupProperties() {
    TestUtils.S3ProxyLaunchInfo info;
    try {
        info = TestUtils.startS3Proxy("s3proxy.conf");
        s3Proxy = info.getS3Proxy();
        context = info.getBlobStore().getContext();
        blobStoreType = context.unwrap().getProviderMetadata().getId();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    Properties props = super.setupProperties();
    props.setProperty(Constants.PROPERTY_IDENTITY, info.getS3Identity());
    props.setProperty(Constants.PROPERTY_CREDENTIAL,
            info.getS3Credential());
    props.setProperty(Constants.PROPERTY_ENDPOINT,
            info.getEndpoint().toString() + info.getServicePath());
    props.setProperty(S3Constants.PROPERTY_S3_SERVICE_PATH,
            info.getServicePath());
    props.setProperty(Constants.PROPERTY_STRIP_EXPECT_HEADER, "true");
    return props;
}
 
开发者ID:gaul,项目名称:s3proxy,代码行数:23,代码来源:JcloudsS3BlobIntegrationLiveTest.java

示例6: setupProperties

import org.jclouds.Constants; //导入依赖的package包/类
@Override
protected Properties setupProperties() {
    TestUtils.S3ProxyLaunchInfo info;
    try {
        info = TestUtils.startS3Proxy("s3proxy.conf");
        s3Proxy = info.getS3Proxy();
        context = info.getBlobStore().getContext();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    Properties props = super.setupProperties();
    props.setProperty(Constants.PROPERTY_IDENTITY, info.getS3Identity());
    props.setProperty(Constants.PROPERTY_CREDENTIAL,
            info.getS3Credential());
    props.setProperty(Constants.PROPERTY_ENDPOINT,
            info.getEndpoint().toString() + info.getServicePath());
    props.setProperty(S3Constants.PROPERTY_S3_SERVICE_PATH,
            info.getServicePath());
    props.setProperty(Constants.PROPERTY_STRIP_EXPECT_HEADER, "true");
    endpoint = info.getEndpoint().toString();
    return props;
}
 
开发者ID:gaul,项目名称:s3proxy,代码行数:23,代码来源:JcloudsS3BlobSignerLiveTest.java

示例7: novaApi

import org.jclouds.Constants; //导入依赖的package包/类
@Bean
@ConditionalOnProperty("openstack.endpoint")
NovaApi novaApi(@Value("${openstack.endpoint}") String endpoint,
                @Value("${openstack.tenant}") String tenant,
                @Value("${openstack.username}") String username,
                @Value("${openstack.password}") String password) {

    String identity = String.format("%s:%s", tenant, username);

    // see https://issues.apache.org/jira/browse/JCLOUDS-816
    Properties overrides = new Properties();
    overrides.put(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
    overrides.put(Constants.PROPERTY_RELAX_HOSTNAME, "true");

    return ContextBuilder.newBuilder("openstack-nova")
        .endpoint(endpoint)
        .credentials(identity, password)
        .modules(Collections.singleton(new SLF4JLoggingModule()))
        .overrides(overrides)
        .buildApi(NovaApi.class);
}
 
开发者ID:strepsirrhini-army,项目名称:chaos-lemur,代码行数:22,代码来源:InfrastructureConfiguration.java

示例8: addProviderFromConfig

import org.jclouds.Constants; //导入依赖的package包/类
private void addProviderFromConfig(String prefix, String provider) {
    String id = prefix.substring(prefix.lastIndexOf('.')).substring(1);
    logger.info("adding provider from {} id: {}", prefix, id);
    Configuration c = config.subset(prefix);
    BlobStoreContext context;
    try {
        ContextBuilder builder = ContextBuilder.newBuilder(provider);
        String identity = c.getString(Constants.PROPERTY_IDENTITY);
        if (identity != null) {
            builder.credentials(identity, c.getString(Constants.PROPERTY_CREDENTIAL));
        }
        c.addProperty(Constants.PROPERTY_STRIP_EXPECT_HEADER, "true");
        context = builder.overrides(new ConfigurationPropertiesView(c))
                .modules(ImmutableList.of(new SLF4JLoggingModule()))
                .build(BlobStoreContext.class);
        logger.info("added provider {} id {}", context.unwrap().getId(), id);
    } catch (CreationException e) {
        e.printStackTrace();
        throw propagate(e);
    }

    BlobStore blobStore = new LoggingBlobStore(context.getBlobStore(), id, this);
    providers.put(Integer.valueOf(id), blobStore);
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:25,代码来源:BounceApplication.java

示例9: setUp

import org.jclouds.Constants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    containerName = Utils.createRandomContainerName();
    Properties properties = new Properties();
    properties.putAll(ImmutableMap.of(
            Constants.PROPERTY_PROVIDER, "encrypted",
            EncryptedBlobStore.KEY, "foobar",
            EncryptedBlobStore.SALT, "salty"
    ));
    Utils.insertAllWithPrefix(properties,
            EncryptedBlobStore.BACKEND + ".",
            ImmutableMap.of(
                    Constants.PROPERTY_PROVIDER, "transient"
            ));
    context = ContextBuilder
            .newBuilder("encrypted")
            .overrides(properties)
            .build(BlobStoreContext.class);
    blobStore = (EncryptedBlobStore) context.getBlobStore();
    blobStore.createContainerInLocation(null, containerName);
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:22,代码来源:EncryptedBlobStoreTest.java

示例10: blobStoreContextFromProperties

import org.jclouds.Constants; //导入依赖的package包/类
private static BlobStoreContext blobStoreContextFromProperties(
        Properties properties) {
    String provider = properties.getProperty(Constants.PROPERTY_PROVIDER);
    String identity = properties.getProperty(Constants.PROPERTY_IDENTITY);
    String credential = properties.getProperty(
            Constants.PROPERTY_CREDENTIAL);
    String endpoint = properties.getProperty(Constants.PROPERTY_ENDPOINT);
    if (provider == null || identity == null || credential == null) {
        System.err.println("Properties file must contain:\n" +
                Constants.PROPERTY_PROVIDER + "\n" +
                Constants.PROPERTY_IDENTITY + "\n" +
                Constants.PROPERTY_CREDENTIAL);
        System.exit(1);
    }

    ContextBuilder builder = ContextBuilder
            .newBuilder(provider)
            .credentials(identity, credential)
            .modules(ImmutableList.<Module>of(new SLF4JLoggingModule()))
            .overrides(properties);
    if (endpoint != null) {
        builder = builder.endpoint(endpoint);
    }
    return builder.build(BlobStoreContext.class);
}
 
开发者ID:gaul,项目名称:are-we-consistent-yet,代码行数:26,代码来源:AreWeConsistentYet.java

示例11: getFreshSwiftClient

import org.jclouds.Constants; //导入依赖的package包/类
private SwiftClient getFreshSwiftClient() {
        String trimmedAuthUrl = // JClouds expects authURL with no version
            authUrl.substring(0, authUrl.lastIndexOf("/"));
        Iterable<Module> modules = 
            ImmutableSet.<Module> of(new SLF4JLoggingModule());            
            Properties properties = new Properties();
            properties.setProperty(Constants.PROPERTY_STRIP_EXPECT_HEADER,
                                   "true");
        return ContextBuilder.newBuilder(new SwiftApiMetadata())
                              .endpoint(trimmedAuthUrl)
                              .credentials(username, password)
                              .modules(modules)
                              // For JClouds 1.7.1 - 1.7.2
                              .overrides(properties)
                              .buildApi(SwiftClient.class);
                              // For JClouds 1.5.5
//                              .build(SwiftApiMetadata.CONTEXT_TOKEN).getApi();
    }
 
开发者ID:bbranan,项目名称:sdsc-tests,代码行数:19,代码来源:SDSCTest.java

示例12: ECSComputeService

import org.jclouds.Constants; //导入依赖的package包/类
@Inject
protected ECSComputeService(
      ComputeServiceContext context,
      ECSComputeServiceAdapter client,
      Map<String, Credentials> credentialStore,
      @Memoized Supplier<Set<? extends Image>> images,
      Supplier<Set<? extends Hardware>> hardwareProfiles,
      @Memoized Supplier<Set<? extends Location>> locations,
      ListNodesStrategy listNodesStrategy,
      GetImageStrategy getImageStrategy,
      GetNodeMetadataStrategy getNodeMetadataStrategy,
      CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy,
      RebootNodeStrategy rebootNodeStrategy,
      DestroyNodeStrategy destroyNodeStrategy,
      ResumeNodeStrategy resumeNodeStrategy,
      SuspendNodeStrategy suspendNodeStrategy,
      @Named("ECS") Provider<TemplateBuilder> templateBuilderProvider,
      @Named("ECS") Provider<TemplateOptions> templateOptionsProvider,
      @Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
      @Named(TIMEOUT_NODE_TERMINATED) Predicate<AtomicReference<NodeMetadata>> nodeTerminated,
      @Named(TIMEOUT_NODE_SUSPENDED) Predicate<AtomicReference<NodeMetadata>> nodeSuspended,
      Factory initScriptRunnerFactory,
      InitAdminAccess initAdminAccess,
      org.jclouds.compute.callables.RunScriptOnNode.Factory runScriptOnNodeFactory,
      PersistNodeCredentials persistNodeCredentials,
      Timeouts timeouts,
      @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
      Optional<ImageExtension> imageExtension,
      Optional<SecurityGroupExtension> securityGroupExtension) {
   super(context, credentialStore, images, hardwareProfiles, locations, listNodesStrategy, getImageStrategy,
         getNodeMetadataStrategy, runNodesAndAddToSetStrategy, rebootNodeStrategy, destroyNodeStrategy, resumeNodeStrategy,
         suspendNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning, nodeTerminated, nodeSuspended,
         initScriptRunnerFactory, initAdminAccess, runScriptOnNodeFactory, persistNodeCredentials, timeouts, userExecutor,
         imageExtension, securityGroupExtension);
   this.client = client;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:37,代码来源:ECSComputeService.java

示例13: tryAuthenticate

import org.jclouds.Constants; //导入依赖的package包/类
private AuthenticatedBlobStore tryAuthenticate(String identity, String credential) {
    if (locator != null) {
        Map.Entry<String, BlobStore> entry = locator.locateBlobStore(identity, null, null);
        if (entry != null && entry.getKey().equals(credential)) {
            logger.debug("blob store for {} found", identity);
            return (container, key) -> locator.locateBlobStore(identity, container, key).getValue();
        } else {
            logger.debug("blob store for {} not found", identity);
        }
    } else {
        logger.debug("fallback to authenticate with configured provider");
        String provider = properties.getProperty(Constants.PROPERTY_PROVIDER);
        if (provider.equals("transient")) {
            /* there's no authentication for transient blobstores, so simply re-use
               the previous blobstore so that multiple authentication will reuse the
               same namespace */
            AuthenticatedBlobStore blobStore = identitiesToBlobStore.getIfPresent(identity);
            if (blobStore != null) {
                return blobStore;
            }
        }

        try {
            BlobStoreContext context = ContextBuilder
                    .newBuilder(provider)
                    .overrides(properties)
                    .credentials(identity, credential)
                    .modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
                    .build(BlobStoreContext.class);
            return (container, key) -> context.getBlobStore();
        } catch (Throwable e) {
            throw propagate(e);
        }
    }

    return null;
}
 
开发者ID:bouncestorage,项目名称:swiftproxy,代码行数:38,代码来源:BounceResourceConfig.java

示例14: storeFromProperties

import org.jclouds.Constants; //导入依赖的package包/类
public static BlobStore storeFromProperties(Properties properties) {
    String provider = properties.getProperty(Constants.PROPERTY_PROVIDER);
    ContextBuilder builder = ContextBuilder
            .newBuilder(provider)
            .modules(ImmutableList.<Module>of(new SLF4JLoggingModule()))
            .overrides(properties);
    BlobStoreContext context = builder.build(BlobStoreContext.class);
    return context.getBlobStore();
}
 
开发者ID:bouncestorage,项目名称:swiftproxy,代码行数:10,代码来源:Utils.java

示例15: getAuthToken

import org.jclouds.Constants; //导入依赖的package包/类
public static String getAuthToken(WebTarget target) {
    Properties properties = new Properties();
    try (InputStream is = Resources.asByteSource(Resources.getResource(
            "swiftproxy.conf")).openStream()) {
        properties.load(is);
    } catch (IOException e) {
        return null;
    }

    Response resp = target.path("/auth/v1.0").request()
            .header("X-auth-user", properties.getProperty(Constants.PROPERTY_IDENTITY))
            .header("X-auth-key", properties.getProperty(Constants.PROPERTY_CREDENTIAL))
            .get();
    return resp.getHeaderString("x-auth-token");
}
 
开发者ID:bouncestorage,项目名称:swiftproxy,代码行数:16,代码来源:TestUtils.java


注:本文中的org.jclouds.Constants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。