Java Code Examples for org.apache.commons.configuration.HierarchicalConfiguration#setProperty()
The following examples show how to use
org.apache.commons.configuration.HierarchicalConfiguration#setProperty() .
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: EnvironmentSettings.java From sailfish-core with Apache License 2.0 | 5 votes |
private void updateGeneralSettings(HierarchicalConfiguration config) { config.setProperty("FileStoragePath", fileStoragePath); config.setProperty("StoreAdminMessages", storeAdminMessages); config.setProperty(ASYNC_RUN_MATRIX_KEY, asyncRunMatrix); config.setProperty("StorageType", storageType.getName()); config.setProperty(COMPARISON_PRECISION, comparisonPrecision); config.setProperty(MAX_STORAGE_QUEUE_SIZE, maxQueueSize); }
Example 2
Source File: EnvironmentSettings.java From sailfish-core with Apache License 2.0 | 5 votes |
private void updateScriptRunSettings(HierarchicalConfiguration config) { config.setProperty(NOTIFICATION_IF_SOME_SERVICES_NOT_STARTED, notificationIfServicesNotStarted); config.setProperty(FAIL_UNEXPECTED_KEY, failUnexpected); config.setProperty(MATRIX_COMPILER_PRIORITY, matrixCompilerPriority); config.setProperty(EXCLUDED_MESSAGES_FROM_REPORT, excludedMessages.isEmpty() ? "" : excludedMessages); config.setProperty(REPORT_OUTPUT_FORMAT, reportOutputFormat); config.setProperty(RELEVANT_MESSAGES_SORTING_MODE, relevantMessagesSortingMode.getName()); config.setProperty(VERIFICATION_LIMIT, verificationLimit); }
Example 3
Source File: BeanConfigurator.java From sailfish-core with Apache License 2.0 | 5 votes |
public static void saveBean(HierarchicalConfiguration context, Object beanObject) { ConvertUtilsBean converter = new ConvertUtilsBean(); PropertyUtilsBean beanUtils = new PropertyUtilsBean(); PropertyDescriptor[] descriptors = beanUtils.getPropertyDescriptors(beanObject); try { for ( PropertyDescriptor descr : descriptors ) { //check that setter exists if ( descr.getWriteMethod() != null ) { Object value = BeanUtils.getProperty(beanObject, descr.getName()); context.setProperty(descr.getName(), converter.convert(value)); } } } catch ( Exception e ) { throw new EPSCommonException(e); } }
Example 4
Source File: XmlConfigParser.java From onos with Apache License 2.0 | 5 votes |
public static String createControllersConfig(HierarchicalConfiguration cfg, HierarchicalConfiguration actualCfg, String target, String netconfOperation, String controllerOperation, List<ControllerInfo> controllers) { //cfg.getKeys().forEachRemaining(key -> System.out.println(key)); cfg.setProperty("edit-config.target", target); cfg.setProperty("edit-config.default-operation", netconfOperation); cfg.setProperty("edit-config.config.capable-switch.id", parseCapableSwitchId(actualCfg)); cfg.setProperty("edit-config.config.capable-switch." + "logical-switches.switch.id", parseSwitchId(actualCfg)); List<ConfigurationNode> newControllers = new ArrayList<>(); for (ControllerInfo ci : controllers) { XMLConfiguration controller = new XMLConfiguration(); controller.setRoot(new HierarchicalConfiguration.Node("controller")); String id = ci.type() + ":" + ci.ip() + ":" + ci.port(); controller.setProperty("id", id); controller.setProperty("ip-address", ci.ip()); controller.setProperty("port", ci.port()); controller.setProperty("protocol", ci.type()); newControllers.add(controller.getRootNode()); } cfg.addNodes("edit-config.config.capable-switch.logical-switches." + "switch.controllers", newControllers); XMLConfiguration editcfg = (XMLConfiguration) cfg; StringWriter stringWriter = new StringWriter(); try { editcfg.save(stringWriter); } catch (ConfigurationException e) { log.error("createControllersConfig()", e); } String s = stringWriter.toString() .replaceAll("<controller>", "<controller nc:operation=\"" + controllerOperation + "\">"); s = s.replace("<target>" + target + "</target>", "<target><" + target + "/></target>"); return s; }