cn.chenlichao.wmi4j
类 SWbemObject

java.lang.Object
  继承者 cn.chenlichao.wmi4j.AbstractSecurityScriptingObject
      继承者 cn.chenlichao.wmi4j.SWbemObject

public class SWbemObject
extends AbstractSecurityScriptingObject

You can use the methods and properties of the SWbemObject object to represent one Windows Management Instrumentation (WMI) class definition or object instance.

This object supports two types of properties and methods. Those defined in this section are generic properties and methods that apply to all WMI objects. In addition, this object exposes the properties and methods of the underlying object as dynamic automation properties and methods of SWbemObject. The names and types of these properties and methods depend on the underlying WMI object.

From the WMI client perspective, this object is always in-process. Write operations only affect the local copy of the object, and read operations always retrieve values from the local copy. Updates to WMI are performed only when entire objects are written using a call to the SWbemObject.put(). If you modify the properties or methods in an SWbemObject object, your changes are not written to WMI until you call SWbemObject.put().

Note: SWbemObject cannot be created by yourself. If you want to create a new, empty class use SWbemServices.get with an empty path parameter. This call returns an empty SWbemObject object that can become a class. You can then supply a class name for the class property of the SWbemObjectPath object returned by the getPath() call. Add properties to the new class by the properties method. To create an instance, call GetObject on the new class.

Created by chenlichao on 14-7-22.


方法摘要
 SWbemObjectSet associators()
          Use default parameters for method associators(String, String, String, String, Boolean, Boolean, String, String, SWbemNamedValueSet, cn.chenlichao.wmi4j.consts.Flags.AssociatorsFlag...)
 SWbemObjectSet associators(String assocClass, String resultClass, String resultRole, String role, Boolean classesOnly, Boolean schemaOnly, String requiredAssocQualifier, String requiredQualifier, SWbemNamedValueSet objwbemNamedValueSet, Flags.AssociatorsFlag... flags)
          Returns a collection of objects (classes or instances) that are associated with the current object.
 boolean compareTo(SWbemObject wbemObject)
          Use default parameters for #compareTo(SWbemObject, Flags.CompareToFlag...
 boolean compareTo(SWbemObject wbemObject, Flags.CompareToFlag... flags)
          Compares two SWbemObject objects.
 void delete()
          Use default parameters for delete(Integer, SWbemNamedValueSet)
 void delete(Integer flags, SWbemNamedValueSet objWbemNamedValueSet)
          Deletes either the current class or the current instance.
 SWbemObject execMethod(String methodName)
          Use default parameters for execMethod(String, SWbemObject, Integer, SWbemNamedValueSet)
 SWbemObject execMethod(String methodName, SWbemObject inParameters)
          Use default parameters for execMethod(String, SWbemObject, Integer, SWbemNamedValueSet)
 SWbemObject execMethod(String methodName, SWbemObject inParameters, Integer flags, SWbemNamedValueSet objWbemNamedValueSet)
          Executes a method exported by a method provider.
 List<String> getDerivation()
          An array of strings that describe the class derivation hierarchy for the instance being referenced.
 SWbemObject getInParametersByMethodName(String methodName)
          Get an SWbemObject object whose properties define the input parameters for the specified method.
 SWbemMethodSet getMethods()
          Returns an SWbemMethodSet object that is a collection of the methods for the current class or instance.
 String getObjectText()
          Use default parameters for getObjectText(Integer)
 String getObjectText(Integer flags)
          Returns a textual rendering of the object.
 SWbemObjectPath getPath()
          Returns an SWbemObjectPath object that represents the object path of the current class or instance.
 SWbemPropertySet getProperties()
          Returns an SWbemPropertySet object that is a collection of the properties for the current class or instance.
 WMIVariant getPropertyByName(String propertyName)
          Get the variant value of the specified WMI property.
 SWbemQualifierSet getQualifiers()
          Returns an SWbemQualifierSet object that is a collection of the qualifiers for the current class or instance.
 SWbemObjectSet instances()
          Use default parameters for instances(SWbemNamedValueSet, Flags.InstancesFlag...)
 SWbemObjectSet instances(SWbemNamedValueSet objWbemNamedValueSet, Flags.InstancesFlag... flags)
          Creates an enumerator that returns the instances of the current class object.
 SWbemObjectPath put()
          Use default parameters for put(SWbemNamedValueSet, cn.chenlichao.wmi4j.consts.Flags.PutFlag...)
 SWbemObjectPath put(SWbemNamedValueSet objWbemNamedValueSet, Flags.PutFlag... flags)
          Creates or updates an instance or a class object to Windows Management Instrumentation (WMI).
 SWbemObjectSet references()
          Use default parameters for references(String, String, Boolean, Boolean, String, SWbemNamedValueSet, cn.chenlichao.wmi4j.consts.Flags.ReferenceFlag...)
 SWbemObjectSet references(String resultClass, String role, Boolean classesOnly, Boolean schemaOnly, String requiredQualifier, SWbemNamedValueSet objWbemNamedValueSet, Flags.ReferenceFlag... flags)
          Returns a collection of all association classes or instances that refer to the current object.
 void setPropertyByName(String propertyName, WMIVariant value)
          Set the variant value of the specified WMI property
 SWbemObject spawnDerivedClass()
          Use default parameters for spawnDerivedClass(Integer)
 SWbemObject spawnDerivedClass(Integer flags)
          Create a derived class object from the current object.
 SWbemObject spawnInstance()
          Use default parameters for spawnInstance(Integer)
 SWbemObject spawnInstance(Integer flags)
          Create a new instance of a class.
 SWbemObjectSet subclasses()
          Use default parameters for subclasses(SWbemNamedValueSet, cn.chenlichao.wmi4j.consts.Flags.SubclassesFlag...)
 SWbemObjectSet subclasses(SWbemNamedValueSet objWbemNamedValueSet, Flags.SubclassesFlag... flags)
          Returns an SWbemObjectSet object.
 SWbemObject wmiClone()
          Returns a new object that is a clone of the current object.
 
