本文整理汇总了Java中org.jinterop.dcom.core.JISession类的典型用法代码示例。如果您正苦于以下问题:Java JISession类的具体用法?Java JISession怎么用?Java JISession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JISession类属于org.jinterop.dcom.core包,在下文中一共展示了JISession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.jinterop.dcom.core.JISession; //导入依赖的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,代码来源:TestWinNativeSSO.java
示例2: 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
示例3: 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
示例4: 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);
}
}
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:28,代码来源:WMIQuery.java
示例5: ComSession
import org.jinterop.dcom.core.JISession; //导入依赖的package包/类
/**
* @param domain Domain of the user associated with this session.
* @param userName Name of the user has required rights on the host.
* @param password Password of the user.
*/
public ComSession(String domain, String userName, String password) {
super();
//super.defineFunctionProperties(new String[]{"destroy", "createObject"}, ComSession.class, ScriptableObject.READONLY);//NOI18N
session = JISession.createSession(domain, userName, password);
}
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:12,代码来源:ComSession.java
示例6: 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
示例7: 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
示例8: 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
示例9: 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);
testItems(server, group, new String[] { "Saw-toothed Waves.Int2",
"Saw-toothed Waves.test2" });
// clean up
server.removeGroup(group, true);
}
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:31,代码来源:DCOMTest4.java
示例10: 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);
final OPCBrowseServerAddressSpace serverBrowser = server.getBrowser();
/**
* Flat形式获取所有Item信息
*/
browseFlat(serverBrowser);
/**
* 获取所有的Group和Item信息
*/
browseTree(serverBrowser);
}
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:31,代码来源:DCOMTest2.java
示例11: 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);
final OPCItemIO itemIO = server.getItemIOService();
queryItems(itemIO, "Saw-toothed Waves.Int1");
// clean up
server.removeGroup(group, true);
}
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:31,代码来源:DCOMTest6.java
示例12: 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);
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,代码来源:DCOMTest5.java
示例13: 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);
}
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:32,代码来源:DCOMTest3.java
示例14: 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);
testItems(group, new String[] { "Saw-toothed Waves.Int2" });
// clean up
server.removeGroup(group, true);
}
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:32,代码来源:DCOMTest7.java
示例15: 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
示例16: 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
示例17: MSWMI2
import org.jinterop.dcom.core.JISession; //导入依赖的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,代码来源:MSWMI2.java
示例18: 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));
}
开发者ID:howie,项目名称:jinterop,代码行数:11,代码来源:MSSysInfo.java
示例19: 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();
}
}
开发者ID:howie,项目名称:jinterop,代码行数:33,代码来源:Test10KServer.java
示例20: 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));
}
开发者ID:howie,项目名称:jinterop,代码行数:9,代码来源:MSEnumVariant.java
注:本文中的org.jinterop.dcom.core.JISession类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论