CICS® Transaction Gateway Programming Reference V3.1

com.ibm.ctg.epi
Class Terminal

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

public class Terminal
extends java.lang.Object
implements TerminalInterface, java.io.Serializable

This class represents an EPI terminal

See Also:
TerminalSession, Serialized Form

Inner Class Summary
(package private)  class Terminal.Wait
           
 
Field Summary
(package private)  EPIRequest asyncReq
           
(package private)  boolean ATIEnabled
           
(package private)  boolean ATIShouldBeEnabled
           
(package private)  boolean inCallback
           
(package private)  JavaGateway jgate
           
(package private)  Screen screen
           
(package private)  Session session
           
(package private)  EPIRequest syncReq
           
(package private)  boolean waitingEvent
           
 
Constructor Summary
Terminal()
          Constructs a terminal.
Terminal(JavaGateway jgate, java.lang.String server, java.lang.String devtype, java.lang.String netname)
          Constructs a terminal to the given server using the given gateway
 
Method Summary
 void connect()
          Connects the terminal to the server.
 void disconnect()
          Disconnects the terminal from the server.
 java.lang.String getDeviceType()
          Returns the device type of the terminal.
(package private)  void getEncodingFromCics()
           
 int getEndReason()
          Returns the end reason code.
(package private)  void getEvents()
           
 java.lang.String getNetName()
          Returns the netname of the terminal.
 Screen getScreen()
          Returns the screen associated with the terminal.
 java.lang.String getServerName()
          Returns the name of the server the terminal is connected to.
 int getState()
          Returns the state of the terminal.
 java.lang.String getTransID()
          Returns the transaction id of the current transaction.
(package private)  void handleEvent(EPIRequest req)
           
(package private)  void keepWaitingATI()
           
 boolean queryATI()
          Returns a boolean indicating whether the terminal ATI state is enabled or disabled.
 void send()
          Sends the current screen to the server using the current Session.
 void send(Session session)
          Sends the current screen to the server.
 void send(Session session, java.lang.String transid, java.lang.String data)
          Starts a transaction on the server.
 void send(java.lang.String transid, java.lang.String data)
          Starts a transaction on the server using the current session.
 void setATI(boolean on)
          Sets the terminal ATI state to be enabled or disabled.
 void setDeviceType(java.lang.String devtype)
          Sets the device type the terminal should use.
 void setGateway(JavaGateway jgate)
          Sets the Java Gateway that this terminal should use to connect to the server.
 void setNetName(java.lang.String netname)
          Sets the netname that terminal should use.
 void setServerName(java.lang.String server)
          Sets the name of the server the terminal should connect to.
 void setSession(Session s)
          Set the Session object associated with the terminal.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jgate

transient JavaGateway jgate

session

Session session

screen

transient Screen screen

syncReq

transient EPIRequest syncReq

asyncReq

transient EPIRequest asyncReq

inCallback

transient boolean inCallback

waitingEvent

transient boolean waitingEvent

ATIEnabled

boolean ATIEnabled

ATIShouldBeEnabled

boolean ATIShouldBeEnabled
Constructor Detail

Terminal

public Terminal()
Constructs a terminal. This terminal must be connected to a Java Gateway before it can be used.

Terminal

public Terminal(JavaGateway jgate,
                java.lang.String server,
                java.lang.String devtype,
                java.lang.String netname)
         throws java.io.IOException,
                EPIException
Constructs a terminal to the given server using the given gateway
Parameters:
jgate - the Java Gateway to use
server - the name of the server to connect to
devtype - device type that the terminal should use - can be null
netname - netname that the terminal should use - can be null
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if an error occurs creating the terminal
Method Detail

setGateway

public void setGateway(JavaGateway jgate)
                throws java.io.IOException,
                       EPIException
Sets the Java Gateway that this terminal should use to connect to the server.
Specified by:
setGateway in interface TerminalInterface
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if the current Java Gateway is in use.

connect

public void connect()
             throws java.io.IOException,
                    EPIException
Connects the terminal to the server.
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if an error occurs creating the terminal, or the terminal is already connected.

