use of org.jinterop.dcom.common.JIException 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);
}
}
use of org.jinterop.dcom.common.JIException in project opennms by OpenNMS.
the class OnmsWbemMethodSetImpl method get.
/** {@inheritDoc} */
@Override
public OnmsWbemMethod get(final Integer idx) throws WmiException {
try {
final IJIComObject enumComObject = wbemMethodSetDispatch.get("_NewEnum").getObjectAsComObject();
final IJIEnumVariant enumVariant = (IJIEnumVariant) JIObjectFactory.narrowObject(enumComObject.queryInterface(IJIEnumVariant.IID));
OnmsWbemMethod wbemMethod;
IJIDispatch wbemMethod_dispatch = null;
for (int i = 0; i < (idx + 1); i++) {
final Object[] values = enumVariant.next(1);
final JIArray array = (JIArray) values[0];
final Object[] arrayObj = (Object[]) array.getArrayInstance();
for (int j = 0; j < arrayObj.length; j++) {
wbemMethod_dispatch = (IJIDispatch) JIObjectFactory.narrowObject(((JIVariant) arrayObj[j]).getObjectAsComObject());
}
}
wbemMethod = new OnmsWbemMethodImpl(wbemMethod_dispatch);
return wbemMethod;
} catch (final JIException e) {
throw new WmiException("Failed to enumerate WbemObject variant: " + e.getMessage(), e);
}
}
use of org.jinterop.dcom.common.JIException in project opennms by OpenNMS.
the class OnmsWbemObjectImpl method getWmiMethods.
/**
* <p>getWmiMethods</p>
*
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemMethodSet} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
@Override
public OnmsWbemMethodSet getWmiMethods() throws WmiException {
try {
// Get the WbemMethodSet dispatcher.
final IJIComObject methodComObject = wbemObjectDispatch.get("Methods_").getObjectAsComObject();
final IJIDispatch methodsSet_dispatch = (IJIDispatch) JIObjectFactory.narrowObject(methodComObject);
return new OnmsWbemMethodSetImpl(methodsSet_dispatch);
} catch (final JIException e) {
throw new WmiException("Failed to retrieve list of methods: " + e.getMessage(), e);
}
}
use of org.jinterop.dcom.common.JIException in project opennms by OpenNMS.
the class OnmsWbemObjectImpl method getWmiPath.
/**
* <p>getWmiPath</p>
*
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemObjectPath} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
@Override
public OnmsWbemObjectPath getWmiPath() throws WmiException {
try {
// Get the WbemMethodSet dispatcher.
final IJIComObject pathComObject = wbemObjectDispatch.get("Path_").getObjectAsComObject();
final IJIDispatch path_dispatch = (IJIDispatch) JIObjectFactory.narrowObject(pathComObject);
return new OnmsWbemObjectPathImpl(path_dispatch);
} catch (final JIException e) {
throw new WmiException("Failed to retrieve object path: " + e.getMessage(), e);
}
}
use of org.jinterop.dcom.common.JIException in project opennms by OpenNMS.
the class OnmsWbemObjectImpl method getWmiProperties.
/**
* <p>getWmiProperties</p>
*
* @return a {@link org.opennms.protocols.wmi.wbem.OnmsWbemPropertySet} object.
* @throws org.opennms.protocols.wmi.WmiException if any.
*/
@Override
public OnmsWbemPropertySet getWmiProperties() throws WmiException {
try {
// Get the WbemMethodSet dispatcher.
final IJIComObject propsSetComObject = wbemObjectDispatch.get("Properties_").getObjectAsComObject();
final IJIDispatch propSet_dispatch = (IJIDispatch) JIObjectFactory.narrowObject(propsSetComObject);
return new OnmsWbemPropertySetImpl(propSet_dispatch);
} catch (final JIException e) {
throw new WmiException("Failed to retrieve object property set: " + e.getMessage(), e);
}
}
Aggregations