cn.chenlichao.wmi4j
类 SWbemPrivilegeSet

java.lang.Object
  继承者 cn.chenlichao.wmi4j.SWbemPrivilegeSet

public class SWbemPrivilegeSet
extends Object

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
 

方法详细信息

add

public SWbemPrivilege add(WbemPrivilegeEnum privilege,
                          Boolean enabled)
                   throws WMIException
Adds an 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.
返回:
If successful, returns an SWbemPrivilege object that represents the new privilege. Otherwise, a null object is returned.
抛出:
WMIException

addAsString

public SWbemPrivilege addAsString(WbemPrivilegeEnum privilege,
                                  Boolean enabled)
                           throws WMIException
You can use the addAsString method to add a privilege to the collection using a privilege string. Use this method to add a privilege or to enable a privilege for SWbemSecurity objects.

参数:
privilege - String privilege for a WMI object.
enabled - [Optional] Enables or disables this privilege. The default value is TRUE.
返回:
If successful, returns an SWbemPrivilege object that represents the new privilege. Otherwise, a null object is returned.
抛出:
WMIException

deleteAll

public void deleteAll()
               throws WMIException
Removes all privileges from the collection, thus emptying it.

抛出:
WMIException

item

public SWbemPrivilege item(WbemPrivilegeEnum privilege)
                    throws WMIException
Get the specified SWbemPrivilege object from the collection.

参数:
privilege - Privilege enum.
返回:
the specified SWbemPrivilege object
抛出:
WMIException

remove

public void remove(WbemPrivilegeEnum privilege)
            throws WMIException
Delete the specified SWbemPrivilege object from the collection.

参数:
privilege - Privilege enum.
抛出:
WMIException

getCount

public int getCount()
             throws WMIException
Get how many items are in this SWbemObjectSet collection. This property is read-only.

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.

返回:
The count of items in this SWbemObjectSet collection.
抛出:
WMIException

iterator

public Iterator<E> iterator()
                                                                         throws WMIException
Create a iterator of this object set.

返回:
Iterator instance.
抛出:
WMIException


Copyright © 2014. All rights reserved.