当前位置: 首页>>代码示例>>Java>>正文


Java JILocalCoClass类代码示例

本文整理汇总了Java中org.jinterop.dcom.core.JILocalCoClass的典型用法代码示例。如果您正苦于以下问题:Java JILocalCoClass类的具体用法?Java JILocalCoClass怎么用?Java JILocalCoClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JILocalCoClass类属于org.jinterop.dcom.core包,在下文中一共展示了JILocalCoClass类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCoClass

import org.jinterop.dcom.core.JILocalCoClass; //导入依赖的package包/类
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;
}
 
开发者ID:howie,项目名称:jinterop,代码行数:20,代码来源:JIOPCEventSink.java

示例2: createCoClass

import org.jinterop.dcom.core.JILocalCoClass; //导入依赖的package包/类
private void createCoClass()
{
    localClass = new JILocalCoClass(new JILocalInterfaceDefinition(IID_IOPCShutdown, false), this, false);
    JILocalParamsDescriptor shutdownParams = new JILocalParamsDescriptor();
    shutdownParams.addInParamAsObject(JIString.class, JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
    JILocalMethodDescriptor shutdownDesc = new JILocalMethodDescriptor("ShutdownRequest", 0, shutdownParams);
    localClass.getInterfaceDefinition().addMethodDescriptor(shutdownDesc);
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:9,代码来源:OPCShutdownImpl.java

示例3: AttachEventListener

import org.jinterop.dcom.core.JILocalCoClass; //导入依赖的package包/类
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
}
 
开发者ID:howie,项目名称:jinterop,代码行数:16,代码来源:MSSysInfo.java

示例4: getLocalClass

import org.jinterop.dcom.core.JILocalCoClass; //导入依赖的package包/类
JILocalCoClass getLocalClass()
{
    return localClass;
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:5,代码来源:OPCShutdownImpl.java

示例5: createCoClass

import org.jinterop.dcom.core.JILocalCoClass; //导入依赖的package包/类
private void createCoClass() throws JIException
{
    localClass = new JILocalCoClass(new JILocalInterfaceDefinition(IID_IOPCDataCallback, false), this, false);

    JILocalParamsDescriptor onDataChangeParams = new JILocalParamsDescriptor();
    onDataChangeParams.addInParamAsType(Integer.class, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT); //dwTransid
    onDataChangeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); //hGroup
    onDataChangeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); //hrMasterquality
    onDataChangeParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); //hrMastererror
    onDataChangeParams.addInParamAsType(Integer.class, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT); //dwCount
    onDataChangeParams.addInParamAsObject(new JIArray(Integer.class, null, 1, true), JIFlags.FLAG_NULL); //phClientItems
    onDataChangeParams.addInParamAsObject(new JIArray(JIVariant.class, null, 1, true), JIFlags.FLAG_NULL); //pvValues
    onDataChangeParams.addInParamAsObject(new JIArray(Short.class, null, 1, true), JIFlags.FLAG_NULL); //pwQualities
    onDataChangeParams.addInParamAsObject(new JIArray(new FileTime().getStruct(), null, 1, true), JIFlags.FLAG_NULL); //pftTimeStamps
    onDataChangeParams.addInParamAsObject(new JIArray(Integer.class, null, 1, true), JIFlags.FLAG_NULL); //pErrors

    JILocalMethodDescriptor onDataChangeDesc = new JILocalMethodDescriptor("OnDataChange", 0, onDataChangeParams);
    localClass.getInterfaceDefinition().addMethodDescriptor(onDataChangeDesc);

    JILocalParamsDescriptor onReadCompleteParams = new JILocalParamsDescriptor();
    onReadCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT); //dwTransid
    onReadCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); //hGroup
    onReadCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); //hrMasterquality
    onReadCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); //hrMastererror
    onReadCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT); //dwCount
    onReadCompleteParams.addInParamAsObject(new JIArray(Integer.class, null, 1, true), JIFlags.FLAG_NULL); //phClientItems
    onReadCompleteParams.addInParamAsObject(new JIArray(JIVariant.class, null, 1, true), JIFlags.FLAG_NULL); //pvValues
    onReadCompleteParams.addInParamAsObject(new JIArray(Short.class, null, 1, true), JIFlags.FLAG_NULL); //pwQualities
    onReadCompleteParams.addInParamAsObject(new JIArray(new FileTime().getStruct(), null, 1, true), JIFlags.FLAG_NULL); //pftTimeStamps
    onReadCompleteParams.addInParamAsObject(new JIArray(Integer.class, null, 1, true), JIFlags.FLAG_NULL); //pErrors
    JILocalMethodDescriptor onReadCompleteDesc = new JILocalMethodDescriptor("OnReadComplete", 1, onReadCompleteParams);
    localClass.getInterfaceDefinition().addMethodDescriptor(onReadCompleteDesc);

    JILocalParamsDescriptor onWriteCompleteParams = new JILocalParamsDescriptor();
    onWriteCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT); //dwTransid
    onWriteCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); //hGroup
    onWriteCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); //hrMastererror
    onWriteCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT); //dwCount
    onWriteCompleteParams.addInParamAsObject(new JIArray(Integer.class, null, 1, true), JIFlags.FLAG_NULL); //pClientHandles
    onWriteCompleteParams.addInParamAsObject(new JIArray(Integer.class, null, 1, true), JIFlags.FLAG_NULL); //pErrors
    JILocalMethodDescriptor onWriteCompleteDesc = new JILocalMethodDescriptor("OnWriteComplete", 2, onWriteCompleteParams);
    localClass.getInterfaceDefinition().addMethodDescriptor(onWriteCompleteDesc);

    JILocalParamsDescriptor onCancelCompleteParams = new JILocalParamsDescriptor();
    onCancelCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT); //dwTransid
    onCancelCompleteParams.addInParamAsType(Integer.class, JIFlags.FLAG_NULL); //hGroup
    JILocalMethodDescriptor onCancelCompleteDesc = new JILocalMethodDescriptor("OnCancelComplete", 3, onCancelCompleteParams);
    localClass.getInterfaceDefinition().addMethodDescriptor(onCancelCompleteDesc);
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:50,代码来源:OPCDataCallbackImpl.java

