CICS® Transaction Gateway Programming Reference V3.1

com.ibm.ctg.epi
Class EPITerminal

java.lang.Object
  |
  +--com.ibm.ctg.epi.EPITerminal

public class EPITerminal
extends java.lang.Object
implements Session, TerminalSession, java.lang.Runnable, java.awt.event.ActionListener, java.io.Serializable

A Java bean that represents a connection to a CICS 3270 terminal.

See Also:
Serialized Form

Inner Class Summary
(package private)  class EPITerminal.Timer
          This class is a simple timer.
 
Constructor Summary
EPITerminal()
          Construct an EPITerminal.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Reacts to an action event by starting a transaction - the action command associated with the event is assumed to be the transaction name.
 void addTerminalEventListener(TerminalEventListener h)
          Adds a TerminalEventListener to the list of screen handlers.
 void connect()
          Connect to the CICS server.
 void disconnect()
          Disconnect from the CICS server.
protected  void finalize()
          finalize.
 java.lang.String getGatewayClientSecurity()
          Returns the name of the client security class that the CICS Transaction Gateway will use.
 java.lang.String getGatewayServerSecurity()
          Returns the name of the server security class that the CICS Transaction Gateway will use.
 java.lang.String getGatewayURL()
          Returns the URL of the CICS Transaction Gateway that the terminal will connect to.
 Screen getScreen()
          Returns the Screen object associated with this terminal.
 int getState()
          Returns the terminal state.
 int getSyncType()
          Returns the type of synchronization the terminal is using.
 TerminalInterface getTerminal()
          Returns the terminal that will be used to connect to CICS..
 long getTimeout()
          Returns the terminal timeout.
 java.lang.String getTransaction()
          Returns the transaction that will be started if startTran is called.
 java.lang.String getTransactionData()
          Returns the parameters that will be passed when startTran is called.
 void handleReply(TerminalInterface term)
          Handles a reply from CICS by sending handleScreen events to all listeners if the terminal is in the right state.
 boolean isATI()
          Returns true if ATI is currently enabled for this terminal.
 boolean isConnected()
          Returns true if the terminal is connected to CICS.
(package private)  void processConnect()
          Send the terminalConnected event to all listeners
(package private)  void processDisconnect()
          Send the terminalDsiconnected event to all listeners
(package private)  void processError(java.lang.Exception e)
          Send the exception occurred event to all listeners
(package private)  void processScreen()
          Handle a change in the terminal state.
 boolean queryATI()
          Determines whether ATI is currently enabled for this terminal.
 void removeTerminalEventListener(TerminalEventListener h)
          Remove a TerminalEventListener from the list of screen handlers.
 void send()
          Sends the current screen to CICS.
 void send(java.lang.String tran, java.lang.String data)
          Starts a new transaction.
 void setATI(boolean on)
          Sets the Terminal ATI state.
 void setGatewayClientSecurity(java.lang.String classname)
          Set the client security class that the CICS Transaction Gateway will use.
 void setGatewayServerSecurity(java.lang.String classname)
          Set the server security class that the CICS Transaction Gateway will use.
 void setGatewayURL(java.lang.String url)
          Set the URL of the CICS Transaction Gateway to connect to.
 void setTerminal(TerminalInterface t)
          Set the terminal that will be used to connect to CICS.
 void setTimeout(long t)
          Set the terminal timeout.
 void setTransaction(java.lang.String t)
          Set the transaction to be started when startTran is called.
 void setTransactionData(java.lang.String d)
          Set the parameters to pass when startTran is called.
 void startTran()
          Starts a transaction on the terminal, using the current transaction ID and data.
 void terminate()
          Waits for the terminal to finish disconnecting, then closes the connection to the CICS Transaction Gateway.
(package private)  void timedOut()
          This method is called by the timer thread if the idle timeout period expires
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPITerminal

public EPITerminal()
Construct an EPITerminal. Before using the terminal, you must at least set the URL property to the URL of the CICS Transaction Gateway.
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
finalize. Best not to try and be too ambitious about cleaning up, as threads may be killed without warning about now. Close the JavaGateway.
Throws:
java.lang.Throwable - if an error occurs
Overrides:
finalize in class java.lang.Object

terminate

public void terminate()
Waits for the terminal to finish disconnecting, then closes the connection to the CICS Transaction Gateway.

connect

public void connect()
Connect to the CICS server.
Specified by:
connect in interface TerminalSession

disconnect

public void disconnect()
Disconnect from the CICS server.
Specified by:
disconnect in interface TerminalSession

setTransaction

public void setTransaction(java.lang.String t)
Set the transaction to be started when startTran is called.
Parameters:
t - the transaction ID.

getTransaction

public java.lang.String getTransaction()
Returns the transaction that will be started if startTran is called.
Returns:
the transaction ID.

setTransactionData

public void setTransactionData(java.lang.String d)
Set the parameters to pass when startTran is called.
Parameters:
d - the parameters

