Java Code Examples for org.apache.commons.configuration.PropertiesConfiguration#getProperty()
The following examples show how to use
org.apache.commons.configuration.PropertiesConfiguration#getProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertyFileManipulator.java From ankush with GNU Lesser General Public License v3.0 | 6 votes |
/** * Delete conf value. * * @param file * the file * @param propertyName * the property name * @return true, if successful */ @Override public boolean deleteConfValue(String file, String propertyName) { boolean status = false; try { // read conf file File confFile = new File(file); if (!confFile.exists()) { System.err.println("File " + file + " does not exists."); status = false; } PropertiesConfiguration props = new PropertiesConfiguration(file); props.getLayout().setSeparator(propertyName, "="); if (props.getProperty(propertyName) != null) { props.clearProperty(propertyName); props.save(); status = true; } } catch (Exception e) { System.err.println(e.getMessage()); } return status; }
Example 2
Source File: TableTestClient.java From web3sdk with Apache License 2.0 | 5 votes |
@SuppressWarnings({"rawtypes", "unchecked"}) public static void testTableTest(String[] args) throws Exception { final Resource contractResource = new ClassPathResource("contract.properties"); PropertiesConfiguration prop = new PropertiesConfiguration(contractResource.getFile()); Object addressObj = prop.getProperty("crud_address"); if (addressObj != null) { contractAddress = (String) addressObj; } else { deployTableTest(); } ContractGasProvider contractGasProvider = new StaticGasProvider(gasPrice, gasLimit); TableTest tabletest = TableTest.load(contractAddress, web3j, credentials, contractGasProvider); // create table if ("create".equals(args[0])) { create(tabletest); } // insert else if ("insert".equals(args[0])) { insert(args, tabletest); } // select else if ("select".equals(args[0])) { select(args, tabletest); } // update else if ("update".equals(args[0])) { update(args, tabletest); } // remove else if ("remove".equals(args[0])) { remove(args, tabletest); } else { System.out.println( "\nPlease choose follow commands:\n deploy, create, insert, select, update or remove"); } }
Example 3
Source File: GMTableTestClient.java From web3sdk with Apache License 2.0 | 5 votes |
@SuppressWarnings({"rawtypes", "unchecked"}) public static void testTableTest(String[] args) throws Exception { final Resource contractResource = new ClassPathResource("contract.properties"); PropertiesConfiguration prop = new PropertiesConfiguration(contractResource.getFile()); Object addressObj = prop.getProperty("crud_address"); if (addressObj != null) { contractAddress = (String) addressObj; } else { deployTableTest(); } ContractGasProvider contractGasProvider = new StaticGasProvider(gasPrice, gasLimit); TableTest tabletest = TableTest.load(contractAddress, web3j, credentials, contractGasProvider); // create table if ("create".equals(args[0])) { create(tabletest); } // insert else if ("insert".equals(args[0])) { insert(args, tabletest); } // select else if ("select".equals(args[0])) { select(args, tabletest); } // update else if ("update".equals(args[0])) { update(args, tabletest); } // remove else if ("remove".equals(args[0])) { remove(args, tabletest); } else { System.out.println( "\nPlease choose follow commands:\n deploy, create, insert, select, update or remove"); } }