se.entra.phantom.server
Class ClientConnectionData

java.lang.Object
  extended by se.entra.phantom.server.ClientConnectionData
All Implemented Interfaces:
Serializable, Cloneable

public class ClientConnectionData
extends Object
implements Cloneable, Serializable

This class contains the data of a client connection.

See Also:
Serialized Form

Field Summary
static int API_TRACE_INDEX
          The index for API trace.
 String[] applicationNames
          The application names.
static int CLIENT_TRACE_INDEX
          The index for Client trace.
 InetAddress clientAddress
          The address of the client.
 Date connectionTime
          The time that the client connected to the server.
static int HOST_TRACE_INDEX
          The index for Host trace.
 InetAddress hostAddress
          The current host address (of the current host session).
 String language
          The language used on the client (or null if not defined).
 String luName
          The current host LU name (of the current host session).
static int TELNET_TRACE_INDEX
          The index for Telnet trace.
static int TRACE_BIT_BINARY
          The trace level bits.
static int TRACE_BIT_VERBOSE
          The trace level bits for verbose trace.
 byte[] traceLevels
          The trace levels of the subsystems telnet, host, client, API.
 String userID
          The user ID at the client, may be null if user authentication is not used.
 
Constructor Summary
ClientConnectionData(InetAddress clientAddress)
          The constructor initiates the trace levels to defaults, i.e. -1.
ClientConnectionData(InetAddress clientAddress, String userID)
          The constructor initiates the trace levels to defaults, i.e. -1.
ClientConnectionData(long connectionID, byte[] defaultTrace, InetAddress clientAddress, String userID)
          The constructor initiates the trace levels to defaults, i.e. -1.
 
Method Summary
 ClientConnectionData createClone()
          Creates a copy of an instance of the client connection data.
 boolean doAPIBinaryTrace()
          Checks if API binary trace is on.
 boolean doAPIVerboseTrace()
          Checks if API verbose trace is on.
 boolean doClientBinaryTrace()
          Checks if Client binary trace is on.
 boolean doClientVerboseTrace()
          Checks if Client verbose trace is on.
 boolean doHostBinaryTrace()
          Checks if Host binary trace is on.
 boolean doHostVerboseTrace()
          Checks if Host verbose trace is on.
 boolean doTelnetBinaryTrace()
          Checks if Telnet binary trace is on.
 boolean doTelnetVerboseTrace()
          Checks if Telnet verbose trace is on.
 String getApplicationNames()
          Gets the application names (space separated).
 long getConnectionID()
          Gets the connection ID.
 String getConnectionIDString()
          Gets the connection ID as a string.
static String getConnectionIDString(ClientConnectionData clientConnectionData)
          Gets the connection ID as a string.
static String getConnectionIDString(ClientConnectionData clientConnectionData, String threadName, String threadID)
          Gets the connection ID as a string.
 int getConnectionTimeInSeconds()
          Calculates current connection time in seconds.
 EventFilter getEventFilter()
          Gets the event filter instance or null if none is defined.
static String getIDString(long id)
          Converts an ID into a string.
 Hashtable<String,Object> getLocalStorage()
          Gets the client local hashtable for object storage.
static String getTabDelimitedConnectionIDString(ClientConnectionData clientConnectionData, String threadName, String threadID)
          Gets the connection ID as a string.
 boolean isEventLogged(int eventID)
          Checks if an event is logged.
 boolean logEvent(int eventID)
          Log the event.
 boolean logEvent(int eventID, String appendedText)
          Log the event.
 String toString()
          Gets the string representation of the client connection data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TELNET_TRACE_INDEX

public static final int TELNET_TRACE_INDEX
The index for Telnet trace.

See Also:
Constant Field Values

HOST_TRACE_INDEX

public static final int HOST_TRACE_INDEX
The index for Host trace.

See Also:
Constant Field Values

CLIENT_TRACE_INDEX

public static final int CLIENT_TRACE_INDEX
The index for Client trace.

See Also:
Constant Field Values

API_TRACE_INDEX

public static final int API_TRACE_INDEX
The index for API trace.

See Also:
Constant Field Values

TRACE_BIT_BINARY

public static final int TRACE_BIT_BINARY
The trace level bits.

See Also:
Constant Field Values

TRACE_BIT_VERBOSE

public static final int TRACE_BIT_VERBOSE
The trace level bits for verbose trace.

See Also:
Constant Field Values

clientAddress

public transient InetAddress clientAddress
The address of the client. This member is null when the class instance is created by e.g. the DefaultLUMapperExit to return client connection data.


language

public transient String language
The language used on the client (or null if not defined). This String is e.g. "sv" for Swedish, "de" for German and is read from the client property "user.language".


userID

public transient String userID
The user ID at the client, may be null if user authentication is not used.


applicationNames

public transient String[] applicationNames
The application names. This member is null when the class instance is created by e.g. the DefaultLUMapperExit to return client connection data.


luName

public transient String luName
The current host LU name (of the current host session). This member can change when HostConnect REXX function is called or if there is a change of host session. The member can also be null if no host is yet contacted.


hostAddress

public transient InetAddress hostAddress
The current host address (of the current host session). This member can change when HostConnect REXX function is called or if there is a change of host session. The member can also be null if no host is yet contacted.


connectionTime

public transient Date connectionTime
The time that the client connected to the server.


traceLevels

public final transient byte[] traceLevels
The trace levels of the subsystems telnet, host, client, API. The values are initially set to -1 indicating it used the default trace setting. The range of the trace is 0-3, or -1 for default.