示例6: main

import org.jinterop.dcom.core.JILocalCoClass; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	
	if (args.length < 4)
    {
    	System.out.println("Please provide address domain username password");
    	return;
    }
	
	
	
	try {
		
		JISystem.setAutoRegisteration(true);
		JISystem.setInBuiltLogHandler(false);
		JISystem.getLogger().setLevel(Level.ALL);
		JISession session1 = JISession.createSession(args[1],args[2],args[3]);
		JISession session2 = JISession.createSession(args[1],args[2],args[3]);
		JIComServer testServer1 = new JIComServer(JIProgId.valueOf("TestJavaServer.TestServer1"),args[0],session1);
		IJIComObject unkTestServer1 = testServer1.createInstance();
		IJIComObject testServer1Intf = JIObjectFactory.narrowObject(unkTestServer1.queryInterface("2A93A24D-59FE-4DE0-B67E-B8D41C9F57F8"));
		IJIDispatch dispatch1 = (IJIDispatch)JIObjectFactory.narrowObject(unkTestServer1.queryInterface(IJIDispatch.IID));;
		
		//First lets call the ITestServer1.Call_TestServer2_Java using the Dispatch interface
		//Acquire a reference to ITestServer2
		JIComServer testServer2 = new JIComServer(JIProgId.valueOf("TestJavaServer.TestServer2"),args[0],session2);
		IJIComObject unkTestServer2 = testServer2.createInstance();
		//Get the interface pointer to ITestServer2
		IJIComObject iTestServer2 = (IJIComObject)JIObjectFactory.narrowObject(unkTestServer2.queryInterface("9CCC5120-457D-49F3-8113-90F7E97B54A7"));
	
		IJIDispatch dispatch2 = (IJIDispatch)JIObjectFactory.narrowObject(unkTestServer2.queryInterface(IJIDispatch.IID));;
		
		//send it directly without IDispatch interface, please note that the "dispatchNotSupported" flag of JICallBuilder is "false".
		JICallBuilder callObject = new JICallBuilder(false);
		callObject.addInParamAsComObject(iTestServer2, JIFlags.FLAG_NULL);
		callObject.setOpnum(0);
		testServer1Intf.call(callObject);
		
		//Send it to ITestServer.Call_TestServer2_Java2 via IDispatch of ITestServer1. Notice that pointer here id IDispatch.
		dispatch1.callMethod("Call_TestServer2_Java2", new Object[]{new JIVariant(dispatch2)});
		
		//Send it to ITestServer.Call_TestServer2_Java via IDispatch of ITestServer1.
		dispatch1.callMethod("Call_TestServer2_Java", new Object[]{new JIVariant(iTestServer2)});
		
		
		//Now for the Java Implementation of ITestServer2 interface (from the type library or IDL)  
		//IID of ITestServer2 interface
		JILocalInterfaceDefinition interfaceDefinition = new JILocalInterfaceDefinition("9CCC5120-457D-49F3-8113-90F7E97B54A7");
		//lets define the method "Execute" now. Please note that either this should be in the same order as defined in IDL
		//or use the addInParamAsObject with opnum parameter function.
		JILocalParamsDescriptor parameterObject = new JILocalParamsDescriptor();
		parameterObject.addInParamAsObject(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),JIFlags.FLAG_REPRESENTATION_STRING_BSTR);
		JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("Execute",1,parameterObject);
		interfaceDefinition.addMethodDescriptor(methodDescriptor);
		//Create the Java Server class. This contains the instance to be called by the COM Server ITestServer1.
		JILocalCoClass _testServer2 = new JILocalCoClass(interfaceDefinition,new Test_ITestServer2_Impl());
		//Get a interface pointer to the Java CO Class. The template could be any IJIComObject since only the session is reused.
		IJIComObject __testServer2 = JIObjectFactory.buildObject(session1,_testServer2); 
		//Call our Java server. The same message should be printed on the Java console.
		dispatch1.callMethod("Call_TestServer2_Java", new Object[]{new JIVariant(__testServer2)});
		
	} catch (Exception e) {
		e.printStackTrace();
	} 
	

}
 
