Package org.opennms.protocols.wmi
Class WmiClient
- java.lang.Object
-
- org.opennms.protocols.wmi.WmiClient
-
- All Implemented Interfaces:
IWmiClient
public class WmiClient extends Object implements IWmiClient
This is a low-level WMI client harnessing DCOM to communicate with remote agents. The interface provided is similar but not identical to that of the SWbemServices interface.
- Author:
- Matt Raykowski, OpenNMS
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect(String domain, String username, String password, String namespace)connectstatic ObjectconvertToNativeType(org.jinterop.dcom.core.JIVariant type)convertToNativeTypestatic DateconvertWmiDate(String dateStr)convertWmiDatevoiddisconnect()disconnectOnmsWbemObjectSetperformExecQuery(String strQuery)performExecQueryOnmsWbemObjectSetperformExecQuery(String strQuery, String strQueryLanguage, Integer flags)performExecQueryOnmsWbemObjectSetperformInstanceOf(String wmiClass)performInstanceOfOnmsWbemObjectSetperformSubclassOf()performSubclassOfOnmsWbemObjectSetperformSubclassOf(String strSuperClass)performSubclassOfOnmsWbemObjectperformWmiGet(String strObjectPath)performWmiGet
-
-
-
Constructor Detail
-
WmiClient
public WmiClient(String address) throws WmiException
Constructor for WmiClient.
- Parameters:
address- aStringobject.- Throws:
WmiException- if any.
-
-
Method Detail
-
performInstanceOf
public OnmsWbemObjectSet performInstanceOf(String wmiClass) throws WmiException
performInstanceOf
- Specified by:
performInstanceOfin interfaceIWmiClient- Parameters:
wmiClass- aStringobject.- Returns:
- a
OnmsWbemObjectSetobject. - Throws:
WmiException- if any.
-
performExecQuery
public OnmsWbemObjectSet performExecQuery(String strQuery) throws WmiException
performExecQuery
- Specified by:
performExecQueryin interfaceIWmiClient- Parameters:
strQuery- aStringobject.- Returns:
- a
OnmsWbemObjectSetobject. - Throws:
WmiException- if any.
-
performExecQuery
public OnmsWbemObjectSet performExecQuery(String strQuery, String strQueryLanguage, Integer flags) throws WmiException
performExecQuery
- Specified by:
performExecQueryin interfaceIWmiClient- Parameters:
strQuery- aStringobject.strQueryLanguage- aStringobject.flags- aIntegerobject.- Returns:
- a
OnmsWbemObjectSetobject. - Throws:
WmiException- if any.
-
performWmiGet
public OnmsWbemObject performWmiGet(String strObjectPath) throws WmiException
performWmiGet
- Parameters:
strObjectPath- aStringobject.- Returns:
- a
OnmsWbemObjectobject. - Throws:
WmiException- if any.
-
performSubclassOf
public OnmsWbemObjectSet performSubclassOf(String strSuperClass) throws WmiException
performSubclassOf
- Parameters:
strSuperClass- aStringobject.- Returns:
- a
OnmsWbemObjectSetobject. - Throws:
WmiException- if any.
-
performSubclassOf
public OnmsWbemObjectSet performSubclassOf() throws WmiException
performSubclassOf
- Returns:
- a
OnmsWbemObjectSetobject. - Throws:
WmiException- if any.
-
convertToNativeType
public static Object convertToNativeType(org.jinterop.dcom.core.JIVariant type) throws WmiException
convertToNativeType
- Parameters:
type- aJIVariantobject.- Returns:
- a
Objectobject. - Throws:
WmiException- if any.
-
connect
public void connect(String domain, String username, String password, String namespace) throws WmiException
connect
- Specified by:
connectin interfaceIWmiClient- Parameters:
domain- aStringobject.username- aStringobject.password- aStringobject.namespace- aStringobject.- Throws:
WmiException- if any.
-
disconnect
public void disconnect() throws WmiExceptiondisconnect
- Specified by:
disconnectin interfaceIWmiClient- Throws:
WmiException- if any.
-
convertWmiDate
public static Date convertWmiDate(String dateStr) throws ParseException
convertWmiDate
- Parameters:
dateStr- aStringobject.- Returns:
- a
Dateobject. - Throws:
ParseException- if any.
-
-