从类 cn.chenlichao.wmi4j.AbstractSecurityScriptingObject 继承的方法
getSecurity
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

associators

public SWbemObjectSet associators(String assocClass,
                                  String resultClass,
                                  String resultRole,
                                  String role,
                                  Boolean classesOnly,
                                  Boolean schemaOnly,
                                  String requiredAssocQualifier,
                                  String requiredQualifier,
                                  SWbemNamedValueSet objwbemNamedValueSet,
                                  Flags.AssociatorsFlag... flags)
                           throws WMIException
Returns a collection of objects (classes or instances) that are associated with the current object. These returned objects are called endpoints. This method performs the same function that the ASSOCIATORS OF WQL query performs.

参数:
assocClass - [Optional] String that contains an association class. If specified, this parameter indicates that the returned endpoints must be associated with the source through the specified association class or a class that is derived from this association class.
resultClass - [Optional] String that contains a class name. If specified, this optional parameter indicates that the returned endpoints must belong to or be derived from the class specified in this parameter.
resultRole - [Optional] String that contains a property name. If specified, this parameter indicates that the returned endpoints must play a particular role in their association with the source object. The role is defined by the name of a specified property (which must be a reference property) of an association.
role - [Optional] String that contains a property name. If specified, this parameter indicates that the returned endpoints must participate in an association with the source object in which the source object plays a particular role. The role is defined by the name of a specified property (which must be a reference property) of an association.
classesOnly - [Optional] Boolean value that indicates whether a list of class names should be returned rather than actual instances of the classes. These are the classes to which the endpoint instances belong. The default value for this parameter is FALSE.
schemaOnly - [Optional] Boolean value that indicates whether the query applies to the schema rather than the data. The default value for this parameter is FALSE. It can only be set to TRUE if the strObjectPath parameter specifies the object path of a class. When set to TRUE, the set of returned endpoints represent classes that are suitably associated with the source class in schema.
requiredAssocQualifier - [Optional] String that contains a qualifier name. If specified, this parameter indicates that the returned endpoints must be associated with the source object through an association class that includes the specified qualifier.
requiredQualifier - [Optional] String that contains a qualifier name. If specified, this parameter indicates that the returned endpoints must include the specified qualifier.
flags - [Optional] Integer that specifies additional flags to the operation. The default value for this parameter is wbemFlagReturnImmediately, which calls the method in the semisynchronous mode. This parameter can accept the following values.
objwbemNamedValueSet - [Optional] Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
返回:
If successful a SWbemObjectSet will be returned.
抛出:
WMIException

