Java Code Examples for org.apache.commons.configuration.XMLConfiguration#setAttributeSplittingDisabled()

The following examples show how to use org.apache.commons.configuration.XMLConfiguration#setAttributeSplittingDisabled() . 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: XmlTelemetryConfigLoader.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Loads the specified telemetry configs resource as an XML stream and parses
 * it to produce a ready-to-register config provider.
 *
 * @param configsStream stream containing the telemetry configs definition
 * @return telemetry configuration provider
 * @throws IOException if issues are encountered reading the stream
 *                     or parsing the telemetry config definition within
 */
public DefaultTelemetryConfigProvider
        loadTelemetryConfigs(InputStream configsStream) throws IOException {
    try {
        XMLConfiguration cfg = new XMLConfiguration();
        cfg.setRootElementName(CONFIGS);
        cfg.setAttributeSplittingDisabled(true);

        cfg.load(configsStream);
        return loadTelemetryConfigs(cfg);
    } catch (ConfigurationException e) {
        throw new IOException("Unable to load telemetry configs", e);
    }
}
 
Example 2
Source File: XmlDriverLoader.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Loads the specified drivers resource as an XML stream and parses it to
 * produce a ready-to-register driver provider.
 *
 * @param driversStream stream containing the drivers definitions
 * @param resolver      driver resolver
 * @return driver provider
 * @throws java.io.IOException if issues are encountered reading the stream
 *                             or parsing the driver definitions within
 */
public DefaultDriverProvider loadDrivers(InputStream driversStream,
                                         DriverResolver resolver) throws IOException {
    try {
        XMLConfiguration cfg = new XMLConfiguration();
        cfg.setRootElementName(DRIVERS);
        cfg.setAttributeSplittingDisabled(true);

        cfg.load(driversStream);
        return loadDrivers(cfg, resolver);
    } catch (ConfigurationException e) {
        throw new IOException("Unable to load drivers", e);
    }
}
 
Example 3
Source File: ApplicationArchive.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 4
Source File: ApplicationArchive.java    From onos with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 5
Source File: ApplicationArchive.java    From onos with Apache License 2.0 5 votes vote down vote up
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;
    }
}