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


Java JISession.destroySession方法代码示例

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


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

示例1: performOp

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public void performOp() throws JIException, InterruptedException
{

	JICallBuilder callObject = new JICallBuilder (true);
       callObject.setOpnum ( 0 );

       callObject.addInParamAsString("",JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
       callObject.addInParamAsInt(0xFFFFFFFF, JIFlags.FLAG_NULL );
       callObject.addInParamAsInt ( 1000,JIFlags.FLAG_NULL );
       callObject.addInParamAsInt ( 1234,JIFlags.FLAG_NULL );
       callObject.addInParamAsPointer ( new JIPointer(new Integer(0)), JIFlags.FLAG_NULL );
       callObject.addInParamAsPointer ( new JIPointer(new Float(0.0)),JIFlags.FLAG_NULL );
       callObject.addInParamAsInt ( 0, JIFlags.FLAG_NULL );
       callObject.addOutParamAsType ( Integer.class,JIFlags.FLAG_NULL );
       callObject.addOutParamAsType ( Integer.class,JIFlags.FLAG_NULL );
       callObject.addInParamAsUUID( "39C13A50-011E-11D0-9675-0020AFD8ADB3", JIFlags.FLAG_NULL );
       callObject.addOutParamAsType ( IJIComObject.class, JIFlags.FLAG_NULL );

       Object[] result = opcServer.call ( callObject );



       JISession.destroySession(unknown.getAssociatedSession());
}
 
开发者ID:howie,项目名称:jinterop,代码行数:25,代码来源:MetrikonOPC.java

示例2: execute

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public void execute() throws JIException
{
	unknown = comStub.createInstance();
	//CLSID of IITestCOMServer
	IJIComObject comObject = (IJIComObject)unknown.queryInterface("4AE62432-FD04-4BF9-B8AC-56AA12A47FF9");
	dispatch = (IJIDispatch)JIObjectFactory.narrowObject(comObject.queryInterface(IJIDispatch.IID));

	//Now call via automation
	Object results[] = dispatch.callMethodA("Add",new Object[]{new Integer(1), new Integer(2), new JIVariant(0,true)});
	System.out.println(results[1]);

	//now without automation
	JICallBuilder callObject = new JICallBuilder();
	callObject.setOpnum(1);//obtained from the IDL or TypeLib.
	callObject.addInParamAsInt(1,JIFlags.FLAG_NULL);
	callObject.addInParamAsInt(2,JIFlags.FLAG_NULL);
	callObject.addInParamAsPointer(new JIPointer(new Integer(0)),JIFlags.FLAG_NULL);
	//Since the retval is a top level pointer , it will get replaced with it's base type.
	callObject.addOutParamAsObject(Integer.class,JIFlags.FLAG_NULL);
	results = comObject.call(callObject);
	System.out.println(results[0]);
	JISession.destroySession(dispatch.getAssociatedSession());
}
 
开发者ID:howie,项目名称:jinterop,代码行数:24,代码来源:TestCOMServer.java

示例3: destroy

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public void destroy() {
    try {
        JISession.destroySession(session);
    } catch (JIException ex) {
        Logger.getLogger(ComSession.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:8,代码来源:ComSession.java

示例4: cleanup

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
/**
 * cleanup after the connection is closed
 */
protected void cleanup() {
	logger.info("Destroying DCOM session...");
	final JISession destructSession = this.session;
	final Thread destructor = new Thread(new Runnable() {

		public void run() {
			final long ts = System.currentTimeMillis();
			try {
				logger.debug("Starting destruction of DCOM session");
				JISession.destroySession(destructSession);
				logger.info("Destructed DCOM session");
			} catch (final Throwable e) {
				logger.warn("Failed to destruct DCOM session", e);
			} finally {
				logger.info(String.format("Session destruction took %s ms",
						System.currentTimeMillis() - ts));
			}
		}
	}, "UtgardSessionDestructor");
	destructor.setName("OPCSessionDestructor");
	destructor.setDaemon(true);
	destructor.start();
	logger.info("Destroying DCOM session... forked");

	this.errorMessageResolver = null;
	this.session = null;
	this.comServer = null;
	this.server = null;

	this.groups.clear();
}
 
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:35,代码来源:Server.java

示例5: main

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public static void main ( final String[] args ) throws IllegalArgumentException, UnknownHostException, JIException
{
    final TestConfiguration configuration = new MatrikonSimulationServerConfiguration ();

    OPCServer server = null;
    try
    {
        JISystem.setAutoRegisteration ( true );

        _session = JISession.createSession ( args[1], args[2], args[3] );

        //JIComServer comServer = new JIComServer ( JIClsid.valueOf ( configuration.getCLSID () ), args[0], _session );
        final JIComServer comServer = new JIComServer ( JIProgId.valueOf ( configuration.getProgId () ), args[0], _session );

        final IJIComObject serverObject = comServer.createInstance ();
        server = new OPCServer ( serverObject );

        final OPCGroupStateMgt group = server.addGroup ( "test", true, 100, 1234, 60, 0.0f, 1033 );

        testItems ( server, group, configuration.getReadItems () );
        server.removeGroup ( group, true );
    }
    catch ( final JIException e )
    {
        e.printStackTrace ();
        showError ( server, e.getErrorCode () );
    }
    finally
    {
        if ( _session != null )
        {
            JISession.destroySession ( _session );
        }
        _session = null;
    }
}
 
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:37,代码来源:Test2.java

示例6: disconnect

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
/**
 * <p>disconnect</p>
 *
 * @throws org.opennms.protocols.wmi.WmiException if any.
 */
public void disconnect() throws WmiException {
    try {
        JISession.destroySession(m_Session);
    } catch (JIException e) {
        throw new WmiException("Failed to destroy J-Interop session: " + e.getMessage(), e);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:13,代码来源:WmiClient.java

示例7: pasteArrayToWorkSheet

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public void pasteArrayToWorkSheet() throws JIException
{
	int dispId = dispatchOfWorkSheet.getIDsOfNames("Range");
	JIVariant variant = new JIVariant(new JIString("A1:C3"));
	Object[] out = new Object[]{JIVariant.class};
	JIVariant[] outVal2 = dispatchOfWorkSheet.get(dispId, new Object[]{variant});
	IJIDispatch dispRange = (IJIDispatch)JIObjectFactory.narrowObject(outVal2[0].getObjectAsComObject());


      JIVariant[][] newValue = {
    	        { new JIVariant(new JIString("defe")), new JIVariant(false), new JIVariant((double)(98765.0 / 12345.0))},
    	        { new JIVariant(new Date()), new JIVariant((int)5454),new JIVariant((float)(22.0 / 7.0) )       },
    	        { new JIVariant(true), new JIVariant(new JIString("dffe")),new JIVariant(new Date())}
    	      };

     // implement safe array XxX dimension

	dispRange.put("Value2", new JIVariant(new JIArray(newValue)));

	try {
		Thread.sleep(10000);
	} catch (InterruptedException e) {
		e.printStackTrace();
	}

	JIVariant variant2 = dispRange.get("Value2");
	JIArray newValue2 = variant2.getObjectAsArray();
	newValue = (JIVariant[][])newValue2.getArrayInstance();
	for(int i = 0; i < newValue.length; i++){
        for(int j = 0; j < newValue[i].length; j++){
          System.out.print(newValue[i][j] + "\t");
        }
        System.out.println();
	}

	dispatchOfWorkBook.callMethod("close",new Object[]{Boolean.FALSE,JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()});
	dispatch.callMethod("Quit");
	JISession.destroySession(session);
}
 
开发者ID:howie,项目名称:jinterop,代码行数:40,代码来源:MSExcel2.java

示例8: performOp

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public void performOp() throws JIException, InterruptedException
{
	System.out.println(((JIVariant)dispatch.get("Version")).getObjectAsString().getString());
	System.out.println(((JIVariant)dispatch.get("Path")).getObjectAsString().getString());
	JIVariant variant = dispatch.get("Documents");
	//JIInterfacePointer ptr = variant.getObjectAsInterfacePointer();
	//IJIDispatch documents = (IJIDispatch)JIObjectFactory.createCOMInstance(unknown,ptr);
	IJIDispatch documents = (IJIDispatch)JIObjectFactory.narrowObject(variant.getObjectAsComObject());
	JIString filePath = new JIString("c:/temp/test.doc");
	JIVariant variant2[] = documents.callMethodA("open",new Object[]{filePath.VariantByRef,JIVariant.OPTIONAL_PARAM()
			,JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),
			JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),
			JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),
			JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),
			JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()});
	//IJIDispatch document = (IJIDispatch)JIObjectFactory.createCOMInstance(unknown,variant2[0].getObjectAsInterfacePointer());
	IJIDispatch document = (IJIDispatch)JIObjectFactory.narrowObject(variant2[0].getObjectAsComObject());
	variant = document.get("Content");
	//IJIDispatch range = (IJIDispatch)JIObjectFactory.createCOMInstance(unknown,variant.getObjectAsInterfacePointer());
	IJIDispatch range = (IJIDispatch)JIObjectFactory.narrowObject(variant.getObjectAsComObject());

	variant = range.get("Find");
	IJIDispatch find = (IJIDispatch)JIObjectFactory.narrowObject(variant.getObjectAsComObject());

	Thread.sleep(2000);
	JIString findString = new JIString("ow");
	JIString replaceString = new JIString("igh");
	find.callMethodA("Execute",new Object[]{findString.VariantByRef,JIVariant.OPTIONAL_PARAM()
			,JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),
			JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),
			JIVariant.OPTIONAL_PARAM(),replaceString.VariantByRef,JIVariant.OPTIONAL_PARAM(),
			JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM(),
			JIVariant.OPTIONAL_PARAM()});
	Thread.sleep(5000);

	dispatch.callMethod("Quit", new Object[]{new JIVariant(-1,true),JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()});
	JISession.destroySession(dispatch.getAssociatedSession());
}
 
