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


Java ConfigurationConverter.getProperties方法代码示例

本文整理汇总了Java中org.apache.commons.configuration.ConfigurationConverter.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationConverter.getProperties方法的具体用法?Java ConfigurationConverter.getProperties怎么用?Java ConfigurationConverter.getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.configuration.ConfigurationConverter的用法示例。


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

示例1: main

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
public static void main(String[] args)
    throws Exception {
  if (args.length < 1 || args.length > 2) {
    System.err.println(
        "Usage: SchedulerDaemon <default configuration properties file> [custom configuration properties file]");
    System.exit(1);
  }

  // Load default framework configuration properties
  Properties defaultProperties = ConfigurationConverter.getProperties(new PropertiesConfiguration(args[0]));

  // Load custom framework configuration properties (if any)
  Properties customProperties = new Properties();
  if (args.length == 2) {
    customProperties.putAll(ConfigurationConverter.getProperties(new PropertiesConfiguration(args[1])));
  }

  // Start the scheduler daemon
  new SchedulerDaemon(defaultProperties, customProperties).start();
}
 
开发者ID:Hanmourang,项目名称:Gobblin,代码行数:21,代码来源:SchedulerDaemon.java

示例2: databasePropertySourcesPlaceholderConfigurer

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
/**
 * The database supplied property sources placeholder configurer that allows access to externalized properties from a database. This method also adds a new
 * property source that contains the database properties to the environment.
 *
 * @return the property sources placeholder configurer.
 */
