Search in sources :

Example 1 with DataSources

use of mondrian.xmla.DataSourcesConfig.DataSources in project pentaho-platform by pentaho.

the class MondrianCatalogHelper method parseDataSources.

protected DataSourcesConfig.DataSources parseDataSources(final String dataSourcesConfigString) {
    try {
        if (dataSourcesConfigString == null) {
            MondrianCatalogHelper.logger.warn(Messages.getInstance().getString(// $NON-NLS-1$
            "MondrianCatalogHelper.WARN_PARSE_NULL_INPUT"));
            return null;
        }
        String replacedConfigString = Util.replaceProperties(dataSourcesConfigString, Util.toMap(System.getProperties()));
        if (MondrianCatalogHelper.logger.isDebugEnabled()) {
            // $NON-NLS-1$
            String msg = "parseDataSources: dataSources=" + replacedConfigString;
            MondrianCatalogHelper.logger.debug(msg);
        }
        final Parser parser = XOMUtil.createDefaultParser();
        final DOMWrapper doc = parser.parse(replacedConfigString);
        catalogComplementInfoMap = makeCatalogComplementInfoMap(doc);
        return new DataSourcesConfig.DataSources(doc);
    } catch (XOMException e) {
        throw Util.newError(e, Messages.getInstance().getErrorString("MondrianCatalogHelper.ERROR_0002_FAILED_TO_PARSE_DATASOURCE_CONFIG", dataSourcesConfigString));
    }
}
Also used : DataSources(mondrian.xmla.DataSourcesConfig.DataSources) XOMException(org.eigenbase.xom.XOMException) DOMWrapper(org.eigenbase.xom.DOMWrapper) Parser(org.eigenbase.xom.Parser)

Aggregations

DataSources (mondrian.xmla.DataSourcesConfig.DataSources)1 DOMWrapper (org.eigenbase.xom.DOMWrapper)1 Parser (org.eigenbase.xom.Parser)1 XOMException (org.eigenbase.xom.XOMException)1