private XMLConfiguration createXMLConfiguration() { XMLConfiguration xmlConfig = new XMLConfiguration(); xmlConfig.setAttributeSplittingDisabled(true); xmlConfig.setDelimiterParsingDisabled(true); if (schemaValidation) { final InputStream resource = Resource.getAsInputStream("vrp_xml_schema.xsd"); if (resource != null) { EntityResolver resolver = new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { { InputSource is = new InputSource(resource); return is; } } }; xmlConfig.setEntityResolver(resolver); xmlConfig.setSchemaValidation(true); } else { logger.debug("cannot find schema-xsd file (vrp_xml_schema.xsd). try to read xml without xml-file-validation."); } } return xmlConfig; }
public void read(URL url) { log.debug("read algorithm: " + url); algorithmConfig.getXMLConfiguration().setURL(url); algorithmConfig.getXMLConfiguration().setAttributeSplittingDisabled(true); algorithmConfig.getXMLConfiguration().setDelimiterParsingDisabled(true); if (schemaValidation) { final InputStream resource = Resource.getAsInputStream("algorithm_schema.xsd"); if (resource != null) { EntityResolver resolver = new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { { InputSource is = new InputSource(resource); return is; } } }; algorithmConfig.getXMLConfiguration().setEntityResolver(resolver); algorithmConfig.getXMLConfiguration().setSchemaValidation(true); } else { log.warn("cannot find schema-xsd file (algorithm_xml_schema.xsd). try to read xml without xml-file-validation."); } } try { algorithmConfig.getXMLConfiguration().load(); } catch (ConfigurationException e) { throw new RuntimeException(e); } }
public static XMLConfiguration createDefaultConfigurationSource() { XMLConfiguration xmlConfig = new XMLConfiguration(); xmlConfig.setDelimiterParsingDisabled(true); return xmlConfig; }
public static XMLConfiguration createDefaultConfigurationSource() { XMLConfiguration xmlConfig = new XMLConfiguration(); xmlConfig.setDelimiterParsingDisabled(true); return xmlConfig; }
private XMLConfiguration getConfiguration() { XMLConfiguration configuration = new XMLConfiguration(); configuration.setDelimiterParsingDisabled(true); return configuration; } }
/** * Creates a new instance of {@code ZapXmlConfiguration}. */ public ZapXmlConfiguration() { super(); super.setEncoding("UTF-8"); super.setDelimiterParsingDisabled(true); }
/** * Constructor. */ public FoConfiguration() { this.config = new XMLConfiguration(); // necessary because some attributes contain commas: config.setDelimiterParsingDisabled( true ); loadDefaultConfig(); }
/** * @return the configuration */ protected HierarchicalConfiguration createConfiguration() { XMLConfiguration config = new XMLConfiguration(); config.setRootElementName("report"); config.setDelimiterParsingDisabled(true); return config; }
public static Map<String, JSONObject> loadRegexAlerts(String config_path) throws ConfigurationException, ParseException { XMLConfiguration alert_rules = new XMLConfiguration(); alert_rules.setDelimiterParsingDisabled(true); alert_rules.load(config_path); //int number_of_rules = alert_rules.getList("rule.pattern").size(); String[] patterns = alert_rules.getStringArray("rule.pattern"); String[] alerts = alert_rules.getStringArray("rule.alert"); JSONParser pr = new JSONParser(); Map<String, JSONObject> rules = new HashMap<String, JSONObject>(); for (int i = 0; i < patterns.length; i++) rules.put(patterns[i], (JSONObject) pr.parse(alerts[i])); return rules; }
private ApplicationDescription parsePlainAppDescription(InputStream stream) throws IOException { XMLConfiguration cfg = new XMLConfiguration(); cfg.setAttributeSplittingDisabled(true); cfg.setDelimiterParsingDisabled(true); try { cfg.load(stream); return loadAppDescription(cfg); } catch (ConfigurationException e) { throw new IOException("Unable to parse " + APP_XML, e); } }
public ConfigurationEditor(String originalConfigFilePath) throws ConfigurationException { this.originalConfigFilePath = originalConfigFilePath; configuration = new XMLConfiguration(this.originalConfigFilePath); // Support XPath queries. configuration.setExpressionEngine(new XPathExpressionEngine()); configuration.setDelimiterParsingDisabled(true); // If we don't do this, // we can't add a new configuration to the compositeConfiguration by code. }
/** * Load the xmlConfiguration from the given resource. * * @param r * @return * @throws ConfigurationException * @throws IOException */ private XMLConfiguration getConfig(Resource r) throws ConfigurationException, IOException { XMLConfiguration config = new XMLConfiguration(); config.setDelimiterParsingDisabled(true); // Don't split attributes which can have bad side-effects with matcher-conditions. // See JAMES-1233 config.setAttributeSplittingDisabled(true); // Use InputStream so we are not bound to File implementations of the // config config.load(r.getInputStream()); return config; }
@Override public HierarchicalConfiguration getConfiguration(String beanName) throws ConfigurationException { XMLConfiguration config = new XMLConfiguration(); FileInputStream fis = null; config.setDelimiterParsingDisabled(true); // Don't split attributes which can have bad side-effects with matcher-conditions. // See JAMES-1233 config.setAttributeSplittingDisabled(true); // Use InputStream so we are not bound to File implementations of the // config try { fis = new FileInputStream("/tmp/" + beanName + ".xml"); config.load(fis); } catch (FileNotFoundException e) { throw new ConfigurationException("Bean " + beanName); } finally { if (fis != null) { try { fis.close(); } catch (Exception e) { // Left empty on purpose } } } return config; }
private String getSelfContainedBundleCoordinates(ApplicationDescription desc) { try { XMLConfiguration cfg = new XMLConfiguration(); cfg.setAttributeSplittingDisabled(true); cfg.setDelimiterParsingDisabled(true); cfg.load(appFile(desc.name(), FEATURES_XML)); return cfg.getString("feature.bundle") .replaceFirst("wrap:", "") .replaceFirst("\\$Bundle-.*$", ""); } catch (ConfigurationException e) { log.warn("Self-contained application {} has no features.xml", desc.name()); return null; } }
private XMLConfiguration createXMLConfiguration() { XMLConfiguration xmlConfig = new XMLConfiguration(); xmlConfig.setAttributeSplittingDisabled(true); xmlConfig.setDelimiterParsingDisabled(true); if (schemaValidation) { final InputStream resource = Resource.getAsInputStream("vrp_xml_schema.xsd"); if (resource != null) { EntityResolver resolver = new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { { InputSource is = new InputSource(resource); return is; } } }; xmlConfig.setEntityResolver(resolver); xmlConfig.setSchemaValidation(true); } else { logger.debug("cannot find schema-xsd file (vrp_xml_schema.xsd). try to read xml without xml-file-validation."); } } return xmlConfig; }
private void createXmlConfiguration(DocumentBuilder documentBuilder, String filename) throws ConfigurationException { XMLConfiguration xmlConfig = new XMLConfiguration(); xmlConfig.setDocumentBuilder(documentBuilder); xmlConfig.setDelimiterParsingDisabled(true); xmlConfig.setFileName(filename); xmlConfig.load(); config.addConfiguration(xmlConfig); applyEnvironmentProperties(); resolveFileReferences(); }
private HierarchicalConfiguration loadConfiguration(InputStream configuration) throws org.apache.commons.configuration.ConfigurationException { XMLConfiguration config = new XMLConfiguration(); config.setDelimiterParsingDisabled(true); config.setAttributeSplittingDisabled(true); config.load(configuration); return config; }
/** * Loads the application descriptor from the specified application archive * stream and saves the stream in the appropriate application archive * directory. * * @param appName application name * @return application descriptor * @throws org.onosproject.app.ApplicationException if unable to read application description */ public ApplicationDescription getApplicationDescription(String appName) { try { XMLConfiguration cfg = new XMLConfiguration(); cfg.setAttributeSplittingDisabled(true); cfg.setDelimiterParsingDisabled(true); cfg.load(appFile(appName, APP_XML)); return loadAppDescription(cfg); } catch (Exception e) { throw new ApplicationException("Unable to get app description", e); } }
public void read(URL url) { log.debug("read algorithm: " + url); algorithmConfig.getXMLConfiguration().setURL(url); algorithmConfig.getXMLConfiguration().setAttributeSplittingDisabled(true); algorithmConfig.getXMLConfiguration().setDelimiterParsingDisabled(true); if (schemaValidation) { final InputStream resource = Resource.getAsInputStream("algorithm_schema.xsd"); if (resource != null) { EntityResolver resolver = new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { { InputSource is = new InputSource(resource); return is; } } }; algorithmConfig.getXMLConfiguration().setEntityResolver(resolver); algorithmConfig.getXMLConfiguration().setSchemaValidation(true); } else { log.warn("cannot find schema-xsd file (algorithm_xml_schema.xsd). try to read xml without xml-file-validation."); } } try { algorithmConfig.getXMLConfiguration().load(); } catch (ConfigurationException e) { throw new RuntimeException(e); } }
private static void fillLdap() { config.setDelimiterParsingDisabled(true); config.setListDelimiter((char) 1); Config.config.clear(); try { config.load(); } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } State.getInstance().setUseLDAP(Config.config.getBoolean("connectionPool[@useLDAP]", false)); State.getInstance().setUseDynamicLDAPDataSource(Config.config.getBoolean("connectionPool[@enableDynamicLdapDataSource]", false)); State.getInstance().setUseLDAPImport(Config.config.getBoolean("connectionPool[@useLDAPImport]", false)); State.getInstance().setLdapServer(Config.config.getString("connectionPool[@ldapServer]")); State.getInstance().setLdapCn(Config.config.getString("connectionPool[@ldapCn]")); State.getInstance().setLdapBase(Config.config.getString("connectionPool[@ldapBase]")); }