當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyList.remove方法代碼示例

本文整理匯總了Java中mondrian.olap.Util.PropertyList.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyList.remove方法的具體用法?Java PropertyList.remove怎麽用?Java PropertyList.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mondrian.olap.Util.PropertyList的用法示例。


在下文中一共展示了PropertyList.remove方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDataSources

import mondrian.olap.Util.PropertyList; //導入方法依賴的package包/類
public List<Map<String, Object>> getDataSources(OlapConnection connection)
    throws OlapException
{
    MondrianOlap4jConnection olap4jConnection =
        (MondrianOlap4jConnection) connection;
    MondrianServer server =
        MondrianServer.forConnection(
            olap4jConnection.getMondrianConnection());
    final List<Map<String, Object>> databases =
        server.getDatabases(olap4jConnection.getMondrianConnection());

    // We can't let JdbcPassword leak out of the public API, so we remove
    // it here. This is only called by the XMLA servlets.
    for (Map<String, Object> db : databases) {
        String dsi = (String) db.get("DataSourceInfo");

        if (dsi == null) {
            break;
        }

        PropertyList pl = Util.parseConnectString(dsi);

        boolean removed =
            pl.remove(RolapConnectionProperties.Jdbc.name());
        removed |= pl.remove(RolapConnectionProperties.JdbcUser.name());
        removed |= pl.remove(RolapConnectionProperties.JdbcPassword.name());

        if (removed) {
            db.put("DataSourceInfo", pl.toString());
        }
    }
    return databases;
}
 
開發者ID:OSBI,項目名稱:mondrian,代碼行數:34,代碼來源:MondrianOlap4jExtra.java

示例2: filterConnectString

import mondrian.olap.Util.PropertyList; //導入方法依賴的package包/類
protected String filterConnectString(String original) {
    PropertyList props = Util.parseConnectString(original);
    if (props.get(RolapConnectionProperties.Catalog.name()) != null) {
        props.remove(RolapConnectionProperties.Catalog.name());
    }
    return props.toString();
}
 
開發者ID:OSBI,項目名稱:mondrian,代碼行數:8,代碼來源:XmlaMetaDataConstraintsTest.java

示例3: addDatasourceInfoResponseKey

import mondrian.olap.Util.PropertyList; //導入方法依賴的package包/類
protected void addDatasourceInfoResponseKey(Properties props) {
    XmlaTestContext s = new XmlaTestContext();
    String con = s.getConnectString().replaceAll("&amp;","&");
    PropertyList pl = Util.parseConnectString(con);
    pl.remove(RolapConnectionProperties.Jdbc.name());
    pl.remove(RolapConnectionProperties.JdbcUser.name());
    pl.remove(RolapConnectionProperties.JdbcPassword.name());
    props.setProperty(DATA_SOURCE_INFO_RESPONSE_PROP, pl.toString());
}
 
開發者ID:OSBI,項目名稱:mondrian,代碼行數:10,代碼來源:XmlaBaseTestCase.java

示例4: getConnection

