ISeriesNetServerConnection
class and may be removed in a future release.public class NetServerConnection extends Resource
Note: A session (represented by class NetServerSession
) 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.
NetServerConnection objects are created and returned by the following methods:
NetServer.listSessionConnections
NetServer.listShareConnections
NetServerShare.listConnections
NetServerSession.listConnections
The following attribute IDs are supported:
Use any of the above attribute IDs with the
getAttributeValue
method to access the attribute values for a NetServerConnection.
Note: For the above attributes, getAttributeValue() should never return null.
For String-valued attributes, if the current actual value of the corresponding property on the system is blank, getAttributeValue() will return "" (an empty String).
import com.ibm.as400.access.*; import com.ibm.as400.resource.*; // Create a NetServer object for a specific system. AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD"); NetServer ns = new NetServer(system); try { // List all current session connections. System.out.println("Session connections:"); ResourceList connectionList = ns.listSessionConnections(); connectionList.waitForComplete(); for (int i=0; i<connectionList.getListLength(); i++) { NetServerConnection connection = (NetServerConnection)connectionList.resourceAt(i); System.out.println(connection.getID() + ": " + (String)connection.getAttributeValue(NetServerConnection.NAME) + "; " + (String)connection.getAttributeValue(NetServerConnection.USER) + "; " + ((Integer)connection.getAttributeValue(NetServerConnection.CONNECT_TIME)) .intValue() ); } } catch (ResourceException e) { e.printStackTrace(); } finally { if (system != null) system.disconnectAllServices(); }
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONNECT_TIME
Deprecated.
Attribute ID for "connect time".
|
static java.lang.String |
FILES_OPEN_COUNT
Deprecated.
Attribute ID for "number of files open".
|
static java.lang.String |
NAME
Deprecated.
Attribute ID for "connection name".
|
static java.lang.String |
TYPE
Deprecated.
Attribute ID for "connection type".
|
static java.lang.Integer |
TYPE_DISK_DRIVE
Deprecated.
TYPE attribute value indicating a connection type of "disk drive". |
static java.lang.Integer |
TYPE_SPOOLED_OUTPUT_QUEUE
Deprecated.
TYPE attribute value indicating a connection type of "spooled output queue". |
static java.lang.String |
USER
Deprecated.
Attribute ID for "user name".
|
Modifier and Type | Method and Description |
---|---|
protected void |
establishConnection()
Deprecated.
Establishes the connection (of this object) to the system.
|
protected void |
freezeProperties()
Deprecated.
Freezes any property changes.
|
java.lang.Object |
getAttributeValue(java.lang.Object attributeID)
Deprecated.
Returns the current value of an attribute.
|
int |
getID()
Deprecated.
Returns the connection ID for connection.
|
void |
refreshAttributeValues()
Deprecated.
Refreshes the values for all attributes.
|
addActiveStatusListener, addPropertyChangeListener, addResourceListener, addVetoableChangeListener, arePropertiesFrozen, equals, fireAttributeValuesRefreshed, fireBusy, fireIdle, firePropertyChange, fireVetoableChange, getAttributeMetaData, getAttributeMetaData, getAttributeValue, getPresentation, getResourceKey, getSystem, initializeAttributeValue, isBidiEnabled, isConnectionEstablished, removeActiveStatusListener, removePropertyChangeListener, removeResourceListener, removeVetoableChangeListener, setPresentation, setResourceKey, setSystem, toString
public static final java.lang.String CONNECT_TIME
public static final java.lang.String FILES_OPEN_COUNT
public static final java.lang.String NAME
public static final java.lang.String TYPE
TYPE_DISK_DRIVE
- Disk drive.
TYPE_SPOOLED_OUTPUT_QUEUE
- Spooled output queue.
public static final java.lang.Integer TYPE_DISK_DRIVE
TYPE
attribute value indicating a connection type of "disk drive".public static final java.lang.Integer TYPE_SPOOLED_OUTPUT_QUEUE
TYPE
attribute value indicating a connection type of "spooled output queue".public static final java.lang.String USER
protected void establishConnection() throws ResourceException
The method is called by the resource framework automatically when the object connection needs to be established.
establishConnection
in class Resource
ResourceException
- If an error occurs.protected void freezeProperties() throws ResourceException
The method is called by the resource framework automatically when the properties need to be frozen.
freezeProperties
in class Resource
ResourceException
- If an error occurs.public java.lang.Object getAttributeValue(java.lang.Object attributeID) throws ResourceException
getAttributeValue
in class Resource
attributeID
- Identifies the attribute.ResourceException
- If an error occurs.public int getID()
public void refreshAttributeValues() throws ResourceException
refreshAttributeValues
in class Resource
ResourceException
- If an error occurs.