开发者ID:howie,项目名称:jinterop,代码行数:39,代码来源:MSWord2.java

示例9: close

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
/**
 * Close session.
 *
 * @throws KettleException
 */
public void close() throws KettleException {
	try {
		if (this.session != null) {
			try {
				JISession.destroySession(this.session);
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}
	}catch(Exception e) {
		throw new KettleException (e);
	}
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:19,代码来源:WMIQuery.java

示例10: killme

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
private void killme() throws JIException
{
	JISession.destroySession(session);
}
 
开发者ID:howie,项目名称:jinterop,代码行数:5,代码来源:MSWMI2.java

示例11: quitPowerPoint

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public void quitPowerPoint() throws JIException
{
	dispatch.callMethod("Quit");
	JISession.destroySession(dispatch.getAssociatedSession());
}
 
开发者ID:howie,项目名称:jinterop,代码行数:6,代码来源:MSPowerPoint2.java

示例12: DetachEventListener

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
void DetachEventListener() throws JIException
{
	JIObjectFactory.detachEventHandler(sysInfoServer,identifier);
	JISession.destroySession(dispatch.getAssociatedSession());
}
 
开发者ID:howie,项目名称:jinterop,代码行数:6,代码来源:MSSysInfo.java

示例13: start

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public void start() throws JIException
{
	unknown = comServer.createInstance();
	dispatch = (IJIDispatch)JIObjectFactory.narrowObject(unknown.queryInterface(IJIDispatch.IID));
	IJITypeInfo typeInfo = dispatch.getTypeInfo(0);
	IJITypeLib typeLib = (IJITypeLib)((Object[])typeInfo.getContainingTypeLib())[0];
	Object[] result = typeLib.getDocumentation(-1);
	System.out.println(((JIString)result[0]).getString());
	System.out.println(((JIString)result[1]).getString());
	System.out.println(((JIString)result[3]).getString());
	System.out.println("-------------------------------");
	int typeInfoCount = typeLib.getTypeInfoCount();
	int i = 0;
	String g_arrClassification[] = { "Enum","Struct","Module","Interface",
		"Dispinterface","Coclass","Typedef","Union"};
	for(; i < typeInfoCount;i++)
	{
		result = typeLib.getDocumentation(i);
		int j = typeLib.getTypeInfoType(i);


		System.out.println(((JIString)result[0]).getString());
		System.out.println(((JIString)result[1]).getString());
		System.out.println(((JIString)result[3]).getString());
		System.out.println(g_arrClassification[j]);

		IJITypeInfo typeInfo2 = typeLib.getTypeInfo(i);
		TypeAttr typeAttr =  typeInfo2.getTypeAttr();
		for(j = 0;j < typeAttr.cFuncs;j++)
		{
			FuncDesc funcDesc = typeInfo2.getFuncDesc(j);
			result = typeInfo2.getDocumentation(funcDesc.memberId);
			System.out.println(((JIString)result[0]).getString());
			System.out.println(((JIString)result[1]).getString());
			System.out.println(((JIString)result[3]).getString());
		}

		for(j = 0;j < typeAttr.cVars;j++)
		{
			if(j == 77)
			{
				int kk = 0;
			}
			VarDesc varDesc = typeInfo2.getVarDesc(j);
			result = typeInfo2.getDocumentation(varDesc.memberId);
			System.out.println(((JIString)result[0]).getString());
			System.out.println(((JIString)result[1]).getString());
			System.out.println(((JIString)result[3]).getString());
			//System.out.println(j);
		}


		System.out.println("***************************************");
	}
	JISession.destroySession(dispatch.getAssociatedSession());
}
 
开发者ID:howie,项目名称:jinterop,代码行数:57,代码来源:MSTypeLibraryBrowser.java

示例14: doStuff

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public void doStuff() {

			try {
				JISession session = JISession.createSession( domain, user, password );

				//this.session.setGlobalSocketTimeout( 60000 );

				// by name, requires local access (for registry search), or a populated progIdVsClsidDB.properties
				JIProgId progId = JIProgId.valueOf( comServerName );

				JIComServer baseComServer = new JIComServer( progId, host, session );

				// Do it by clsid
				//JIClsid clsid = JIClsid.valueOf( "76A6415B-CB41-11d1-8B02-00600806D9B6" );
				//clsid.setAutoRegistration( true );
				//baseComServer = new JIComServer( clsid, host, session );

				// I'm not really sure what the deal is with this
				// Create an intermediary instance?
				IJIComObject unknown = baseComServer.createInstance();

				IJIComObject baseComObject = (IJIComObject) unknown.queryInterface( comObjectId );

				IJIDispatch baseDispatch = (IJIDispatch) JIObjectFactory.narrowObject( baseComObject.queryInterface(IJIDispatch.IID) );

				JIVariant connectServer = (JIVariant)
				baseDispatch.callMethodA(
						"ConnectServer"
						, new Object[] {
								new JIString( host )
								, JIVariant.OPTIONAL_PARAM()
								, JIVariant.OPTIONAL_PARAM()
								, JIVariant.OPTIONAL_PARAM()
								, JIVariant.OPTIONAL_PARAM()
								, JIVariant.OPTIONAL_PARAM()
								, new Integer( 0 )
								, JIVariant.OPTIONAL_PARAM()
						}
					) [ 0 ];

				JISession.destroySession( session );
				System.out.println( "doStuff() run complete" );
			}
			catch ( Exception e ) {
				JISystem.getLogger().log( Level.SEVERE, "Caught exception: ", e );
			}
		}
 
开发者ID:howie,项目名称:jinterop,代码行数:48,代码来源:TestJIThreading.java

示例15: quit

import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
private void quit () throws JIException
{
	ieObjectDispatch.callMethod("Quit");
	JISession.destroySession(ieObjectDispatch.getAssociatedSession());
}
 
开发者ID:howie,项目名称:jinterop,代码行数:6,代码来源:MSInternetExplorer.java


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