com.ibm.as400.access
Class NetServerSession

java.lang.Object
  extended by com.ibm.as400.resource.Resource
      extended by com.ibm.as400.access.NetServerSession
All Implemented Interfaces:
Serializable

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

public class NetServerSession
extends Resource

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.

NetServerSession objects are created and returned by NetServer.listSessions().

The following attribute IDs are supported:

Use any of the above attribute IDs with getAttributeValue to access the attribute values for a NetServerSession.
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 sessions.
   System.out.println("Sessions:");
   ResourceList sessionList = ns.listSessions();
   sessionList.waitForComplete();
   for (int i=0; i<sessionList.getListLength(); i++)
   {
     NetServerSession session =
       (NetServerSession)sessionList.resourceAt(i);
     System.out.println(session.getName() + ": " +
       (String)session.getAttributeValue(NetServerSession.USER) + "; " +
       ((Integer)session.getAttributeValue(NetServerSession.SESSION_TIME))
                                                           .intValue() + "; " +
       ((Boolean)session.getAttributeValue(NetServerSession.IS_GUEST))
                                                           .booleanValue() );
   }
 }
 catch (ResourceException e) {
   e.printStackTrace();
 }
 finally {
   if (system != null) system.disconnectAllServices();
 }

See Also:
Serialized Form

Field Summary
static String CONNECTION_COUNT
          Deprecated. Attribute ID for "connection count".
static String FILES_OPEN_COUNT
          Deprecated. Attribute ID for "files open count".
static String IDLE_TIME
          Deprecated. Attribute ID for "session idle time".
static String IS_ENCRYPT_PASSWORD
          Deprecated. Attribute ID for "is encrypt password".
static String IS_GUEST
          Deprecated. Attribute ID for "is guest".
static String SESSION_TIME
          Deprecated. Attribute ID for "session time".
static String USER
          Deprecated. Attribute ID for "user name".
 
Method Summary
 void end()
          Deprecated. Ends the session.
protected  void establishConnection()
          Deprecated. Establishes the connection to the system.
protected  void freezeProperties()
          Deprecated. Freezes any property changes.
 Object getAttributeValue(Object attributeID)
          Deprecated. Returns the current value of an attribute.
 String getName()
          Deprecated. Returns the name of the workstation from which the session to the system was established.
 ResourceList listConnections()
          Deprecated. Lists the connections currently associated with this session.
 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

CONNECTION_COUNT

public static final String CONNECTION_COUNT
Deprecated. 
Attribute ID for "connection count". This identifies a read-only Integer attribute, which represents the number of connections made during a session.

See Also:
Constant Field Values

SESSION_TIME

public static final String SESSION_TIME
Deprecated. 
Attribute ID for "session time". This identifies a read-only Integer attribute, which represents the number of seconds that a session has been active.

See Also:
Constant Field Values

FILES_OPEN_COUNT

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

See Also:
Constant Field Values

IDLE_TIME

public static final String IDLE_TIME
Deprecated. 
Attribute ID for "session idle time". This identifies a read-only Integer attribute, which represents the number of seconds a session has been idle.

See Also:
Constant Field Values

IS_ENCRYPT_PASSWORD

public static final String IS_ENCRYPT_PASSWORD
Deprecated. 
Attribute ID for "is encrypt password". This identifies a read-only Boolean attribute, which indicates whether or not the encrypted password was used to establish a session.

See Also:
Constant Field Values

IS_GUEST

public static final String IS_GUEST
Deprecated. 
Attribute ID for "is guest". This identifies a read-only Boolean attribute, which indicates whether or not a session is a guest session.

See Also:
Constant Field Values

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 is associated with a session.

See Also:
Constant Field Values
Method Detail

end

public void end()
         throws ResourceException
Deprecated. 
Ends the session. This method fires a resourceDeleted() ResourceEvent.
This method requires *IOSYSCFG special authority on the system.

Throws:
ResourceException - If an error occurs.

establishConnection

protected void establishConnection()
                            throws ResourceException
Deprecated. 
Establishes the connection to the system.

The method is called by the resource framework automatically when the 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

getName

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

Returns:
The workstation name.

listConnections

public ResourceList listConnections()
                             throws ResourceException
Deprecated. 
Lists the connections currently associated with this session. The returned ResourceList contains NetServerConnection objects.

Returns:
The current connections for the session.
Throws:
ResourceException - If an error occurs.

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.