|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcn.chenlichao.wmi4j.SWbemPrivilegeSet
public class SWbemPrivilegeSet
An SWbemPrivilegeSet object is a collection of SWbemPrivilege objects in an
SWbemSecurity object that requests specific privileges for a Windows Management Instrumentation (WMI) object.
See the list of privileges in Privilege Constants. Items are added to the collection using the Add and AddAsString methods. Items are retrieved from the collection using the Item method, and removed using the Remove method. This object cannot be created by the VBScript CreateObject method call. For more information, see Accessing a Collection.
An SWbemPrivilegeSet object is a set of privilege override requests for a specific object. When an API call is made using this object, the privilege override requests are attempted. The SWbemPrivilegeSet object does not define the privileges available to the current user or process. In other words, obtaining the privileges for any WMI object does not identify the privilege settings that are made on the connection to WMI, or the privileges in effect when an object is delivered to a sink.
Created by chenlichao on 14-7-28.
| 方法摘要 | |
|---|---|
SWbemPrivilege |
add(WbemPrivilegeEnum privilege,
Boolean enabled)
Adds an SWbemPrivilege object to the collection. |
SWbemPrivilege |
addAsString(WbemPrivilegeEnum privilege,
Boolean enabled)
You can use the addAsString method to add a privilege to the collection using a privilege string. |
void |
deleteAll()
Removes all privileges from the collection, thus emptying it. |
int |
getCount()
Get how many items are in this SWbemObjectSet collection. |
SWbemPrivilege |
item(WbemPrivilegeEnum privilege)
Get the specified SWbemPrivilege object from the collection. |
Iterator<E> |
iterator()
Create a iterator of this object set. |
void |
remove(WbemPrivilegeEnum privilege)
Delete the specified SWbemPrivilege object from the collection. |
| 从类 java.lang.Object 继承的方法 |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 方法详细信息 |
|---|
public SWbemPrivilege add(WbemPrivilegeEnum privilege,
Boolean enabled)
throws WMIException
SWbemPrivilege object to the collection.
If a privilege with the same name already exists in the collection, it is replaced.
privilege - Privilege for a WMI object.enabled - [Optional] Enables or disables this privilege. The default value is TRUE.
SWbemPrivilege object that represents the new privilege.
Otherwise, a null object is returned.
WMIException
public SWbemPrivilege addAsString(WbemPrivilegeEnum privilege,
Boolean enabled)
throws WMIException
SWbemSecurity objects.
privilege - String privilege for a WMI object.enabled - [Optional] Enables or disables this privilege. The default value is TRUE.
SWbemPrivilege object that represents the new privilege.
Otherwise, a null object is returned.
WMIException
public void deleteAll()
throws WMIException
WMIException
public SWbemPrivilege item(WbemPrivilegeEnum privilege)
throws WMIException
SWbemPrivilege object from the collection.
privilege - Privilege enum.
SWbemPrivilege object
WMIException
public void remove(WbemPrivilegeEnum privilege)
throws WMIException
SWbemPrivilege object from the collection.
privilege - Privilege enum.
WMIException
public int getCount()
throws WMIException
One thing to be careful of when using Count is that WMI does not keep a running tally of the number of items in a collection. If you request Count for a collection, WMI cannot instantly respond with a number; instead, it must literally count the items, enumerating the entire collection. For a collection that has relatively few items, such as services, this enumeration likely takes less than a second. Counting the number of events in an event log collection, however, can take considerably longer.
And then suppose you want to display the property values for every event in the collection. If so, WMI will have to enumerate the entire collection a second time.
Note: If you attempt to get this property from an SWbemObjectSet object that is returned from a method where the specified flags are included the wbemFlagForwardOnly flag, you will get an wbemErrFailed error.
WMIException
public Iterator<E> iterator()
throws WMIException
WMIException
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||