本文整理汇总了Java中org.jinterop.dcom.core.JISession类的典型用法代码示例。如果您正苦于以下问题:Java JISession类的具体用法?Java JISession怎么用?Java JISession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JISession类属于org.jinterop.dcom.core包,在下文中一共展示了JISession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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());
}
示例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());
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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();
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
}