Java 类org.apache.commons.configuration.SystemConfiguration 实例源码

项目:incubator-servicecomb-java-chassis    文件:ConfigUtil.java   
public static ConcurrentCompositeConfiguration createLocalConfig(List<ConfigModel> configModelList) {
  ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();

  duplicateServiceCombConfigToCse(config,
      new ConcurrentMapConfiguration(new SystemConfiguration()),
      "configFromSystem");
  duplicateServiceCombConfigToCse(config,
      convertEnvVariable(new ConcurrentMapConfiguration(new EnvironmentConfiguration())),
      "configFromEnvironment");
  duplicateServiceCombConfigToCse(config,
      new DynamicConfiguration(
          new MicroserviceConfigurationSource(configModelList), new NeverStartPollingScheduler()),
      "configFromYamlFile");

  return config;
}
项目:incubator-servicecomb-java-chassis    文件:TestYAMLConfigurationSource.java   
@Test
public void testFullOperation() {
  // configuration from system properties
  ConcurrentMapConfiguration configFromSystemProperties =
      new ConcurrentMapConfiguration(new SystemConfiguration());
  // configuration from yaml file
  DynamicConfiguration configFromYamlFile =
      new DynamicConfiguration(yamlConfigSource(), new NeverStartPollingScheduler());
  // create a hierarchy of configuration that makes
  // 1) dynamic configuration source override system properties
  ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
  finalConfig.addConfiguration(configFromYamlFile, "yamlConfig");
  finalConfig.addConfiguration(configFromSystemProperties, "systemEnvConfig");
  Assert.assertEquals(0.5, finalConfig.getDouble("trace.handler.sampler.percent"), 0.5);

  Object o = finalConfig.getProperty("zq");
  @SuppressWarnings("unchecked")
  List<Map<String, Object>> listO = (List<Map<String, Object>>) o;
  Assert.assertEquals(3, listO.size());
}
项目:xtesy-framework    文件:Settings.java   
/**
 * @author Wasiq B
 * @since 31-May-2015 9:23:00 pm
 */
private Settings () {
    super ();
    log.entry ();
    try {
        addConfiguration (new SystemConfiguration ());
        parseConfig ();
    }
    catch (final ConfigurationException | FileNotFoundException e) {
        try {
            throw new FrameworkException ("Load Settings", e);
        }
        catch (final FrameworkException e1) {
            log.catching (e1);
            log.error (ExceptionUtils.getRootCauseMessage (e1));
            log.error (ExceptionUtils.getStackTrace (e1));
        }
    }
    finally {
        log.exit ();
    }
}
项目:jindy    文件:CommonsSimpleImpl.java   
@Override
protected Configuration createConfiguration(String name) throws ConfigurationException {
  CompositeConfiguration config = new CompositeConfiguration();
  config.addConfiguration(new SystemConfiguration());
  try {
    if (ConfigFactory.DEFAULT_CONFIG_NAME.equals(name)) {
      config.addConfiguration(new PropertiesConfiguration("config.properties"));
    } else {
      config.addConfiguration(new PropertiesConfiguration(name));
    }
  } catch (ConfigurationException e) {
    String message = "No properties file found: " + name
        + ". Using an empty BaseConfiguration instead.";
    if (ConfigFactory.DEFAULT_CONFIG_NAME.equals(name)) {
      LOG.info(message);
    } else {
      LOG.warn(message);
    }
    BaseConfiguration base = new BaseConfiguration();
    config.addConfiguration(base);
  }
  return config;
}
项目:artifactory_ssh_proxy    文件:SshdSettingsBuilder.java   
protected Configuration createConfiguration(final String overriddenPath) {
    try {

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("got overriddenPath {}", overriddenPath);
        }

        CompositeConfiguration compositeConfig = new CompositeConfiguration();
        // TODO: see how Systems and properties interact.
        compositeConfig.addConfiguration(new SystemConfiguration());
        compositeConfig.addConfiguration(findPropertiesConfiguration(overriddenPath));

        return compositeConfig;
    } catch (ConfigurationException e) {
        throw new RuntimeException(e);
    }
}
项目:appframework    文件:ConfigUtil.java   
private synchronized static void init() {
    try {
        config = new CompositeConfiguration();
        config.setLogger(log);

        // 1 SystemConfiguration
        SystemConfiguration configSys = new SystemConfiguration();

        cfgMap = new HashMap<String, Configuration>();

        cfgMap.put("system", configSys);
        config.addConfiguration(configSys);
        log.debug("loading System Properties");

    } catch (Exception e) {
        log.error("load config file failed: " + ExceptionUtils.getFullStackTrace(e));
    }
}
项目:jbake    文件:ConfigUtil.java   
public static CompositeConfiguration load(File source, boolean isRunServer) throws ConfigurationException {
      CompositeConfiguration config = new CompositeConfiguration();
      config.setListDelimiter(',');
      File customConfigFile = new File(source, LEGACY_CONFIG_FILE);
      if (customConfigFile.exists()) {
        LEGACY_CONFIG_FILE_EXISTS = true;
          config.addConfiguration(new PropertiesConfiguration(customConfigFile));
      }
      customConfigFile = new File(source, CONFIG_FILE);
      if (customConfigFile.exists()) {
          config.addConfiguration(new PropertiesConfiguration(customConfigFile));
      }
      config.addConfiguration(new PropertiesConfiguration(DEFAULT_CONFIG_FILE));
      config.addConfiguration(new SystemConfiguration());
      if (isRunServer) {
    String port = config.getString(Keys.SERVER_PORT);
    config.setProperty(Keys.SITE_HOST, "http://localhost:"+port);
}
      return config;
  }
