Package com.iizix.term
Class HostSession
java.lang.Object
com.iizix.term.HostSession
The 3270 or 5250 (or EE) host session.
- Constructor SummaryConstructorsConstructorDescription- HostSession- (String id, TerminalProps properties, HostSessionOwner owner) Creates an instance of the host session, but does not connect to the host.
- Method SummaryModifier and TypeMethodDescription- void- addListener- (HostSessionListener listener) Adds a listener for host session changes.- booleanChecks for connect operation possible, used typically for GUI operations.- booleanChecks for disconnect operation possible, used typically for GUI operations.- booleanChecks for resume operation possible, used typically for GUI operations.- booleanChecks for suspend operation possible, used typically for GUI operations.- voidClears the type-ahead buffer.- boolean- connect()Connects the session.- booleanDisconnects the session.- boolean- doesHostNeedFieldExit- (int x, int y, int offset, int length, String string) For 5250 only: checks if a field has the attributes that requires this particular string to enter the data followed by a "Field Exit" or "Field Minus" key.Gets the string of characters that can be input by the user using the configured host code page for this session.- void- getCharactersAndAttributes- (char[] chars, int[] attrbs, int beginPos, int endPos) Gets the characters and attributes between two positions, including the end position.- void- getCharactersAndAttributes- (char[] chars, int[] attrbs, int beginPos, int endPos, char fieldOrNullChar) Gets the characters and attributes between two positions, including the end position.Gets the current host cursor position.Gets the device name of the session.- intGets the current screen length (width * height).Gets the host screen size.- getID()Gets the terminal session ID.- getInfo()Gets the info of the Terminal Session.Gets the keyboard remapper for this session.- getLastError- (boolean doClear) Gets the last error message of the session.Gets the last communication exception, reset at connect.Gets the listeners.- getPeer()Gets the peer.Gets the terminal properties.Gets the current host screen instance.Gets the screen compressor.Gets the current SessionInfo.- intGets the host session state.Gets the type of session as a String (3270, 5250, EE [when not connected], EE-3270 or EE-5250 [when EE is connected]).- getType()Gets the terminal type.Gets the worker instance of the session.- boolean- hasError()Checks if there is an error state.- booleanChecks if the keyboard is in insert mode or not.- boolean- is3270()Checks the session type against 3270.- booleanChecks if this is a screen capture or a "real" 3270/5250 session.- booleanChecks for session currently connected.- booleanFlag for session is processing a connect request.- booleanChecks if session is disconnected.- booleanChecks if this host screen is field formatted.- booleanChecks if the host session is locked for keyboard input.- boolean- isLocked()Checks if the host session is locked.- booleanChecks if the session is currently processing data stream commands to update the screen/cursor, state, etc.- booleanCheck if the session is current being reconnected (e.g.- booleanCheck if the session is current being reconnected (e.g.- booleanChecks if session is suspended.- booleanChecks if type-ahead is enabled for this session.- void- onConnectChange- (HostSessionPeer peer, boolean connected) Notifies the session of a connect state change.- void- onCursorPositionChange- (HostSessionPeer peer, int x, int y) Notifies the session that the cursor position has changed.- void- onFieldChange- (HostSessionPeer peer) Notifies the session that fields have changed.- void- onHostDataStreamProcessing- (HostSessionPeer peer, boolean isEntering) Called when entering or exiting data stream processing.- voidCalled when a host printer needs printing of a new page.- void- onScreenChange- (HostSessionPeer peer, int beginPos, int endPos) Notifies the session of a screen change.- void- onScreenChange- (RemoteHostSessionListener listener, HostSessionPeer peer, int beginPos, int endPos) Method to update the screen of a RemoteHostScreenListener.- void- onScreenSizeChange- (HostSessionPeer peer, int cx, int cy) Notifies the session that the screen size has changed.- void- onSessionFailure- (HostSessionPeer peer, Throwable exception) Called when a session has had a failure.- void- onStateChange- (HostSessionPeer peer) Notifies the session of a state change (such as insert mode, lock state, error state).- boolean- performClear- (int x, int y, int cx, int cy) Performs a clear operation in the terminal screen.- performCopy- (int oper, int x, int y, int cx, int cy) Performs a copy operation to a clip board string for terminal screen.- performPaste- (String data, boolean byField, boolean doPasteTextWrapping) Performs a paste operation.- booleanResumes the session.- booleanSuspends or resumes the session.- boolean- printSession- (HostSessionPeer peer) Print terminal session.- final voidRefreshes the host fields of the current session.- void- removeListener- (HostSessionListener listener) Removes a listener for host session changes.- void- replaceOwner- (HostSessionOwner owner) Replaces the host session owner for this session.- boolean- sendCharacterString- (String keys) Sends character keystrokes to host.- boolean- sendCharacterString- (String keys, boolean allowTypeAhead) Sends character keystrokes to host without allowing type-ahead.- boolean- sendKey- (int key) Sends keystrokes to host without allowing type-ahead.- boolean- sendKey- (int key, boolean allowTypeAhead) Sends keystrokes to host.- boolean- sendString- (String keys) Sends character keystrokes to host.- boolean- sendString- (String keys, boolean allowTypeAhead) Sends character keystrokes to host.- boolean- setCursor- (int x, int y) Sets the host cursor position.- boolean- setHostString- (int x, int y, int offset, int length, String string) Sets a string to a host field.- boolean- setHostStringAsKeys- (int x, int y, int offset, int length, String string) Sets a string to a host field just as if the user typed the characters.- boolean- setInsertMode- (boolean on) Sets the insert mode.- void- setLastError- (String errMsg) Sets the last error message of the session.- void- soundAlarm- (HostSessionPeer peer) Sound alarm on the client.
- Constructor Details- HostSessionCreates an instance of the host session, but does not connect to the host.- Throws:
- IOException- if an I/O error occurs.
 
 
- Method Details- addListenerAdds a listener for host session changes.- Parameters:
- listener- The host session listener.
 
- removeListenerRemoves a listener for host session changes.- Parameters:
- listener- The host session listener.
 
- getListenersGets the listeners.
- getPropertiesGets the terminal properties.
- getKeyboardRemapperGets the keyboard remapper for this session.
- getTypeGets the terminal type.
- getStringTypeGets the type of session as a String (3270, 5250, EE [when not connected], EE-3270 or EE-5250 [when EE is connected]).
- getIDGets the terminal session ID.
- is3270public boolean is3270()Checks the session type against 3270. If no session type is available, 3270 is assumed.
- isConnectedpublic boolean isConnected()Checks for session currently connected.
- isDisconnectedpublic boolean isDisconnected()Checks if session is disconnected.
- isConnectingpublic boolean isConnecting()Flag for session is processing a connect request.
- isReconnectingpublic boolean isReconnecting()Check if the session is current being reconnected (e.g. to avoid logging of host sessions being established, disconnected).
- isReconnectingCheck if the session is current being reconnected (e.g. to avoid logging of host sessions being established, disconnected).
- getLastExceptionGets the last communication exception, reset at connect.- Returns:
- The exception, or null for none.
 
- connectpublic boolean connect()Connects the session.
- disconnectpublic boolean disconnect()Disconnects the session.
- sendStringSends character keystrokes to host.
- sendStringSends character keystrokes to host.
- sendCharacterStringSends character keystrokes to host.
- sendCharacterStringSends character keystrokes to host without allowing type-ahead.
- isTypeAheadEnabledpublic boolean isTypeAheadEnabled()Checks if type-ahead is enabled for this session.
- sendKeypublic boolean sendKey- (int key) Sends keystrokes to host without allowing type-ahead.- See Also:
 
- sendKeypublic boolean sendKey- (int key, boolean allowTypeAhead) Sends keystrokes to host.- See Also:
 
- printSessionPrint terminal session.- Returns:
- false if this is not a Java client session, true otherwise.
 
- doesHostNeedFieldExitFor 5250 only: checks if a field has the attributes that requires this particular string to enter the data followed by a "Field Exit" or "Field Minus" key. For 3270 it's always false.
- setHostStringSets a string to a host field.
- setHostStringAsKeysSets a string to a host field just as if the user typed the characters. The host field is first cleared with (3270) Clear EOF or (5250) Field Exit or Field Minus (for negative numbers in a numeric field). The string is then entered as a set of keystrokes, followed by a potential Field Exit or Field Minus (for negative numbers in a numeric field), but only for 5250.
- setCursorpublic boolean setCursor- (int x, int y) Sets the host cursor position.
- getCursorGets the current host cursor position.
- getCharactersAndAttributespublic void getCharactersAndAttributes- (char[] chars, int[] attrbs, int beginPos, int endPos) Gets the characters and attributes between two positions, including the end position.
- getCharactersAndAttributespublic void getCharactersAndAttributes- (char[] chars, int[] attrbs, int beginPos, int endPos, char fieldOrNullChar) Gets the characters and attributes between two positions, including the end position. The character "fieldOrNullChar" is the character that will be used instead of field attributes and null characters.
- onScreenChangeNotifies the session of a screen change.
- onScreenChangepublic void onScreenChange- (RemoteHostSessionListener listener, HostSessionPeer peer, int beginPos, int endPos) Method to update the screen of a RemoteHostScreenListener.- Parameters:
- listener- The listener to update, or null for all.
- peer- The peer.
 
- getScreenCompressionGets the screen compressor.
- onFieldChangeNotifies the session that fields have changed.
- onScreenSizeChangeNotifies the session that the screen size has changed.
- onCursorPositionChangeNotifies the session that the cursor position has changed.
- onConnectChangeNotifies the session of a connect state change.
- onStateChangeNotifies the session of a state change (such as insert mode, lock state, error state).
- getScreenGets the current host screen instance.
- getHostScreenSizeGets the host screen size.
- getHostScreenLengthpublic int getHostScreenLength()Gets the current screen length (width * height).
- getSessionStatepublic int getSessionState()Gets the host session state.- Returns:
- A combination of STATE_* flags is returned.
 
- isLockedpublic boolean isLocked()Checks if the host session is locked.
- isKeyboardInputAllowedpublic boolean isKeyboardInputAllowed()Checks if the host session is locked for keyboard input. Keyboard input is allowed for 5250 sessions when in System Request mode or the Attention key is sent.
- hasErrorpublic boolean hasError()Checks if there is an error state.
- inInsertModepublic boolean inInsertMode()Checks if the keyboard is in insert mode or not.
- refreshHostFieldspublic final void refreshHostFields()Refreshes the host fields of the current session. The host session will add all available host fields sorted left to right, top to bottom.
- getSessionInfoGets the current SessionInfo.
- soundAlarmSound alarm on the client.
- onSessionFailureCalled when a session has had a failure.
- getLastErrorGets the last error message of the session.- Returns:
- null if the session doesn't support it (3270 doesn't).
 
- setLastErrorSets the last error message of the session.
- getDeviceNameGets the device name of the session.- Returns:
- null if no device name exists.
 
- onHostPrintPageCalled when a host printer needs printing of a new page.
- getPeerGets the peer.- Note that manipulation of the peer directly needs synchronization of that object. 
- clearTypeAheadpublic void clearTypeAhead()Clears the type-ahead buffer.
- setInsertModepublic boolean setInsertMode- (boolean on) Sets the insert mode.- Returns:
- true for success, false for failure.
 
- replaceOwnerReplaces the host session owner for this session.
- isProcessingDataStreampublic boolean isProcessingDataStream()Checks if the session is currently processing data stream commands to update the screen/cursor, state, etc.
- onHostDataStreamProcessingCalled when entering or exiting data stream processing.
- getAllowedCharactersGets the string of characters that can be input by the user using the configured host code page for this session.- If the return string is empty, for the EE package for example, all characters are "inputable". 
- isFieldFormattedpublic boolean isFieldFormatted()Checks if this host screen is field formatted. This method is not like the one in HostScreen, this one checks directly to see if any fields are present.
- getWorkerGets the worker instance of the session.- Throws:
- IOException
 
- performCopyPerforms a copy operation to a clip board string for terminal screen.- Parameters:
- oper- 0=divide by field, 1=by word, 2=data only.
- x- The x position.
- y- The y position.
- cx- The width.
- cy- The height.
- Returns:
- null if the operation could not be completed due to invalid host session or parameters, otherwise the copied string.
 
- performClearpublic boolean performClear- (int x, int y, int cx, int cy) Performs a clear operation in the terminal screen.- Returns:
- false if the operation could not be completed due to invalid host session or parameters, true otherwise.
 
- performPastePerforms a paste operation.- Parameters:
- byField- Flag used only when tabs are in the string.
- doPasteTextWrapping- Flag to paste too long text wrapping.
- Returns:
- The rest of the clip board data that couldn't be pasted (in order to perform another Continue paste operation), or null for failure.
 
- performSuspendpublic boolean performSuspend()Suspends or resumes the session.- Returns:
- true for success, false for failure.
 
- isSuspendedpublic boolean isSuspended()Checks if session is suspended.
- performResumepublic boolean performResume()Resumes the session.- Returns:
- true for success, false for failure.
 
- canConnectpublic boolean canConnect()Checks for connect operation possible, used typically for GUI operations.
- canSuspendpublic boolean canSuspend()Checks for suspend operation possible, used typically for GUI operations.
- canResumepublic boolean canResume()Checks for resume operation possible, used typically for GUI operations.
- canDisconnectpublic boolean canDisconnect()Checks for disconnect operation possible, used typically for GUI operations.
- isCapturedpublic boolean isCaptured()Checks if this is a screen capture or a "real" 3270/5250 session.
- getInfoGets the info of the Terminal Session. The name is either the file name for a capture session or the terminal properties name. The first character is '0'=live 3270/5250, '1'=capture, '2'=recorded.