associators

public SWbemObjectSet associators()
                           throws WMIException
Use default parameters for method associators(String, String, String, String, Boolean, Boolean, String, String, SWbemNamedValueSet, cn.chenlichao.wmi4j.consts.Flags.AssociatorsFlag...)

抛出:
WMIException

wmiClone

public SWbemObject wmiClone()
                     throws WMIException
Returns a new object that is a clone of the current object.

返回:
A new object that is a clone of the current object.
抛出:
WMIException

compareTo

public boolean compareTo(SWbemObject wbemObject,
                         Flags.CompareToFlag... flags)
                  throws WMIException
Compares two SWbemObject objects. This comparison is subject to certain constraints based on the values specified in the flags parameter.

参数:
wbemObject - This is the object with which the first object is compared. The object must be a valid SWbemObject instance.
flags - [Optional] Specifies the object characteristics to consider when comparing an object with other objects. You can use wbemComparisonFlagIncludeAll to consider all features (this is the default), or any combination of the following values.
返回:
This method returns the Boolean value of TRUE if the objects match. It returns FALSE if the objects do not match.
抛出:
WMIException

compareTo

public boolean compareTo(SWbemObject wbemObject)
                  throws WMIException
Use default parameters for #compareTo(SWbemObject, Flags.CompareToFlag...

抛出:
WMIException

delete

public void delete(Integer flags,
                   SWbemNamedValueSet objWbemNamedValueSet)
            throws WMIException
Deletes either the current class or the current instance. If a dynamic provider supplies the class or instance, it is sometimes not possible to delete this object unless the provider supports class or instance deletion.

参数:
flags - Reserved and must be 0 (zero) if specified.
objWbemNamedValueSet - [Optional] Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
抛出:
WMIException

delete

public void delete()
            throws WMIException
Use default parameters for delete(Integer, SWbemNamedValueSet)

抛出:
WMIException

execMethod

public SWbemObject execMethod(String methodName,
                              SWbemObject inParameters,
                              Integer flags,
                              SWbemNamedValueSet objWbemNamedValueSet)
                       throws WMIException
Executes a method exported by a method provider. This method pauses while the method that is forwarded to the appropriate provider executes. The information and status are then returned. The provider rather than WMI implements the method

参数:
methodName - Name of the method for the object.
inParameters - [Optional] An SWbemObject object that contains the input parameters for the method being executed. By default, this parameter is undefined.
flags - [Optional] Reserved. This value must be zero.
objWbemNamedValueSet - [Optional] Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
返回:
If the method is successful, an SWbemObject object is returned. The returned object contains the out parameters and return value for the method that is being executed.
抛出:
WMIException

execMethod

public SWbemObject execMethod(String methodName,
                              SWbemObject inParameters)
                       throws WMIException
Use default parameters for execMethod(String, SWbemObject, Integer, SWbemNamedValueSet)

抛出:
WMIException

execMethod

public SWbemObject execMethod(String methodName)
                       throws WMIException
Use default parameters for execMethod(String, SWbemObject, Integer, SWbemNamedValueSet)

抛出:
WMIException

getObjectText

public String getObjectText(Integer flags)
                     throws WMIException
Returns a textual rendering of the object. This object can be used to display an object's contents. Currently, only the MOF syntax is supported as an output format. Notice that the MOF text returned does not contain all the information about the object; the MOF text contains only enough information for the MOF compiler to be able to re-create the original object. For instance, there is no information about the propagated qualifiers or the parent class properties.

参数:
flags - [Optional] Reserved. This value must be zero.
返回:
If successful, this method returns a string that contains the output text.
抛出:
WMIException

getObjectText

public String getObjectText()
                     throws WMIException
Use default parameters for getObjectText(Integer)

抛出:
WMIException

instances

public SWbemObjectSet instances(SWbemNamedValueSet objWbemNamedValueSet,
                                Flags.InstancesFlag... flags)
                         throws WMIException
Creates an enumerator that returns the instances of the current class object. This method implements a simple query. More complex queries may require the use of SWbemServices.execQuery().

