createinstance.java_Java JIComServer.createInstance方法代碼示例

本文整理匯總了Java中org.jinterop.dcom.core.JIComServer.createInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java JIComServer.createInstance方法的具體用法?Java JIComServer.createInstance怎麽用?Java JIComServer.createInstance使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jinterop.dcom.core.JIComServer的用法示例。

在下文中一共展示了JIComServer.createInstance方法的20個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: main

​點讚 3

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public static void main(String[] args) {

try {

JISession session = JISession.createSession();

JIComServer comServer = new JIComServer(JIClsid.valueOf("00024500-0000-0000-C000-000000000046"), session);

IJIComObject comObject = comServer.createInstance();

int h = 0;

//SSPIJNIClient jniClient = SSPIJNIClient.getInstance();

//byte[] type1Message = jniClient.invokePrepareSSORequest();

//jcifs.util.Hexdump.hexdump(System.out, type1Message, 0, type1Message.length);

//int h = 0;

//

//jniClient.invokeUnInitialize();

//

//type1Message = new Type1Message().toByteArray();

//jcifs.util.Hexdump.hexdump(System.out, type1Message, 0, type1Message.length);

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

開發者ID:howie,項目名稱:jinterop,代碼行數:25,

示例2: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的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,

示例3: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public static void main(String[] args) throws Exception {

JISystem.setAutoRegisteration(true);

/**

* Session獲取

*/

JISession _session = JISession.createSession(

getEntryValue(CONFIG_DOMAIN), getEntryValue(CONFIG_USERNAME),

getEntryValue(CONFIG_PASSWORD));

final JIComServer comServer = new JIComServer(

JIClsid.valueOf(getEntryValue(CONFIG_CLSID)),

getEntryValue(CONFIG_HOST), _session);

final IJIComObject serverObject = comServer.createInstance();

OPCServer server = new OPCServer(serverObject);

/**

* 添加一個Group的信息

*/

OPCGroupStateMgt group = server.addGroup("test", true, 100, 1234, 60,

0.0f, 1033);

testItems(server, group, new String[] { "Saw-toothed Waves.Int2",

"Saw-toothed Waves.test2" });

// clean up

server.removeGroup(group, true);

}

開發者ID:luoyan35714,項目名稱:OPC_Client,代碼行數:31,

示例4: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public static void main(String[] args) throws Exception {

JISystem.setAutoRegisteration(true);

/**

* Session獲取

*/

JISession _session = JISession.createSession(

getEntryValue(CONFIG_DOMAIN), getEntryValue(CONFIG_USERNAME),

getEntryValue(CONFIG_PASSWORD));

final JIComServer comServer = new JIComServer(

JIClsid.valueOf(getEntryValue(CONFIG_CLSID)),

getEntryValue(CONFIG_HOST), _session);

final IJIComObject serverObject = comServer.createInstance();

OPCServer server = new OPCServer(serverObject);

final OPCBrowseServerAddressSpace serverBrowser = server.getBrowser();

/**

* Flat形式獲取所有Item信息

*/

browseFlat(serverBrowser);

/**

* 獲取所有的Group和Item信息

*/

browseTree(serverBrowser);

}

開發者ID:luoyan35714,項目名稱:OPC_Client,代碼行數:31,

示例5: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public static void main(String[] args) throws Exception {

JISystem.setAutoRegisteration(true);

/**

* Session獲取

*/

JISession _session = JISession.createSession(

getEntryValue(CONFIG_DOMAIN), getEntryValue(CONFIG_USERNAME),

getEntryValue(CONFIG_PASSWORD));

final JIComServer comServer = new JIComServer(

JIClsid.valueOf(getEntryValue(CONFIG_CLSID)),

getEntryValue(CONFIG_HOST), _session);

final IJIComObject serverObject = comServer.createInstance();

OPCServer server = new OPCServer(serverObject);

/**

* 添加一個Group的信息

*/

OPCGroupStateMgt group = server.addGroup("test", true, 100, 1234, 60,

0.0f, 1033);

final OPCItemIO itemIO = server.getItemIOService();

queryItems(itemIO, "Saw-toothed Waves.Int1");

// clean up

server.removeGroup(group, true);

}

開發者ID:luoyan35714,項目名稱:OPC_Client,代碼行數:31,

示例6: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public static void main(String[] args) throws Exception {

JISystem.setAutoRegisteration(true);

/**

* Session獲取

*/

JISession _session = JISession.createSession(

getEntryValue(CONFIG_DOMAIN), getEntryValue(CONFIG_USERNAME),

getEntryValue(CONFIG_PASSWORD));

final JIComServer comServer = new JIComServer(

JIClsid.valueOf(getEntryValue(CONFIG_CLSID)),

getEntryValue(CONFIG_HOST), _session);

final IJIComObject serverObject = comServer.createInstance();

OPCServer server = new OPCServer(serverObject);

/**

* 添加一個Group的信息

*/

OPCGroupStateMgt group = server.addGroup("test", true, 100, 1234, 60,

0.0f, 1033);

final OPCItemProperties itemProperties = server

.getItemPropertiesService();

dumpItemProperties(itemProperties, "Saw-toothed Waves.Int");

// clean up

server.removeGroup(group, true);

LOGGER.info("test");

}

開發者ID:luoyan35714,項目名稱:OPC_Client,代碼行數:33,

示例7: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public static void main(String[] args) throws Exception {

JISystem.setAutoRegisteration(true);

/**

* Session獲取

*/

JISession _session = JISession.createSession(

getEntryValue(CONFIG_DOMAIN), getEntryValue(CONFIG_USERNAME),

getEntryValue(CONFIG_PASSWORD));

final JIComServer comServer = new JIComServer(

JIClsid.valueOf(getEntryValue(CONFIG_CLSID)),

getEntryValue(CONFIG_HOST), _session);

final IJIComObject serverObject = comServer.createInstance();

OPCServer server = new OPCServer(serverObject);

/**

* 添加一個Group的信息

*/

OPCGroupStateMgt group = server.addGroup("test", true, 100, 1234, 60,

0.0f, 1033);

enumerateGroups(server, OPCENUMSCOPE.OPC_ENUM_PUBLIC);

enumerateGroups(server, OPCENUMSCOPE.OPC_ENUM_PRIVATE);

enumerateGroups(server, OPCENUMSCOPE.OPC_ENUM_ALL);

// clean up

server.removeGroup(group, true);

}

開發者ID:luoyan35714,項目名稱:OPC_Client,代碼行數:32,

示例8: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public static void main(String[] args) throws Exception {

JISystem.setAutoRegisteration(true);

/**

* Session獲取

*/

JISession _session = JISession.createSession(

getEntryValue(CONFIG_DOMAIN), getEntryValue(CONFIG_USERNAME),

getEntryValue(CONFIG_PASSWORD));

final JIComServer comServer = new JIComServer(

JIClsid.valueOf(getEntryValue(CONFIG_CLSID)),

getEntryValue(CONFIG_HOST), _session);

final IJIComObject serverObject = comServer.createInstance();

OPCServer server = new OPCServer(serverObject);

/**

* 添加一個Group的信息

*/

OPCGroupStateMgt group = server.addGroup("test", true, 100, 1234, 60,

0.0f, 1033);

testItems(group, new String[] { "Saw-toothed Waves.Int2" });

// clean up

server.removeGroup(group, true);

}

開發者ID:luoyan35714,項目名稱:OPC_Client,代碼行數:32,

示例9: MSWMI2

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public MSWMI2(String address, String[] args) throws JIException, UnknownHostException

{

this.address = address;

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

//session.useSessionSecurity(true);

//session.setGlobalSocketTimeout(5000);

comStub = new JIComServer(JIClsid.valueOf("76a64158-cb41-11d1-8b02-00600806d9b6"),address,session);

IJIComObject unknown = comStub.createInstance();

comObject = (IJIComObject)unknown.queryInterface("76A6415B-CB41-11d1-8B02-00600806D9B6");//ISWbemLocator

//This will obtain the dispatch interface

dispatch = (IJIDispatch)JIObjectFactory.narrowObject(comObject.queryInterface(IJIDispatch.IID));

}

開發者ID:howie,項目名稱:jinterop,代碼行數:13,

示例10: MSSysInfo

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

MSSysInfo(String[] args) throws JIException, UnknownHostException

{

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

session.useSessionSecurity(true);

JIComServer comServer = new JIComServer(JIProgId.valueOf("SYSINFO.SysInfo"),args[0],session);

sysInfoServer = comServer.createInstance();

sysInfoObject = (IJIComObject)sysInfoServer.queryInterface("6FBA474C-43AC-11CE-9A0E-00AA0062BB4C");

dispatch = (IJIDispatch)JIObjectFactory.narrowObject(sysInfoObject.queryInterface(IJIDispatch.IID));

}

開發者ID:howie,項目名稱:jinterop,代碼行數:11,

示例11: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public static void main(String[] args) {

try {

if (args.length < 4)

{

System.out.println("Please provide address domain username password");

return;

}

JISystem.setInBuiltLogHandler(false);

JISystem.setAutoRegisteration(true);

for (int i=0;i<10000;++i)

{

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

JIComServer comServer = new JIComServer(JIProgId.valueOf("MSMQ.MSMQQueueInfo"),args[0],session);

IJIComObject unknown = comServer.createInstance();

IJIDispatch dispatch = (IJIDispatch)JIObjectFactory.narrowObject(unknown.queryInterface(IJIDispatch.IID));

//JISession.destroySession(session);

Thread.sleep(150);

if(i%100 == 0)

{

System.out.println(new String().valueOf(i));

}

System.gc();

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

開發者ID:howie,項目名稱:jinterop,代碼行數:33,

示例12: MSEnumVariant

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public MSEnumVariant(String address,String[] args) throws JIException, UnknownHostException

{

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

comServer = new JIComServer(JIProgId.valueOf("StdCollection.VBCollection"),address,session);

IJIComObject object = comServer.createInstance();

dispatch = (IJIDispatch)JIObjectFactory.narrowObject(object.queryInterface(IJIDispatch.IID));

}

開發者ID:howie,項目名稱:jinterop,代碼行數:9,

示例13: MSWMI

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public MSWMI(String address, String[] args) throws JIException, UnknownHostException

{

this.address = address;

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

session.useSessionSecurity(true);

session.setGlobalSocketTimeout(5000);

comStub = new JIComServer(JIProgId.valueOf("WbemScripting.SWbemLocator"),address,session);

IJIComObject unknown = comStub.createInstance();

comObject = (IJIComObject)unknown.queryInterface("76A6415B-CB41-11d1-8B02-00600806D9B6");//ISWbemLocator

//This will obtain the dispatch interface

dispatch = (IJIDispatch)JIObjectFactory.narrowObject(comObject.queryInterface(IJIDispatch.IID));

}

開發者ID:howie,項目名稱:jinterop,代碼行數:13,

示例14: SampleTestServer

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public SampleTestServer(String address, String[] args) throws JIException, UnknownHostException {

this.address = address;

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

comStub = new JIComServer(JIProgId.valueOf("SampleTestServer.TestServer"), address, session);

IJIComObject unknown = comStub.createInstance();

comObject = (IJIComObject) unknown.queryInterface("1F438B1C-02BA-462E-A971-8E0640C141E5"); //ITestServer

}

開發者ID:howie,項目名稱:jinterop,代碼行數:8,

示例15: MSInternetExplorer

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public MSInternetExplorer(String address, String[] args) throws JIException, UnknownHostException

{

JISystem.mapHostNametoIP("locutus", "192.168.0.130");

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

session.useNTLMv2(true);

session.useSessionSecurity(true);

comServer = new JIComServer(JIProgId.valueOf("InternetExplorer.Application"),address,session);

ieObject = comServer.createInstance();

IJIComObject ieObjectWebBrowser2 = (IJIComObject)ieObject.queryInterface("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E");

ieObjectDispatch = (IJIDispatch)JIObjectFactory.narrowObject((IJIComObject)ieObject.queryInterface(IJIDispatch.IID));

}

開發者ID:howie,項目名稱:jinterop,代碼行數:13,

示例16: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

public static void main(String[] args) throws Exception {

JISystem.setAutoRegisteration(true);

JISession _session = JISession.createSession(

getEntryValue(CONFIG_DOMAIN), getEntryValue(CONFIG_USERNAME),

getEntryValue(CONFIG_PASSWORD));

final JIComServer comServer = new JIComServer(

JIClsid.valueOf(getEntryValue(CONFIG_CLSID)),

getEntryValue(CONFIG_HOST), _session);

final IJIComObject serverObject = comServer.createInstance();

OPCServer server = new OPCServer(serverObject);

dumpServerStatus(server);

}

開發者ID:luoyan35714,項目名稱:OPC_Client,代碼行數:20,

示例17: main

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的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,

示例18: doStuff

​點讚 2

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的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,

示例19: ServerList

​點讚 1

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

/**

* Create a new instance with an already existing session

* @param session the DCOM session

* @param host the host to query

* @throws IllegalArgumentException

* @throws UnknownHostException

* @throws JIException

*/

public ServerList ( final JISession session, final String host ) throws IllegalArgumentException, UnknownHostException, JIException

{

this._session = session;

JIComServer comServer = new JIComServer ( JIClsid.valueOf ( Constants.OPCServerList_CLSID ), host, this._session );

this._serverList = new OPCServerList ( comServer.createInstance () );

}

開發者ID:luoyan35714,項目名稱:OPC_Client,代碼行數:15,

示例20: createObject

​點讚 1

import org.jinterop.dcom.core.JIComServer; //導入方法依賴的package包/類

/**

* Creates OLE automation interface wrapper.

* @param progId user-friendly string such as "Excel.Application".

* @param host address of the host where the COM object resides.This should be in the IEEE IP format (e.g. 192.168.170.6) or a resolvable HostName.

* @return a ComObject instance

* @throws JIException

* @throws UnknownHostException

*/

public ComObject createObject(String progId, String host) throws JIException, UnknownHostException {

comServer = new JIComServer(JIProgId.valueOf(progId), host, session);

IJIComObject comObject = comServer.createInstance();

return ComObject.getInstance(comObject);

}

開發者ID:marat-gainullin,項目名稱:platypus-js,代碼行數:14,

注:本文中的org.jinterop.dcom.core.JIComServer.createInstance方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值