项目:glados-wiki    文件:GroovyConfigurer.java   
private Optional<String> getUserConfigFilename() throws NamingException {
    CompositeConfiguration cc = new CompositeConfiguration();
    JNDIConfiguration jndi = new JNDIConfiguration();
    EnvironmentConfiguration env = new EnvironmentConfiguration();
    SystemConfiguration jvm = new SystemConfiguration();
    cc.addConfiguration(jvm);
    cc.addConfiguration(env);
    cc.addConfiguration(jndi);
    //
    final String CONFIG_FILENAME = (String) cc.getProperty("gladosWiki_configFile");
    if (false == Strings.isNullOrEmpty(CONFIG_FILENAME)) {
        LOG.debug(String.format("LOCAL-CONFIG CONFIG_FILENAME = %s", CONFIG_FILENAME));
        return Optional.of(CONFIG_FILENAME);
    } else {
        return Optional.absent();
    }
}
项目:bigstreams    文件:TestFilesSendWorkerServerFailures.java   
@Before
public void setUp() throws Exception {

    conf = new SystemConfiguration();

    // Create LZO Codec
    org.apache.hadoop.conf.Configuration hadoopConf = new org.apache.hadoop.conf.Configuration();
    GzipCodec gzipCodec = new GzipCodec();
    gzipCodec.setConf(hadoopConf);

    codec = gzipCodec;

    // Write out test file
    baseDir = new File(".", "target/testClientServerFailures/");
    baseDir.mkdirs();

    fileToStream = new File(baseDir, "test.txt");

    if (fileToStream.exists())
        fileToStream.delete();

    fileToStream.createNewFile();

    FileWriter writer = new FileWriter(fileToStream);
    BufferedWriter buffWriter = new BufferedWriter(writer);
    try {
        for (int i = 0; i < testLineCount; i++) {

            buffWriter.write(testString);
            buffWriter.write('\n');
        }
    } finally {
        buffWriter.close();
        writer.close();
    }
}
项目:bigstreams    文件:TestProtocolImpl.java   
@Test
public void testReadProtocolWrongHeaderLen() throws Exception {

    ByteArrayOutputStream output = new ByteArrayOutputStream();
    DataOutputStream datOut = new DataOutputStream(output);

    // write the wrong length for the header length.
    // no further data is needed as we expect the Protocol to fail on this
    try {
        byte[] namebytes = GzipCodec.class.getName().getBytes();
        datOut.writeInt(namebytes.length);
        datOut.write(namebytes);
        datOut.writeInt(1000);
        datOut.write("test".getBytes()); // this data is normally compressed
                                            // but we expect the code to
                                            // fail when reading the
        // lengths
    } finally {
        datOut.close();
        output.close();
    }

    CompressionPoolFactory pf = new CompressionPoolFactoryImpl(10, 10,
            new AgentStatusImpl());
    ProtocolImpl p = new ProtocolImpl(pf);

    Configuration conf = new SystemConfiguration();

    ByteArrayInputStream in = new ByteArrayInputStream(output.toByteArray());
    try {
        p.read(conf, new DataInputStream(in));
        assertTrue(false);
    } catch (Throwable t) {
        assertTrue(true);
    }
}
项目:bigstreams    文件:TestProtocolImpl.java   
@Test
public void testReadProtocolWrongCompressionLen() throws Exception {

    ByteArrayOutputStream output = new ByteArrayOutputStream();
    DataOutputStream datOut = new DataOutputStream(output);

    // write the wrong length for the header.
    // no further data is needed as we expect the Protocol to fail on this
    try {
        datOut.writeInt(400);
        datOut.write(GzipCodec.class.getName().getBytes());
    } finally {
        datOut.close();
        output.close();
    }

    CompressionPoolFactory pf = new CompressionPoolFactoryImpl(10, 10,
            new AgentStatusImpl());

    ProtocolImpl p = new ProtocolImpl(pf);

    Configuration conf = new SystemConfiguration();

    ByteArrayInputStream in = new ByteArrayInputStream(output.toByteArray());
    try {
        p.read(conf, new DataInputStream(in));
        assertTrue(false);
    } catch (Throwable t) {
        assertTrue(true);
    }
}
项目:bigstreams    文件:TestConfigCheck.java   
@Test
public void testConfigCheckOK() throws Exception {

    ConfigCheck check = new ConfigCheck(new SystemConfiguration());
    check.runCheck();
    assertTrue(true);

}
项目:micro-service-netflix    文件:NetflixPropertySourceLocator.java   
@Override
    public PropertySource<?> locate(Environment environment) {

        try {
            // configuration from local properties file
            ConcurrentMapConfiguration configFromPropertiesFile = new ConcurrentMapConfiguration(new PropertiesConfiguration("application.yml"));

            // configuration from system properties
            ConcurrentMapConfiguration configFromSystemProperties = new ConcurrentMapConfiguration(new SystemConfiguration());

            // configuration from a dynamic source
//          PolledConfigurationSource source = new NetflixUrlPolledConfigurationSource();
            PolledConfigurationSource source = new NetflixEurekaPolledConfigurationSource();
            AbstractPollingScheduler scheduler = new FixedDelayPollingScheduler();
            DynamicConfiguration dynamicConfiguration = new DynamicConfiguration(source, scheduler);

            // create a hierarchy of configuration that makes
            // 1) dynamic configuration source override system properties
            // 2) system properties override properties file
            ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
            finalConfig.addConfiguration(dynamicConfiguration, "dynamicConfig");
            finalConfig.addConfiguration(configFromSystemProperties, "systemConfig");
            finalConfig.addConfiguration(configFromPropertiesFile, "fileConfig");

            // install with ConfigurationManager so that finalConfig
            // becomes the source of dynamic properties
            ConfigurationManager.install(finalConfig);
        } catch(Exception e) {
            logger.error(e.getMessage());
        }

        return null;
    }
