Search in sources :

Example 1 with OnmsWbemObjectImpl

use of org.opennms.protocols.wmi.wbem.jinterop.OnmsWbemObjectImpl in project opennms by OpenNMS.

the class WmiClient method performWmiGet.

/**
     * <p>performWmiGet</p>
     *
     * @param strObjectPath a {@link java.lang.String} object.
     * @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemObject} object.
     * @throws org.opennms.protocols.wmi.WmiException if any.
     */
public OnmsWbemObject performWmiGet(final String strObjectPath) throws WmiException {
    try {
        final JIVariant[] results = m_WbemServices.callMethodA("Get", new Object[] { new JIString(strObjectPath), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM() });
        final IJIDispatch obj_dsp = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
        return new OnmsWbemObjectImpl(obj_dsp);
    } catch (final JIException e) {
        throw new WmiException("Failed to perform get '" + strObjectPath + "': " + e.getMessage(), e);
    }
}
Also used : JIVariant(org.jinterop.dcom.core.JIVariant) OnmsWbemObjectImpl(org.opennms.protocols.wmi.wbem.jinterop.OnmsWbemObjectImpl) JIString(org.jinterop.dcom.core.JIString) IJIDispatch(org.jinterop.dcom.impls.automation.IJIDispatch) JIException(org.jinterop.dcom.common.JIException)

Aggregations

JIException (org.jinterop.dcom.common.JIException)1 JIString (org.jinterop.dcom.core.JIString)1 JIVariant (org.jinterop.dcom.core.JIVariant)1 IJIDispatch (org.jinterop.dcom.impls.automation.IJIDispatch)1 OnmsWbemObjectImpl (org.opennms.protocols.wmi.wbem.jinterop.OnmsWbemObjectImpl)1