本文整理汇总了Java中org.jinterop.dcom.core.JISession.createSession方法的典型用法代码示例。如果您正苦于以下问题:Java JISession.createSession方法的具体用法?Java JISession.createSession怎么用?Java JISession.createSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jinterop.dcom.core.JISession
的用法示例。
在下文中一共展示了JISession.createSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
/**
* Create a new session.
*
* @throws KettleException
*/
public void connect() throws KettleException {
try {
JISystem.getLogger().setLevel(Level.OFF);
JISystem.setAutoRegisteration(true);
if(Const.isEmpty(getHost())) {
this.session = JISession.createSession();
}else {
this.session = JISession.createSession(getDomain(), getUserName(), this.password);
}
this.session.useSessionSecurity(true);
if(log.isDebug()) {
log.logDebug(BaseMessages.getString(PKG, "WMIQuery.SessionCreated", this.session.getSessionIdentifier()));
}
this.comServer = new JIComServer(valueOf("WbemScripting.SWbemLocator"), this.hostName , this.session);
this.wbemLocator = (IJIDispatch) narrowObject(this.comServer.createInstance().queryInterface(IID));
}catch(Exception e) {
throw new KettleException(e);
}
}
示例2: MSEnumVariant
import org.jinterop.dcom.core.JISession; //导入方法依赖的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));
}
示例3: FirstContact_Stub
import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public FirstContact_Stub(String address) throws Exception
{
JIArray arry123 = new JIArray(new Byte[10][0],true);
JIStruct struct123 = new JIStruct();
struct123.addMember(arry123);
struct123.addMember(0,new Integer(1));
struct123.addMember(0,new JIPointer(arry123));
//JIArray array = new JIArray(new short[]{0});
JISystem.setAutoRegisteration(true);
JISystem.setInBuiltLogHandler(false);
//Config.setProperty("jcifs.smb.client.domain","ITLINFOSYS");
session = JISession.createSession("FDGNT","roopchand","QweQwe007");
//session = JISession.createSession("10.74.85.56","itl-hw-38602a\\Vikram","[email protected]");
//session = JISession.createSession("federation","administrator","enterprise");
//stub = new JIComServer(JIClsid.valueOf("8B21775E-717D-11CE-AB5B-D41203C10000"),address,session);
//stub = new JIComServer(JIProgId.valueOf(session,"TestCOM123.TestServer2"),address,session);
//stub = new JIComServer(JIProgId.valueOf(session,"VirtualServer.Application"),address,session);
// stub = new JIComServer(JIProgId.valueOf(session,"ArrayTry.myarray"),address,session);
stub = new JIComServer(JIProgId.valueOf("ATLDemo.TestSafeArray"),address,session);
//stub = new JIComServer(JIProgId.valueOf(session,"SafeArrayDemo.SafeArrayTest"),address,session);
//stub = new JIComServer(JIProgId.valueOf(session,"Project1.Class1"),address,session);
//stub = new JIComServer(JIProgId.valueOf(session,"TLI.TLIApplication"),address,session);
//stub = new JIComServer(JIProgId.valueOf(session,"TestSinglePtr.TestSinglePtr2"),address,session);
}
示例4: TestCOMServer
import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public TestCOMServer(String address, String[] args) throws JIException, UnknownHostException
{
JISession session = JISession.createSession(args[1],args[2],args[3]);
//instead of this the ProgID "TestCOMServer.ITestCOMServer" can be used as well.
//comStub = new JIComServer(JIProgId.valueOf(session,"TestCOMServer.ITestCOMServer"),address,session);
//CLSID of ITestCOMServer
comStub = new JIComServer(JIClsid.valueOf("44A9CD09-0D9B-4FD2-9B8A-0151F2E0CAD1"),address,session);
}
示例5: main
import org.jinterop.dcom.core.JISession; //导入方法依赖的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);
}
示例6: SampleTestServer
import org.jinterop.dcom.core.JISession; //导入方法依赖的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
}
示例7: MSSysInfo
import org.jinterop.dcom.core.JISession; //导入方法依赖的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));
}
示例8: MSInternetExplorer
import org.jinterop.dcom.core.JISession; //导入方法依赖的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));
}
示例9: main
import org.jinterop.dcom.core.JISession; //导入方法依赖的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();
}
}
示例10: QtpComTest
import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public QtpComTest(String address, String domain, String username, String password) throws JIException, UnknownHostException{
JISystem.getLogger().setLevel(Level.FINEST);
/*Let the j-Interop library do this for you. You can set the "autoRegistration" flag in the
JISystem class. When the library encounters a "Class not registered" exception, it will
perform all the registry changes if the autoRegistration flag is set. And then re-attempt
loading the COM Server. Please have a look at MSSysInfo,MSWMI examples.*/
JISystem.setAutoRegisteration(true);
session = JISession.createSession(domain,username,password);
comServer = new JIComServer(JIProgId.valueOf("QuickTest.Application"), address, session);
// session.setGlobalSocketTimeout(30000);
}
示例11: MetrikonOPC
import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public MetrikonOPC(String address, String[] args) throws JIException, UnknownHostException
{
JISession session = JISession.createSession(args[1],args[2],args[3]);
comStub = new JIComServer(JIProgId.valueOf("Matrikon.OPC.Simulation"),address,session);
}
示例12: main
import org.jinterop.dcom.core.JISession; //导入方法依赖的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);
}
示例13: MSExcel3
import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public MSExcel3(String address, String args[]) throws JIException, UnknownHostException
{
JISession session = JISession.createSession(args[1],args[2],args[3]);
comServer = new JIComServer(JIProgId.valueOf("Excel.Application"),address,session);
}
示例14: MSExcel2
import org.jinterop.dcom.core.JISession; //导入方法依赖的package包/类
public MSExcel2(String address, String[] args) throws JIException, UnknownHostException
{
session = JISession.createSession(args[1],args[2],args[3]);
// session.useSessionSecurity(true);
comServer = new JIComServer(JIProgId.valueOf("Excel.Application"),address,session);
}
示例15: 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 );
}
}