项目:jindy    文件:ApacheTestFactory.java   
@Override
public Config createConfig(String name) {
  try {
    final CompositeConfiguration config = new CompositeConfiguration();
    config.addConfiguration(new SystemConfiguration());
    config.addConfiguration(new PropertiesConfiguration("test.properties"));
    return new ApacheTestConfig(config);
  } catch (ConfigurationException e) {
    throw new RuntimeException(e);
  }
}
项目:incubator-gobblin    文件:DatabaseJobHistoryStoreSchemaManager.java   
public static void main(String[] args) throws IOException {
  if (args.length < 1 || args.length > 2) {
    printUsage();
  }
  Closer closer = Closer.create();
  try {
    CompositeConfiguration config = new CompositeConfiguration();
    config.addConfiguration(new SystemConfiguration());
    if (args.length == 2) {
      config.addConfiguration(new PropertiesConfiguration(args[1]));
    }
    Properties properties = getProperties(config);
    DatabaseJobHistoryStoreSchemaManager schemaManager =
            closer.register(DatabaseJobHistoryStoreSchemaManager.builder(properties).build());
    if (String.CASE_INSENSITIVE_ORDER.compare("migrate", args[0]) == 0) {
      schemaManager.migrate();
    } else if (String.CASE_INSENSITIVE_ORDER.compare("info", args[0]) == 0) {
      schemaManager.info();
    } else {
      printUsage();
    }
  } catch (Throwable t) {
    throw closer.rethrow(t);
  } finally {
    closer.close();
  }
}
项目:juddi    文件:ClientConfig.java   
/**
 * Does the actual work of reading the configuration from System
 * Properties and/or uddi.xml file. When the uddi.xml file is updated
 * the file will be reloaded. By default the reloadDelay is set to 1
 * second to prevent excessive date stamp checking.
 */
