use of com.netflix.exhibitor.core.config.DefaultProperties in project exhibitor by soabase.
the class ExhibitorCreator method addInitialConfigFile.
private void addInitialConfigFile(CommandLine commandLine, Properties properties) throws IOException {
Properties defaultProperties = new Properties();
String defaultConfigFile = commandLine.getOptionValue(INITIAL_CONFIG_FILE);
if (defaultConfigFile == null) {
return;
}
InputStream in = new BufferedInputStream(new FileInputStream(defaultConfigFile));
try {
defaultProperties.load(in);
} finally {
CloseableUtils.closeQuietly(in);
}
Set<String> propertyNames = Sets.newHashSet();
for (StringConfigs config : StringConfigs.values()) {
propertyNames.add(PropertyBasedInstanceConfig.toName(config, ""));
}
for (IntConfigs config : IntConfigs.values()) {
propertyNames.add(PropertyBasedInstanceConfig.toName(config, ""));
}
for (String name : defaultProperties.stringPropertyNames()) {
if (propertyNames.contains(name)) {
String value = defaultProperties.getProperty(name);
properties.setProperty(PropertyBasedInstanceConfig.ROOT_PROPERTY_PREFIX + name, value);
} else {
log.warn("Ignoring unknown config: " + name);
}
}
}
use of com.netflix.exhibitor.core.config.DefaultProperties in project exhibitor by soabase.
the class ExhibitorCreator method makeConfigProvider.
private ConfigProvider makeConfigProvider(String configType, ExhibitorCLI cli, CommandLine commandLine, PropertyBasedS3Credential awsCredentials, PropertyBasedS3ClientConfig awsClientConfig, BackupProvider backupProvider, String useHostname, String s3Region) throws Exception {
Properties defaultProperties = makeDefaultProperties(commandLine, backupProvider);
ConfigProvider configProvider;
if (configType.equals("s3")) {
configProvider = getS3Provider(cli, commandLine, awsCredentials, awsClientConfig, useHostname, defaultProperties, s3Region);
} else if (configType.equals("file")) {
configProvider = getFileSystemProvider(commandLine, defaultProperties);
} else if (configType.equals("zookeeper")) {
configProvider = getZookeeperProvider(commandLine, useHostname, defaultProperties);
} else if (configType.equals("none")) {
log.warn("Warning: you have intentionally turned off shared configuration. This mode is meant for special purposes only. Please verify that this is your intent.");
configProvider = getNoneProvider(commandLine, defaultProperties);
} else {
configProvider = null;
log.error("Unknown configtype: " + configType);
}
return configProvider;
}
Aggregations