getTransactionData

public java.lang.String getTransactionData()
Returns the parameters that will be passed when startTran is called.
Returns:
the parameters

setTerminal

public void setTerminal(TerminalInterface t)
Set the terminal that will be used to connect to CICS. Disconnect and reconnect for this change to take effect.
Parameters:
t - the terminal to use

getTerminal

public TerminalInterface getTerminal()
Returns the terminal that will be used to connect to CICS..
Returns:
the terminal object

setGatewayURL

public void setGatewayURL(java.lang.String url)
Set the URL of the CICS Transaction Gateway to connect to. If already connected, this change has no effect.
Parameters:
url - the URL of the gateway

getGatewayURL

public java.lang.String getGatewayURL()
Returns the URL of the CICS Transaction Gateway that the terminal will connect to.
Returns:
the URL of the gateway

setGatewayClientSecurity

public void setGatewayClientSecurity(java.lang.String classname)
Set the client security class that the CICS Transaction Gateway will use. If the terminal is connected, this change does not affect it.
Parameters:
classname - the name of the security class

getGatewayClientSecurity

public java.lang.String getGatewayClientSecurity()
Returns the name of the client security class that the CICS Transaction Gateway will use.
Returns:
the name of the security class

setGatewayServerSecurity

public void setGatewayServerSecurity(java.lang.String classname)
Set the server security class that the CICS Transaction Gateway will use. If the terminal is connected, this change does not affect it.
Parameters:
classname - the name of the security class

getGatewayServerSecurity

public java.lang.String getGatewayServerSecurity()
Returns the name of the server security class that the CICS Transaction Gateway will use.
Returns:
the name of the security class

setTimeout

public void setTimeout(long t)
Set the terminal timeout. If the terminal is idle for longer than this period, it will disconnect itself. A timeout of zero or a negative timeout means no timeout.
Parameters:
t - the timeout in milliseconds

getTimeout

public long getTimeout()
Returns the terminal timeout. If the terminal is idle for longer than this period, it will disconnect itself. A timeout of zero or a negative timeout means no timeout.
Returns:
the timeout in milliseconds

isConnected

public boolean isConnected()
Returns true if the terminal is connected to CICS.
Returns:
true if connected, false otherwise

startTran

public void startTran()
Starts a transaction on the terminal, using the current transaction ID and data.

getScreen

public Screen getScreen()
Returns the Screen object associated with this terminal.
Specified by:
getScreen in interface TerminalSession
Returns:
the screen, or null if not connected.

send

public void send()
Sends the current screen to CICS.
Specified by:
send in interface TerminalSession

send

public void send(java.lang.String tran,
                 java.lang.String data)
Starts a new transaction.
Specified by:
send in interface TerminalSession
Parameters:
tran - a transaction ID
data - parameters to pass to the transaction

queryATI

public boolean queryATI()
Determines whether ATI is currently enabled for this terminal.
Specified by:
queryATI in interface TerminalSession
Returns:
true if ATI is currently enabled

setATI

public void setATI(boolean on)
Sets the Terminal ATI state.
Specified by:
setATI in interface TerminalSession
Parameters:
on - true to set ATI enabled

isATI

public boolean isATI()
Returns true if ATI is currently enabled for this terminal.
Returns:
true if ATI is enabled

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Reacts to an action event by starting a transaction - the action command associated with the event is assumed to be the transaction name. Use this method to make a button push or menu selection trigger the start of a transaction.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
evt - the action event

addTerminalEventListener

public void addTerminalEventListener(TerminalEventListener h)
Adds a TerminalEventListener to the list of screen handlers. When an event occurs, such as the arrival of a screen of data from CICS, all the event listeners are notified.
Parameters:
h - the event listener

removeTerminalEventListener

public void removeTerminalEventListener(TerminalEventListener h)
Remove a TerminalEventListener from the list of screen handlers.
Parameters:
h - the event listener

processScreen

void processScreen()
Handle a change in the terminal state. This method sends the handleScreen event to all listeners.

processConnect

void processConnect()
Send the terminalConnected event to all listeners

processDisconnect

void processDisconnect()
Send the terminalDsiconnected event to all listeners

processError

void processError(java.lang.Exception e)
Send the exception occurred event to all listeners

getSyncType

public int getSyncType()
Returns the type of synchronization the terminal is using.
Specified by:
getSyncType in interface Session
Returns:
the synchronization type

handleReply

public void handleReply(TerminalInterface term)
Handles a reply from CICS by sending handleScreen events to all listeners if the terminal is in the right state.
Specified by:
handleReply in interface Session
Parameters:
term - the terminal object where the state has changed

getState

public int getState()
Returns the terminal state.
Specified by:
getState in interface TerminalSession
Returns:
the terminal state, or discon if not connected

timedOut

void timedOut()
This method is called by the timer thread if the idle timeout period expires

© Copyright IBM Corp. 1994, 1999