void AttachEventListener() throws JIException { //6FBA474D-43AC-11CE-9A0E-00AA0062BB4C JILocalCoClass javaComponent = new JILocalCoClass(new JILocalInterfaceDefinition("6FBA474D-43AC-11CE-9A0E-00AA0062BB4C"),SysInfoEvents.class); javaComponent.getInterfaceDefinition().addMethodDescriptor(new JILocalMethodDescriptor("PowerStatusChanged",8,null)); javaComponent.getInterfaceDefinition().addMethodDescriptor(new JILocalMethodDescriptor("TimeChanged",3,null)); identifier = JIObjectFactory.attachEventHandler(sysInfoServer,"6FBA474D-43AC-11CE-9A0E-00AA0062BB4C",JIObjectFactory.buildObject(session,javaComponent)); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } //for call backs }
void AttachEventListener() throws JIException { //6FBA474D-43AC-11CE-9A0E-00AA0062BB4C JILocalCoClass javaComponent = new JILocalCoClass(new JILocalInterfaceDefinition("6FBA474D-43AC-11CE-9A0E-00AA0062BB4C"),SysInfoEvents.class); javaComponent.getInterfaceDefinition().addMethodDescriptor(new JILocalMethodDescriptor("PowerStatusChanged",8,null)); javaComponent.getInterfaceDefinition().addMethodDescriptor(new JILocalMethodDescriptor("TimeChanged",3,null)); identifier = JIObjectFactory.attachEventHandler(sysInfoServer,"6FBA474D-43AC-11CE-9A0E-00AA0062BB4C",JIObjectFactory.buildObject(session,javaComponent)); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } //for call backs }
void AttachEventListener () throws JIException { //6FBA474D-43AC-11CE-9A0E-00AA0062BB4C final JILocalCoClass javaComponent = new JILocalCoClass ( new JILocalInterfaceDefinition ( "6FBA474D-43AC-11CE-9A0E-00AA0062BB4C" ), SysInfoEvents.class ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( new JILocalMethodDescriptor ( "PowerStatusChanged", 8, null ) ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( new JILocalMethodDescriptor ( "TimeChanged", 3, null ) ); this.identifier = JIObjectFactory.attachEventHandler ( this.sysInfoServer, "6FBA474D-43AC-11CE-9A0E-00AA0062BB4C", JIObjectFactory.buildObject ( this.session, javaComponent ) ); try { Thread.sleep ( 3000 ); } catch ( final InterruptedException e ) { // TODO Auto-generated catch block e.printStackTrace (); } //for call backs }
public static final JILocalCoClass getCoClass(JIOPCEventSink instance){ //Define the onEvent method for this interface JILocalParamsDescriptor oeParams=new JILocalParamsDescriptor(); oeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); oeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); oeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); oeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); oeParams.addInParamAsObject(new JIArray(outStruct(),null,1,true), JIFlags.FLAG_NULL); JILocalMethodDescriptor oeMethod=new JILocalMethodDescriptor("onEvent",0,oeParams); //This identify the JIOPCEventSink and not the interface JILocalInterfaceDefinition def=new JILocalInterfaceDefinition(LOCAL_CLASS_IID,false); def.addMethodDescriptor(oeMethod); JILocalCoClass coClass=(instance==null) ? new JILocalCoClass(def,JIOPCEventSink.class) : new JILocalCoClass(def,instance); ArrayList list = new ArrayList(); //Supported interface list.add(OPC_IID); coClass.setSupportedEventInterfaces(list); return coClass; } }
public static final JILocalCoClass getCoClass ( final JIOPCEventSink instance ) { //Define the onEvent method for this interface final JILocalParamsDescriptor oeParams = new JILocalParamsDescriptor (); oeParams.addInParamAsType ( Integer.class, JIFlags.FLAG_NULL ); oeParams.addInParamAsType ( Integer.class, JIFlags.FLAG_NULL ); oeParams.addInParamAsType ( Integer.class, JIFlags.FLAG_NULL ); oeParams.addInParamAsType ( Integer.class, JIFlags.FLAG_NULL ); oeParams.addInParamAsObject ( new JIArray ( outStruct (), null, 1, true ), JIFlags.FLAG_NULL ); final JILocalMethodDescriptor oeMethod = new JILocalMethodDescriptor ( "onEvent", 0, oeParams ); //This identify the JIOPCEventSink and not the interface final JILocalInterfaceDefinition def = new JILocalInterfaceDefinition ( LOCAL_CLASS_IID, false ); def.addMethodDescriptor ( oeMethod ); final JILocalCoClass coClass = instance == null ? new JILocalCoClass ( def, JIOPCEventSink.class ) : new JILocalCoClass ( def, instance ); final ArrayList list = new ArrayList (); //Supported interface list.add ( OPC_IID ); coClass.setSupportedEventInterfaces ( list ); return coClass; } }
public static final JILocalCoClass getCoClass(JIOPCEventSink instance){ //Define the onEvent method for this interface JILocalParamsDescriptor oeParams=new JILocalParamsDescriptor(); oeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); oeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); oeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); oeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); oeParams.addInParamAsObject(new JIArray(outStruct(),null,1,true), JIFlags.FLAG_NULL); JILocalMethodDescriptor oeMethod=new JILocalMethodDescriptor("onEvent",0,oeParams); //This identify the JIOPCEventSink and not the interface JILocalInterfaceDefinition def=new JILocalInterfaceDefinition(LOCAL_CLASS_IID,false); def.addMethodDescriptor(oeMethod); JILocalCoClass coClass=(instance==null) ? new JILocalCoClass(def,JIOPCEventSink.class) : new JILocalCoClass(def,instance); ArrayList list = new ArrayList(); //Supported interface list.add(OPC_IID); coClass.setSupportedEventInterfaces(list); return coClass; } }
JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("PropertyChange",0x70,propertyChangeObject); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); navigateObject.addInParamAsType(JIVariant.class,JIFlags.FLAG_NULL); navigateObject.addInParamAsType(JIVariant.class,JIFlags.FLAG_NULL); methodDescriptor = new JILocalMethodDescriptor("BeforeNavigate2",0xFA,navigateObject); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); methodDescriptor = new JILocalMethodDescriptor("StatusTextChange",0x66,StatusTextChange); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); ProgressChange.addInParamAsType(Integer.class,JIFlags.FLAG_NULL); ProgressChange.addInParamAsType(Integer.class,JIFlags.FLAG_NULL); methodDescriptor = new JILocalMethodDescriptor("ProgressChange",0x6c,ProgressChange); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); CommandStateChange.addInParamAsType(Integer.class,JIFlags.FLAG_NULL); CommandStateChange.addInParamAsType(Boolean.class,JIFlags.FLAG_NULL); methodDescriptor = new JILocalMethodDescriptor("CommandStateChange",0x69,CommandStateChange); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); methodDescriptor = new JILocalMethodDescriptor("DownloadBegin",0x6a,DownloadBegin); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); methodDescriptor = new JILocalMethodDescriptor("DownloadComplete",0x68,DownloadComplete); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); methodDescriptor = new JILocalMethodDescriptor("TitleChange",0x71,TitleChange); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor);
JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor ( "PropertyChange", 0x70, propertyChangeObject ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( methodDescriptor ); navigateObject.addInParamAsType ( JIVariant.class, JIFlags.FLAG_NULL ); navigateObject.addInParamAsType ( JIVariant.class, JIFlags.FLAG_NULL ); methodDescriptor = new JILocalMethodDescriptor ( "BeforeNavigate2", 0xFA, navigateObject ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( methodDescriptor ); methodDescriptor = new JILocalMethodDescriptor ( "StatusTextChange", 0x66, StatusTextChange ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( methodDescriptor ); ProgressChange.addInParamAsType ( Integer.class, JIFlags.FLAG_NULL ); ProgressChange.addInParamAsType ( Integer.class, JIFlags.FLAG_NULL ); methodDescriptor = new JILocalMethodDescriptor ( "ProgressChange", 0x6c, ProgressChange ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( methodDescriptor ); CommandStateChange.addInParamAsType ( Integer.class, JIFlags.FLAG_NULL ); CommandStateChange.addInParamAsType ( Boolean.class, JIFlags.FLAG_NULL ); methodDescriptor = new JILocalMethodDescriptor ( "CommandStateChange", 0x69, CommandStateChange ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( methodDescriptor ); methodDescriptor = new JILocalMethodDescriptor ( "DownloadBegin", 0x6a, DownloadBegin ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( methodDescriptor ); methodDescriptor = new JILocalMethodDescriptor ( "DownloadComplete", 0x68, DownloadComplete ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( methodDescriptor ); methodDescriptor = new JILocalMethodDescriptor ( "TitleChange", 0x71, TitleChange ); javaComponent.getInterfaceDefinition ().addMethodDescriptor ( methodDescriptor );
JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("PropertyChange",0x70,propertyChangeObject); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); navigateObject.addInParamAsType(JIVariant.class,JIFlags.FLAG_NULL); navigateObject.addInParamAsType(JIVariant.class,JIFlags.FLAG_NULL); methodDescriptor = new JILocalMethodDescriptor("BeforeNavigate2",0xFA,navigateObject); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); methodDescriptor = new JILocalMethodDescriptor("StatusTextChange",0x66,StatusTextChange); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); ProgressChange.addInParamAsType(Integer.class,JIFlags.FLAG_NULL); ProgressChange.addInParamAsType(Integer.class,JIFlags.FLAG_NULL); methodDescriptor = new JILocalMethodDescriptor("ProgressChange",0x6c,ProgressChange); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); CommandStateChange.addInParamAsType(Integer.class,JIFlags.FLAG_NULL); CommandStateChange.addInParamAsType(Boolean.class,JIFlags.FLAG_NULL); methodDescriptor = new JILocalMethodDescriptor("CommandStateChange",0x69,CommandStateChange); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); methodDescriptor = new JILocalMethodDescriptor("DownloadBegin",0x6a,DownloadBegin); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); methodDescriptor = new JILocalMethodDescriptor("DownloadComplete",0x68,DownloadComplete); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor); methodDescriptor = new JILocalMethodDescriptor("TitleChange",0x71,TitleChange); javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor);
params.addInParamAsObject ( new JIArray ( Integer.class, null, 1, true ), JIFlags.FLAG_NULL ); // errors method = new JILocalMethodDescriptor ( "OnDataChange", params ); this.coClass.getInterfaceDefinition ().addMethodDescriptor ( method ); params.addInParamAsObject ( new JIArray ( FILETIME.getStruct (), null, 1, true ), JIFlags.FLAG_NULL ); params.addInParamAsObject ( new JIArray ( Integer.class, null, 1, true ), JIFlags.FLAG_NULL ); method = new JILocalMethodDescriptor ( "OnReadComplete", params ); this.coClass.getInterfaceDefinition ().addMethodDescriptor ( method ); params.addInParamAsObject ( new JIArray ( Integer.class, null, 1, true ), JIFlags.FLAG_NULL ); params.addInParamAsObject ( new JIArray ( Integer.class, null, 1, true ), JIFlags.FLAG_NULL ); method = new JILocalMethodDescriptor ( "OnWriteComplete", params ); this.coClass.getInterfaceDefinition ().addMethodDescriptor ( method ); params.addInParamAsType ( Integer.class, JIFlags.FLAG_NULL ); params.addInParamAsType ( Integer.class, JIFlags.FLAG_NULL ); method = new JILocalMethodDescriptor ( "OnCancelComplete", params ); this.coClass.getInterfaceDefinition ().addMethodDescriptor ( method );
JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("Execute",1,parameterObject); interfaceDefinition.addMethodDescriptor(methodDescriptor);
JILocalCoClass component = new JILocalCoClass(interfaceDefinition,Test.class); JILocalParamsDescriptor runtimeObject = new JILocalParamsDescriptor(); JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("test",1,runtimeObject); interfaceDefinition.addMethodDescriptor(methodDescriptor);
JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("Execute",1,parameterObject); interfaceDefinition.addMethodDescriptor(methodDescriptor);
private static JILocalInterfaceDefinition registerInterface() throws JIException { //Now for the Java Implementation of SampleTestServer2 interface (from the type library or IDL) JILocalInterfaceDefinition interfaceDefinition = new JILocalInterfaceDefinition("D3F9CE10-686C-11d2-97BF-006008BD50B1", false);//IStatisUpdateMeSink JIStruct VarData = new JIStruct();// Will add in the struct later on VarData.addMember(JIUnsignedInteger.class); VarData.addMember(Float.class); VarData.addMember(Float.class); VarData.addMember(JIUnsignedShort.class); VarData.addMember(Float.class); VarData.addMember(Date.class); VarData.addMember(JIUnsignedShort.class); JIStruct NonVariableData = new JIStruct();// Will add in the struct later on NonVariableData.addMember(JIUnsignedInteger.class); NonVariableData.addMember(JIUnsignedInteger.class); NonVariableData.addMember(JIUnsignedByte.class); NonVariableData.addMember(new JIPointer(new JIArray(VarData, null, 1, true),true)); //since this is an embedded pointer JIArray NonVariableDataArray = new JIArray(NonVariableData, null, 1, true); JILocalParamsDescriptor updateParamObj = new JILocalParamsDescriptor(); updateParamObj.addInParamAsType(JIUnsignedShort.class, JIFlags.FLAG_NULL); updateParamObj.addInParamAsObject(NonVariableDataArray, JIFlags.FLAG_NULL); JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("UpdateMe", updateParamObj); interfaceDefinition.addMethodDescriptor(methodDescriptor); return interfaceDefinition; }
final JILocalCoClass component = new JILocalCoClass ( interfaceDefinition, Test.class ); final JILocalParamsDescriptor runtimeObject = new JILocalParamsDescriptor (); final JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor ( "test", 1, runtimeObject ); interfaceDefinition.addMethodDescriptor ( methodDescriptor );
JILocalCoClass component = new JILocalCoClass(interfaceDefinition,Test.class); JILocalParamsDescriptor runtimeObject = new JILocalParamsDescriptor(); JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("test",1,runtimeObject); interfaceDefinition.addMethodDescriptor(methodDescriptor);
private static JILocalInterfaceDefinition registerInterface() throws JIException { //Now for the Java Implementation of SampleTestServer2 interface (from the type library or IDL) JILocalInterfaceDefinition interfaceDefinition = new JILocalInterfaceDefinition("D3F9CE10-686C-11d2-97BF-006008BD50B1", false);//IStatisUpdateMeSink JIStruct VarData = new JIStruct();// Will add in the struct later on VarData.addMember(JIUnsignedInteger.class); VarData.addMember(Float.class); VarData.addMember(Float.class); VarData.addMember(JIUnsignedShort.class); VarData.addMember(Float.class); VarData.addMember(Date.class); VarData.addMember(JIUnsignedShort.class); JIStruct NonVariableData = new JIStruct();// Will add in the struct later on NonVariableData.addMember(JIUnsignedInteger.class); NonVariableData.addMember(JIUnsignedInteger.class); NonVariableData.addMember(JIUnsignedByte.class); NonVariableData.addMember(new JIPointer(new JIArray(VarData, null, 1, true),true)); //since this is an embedded pointer JIArray NonVariableDataArray = new JIArray(NonVariableData, null, 1, true); JILocalParamsDescriptor updateParamObj = new JILocalParamsDescriptor(); updateParamObj.addInParamAsType(JIUnsignedShort.class, JIFlags.FLAG_NULL); updateParamObj.addInParamAsObject(NonVariableDataArray, JIFlags.FLAG_NULL); JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("UpdateMe", updateParamObj); interfaceDefinition.addMethodDescriptor(methodDescriptor); return interfaceDefinition; }
private static JILocalInterfaceDefinition registerInterface () throws JIException { //Now for the Java Implementation of SampleTestServer2 interface (from the type library or IDL) final JILocalInterfaceDefinition interfaceDefinition = new JILocalInterfaceDefinition ( "D3F9CE10-686C-11d2-97BF-006008BD50B1", false );//IStatisUpdateMeSink final JIStruct VarData = new JIStruct ();// Will add in the struct later on VarData.addMember ( JIUnsignedInteger.class ); VarData.addMember ( Float.class ); VarData.addMember ( Float.class ); VarData.addMember ( JIUnsignedShort.class ); VarData.addMember ( Float.class ); VarData.addMember ( Date.class ); VarData.addMember ( JIUnsignedShort.class ); final JIStruct NonVariableData = new JIStruct ();// Will add in the struct later on NonVariableData.addMember ( JIUnsignedInteger.class ); NonVariableData.addMember ( JIUnsignedInteger.class ); NonVariableData.addMember ( JIUnsignedByte.class ); NonVariableData.addMember ( new JIPointer ( new JIArray ( VarData, null, 1, true ), true ) ); //since this is an embedded pointer final JIArray NonVariableDataArray = new JIArray ( NonVariableData, null, 1, true ); final JILocalParamsDescriptor updateParamObj = new JILocalParamsDescriptor (); updateParamObj.addInParamAsType ( JIUnsignedShort.class, JIFlags.FLAG_NULL ); updateParamObj.addInParamAsObject ( NonVariableDataArray, JIFlags.FLAG_NULL ); final JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor ( "UpdateMe", updateParamObj ); interfaceDefinition.addMethodDescriptor ( methodDescriptor ); return interfaceDefinition; }
final JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor ( "Execute", 1, parameterObject ); interfaceDefinition.addMethodDescriptor ( methodDescriptor );