private void loadConfiguration(String configurationFile, Properties properties) throws ConfigurationException {
        //Properties from system properties
        CompositeConfiguration compositeConfig = new CompositeConfiguration();
        compositeConfig.addConfiguration(new SystemConfiguration());
        //Properties from XML file
        if (System.getProperty(UDDI_CONFIG_FILENAME_PROPERTY) != null) {
                log.info("Using system property config override");
                configurationFile = System.getProperty(UDDI_CONFIG_FILENAME_PROPERTY);
        }
        XMLConfiguration xmlConfig = null;
        if (configurationFile != null) {
                xmlConfig = new XMLConfiguration(configurationFile);
        } else {
                final String filename = System.getProperty(UDDI_CONFIG_FILENAME_PROPERTY);
                if (filename != null) {
                        xmlConfig = new XMLConfiguration(filename);
                } else {
                        xmlConfig = new XMLConfiguration(DEFAULT_UDDI_CONFIG);
                }
        }
        log.info("Reading UDDI Client properties file " + xmlConfig.getBasePath() + " use -D" + UDDI_CONFIG_FILENAME_PROPERTY + " to override");
        this.configurationFile = xmlConfig.getBasePath();
        long refreshDelay = xmlConfig.getLong(Property.UDDI_RELOAD_DELAY, 1000l);
        log.debug("Setting refreshDelay to " + refreshDelay);
        FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
        fileChangedReloadingStrategy.setRefreshDelay(refreshDelay);
        xmlConfig.setReloadingStrategy(fileChangedReloadingStrategy);
        compositeConfig.addConfiguration(xmlConfig);
        //Making the new configuration globally accessible.
        config = compositeConfig;
        readConfig(properties);

        validateConfig();
}
项目:chassis    文件:CuratorFrameworkBuilder.java   
private ConcurrentCompositeConfiguration buildConfiguration() {
    ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration();
    configuration.addConfiguration(new ConcurrentMapConfiguration(new SystemConfiguration()));
    configuration.addConfiguration(this.configuration);
    configuration.addConfiguration(defaults);
    return configuration;
}
项目:chassis    文件:ConfigurationBuilder.java   
/**
 * Build the Configuration
 *
 * @return the configuration
 */
