Search in sources :

Example 1 with DOMWrapper

use of org.eigenbase.xom.DOMWrapper in project mondrian by pentaho.

the class RolapSchemaTest method wrapStrSources.

private static DOMWrapper wrapStrSources(String resStr) throws XOMException {
    final Parser xmlParser = XOMUtil.createDefaultParser();
    final DOMWrapper def = xmlParser.parse(resStr);
    return def;
}
Also used : DOMWrapper(org.eigenbase.xom.DOMWrapper) Parser(org.eigenbase.xom.Parser)

Example 2 with DOMWrapper

use of org.eigenbase.xom.DOMWrapper in project mondrian by pentaho.

the class RolapUtilTest method wrapStrSources.

private static DOMWrapper wrapStrSources(String resStr) throws XOMException {
    final Parser xmlParser = XOMUtil.createDefaultParser();
    final DOMWrapper def = xmlParser.parse(resStr);
    return def;
}
Also used : DOMWrapper(org.eigenbase.xom.DOMWrapper) Parser(org.eigenbase.xom.Parser)

Example 3 with DOMWrapper

use of org.eigenbase.xom.DOMWrapper in project mondrian by pentaho.

the class SqlMemberSourceTest method wrapStrSources.

private static DOMWrapper wrapStrSources(String resStr) throws XOMException {
    final Parser xmlParser = XOMUtil.createDefaultParser();
    final DOMWrapper def = xmlParser.parse(resStr);
    return def;
}
Also used : DOMWrapper(org.eigenbase.xom.DOMWrapper) Parser(org.eigenbase.xom.Parser)

Example 4 with DOMWrapper

use of org.eigenbase.xom.DOMWrapper 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)

Example 5 with DOMWrapper

use of org.eigenbase.xom.DOMWrapper in project pentaho-platform by pentaho.

the class MondrianCatalogHelper method makeCatalogComplementInfoMap.

protected Map<String, MondrianCatalogComplementInfo> makeCatalogComplementInfoMap(final DOMWrapper doc) {
    HashMap<String, MondrianCatalogComplementInfo> map = new HashMap<String, MondrianCatalogComplementInfo>();
    if (doc.getElementChildren().length > 0) {
        DOMWrapper dataSource = doc.getElementChildren()[0];
        DOMWrapper catalogs = null;
        // Search Catalogs
        for (int i = 0; i < dataSource.getElementChildren().length; i++) {
            DOMWrapper element = dataSource.getElementChildren()[i];
            if (element.getTagName().equals("Catalogs")) {
                // $NON-NLS-1$
                catalogs = element;
                break;
            }
        }
        // Generate the map. We need the name and the variables
        for (int i = 0; i < catalogs.getElementChildren().length; i++) {
            final DOMWrapper catalog = catalogs.getElementChildren()[i];
            if (!"Catalog".equals(catalog.getTagName())) {
                // $NON-NLS-1$
                continue;
            }
            MondrianCatalogComplementInfo complementInfo = new MondrianCatalogComplementInfo();
            // Iterate through whereConditions
            for (int j = 0; j < catalog.getElementChildren().length; j++) {
                final DOMWrapper whereNode = catalog.getElementChildren()[j];
                if ("WhereCondition".equals(whereNode.getTagName())) {
                    // $NON-NLS-1$
                    // $NON-NLS-1$
                    complementInfo.addWhereCondition(whereNode.getAttribute("cube"), whereNode.getText());
                }
            }
            // $NON-NLS-1$
            map.put(getDOMWrapperElementText(catalog, "Definition"), complementInfo);
        }
    }
    return map;
}
Also used : HashMap(java.util.HashMap) DOMWrapper(org.eigenbase.xom.DOMWrapper)

Aggregations

DOMWrapper (org.eigenbase.xom.DOMWrapper)6 Parser (org.eigenbase.xom.Parser)5 XOMException (org.eigenbase.xom.XOMException)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 MondrianDef (mondrian.olap.MondrianDef)1 DataSources (mondrian.xmla.DataSourcesConfig.DataSources)1