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


Java ChainedConfigContext类代码示例

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


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

示例1: initialize

import com.joyent.manta.config.ChainedConfigContext; //导入依赖的package包/类
/**
 * Initialization method called after a new FileSystem instance is constructed.
 *
 * @param name a uri whose authority section names the host, port, etc.
 *             for this FileSystem. [Not used for Manta implementation]
 * @param conf Hadoop configuration object
 * @throws IOException thrown when we can't create a Manta Client
 */
@Override
public void initialize(final URI name, final Configuration conf) throws IOException {
    super.initialize(name, conf);

    ChainedConfigContext chained = new ChainedConfigContext(
            new EnvVarConfigContext(),
            new MapConfigContext(System.getProperties()),
            new HadoopConfigurationContext(conf),
            new DefaultsConfigContext()
    );

    dumpConfig(chained);

    this.config = chained;
    this.client = new MantaClient(this.config);

    this.workingDir = getInitialWorkingDirectory();
}
 
开发者ID:joyent,项目名称:hadoop-manta,代码行数:27,代码来源:MantaFileSystem.java

示例2: MantaSession

import com.joyent.manta.config.ChainedConfigContext; //导入依赖的package包/类
public MantaSession(final Host host, final X509TrustManager trust, final X509KeyManager key) {
    super(host, new ThreadLocalHostnameDelegatingTrustManager(new DisabledX509TrustManager(), host.getHostname()), key);
    config = new AuthAwareConfigContext(new ChainedConfigContext(
        new DefaultsConfigContext(),
        new StandardConfigContext()
            .setNoAuth(true)
            .setMantaKeyPath(null)
            .setHttpsProtocols(PreferencesFactory.get().getProperty("connection.ssl.protocols"))
            .setDisableNativeSignatures(true)
            .setMantaUser(host.getCredentials().getUsername())
            .setMantaURL(String.format("%s://%s", host.getProtocol().getScheme().name(), host.getHostname()))
    ));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:14,代码来源:MantaSession.java

示例3: init

import com.joyent.manta.config.ChainedConfigContext; //导入依赖的package包/类
@Override
public void init(final Config config, final Logger logger) {
    logger.debug("Manta client has started initialization");
    super.init(config, logger);

    // We change the default number of connections to something more
    // fitting for COSBench.
    StandardConfigContext defaults = new StandardConfigContext();
    defaults.overwriteWithContext(new DefaultsConfigContext());
    defaults.setMaximumConnections(MAX_CONNECTIONS);

    final CosbenchMantaConfigContext cosbenchConfig = new CosbenchMantaConfigContext(config);
    final ChainedConfigContext context = new ChainedConfigContext(defaults, new EnvVarConfigContext(),
            new SystemSettingsConfigContext(), cosbenchConfig);

    this.durabilityLevel = cosbenchConfig.getDurabilityLevel();
    this.logging = cosbenchConfig.logging();
    this.sections = cosbenchConfig.getNumberOfSections();
    this.objectSize = cosbenchConfig.getObjectSize();
    this.multipart = cosbenchConfig.isMultipart();

    this.splitSize = cosbenchConfig.getSplitSize();
    if (splitSize == null) {
        splitSize = DEFAULT_SPLIT;
    }
    if (cosbenchConfig.chunked() == null) {
        if (logging) {
            logger.info("Chunked mode is disabled");
        }

        this.chunked = false;
    } else {
        final String status;
        if (cosbenchConfig.chunked()) {
            status = "enabled";
        } else {
            status = "disabled";
        }

        if (logging) {
            logger.info("Chunked mode is " + status);
        }
        this.chunked = cosbenchConfig.chunked();
    }

    if (logging) {
        logger.info(String.format("Client configuration: %s", context));
    }

    try {
        client = new MantaClient(context);

        final String baseDir = Objects.toString(cosbenchConfig.getBaseDirectory(), DEFAULT_COSBENCH_BASE_DIR);

        // We rely on COSBench properly cleaning up after itself.
        currentTestDirectory = String.format("%s/%s", context.getMantaHomeDirectory(), baseDir);

        client.putDirectory(currentTestDirectory, true);

        if (!client.existsAndIsAccessible(currentTestDirectory)) {
            String msg = "Unable to create base test directory";
            throw new StorageException(msg);
        }
    } catch (IOException e) {
        logger.error("Error in initialization", e);
        throw new StorageException(e);
    }

    if (logging) {
        logger.debug("Manta client has been initialized");
    }
    if (cosbenchConfig.isClientEncryptionEnabled()) {
        encryptedMultipartManager = new EncryptedServerSideMultipartManager(client);
    }
    serverMultipartManager = new ServerSideMultipartManager(client);
}
 
开发者ID:joyent,项目名称:cosbench-manta,代码行数:77,代码来源:MantaStorage.java


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