本文整理汇总了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();
}
示例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()))
));
}
示例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);
}