|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcn.chenlichao.wmi4j.SWbemLocator
public class SWbemLocator
You can use the methods of the SWbemLocator object to obtain an SWbemServices object that represents
a connection to a namespace on either a local computer or a remote host computer.
You can then use the methods of the SWbemServices object to access WMI.
| 构造方法摘要 | |
|---|---|
SWbemLocator(String server,
String username,
String password,
String namespace)
|
|
| 方法摘要 | ||
|---|---|---|
SWbemServices |
connectServer()
Use default parameters for connectServer(String, String, cn.chenlichao.wmi4j.consts.Flags.SecurityFlag, SWbemNamedValueSet) |
|
SWbemServices |
connectServer(String locale,
String authority,
Flags.SecurityFlag securityFlag,
SWbemNamedValueSet objwbemNamedValueSet)
The ConnectServer method of the SWbemLocator object connects to the namespace on the computer
that is specified in the strServer parameter. |
|
|
createObject(Class<T> objectType)
|
|
void |
disconnect()
Disconnect from server and release resources |
|
SWbemServices |
getSWbemServices()
Obtain SWbemServices object;
Note: Before call this method, you need call connectServer first,
to generate SWbemServices object. |
|
boolean |
isConnected()
Verify if the connection is living. |
|
| 从类 java.lang.Object 继承的方法 |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public SWbemLocator(String server,
String username,
String password,
String namespace)
server - Computer name or ip to which you are connecting.username - User name to use to connect. The string can be in the form of either a user name or a Domain\Username.password - String that specifies the password to use when attempting to connect.namespace - String that specifies the namespace to which you log on.
Note: Optional parameter, if you set it to null, then use the default namespace root\CIMv2
| 方法详细信息 |
|---|
public SWbemServices connectServer(String locale,
String authority,
Flags.SecurityFlag securityFlag,
SWbemNamedValueSet objwbemNamedValueSet)
throws WMIException,
UnknownHostException
The ConnectServer method of the SWbemLocator object connects to the namespace on the computer
that is specified in the strServer parameter. The target computer can be either local or remote,
but it must have WMI installed. For examples and a comparison with the moniker type of connection,
see Creating a WMI Script.
Starting with Windows Vista, SWbemLocator.connectServer can connect with computers running IPv6 using an IPv6 address in the strServer parameter. For more information, see IPv6 and IPv4 Support in WMI.
Windows Server 2003 and Windows XP: You only can use SWbemLocator.connectServer to connect to computers with IPv4 addresses.
locale - Optional. String that specifies the localization code. If you want to use the current locale, set to null.
If not null, this parameter must be a string that indicates the desired locale where information must be retrieved.
For Microsoft locale identifiers, the format of the string is "MS_xxxx",
where xxxx is a string in the hexadecimal form that indicates the LCID.
For example, American English would appear as "MS_409".authority - Optional. This parameter is optional. However,
if it is specified, only Kerberos or NTLMDomain can be used.
If the strAuthority parameter begins with the string "Kerberos:",
then Kerberos authentication is used and this parameter should contain a Kerberos principal name.
The Kerberos principal name is specified as Kerberos:domain, such as Kerberos:fabrikam
where fabrikam is the server to which you are attempting to connect.
Example: "Kerberos:DOMAIN"
To use NT Lan Manager (NTLM) authentication, you must specify it as NTLMDomain:domain,
such as NTLMDomain:fabrikam where fabrikam is the name of the domain.
Example: "NTLMDomain:DOMAIN"
securityFlag - Optional. Used to pass flag values to connectServer method.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.
SWbemServices object that is bound to the namespace
that is specified in namespace parameter on the computer that is specified in server parameter.
WMIException - Failed to connect to the server.
UnknownHostException
public SWbemServices connectServer()
throws WMIException,
UnknownHostException
connectServer(String, String, cn.chenlichao.wmi4j.consts.Flags.SecurityFlag, SWbemNamedValueSet)
WMIException
UnknownHostExceptionpublic SWbemServices getSWbemServices()
SWbemServices object;
Note: Before call this method, you need call connectServer first,
to generate SWbemServices object.
SWbemServices object
IllegalStateException - If call before connect to the server.
public <T> T createObject(Class<T> objectType)
throws WMIException
WMIException
public void disconnect()
throws WMIException
WMIExceptionpublic boolean isConnected()
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||