org.jinterop.dcom.core
Class JISession

java.lang.Object
  extended by org.jinterop.dcom.core.JISession

public final class JISession
extends java.lang.Object

Class representing the user's session. Each IJIComObject is associated with 1 session only. All Interface references being given out by the library for a particular COM server are maintained by the session. It is also responsible for the clean up once the system shuts down or objects loose there references.
Please make sure that you call JISession.destroySession after you are done using the session. This will ensure that any open sockets to COM server are closed.

Since:
1.0

Method Summary
static JISession createSession(IJIAuthInfo authInfo)
          Creates a session with the authInfo of the user.
static JISession createSession(JISession session)
          Creates a new Session , using credentials of the session sent as parameter.
static JISession createSession(java.lang.String domain, java.lang.String username, java.lang.String password)
          Creates a session.
static void destroySession(JISession session)
          Used to destroy the session, this release all references of the COM server and it's interfaces.
 IJIAuthInfo getAuthInfo()
          Returns the authInfo (if any) associated with this session.
 java.lang.String getDomain()
          Gets the domain of the user associated with this session.
 int getGlobalSocketTimeout()
          Returns the global timeout applied to all sockets opened from this session to COM Server.
 int getSessionIdentifier()
          Returns a unique identifier for this session.
 java.lang.String getUserName()
          Gets the username associated with this session.
 void setGlobalSocketTimeout(int timeout)
           Sets the timeout for all sockets opened to (not fro) the COM server for this session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAuthInfo

public IJIAuthInfo getAuthInfo()
Returns the authInfo (if any) associated with this session.

Returns:

createSession

public static JISession createSession(IJIAuthInfo authInfo)
Creates a session with the authInfo of the user. authInfo cannot be null.

Parameters:
authInfo -
Returns:

createSession

public static JISession createSession(java.lang.String domain,
                                      java.lang.String username,
                                      java.lang.String password)
Creates a session.

Parameters:
domain - Domain of the user.
username - Username
password - password of the user.
Returns:

createSession

public static JISession createSession(JISession session)
Creates a new Session , using credentials of the session sent as parameter.

Parameters:
session -
Returns:

destroySession

public static void destroySession(JISession session)
                           throws JIException

Used to destroy the session, this release all references of the COM server and it's interfaces. It should be called once the developer is done with the usage of a COM object, it is required so as to close all open sockets with the COM server. The references to COM interfaces are discarded from time to time when a random GC is done or when the system shuts down.

Parameters:
session -
Throws:
JIException

getUserName

public java.lang.String getUserName()
Gets the username associated with this session.

Returns:

getDomain

public java.lang.String getDomain()
Gets the domain of the user associated with this session.

Returns:

getSessionIdentifier

public int getSessionIdentifier()
Returns a unique identifier for this session.

Returns:

setGlobalSocketTimeout

public void setGlobalSocketTimeout(int timeout)

Sets the timeout for all sockets opened to (not fro) the COM server for this session. Default value is 0 (no timeout). The class level and the API level settings in case of IJIComObject override this timeout.

Parameters:
timeout - in millisecs

getGlobalSocketTimeout

public int getGlobalSocketTimeout()
Returns the global timeout applied to all sockets opened from this session to COM Server.

Returns: