List of usage examples for org.apache.commons.configuration CompositeConfiguration CompositeConfiguration
public CompositeConfiguration()
From source file:org.apache.whirr.service.mahout.integration.MahoutServiceTest.java
@BeforeClass public static void setUp() throws Exception { CompositeConfiguration config = new CompositeConfiguration(); if (System.getProperty("config") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("config"))); }/*from w ww. j a va2 s . com*/ config.addConfiguration(new PropertiesConfiguration("whirr-mahout-test.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); controller.launchCluster(clusterSpec); }
From source file:org.apache.whirr.service.mongodb.integration.MongoDBServiceController.java
public synchronized void startup() throws Exception { LOG.info("Starting up cluster..."); CompositeConfiguration config = new CompositeConfiguration(); if (System.getProperty("config") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("config"))); }//from ww w .j a v a2 s . c o m config.addConfiguration(new PropertiesConfiguration(this.configResource)); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); cluster = controller.launchCluster(clusterSpec); waitForMongod(); running = true; }
From source file:org.apache.whirr.service.pig.integration.PigServiceTest.java
@BeforeClass public static void setUp() throws Exception { CompositeConfiguration config = new CompositeConfiguration(); if (System.getProperty("config") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("config"))); }// w ww. j a v a 2 s .c om config.addConfiguration(new PropertiesConfiguration("whirr-pig-test.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); controller.launchCluster(clusterSpec); }
From source file:org.apache.whirr.service.puppet.integration.PuppetServiceTest.java
@Before public void setUp() throws Exception { CompositeConfiguration config = new CompositeConfiguration(); if (System.getProperty("config") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("config"))); }/*from w w w . j av a2 s.co m*/ config.addConfiguration(new PropertiesConfiguration("whirr-puppet-test.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); cluster = controller.launchCluster(clusterSpec); socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 60, 1, TimeUnit.SECONDS); }
From source file:org.apache.whirr.service.solr.integration.SolrServiceTest.java
@BeforeClass public static void beforeClass() throws ConfigurationException, JSchException, IOException, InterruptedException { String solrConfigTarballDestination = "target/solrconfig.tar.gz"; Tarball.createFromDirectory("src/test/resources/conf", solrConfigTarballDestination); LOG.info("Created Solr config tarball at " + solrConfigTarballDestination); CompositeConfiguration config = new CompositeConfiguration(); if (System.getProperty("conf") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("conf"))); }/*from ww w . j av a 2s . c o m*/ config.addConfiguration(new PropertiesConfiguration("whirr-solr-test.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); cluster = controller.launchCluster(clusterSpec); }
From source file:org.apache.whirr.service.vblob.integration.VBlobServiceTest.java
@Before public void setUp() throws Exception { CompositeConfiguration config = new CompositeConfiguration(); if (System.getProperty("config") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("config"))); }/* w w w . j a va2 s. co m*/ config.addConfiguration(new PropertiesConfiguration("whirr-vblob-test.properties")); config.addConfiguration(new PropertiesConfiguration("whirr-vblob-default.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); vBlobConfig = new CommonsConfigurationToVBlobConfig("vblob", clusterSpec.getClusterUser()).apply(config); controller = new ClusterController(); cluster = controller.launchCluster(clusterSpec); }
From source file:org.apache.whirr.service.voldemort.integration.VoldemortServiceTest.java
@Before public void setUp() throws Exception { CompositeConfiguration config = new CompositeConfiguration(); if (System.getProperty("config") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("config"))); }/* w ww.jav a 2 s . c o m*/ config.addConfiguration(new PropertiesConfiguration("whirr-voldemort-test.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); cluster = controller.launchCluster(clusterSpec); waitForBootstrap(); }
From source file:org.apache.whirr.service.yarn.integration.HadoopServiceController.java
public synchronized void startup() throws Exception { LOG.info("Starting up cluster..."); CompositeConfiguration config = new CompositeConfiguration(); if (System.getProperty("config") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("config"))); }/*from w ww . jav a 2s . c om*/ config.addConfiguration(configuration); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); cluster = controller.launchCluster(clusterSpec); proxy = new HadoopProxy(clusterSpec, cluster); proxy.start(); Configuration conf = getConfiguration(); JobConf job = new JobConf(conf, HadoopServiceController.class); JobClient client = new JobClient(job); waitToExitSafeMode(client); waitForTaskTrackers(client); running = true; }
From source file:org.apache.whirr.service.zookeeper.integration.ZooKeeperServiceTest.java
@Before public void setUp() throws Exception { CompositeConfiguration config = new CompositeConfiguration(); if (System.getProperty("config") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("config"))); }//ww w . ja v a 2 s . c o m config.addConfiguration(new PropertiesConfiguration("whirr-zookeeper-test.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterControllerFactory().create(clusterSpec.getServiceName()); cluster = controller.launchCluster(clusterSpec); hosts = ZooKeeperCluster.getHosts(cluster); }
From source file:org.apereo.lap.services.ConfigurationService.java
@PostConstruct public void init() throws IOException { logger.info("INIT started"); logger.info("App Home: " + appHome().getAbsolutePath()); CompositeConfiguration config = new CompositeConfiguration(); // load internal config defaults first config.setProperty("app.name", "LAP"); File dbDefaults = resourceLoader.getResource("classpath:db.properties").getFile(); try {/*from w ww . java 2 s.c om*/ config.addConfiguration(new PropertiesConfiguration(dbDefaults)); } catch (ConfigurationException e) { logger.error("Unable to load default db.properties file"); } File appDefaults = resourceLoader.getResource("classpath:app.properties").getFile(); try { config.addConfiguration(new PropertiesConfiguration(appDefaults)); logger.info("Default app configuration loaded from: " + appDefaults.getAbsolutePath()); } catch (ConfigurationException e) { logger.error("Unable to load default app.properties file"); } // now try to load external config settings config.addConfiguration(new SystemConfiguration()); File lapConfigProps = new File(appHome(), "lap.properties"); if (lapConfigProps.exists() && lapConfigProps.canRead()) { try { config.addConfiguration(new PropertiesConfiguration(lapConfigProps)); } catch (ConfigurationException e) { logger.warn("Unable to load lap.properties file"); } } else { IOUtils.copy( SampleCSVInputHandlerService.class.getClassLoader() .getResourceAsStream("config" + SLASH + "lap.properties"), new FileOutputStream(new File(appHome(), "lap.properties"))); logger.info("No external LAP config found: " + lapConfigProps.getAbsolutePath() + ", copied default sample lap.properties"); } this.config = config; // verify the existence of the various dirs pipelinesDirectory = verifyDir("dir.pipelines", "piplines"); inputDirectory = verifyDir("dir.inputs", "inputs"); outputDirectory = verifyDir("dir.outputs", "outputs"); pipelineConfigs = new ConcurrentHashMap<>(); // first load the internal ones (must be listed explicitly for now) Resource pipelineSample = resourceLoader.getResource("classpath:pipelines" + SLASH + "sample.xml"); PipelineConfig plcfg = processPipelineConfigFile(pipelineSample.getFile()); if (plcfg != null) { pipelineConfigs.put(plcfg.getType(), plcfg); } // then try to load the external ones File[] pipelineFiles = pipelinesDirectory.listFiles(); if (pipelineFiles != null && pipelineFiles.length > 0) { for (final File fileEntry : pipelineFiles) { if (fileEntry.isFile()) { PipelineConfig filePLC = processPipelineConfigFile(pipelineSample.getFile()); if (filePLC != null) { pipelineConfigs.put(filePLC.getType(), filePLC); } } } } logger.info("INIT complete: " + config.getString("app.name") + ", home=" + applicationHomeDirectory.getAbsolutePath()); }