@Bean
public static PropertySourcesPlaceholderConfigurer databasePropertySourcesPlaceholderConfigurer()
{
    // Get the configurable environment and add a new property source to it that contains the database properties.
    // That way, the properties can be accessed via the environment or via an injected @Value annotation.
    // We are adding this property source last so other property sources (e.g. system properties, environment variables) can be used
    // to override the database properties.
    Environment environment = ApplicationContextHolder.getApplicationContext().getEnvironment();
    if (environment instanceof ConfigurableEnvironment)
    {
        ConfigurableEnvironment configurableEnvironment = (ConfigurableEnvironment) environment;
        ReloadablePropertySource reloadablePropertySource =
            new ReloadablePropertySource(ReloadablePropertySource.class.getName(), ConfigurationConverter.getProperties(getPropertyDatabaseConfiguration()),
                getPropertyDatabaseConfiguration());
        configurableEnvironment.getPropertySources().addLast(reloadablePropertySource);
    }

    return new PropertySourcesPlaceholderConfigurer();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:26,代码来源:DaoSpringModuleConfig.java

示例3: setPamProperties

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
private void setPamProperties() {
    try {
        this.groupsFromUGI = ApplicationProperties.get().getBoolean("atlas.authentication.method.pam.ugi-groups", true);
        Properties properties = ConfigurationConverter.getProperties(ApplicationProperties.get()
                .subset("atlas.authentication.method.pam"));
        for (String key : properties.stringPropertyNames()) {
            String value = properties.getProperty(key);
            options.put(key, value);
        }
        if (!options.containsKey("service")) {
            options.put("service", "atlas-login");
        }
    } catch (Exception e) {
        LOG.error("Exception while setLdapProperties", e);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:17,代码来源:AtlasPamAuthenticationProvider.java

示例4: getSail

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
@Override
	public synchronized Sail getSail() throws SailException {
		if (sail == null) {
			try {
				config = PlatformConfigHelper.getConfig();
				Properties properties = ConfigurationConverter.getProperties(loadProperties());
//				BigdataSailRepository repository = new BigdataSailRepository(new com.bigdata.rdf.sail.BigdataSail(properties));
//				repo = new BigdataSail(repository);
				sail = new SimpleTypeInferencingSail(
//					   new SmartSailWrapper(
					   new BigdataSail(properties));
//				sail.setPipelineTypes(Arrays.asList(
//						"getReadOnlyConnection", 
//						"getReadWriteConnection",
//						"getUnisolatedConnection"));
			} catch (Exception e) {
				throw new SailException(e);
			} 
		}
		return sail;
	}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:22,代码来源:Bigdata.java

示例5: main

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
public static void main(String[] args)
    throws Exception {
  if (args.length < 1 || args.length > 2) {
    System.err.println(
        "Usage: SchedulerDaemon <default configuration properties file> [custom configuration properties file]");
    System.exit(1);
  }

  // Load default framework configuration properties
  Properties defaultProperties = ConfigurationConverter.getProperties(new PropertiesConfiguration(args[0]));

  // Load custom framework configuration properties (if any)
  Properties customProperties = new Properties();
  if (args.length == 2) {
    customProperties.putAll(ConfigurationConverter.getProperties(new PropertiesConfiguration(args[1])));
  }

  log.debug("Scheduler Daemon::main starting with defaultProperties: {}, customProperties: {}", defaultProperties,
      customProperties);
  // Start the scheduler daemon
  new SchedulerDaemon(defaultProperties, customProperties).start();
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:23,代码来源:SchedulerDaemon.java

示例6: createFromProperties

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
public static DbDataComparisonConfig createFromProperties(final Configuration config) {
    Properties propsView = ConfigurationConverter.getProperties(config);  // config.getString() automatically parses
    // for commas...would like to avoid this
    DbDataComparisonConfig compConfig = new DbDataComparisonConfig();
    compConfig.setInputTables(Lists.mutable.with(propsView.getProperty("tables.include").split(",")));
    compConfig.setExcludedTables(Lists.mutable.with(propsView.getProperty("tables.exclude").split(",")).toSet());
    String comparisonsStr = propsView.getProperty("comparisons");

    MutableList<Pair<String, String>> compCmdPairs = Lists.mutable.empty();
    MutableSet<String> dsNames = UnifiedSet.newSet();
    for (String compPairStr : comparisonsStr.split(";")) {
        String[] pairParts = compPairStr.split(",");
        compCmdPairs.add(Tuples.pair(pairParts[0], pairParts[1]));

        // note - if I knew where the Pair.TO_ONE TO_TWO selectors were, I'd use those
        dsNames.add(pairParts[0]);
        dsNames.add(pairParts[1]);
    }

    compConfig.setComparisonCommandNamePairs(compCmdPairs);

    MutableList<DbDataSource> dbDataSources = dsNames.toList().collect(new Function<String, DbDataSource>() {
        @Override
        public DbDataSource valueOf(String dsName) {
            Configuration dsConfig = config.subset(dsName);

            DbDataSource dbDataSource = new DbDataSource();
            dbDataSource.setName(dsName);
            dbDataSource.setUrl(dsConfig.getString("url"));
            dbDataSource.setSchema(dsConfig.getString("schema"));
            dbDataSource.setUsername(dsConfig.getString("username"));
            dbDataSource.setPassword(dsConfig.getString("password"));
            dbDataSource.setDriverClassName(dsConfig.getString("driverClass"));

            return dbDataSource;
        }
    });
    compConfig.setDbDataSources(dbDataSources);
    return compConfig;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:41,代码来源:DbDataComparisonConfigFactory.java

示例7: exportSQLFileFromDatabase

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
@Override
public File exportSQLFileFromDatabase(int dbId) throws Exception {
	OrdsPhysicalDatabase database = this.getPhysicalDatabaseFromID(dbId);
	DatabaseServer server = ServerConfigurationService.Factory.getInstance().getDatabaseServer(database.getDatabaseServer());
	// create the file
	String databaseName = database.getDbConsumedName();
	File file = File.createTempFile("dump_" + databaseName, "sql");
	Properties properties = ConfigurationConverter.getProperties(MetaConfiguration.getConfiguration());
	String postgres_bin = "";
	if ( properties.containsKey("ords.postgresql.bin.path")) {
		postgres_bin = properties.getProperty("ords.postgresql.bin.path");
	}
	ProcessBuilder processBuilder = new ProcessBuilder(postgres_bin+"pg_dump", 
			"-f", 
			file.toString(), 
			"-v", "-o", "-h", 
			database.getDatabaseServer(), 
			"-U", 
			server.getUsername(), database.getDbConsumedName());
	
	processBuilder.environment().put("PGPASSWORD", server.getPassword());
	Process process = processBuilder.start();
	try {
		InputStream is = process.getInputStream();
		InputStreamReader reader = new InputStreamReader(is);
		BufferedReader buffer = new BufferedReader(reader);
		String line;
		while ((line = buffer.readLine()) != null ) {
			System.out.println(line);
			if (log.isDebugEnabled()) {
				log.debug(line);
			}
		}
	}
	catch ( Exception e ) {
		log.error("ERROR", e );
	}
	return file;
}
 
开发者ID:ox-it,项目名称:ords-database-api,代码行数:40,代码来源:SQLServicePostgresImpl.java

示例8: parseArgs

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
/**
 * Parse command line arguments and return a {@link java.util.Properties} object for the gobblin job found.
 * @param caller Class of the calling main method. Used for error logs.
 * @param args Command line arguments.
 * @return Instance of {@link Properties} for the Gobblin job to run.
 * @throws IOException
 */
public static Properties parseArgs(Class<?> caller, String[] args) throws IOException {

  try {
    // Parse command-line options
    CommandLine cmd = new DefaultParser().parse(options(), args);

    if (cmd.hasOption(HELP_OPTION.getOpt())) {
      printUsage(caller);
      System.exit(0);
    }

    if (!cmd.hasOption(SYS_CONFIG_OPTION.getLongOpt()) || !cmd.hasOption(JOB_CONFIG_OPTION.getLongOpt())) {
      printUsage(caller);
      System.exit(1);
    }

    // Load system and job configuration properties
    Properties sysConfig = ConfigurationConverter
        .getProperties(new PropertiesConfiguration(cmd.getOptionValue(SYS_CONFIG_OPTION.getLongOpt())));
    Properties jobConfig = ConfigurationConverter
        .getProperties(new PropertiesConfiguration(cmd.getOptionValue(JOB_CONFIG_OPTION.getLongOpt())));

    return JobConfigurationUtils.combineSysAndJobProperties(sysConfig, jobConfig);
  } catch (ParseException pe) {
    throw new IOException(pe);
  } catch (ConfigurationException ce) {
    throw new IOException(ce);
  }

}
 
开发者ID:Hanmourang,项目名称:Gobblin,代码行数:38,代码来源:CliOptions.java

示例9: setADProperties

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
private void setADProperties() {
    try {

        Configuration configuration = ApplicationProperties.get();
        Properties properties = ConfigurationConverter.getProperties(configuration.subset("atlas.authentication.method.ldap.ad"));
        this.adDomain = properties.getProperty("domain");
        this.adURL = properties.getProperty("url");
        this.adBindDN = properties.getProperty("bind.dn");
        this.adBindPassword = properties.getProperty("bind.password");
        this.adUserSearchFilter = properties.getProperty("user.searchfilter");
        this.adBase = properties.getProperty("base.dn");
        this.adReferral = properties.getProperty("referral");
        this.adDefaultRole = properties.getProperty("default.role");

        this.groupsFromUGI = configuration.getBoolean("atlas.authentication.method.ldap.ugi-groups", true);

        if(LOG.isDebugEnabled()) {
            LOG.debug("AtlasADAuthenticationProvider{" +
                    "adURL='" + adURL + '\'' +
                    ", adDomain='" + adDomain + '\'' +
                    ", adBindDN='" + adBindDN + '\'' +
                    ", adUserSearchFilter='" + adUserSearchFilter + '\'' +
                    ", adBase='" + adBase + '\'' +
                    ", adReferral='" + adReferral + '\'' +
                    ", adDefaultRole='" + adDefaultRole + '\'' +
                    ", groupsFromUGI=" + groupsFromUGI +
                    '}');
        }


    } catch (Exception e) {
        LOG.error("Exception while setADProperties", e);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:35,代码来源:AtlasADAuthenticationProvider.java

示例10: setLdapProperties

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
private void setLdapProperties() {
    try {
        Configuration configuration = ApplicationProperties.get();
        Properties properties = ConfigurationConverter.getProperties(configuration.subset("atlas.authentication.method.ldap"));
        ldapURL = properties.getProperty("url");
        ldapUserDNPattern = properties.getProperty("userDNpattern");
        ldapGroupSearchBase = properties.getProperty("groupSearchBase");
        ldapGroupSearchFilter = properties.getProperty("groupSearchFilter");
        ldapGroupRoleAttribute = properties.getProperty("groupRoleAttribute");
        ldapBindDN = properties.getProperty("bind.dn");
        ldapBindPassword = properties.getProperty("bind.password");
        ldapDefaultRole = properties.getProperty("default.role");
        ldapUserSearchFilter = properties.getProperty("user.searchfilter");
        ldapReferral = properties.getProperty("referral");
        ldapBase = properties.getProperty("base.dn");
        groupsFromUGI = configuration.getBoolean("atlas.authentication.method.ldap.ugi-groups", true);

        if(LOG.isDebugEnabled()) {
            LOG.debug("AtlasLdapAuthenticationProvider{" +
                    "ldapURL='" + ldapURL + '\'' +
                    ", ldapUserDNPattern='" + ldapUserDNPattern + '\'' +
                    ", ldapGroupSearchBase='" + ldapGroupSearchBase + '\'' +
                    ", ldapGroupSearchFilter='" + ldapGroupSearchFilter + '\'' +
                    ", ldapGroupRoleAttribute='" + ldapGroupRoleAttribute + '\'' +
                    ", ldapBindDN='" + ldapBindDN + '\'' +
                    ", ldapDefaultRole='" + ldapDefaultRole + '\'' +
                    ", ldapUserSearchFilter='" + ldapUserSearchFilter + '\'' +
                    ", ldapReferral='" + ldapReferral + '\'' +
                    ", ldapBase='" + ldapBase + '\'' +
                    ", groupsFromUGI=" + groupsFromUGI +
                    '}');
        }

    } catch (Exception e) {
        LOG.error("Exception while setLdapProperties", e);
    }

}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:39,代码来源:AtlasLdapAuthenticationProvider.java

示例11: init

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
public static void init(org.apache.commons.configuration.Configuration atlasConfiguration) throws AtlasException {
    LOG.debug("==> InMemoryJAASConfiguration.init()");

    if (atlasConfiguration != null && !atlasConfiguration.isEmpty()) {
        Properties properties = ConfigurationConverter.getProperties(atlasConfiguration);
        init(properties);
    } else {
        throw new AtlasException("Failed to load JAAS application properties: configuration NULL or empty!");
    }

    LOG.debug("<== InMemoryJAASConfiguration.init()");
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:13,代码来源:InMemoryJAASConfiguration.java

示例12: KafkaNotification

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
/**
 * Construct a KafkaNotification.
 *
 * @param applicationProperties  the application properties used to configure Kafka
 *
 * @throws AtlasException if the notification interface can not be created
 */
@Inject
public KafkaNotification(Configuration applicationProperties) throws AtlasException {
    super(applicationProperties);
    Configuration subsetConfiguration =
            ApplicationProperties.getSubsetConfiguration(applicationProperties, PROPERTY_PREFIX);
    properties = ConfigurationConverter.getProperties(subsetConfiguration);
    //override to store offset in kafka
    //todo do we need ability to replay?

    //Override default configs
    properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
            "org.apache.kafka.common.serialization.StringSerializer");
    properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
            "org.apache.kafka.common.serialization.StringSerializer");
    properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
            "org.apache.kafka.common.serialization.StringDeserializer");
    properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
            "org.apache.kafka.common.serialization.StringDeserializer");
    properties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");

    pollTimeOutMs = subsetConfiguration.getLong("poll.timeout.ms", 1000);
    boolean oldApiCommitEnbleFlag = subsetConfiguration.getBoolean("auto.commit.enable",false);
    //set old autocommit value if new autoCommit property is not set.
    properties.put("enable.auto.commit", subsetConfiguration.getBoolean("enable.auto.commit", oldApiCommitEnbleFlag));
    properties.put("session.timeout.ms", subsetConfiguration.getString("session.timeout.ms", "30000"));

}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:35,代码来源:KafkaNotification.java

示例13: readFilterIntoProperties

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
/**
 * Filter io contain the properties we wish to substitute in templates.
 *
 * Uses Apache Commons Configuration to load filters.
 */
private Properties readFilterIntoProperties(final FileInfo filter) throws ConfigurationException, IOException {
    final CompositeConfiguration composite = new CompositeConfiguration();
    final List<File> files = filter.getFiles();
    for (final File file : files) {
        final PropertiesConfiguration config = new PropertiesConfiguration(file);
        config.setEncoding(configGeneratorParameters.getEncoding());
        composite.addConfiguration(config);
    }
    if (StringUtils.isNotBlank(configGeneratorParameters.getFilterSourcePropertyName())) {
        composite.setProperty(configGeneratorParameters.getFilterSourcePropertyName(), filter.getAllSources());
    }
    return ConfigurationConverter.getProperties(composite);
}
 
开发者ID:sofdes,项目名称:config-generation-maven-plugin,代码行数:19,代码来源:ConfigGeneratorImpl.java

示例14: fileToProperties

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
/**
 * Load the properties from the specified file into a {@link Properties} object.
 *
 * @param fileName the name of the file to load properties from
 * @param conf configuration object to determine the file system to be used
 * @return a new {@link Properties} instance
 */
public static Properties fileToProperties(String fileName, Configuration conf)
    throws IOException, ConfigurationException {

  PropertiesConfiguration propsConfig = new PropertiesConfiguration();
  Path filePath = new Path(fileName);
  URI fileURI = filePath.toUri();

  if (fileURI.getScheme() == null && fileURI.getAuthority() == null) {
    propsConfig.load(FileSystem.getLocal(conf).open(filePath));
  } else {
    propsConfig.load(filePath.getFileSystem(conf).open(filePath));
  }
  return ConfigurationConverter.getProperties(propsConfig);
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:22,代码来源:JobConfigurationUtils.java

示例15: createSchema

import org.apache.commons.configuration.ConfigurationConverter; //导入方法依赖的package包/类
@Override
public synchronized void createSchema() {
    final Properties props = ConfigurationConverter.getProperties(configuration.subset(String.format(CONFIG_PREFIX_FORMAT, schemaName.toLowerCase())));
    try {
        props.setProperty("name", props.getProperty("keyspace"));
        LOG.info("Creating schema: " + schemaName + " " + props);
        this.keyspace.createKeyspace(props);
    } catch (ConnectionException e) {
        LOG.error("Failed to create schema '{}' with properties '{}'", new Object[]{schemaName, props.toString(), e});
        throw new RuntimeException("Failed to create keyspace " + keyspace.getKeyspaceName(), e);
    }
}
 
开发者ID:Netflix,项目名称:staash,代码行数:13,代码来源:AstyanaxDaoSchemaProvider.java


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