send

public void send(Session session,
                 java.lang.String transid,
                 java.lang.String data)
          throws EPIException,
                 java.io.IOException
Starts a transaction on the server. The terminal must be in the idle state.
Specified by:
send in interface TerminalInterface
Parameters:
session - the Session that will handle responses from the server. If this is null, no Session is used and calls are handled synchronously.
transid - the transaction to start
data - the data to pass to the transaction
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if the EPI call fails

send

public void send(java.lang.String transid,
                 java.lang.String data)
          throws EPIException,
                 java.io.IOException
Starts a transaction on the server using the current session. The terminal must be in the idle state.
Parameters:
transid - the transaction to start
data - the data to pass to the transaction
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if the EPI call fails

send

public void send(Session session)
          throws EPIException,
                 java.io.IOException
Sends the current screen to the server. This method is used when the terminal state is not idle or the screen is already set up to start the next transaction.
Specified by:
send in interface TerminalInterface
Parameters:
session - the Session that will handle responses from the server. If this is null, no Session is used and calls are handled synchronously.
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if the EPI call fails

send

public void send()
          throws EPIException,
                 java.io.IOException
Sends the current screen to the server using the current Session. This method is used when the terminal state is not idle or the screen is already set up to start the next transaction.
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if the EPI call fails

disconnect

public void disconnect()
                throws java.io.IOException,
                       EPIException
Disconnects the terminal from the server. The terminal state must be idle.
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if the EPI call fails

queryATI

public boolean queryATI()
                 throws EPIException,
                        java.io.IOException
Returns a boolean indicating whether the terminal ATI state is enabled or disabled.
Returns:
true if ATI is enabled, false otherwise
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if the EPI call fails

setATI

public void setATI(boolean on)
            throws EPIException,
                   java.io.IOException
Sets the terminal ATI state to be enabled or disabled. ATI is not enabled unless you have associated an asynchronous Session object with the Terminal.
Parameters:
on - true to set ATI enabled, false otherwise
Throws:
java.io.IOException - if an error occurs connecting to the gateway
EPIException - if the EPI call fails

getServerName

public java.lang.String getServerName()
Returns the name of the server the terminal is connected to.
Returns:
the name of the server

getNetName

public java.lang.String getNetName()
Returns the netname of the terminal.
Returns:
the netname

getDeviceType

public java.lang.String getDeviceType()
Returns the device type of the terminal.
Returns:
the dvice type.

setServerName

public void setServerName(java.lang.String server)
Sets the name of the server the terminal should connect to. Disconnect and connect the terminal to make it use the new server.
Parameters:
server - the name of the server

setNetName

public void setNetName(java.lang.String netname)
Sets the netname that terminal should use. Disconnect and connect the terminal to make it use the new netname.
Parameters:
netname - the netname

setDeviceType

public void setDeviceType(java.lang.String devtype)
Sets the device type the terminal should use. Disconnect and connect the terminal to make it use the device type.
Parameters:
devtype - the device type

getScreen

public Screen getScreen()
Returns the screen associated with the terminal.
Returns:
the screen

setSession

public void setSession(Session s)
Set the Session object associated with the terminal.
Specified by:
setSession in interface TerminalInterface
Parameters:
s - a Session object

getTransID

public java.lang.String getTransID()
Returns the transaction id of the current transaction. This may be null if there is no transaction running or the transaction ID is not known.
Returns:
the transaction id

getState

public int getState()
Returns the state of the terminal.
Returns:
the state

getEndReason

public int getEndReason()
Returns the end reason code.
Returns:
the end reason code

getEncodingFromCics

void getEncodingFromCics()
                   throws java.io.IOException,
                          EPIException

handleEvent

void handleEvent(EPIRequest req)
           throws EPIException,
                  java.io.IOException

getEvents

void getEvents()
         throws EPIException,
                java.io.IOException

keepWaitingATI

void keepWaitingATI()
              throws java.io.IOException,
                     EPIException

© Copyright IBM Corp. 1994, 1999