Interface Session


  • public interface Session
    A Session object represents a host session. Once you have obtained the Session object, you can access the other elements of the host session, such as the presentation space, operator information area, file transfer object and Printing services.
    • Method Detail

      • connect

        void connect()
        Attempts a connection to the host. The connection is attempted only if the current connection state is ConnectionState.DISCONNECTED. When this method is called, the connection state is first set to ConnectionState.CONNECTING. Only after the connection has been established is the status changed to ConnectionState.CONNECTED. You may choose to implement a timer in your code so if a connection does not succeed after a certain amount of time, you can call disconnect to cancel the connection attempt. Otherwise, the connection attempt may proceed indefinitely. This call returns immediately, status and errors are reported via ConnectionListener.
      • disconnect

        void disconnect()
        Disconnects from the host. If the connection is currently pending and this method is called, the connection attempt is interrupted. As soon as this method is called, the connection status is set to ConnectionState.DISCONNECTING. Only after the connection has disconnected is the status changed to ConnectionState.DISCONNECTED. This call returns immediately, status and errors are reported via ConnectionListener.
      • isConnected

        boolean isConnected()
        Determines whether the connection to the host is connected and ready.
        Returns:
        true if the connection status is ConnectionState.CONNECTED, false otherwise.
      • getConnectionState

        ConnectionState getConnectionState()
        Returns the current state of the host connection.
        Returns:
        the connection status
      • getDeviceName

        String getDeviceName()
        This method will return the connected device name if available, or the configured device name, or null if no device name was configured.
        Returns:
        the connected device name, the configured device name, or null.
      • setDeviceName

        void setDeviceName​(String name)
        Configure a new device name for the session. Overrides any previously configured name.
        Parameters:
        name - to use on the next connect.
        Throws:
        IllegalStateException - if an attempt is made to set this property while the session is connected.
      • addConnectionListener

        void addConnectionListener​(ConnectionListener listener)
        Registers a listener that will receive connection events from this Session instance. If the listener has already been added it will not be added again.
        Parameters:
        listener - the object that wishes to receive communication events.
      • removeConnectionListener

        boolean removeConnectionListener​(ConnectionListener listener)
        Unregisters an event listener that no longer wishes to receive connection events. Before the object is unregistered, it receives a NotifyStop event.
        Parameters:
        listener - the object that wishes to stop receiving notification.
        Returns:
        true if successful.
      • getType

        SessionType getType()
        Returns the type of host session.
        Returns:
        the type of host session
      • getPresentationSpace

        PresentationSpace getPresentationSpace()
        Returns the presentation space object associated with the session. The PresentationSpace object provides access to the virtual terminal screen.
        Returns:
        the PresentationSpace object associated with the session.
      • getOIA

        OIA getOIA()
        Returns the operator information area object (OIA) associated with the session. The OIA object provides access to status information about the terminal screen.
        Returns:
        the OIA object associated with the session.