public AbstractConfiguration build() {
    initApplicationFileConfiguration();
    initAppVersion();
    initApplicationConfiguration();
    initModuleConfiguration();

    ConcurrentCompositeConfiguration finalConfiguration = new ConcurrentCompositeConfiguration();
    if (addSystemConfigs) {
        finalConfiguration.addConfiguration(new ConcurrentMapConfiguration(new SystemConfiguration()));
    }

    finalConfiguration.addProperty(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName(), appVersion);

    addServerInstanceProperties(finalConfiguration);

    if (applicationConfiguration == null) {
        LOGGER.warn("\n\n    ****** Default configuration being used ******\n    client application \"" + appName + "\" is being configured with modules defaults. Defaults should only be used in development environments.\n    In non-developement environments, a configuration provider should be used to configure the client application and it should define ALL required configuration properties.\n");
        finalConfiguration.addConfiguration(applicationFileConfiguration);
        finalConfiguration.addConfiguration(moduleDefaultConfiguration);
    } else {
        finalConfiguration.addConfiguration(applicationConfiguration);
        finalConfiguration.addConfiguration(applicationFileConfiguration);
    }

    finalConfiguration.setProperty(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName(), appVersion);

    configureArchaius(finalConfiguration);

    logConfiguration(finalConfiguration);

    return finalConfiguration;
}
项目:stickypunch    文件:Main.java   
private static Configuration buildConfiguration(String[] args) throws ConfigurationException {
    CompositeConfiguration compositeConfiguration = new CompositeConfiguration();
    File propFile = new File(args[0]);
    if (propFile.exists()) {
        compositeConfiguration.addConfiguration(new PropertiesConfiguration(propFile));
    }
    compositeConfiguration.addConfiguration(new SystemConfiguration());

    return compositeConfiguration;
}
项目:spring-cloud-netflix    文件:ArchaiusEndpoint.java   
private void append(Map<String, Object> map, Configuration config) {
    if (config instanceof ConfigurableEnvironmentConfiguration) {
        return;
    }
    if (config instanceof SystemConfiguration) {
        return;
    }
    if (config instanceof EnvironmentConfiguration) {
        return;
    }
    for (Iterator<String> iter = config.getKeys(); iter.hasNext();) {
        String key = iter.next();
        map.put(key, config.getProperty(key));
    }
}
项目:jersey2-toolkit    文件:Jersey2ToolkitConfig.java   
/**
 * Create an instance of the configuration provider.
 */
public Jersey2ToolkitConfig() {
    logger.debug("Add version configuration");
    addConfiguration(buildVersionConfig());
    logger.debug("Adding system configuration");
    addConfiguration(new SystemConfiguration());
    logger.debug("Adding jersey2-toolkit configuration");
    addConfiguration(buildToolkitConfig());
}
项目:nutz_frame    文件:ControllerConfig.java   
public static void load() {
    if (config != null) {
        config.clear();
    }
    CompositeConfiguration conf = new CompositeConfiguration();
    conf.addConfiguration(new SystemConfiguration(), true);
    conf.addConfiguration(loadConfig(getRootFile()), true);

    loadIncludeFiles(conf);
    loadOuterFiles(conf);
    loadSunrise22Data(conf);
    config = conf;
}
项目:ocms    文件:CommentConfigFactory.java   
public static CommentConfigFactory getInstance() {
    synchronized (lock) {
        if (_instance == null) {
            SystemConfiguration config = new SystemConfiguration();
            _instance = new CommentConfigFactory(config);
        }
    }
    return _instance;

}
项目:ocms    文件:ConfigFactory.java   
public static ConfigFactory getInstance() {
    synchronized (lock) {
        if (_instance == null) {
            SystemConfiguration config = new SystemConfiguration();
            _instance = new ConfigFactory(config);
        }
    }
    return _instance;

}
项目:data-driven-framework    文件:DDConfig.java   
/**
 * Returns the configuration data. If configuration data is null, method first attempts to
 * create a configuration data from JVM's system properties.<br>
 * 
 * @return test configuration data
 */