开发者ID:howie,项目名称:jinterop,代码行数:70,代码来源:Test_ITestServer2_Impl.java

示例7: buildObject

import org.jinterop.dcom.core.JILocalCoClass; //导入依赖的package包/类
/** Returns a <b>local</b> COM Object representation for the Java component. <code>IJIComObject.IsLocalReference()</code>
 * method will return <code>true</code> for all objects built by this method. Another important point to note is that a
 * <code>javaComponent</code> can only export one reference to itself. Reusing the same <code>javaComponent</code> in another
 * call to this method will raise an exception.
 *
 * @param session session to attach <code>comObject</code> to.
 * @param javaComponent
 * @return
 * @throws JIException
 */
public static IJIComObject buildObject(JISession session,JILocalCoClass javaComponent) throws JIException
{
	return JIFrameworkHelper.instantiateLocalComObject(session, javaComponent);
}
 
开发者ID:howie,项目名称:jinterop,代码行数:15,代码来源:JIObjectFactory.java

示例8: releaseObject

import org.jinterop.dcom.core.JILocalCoClass; //导入依赖的package包/类
/** To be called after one is done using the local Java CoClass. Recommended to be called from the <code>finalize()</code> method of the 
 * Java CoClass.
 * 
 * @param session
 * @param javaComponent
 * @throws JIException
 */
public static void releaseObject(JISession session, JILocalCoClass javaComponent) throws JIException
{
    JIFrameworkHelper.releaseLocalComponent(session, javaComponent);
}
 
开发者ID:howie,项目名称:jinterop,代码行数:12,代码来源:JIObjectFactory.java


注:本文中的org.jinterop.dcom.core.JILocalCoClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。