List of usage examples for org.apache.commons.configuration CompositeConfiguration addConfiguration
public void addConfiguration(Configuration config)
From source file:org.apache.whirr.service.cinderella.integration.CinderellaServiceTest.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 . ja v a 2s. co m config.addConfiguration(new PropertiesConfiguration("whirr-cinderella-test.properties")); config.addConfiguration(new PropertiesConfiguration("whirr-cinderella-default.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); cinderellaConfig = new CommonsConfigurationToCinderellaConfig("cinderella", clusterSpec.getClusterUser()) .apply(config); controller = new ClusterController(); controller.destroyCluster(clusterSpec); cluster = controller.launchCluster(clusterSpec); }
From source file:org.apache.whirr.service.ClusterActionHandlerSupport.java
/** * Returns a composite configuration that is made up from the global * configuration coming from the Whirr core with the service default * properties.// ww w .j a v a2s . c o m * * @param clusterSpec The cluster specification instance. * @return The composite configuration. */ protected Configuration getConfiguration(ClusterSpec clusterSpec, Configuration defaults) { CompositeConfiguration cc = new CompositeConfiguration(); cc.addConfiguration(clusterSpec.getConfiguration()); cc.addConfiguration(defaults); return cc; }
From source file:org.apache.whirr.service.elasticsearch.ElasticSearchConfigurationBuilder.java
/** * Build a configuration by adding the expected defaults *///w w w. j a v a 2s . co m public static Configuration buildConfig(ClusterSpec spec, Cluster cluster) { CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(spec.getConfiguration()); try { config.addConfiguration(new PropertiesConfiguration("whirr-elasticsearch-default.properties")); } catch (ConfigurationException e) { LOG.error("Configuration error", e); // this should never happen } if ("aws-ec2".equals(spec.getProvider()) || "ec2".equals(spec.getProvider())) { addDefaultsForEC2(spec, config); } else { addDefaultsForUnicast(cluster, config); } if (!config.containsKey("es.cluster.name")) { config.addProperty("es.cluster.name", spec.getClusterName()); } return config; }
From source file:org.apache.whirr.service.elasticsearch.integration.ElasticSearchTest.java
@Before public void setUp() throws Exception { CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(new PropertiesConfiguration("whirr-elasticsearch-test.properties")); if (System.getProperty("config") != null) { config.addConfiguration(new PropertiesConfiguration(System.getProperty("config"))); }//from w w w . j a v a 2s . c om clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); cluster = controller.launchCluster(clusterSpec); }
From source file:org.apache.whirr.service.ganglia.integration.GangliaServiceTest.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 . ja v a2s .c o m config.addConfiguration(new PropertiesConfiguration("whirr-ganglia-test.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterControllerFactory().create(clusterSpec.getServiceName()); cluster = controller.launchCluster(clusterSpec); }
From source file:org.apache.whirr.service.hadoop.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"))); }/*w w w . j av a 2s.c o m*/ 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, HadoopServiceTest.class); JobClient client = new JobClient(job); waitToExitSafeMode(client); waitForTaskTrackers(client); running = true; }
From source file:org.apache.whirr.service.hama.integration.HamaServiceController.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"))); }/* w w w .j av a2 s . c o m*/ config.addConfiguration(new PropertiesConfiguration("whirr-hama-test.properties")); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); cluster = controller.launchCluster(clusterSpec); proxy = new HadoopProxy(clusterSpec, cluster); proxy.start(); HamaConfiguration conf = getConfiguration(); BSPJobClient client = new BSPJobClient(conf); waitForGroomServers(client); running = true; }
From source file:org.apache.whirr.service.hbase.integration.HBaseServiceController.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"))); }/* w w w.j a va 2s .c o m*/ config.addConfiguration(new PropertiesConfiguration(this.configResource)); clusterSpec = ClusterSpec.withTemporaryKeys(config); controller = new ClusterController(); cluster = controller.launchCluster(clusterSpec); proxy = new HadoopProxy(clusterSpec, cluster); proxy.start(); waitForMaster(); running = true; }
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"))); }// w ww.j ava2 s .c o m 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"))); }// w ww.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; }