public synchronized Configuration getData() {
    if (data != null) {
        return data;
    }
    final HierarchicalConfiguration cfg = new HierarchicalConfiguration();
    cfg.copy(new EnvironmentConfiguration());// copy the environment variables.
    cfg.copy(new SystemConfiguration());// JVM args
    log.debug("Configuration data from Env:\n" + ConfigurationUtils.toString(cfg));
    return data = prepareData(cfg);
}
项目:googleads-java-lib    文件:ConfigurationHelperTest.java   
@Test
public void testCreateCombinedConfiguration_justSystem() throws Exception {
  SystemConfiguration systemConfig = new SystemConfiguration();
  systemConfig.setTrimmingDisabled(true);
  assertContains(systemConfig,
      configurationHelper.createCombinedConfiguration(null, null));
}
项目:bigstreams    文件:TestSendClientFiles.java   
@Before
public void setUp() throws Exception {

    bootstrap = new Bootstrap();
    bootstrap.loadProfiles(CommandLineProcessorFactory.PROFILE.DB,
            CommandLineProcessorFactory.PROFILE.AGENT);

    conf = new SystemConfiguration();

    // Create LZO Codec
    org.apache.hadoop.conf.Configuration hadoopConf = new org.apache.hadoop.conf.Configuration();
    GzipCodec gzipCodec = new GzipCodec();
    gzipCodec.setConf(hadoopConf);

    codec = gzipCodec;

    // Write out test file
    baseDir = new File(".", "target/testSendClientFiles/");
    baseDir.mkdirs();

    fileToStream = new File(baseDir, "test.txt");

    if (fileToStream.exists())
        fileToStream.delete();

    fileToStream.createNewFile();

    FileWriter writer = new FileWriter(fileToStream);
    BufferedWriter buffWriter = new BufferedWriter(writer);
    try {
        for (int i = 0; i < testLineCount; i++) {

            buffWriter.write(testString);
            buffWriter.write('\n');
        }
    } finally {
        buffWriter.close();
        writer.close();
    }

}
项目:bigstreams    文件:TestAgentConfiguration.java   
/**
 * If not clientThreadCount property is specified the client send threads
 * must be equal to that of the LogDirConf directories.
 * 
 * @throws Exception
 */
@Test
public void testDefaultClientThreadsSelection() throws Exception {

    LogDirConf logDirConf = new LogDirConf(testConfFile.getAbsolutePath());

    SystemConfiguration conf = new SystemConfiguration();

    AgentConfiguration agentConf = new AgentConfiguration(conf, logDirConf);

    assertEquals(logDirConf.getDirectories().size(),
            agentConf.getClientThreadCount());

    assertEquals(logDirConf.getDirectories().size(),
            agentConf.getCompressorPoolSize());

}
项目:distributedlog    文件:DistributedLogConfiguration.java   
/**
 * Construct distributedlog configuration with default settings.
 * It also loads the settings from system properties.
 */
public DistributedLogConfiguration() {
    super();
    // add configuration for system properties
    addConfiguration(new SystemConfiguration());
}
项目:distributedlog    文件:ServerConfiguration.java   
public ServerConfiguration() {
    super();
    addConfiguration(new SystemConfiguration());
}
项目:juddi    文件:AppConfig.java   
/**
 * Does the actual work of reading the configuration from System
 * Properties and/or juddiv3.xml file. When the juddiv3.xml
 * file is updated the file will be reloaded. By default the reloadDelay is
 * set to 1 second to prevent excessive date stamp checking.
 */
