wbemLocator.callMethodA( "ConnectServer", new Object[] { new JIString( host ), new JIString( WMI_DEFAULT_NAMESPACE ), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), new Integer( 0 ), JIVariant.OPTIONAL_PARAM() } ); wbemServices.callMethodA( "ExecNotificationQuery", new Object[] { new JIString( QUERY_FOR_ALL_LOG_EVENTS ), new JIString( "WQL" ), new JIVariant( new Integer( RETURN_IMMEDIATE + FORWARD_ONLY ) ) } ); IJIDispatch wbemEventSource = (IJIDispatch) JIObjectFactory.narrowObject( ( eventSourceSet[ 0 ] ).getObjectAsComObject() );
/**Setting up a <code>VARIANT</code> with a <code>String</code>. Used via serializing the <code>VARIANT</code>. Internally a * <code>JIString</code> is formed with it's default type <code>BSTR</code>. * * @param value */ public JIVariant(String value) { this(new JIString(value)); }
/** Helper method for creating an array of <code>BSTR</code>s , IDL signature <code>[in, out] SAFEARRAY(BSTR) *p</code>. * The return value can directly be used in an <code>IJIDispatch</code>call. * * @return */ public static JIVariant BSTRARRAY() { return new JIVariant(new JIArray(new JIString[]{new JIString("")}, true),true); }
/** Helper method for creating an array of <code>BSTR</code>s , IDL signature <code>[in, out] SAFEARRAY(BSTR) *p</code>. * The return value can directly be used in an <code>IJIDispatch</code>call. * * @return */ public static JIVariant BSTRARRAY() { return new JIVariant(new JIArray(new JIString[]{new JIString("")}, true),true); }
/**Setting up a <code>VARIANT</code> with a <code>String</code>. Used via serializing the <code>VARIANT</code>. Internally a * <code>JIString</code> is formed with it's default type <code>BSTR</code>. * * @param value * @param isByRef <code>true</code> if the value is to be represented as a pointer. BSTR* */ public JIVariant(String value, boolean isByRef) { init(new JIString(value),isByRef); }
private Object marshal(Object v, Class<?> declaredType) throws JIException { if(v==null) return JIVariant.OPTIONAL_PARAM(); Class<?> actualType = v.getClass(); if(actualType==String.class) return new JIString((String)v); return v; }
public Object[] getDocumentation(int memberId) throws JIException { JICallBuilder callObject = new JICallBuilder(true); callObject.addInParamAsInt(memberId,JIFlags.FLAG_NULL); callObject.addInParamAsInt(0xb,JIFlags.FLAG_NULL);//refPtrFlags , as per the oaidl.idl... callObject.addOutParamAsObject(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),JIFlags.FLAG_NULL); callObject.addOutParamAsObject(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),JIFlags.FLAG_NULL); callObject.addOutParamAsObject(Integer.class,JIFlags.FLAG_NULL); callObject.addOutParamAsObject(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),JIFlags.FLAG_NULL); callObject.setOpnum(9); return comObject.call(callObject); }
public Object[] getDocumentation(int memberId) throws JIException { JICallBuilder callObject = new JICallBuilder(true); callObject.addInParamAsInt(memberId,JIFlags.FLAG_NULL); callObject.addInParamAsInt(0xb,JIFlags.FLAG_NULL);//refPtrFlags , as per the oaidl.idl... callObject.addOutParamAsObject(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),JIFlags.FLAG_NULL); callObject.addOutParamAsObject(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),JIFlags.FLAG_NULL); callObject.addOutParamAsObject(Integer.class,JIFlags.FLAG_NULL); callObject.addOutParamAsObject(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),JIFlags.FLAG_NULL); callObject.setOpnum(6); return comObject.call(callObject); }
@Override public JIString getMops ( final int memberId ) throws JIException { final JICallBuilder callObject = new JICallBuilder ( true ); callObject.setOpnum ( 14 ); callObject.addInParamAsInt ( memberId, JIFlags.FLAG_NULL ); callObject.addOutParamAsObject ( new JIString ( JIFlags.FLAG_REPRESENTATION_STRING_BSTR ), JIFlags.FLAG_NULL ); final Object[] result = this.comObject.call ( callObject ); return (JIString)result[0]; } }
private void navigateToUrl(String url) throws JIException { //ieObjectDispatch.put("Top",new JIVariant(new Integer(600))); //ieObjectDispatch.put("Left",new JIVariant(new Integer(700))); ieObjectDispatch.callMethod("Navigate2",new Object[]{new JIString(url),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()}); }
public JIString getMops(int memberId) throws JIException { JICallBuilder callObject = new JICallBuilder(true); callObject.setOpnum(14); callObject.addInParamAsInt(memberId,JIFlags.FLAG_NULL); callObject.addOutParamAsObject(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),JIFlags.FLAG_NULL); Object[] result = comObject.call(callObject); return (JIString)result[0]; } }
public JIString getMops(int memberId) throws JIException { JICallBuilder callObject = new JICallBuilder(true); callObject.setOpnum(14); callObject.addInParamAsInt(memberId,JIFlags.FLAG_NULL); callObject.addOutParamAsObject(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),JIFlags.FLAG_NULL); Object[] result = comObject.call(callObject); return (JIString)result[0]; } }
private void navigateToUrl(String url) throws JIException { //ieObjectDispatch.put("Top",new JIVariant(new Integer(600))); //ieObjectDispatch.put("Left",new JIVariant(new Integer(700))); ieObjectDispatch.callMethod("Navigate2",new Object[]{new JIString(url),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()}); }
public void envQtp () throws JIException { this.dispatch.callMethodA ( "Open", new Object[] { new JIString ( "C:\\Programme\\Mercury Interactive\\QuickTest Professional\\Tests\\Test1" ), new JIVariant ( false ), new JIVariant ( true ) } ); final JIVariant variant = this.dispatch.get ( "Test" ); final IJIDispatch test = (IJIDispatch)JIObjectFactory.narrowObject ( variant.getObjectAsComObject () ); System.out.println ( test.get ( "Author" ) ); //and this is the original session associated with dispatch. JISession.destroySession ( this.session ); }
public void envQtp() throws JIException{ dispatch.callMethodA("Open", new Object[]{new JIString("C:\\Programme\\Mercury Interactive\\QuickTest Professional\\Tests\\Test1"), new JIVariant(Boolean.FALSE), new JIVariant(Boolean.TRUE)}); JIVariant variant = dispatch.get("Test"); IJIDispatch test = (IJIDispatch)JIObjectFactory.narrowObject(variant.getObjectAsComObject()); System.out.println(test.get("Author")); //and this is the original session associated with dispatch. JISession.destroySession(session); }
/** {@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); } }
/** {@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); } }
/** {@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); } }
public IJIDispatch openPresentation(String fullEscapedPath) throws JIException, InterruptedException { IJIDispatch presentations = (IJIDispatch)JIObjectFactory.narrowObject(dispatch.get("Presentations").getObjectAsComObject()); JIVariant[] result = presentations.callMethodA("Open",new Object[]{new JIString(fullEscapedPath),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()}); return (IJIDispatch)JIObjectFactory.narrowObject(result[0].getObjectAsComObject()); }
public IJIDispatch openPresentation ( final String fullEscapedPath ) throws JIException, InterruptedException { final IJIDispatch presentations = (IJIDispatch)JIObjectFactory.narrowObject ( this.dispatch.get ( "Presentations" ).getObjectAsComObject () ); final JIVariant[] result = presentations.callMethodA ( "Open", new Object[] { new JIString ( fullEscapedPath ), JIVariant.OPTIONAL_PARAM (), JIVariant.OPTIONAL_PARAM (), JIVariant.OPTIONAL_PARAM () } ); return (IJIDispatch)JIObjectFactory.narrowObject ( result[0].getObjectAsComObject () ); }