private void copyProperty(XMLConfiguration fromConfig, XMLConfiguration toConfig, String key) { toConfig.setProperty(key, fromConfig.getProperty(key)); }
private static Map<String, List<String>> parseEquivalentTermsMap(final XMLConfiguration xmlConfig) { final Map<String, List<String>> equivalentTermsMap = new LinkedHashMap<>(); final Object prop = xmlConfig.getProperty("termMappings.termMapping.term"); if (prop != null) { if (prop instanceof Collection) { final int size = ((Collection<?>) prop).size(); for (int i = 0; i < size; i++) { final String termElement = "termMappings.termMapping(" + i + ")"; parseTermMapping(termElement, xmlConfig, equivalentTermsMap); } } else { final String termElement = "termMappings.termMapping"; parseTermMapping(termElement, xmlConfig, equivalentTermsMap); } } return equivalentTermsMap; }
private static Map<String, List<String>> parseEquivalentTermsMap(final XMLConfiguration xmlConfig) { final Map<String, List<String>> equivalentTermsMap = new LinkedHashMap<>(); final Object prop = xmlConfig.getProperty("termMappings.termMapping.term"); if (prop != null) { if (prop instanceof Collection) { final int size = ((Collection<?>) prop).size(); for (int i = 0; i < size; i++) { final String termElement = "termMappings.termMapping(" + i + ")"; parseTermMapping(termElement, xmlConfig, equivalentTermsMap); } } else { final String termElement = "termMappings.termMapping"; parseTermMapping(termElement, xmlConfig, equivalentTermsMap); } } return equivalentTermsMap; }
public void loadXmlFile(String filename) { XMLConfiguration config = null; try { config = new XMLConfiguration(filename); } catch (ConfigurationException e) { e.printStackTrace(); } Iterator<String> keyIter = config.getKeys(); String key; while (keyIter.hasNext()) { key = keyIter.next(); Object prop = config.getProperty(key); if(prop instanceof Collection) { List<String> values = (List<String>) prop; for(String value : values){ System.out.println(key + "=" + value); } } else { System.out.println(key + "=" + prop); } } }
public static LocatorConfig fromURL(final URL url) throws KapuaLocatorException { if (url == null) { throw new IllegalArgumentException("'url' must not be null"); } final List<String> packageNames = new ArrayList<>(); final List<String> providedInterfaceNames = new ArrayList<>(); final XMLConfiguration xmlConfig; try { xmlConfig = new XMLConfiguration(url); } catch (ConfigurationException e) { throw new KapuaLocatorException(KapuaLocatorErrorCodes.INVALID_CONFIGURATION, e); } Object props = xmlConfig.getProperty(SERVICE_RESOURCE_PACKAGES); if (props instanceof Collection<?>) { addAllStrings(packageNames, (Collection<?>) props); } if (props instanceof String) { packageNames.add((String) props); } props = xmlConfig.getProperty(SERVICE_RESOURCE_INTERFACES); if (props instanceof Collection<?>) { addAllStrings(providedInterfaceNames, (Collection<?>) props); } if (props instanceof String) { providedInterfaceNames.add((String) props); } return new LocatorConfig(url, Collections.unmodifiableList(packageNames), Collections.unmodifiableList(providedInterfaceNames)); }
@SuppressWarnings("unchecked") ArrayList<String> pluginPath = (ArrayList<String>) tweetyXmlConfig .getProperty(it.next()); @SuppressWarnings("unchecked") ArrayList<String> pluginName = (ArrayList<String>) tweetyXmlConfig .getProperty(it.next());
Object property = config.getProperty("AccessControlRules.AccessControlRule(" + currentRule + ").Parameters.Parameter[@name]"); if(property == null) { return null;
Object property = config.getProperty("AccessControlRules.AccessControlRule(" + currentRule + ").Parameters.Parameter[@name]"); if(property == null) { return null;
String key = (String) keys.next(); if (!userConfiguration.containsKey(key)) { userConfiguration.setProperty(key, commonConfiguration.getProperty(key));
String keybase = "xsl:attribute-set(" + String.valueOf( index ) + ")"; Object prop = config.getProperty( keybase + ".xsl:attribute" );
private void upgradeFrom1_4_1(XMLConfiguration config) { if (!config.getProperty("spider.postform").toString().equals("0")) { config.setProperty("spider.postform", "true"); config.setProperty("spider.processform", "true");
Object property = config.getProperty("AccessControlRules.AccessControlRule[@name]"); logger.info(Logger.EVENT_SUCCESS, "Loading Property: " + property); int numberOfRules = 0;
Object property = config.getProperty("AccessControlRules.AccessControlRule[@name]"); logger.info(Logger.EVENT_SUCCESS, "Loading Property: " + property); int numberOfRules = 0;