com.ibm.as400.access
Class ISeriesNetServerSession

java.lang.Object
  extended bycom.ibm.as400.access.ISeriesNetServerSession
All Implemented Interfaces:
Serializable

public class ISeriesNetServerSession
extends Object
implements Serializable

The ISeriesNetServerSession class represents a NetServer session.

Note: A session (represented by this class) corresponds to a workstation. A workstation could be a Windows Terminal Server or it could be a single PC on someone's desktop. A connection (represented by class NetServerConnection) corresponds to a specific user who has mapped a drive and has files opened or spooled output on a print queue. Since a session can have multiple users, a connection shows a particular user's statistics on that session.

ISeriesNetServerSession objects are created and returned by listSessions() and listSessionsForWorkstation().

 import com.ibm.as400.access.*;

 // Create an ISeriesNetServer object for a specific system.
 AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
 ISeriesNetServer ns = new ISeriesNetServer(system);

 try
 {
   // List all current sessions.
   System.out.println("Sessions:");
   ISeriesNetServerSession[] sessionList = ns.listSessions();
   for (int i=0; i<sessionList.length; i++)
   {
     ISeriesNetServerSession session = sessionList[i];
     System.out.println(session.getName() + ": " +
       session.getUserName() + "; " +
       session.getAge() + "; " +
       session.isGuest() );
   }
 }
 catch (AS400Exception e) {
   AS400Message[] messageList = e.getAS400MessageList();
   for (int i=0; i<messageList.length; i++) {
     System.out.println(messageList[i].getText());
   }
 }
 catch (Exception e) {
   e.printStackTrace();
 }
 finally {
   if (system != null) system.disconnectAllServices();
 }

See Also:
Serialized Form

Method Summary
 int getAge()
          Returns the number of seconds that the session has been active.
 long getID()
          Returns the unique identifier for the system session.
 int getIdleTime()
          Returns the number of seconds the session has been idle.
 String getName()
          Returns the name of the workstation from which the session to the system was established.
 int getNumberOfConnections()
          Returns the number of connections made during the session.
 int getNumberOfFilesOpen()
          Returns the number of files that are currently open for the session.
 String getUserName()
          Returns the name of the user that is associated with the session.
 boolean isGuest()
          Indicates whether or not the session is a guest session.
 boolean isPasswordEncrypted()
          Indicates whether or not the encrypted password was used to establish the session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public String getName()
Returns the name of the workstation from which the session to the system was established.

Returns:
The workstation name.

getID

public long getID()
Returns the unique identifier for the system session. Note: The session identifier was added to the NetServer API's in V5R1.

Returns:
The session identifier.

getNumberOfConnections

public int getNumberOfConnections()
Returns the number of connections made during the session.

Returns:
The number of connections.

getAge

public int getAge()
Returns the number of seconds that the session has been active.

Returns:
The session time.

getNumberOfFilesOpen

public int getNumberOfFilesOpen()
Returns the number of files that are currently open for the session.

Returns:
The files open count.

getIdleTime

public int getIdleTime()
Returns the number of seconds the session has been idle.

Returns:
The session idle time.

isPasswordEncrypted

public boolean isPasswordEncrypted()
Indicates whether or not the encrypted password was used to establish the session.

Returns:
true if the encrypted password was used.

isGuest

public boolean isGuest()
Indicates whether or not the session is a guest session.

Returns:
true if the session is a guest session.

getUserName

public String getUserName()
Returns the name of the user that is associated with the session.

Returns:
The user name.