public int getTypeInfoType(int index) throws JIException { JICallBuilder callObject = new JICallBuilder(true); callObject.setOpnum(2); callObject.addInParamAsInt(index,JIFlags.FLAG_NULL); callObject.addOutParamAsType(Integer.class,JIFlags.FLAG_NULL); Object[] result = comObject.call(callObject); return ((Integer)result[0]).intValue(); }
private void releaseRefs ( final JIArray arrayOfStructs, final boolean fromDestroy ) throws JIException { logger.info ( "In releaseRefs for session : {} , array length is: {}", getSessionIdentifier (), (short) ( (Object[])arrayOfStructs.getArrayInstance () ).length ); final JICallBuilder obj = new JICallBuilder ( true ); obj.setOpnum ( 2 );//release //length obj.addInParamAsShort ( (short) ( (Object[])arrayOfStructs.getArrayInstance () ).length, JIFlags.FLAG_NULL ); obj.addInParamAsArray ( arrayOfStructs, JIFlags.FLAG_NULL ); obj.fromDestroySession = fromDestroy; this.stub2.addRef_ReleaseRef ( obj ); //ignore the results }
public OPCGroupStateMgt addGroup ( final String name, final boolean active, final int updateRate, final int clientHandle, final Integer timeBias, final Float percentDeadband, final int localeID ) throws JIException, IllegalArgumentException, UnknownHostException { final JICallBuilder callObject = new JICallBuilder ( true ); callObject.setOpnum ( 0 ); callObject.addInParamAsString ( name, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ); callObject.addInParamAsInt ( active ? 1 : 0, JIFlags.FLAG_NULL ); callObject.addInParamAsInt ( updateRate, JIFlags.FLAG_NULL ); callObject.addInParamAsInt ( clientHandle, JIFlags.FLAG_NULL ); callObject.addInParamAsPointer ( new JIPointer ( timeBias ), JIFlags.FLAG_NULL ); callObject.addInParamAsPointer ( new JIPointer ( percentDeadband ), JIFlags.FLAG_NULL ); callObject.addInParamAsInt ( localeID, JIFlags.FLAG_NULL ); callObject.addOutParamAsType ( Integer.class, JIFlags.FLAG_NULL ); callObject.addOutParamAsType ( Integer.class, JIFlags.FLAG_NULL ); callObject.addInParamAsUUID ( Constants.IOPCGroupStateMgt_IID, JIFlags.FLAG_NULL ); callObject.addOutParamAsType ( IJIComObject.class, JIFlags.FLAG_NULL ); final Object[] result = Helper.callIgnoreSpecificError ( getCOMObject (), callObject, org.openscada.opc.dcom.common.Constants.S_OPC_UNSUPPORTED_UPDATE_RATE ); return new OPCGroupStateMgt ( (IJIComObject)result[2] ); }
public void setTCharArray() throws JIException, InterruptedException, UnknownHostException { System.gc(); JICallBuilder callObject = new JICallBuilder( true); callObject.setOpnum(7); Object results[]; callObject.addInParamAsString("AHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR); results = comObject.call(callObject); }
public Object[] getContainingTypeLib() throws JIException { JICallBuilder callObject = new JICallBuilder(true); callObject.addOutParamAsObject(IJIComObject.class,JIFlags.FLAG_NULL); callObject.addOutParamAsObject(Integer.class,JIFlags.FLAG_NULL); callObject.setOpnum(15); Object[] result = comObject.call(callObject); Object[] retVal = new Object[2]; retVal[0] = (IJITypeLib) JIObjectFactory.narrowObject((IJIComObject)result[0]); retVal[1] = result[1]; return retVal; }
JICallBuilder callObject = new JICallBuilder(); callObject.setOpnum(156); callObject.addInParamAsPointer(new JIPointer(new JIArray(new JIVariant[]{}, true)), JIFlags.FLAG_NULL); callObject = new JICallBuilder(); callObject.reInit(); callObject.setOpnum(147); callObject.addInParamAsUnsigned(JIUnsignedFactory.getUnsigned(new Short((short)200), JIFlags.FLAG_REPRESENTATION_UNSIGNED_BYTE),JIFlags.FLAG_NULL); handle2.call(callObject); callObject.setOpnum(3); callObject.addInParamAsShort((short)8194,JIFlags.FLAG_NULL); callObject.addInParamAsVariant(varArray,JIFlags.FLAG_NULL); callObject.addInParamAsVariant(JIVariant.EMPTY_BYREF(),JIFlags.FLAG_NULL); callObject.addInParamAsVariant(JIVariant.EMPTY_BYREF(),JIFlags.FLAG_NULL); callObject.addOutParamAsType(JIVariant.class,JIFlags.FLAG_NULL); callObject.addOutParamAsType(JIVariant.class,JIFlags.FLAG_NULL); callObject.addOutParamAsType(Integer.class,JIFlags.FLAG_NULL); callObject.setOpnum(16); callObject.addInParamAsPointer(new JIPointer(new JIString("123",JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR)),JIFlags.FLAG_NULL); callObject.addOutParamAsObject( new JIString(JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR),JIFlags.FLAG_NULL ); Object[] t2= handle2.call(callObject);
public JIVariant[] invoke(int dispId,int dispatchFlags,JIArray arrayOfVariantsInParams,JIArray arrayOfNamedDispIds,JIVariant outParamType) throws JIException JICallBuilder obj = new JICallBuilder(true); obj.setOpnum(3); obj.addInParamAsInt(dispId,JIFlags.FLAG_NULL); obj.addInParamAsUUID(UUID.NIL_UUID,JIFlags.FLAG_NULL); obj.addInParamAsInt(0x800,JIFlags.FLAG_NULL); obj.addInParamAsInt(dispatchFlags^0xFFFFFFF0,JIFlags.FLAG_NULL); obj.addInParamAsStruct(dispParams,JIFlags.FLAG_REPRESENTATION_IDISPATCH_INVOKE); obj.addInParamAsInt(listOfPositions.size(),JIFlags.FLAG_NULL); obj.addInParamAsArray(new JIArray(listOfPositions.toArray(new Integer[listOfPositions.size()]),true),JIFlags.FLAG_NULL); obj.addInParamAsArray(new JIArray(listOfVariantPtrs.toArray(new JIVariant[listOfVariantPtrs.size()]),true),JIFlags.FLAG_NULL); obj.addInParamAsObject(null,JIFlags.FLAG_NULL); //results --> currently all are null and this param is not required as the outparam carries this info. obj.addInParamAsObject(null,JIFlags.FLAG_NULL); //excepinfo --> currently all are null and this param is not required as the excepinfo is built here. obj.addInParamAsObject(null,JIFlags.FLAG_NULL); //augerr --> currently all are null and this param is not required as the excepinfo is built here. obj.setOutParams(outparams,JIFlags.FLAG_REPRESENTATION_IDISPATCH_INVOKE); }catch(JIException e) Object[] results = obj.getResultsInCaseOfException(); if (results != null)
void releaseRef ( final String IPID, final int numinstances ) throws JIException { logger.info ( "releaseRef:Reclaiming from Session: {} , the IPID: {}, numinstances is {}", numinstances, new Object[] { getSessionIdentifier (), IPID, numinstances } ); final JICallBuilder obj = new JICallBuilder ( true ); obj.setParentIpid ( IPID ); obj.setOpnum ( 2 );//release //length obj.addInParamAsShort ( (short)1, JIFlags.FLAG_NULL ); //ipid to addfref on final JIArray array = new JIArray ( new rpc.core.UUID[] { new rpc.core.UUID ( IPID ) }, true ); obj.addInParamAsArray ( array, JIFlags.FLAG_NULL ); //TODO requesting 5 for now, will later build caching mechnaism to exhaust 5 refs first before asking for more // same with release. obj.addInParamAsInt ( numinstances, JIFlags.FLAG_NULL ); obj.addInParamAsInt ( 0, JIFlags.FLAG_NULL );//private refs = 0 if ( logger.isInfoEnabled () ) { debug_delIpids ( IPID, numinstances ); logger.info ( "releaseRef: Releasing numinstances {} references of IPID: {} session: {}", new Object[] { numinstances, IPID, getSessionIdentifier () } ); } this.stub2.addRef_ReleaseRef ( obj ); }
JICallBuilder obj = new JICallBuilder(true); obj.setOpnum(2); //size of the array //1st is the num elements and second is the actual values obj.addInParamAsUUID(UUID.NIL_UUID,JIFlags.FLAG_NULL); obj.addInParamAsArray(array,JIFlags.FLAG_NULL); obj.addInParamAsInt(1,JIFlags.FLAG_NULL); obj.addInParamAsInt(0x800,JIFlags.FLAG_NULL); obj.addOutParamAsObject(new JIArray(Integer.class,null,1,true),JIFlags.FLAG_NULL); if (result == null && obj.isError()) throw new JIException(obj.getHRESULT());
final JICallBuilder object = new JICallBuilder ( true ); object.setOpnum ( 1 ); object.addInParamAsUUID ( sourceUUID, JIFlags.FLAG_NULL ); object.addOutParamAsObject ( IJIComObject.class, JIFlags.FLAG_NULL ); final Object[] objects = connectionPointContainer.call ( object ); //find connection point final IJIComObject connectionPointer = (IJIComObject)objects[0]; object.reInit (); object.setOpnum ( 2 ); object.addInParamAsComObject ( eventListener, JIFlags.FLAG_NULL ); object.addOutParamAsType ( Integer.class, JIFlags.FLAG_NULL ); final Object[] obj = connectionPointer.call ( object );
public EnumGUID enumClassesOfCategories ( final UUID[] implemented, final UUID[] required ) throws IllegalArgumentException, UnknownHostException, JIException JICallBuilder callObject = new JICallBuilder ( true ); callObject.setOpnum ( 0 ); callObject.addInParamAsInt ( implemented.length, JIFlags.FLAG_NULL ); if ( implemented.length == 0 ) callObject.addInParamAsPointer ( new JIPointer ( null ), JIFlags.FLAG_NULL ); callObject.addInParamAsArray ( new JIArray ( implemented, true ), JIFlags.FLAG_NULL ); callObject.addInParamAsInt ( required.length, JIFlags.FLAG_NULL ); if ( required.length == 0 ) callObject.addInParamAsPointer ( new JIPointer ( null ), JIFlags.FLAG_NULL ); callObject.addInParamAsArray ( new JIArray ( required, true ), JIFlags.FLAG_NULL ); callObject.addOutParamAsType ( IJIComObject.class, JIFlags.FLAG_NULL );
/** * Direct the browser to another position * * Depending on the <em>direction</em> the new position will be set based on the provided * position information. If the direction is {@link OPCBROWSEDIRECTION#OPC_BROWSE_TO} then * the <em>position</em> is the item to go to. If the direction is {@link OPCBROWSEDIRECTION#OPC_BROWSE_DOWN} * the browser will descent into the tree down (not to) the branch item in <em>position</em>. * Passing {@link OPCBROWSEDIRECTION#OPC_BROWSE_UP} won't need a <em>position</em> (pass <code>null</code>) * and will ascent in the tree one level. * * Passing {@link OPCBROWSEDIRECTION#OPC_BROWSE_TO} and <code>null</code> as position will * go to the first root entry of the namespace. * * @param position The item position reference for the direction * @param direction The direction to go based on the position * @throws JIException */ public void changePosition ( final String position, final OPCBROWSEDIRECTION direction ) throws JIException { JICallBuilder callObject = new JICallBuilder ( true ); callObject.setOpnum ( 1 ); callObject.addInParamAsShort ( (short)direction.id (), JIFlags.FLAG_NULL ); callObject.addInParamAsString ( position, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ); getCOMObject ().call ( callObject ); }
final JICallBuilder callObject = new JICallBuilder ( true ); callObject.setOpnum ( 1 ); callObject.addInParamAsPointer ( new JIPointer ( requestedUpdateRate ), JIFlags.FLAG_NULL ); if ( active != null ) callObject.addInParamAsPointer ( new JIPointer ( Integer.valueOf ( active.booleanValue () ? 1 : 0 ) ), JIFlags.FLAG_NULL ); callObject.addInParamAsPointer ( new JIPointer ( null ), JIFlags.FLAG_NULL ); callObject.addInParamAsPointer ( new JIPointer ( timeBias ), JIFlags.FLAG_NULL ); callObject.addInParamAsPointer ( new JIPointer ( percentDeadband ), JIFlags.FLAG_NULL ); callObject.addInParamAsPointer ( new JIPointer ( localeID ), JIFlags.FLAG_NULL ); callObject.addInParamAsPointer ( new JIPointer ( clientHandle ), JIFlags.FLAG_NULL ); callObject.addOutParamAsType ( Integer.class, JIFlags.FLAG_NULL );
/** * Get the complete item id from an item at the local position. * * Browsing a hierarchical namespace the browse method will return items based on the * local level in the namespace. So actually only the last part of the item ID hierarchy * is returned. In order to convert this to the full item ID one can use this method. It * will only work if the browser is still at the position in question. * * @param item the local item * @return the complete item ID * @throws JIException */ public String getItemID ( final String item ) throws JIException { JICallBuilder callObject = new JICallBuilder ( true ); callObject.setOpnum ( 3 ); callObject.addInParamAsString ( item, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ); callObject.addOutParamAsObject ( new JIPointer ( new JIString ( JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ) ), JIFlags.FLAG_NULL ); Object[] result = getCOMObject ().call ( callObject ); return ( (JIString) ( (JIPointer)result[0] ).getReferent () ).getString (); } }
/** * Return details about a serve class * @param clsId A server class * @throws JIException */ public ClassDetails getClassDetails ( final JIClsid clsId ) throws JIException { if ( clsId == null ) { return null; } JICallBuilder callObject = new JICallBuilder ( true ); callObject.setOpnum ( 1 ); callObject.addInParamAsUUID ( clsId.getCLSID (), JIFlags.FLAG_NULL ); callObject.addOutParamAsObject ( new JIPointer ( new JIString ( JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ) ), JIFlags.FLAG_NULL ); callObject.addOutParamAsObject ( new JIPointer ( new JIString ( JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ) ), JIFlags.FLAG_NULL ); Object[] result = Helper.callRespectSFALSE ( getCOMObject (), callObject ); ClassDetails cd = new ClassDetails (); cd.setClsId ( clsId.getCLSID () ); cd.setProgId ( ( (JIString) ( (JIPointer)result[0] ).getReferent () ).getString () ); cd.setDescription ( ( (JIString) ( (JIPointer)result[1] ).getReferent () ).getString () ); return cd; }
/** Add <code>[in]</code> parameter at the end of the out parameter list. Typically callers are * composite in nature <code>JIStruct</code> , <code>JIUnions</code> , <code>JIPointer</code> * and <code>JIString</code> . * * @param param * @param FLAGS */ public void addInParamAsObject(Object param, int FLAGS) { callObject.addOutParamAsObject(param,FLAGS); }
return callObject.getResultsInCaseOfException ();
JICallBuilder callObject = new JICallBuilder (); callObject.setOpnum ( 156 ); callObject.addInParamAsPointer ( new JIPointer ( new JIArray ( new JIVariant[] {}, true ) ), JIFlags.FLAG_NULL ); callObject = new JICallBuilder (); callObject.reInit (); callObject.setOpnum ( 147 ); callObject.addInParamAsUnsigned ( JIUnsignedFactory.getUnsigned ( new Short ( (short)200 ), JIFlags.FLAG_REPRESENTATION_UNSIGNED_BYTE ), JIFlags.FLAG_NULL ); handle2.call ( callObject ); callObject.setOpnum ( 3 ); callObject.addInParamAsShort ( (short)8194, JIFlags.FLAG_NULL ); callObject.addInParamAsVariant ( varArray, JIFlags.FLAG_NULL ); callObject.addInParamAsVariant ( JIVariant.EMPTY_BYREF (), JIFlags.FLAG_NULL ); callObject.addInParamAsVariant ( JIVariant.EMPTY_BYREF (), JIFlags.FLAG_NULL ); callObject.addOutParamAsType ( JIVariant.class, JIFlags.FLAG_NULL ); callObject.addOutParamAsType ( JIVariant.class, JIFlags.FLAG_NULL ); callObject.addOutParamAsType ( Integer.class, JIFlags.FLAG_NULL ); callObject.setOpnum ( 16 ); callObject.addInParamAsPointer ( new JIPointer ( new JIString ( "123", JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ) ), JIFlags.FLAG_NULL ); callObject.addOutParamAsObject ( new JIString ( JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR ), JIFlags.FLAG_NULL ); Object[] t2 = handle2.call ( callObject );
public JIVariant[] invoke(int dispId,int dispatchFlags,JIArray arrayOfVariantsInParams,JIArray arrayOfNamedDispIds,JIVariant outParamType) throws JIException JICallBuilder obj = new JICallBuilder(true); obj.setOpnum(3); obj.addInParamAsInt(dispId,JIFlags.FLAG_NULL); obj.addInParamAsUUID(UUID.NIL_UUID,JIFlags.FLAG_NULL); obj.addInParamAsInt(0x800,JIFlags.FLAG_NULL); obj.addInParamAsInt(dispatchFlags^0xFFFFFFF0,JIFlags.FLAG_NULL); obj.addInParamAsStruct(dispParams,JIFlags.FLAG_REPRESENTATION_IDISPATCH_INVOKE); obj.addInParamAsInt(listOfPositions.size(),JIFlags.FLAG_NULL); obj.addInParamAsArray(new JIArray(listOfPositions.toArray(new Integer[listOfPositions.size()]),true),JIFlags.FLAG_NULL); obj.addInParamAsArray(new JIArray(listOfVariantPtrs.toArray(new JIVariant[listOfVariantPtrs.size()]),true),JIFlags.FLAG_NULL); obj.addInParamAsObject(null,JIFlags.FLAG_NULL); //results --> currently all are null and this param is not required as the outparam carries this info. obj.addInParamAsObject(null,JIFlags.FLAG_NULL); //excepinfo --> currently all are null and this param is not required as the excepinfo is built here. obj.addInParamAsObject(null,JIFlags.FLAG_NULL); //augerr --> currently all are null and this param is not required as the excepinfo is built here. obj.setOutParams(outparams,JIFlags.FLAG_REPRESENTATION_IDISPATCH_INVOKE); }catch(JIException e) Object[] results = obj.getResultsInCaseOfException(); if (results != null)
void releaseRef(String IPID) throws JIException { if (JISystem.getLogger().isLoggable(Level.INFO)) { JISystem.getLogger().info("releaseRef:Reclaiming from Session: " + getSessionIdentifier() + " , the IPID: " + IPID); } JICallBuilder obj = new JICallBuilder(true); obj.setParentIpid(IPID); obj.setOpnum(2);//release //length obj.addInParamAsShort((short)1,JIFlags.FLAG_NULL); //ipid to addfref on JIArray array = new JIArray(new rpc.core.UUID[]{new rpc.core.UUID(IPID)},true); obj.addInParamAsArray(array,JIFlags.FLAG_NULL); //TODO requesting 5 for now, will later build caching mechnaism to exhaust 5 refs first before asking for more // same with release. obj.addInParamAsInt(5,JIFlags.FLAG_NULL); obj.addInParamAsInt(0,JIFlags.FLAG_NULL);//private refs = 0 if (JISystem.getLogger().isLoggable(Level.WARNING)) { JISystem.getLogger().warning("releaseRef: Releasing 5 references of IPID: " + IPID + " session: " + getSessionIdentifier()); debug_delIpids(IPID, 5); } stub.addRef_ReleaseRef(obj); }