public class ISeriesNetServerConnection
extends java.lang.Object
implements java.io.Serializable
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();
}
| 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.
|
| 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.
|
public static final int WORKSTATION
public static final int SHARE
public static final int DISK_DRIVE
public static final int SPOOLED_OUTPUT_QUEUE
public int getID()
public long getSessionID()
public int getAge()
public int getNumberOfFilesOpen()
public java.lang.String getName()
SHARE, this is the name of a share.
If the resource type is WORKSTATION, this is the name of a workstation.public int getResourceType()
WORKSTATION and SHARE.public int getConnectionType()
DISK_DRIVE and SPOOLED_OUTPUT_QUEUE.public java.lang.String getUserName()
public int getNumberOfUsers()