参数:
flags - [Optional] Integer that determines the behavior of the call.
objWbemNamedValueSet - [Optional] Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
返回:
The instances of the current class object.
抛出:
WMIException

instances

public SWbemObjectSet instances()
                         throws WMIException
Use default parameters for instances(SWbemNamedValueSet, Flags.InstancesFlag...)

抛出:
WMIException

put

public SWbemObjectPath put(SWbemNamedValueSet objWbemNamedValueSet,
                           Flags.PutFlag... flags)
                    throws WMIException
Creates or updates an instance or a class object to Windows Management Instrumentation (WMI). You can use this method after you modify any properties or methods in an SWbemObject, and your changes are written to WMI.

参数:
flags - [Optional] Determines if the call creates or updates the class or instance and if the call returns immediately.
objWbemNamedValueSet - [Optional] Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
返回:
SWbemObjectPath object contains the object path of the instance or class that has been successfully committed to WMI.
抛出:
WMIException

put

public SWbemObjectPath put()
                    throws WMIException
Use default parameters for put(SWbemNamedValueSet, cn.chenlichao.wmi4j.consts.Flags.PutFlag...)

抛出:
WMIException

references

public SWbemObjectSet references(String resultClass,
                                 String role,
                                 Boolean classesOnly,
                                 Boolean schemaOnly,
                                 String requiredQualifier,
                                 SWbemNamedValueSet objWbemNamedValueSet,
                                 Flags.ReferenceFlag... flags)
                          throws WMIException
Returns a collection of all association classes or instances that refer to the current object. This method performs the same function as the REFERENCES OF WQL query.

参数:
resultClass - [Optional] String that contains a class name. If specified, this optional parameter indicates that the returned endpoints must belong to or be derived from the class specified in this parameter.
role - [Optional] String that contains a property name. If specified, this parameter indicates that the returned endpoints must participate in an association with the source object in which the source object plays a particular role. The role is defined by the name of a specified property (which must be a reference property) of an association.
classesOnly - [Optional] Boolean value that indicates whether a list of class names should be returned rather than actual instances of the classes. These are the classes to which the endpoint instances belong. The default value for this parameter is FALSE.
schemaOnly - [Optional] Boolean value that indicates whether the query applies to the schema rather than the data. The default value for this parameter is FALSE. It can only be set to TRUE if the strObjectPath parameter specifies the object path of a class. When set to TRUE, the set of returned endpoints represent classes that are suitably associated with the source class in schema.
requiredQualifier - [Optional] String that contains a qualifier name. If specified, this parameter indicates that the returned endpoints must include the specified qualifier.
flags - [Optional] Integer that specifies additional flags to the operation. The default value for this parameter is wbemFlagReturnImmediately, which calls the method in the semisynchronous mode. This parameter can accept the following values.
objWbemNamedValueSet - [Optional] Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
返回:
If successful a SWbemObjectSet will be returned.
抛出:
WMIException

references

public SWbemObjectSet references()
                          throws WMIException
Use default parameters for references(String, String, Boolean, Boolean, String, SWbemNamedValueSet, cn.chenlichao.wmi4j.consts.Flags.ReferenceFlag...)

抛出:
WMIException

spawnDerivedClass

public SWbemObject spawnDerivedClass(Integer flags)
                              throws WMIException
Create a derived class object from the current object. The object must be a class definition that becomes the parent class of the spawned object.

参数:
flags - [Optional] Reserved. This value must be zero.
返回:
SWbemObject object contains the new class definition object. No object returns when there is an error.
抛出:
WMIException

spawnDerivedClass

public SWbemObject spawnDerivedClass()
                              throws WMIException
Use default parameters for spawnDerivedClass(Integer)

抛出:
WMIException

spawnInstance

public SWbemObject spawnInstance(Integer flags)
                          throws WMIException
Create a new instance of a class. The current object must be a class definition obtained from WMI via a method such as SWbemServices.get() or SWbemServices.execQuery(). Then, use this class definition to create new instances. Create each new instance locally within the process, and then call SWbemObject.put() to actually create the instance within WMI.

Note: Spawning an instance from an instance is supported, but the returned instance is empty.