import mondrian.olap.Util.PropertyList; //導入方法依賴的package包/類
public OlapConnection getConnection(
    MondrianServer server,
    String databaseName,
    String catalogName,
    String roleName,
    Properties props)
    throws SQLException
{
    final ServerInfo serverInfo = getServerInfo();
    DatabaseInfo datasourceInfo;
    if (databaseName == null) {
        if (serverInfo.datasourceMap.size() == 0) {
            throw new OlapException(
                "No databases configured on this server");
        }
        datasourceInfo =
            serverInfo
                .datasourceMap
                .values()
                .iterator()
                .next();
    } else {
        datasourceInfo =
            serverInfo.datasourceMap.get(databaseName);

        // For legacy, we have to check if the DataSourceInfo matches.
        // We used to mix up DS Info and DS names. The behavior above is
        // the right one. The one below is not.
        // Note also that the DSInfos we sent to the client had the
        // JDBC properties removed for security. We have to account for
        // that here as well.
        if (datasourceInfo == null) {
            for (DatabaseInfo infos
                : serverInfo.datasourceMap.values())
            {
                PropertyList pl =
                    Util.parseConnectString(
                        (String) infos.properties.get("DataSourceInfo"));

                pl.remove(RolapConnectionProperties.Jdbc.name());
                pl.remove(RolapConnectionProperties.JdbcUser.name());
                pl.remove(RolapConnectionProperties.JdbcPassword.name());

                if (pl.toString().equals(databaseName)) {
                    datasourceInfo = infos;
                }
            }
        }
    }

    if (datasourceInfo == null) {
        throw Util.newError("Unknown database '" + databaseName + "'");
    }

    if (catalogName == null) {
        if (datasourceInfo.catalogMap.size() == 0) {
            throw new OlapException(
                "No catalogs in the database named "
                + datasourceInfo.name);
        }
        for (CatalogInfo catalogInfo : datasourceInfo.catalogMap.values()) {
          try {
            return getConnection(catalogInfo, server, roleName, props);
          } catch (Exception e) {
            LOGGER.warn("Failed getting connection. Skipping", e);
          }
        }
    } else {
      CatalogInfo namedCatalogInfo =
            datasourceInfo.catalogMap.get(catalogName);
      if (namedCatalogInfo == null) {
        throw Util.newError("Unknown catalog '" + catalogName + "'");
      }
      return getConnection(namedCatalogInfo, server, roleName, props);
    }

    throw Util.newError("No suitable connection found");
}
 
開發者ID:OSBI,項目名稱:mondrian,代碼行數:79,代碼來源:FileRepository.java

示例5: runTest

import mondrian.olap.Util.PropertyList; //導入方法依賴的package包/類
protected void runTest() throws Exception {
    if (!MondrianProperties.instance().SsasCompatibleNaming.get()
        && getName().equals("mdschemaLevelsCubeDimRestrictions"))
    {
        // Changes in unique names of hierarchies and levels mean that the
        // output is a different order in the old behavior, and cannot be
        // fixed by a few sed-like comparisons.
        return;
    }
    DiffRepository diffRepos = getDiffRepos();
    String request = diffRepos.expand(null, "${request}");
    String expectedResponse = diffRepos.expand(null, "${response}");

    Properties props = new Properties();
    XmlaTestContext s = new XmlaTestContext();
    String con = s.getConnectString().replaceAll("&amp;","&");
    PropertyList pl = Util.parseConnectString(con);
    pl.remove(RolapConnectionProperties.Jdbc.name());
    pl.remove(RolapConnectionProperties.JdbcUser.name());
    pl.remove(RolapConnectionProperties.JdbcPassword.name());
    props.setProperty(DATA_SOURCE_INFO_RESPONSE_PROP, pl.toString());
    expectedResponse =
        Util.replaceProperties(
            expectedResponse, Util.toMap(props));

    Element requestElem = XmlaUtil.text2Element(
        XmlaTestContext.xmlFromTemplate(
            request, XmlaTestContext.ENV));
    Element responseElem =
        ignoreLastUpdateDate(executeRequest(requestElem));

    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer();
    StringWriter bufWriter = new StringWriter();
    transformer.transform(
        new DOMSource(responseElem), new StreamResult(bufWriter));
    bufWriter.write(Util.nl);
    String actualResponse =
        TestContext.instance().upgradeActual(
            bufWriter.getBuffer().toString());
    try {
        // Start with a purely logical XML diff to avoid test noise
        // from non-determinism in XML generation.
        XMLAssert.assertXMLEqual(expectedResponse, actualResponse);
    } catch (AssertionFailedError e) {
        // In case of failure, re-diff using DiffRepository's comparison
        // method. It may have noise due to physical vs logical structure,
        // but it will maintain the expected/actual, and some IDEs can even
        // display visual diffs.
        diffRepos.assertEquals("response", "${response}", actualResponse);
    }
}
 
開發者ID:OSBI,項目名稱:mondrian,代碼行數:53,代碼來源:XmlaTest.java


注:本文中的mondrian.olap.Util.PropertyList.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。