微软的这个联机文档太强大了,强大到要理解他需要耗费相当大的精力。
强大到看到人就让人头痛,呵呵。
不得不这样感叹啊,如果全都看遍,估计就无敌了。
在Analysis service 编程章节中 Decision Support Object Programmer's Reference中
文档分别从Interface,Events,Objects,Enumerations,Collections这些方面比较详细的
介绍了AS中主要对象的一些接口和属性。
比如大部分对象都是继承了Collections。(语言果然是共通的。。。)
Decision Support Objects Architecture 描述了AS中所有基本对象的说明
Server,Database,DataSource,Cube,Deimension,Role,Command,Level,MeaSure,Menber等等。。。
有一点很反感的是微软把文档搞的跟蜘蛛网一样,相当繁琐。
链接来链接去的。。
附微软官方网站添加角色VB代码一段:
Const ServerName = "localhost" '"SERVER-NAME"
Const DatabaseName = "Foodmart 2000" '"OLAP-DATABASE-NAME"
Const UserList = "USERS" '"DOMAIN-NAME\USER-ID;DOMAIN-NAME\USER-ID"
Const CubeName = "HR" '"CUBE-NAME"
Sub Main()
Dim dsoServer As DSO.Server
Dim dsoRole As DSO.Role
Dim dsoCubeRole As DSO.Role
Dim dsoDB As DSO.Database
Dim RoleName As String
RoleName = "Fred"
Set dsoServer = New DSO.Server
'Connect to server.
dsoServer.Connect ServerName
'Connect to database.
Set dsoDB = dsoServer.MDStores.Item(DatabaseName)
If dsoDB.Roles.Find(RoleName) Then
dsoDB.Roles.Remove (RoleName)
End If
Set dsoRole = dsoDB.Roles.AddNew(RoleName, sbclsRegular) ' 0) ' sbclsRegular
'Set role description.
dsoRole.Description = "Test through Visual Basic application"
dsoRole.LockObject 1, "Creating Role"
'Set Enforcement Location permission key.
dsoRole.SetPermissions "EnforcementLocation", "Server"
'Add group of users or single user to roles.
dsoRole.UsersList = UserList
Dim strAllowedSet As String
Dim strDimensionSecurity As String
'Set Permission on Dimensions Time.
strAllowedSet = "[Time].[1997].[Q1]:[Time].[1998].[Q4]"
strDimensionSecurity = "<MEMBERSECURITY IsVisible=""True"" VisualTotalsLowestLevel=""[Time].[Quarter]"">"
strDimensionSecurity = strDimensionSecurity & "<PERMISSION Access=""Read"""
strDimensionSecurity = strDimensionSecurity & " AllowedSet=""{" & strAllowedSet & "}"""
strDimensionSecurity = strDimensionSecurity & " UpperLevel=""[Time].[Year]"""
strDimensionSecurity = strDimensionSecurity & " LowerLevel=""[Time].[Quarter]"""
strDimensionSecurity = strDimensionSecurity & " /></MEMBERSECURITY>"
dsoRole.SetPermissions "Dimension:Time", strDimensionSecurity
'Set Permission on Dimension Store.
strAllowedSet = "[Store].[All Stores].[USA].[CA],[Store].[All Stores].[USA].[WA],[Store].[All Stores].[USA].[OR]"
strDimensionSecurity = "<MEMBERSECURITY IsVisible=""True"" VisualTotalsLowestLevel=""[Store].[Store Country]"">"
strDimensionSecurity = strDimensionSecurity & "<PERMISSION Access=""Read"""
strDimensionSecurity = strDimensionSecurity & " AllowedSet=""{" & strAllowedSet & "}"""
strDimensionSecurity = strDimensionSecurity & " UpperLevel=""[Store].[Store Country]"""
strDimensionSecurity = strDimensionSecurity & " LowerLevel=""[Store].[Store State]"""
strDimensionSecurity = strDimensionSecurity & " /></MEMBERSECURITY>"
dsoRole.SetPermissions "Dimension:Store", strDimensionSecurity
'Deny access to other dimensions.
For i = 1 To dsoDB.Dimensions.Count
If dsoDB.Dimensions(i).Name <> "Time" Then
If dsoDB.Dimensions(i).Name <> "Store" Then
' Pay Type is a private dimension in the HR cube.
' Setting permissions at the Database Level
' so preface it with the name of the cube and ^.
If dsoDB.Dimensions(i).Name <> "HR^Pay Type" Then
If dsoDB.Dimensions(i).Name <> "Store Type" Then
If dsoDB.Dimensions(i).Name <> "Measures" Then
' Comment these two lines, because they contain an incomplete permission statement.
strDimensionSecurity = "<MEMBERSECURITY IsVisible=""False"">"
strDimensionSecurity = strDimensionSecurity & "</MEMBERSECURITY>"
' Uncomment these lines, containing a complete permission statement, to apply the security rules.
'strDimensionSecurity = "<MEMBERSECURITY IsVisible=""False"">"
'strDimensionSecurity = strDimensionSecurity & "<PERMISSION Access=""Read"" "
'strDimensionSecurity = strDimensionSecurity & "UpperLevel=""[" & Trim(dsoDB.Dimensions(i).Name) & "].Levels(0)"" "
'strDimensionSecurity = strDimensionSecurity & "LowerLevel=""[" & Trim(dsoDB.Dimensions(i).Name) & "].Levels(0)"" "
'strDimensionSecurity = strDimensionSecurity & "AllowedSet=""{[" & Trim(dsoDB.Dimensions(i).Name) & "].Levels(0).Members(0)}""/> "
'strDimensionSecurity = strDimensionSecurity & "</MEMBERSECURITY>"
dsoRole.SetPermissions "Dimension:" & dsoDB.Dimensions(i).Name, strDimensionSecurity
End If
End If
End If
End If
End If
Next
'Unlock the database.
dsoRole.UnlockObject
'Update the Role.
dsoRole.Update
Dim dsoCube As DSO.Cube
Set dsoCube = dsoDB.MDStores(CubeName)
dsoCube.LockObject 1, "Creating New Roles"
Set dsoCubeRole = dsoCube.Roles.AddNew(RoleName)
strDimensionSecurity = "<MEMBERSECURITY>"
strDimensionSecurity = strDimensionSecurity & "<PERMISSION Access=""Read"""
strDimensionSecurity = strDimensionSecurity & " AllowedSet=""{[Measures].[Org Salary],[Measures].[Count],[Measures].[Number of Employees]}"""
strDimensionSecurity = strDimensionSecurity & " /></MEMBERSECURITY>"
dsoCubeRole.SetPermissions "Dimension:Measures", strDimensionSecurity
dsoCube.Update
dsoCube.UnlockObject
Set dsoCubeRole = Nothing
Set dsoCube = Nothing
dsoDB.Update
dsoServer.Update
dsoServer.UnlockAllObjects
dsoServer.CloseServer
Set dsoServer = Nothing
Set dsoDB = Nothing
Set dsoRole = Nothing
MsgBox "Done"
End Sub
对之Java代码的改造(部分):
Ole32.CoInitialize();
DispatchPtr as = new DispatchPtr("DSO.Server");
as.invoke("Connect" , "localhost");
DispatchPtr mds = (DispatchPtr) as.get("MDStores");
DispatchPtr db = (DispatchPtr)mds.invoke("Item","FoodMart 2000");
DispatchPtr roles = (DispatchPtr) db.get("Roles");
int rnt = (Integer) roles.get("Count");
for( int i = 1;i <= rnt;i ++ )
{
DispatchPtr role = (DispatchPtr) roles.invoke("Item", i);
System.err.println("RoleName:" + role.get("Name"));
String str = (String) role.get("Permissions","Dimension:Time");
System.out.println(str);
}
Ole32.CoUninitialize();
分享到:
相关推荐
Java调用COM组件是Java与非Java环境交互的一种方式,主要应用于Windows平台,因为COM(Component Object Model)是微软提出的一种面向对象的技术,主要用于构建Windows应用程序和服务。在Java中调用COM组件,可以...
在IT行业中,有时我们需要在Java应用程序中调用Windows操作系统中的COM(Component Object Model)组件,以便利用这些组件提供的特定功能。对于这种情况,开发者可以借助于一个名为JACOB的库,它是一个Java到COM桥接...
Java Jain SIP是一个强大的开源库,用于在Java平台上构建SIP(Session Initiation Protocol)应用程序。这个简单的JAVA-JAIN-SIP客户端示例展示了如何利用该库与SIP服务器进行交互,实现登录和发起呼叫的基本功能。...
Java 操纵 COM 组件并调用 C# 编写的 DLL 文件是一种跨语言交互的技术实现。在本文中,我们将深入探讨这一技术,并提供一个完整的示例,包括源代码、DLL 文件以及必要的 JAR 包和工具。我们使用的是一种名为 Jacob ...
为了扩展JavaScript的功能,可以利用OCX(ActiveX控件)和COM(组件对象模型)组件来实现与客户端DLL(动态链接库)的交互。 **OCX(ActiveX控件)**是微软提出的一种技术,它允许开发者创建可重用的、跨平台的用户...
在Java编程中,调用Windows系统的COM(Component Object Model)组件是一种常见的需求,尤其是在与操作系统交互或者使用特定的硬件设备时。"java调用大漠插件的开源项目" 提到了如何利用Java来调用这类插件,而...
### Java调用C#封装的DLL方法 #### 第一种方法:Java利用JNA进行调用 **背景介绍:** 为了实现Java与C#之间的交互,一种常用的方式是通过调用C#封装的DLL文件来完成特定功能。这种方法涉及到.NET Framework与Java...
【使用JACOB工具调用COM组件】是一个关键的话题,特别是在Java编程中处理与Windows平台交互的场景。JACOB,全称为JAVA-COM Bridge,它允许Java应用程序直接调用COM(Component Object Model)组件,这些组件通常是用...
java调用com组件操作word使用总结(jacob)
标题中的“pb调用C#中COM组件实例”是指在PowerBuilder(PB)环境中通过COM(Component Object Model)接口调用由C#语言编写的组件。这种方法允许不同编程语言之间进行互操作,使得PB能够利用C#的强大功能,如.NET ...
gRPC的通信方式-客户端流式、服务端流式、双向流式在Java的调用示例代码;gRPC的通信方式-客户端流式、服务端流式、双向流式在Java的调用示例代码.;gRPC的通信方式-客户端流式、服务端流式、双向流式在Java的调用示例...
- 以管理员身份运行“控制面板”->“程序”->“打开或关闭Windows功能”,确保选中必要的组件,例如“远程过程调用(RPC)”等。 2. **运行金蝶客户端安装程序**: - 使用管理员权限启动安装程序,根据提示进行...
WebService客户端调用WebService服务示例代码,java代码,纯手工,包括直接httpClient直接发送Saop报文调用和利用wsimport -keep 生成客户端代码后调用两种方式的示例。因涉及商务账户密码隐私,因此代码中的有些账号...
java 调用windows的COM组件举例(使用JACOB)-附件资源
本话题主要探讨如何使用Java调用由C++实现的Web服务(Webservice)。在给出的描述中,提到了通过WSDL(Web Services Description Language)文件来实现这一目标。以下是关于这个主题的详细知识点: 1. **Web服务...
JAVA com组件调用示例/** * */ package com.jdgroup.utilwork.util; import org.jawin.DispatchPtr; import org.jawin.win32.Ole32; /** * @author Guo Long * * Oct 16, 2008 */
java调用实例:// windows环境下需要配置Hadoop的客户端 System.setProperty("hadoop.home.dir", "E:/hadoop-2.6.0/"); conf = new Configuration(); fs = FileSystem.get(new URI("hdfs://192.168.1.222:8020"),...
本文将深入探讨如何使用CXF框架结合ws-security标准来实现对Java客户端调用Web服务的安全接口。CXF是一个开源的服务框架,它允许开发人员创建和消费各种Web服务,而ws-security(Web Services Security)则是用于...
本主题聚焦于"C#调用java",探讨如何在C#应用中直接调用Java代码,而无需通过生成.NET组件来实现这一目标。这样的做法能带来更高的稳定性和速度。 首先,我们需要理解的是,C#和Java属于两种不同的编程语言,它们...
java调用C#封装的dll(jna,com)java调用C#封装的dll(jna,com)java调用C#封装的dll(jna,com)