Package com.iizix.term
Interface HostSessionPeer
- All Known Implementing Classes:
EmptyHostSession
,HostSession3270
,HostSession5250
,HostSessionEE
public interface HostSessionPeer
The interface for 3270 or 5250 host sessions.
It is also a collection of host session states.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionstatic final int
If one of these bits are set, a lock state is present.static final int
Connected.static final int
Connecting.static final int
General error flag.static final int
3270: X-stickman>static final int
General insert mode flag.static final int
General lock flag.static final int
5250: MW.static final int
3270: X-f.static final int
3270.static final int
3270.static final int
Waiting for data.static final int
Reconnecting.static final int
Secured with SSL communication.static final int
Sending data pending.static final int
3270: 4Bstickman.static final int
General system availability.Method Summary
Modifier and TypeMethodDescriptionboolean
connect()
Connects the session to host.boolean
Disconnects the session from host.boolean
doesFieldHaveExtendedAttributes
(HostField hostField) Checks if a host field has extended attributes or not.boolean
doesHostNeedFieldExit
(int x, int y, int offset, int length, String string) For 5250: 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.int
getClientHostFieldFlags
(HostField hostField) Gets flags that are required for the client host fields for local editing, etc.getComm()
Gets the communication engine.Gets the current host cursor position.Gets the device name of the session.int
Gets the host address index on the screen.Gets the HostSession, i.e.getLastError
(boolean doClear) Gets the last error message of the session.int
getNewCharAttribute
(HostField hostField) Gets the attribute to use for new characters in a field that contains extended attributes (always zero for non-3270).int
Gets the current screen length (width * height).Gets the current screen size.int
Gets the current session state.boolean
is3270()
Checks if a session is 3270 or 5250.boolean
Checks if the use of auto reconnect session is handled or not.boolean
Checks if the display (5250 only) is in System Request mode.boolean
Checks if this host screen is field formatted.boolean
Checks if this is a printer or not.boolean
Checks if the session is currently processing data stream commands to update the screen/cursor, state, etc.void
refreshHostFields
(HostFields fields) Refreshes the host fields of the current session.boolean
sendCharacterString
(String keys) Sends character keystrokes to host.boolean
sendKey
(int key) Sends keystrokes to host.boolean
setCursor
(int x, int y) Sets the host cursor position.boolean
setHostField
(HostField hostField, String data, int[] attrs) Sets a host field fully with text data and perhaps attributes (if these are non-null).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.
Field Details
STATE_Lock
static final int STATE_LockGeneral lock flag.- See Also:
STATE_Error
static final int STATE_ErrorGeneral error flag.- See Also:
STATE_SystemAvailable
static final int STATE_SystemAvailableGeneral system availability.- See Also:
STATE_InsertMode
static final int STATE_InsertModeGeneral insert mode flag.- See Also:
STATE_Sending
static final int STATE_SendingSending data pending.- See Also:
STATE_ReceiveWait
static final int STATE_ReceiveWaitWaiting for data.- See Also:
STATE_Secure
static final int STATE_SecureSecured with SSL communication.- See Also:
STATE_MessageWaiting
static final int STATE_MessageWaiting5250: MW.- See Also:
STATE_SSCPLUOwned
static final int STATE_SSCPLUOwned3270: 4Bstickman.- See Also:
STATE_FieldFullError
static final int STATE_FieldFullError3270: X-stickman>- See Also:
STATE_MinusError
static final int STATE_MinusError3270: X-f.- See Also:
STATE_OnFieldOrProtected
static final int STATE_OnFieldOrProtected3270.- See Also:
STATE_NonNumericError
static final int STATE_NonNumericError3270.- See Also:
STATE_Connecting
static final int STATE_ConnectingConnecting.- See Also:
STATE_Reconnecting
static final int STATE_ReconnectingReconnecting.- See Also:
STATE_Connected
static final int STATE_ConnectedConnected.- See Also:
STATE_AnyLock
static final int STATE_AnyLockIf one of these bits are set, a lock state is present.- See Also:
Method Details
connect
boolean connect()Connects the session to host.disconnect
boolean disconnect()Disconnects the session from host.getScreenSize
Size getScreenSize()Gets the current screen size.getScreenLength
int getScreenLength()Gets the current screen length (width * height).sendCharacterString
Sends character keystrokes to host.sendKey
boolean sendKey(int key) Sends keystrokes to host.- See Also:
setHostString
Sets a string to a host field.setHostStringAsKeys
Sets 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.doesHostNeedFieldExit
For 5250: 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.- Returns:
- false=field doesn't require field exit, true=field requires field exit.
setCursor
boolean setCursor(int x, int y) Sets the host cursor position.getCursor
Position getCursor()Gets the current host cursor position.getCharactersAndAttributes
void getCharactersAndAttributes(char[] chars, int[] attrbs, int beginPos, int endPos) Gets the characters and attributes between two positions, including the end position.getCharactersAndAttributes
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.getSessionState
int getSessionState()Gets the current session state.- Returns:
- A combination of HostSessionPeer.STATE_* flags is returned.
getComm
SocketCommNIO getComm()Gets the communication engine.- Returns:
- The NIO instance.
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.is3270
boolean is3270()Checks if a session is 3270 or 5250.- Returns:
- false if 5250,
true if 3270.
isPrinter
boolean isPrinter()Checks if this is a printer or not.getLastError
Gets the last error message of the session.- Returns:
- null if the session doesn't support it (3270 doesn't).
setLastError
Sets the last error message of the session.getDeviceName
String getDeviceName()Gets the device name of the session.- Returns:
- null if no device name exists.
isProcessingDataStream
boolean isProcessingDataStream()Checks if the session is currently processing data stream commands to update the screen/cursor, state, etc.setInsertMode
boolean setInsertMode(boolean on) Sets the insert mode.- Returns:
- true for success, false for failure.
doesFieldHaveExtendedAttributes
Checks if a host field has extended attributes or not. 5250 never has, but 3270 could have, e.g. special highlighting.getNewCharAttribute
Gets the attribute to use for new characters in a field that contains extended attributes (always zero for non-3270).getClientHostFieldFlags
Gets flags that are required for the client host fields for local editing, etc.isAutoReconnectSessionEnabled
boolean isAutoReconnectSessionEnabled()Checks if the use of auto reconnect session is handled or not.getHomeAddress
int getHomeAddress()Gets the host address index on the screen.setHostField
Sets a host field fully with text data and perhaps attributes (if these are non-null).- Returns:
- true for success, false for failure.
getAllowedCharacters
String getAllowedCharacters()Gets 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".
isFieldFormatted
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.isDisplayInSystemRequestMode
boolean isDisplayInSystemRequestMode()Checks if the display (5250 only) is in System Request mode.getHostSession
HostSession getHostSession()Gets the HostSession, i.e. the owner of the peer.