void displayValues() throws JIException { System.out.println("ACStatus: " + dispatch.get("ACStatus").getObjectAsShort()); System.out.println("BatteryFullTime: " + dispatch.get("BatteryFullTime").getObjectAsInt()); System.out.println("BatteryLifePercent: " + dispatch.get("BatteryLifePercent").getObjectAsShort()); System.out.println("BatteryLifeTime: " + dispatch.get("BatteryLifeTime").getObjectAsInt()); System.out.println("BatteryStatus: " + dispatch.get("BatteryStatus").getObjectAsShort()); System.out.println("OSVersion: " + dispatch.get("OSVersion").getObjectAsFloat()); //dispatch.callMethod("AboutBox"); }
void displayValues() throws JIException { System.out.println("ACStatus: " + dispatch.get("ACStatus").getObjectAsShort()); System.out.println("BatteryFullTime: " + dispatch.get("BatteryFullTime").getObjectAsInt()); System.out.println("BatteryLifePercent: " + dispatch.get("BatteryLifePercent").getObjectAsShort()); System.out.println("BatteryLifeTime: " + dispatch.get("BatteryLifeTime").getObjectAsInt()); System.out.println("BatteryStatus: " + dispatch.get("BatteryStatus").getObjectAsShort()); System.out.println("OSVersion: " + dispatch.get("OSVersion").getObjectAsFloat()); //dispatch.callMethod("AboutBox"); }
void displayValues () throws JIException { System.out.println ( "ACStatus: " + this.dispatch.get ( "ACStatus" ).getObjectAsShort () ); System.out.println ( "BatteryFullTime: " + this.dispatch.get ( "BatteryFullTime" ).getObjectAsInt () ); System.out.println ( "BatteryLifePercent: " + this.dispatch.get ( "BatteryLifePercent" ).getObjectAsShort () ); System.out.println ( "BatteryLifeTime: " + this.dispatch.get ( "BatteryLifeTime" ).getObjectAsInt () ); System.out.println ( "BatteryStatus: " + this.dispatch.get ( "BatteryStatus" ).getObjectAsShort () ); System.out.println ( "OSVersion: " + this.dispatch.get ( "OSVersion" ).getObjectAsFloat () ); //dispatch.callMethod("AboutBox"); }
/** * <p>getWmiCIMType</p> * * @return a {@link java.lang.Integer} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public Integer getWmiCIMType() throws WmiException { try { return wbemPropertyDispatch.get("CIMType").getObjectAsInt(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemProperty CIMType attribute: " + e.getMessage(), e); } }
/** * <p>count</p> * * @return a {@link java.lang.Integer} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public Integer count() throws WmiException { try { final JIVariant Count = wbemPropertySetDispatch.get("Count"); return Count.getObjectAsInt(); } catch (final JIException e) { throw new WmiException("Retrieving Count failed: " + e.getMessage(), e); } }
/** * <p>getWmiCIMType</p> * * @return a {@link java.lang.Integer} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public Integer getWmiCIMType() throws WmiException { try { return wbemPropertyDispatch.get("CIMType").getObjectAsInt(); } catch (final JIException e) { throw new WmiException("Unable to retrieve WbemProperty CIMType attribute: " + e.getMessage(), e); } }
/** * <p>getCount</p> * * @return a {@link java.lang.Integer} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public Integer getCount() throws WmiException { try { return wbemMethodSetDispatch.get("Count").getObjectAsInt(); } catch(final JIException e) { throw new WmiException("Failed to retrieve Method Set count: " + e.getMessage(), e); } }
/** * <p>count</p> * * @return a {@link java.lang.Integer} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public Integer count() throws WmiException { try { return wbemObjectSet.get("Count").getObjectAsInt(); } catch (final JIException e) { throw new WmiException("Retrieving Count failed: " + e.getMessage(), e); } }
/** * <p>count</p> * * @return a {@link java.lang.Integer} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public Integer count() throws WmiException { try { return wbemObjectSet.get("Count").getObjectAsInt(); } catch (final JIException e) { throw new WmiException("Retrieving Count failed: " + 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()); } }
/** * <p>count</p> * * @return a {@link java.lang.Integer} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public Integer count() throws WmiException { try { final JIVariant Count = wbemPropertySetDispatch.get("Count"); return Count.getObjectAsInt(); } catch (final JIException e) { throw new WmiException("Retrieving Count failed: " + e.getMessage(), e); } }
/** * <p>getCount</p> * * @return a {@link java.lang.Integer} object. * @throws org.opennms.protocols.wmi.WmiException if any. */ @Override public Integer getCount() throws WmiException { try { return wbemMethodSetDispatch.get("Count").getObjectAsInt(); } catch(final JIException e) { throw new WmiException("Failed to retrieve Method Set count: " + e.getMessage(), e); } }
for ( int j = 0; j < arrayObj.length; j++ ) System.out.println ( ( (JIVariant)arrayObj[j] ).getObjectAsInt () + "," + ( (Integer)values[1] ).intValue () );
final int count = fields.get ( "Count" ).getObjectAsInt (); for ( int i = 0; i < count; i++ ) val = new Integer ( variant2.getObjectAsInt () );
for (int j = 0; j < arrayObj.length; j++) System.out.println(((JIVariant)arrayObj[j]).getObjectAsInt() + "," + ((Integer)values[1]).intValue());
return type.getObjectAsShort(); case JIVariant.VT_I4: return type.getObjectAsInt(); case JIVariant.VT_UI1: // uint8 (convert to Java Number) return type.getObjectAsUnsigned().getValue();
int count = Count.getObjectAsInt(); for (int i = 0; i < count; i++)
int count = Count.getObjectAsInt(); for (int i = 0; i < count; i++)
public void performOp () throws JIException, InterruptedException { // IJIDispatch securityDisp = (IJIDispatch)JIObjectFactory.narrowObject(dispatch.get("Security_").getObjectAsComObject()); // securityDisp.put("ImpersonationLevel", new JIVariant(3)); JIVariant results[] = this.dispatch.callMethodA ( "ConnectServer", new Object[] { JIVariant.OPTIONAL_PARAM (), new JIString ( "ROOT\\CIMV2" ), JIVariant.OPTIONAL_PARAM (), JIVariant.OPTIONAL_PARAM (), JIVariant.OPTIONAL_PARAM (), JIVariant.OPTIONAL_PARAM (), new Integer ( 0 ), JIVariant.OPTIONAL_PARAM () } ); final IJIDispatch wbemServices_dispatch = (IJIDispatch)JIObjectFactory.narrowObject ( results[0].getObjectAsComObject () ); results = wbemServices_dispatch.callMethodA ( "ExecQuery", new Object[] { new JIString ( "select * from Win32_OperatingSystem where Primary=True" ), JIVariant.OPTIONAL_PARAM (), JIVariant.OPTIONAL_PARAM (), JIVariant.OPTIONAL_PARAM () } ); final IJIDispatch wbemObjectSet_dispatch = (IJIDispatch)JIObjectFactory.narrowObject ( results[0].getObjectAsComObject () ); final JIVariant variant = wbemObjectSet_dispatch.get ( "_NewEnum" ); final IJIComObject object2 = variant.getObjectAsComObject (); final IJIEnumVariant enumVARIANT = (IJIEnumVariant)JIObjectFactory.narrowObject ( object2.queryInterface ( IJIEnumVariant.IID ) ); final JIVariant Count = wbemObjectSet_dispatch.get ( "Count" ); final int count = Count.getObjectAsInt (); 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++ ) { final IJIDispatch wbemObject_dispatch = (IJIDispatch)JIObjectFactory.narrowObject ( ( (JIVariant)arrayObj[j] ).getObjectAsComObject () ); final JIVariant variant2 = wbemObject_dispatch.callMethodA ( "GetObjectText_", new Object[] { new Integer ( 1 ) } )[0]; System.out.println ( variant2.getObjectAsString ().getString () ); System.out.println ( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" ); } } }
return type.getObjectAsShort(); case JIVariant.VT_I4: return type.getObjectAsInt(); case JIVariant.VT_UI1: // uint8 (convert to Java Number) return type.getObjectAsUnsigned().getValue();