com.ibm.as400.access

Class ISeriesNetServerConnection

  • java.lang.Object
    • com.ibm.as400.access.ISeriesNetServerConnection
  • All Implemented Interfaces:
    java.io.Serializable


    public class ISeriesNetServerConnection
    extends java.lang.Object
    implements java.io.Serializable
    The ISeriesNetServerConnection class represents a NetServer share connection.

    Note: A session (represented by class ISeriesNetServerSession) 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 this class) 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.

    ISeriesNetServerConnection objects are created and returned by the following methods:

     import com.ibm.as400.access.*;
    
     // Create a ISeriesNetServer object for a specific system.
     AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
     ISeriesNetServer ns = new ISeriesNetServer(system);
    
     try
     {
       // List all current session connections.
       System.out.println("Session connections:");
       ISeriesNetServerSession[] sessionList = ns.listSessions();
       ISeriesNetServerConnection[] connectionList =
                     ns.listConnectionsForSession(sessionList[0].getID());
       for (int i=0; i<connectionList.length; i++)
       {
         ISeriesNetServerConnection connection = connectionList[i];
         System.out.println(connection.getID() + ": " +
           connection.getName() + "; " +
           connection.getUserName() + "; " +
           connection.getAge());
       }
     }
     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:
    ISeriesNetServer.listConnectionsForSession(long), ISeriesNetServer.listConnectionsForSession(String), Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int DISK_DRIVE
      Value of the ISeriesNetServerConnection "connection type" attribute, indicating that the connection is to a disk drive, that is, a file share.
      static int SHARE
      Value of the ISeriesNetServerConnection "resource type" attribute, indicating that the connection is to a specific share.
      static int SPOOLED_OUTPUT_QUEUE
      Value of the ISeriesNetServerConnection "connection type" attribute, indicating that the connection is to a spooled output queue, that is, a print share.
      static int WORKSTATION
      Value of the ISeriesNetServerConnection "resource type" attribute, indicating that the connection is from a specific workstation.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      int getAge()
      Returns the number of seconds elapsed since the connection was established.
      int getConnectionType()
      Returns the type of the connection made from the workstation to the shared resource.
      int getID()
      Returns the connection ID.
      java.lang.String getName()
      Returns the network name of the resource.
      int getNumberOfFilesOpen()
      Returns the number of files that are open currently (on the connection).
      int getNumberOfUsers()
      Returns the number of current users on the connection.
      int getResourceType()
      Returns the type of resource for this connection.
      long getSessionID()
      Returns the session ID for connection.
      java.lang.String getUserName()
      Returns the name of the user that is associated with the connection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • WORKSTATION

        public static final int WORKSTATION
        Value of the ISeriesNetServerConnection "resource type" attribute, indicating that the connection is from a specific workstation.
        See Also:
        Constant Field Values
      • SHARE

        public static final int SHARE
        Value of the ISeriesNetServerConnection "resource type" attribute, indicating that the connection is to a specific share.
        See Also:
        Constant Field Values
      • DISK_DRIVE

        public static final int DISK_DRIVE
        Value of the ISeriesNetServerConnection "connection type" attribute, indicating that the connection is to a disk drive, that is, a file share.
        See Also:
        Constant Field Values
      • SPOOLED_OUTPUT_QUEUE

        public static final int SPOOLED_OUTPUT_QUEUE
        Value of the ISeriesNetServerConnection "connection type" attribute, indicating that the connection is to a spooled output queue, that is, a print share.
        See Also:
        Constant Field Values
    • Method Detail

      • getID

        public int getID()
        Returns the connection ID.
        Returns:
        The connection ID.
      • getSessionID

        public long getSessionID()
        Returns the session ID for connection.
        Returns:
        The session ID.
      • getAge

        public int getAge()
        Returns the number of seconds elapsed since the connection was established.
        Returns:
        The connect time.
      • getNumberOfFilesOpen

        public int getNumberOfFilesOpen()
        Returns the number of files that are open currently (on the connection).
        Returns:
        The number of files open.
      • getName

        public java.lang.String getName()
        Returns the network name of the resource. If the resource type is SHARE, this is the name of a share. If the resource type is WORKSTATION, this is the name of a workstation.
        Returns:
        The name of the share or workstation.
      • getResourceType

        public int getResourceType()
        Returns the type of resource for this connection. Possible values are WORKSTATION and SHARE.
        Returns:
        The resource type.
      • getConnectionType

        public int getConnectionType()
        Returns the type of the connection made from the workstation to the shared resource. Possible values are DISK_DRIVE and SPOOLED_OUTPUT_QUEUE.
        Returns:
        The connection type.
      • getUserName

        public java.lang.String getUserName()
        Returns the name of the user that is associated with the connection.
        Returns:
        The user name.
      • getNumberOfUsers

        public int getNumberOfUsers()
        Returns the number of current users on the connection.
        Returns:
        The number of users.