Package com.iizix.term.server
Class TerminalHost
- java.lang.Object
- com.iizix.term.server.TerminalHost
- All Implemented Interfaces:
HostSessionListener,HostSessionOwner
public class TerminalHost extends java.lang.Object implements HostSessionOwner
The terminal host implementation running a terminal of 3270, 5020 or EE type.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description TerminalHost(TerminalProps terminalProps, AppSessionGyro appGyro)The constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddListener(ITerminalStateListener listener)Adds a new listeners.HostSessioncreateHostSession()Creates a HostSession if not already created.voiddispose()Dispose.HostSessiongetHostSession()Gets the host session instance.ScreenProp[]getMatchingScreens()Gets the matching screens.SessionInfogetSessionInfo()Gets the SessionInfo.WorkergetWorker()Gets the worker of the session.booleanisConnectEnabled()Checks if session is connectable.booleanisDisconnectEnabled()Checks if session is disconnectable.booleanisResumeEnabled()Checks if session can be resumed.booleanisSuspendEnabled()Checks if session can be suspended.voidonConnectChange(HostSessionPeer peer, boolean connected)Notifies the session of a connect state change.voidonCursorPositionChange(HostSessionPeer peer, int x, int y)Notifies the session that the cursor position has changed.voidonFieldChange(HostSessionPeer peer)Notifies the session that fields have changed.intonHostDataStreamProcessing(HostSessionPeer peer, boolean isEntering)Called when the datastream enters or exits processing.voidonHostDataStreamProcessing(HostSessionPeer peer, boolean isEntering, int updates)Data stream processing notification method.voidonHostPrintPage(HostSessionPeer peer)Called when a host printer needs printing of a new page.voidonScreenChange(HostSessionPeer peer, int beginPos, int endPos)Notifies the session of a screen change.voidonScreenChanged(ScreenProp screen, boolean isRemoved)Method to refresh the matching screens when one has been changed.voidonScreenSizeChange(HostSessionPeer peer, int cx, int cy)Notifies the session that the screen size has changed.voidonSessionFailure(HostSessionPeer peer, java.lang.Throwable exception)Called when a session has had a failure.voidonStateChange(HostSessionPeer peer)Notifies the session of a state change (such as insert mode, lock state, error state).booleanprintSession(HostSessionPeer peer)Called when the host (mainframe) has issued a Print Session (Print Local Copy).booleanremoveListener(ITerminalStateListener listener)Removes a listener.voidsoundAlarm(HostSessionPeer peer)Sound alarm on the client.
Constructor Detail
TerminalHost
public TerminalHost(TerminalProps terminalProps, AppSessionGyro appGyro)
The constructor.- Parameters:
terminalProps- The terminal properties.appGyro- The application session gyro.
Method Detail
dispose
public void dispose()
Dispose.
addListener
public boolean addListener(ITerminalStateListener listener)
Adds a new listeners. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
listener- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
java.lang.NullPointerException- If the listener isnull.
removeListener
public boolean removeListener(ITerminalStateListener listener)
Removes a listener.- Parameters:
listener- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
createHostSession
public HostSession createHostSession() throws java.io.IOException
Creates a HostSession if not already created.- Returns:
- Thew new or existing host session, never null.
- Throws:
java.io.IOException- For failures when creating SSL engine.
getHostSession
public HostSession getHostSession()
Gets the host session instance.- Returns:
- The host session, null if none is created.
getMatchingScreens
public ScreenProp[] getMatchingScreens()
Gets the matching screens.- Returns:
- Matching screens array, never null.
onScreenChanged
public void onScreenChanged(ScreenProp screen, boolean isRemoved)
Method to refresh the matching screens when one has been changed.- Parameters:
screen- The changed screen or null for all.isRemoved- Flag for removed.
onHostDataStreamProcessing
public int onHostDataStreamProcessing(HostSessionPeer peer, boolean isEntering)
Called when the datastream enters or exits processing. This enables the owner to "group" multiple notification events together.- Specified by:
onHostDataStreamProcessingin interfaceHostSessionOwner- Parameters:
peer- The peer.isEntering- Flag for entering or exiting.- Returns:
- Bit flags 0x01 = characters changed, 0x02=fields changed.
onHostPrintPage
public void onHostPrintPage(HostSessionPeer peer)
Called when a host printer needs printing of a new page.- Specified by:
onHostPrintPagein interfaceHostSessionOwner- Parameters:
peer- The peer.
printSession
public boolean printSession(HostSessionPeer peer)
Called when the host (mainframe) has issued a Print Session (Print Local Copy).- Specified by:
printSessionin interfaceHostSessionOwner- Parameters:
peer- The peer.- Returns:
- true for success, false for cancel.
getWorker
public Worker getWorker() throws java.io.IOException
Gets the worker of the session.- Specified by:
getWorkerin interfaceHostSessionOwner- Returns:
- The worker.
- Throws:
java.io.IOException- For error when getting the worker.
getSessionInfo
public SessionInfo getSessionInfo()
Gets the SessionInfo.- Specified by:
getSessionInfoin interfaceHostSessionOwner- Returns:
- The session info, never null.
onScreenChange
public void onScreenChange(HostSessionPeer peer, int beginPos, int endPos)
Notifies the session of a screen change.- Specified by:
onScreenChangein interfaceHostSessionListener
onFieldChange
public void onFieldChange(HostSessionPeer peer)
Notifies the session that fields have changed.- Specified by:
onFieldChangein interfaceHostSessionListener
onScreenSizeChange
public void onScreenSizeChange(HostSessionPeer peer, int cx, int cy)
Notifies the session that the screen size has changed.- Specified by:
onScreenSizeChangein interfaceHostSessionListener
onCursorPositionChange
public void onCursorPositionChange(HostSessionPeer peer, int x, int y)
Notifies the session that the cursor position has changed.- Specified by:
onCursorPositionChangein interfaceHostSessionListener
onConnectChange
public void onConnectChange(HostSessionPeer peer, boolean connected)
Notifies the session of a connect state change.- Specified by:
onConnectChangein interfaceHostSessionListener
onStateChange
public void onStateChange(HostSessionPeer peer)
Notifies the session of a state change (such as insert mode, lock state, error state).- Specified by:
onStateChangein interfaceHostSessionListener
onSessionFailure
public void onSessionFailure(HostSessionPeer peer, java.lang.Throwable exception)
Called when a session has had a failure.- Specified by:
onSessionFailurein interfaceHostSessionListener
onHostDataStreamProcessing
public void onHostDataStreamProcessing(HostSessionPeer peer, boolean isEntering, int updates)
Data stream processing notification method.- Specified by:
onHostDataStreamProcessingin interfaceHostSessionListener- Parameters:
peer- The peer.isEntering- The state of processing (true=before, false=after).updates- What has been updated on screen (bit flag: 0x01=characters, 0x02=fields).
soundAlarm
public void soundAlarm(HostSessionPeer peer)
Sound alarm on the client.- Specified by:
soundAlarmin interfaceHostSessionListener
isConnectEnabled
public boolean isConnectEnabled()
Checks if session is connectable.- Returns:
- true if connectable.
isSuspendEnabled
public boolean isSuspendEnabled()
Checks if session can be suspended.- Returns:
- true if suspendable.
isResumeEnabled
public boolean isResumeEnabled()
Checks if session can be resumed.- Returns:
- true if resumeable.
isDisconnectEnabled
public boolean isDisconnectEnabled()
Checks if session is disconnectable.- Returns:
- true if disconnectable.