List of usage examples for org.apache.commons.configuration PropertiesConfiguration PropertiesConfiguration
public PropertiesConfiguration()
From source file:com.mirth.connect.manager.ManagerController.java
public void initialize() { serverProperties = initializeProperties(PlatformUI.MIRTH_PATH + ManagerConstants.PATH_SERVER_PROPERTIES, true);//from w w w.jav a2 s. c om log4jProperties = initializeProperties(PlatformUI.MIRTH_PATH + ManagerConstants.PATH_LOG4J_PROPERTIES, true); serverIdProperties = initializeProperties( PlatformUI.MIRTH_PATH + getServerProperties().getString(ManagerConstants.DIR_APPDATA) + System.getProperty("file.separator") + ManagerConstants.PATH_SERVER_ID_FILE, false); InputStream is = getClass().getResourceAsStream(ManagerConstants.PATH_VERSION_FILE); if (is != null) { try { versionProperties = new PropertiesConfiguration(); versionProperties.load(is); } catch (ConfigurationException e) { alertErrorDialog("Could not load resource: " + ManagerConstants.PATH_VERSION_FILE); } } else { versionProperties = initializeProperties(PlatformUI.MIRTH_PATH + ManagerConstants.PATH_VERSION_FILE, true); } }
From source file:com.linkedin.pinot.core.query.scheduler.MultiLevelPriorityQueueTest.java
@Test public void testPutOutOfCapacity() throws OutOfCapacityError { PropertiesConfiguration conf = new PropertiesConfiguration(); conf.setProperty(MultiLevelPriorityQueue.MAX_PENDING_PER_GROUP_KEY, 2); ResourceManager rm = new UnboundedResourceManager(conf); MultiLevelPriorityQueue queue = createQueue(conf, rm); queue.put(createQueryRequest(groupOne, metrics)); groupFactory.groupMap.get(groupOne).addReservedThreads(rm.getTableThreadsHardLimit()); // we should still be able to add one more waiting query queue.put(createQueryRequest(groupOne, metrics)); // this assert is to test that above call to put() is not the one // throwing exception assertTrue(true);/*w ww. j a va 2 s . co m*/ // it should throw now try { queue.put(createQueryRequest(groupOne, metrics)); } catch (OutOfCapacityError e) { assertTrue(true); return; } assertTrue(false); }
From source file:com.linkedin.pinot.server.api.resources.TableSizeResourceTest.java
@BeforeClass public void setupTest() throws Exception { INDEX_DIR = Files.createTempDirectory(TableSizeResourceTest.class.getName() + "_segmentDir").toFile(); File confFile = new File(TestUtils.getFileFromResourceUrl( InstanceServerStarter.class.getClassLoader().getResource("conf/pinot.properties"))); PropertiesConfiguration config = new PropertiesConfiguration(); config.setDelimiterParsingDisabled(false); config.load(confFile);/* w ww .j a v a 2 s . c o m*/ ServerConf serverConf = new ServerConf(config); LOGGER.info("Trying to create a new ServerInstance!"); serverInstance = new ServerInstance(); LOGGER.info("Trying to initial ServerInstance!"); serverInstance.init(serverConf, new MetricsRegistry()); LOGGER.info("Trying to start ServerInstance!"); serverInstance.start(); apiService = new AdminApiApplication(serverInstance); apiService.start(Integer.parseInt(CommonConstants.Server.DEFAULT_ADMIN_API_PORT)); client = ClientBuilder.newClient(); target = client.target(apiService.getBaseUri().toString()); setupSegment(); }
From source file:com.pinterest.secor.io.FileReaderWriterFactoryTest.java
private void setupSequenceFileReaderConfig() { PropertiesConfiguration properties = new PropertiesConfiguration(); properties.addProperty("secor.file.reader.writer.factory", "com.pinterest.secor.io.impl.SequenceFileReaderWriterFactory"); mConfig = new SecorConfig(properties); }
From source file:it.geosolutions.opensdi2.configurations.model.converters.PropertiesConfigurationConverter.java
/** * This implementation expects an input object instance of OSDIConfigurationKVP otherwise an IllegalArgumentException is thrown. * The concrete return type is always an instance of org.apache.commons.configuration.Configuration *//*from w ww . j a v a 2 s .c om*/ @Override public Object buildConfig(OSDIConfiguration configToBeConverted) { if (!(configToBeConverted instanceof OSDIConfigurationKVP)) { throw new IllegalArgumentException( "You are using the class OSDIPropertiesConverter as implementation of the OSDIConfigConverter interface, you need to pass to this method an instance of OSDIConfigurationKVP"); } OSDIConfigurationKVP inConfig = (OSDIConfigurationKVP) configToBeConverted; Configuration outConfig = new PropertiesConfiguration(); Iterator<String> iter = inConfig.getAllKeys().iterator(); String tmpKey = ""; while (iter.hasNext()) { tmpKey = iter.next(); outConfig.addProperty(tmpKey, inConfig.getValue(tmpKey)); } return outConfig; }
From source file:gobblin.util.JobConfigurationUtils.java
/** * 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 *//*from w w w . ja v a 2 s . c o m*/ 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); }
From source file:com.pinterest.secor.io.FileReaderWriterTest.java
private void setupSequenceFileReaderConfig() { PropertiesConfiguration properties = new PropertiesConfiguration(); properties.addProperty("secor.file.reader.writer", "com.pinterest.secor.io.impl.SequenceFileReaderWriter"); mConfig = new SecorConfig(properties); }
From source file:com.francetelecom.clara.cloud.logicalmodel.LogicalConfigServiceUtils.java
public void dumpConfigContent(StructuredLogicalConfigServiceContent content, Writer writer) throws InvalidConfigServiceException { try {//from ww w .ja va 2s. co m ValidatorUtil.validate(content); } catch (TechnicalException e) { throw new InvalidConfigServiceException("Invalid structured content:" + e, e); } PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); PropertiesConfigurationLayout layout = propertiesConfiguration.getLayout(); layout.setLineSeparator("\n"); String headerComment = content.getHeaderComment(); if (headerComment != null) { layout.setHeaderComment(headerComment); } for (ConfigEntry configEntry : content.configEntries) { String key = configEntry.getKey(); propertiesConfiguration.addProperty(key, configEntry.getValue()); String comment = configEntry.getComment(); layout.setSeparator(key, "="); if (comment != null) { layout.setComment(key, comment); } } try { propertiesConfiguration.save(writer); } catch (ConfigurationException e) { throw new InvalidConfigServiceException("Invalid structured content or output:" + e, e); } }
From source file:com.linkedin.pinot.core.startree.hll.HllIndexCreationTest.java
@BeforeMethod public void setUp() throws Exception { hllConfig = new HllConfig(hllLog2m, columnsToDeriveHllFields, hllDeriveColumnSuffix); Configuration tableConfig = new PropertiesConfiguration(); tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v1"); v1LoadingConfig = new IndexLoadingConfigMetadata(tableConfig); tableConfig.clear();//from w w w . jav a 2 s .c om tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v3"); v3LoadingConfig = new IndexLoadingConfigMetadata(tableConfig); }
From source file:com.linkedin.pinot.server.api.resources.ResourceTestHelper.java
/** * Sets up Pinot server instance, index directory for creation of segments, creates a default segment * and starts pinot admin api service/*from w w w . j a va 2 s. co m*/ * This should be called only once in the @BeforeClass method of a unit test. * Caller must ensure teardown() is called when the test completes (in @AfterClass) */ public void setup() throws Exception { INDEX_DIR = Files.createTempDirectory(TableSizeResourceTest.class.getName() + "_segmentDir").toFile(); File confFile = new File(TestUtils.getFileFromResourceUrl( InstanceServerStarter.class.getClassLoader().getResource("conf/pinot.properties"))); config = new PropertiesConfiguration(); config.setDelimiterParsingDisabled(false); config.load(confFile); serverConf = new ServerConf(config); LOGGER.info("Trying to create a new ServerInstance!"); serverInstance = new ServerInstance(); LOGGER.info("Trying to initial ServerInstance!"); serverInstance.init(serverConf, new MetricsRegistry()); LOGGER.info("Trying to start ServerInstance!"); serverInstance.start(); apiApplication = new AdminApiApplication(serverInstance); apiApplication.start(Integer.parseInt(CommonConstants.Server.DEFAULT_ADMIN_API_PORT)); client = ClientBuilder.newClient(); target = client.target(apiApplication.getBaseUri().toString()); setupSegment(); }