com.ibm.as400.access
Class NetServerConnection

java.lang.Object
  extended bycom.ibm.as400.resource.Resource
      extended bycom.ibm.as400.access.NetServerConnection
All Implemented Interfaces:
Serializable

Deprecated. This class has been replaced by the ISeriesNetServerConnection class and may be removed in a future release.

public class NetServerConnection
extends Resource

The NetServerConnection class represents a NetServer share connection.

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:

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 server 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 server 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();
 }

See Also:
NetServer.listSessionConnections(), NetServer.listShareConnections(), NetServerSession, Serialized Form

Field Summary
static String CONNECT_TIME
          Deprecated. Attribute ID for "connect time".
static String FILES_OPEN_COUNT
          Deprecated. Attribute ID for "number of files open".
static String NAME
          Deprecated. Attribute ID for "connection name".
static String TYPE
          Deprecated. Attribute ID for "connection type".
static Integer TYPE_DISK_DRIVE
          Deprecated. TYPE attribute value indicating a connection type of "disk drive".
static Integer TYPE_SPOOLED_OUTPUT_QUEUE
          Deprecated. TYPE attribute value indicating a connection type of "spooled output queue".
static String USER
          Deprecated. Attribute ID for "user name".
 
Method Summary
protected  void establishConnection()
          Deprecated. Establishes the connection (of this object) to the server.
protected  void freezeProperties()
          Deprecated. Freezes any property changes.
 Object getAttributeValue(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.
 
Methods inherited from class com.ibm.as400.resource.Resource
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECT_TIME

public static final String CONNECT_TIME
Deprecated. 
Attribute ID for "connect time". This identifies a read-only Integer attribute, which represents the number of seconds that have elapsed since a connection was established.

See Also:
Constant Field Values

FILES_OPEN_COUNT

public static final String FILES_OPEN_COUNT
Deprecated. 
Attribute ID for "number of files open". This identifies a read-only Integer attribute, which represents the number of files that are currently open on a connection.

See Also:
Constant Field Values

NAME

public static final String NAME
Deprecated. 
Attribute ID for "connection name". This identifies a read-only String attribute, which represents the name of the share or workstation that is associated with a connection.

See Also:
Constant Field Values

TYPE

public static final String TYPE
Deprecated. 
Attribute ID for "connection type". This identifies a read-only Integer attribute, which represents the type of a connection. Valid values are:

See Also:
Constant Field Values

TYPE_DISK_DRIVE

public static final Integer TYPE_DISK_DRIVE
Deprecated. 
TYPE attribute value indicating a connection type of "disk drive".


TYPE_SPOOLED_OUTPUT_QUEUE

public static final Integer TYPE_SPOOLED_OUTPUT_QUEUE
Deprecated. 
TYPE attribute value indicating a connection type of "spooled output queue".


USER

public static final String USER
Deprecated. 
Attribute ID for "user name". This identifies a read-only String attribute, which represents the name of the user that opened the connection.

See Also:
Constant Field Values
Method Detail

establishConnection

protected void establishConnection()
                            throws ResourceException
Deprecated. 
Establishes the connection (of this object) to the server.

The method is called by the resource framework automatically when the object connection needs to be established.

Overrides:
establishConnection in class Resource
Throws:
ResourceException - If an error occurs.

freezeProperties

protected void freezeProperties()
                         throws ResourceException
Deprecated. 
Freezes any property changes. After this is called, property changes should not be made. Properties are not the same thing as attributes. Properties are basic pieces of information which must be set to make the object usable, such as the system and the name.

The method is called by the resource framework automatically when the properties need to be frozen.

Overrides:
freezeProperties in class Resource
Throws:
ResourceException - If an error occurs.

getAttributeValue

public Object getAttributeValue(Object attributeID)
                         throws ResourceException
Deprecated. 
Returns the current value of an attribute.

Overrides:
getAttributeValue in class Resource
Parameters:
attributeID - Identifies the attribute.
Returns:
The attribute value, or null if the attribute value is not available.
Throws:
ResourceException - If an error occurs.
See Also:
Subclass notes

getID

public int getID()
Deprecated. 
Returns the connection ID for connection.

Returns:
The connection ID.

refreshAttributeValues

public void refreshAttributeValues()
                            throws ResourceException
Deprecated. 
Refreshes the values for all attributes. This method fires an attributeValuesRefreshed() ResourceEvent.

Overrides:
refreshAttributeValues in class Resource
Throws:
ResourceException - If an error occurs.