2

我有一个 Mondrian 服务器 webapp 启动并运行以处理 MDX 查询,从 Mondrian Schema 中定义的 OLAP 多维数据集获取数据,并返回前端 GUI 应用程序所需的 XMLA 以显示查询的数据。

这一切都有效,但现在我正在尝试添加权限角色,我偶然发现了一个非常令人困惑的问题。

现在我认为这就像添加另一个参数“角色”并发送它一样简单。但是,这给了我一个奇怪的错误。

我正在使用 SmartGWT 连接到 Mondrian XMLA 服务。

    public static OlapConnection getConnection() throws Exception {
    Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
    java.util.Properties p = new Properties();
    String role = "role1";
    p.put("server", "http://domain.be:8080/mondrian/xmla");
    p.put("user", "user");
    p.put("password", "password");
    p.put("role","\""+role+"\"");
    String dbUrl = "jdbc:xmla:";
    Connection connectionXMLA = DriverManager.getConnection(dbUrl, p);
    OlapWrapper wrapper = (OlapWrapper) connectionXMLA;
    OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
    return olapConnection;

角色在也包含多维数据集的架构中定义,如下所示:

<Role name="role1">
<SchemaGrant access="none">
      <CubeGrant cube="VehicleSales" access="all"/>
  <CubeGrant cube="Contract" access="none"/>
</SchemaGrant>

<Role name="role2">
<SchemaGrant access="none">
      <CubeGrant cube="VehicleSales" access="none"/>
  <CubeGrant cube="Contract" access="all"/>
</SchemaGrant>

使用“角色”参数时,我收到此错误:

12:30:50.930 [错误] [smartgwtolap] 12:30:50.928:TMR9:WARN:RPCManager:org.olap4j.OlapException: XMLA

提供者给出了例外:

<faultcode>
    SOAP-ENV:Server.00HSBB01
</faultcode>
<faultstring>
    XMLA SOAP Body processing error
</faultstring>
<faultactor>
    Mondrian
</faultactor>
<detail>
    <XA:error xmlns:XA="mondrian sourceforge net">
        <code>
            00HSBB01
        </code>
        <desc>
            The Mondrian XML: Mondrian Error:Internal error: Rowset 'DISCOVER_PROPERTIES' does not support property 'Roles'
        </desc>
    </XA:error>
</detail>
 </SOAP-ENV:Fault>

请求是:DISCOVER_PROPERTIES “role1”;数据未定义 - 响应:{operationId:“listCubes_fetch”,clientContext:Obj,上下文:Obj,transactionNum:0,httpResponseCode:200,httpResponseText:“//isc_RPCResponseStart-->[{“data”:“org.o ... “[1497],xmlHttpRequest:Obj,传输:“xmlHttpRequest”,状态:-1,clientOnly:undef,httpHeaders:Obj,isStructured:true,callbackArgs:null,结果:Obj,数据:“org.olap4j.OlapException:XMLA提供者...“[1243],invalidateCache:假,isDSResponse:真,queueStatus:-1,startRow:0,endRow:0,totalRows:0}com.smartgwt.client.core.JsObject$SGWT_WARN:12:30: 50.928:TMR9:WARN:RPCManager:org.olap4j。 00HSBB01 蒙德里安 XML:蒙德里安错误:内部错误:行集“DISCOVER_PROPERTIES”不支持属性“角色”
请求是:DISCOVER_PROPERTIES “role1”;数据未定义 - 响应:{operationId:“listCubes_fetch”,clientContext:Obj,上下文:Obj,transactionNum:0,httpResponseCode:200,httpResponseText:“//isc_RPCResponseStart-->[{“data”:“org.o ... “[1497],xmlHttpRequest:Obj,传输:“xmlHttpRequest”,状态:-1,clientOnly:undef,httpHeaders:Obj,isStructured:true,callbackArgs:null,结果:Obj,数据:“org.olap4j.OlapException:XMLA provider ..."[1243],invalidateCache:false,isDSResponse:true,queueStatus:-1,startRow:0,endRow:0,totalRows:0} 在 sun.reflect.NativeConstructorAccessorImpl。

其他随机参数,例如“foo”或“bar”,不会返回任何错误,并且会被忽略。所以“角色”肯定会触发一些东西,但遗憾的是不是我可以使用的任何东西。

任何人都可以提供一些见解?这是非常赞赏。我发现了关于 Pentaho XmlaHandler 的一些东西,它接受一个角色作为参数,但这似乎是在 Mondrian 内部使用的东西,不一定是我可以立即在 SmartGWT 中使用的东西——我想。

谢谢阅读!

编辑

下面的代码段返回错误:

java.lang.RuntimeException: org.olap4j.OlapException: 获取数据库产品名失败。

        Connection connectionXMLA = DriverManager.getConnection(dbUrl, p);
    OlapWrapper wrapper = (OlapWrapper) connectionXMLA;
    OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
    String role = "role2";
    olapConnection.setRoleName(role);
    return olapConnection;

getAvailableRoleNames() 函数确实返回架构文件中指定的角色。如果我注释掉 setRoleName(role) 部分,它工作得很好。

4

1 回答 1

0

这不是在 olap4j 中设置角色的方法。尝试使用OlapConnection.setRoleName

于 2013-04-15T23:04:44.730 回答