The values are:
-1 = default trace,
0 = no trace,
1 = binary trace,
2 = verbose trace,
3 = binary and verbose trace.

The indexes are:
0 = Telnet,
1 = Host,
2 = Client,
3 = API.

See Also:
TELNET_TRACE_INDEX, HOST_TRACE_INDEX, CLIENT_TRACE_INDEX, API_TRACE_INDEX, TRACE_BIT_BINARY, TRACE_BIT_VERBOSE
Constructor Detail

ClientConnectionData

public ClientConnectionData(long connectionID,
                            byte[] defaultTrace,
                            InetAddress clientAddress,
                            String userID)
The constructor initiates the trace levels to defaults, i.e. -1.


ClientConnectionData

public ClientConnectionData(InetAddress clientAddress,
                            String userID)
The constructor initiates the trace levels to defaults, i.e. -1. This constructor is used by e.g. the DefaultLUMapperExit to return client connection data for informational purposes.


ClientConnectionData

public ClientConnectionData(InetAddress clientAddress)
The constructor initiates the trace levels to defaults, i.e. -1. This constructor is used by e.g. the DefaultLUMapperExit to return client connection data for informational purposes.

Method Detail

createClone

public ClientConnectionData createClone()
Creates a copy of an instance of the client connection data. This is used in the Administration Interface.


getEventFilter

public EventFilter getEventFilter()
Gets the event filter instance or null if none is defined.


getConnectionID

public long getConnectionID()
Gets the connection ID.


getConnectionIDString

public static String getConnectionIDString(ClientConnectionData clientConnectionData)
Gets the connection ID as a string. If no data exists, i.e. source is null or -1, the string "<NetPhantom>" is returned.


getConnectionIDString

public static String getConnectionIDString(ClientConnectionData clientConnectionData,
                                           String threadName,
                                           String threadID)
Gets the connection ID as a string. If no data exists, i.e. source is null or -1, the string "<NetPhantom>" is returned.


getTabDelimitedConnectionIDString

public static String getTabDelimitedConnectionIDString(ClientConnectionData clientConnectionData,
                                                       String threadName,
                                                       String threadID)
Gets the connection ID as a string. If no data exists, i.e. source is null or -1, the string "<NetPhantom>" is returned. The parameters are tab delimited instead of filled out with spaces.


getConnectionIDString

public String getConnectionIDString()
Gets the connection ID as a string. If no data exists, i.e. source is -1, the string "<NetPhantom>" is returned.


getIDString

public static String getIDString(long id)
Converts an ID into a string.


getConnectionTimeInSeconds

public int getConnectionTimeInSeconds()
Calculates current connection time in seconds.


doTelnetBinaryTrace

public boolean doTelnetBinaryTrace()
Checks if Telnet binary trace is on.

Returns:
true if the trace option is selected.

doTelnetVerboseTrace

public boolean doTelnetVerboseTrace()
Checks if Telnet verbose trace is on.

Returns:
true if the trace option is selected.

doHostBinaryTrace

public boolean doHostBinaryTrace()
Checks if Host binary trace is on.

Returns:
true if the trace option is selected.

doHostVerboseTrace

public boolean doHostVerboseTrace()
Checks if Host verbose trace is on.

Returns:
true if the trace option is selected.

doClientBinaryTrace

public boolean doClientBinaryTrace()
Checks if Client binary trace is on.

Returns:
true if the trace option is selected.

doClientVerboseTrace

public boolean doClientVerboseTrace()
Checks if Client verbose trace is on.

Returns:
true if the trace option is selected.

doAPIBinaryTrace

public boolean doAPIBinaryTrace()
Checks if API binary trace is on.

Returns:
true if the trace option is selected.

doAPIVerboseTrace

public boolean doAPIVerboseTrace()
Checks if API verbose trace is on.

Returns:
true if the trace option is selected.

isEventLogged

public boolean isEventLogged(int eventID)
Checks if an event is logged. This call should be made prior to calling the logEvent method if the event requires many object instances of e.g. String in order to relieve the garbage collector.

The logEvent method always calls the isEventLogged method first in order to verify if the event is filtered or not.

All events are numbered and stored in the EventID class as static member variables.

See Also:
EventID

logEvent

public boolean logEvent(int eventID,
                        String appendedText)
Log the event. The event may be filtered out by administrators action. The method isEventLogged may be used to check if the event is logged or not.

The logEvent method always calls the isEventLogged method first in order to verify if the event is filtered or not.

All events are numbered and stored in the EventID class as static member variables.

The appendedText variable may be set to null, in which case no text will be appended to the event text.

Returns:
true if the event is successfully logged, false otherwise (because the event is filtered.
See Also:
EventID

logEvent

public boolean logEvent(int eventID)
Log the event. The event may be filtered out by administrators action. The method isEventLogged may be used to check if the event is logged or not.

The logEvent method always calls the isEventLogged method first in order to verify if the event is filtered or not.

All events are numbered and stored in the EventID class as static member variables.

Returns:
true if the event is successfully logged, false otherwise (because the event is filtered.
See Also:
EventID

getApplicationNames

public String getApplicationNames()
Gets the application names (space separated).

Returns:
empty string if no applications are specified.

toString

public String toString()
Gets the string representation of the client connection data.

Overrides:
toString in class Object

getLocalStorage

public Hashtable<String,Object> getLocalStorage()
Gets the client local hashtable for object storage.



Phantom® and NetPhantom® are registered trademarks of Codectica Systems SARL.
© Copyright Codectica Systems SARL, 2008. All rights reserved.