参数:
flags - [Optional] Reserved. This value must be zero.
返回:
Returns an SWbemObject object that contains a new instance of the class.
抛出:
WMIException

spawnInstance

public SWbemObject spawnInstance()
                          throws WMIException
Use default parameters for spawnInstance(Integer)

抛出:
WMIException

subclasses

public SWbemObjectSet subclasses(SWbemNamedValueSet objWbemNamedValueSet,
                                 Flags.SubclassesFlag... flags)
                          throws WMIException
Returns an SWbemObjectSet object. This object is a collection of subclasses of the current object, which must be a class. Items in the returned collection can be obtained using standard collection methods.

参数:
flags - [Optional] Determines how detailed the call enumerates. The default values for this parameter are wbemFlagReturnImmediately and wbemQueryFlagDeep.
objWbemNamedValueSet - [Optional] Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
返回:
If successful a SWbemObjectSet contains subclasses of the current object will be returned.
抛出:
WMIException

subclasses

public SWbemObjectSet subclasses()
                          throws WMIException
Use default parameters for subclasses(SWbemNamedValueSet, cn.chenlichao.wmi4j.consts.Flags.SubclassesFlag...)

抛出:
WMIException

getDerivation

public List<String> getDerivation()
                           throws WMIException
An array of strings that describe the class derivation hierarchy for the instance being referenced. The first element in the array defines the parent class and the last element defines the dynasty class.

This property is read-only.

返回:
An array of strings that describe the class derivation hierarchy for the instance being referenced.
抛出:
WMIException

getMethods

public SWbemMethodSet getMethods()
                          throws WMIException
Returns an SWbemMethodSet object that is a collection of the methods for the current class or instance. This property is read-only.

返回:
A collection of the methods for the current class or instance.
抛出:
WMIException

getInParametersByMethodName

public SWbemObject getInParametersByMethodName(String methodName)
                                        throws WMIException
Get an SWbemObject object whose properties define the input parameters for the specified method.

参数:
methodName - Name of the method for the in parameters.
返回:
An SWbemObject object whose properties define the input parameters for the specified method.
抛出:
WMIException

getPath

public SWbemObjectPath getPath()
                        throws WMIException
Returns an SWbemObjectPath object that represents the object path of the current class or instance. This property can be passed as a parameter to methods that require an object path.

Remark

Only the class property of the returned SWbemObjectPath instance can be modified. If you try to modify any other property, or try to call the methods SWbemObjectPath.setAsClass() or SWbemObjectPath.setAsSingleton() you will get a WMIException.

Because of this, you cannot modify the SWbemNamedValueSet object that is the value of the keys property of the returned SWbemObjectPath instance. If you try to call the Add, Remove, or DeleteAll methods on this value, you will get a WMIException. Furthermore, you cannot modify any SWbemNamedValue obtained from this collection. Attempts to modify the value property return the same error.

However, if you call wmiClone() to create a copy, the SWbemObjectPath.path property of the copy is fully modifiable.

返回:
SWbemObjectPath object that represents the object path of the current class or instance.
抛出:
WMIException

getProperties

public SWbemPropertySet getProperties()
                               throws WMIException
Returns an SWbemPropertySet object that is a collection of the properties for the current class or instance. This property is read-only.

返回:
An SWbemPropertySet object that is a collection of the properties for the current class or instance.
抛出:
WMIException

getPropertyByName

public WMIVariant getPropertyByName(String propertyName)
                             throws WMIException
Get the variant value of the specified WMI property.

参数:
propertyName - Name of the property.
返回:
The variant value of the specified WMI property.
抛出:
WMIException

setPropertyByName

public void setPropertyByName(String propertyName,
                              WMIVariant value)
                       throws WMIException
Set the variant value of the specified WMI property

参数:
propertyName - Name of the property.
value - The variant value of the property
抛出:
WMIException

getQualifiers

public SWbemQualifierSet getQualifiers()
                                throws WMIException
Returns an SWbemQualifierSet object that is a collection of the qualifiers for the current class or instance. This property is read-only.

返回:
An SWbemQualifierSet object that is a collection of the qualifiers for the current class or instance.
抛出:
WMIException


Copyright © 2014. All rights reserved.