private String getWmiString(final String name) throws WmiException { try { return wbemPropertyDispatch.get(name).getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemProperty " + name + " attribute: " + e.getMessage(), e); } }
/** * <p>getWmiAuthority</p> * * @return a {@link java.lang.String} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ private String getWmiString(final String name) throws WmiException { try { return wbemObjectPathDispatch.get(name).getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemObjectPath " + name + " attribute: " + e.getMessage(), e); } }
private String getWmiString(final String name) throws WmiException { try { return wbemPropertyDispatch.get(name).getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemProperty " + name + " attribute: " + e.getMessage(), e); } }
/** * <p>getWmiObjectText</p> * * @return a {@link java.lang.String} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public String getWmiObjectText() throws WmiException { try { return (wbemObjectDispatch.callMethodA("GetObjectText_", new Object[]{1}))[0].getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemObjectPath GetObjectText_ attribute: " + e.getMessage(), e); } }
/** * <p>getWmiAuthority</p> * * @return a {@link java.lang.String} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ private String getWmiString(final String name) throws WmiException { try { return wbemObjectPathDispatch.get(name).getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemObjectPath " + name + " attribute: " + e.getMessage(), e); } }
/** * <p>getWmiName</p> * * @return a {@link java.lang.String} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public String getWmiName()throws WmiException { try { return wbemMethodDispatch.get("Name").getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemMethod Name attribute: " + e.getMessage(), e); } }
/** * <p>getWmiOrigin</p> * * @return a {@link java.lang.String} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public String getWmiOrigin() throws WmiException { try { return wbemMethodDispatch.get("Origin").getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemMethod Origin attribute: " + e.getMessage(), e); } }
/** * <p>getWmiObjectText</p> * * @return a {@link java.lang.String} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public String getWmiObjectText() throws WmiException { try { return (wbemObjectDispatch.callMethodA("GetObjectText_", new Object[]{1}))[0].getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemObjectPath GetObjectText_ attribute: " + e.getMessage(), e); } }
/** * <p>getWmiName</p> * * @return a {@link java.lang.String} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public String getWmiName()throws WmiException { try { return wbemMethodDispatch.get("Name").getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemMethod Name attribute: " + e.getMessage(), e); } }
/** * <p>getWmiOrigin</p> * * @return a {@link java.lang.String} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public String getWmiOrigin() throws WmiException { try { return wbemMethodDispatch.get("Origin").getObjectAsString2(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemMethod Origin attribute: " + e.getMessage(), e); } }
private Object unmarshal(JIVariant v, Class<?> returnType) throws JIException { if(returnType==IJIDispatch.class) { return JIObjectFactory.narrowObject(v.getObjectAsComObject()); } if(JIProxy.class.isAssignableFrom(returnType)) {// typed wrapper return wrap(returnType.asSubclass(JIProxy.class),v.getObjectAsComObject()); } if(returnType==JIVariant.class) return v; if(returnType==int.class || returnType==Integer.class) return v.getObjectAsInt(); if(returnType==void.class) return null; if(returnType==String.class) return v.getObjectAsString2(); if(returnType==boolean.class) return v.getObjectAsBoolean(); throw new UnsupportedOperationException(returnType.getName()); } }
/** {@inheritDoc} */ @Override public OnmsWbemProperty getByName(final String name) throws WmiException { try { final IJIComObject enumComObject = wbemPropertySetDispatch.get("_NewEnum").getObjectAsComObject(); final IJIEnumVariant enumVariant = (IJIEnumVariant) JIObjectFactory.narrowObject(enumComObject.queryInterface(IJIEnumVariant.IID)); IJIDispatch wbemProperty_dispatch = null; for (int i = 0; i < count(); 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++) { wbemProperty_dispatch = (IJIDispatch)JIObjectFactory.narrowObject(((JIVariant)arrayObj[j]).getObjectAsComObject()); // Check the name final JIVariant variant = wbemProperty_dispatch.get("Name"); if(variant.getObjectAsString2().equalsIgnoreCase(name)) { return new OnmsWbemPropertyImpl(wbemProperty_dispatch); } } } throw new WmiException("Property Name '" + name + "' not found."); } catch(final JIException e) { throw new WmiException("Failed to enumerate WbemProperty variant: " + e.getMessage(), e); } } }
/** {@inheritDoc} */ @Override public OnmsWbemProperty getByName(final String name) throws WmiException { try { final IJIComObject enumComObject = wbemPropertySetDispatch.get("_NewEnum").getObjectAsComObject(); final IJIEnumVariant enumVariant = (IJIEnumVariant) JIObjectFactory.narrowObject(enumComObject.queryInterface(IJIEnumVariant.IID)); IJIDispatch wbemProperty_dispatch = null; for (int i = 0; i < count(); 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++) { wbemProperty_dispatch = (IJIDispatch)JIObjectFactory.narrowObject(((JIVariant)arrayObj[j]).getObjectAsComObject()); // Check the name final JIVariant variant = wbemProperty_dispatch.get("Name"); if(variant.getObjectAsString2().equalsIgnoreCase(name)) { return new OnmsWbemPropertyImpl(wbemProperty_dispatch); } } } throw new WmiException("Property Name '" + name + "' not found."); } catch(final JIException e) { throw new WmiException("Failed to enumerate WbemProperty variant: " + e.getMessage(), e); } } }