congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
JISession
Code IndexAdd Tabnine to your IDE (free)

How to use
JISession
in
org.jinterop.dcom.core

Best Java code snippets using org.jinterop.dcom.core.JISession (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: org.jinterop/j-interop

public MSExcel2_Test(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);
}
origin: org.kohsuke.jinterop/j-interop

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));
}
origin: org.openscada.jinterop/org.openscada.jinterop.core

@Override
protected void finalize ()
{
  try
  {
    destroySession ( this );
  }
  catch ( final JIException e )
  {
    logger.warn ( "Exception in finalize when destroying session", e );
  }
}
origin: org.kohsuke.jinterop/j-interop

/** Creates a new session using credentials of the <code>session</code>parameter. The new session is not yet attached to a
 * COM server.
 *
 * @param session
 * @return
 * @see JIComServer#JIComServer(JIClsid, JISession)
 * @see JIComServer#JIComServer(JIProgId, JISession)
 */
public static JISession createSession(JISession session)
{
  JISession newSession = createSession(session.getDomain(),session.getUserName(),session.getPassword());
  newSession.authInfo = session.authInfo;
  return newSession;
}
origin: org.openscada.jinterop/org.openscada.jinterop.core

private JIStruct prepareForReleaseRef ( final String IPID, final int numInstancesfirsttime ) throws JIException
{
  final JIStruct remInterface = new JIStruct ();
  remInterface.addMember ( new rpc.core.UUID ( IPID ) );
  remInterface.addMember ( new Integer ( numInstancesfirsttime + 5 ) ); // numInstancesfirsttime of the original and 5 for the addRef done later on.
  remInterface.addMember ( new Integer ( 0 ) );//private refs = 0
  logger.warn ( "prepareForReleaseRef: Releasing numInstancesfirsttime + 5 references of IPID: {} session: {} , numInstancesfirsttime is {}", new Object[] { IPID, getSessionIdentifier (), numInstancesfirsttime } );
  debug_delIpids ( IPID, numInstancesfirsttime + 5 );
  return remInterface;
}
origin: org.openscada.jinterop/org.openscada.jinterop.core

newsession = JISession.createSession ( session );
newsession.setGlobalSocketTimeout ( session.getGlobalSocketTimeout () );
newsession.useSessionSecurity ( session.isSessionSecurityEnabled () );
newsession.useNTLMv2 ( session.isNTLMv2Enabled () );
final JIComServer comServer = new JIComServer ( newsession, ptr, null );
retval = comServer.getInstance ();
origin: org.kohsuke.jinterop/j-interop