private void loadConfiguration() throws ConfigurationException
{
    //Properties from system properties
    CompositeConfiguration compositeConfig = new CompositeConfiguration();
    compositeConfig.addConfiguration(new SystemConfiguration());
    //Properties from file
               //changed 7-19-2013 AO for JUDDI-627
    propConfig = null;
        final String filename = System.getProperty(JUDDI_CONFIGURATION_FILE_SYSTEM_PROPERTY);
    if (filename != null) {
                 propConfig = new XMLConfiguration (filename); 
                   try {
                       loadedFrom = new File(filename).toURI().toURL();
                   //   propConfig = new PropertiesConfiguration(filename);
                   } catch (MalformedURLException ex) {
                     try {
                         loadedFrom = new URL("file://" + filename);
                     } catch (MalformedURLException ex1) {
                         log.warn("unable to get an absolute path to " + filename + ". This may be ignorable if everything works properly.", ex1);
                     }
                   }
    } else {
        //propConfig = new PropertiesConfiguration(JUDDI_PROPERTIES);
                   propConfig = new XMLConfiguration(JUDDI_PROPERTIES);
                   loadedFrom = ClassUtil.getResource(JUDDI_PROPERTIES, this.getClass()); 
    }
               //Hey! this may break things
               propConfig.setAutoSave(true);

    log.info("Reading from jUDDI config file from:  " + loadedFrom);
    long refreshDelay = propConfig.getLong(Property.JUDDI_CONFIGURATION_RELOAD_DELAY, 1000l);
    log.debug("Setting refreshDelay to " + refreshDelay);
    FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
    fileChangedReloadingStrategy.setRefreshDelay(refreshDelay);
    propConfig.setReloadingStrategy(fileChangedReloadingStrategy);
    compositeConfig.addConfiguration(propConfig);


    Properties properties = new Properties();
    if ("Hibernate".equals(propConfig.getString(Property.PERSISTENCE_PROVIDER))) {
        if (propConfig.containsKey(Property.DATASOURCE)) 
            properties.put("hibernate.connection.datasource",propConfig.getString(Property.DATASOURCE));
        if (propConfig.containsKey(Property.HBM_DDL_AUTO))
            properties.put("hibernate.hbm2ddl.auto",propConfig.getString(Property.HBM_DDL_AUTO));
        if (propConfig.containsKey(Property.DEFAULT_SCHEMA))
            properties.put("hibernate.default_schema",propConfig.getString(Property.DEFAULT_SCHEMA));
        if (propConfig.containsKey(Property.HIBERNATE_DIALECT))
            properties.put("hibernate.dialect",propConfig.getString(Property.HIBERNATE_DIALECT));
    }
    // initialize the entityManagerFactory.
    PersistenceManager.initializeEntityManagerFactory(propConfig.getString(Property.JUDDI_PERSISTENCEUNIT_NAME), properties);
    // Properties from the persistence layer 
    MapConfiguration persistentConfig = new MapConfiguration(getPersistentConfiguration(compositeConfig));

    compositeConfig.addConfiguration(persistentConfig);
    //Making the new configuration globally accessible.
    config = compositeConfig;
}
项目:spring-cloud-netflix    文件:ArchaiusAutoConfiguration.java   
protected static void configureArchaius(ConfigurableEnvironmentConfiguration envConfig, ConfigurableEnvironment env, List<AbstractConfiguration> externalConfigurations) {
    if (initialized.compareAndSet(false, true)) {
        String appName = env.getProperty("spring.application.name");
        if (appName == null) {
            appName = "application";
            log.warn("No spring.application.name found, defaulting to 'application'");
        }
        System.setProperty(DeploymentContext.ContextKey.appId.getKey(), appName);

        ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();

        // support to add other Configurations (Jdbc, DynamoDb, Zookeeper, jclouds,
        // etc...)
        if (externalConfigurations != null) {
            for (AbstractConfiguration externalConfig : externalConfigurations) {
                config.addConfiguration(externalConfig);
            }
        }
        config.addConfiguration(envConfig,
                ConfigurableEnvironmentConfiguration.class.getSimpleName());

        defaultURLConfig = new DynamicURLConfiguration();
        try {
            config.addConfiguration(defaultURLConfig, URL_CONFIG_NAME);
        }
        catch (Throwable ex) {
            log.error("Cannot create config from " + defaultURLConfig, ex);
        }

        // TODO: sys/env above urls?
        if (!Boolean.getBoolean(DISABLE_DEFAULT_SYS_CONFIG)) {
            SystemConfiguration sysConfig = new SystemConfiguration();
            config.addConfiguration(sysConfig, SYS_CONFIG_NAME);
        }
        if (!Boolean.getBoolean(DISABLE_DEFAULT_ENV_CONFIG)) {
            EnvironmentConfiguration environmentConfiguration = new EnvironmentConfiguration();
            config.addConfiguration(environmentConfiguration, ENV_CONFIG_NAME);
        }

        ConcurrentCompositeConfiguration appOverrideConfig = new ConcurrentCompositeConfiguration();
        config.addConfiguration(appOverrideConfig, APPLICATION_PROPERTIES);
        config.setContainerConfigurationIndex(
                config.getIndexOfConfiguration(appOverrideConfig));

        addArchaiusConfiguration(config);
    }
    else {
        // TODO: reinstall ConfigurationManager
        log.warn(
                "Netflix ConfigurationManager has already been installed, unable to re-install");
    }
}
项目:manydesigns.cn    文件:ConfigurationsAction.java   
public String systemConfiguration() {
    form = configureForm(new SystemConfiguration());

    return "systemConfiguration";
}
项目:Runway-SDK    文件:InMemoryConfigurator.java   
public InMemoryConfigurator() {
  config = new CompositeConfiguration();
  config.addConfiguration(new BaseConfiguration());
  config.addConfiguration(new SystemConfiguration());
  interpolate();
}
项目:iotracah    文件:DefaultRunner.java   
/**
 * Initializes this instance.
 * <p>
 * This method should be called once the JVM process is created and the
 * <code>Runner</code> instance is created thru its empty public
 * constructor.
 * </p>
 * <p>
 * Apart from set up and allocation of native resources, this method
 * does not start actual operation of <code>Runner</code> (such
 * as starting threads.) as it would impose serious security hazards. The
 * start of operation must be performed in the <code>start()</code>
 * method.
 * </p>
 *
 * @throws UnRetriableException Any exception preventing a successful
 *                              initialization.
 */
