Search in sources :

Example 1 with OnmsWbemObjectSetImpl

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

the class WmiClient method performSubclassOf.

/**
     * <p>performSubclassOf</p>
     *
     * @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemObjectSet} object.
     * @throws org.opennms.protocols.wmi.WmiException if any.
     */
public OnmsWbemObjectSet performSubclassOf() throws WmiException {
    try {
        final JIVariant[] results = m_WbemServices.callMethodA("SubclassesOf", new Object[] { JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM() });
        final IJIDispatch objset_dsp = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
        return new OnmsWbemObjectSetImpl(objset_dsp);
    } catch (final JIException e) {
        throw new WmiException("Failed to perform SubclassesOf: " + e.getMessage(), e);
    }
}
Also used : JIVariant(org.jinterop.dcom.core.JIVariant) OnmsWbemObjectSetImpl(org.opennms.protocols.wmi.wbem.jinterop.OnmsWbemObjectSetImpl) IJIDispatch(org.jinterop.dcom.impls.automation.IJIDispatch) JIException(org.jinterop.dcom.common.JIException)

Example 2 with OnmsWbemObjectSetImpl

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

the class WmiClient method performSubclassOf.

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

Example 3 with OnmsWbemObjectSetImpl

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

the class WmiClient method performInstanceOf.

/** {@inheritDoc} */
@Override
public OnmsWbemObjectSet performInstanceOf(final String wmiClass) throws WmiException {
    try {
        // Execute the InstancesOf method on the remote SWbemServices object.
        final JIVariant[] results = m_WbemServices.callMethodA("InstancesOf", new Object[] { new JIString(wmiClass), 0, JIVariant.OPTIONAL_PARAM() });
        final IJIDispatch wOSd = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
        return new OnmsWbemObjectSetImpl(wOSd);
    } catch (final JIException e) {
        throw new WmiException("Failed to perform WMI operation (\\\\" + wmiClass + ") : " + e.getMessage(), e);
    }
}
Also used : JIVariant(org.jinterop.dcom.core.JIVariant) JIString(org.jinterop.dcom.core.JIString) OnmsWbemObjectSetImpl(org.opennms.protocols.wmi.wbem.jinterop.OnmsWbemObjectSetImpl) IJIDispatch(org.jinterop.dcom.impls.automation.IJIDispatch) JIException(org.jinterop.dcom.common.JIException)

Example 4 with OnmsWbemObjectSetImpl

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

the class WmiClient method performExecQuery.

/** {@inheritDoc} */
@Override
public OnmsWbemObjectSet performExecQuery(final String strQuery, final String strQueryLanguage, final Integer flags) throws WmiException {
    try {
        final JIVariant[] results = m_WbemServices.callMethodA("ExecQuery", new Object[] { new JIString(strQuery), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM() });
        final IJIDispatch wOSd = (IJIDispatch) JIObjectFactory.narrowObject((results[0]).getObjectAsComObject());
        return new OnmsWbemObjectSetImpl(wOSd);
    } catch (final JIException e) {
        throw new WmiException("Failed to execute query '" + strQuery + "': " + e.getMessage(), e);
    }
}
Also used : JIVariant(org.jinterop.dcom.core.JIVariant) JIString(org.jinterop.dcom.core.JIString) OnmsWbemObjectSetImpl(org.opennms.protocols.wmi.wbem.jinterop.OnmsWbemObjectSetImpl) IJIDispatch(org.jinterop.dcom.impls.automation.IJIDispatch) JIException(org.jinterop.dcom.common.JIException)

Aggregations

JIException (org.jinterop.dcom.common.JIException)4 JIVariant (org.jinterop.dcom.core.JIVariant)4 IJIDispatch (org.jinterop.dcom.impls.automation.IJIDispatch)4 OnmsWbemObjectSetImpl (org.opennms.protocols.wmi.wbem.jinterop.OnmsWbemObjectSetImpl)4 JIString (org.jinterop.dcom.core.JIString)3