public class WmiManager extends Object
This provides an easy abtraction of the WmiClient functionality. It allows programmers to make simple WMI Class + WMI Object queries and then measure the resulting values against parameters. The purpose of the WMI Manager is to provide poller-style functionality where low-level access to WBEM objects and methods is not essential.
| Modifier and Type | Field and Description | 
|---|---|
static int | 
DEFAULT_SOCKET_TIMEOUT
The default socket timeout. 
 | 
| Constructor and Description | 
|---|
WmiManager(String host,
          String user,
          String pass)
Constructor. 
 | 
WmiManager(String host,
          String user,
          String pass,
          String domain)
Constructor. 
 | 
WmiManager(String host,
          String user,
          String pass,
          String domain,
          String matchType)
Constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()
close 
 | 
String | 
getHostName()
Returns the host name being used to connect to the remote service. 
 | 
String | 
getMatchType()
getMatchType 
 | 
String | 
getNamespace()
getNamespace 
 | 
int | 
getTimeout()
Returns the TCP socket timeout used when connecting to the remote
 service. 
 | 
void | 
init()
This creates a new WmiClient and creates a connection to the host. 
 | 
void | 
init(IWmiClient client)
This is for tests to harness and create a mock client. 
 | 
static boolean | 
isValidMatchType(String matchType)
isValidMatchType 
 | 
static boolean | 
isValidOpType(String opType)
isValidOpType 
 | 
WmiResult | 
performExecQuery(WmiParams params)
performExecQuery 
 | 
WmiResult | 
performInstanceOf(WmiParams params)
performInstanceOf 
 | 
WmiResult | 
performOp(WmiParams params)
performOp 
 | 
void | 
setHostName(String host)
This method is used to set the host name to connect to for performing
 remote service checks. 
 | 
void | 
setMatchType(String matchType)
setMatchType 
 | 
void | 
setNamespace(String namespace)
setNamespace 
 | 
void | 
setPassword(String pass)
This method is used for setting the password used to perform service
 checks. 
 | 
void | 
setTimeout(int timeout)
This method is used to set the TCP socket timeout to be used when
 connecting to the remote service. 
 | 
public static int DEFAULT_SOCKET_TIMEOUT
public WmiManager(String host, String user, String pass)
host - sets the host name to connect to.user - sets the username to connect withpass - sets the password to connect with.public WmiManager(String host, String user, String pass, String domain)
host - sets the host name to connect to.user - sets the username to connect withpass - sets the password to connect with.domain - sets the domain to connect to.public WmiManager(String host, String user, String pass, String domain, String matchType)
host - sets the host name to connect to.user - sets the username to connect withpass - sets the password to connect with.domain - sets the domain to connect to.matchType - the type of matching to be used for multiple results: all, none, some, one.public void setPassword(String pass)
pass - the password to use when performing service checks.public void setHostName(String host)
host - the host name to connect to.initpublic String getHostName()
public void setTimeout(int timeout)
init or it will have no effect.timeout - the TCP socket timeout.public int getTimeout()
public static boolean isValidMatchType(String matchType)
isValidMatchType
matchType - a String object.public static boolean isValidOpType(String opType)
isValidOpType
opType - a String object.public void init()
          throws WmiException
WmiException - An exception will be thrown if the system is unable to look
             up the host and if J-Interop throws an exception this will
             re-throw that exception so that implementors need not know
             J-Interop exceptions.public void init(IWmiClient client) throws WmiException
client - allows a IWmiClient to be pre-instantiated. Used for mock testing.WmiException - is thrown if there are any problems connecting.public void close()
           throws WmiException
close
WmiException - if any.public WmiResult performOp(WmiParams params) throws WmiException
performOp
params - a WmiParams object.WmiResult object.WmiException - if any.public WmiResult performExecQuery(WmiParams params) throws WmiException
performExecQuery
params - a WmiParams object.WmiResult object.WmiException - if any.public WmiResult performInstanceOf(WmiParams params) throws WmiException
performInstanceOf
params - a WmiParams object.WmiResult object.WmiException - if any.public String getMatchType()
getMatchType
public void setMatchType(String matchType)
setMatchType
matchType - the m_MatchType to setpublic String getNamespace()
getNamespace
public void setNamespace(String namespace)
setNamespace
the - m_namespace to setCopyright © 2021. All rights reserved.