@Override
public void init() throws UnRetriableException {

    log.trace(" init : initializing system configurations");

    //First load the system settings as the defaults.
    CompositeConfiguration configuration = new CompositeConfiguration();
    configuration.addConfiguration(new SystemConfiguration());

    setConfiguration(configuration);

    log.info(" init : {} set to : {}", "iotracah.pidfile", System.getProperty("iotracah.pidfile"));
    log.info(" init : {} set to : {}", "iotracah.default.path.home", System.getProperty("iotracah.default.path.home"));
    log.info(" init : {} set to : {}", "iotracah.default.path.logs", System.getProperty("iotracah.default.path.logs"));
    log.info(" init : {} set to : {}", "iotracah.default.path.data", System.getProperty("iotracah.default.path.data"));
    log.info(" init : {} set to : {}", "iotracah.default.path.conf", System.getProperty("iotracah.default.path.conf"));

    for(ConfigHandler configHandler: getConfigurationSetLoader()){

        log.debug(" init : found the configuration handler {} ", configHandler);

            Configuration newConfigs = configHandler.populateConfiguration(getConfiguration());
            setConfiguration(newConfigs);
    }


    for(LogHandler logHandler: getLogSetLoader()){

        log.debug(" init : Configuring logging using handler {} ", logHandler);

        logHandler.configure(getConfiguration());

    }

}