if (session.getStub() != null)
super.getProperties().setProperty("rpc.security.username", session.getUserName());
super.getProperties().setProperty("rpc.security.password", session.getPassword());
super.getProperties().setProperty("rpc.ntlm.domain", session.getDomain());
super.getProperties().setProperty("rpc.socketTimeout", new Integer(session.getGlobalSocketTimeout()).toString());
if (session.isNTLMv2Enabled())
if (session.isSSOEnabled())
this.session.setTargetServer(getAddress().substring(getAddress().indexOf(":") + 1,getAddress().indexOf("[")));
oxidResolver = new JIOxidResolver(((JIStdObjRef)interfacePointer.getObjectReference(JIInterfacePointer.OBJREF_STANDARD)).getOxid());
try {
if (session.isSessionSecurityEnabled())
remunknownIPID = oxidResolver.getIPID();
interfacePtrCtor = interfacePointer;
this.session.setStub(this);
this.session.setStub2(new JIRemUnknownServer(session, remunknownIPID, getAddress()));
origin: org.openscada.jinterop/org.openscada.jinterop.core

super.getProperties ().setProperty ( "rpc.socketTimeout", new Integer ( session.getGlobalSocketTimeout () ).toString () );
super.setAddress ( address );
if ( session.isNTLMv2Enabled () )
if ( session.isSSOEnabled () )
  super.getProperties ().setProperty ( "rpc.security.username", session.getUserName () );
  super.getProperties ().setProperty ( "rpc.security.password", session.getPassword () );
  super.getProperties ().setProperty ( "rpc.ntlm.domain", session.getDomain () );
this.session.setTargetServer ( address.substring ( address.indexOf ( ":" ) + 1, address.indexOf ( "[" ) ) );
try
        if ( session.isSSOEnabled () )
          registry = JIWinRegFactory.getSingleTon ().getWinreg ( session.getTargetServer (), true );
          registry = JIWinRegFactory.getSingleTon ().getWinreg ( new JIDefaultAuthInfoImpl ( session.getDomain (), session.getUserName (), session.getPassword () ), session.getTargetServer (), true );
this.session.setStub ( this );
this.session.setStub2 ( new JIRemUnknownServer ( session, this.remunknownIPID, getAddress () ) );
origin: org.jinterop/j-interop

newsession = JISession.createSession(session);
newsession.setGlobalSocketTimeout(session.getGlobalSocketTimeout());
newsession.useSessionSecurity(session.isSessionSecurityEnabled());
JIComServer comServer = new JIComServer(newsession,ptr,null);
retval = comServer.getInstance();
origin: OpenNMS/opennms

try {
  m_Session = JISession.createSession(domain, username, password);
  m_Session.useSessionSecurity(true);
  m_Session.setGlobalSocketTimeout(5000);
  if (m_Session != null) {
    try {
      JISession.destroySession(m_Session);
    } catch (JIException e1) {
      LOG.error("Failed to destroy session after incomplete connect with host '{}'.", m_Address, e1);
  if (m_Session != null) {
    try {
      JISession.destroySession(m_Session);
    } catch (JIException e1) {
      LOG.error("Failed to destroy session after unknown host '{}'.", m_Address, e1);
origin: org.kohsuke.jinterop/j-interop

super.setTransportFactory(JIComTransportFactory.getSingleTon());
super.setProperties(new Properties(defaults));
super.getProperties().setProperty("rpc.socketTimeout", new Integer(session.getGlobalSocketTimeout()).toString());
if (session.isNTLMv2Enabled())
if (session.isSSOEnabled())
  super.getProperties().setProperty("rpc.security.username", session.getUserName());
  super.getProperties().setProperty("rpc.security.password", session.getPassword());
  super.getProperties().setProperty("rpc.ntlm.domain", session.getDomain());
if (session.isSessionSecurityEnabled())
this.session.setStub2(this);
origin: org.jinterop/j-interop

super.getProperties().setProperty("rpc.security.username", session.getUserName());
super.getProperties().setProperty("rpc.security.password", session.getPassword());
super.getProperties().setProperty("rpc.ntlm.domain", session.getDomain());
super.getProperties().setProperty("rpc.socketTimeout", new Integer(session.getGlobalSocketTimeout()).toString());
super.setAddress(address);
this.session.setTargetServer(address.substring(address.indexOf(":") + 1,address.indexOf("[")));
try{
  init();
        registry = JIWinRegFactory.getSingleTon().getWinreg(new JIDefaultAuthInfoImpl(session.getDomain(),session.getUserName(),session.getPassword()),session.getTargetServer(),true);
        JIPolicyHandle hkcr = registry.winreg_OpenHKCR();
        JIPolicyHandle key = registry.winreg_CreateKey(hkcr,"CLSID\\{" + this.clsid + "}",IJIWinReg.REG_OPTION_NON_VOLATILE,IJIWinReg.KEY_ALL_ACCESS );
this.session.setStub(this);
origin: org.jvnet.hudson.main/hudson-core

@Override
public void afterDisconnect(SlaveComputer computer, TaskListener listener) {
  try {
    JIDefaultAuthInfoImpl auth = createAuth();
    JISession session = JISession.createSession(auth);
    session.setGlobalSocketTimeout(60000);
    SWbemServices services = WMI.connect(session, computer.getName());
    Win32Service slaveService = services.getService("hudsonslave");
    if(slaveService!=null) {
      listener.getLogger().println(Messages.ManagedWindowsServiceLauncher_StoppingService());
      slaveService.StopService();
    }
  } catch (UnknownHostException e) {
    e.printStackTrace(listener.error(e.getMessage()));
  } catch (JIException e) {
    e.printStackTrace(listener.error(e.getMessage()));
  }
}
origin: org.kohsuke.jinterop/j-interop

server = session.getTargetServer();
if (session.isSSOEnabled())
  winreg = JIWinRegFactory.getSingleTon().getWinreg(new JIDefaultAuthInfoImpl(session.getDomain(),session.getUserName(),session.getPassword()),server,true);
origin: org.kohsuke.jinterop/j-interop

public MSExcel(String address,String[] args) throws JIException, UnknownHostException
{
  session = JISession.createSession(args[1],args[2],args[3]);
  comServer = new JIComServer(JIProgId.valueOf("Excel.Application"),address,session);
}
origin: org.openscada.jinterop/org.openscada.jinterop.core

holder.username = session.getUserName ();
holder.password = session.getPassword ();
holder.domain = session.getDomain ();
holder.currentSetOIDs.put ( oid, oid );
holder.modified = true;
origin: org.jinterop/j-interop

public void release() throws JIException
{
  checkLocal();
  JICallBuilder obj = new JICallBuilder(true);
  obj.setParentIpid(ptr.getIPID());
  obj.setOpnum(2);//release
  //length
  obj.addInParamAsShort((short)1,JIFlags.FLAG_NULL);
  //ipid to addfref on
  JIArray array = new JIArray(new rpc.core.UUID[]{new rpc.core.UUID(ptr.getIPID())},true);
  obj.addInParamAsArray(array,JIFlags.FLAG_NULL);
  //TODO requesting 5 for now, will later build caching mechnaism to exhaust 5 refs first before asking for more
  // same with release.
  obj.addInParamAsInt(5,JIFlags.FLAG_NULL);
  obj.addInParamAsInt(0,JIFlags.FLAG_NULL);//private refs = 0
  if (JISystem.getLogger().isLoggable(Level.WARNING))
  {
    JISystem.getLogger().warning("RELEASE called directly ! removing 5 references for " + ptr.getIPID()+ " session: " + session.getSessionIdentifier());
    JISession.debug_delIpids(ptr.getIPID(), 5);
  }
  session.getStub().addRef_ReleaseRef(obj);
}
origin: org.jinterop/j-interop

if (JISystem.getLogger().isLoggable(Level.WARNING))
  JISystem.getLogger().warning("addRef: Adding 5 references for " + ptr.getIPID() + " session: " + session.getSessionIdentifier());
  JISession.debug_addIpids(ptr.getIPID(), 5);
session.getStub().addRef_ReleaseRef(obj);
origin: org.openscada.jinterop/org.openscada.jinterop.core

@Override
public void release () throws JIException
{
  checkLocal ();
  final JICallBuilder obj = new JICallBuilder ( true );
  obj.setParentIpid ( this.ptr.getIPID () );
  obj.setOpnum ( 2 );//release
  //length
  obj.addInParamAsShort ( (short)1, JIFlags.FLAG_NULL );
  //ipid to addfref on
  final JIArray array = new JIArray ( new rpc.core.UUID[] { new rpc.core.UUID ( this.ptr.getIPID () ) }, true );
  obj.addInParamAsArray ( array, JIFlags.FLAG_NULL );
  //TODO requesting 5 for now, will later build caching mechnaism to exhaust 5 refs first before asking for more
  // same with release.
  obj.addInParamAsInt ( 5, JIFlags.FLAG_NULL );
  obj.addInParamAsInt ( 0, JIFlags.FLAG_NULL );//private refs = 0
  if ( logger.isInfoEnabled () )
  {
    logger.info ( "RELEASE called directly ! removing 5 references for " + this.ptr.getIPID () + " session: " + this.session.getSessionIdentifier () );
    JISession.debug_delIpids ( this.ptr.getIPID (), 5 );
  }
  this.session.getStub2 ().addRef_ReleaseRef ( obj );
}
origin: org.openscada.jinterop/org.openscada.jinterop.core

@Override
public void addRef () throws JIException
{
  checkLocal ();
  final JICallBuilder obj = new JICallBuilder ( true );
  obj.setParentIpid ( this.ptr.getIPID () );
  obj.setOpnum ( 1 );//addRef
  //length
  obj.addInParamAsShort ( (short)1, JIFlags.FLAG_NULL );
  //ipid to addfref on
  final JIArray array = new JIArray ( new rpc.core.UUID[] { new rpc.core.UUID ( this.ptr.getIPID () ) }, true );
  obj.addInParamAsArray ( array, JIFlags.FLAG_NULL );
  //TODO requesting 5 for now, will later build caching mechnaism to exhaust 5 refs first before asking for more
  // same with release.
  obj.addInParamAsInt ( 5, JIFlags.FLAG_NULL );
  obj.addInParamAsInt ( 0, JIFlags.FLAG_NULL );//private refs = 0
  obj.addOutParamAsType ( Short.class, JIFlags.FLAG_NULL );//size
  obj.addOutParamAsType ( Integer.class, JIFlags.FLAG_NULL );//Hresult for size
  if ( logger.isInfoEnabled () )
  {
    logger.info ( "addRef: Adding 5 references for " + this.ptr.getIPID () + " session: " + this.session.getSessionIdentifier () );
  }
  JISession.debug_addIpids ( this.ptr.getIPID (), 5 );
  this.session.getStub2 ().addRef_ReleaseRef ( obj );
  if ( obj.getResultAsIntAt ( 1 ) != 0 )
  {
    throw new JIException ( obj.getResultAsIntAt ( 1 ), (Throwable)null );
  }
}
org.jinterop.dcom.coreJISession

Javadoc

Representation of an active session with a COM server. All interface references being given out by the framework for a particular COM server are maintained by the session and an IJIComObject is associated with a single session only. Sessions are also responsible for the clean up once the system shuts down or IJIComObject go out of reference scope.

Please make sure that you call #destroySession(JISession) after you are done using the session. This will ensure that any open sockets to COM server are closed.

Most used methods

  • createSession
    Creates a new session using credentials of the sessionparameter. The new session is not yet attached
  • setGlobalSocketTimeout
    Sets the timeout for all sockets opened to (not fro) the COM server for this session. Default value
  • destroySession
    Used to destroy the session, this release all references of the COM server and it's interfaces. It s
  • useSessionSecurity
    Sets the use of NTLM2 Session Security. Framework will use NTLM Packet Level Privacy and Sign\Seal
  • <init>
  • addToSession
  • debug_addIpids
  • debug_delIpids
  • equals
  • getDomain
    Gets the domain of the user associated with this session.
  • getGlobalSocketTimeout
    Returns the global timeout applied to all sockets opened from this session to COM Server.
  • getLocalHost
  • getGlobalSocketTimeout,
  • getLocalHost,
  • getLocalhostAddressAsIPString,
  • getLocalhostAddressAsIPbytes,
  • getLocalhostCanonicalAddressAsString,
  • getPassword,
  • getSessionIdentifier,
  • getStub,
  • getTargetServer,
  • getUnreferencedHandler

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • startActivity (Activity)
  • getContentResolver (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now