|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.adapter.HostAccess
HostAccess layers the IBM Host On Demand library to provide 3270 emulation access to a mainframe.
There are two principal uses of this class:
Field Summary | |
protected static Trace |
_trace
|
static java.lang.String |
code_id
|
static java.lang.String |
RA_PROPS
|
static java.lang.String |
RA_TN3270E
|
static java.lang.String |
WAIT_FOR_INPUT
|
Constructor Summary | |
HostAccess(HostAccessLogin haLogin)
Constructor. |
Method Summary | |
void |
close()
Abruptly terminate communications with the host. |
void |
connect()
Initiate communication with the host. |
void |
connectAndLogin()
Initiate communication with the host, and ask the adapter to execute its custom login script. |
int |
convertRowColToPos(int row,
int col)
The ConvertRowColToPos method converts a row and column coordinate to its corresponding linear position. |
java.lang.String |
doCmd(java.lang.String cmd,
java.lang.String prompt,
java.lang.String morePrompt)
Send a command to the host. |
java.lang.String |
doCmd(java.lang.String cmd,
java.lang.String prompt,
java.lang.String morePrompt,
int timeout)
Send a command to the host. |
java.lang.String |
doCmd(java.lang.String cmd,
java.lang.String prompt,
java.lang.String morePrompt,
int timeout,
ScreenNotifier notifier)
Send a command to the host. |
java.lang.String |
doCmd(java.lang.String cmd,
java.lang.String prompt,
java.lang.String morePrompt,
java.lang.String displayCmd,
java.util.List stringsToHide,
int timeout,
ScreenNotifier notifier)
Send a command to the host. |
ServerAffinity |
getAffinity()
Returns the ServerAffinity |
int |
getCmdTimeouts()
Returns the number of timeouts which have occurred. |
java.lang.String |
getContainerPoolKey()
Returns the container's pool key |
int |
getCursorPos()
Returns the linear cursor position. |
protected static java.lang.String |
getDisplayableCommand(java.lang.String command,
java.util.List stringsToHide)
Transform the command into a string which can be safely displayed. |
java.lang.String |
getHost()
Returns the name of the host or TN server. |
int |
getIdleTimeout()
Returns the time (in milliseconds) after which the connection should be considered idle. |
java.lang.String |
getKey()
Returns the pool key for this object |
long |
getLastUse()
Returns the timestamp when this object was last used |
java.lang.String |
getLine(int line)
Returns a string containing all the characters for the specified line in the text plane associated with the presentation space. |
int |
getNumCols()
Returns the total number of columns in the presentation space. |
int |
getNumRows()
Returns the total number of rows in the presentation space. |
java.lang.String |
getPort()
Returns the port of the host or TN server |
java.util.Properties |
getProperties()
Returns the Properties used to configure the ECLSession |
int |
getRequiredString(java.lang.String s)
Searches for a given text string within the presentation space. |
int |
getRequiredString(java.lang.String s,
java.util.ArrayList stringsToHide)
Searches for a given text string within the presentation space. |
java.lang.String |
getScreen()
Returns a string containing all the characters in the text plane associated with the presentation space. |
java.lang.String |
getScreen(int plane)
Returns a string containing all the characters in the specified plane associated with the presentation space. |
java.lang.String |
getScreenRect(int startRow,
int startCol,
int endRow,
int endCol)
Returns a string containing all the characters in the specified rectangle within the text plane associated with the presentation space. |
java.lang.String |
hideFields(java.lang.String screen,
java.util.ArrayList stringsToHide)
Returns a string with any fields that should be hidden blanked out. |
boolean |
isBogus()
Returns the value of the corrupted connection flag set by setBogus(boolean) |
void |
logoffAndClose()
Logoff from the host (using a logoff script configured for the resource), and close the connection. |
void |
NotifyError(com.ibm.eNetwork.ECL.ECLConnection connection,
com.ibm.eNetwork.ECL.ECLErr e)
Outputs the error message text to the trace log if level 3 tracing is enabled on the "NotifyError" method of this class. |
void |
NotifyEvent(com.ibm.eNetwork.ECL.ECLConnection connection,
boolean connected)
Outputs the connection state to the trace log if level 3 tracing is enabled on the "NotifyEvent" method of this class. |
void |
NotifyStop(com.ibm.eNetwork.ECL.ECLConnection connection,
int reason)
Outputs the stop reason to the trace log if level 3 tracing is enabled on the "NotifyStop" method of this class. |
void |
PSNotifyError(com.ibm.eNetwork.ECL.ECLPS ps,
com.ibm.eNetwork.ECL.ECLErr err)
Outputs the error message text in err to the trace log if level 3 tracing is enabled on the "PSNotifyError" method of this class. |
void |
PSNotifyEvent(com.ibm.eNetwork.ECL.event.ECLPSEvent evt)
Core logic of processing host responses. |
void |
PSNotifyStop(com.ibm.eNetwork.ECL.ECLPS ps,
int reason)
Outputs the stop reason to the trace log if level 3 tracing is enabled on the "PSNotifyStop" method of this class. |
static java.util.Properties |
retrieveProperties(Resource resource)
Get the ECLSession properties from the "standard" set of resource attributes. |
protected int |
searchBackwards(com.ibm.eNetwork.ECL.ECLPS ps,
java.lang.String str)
Searches for the last occurrence of a string within a presentation space. |
int |
searchText(java.lang.String string,
boolean forward)
The searchText method searches for a given text string within the presentation space. |
void |
sendKeys(java.lang.String s)
The SendKeys method sends a string of keys to the host. |
void |
sendKeysAndWait(java.lang.String s,
java.lang.String errMsg)
Calls sendKeys(s) and then waitForInput() . |
void |
setAffinity(ServerAffinity affinity)
Set the ServerAffinity. |
void |
setBogus(boolean isBogus)
Set the flag indicating that this host connection can or cannot be trusted. |
void |
setContainerPoolKey(java.lang.String containerPoolKey)
Set the the pool key of this object's container (internal). |
void |
setCursorPos(int pos)
Sets the cursor position to the specified row and column. |
void |
setHost(java.lang.String host)
Set the name of the host or TN server |
void |
setIdleTimeout(int to)
Sets the time (in milliseconds) after which the connection should be considered idle. |
void |
setKey(java.lang.String key)
Sets the pool key for this object |
void |
setPort(java.lang.String port)
Set the port of the host or TN server |
void |
setProperties(java.util.Properties props)
Set additional Properties to configure the host ECLSession. |
protected void |
trace(java.lang.String s)
Outputs a string to the trace log if level 4 tracing is enabled on the "trace" method of this class. |
void |
traceString(java.lang.String s)
Outputs a string to the trace log if level 4 tracing is enabled on the "trace" method of this class. |
boolean |
waitForInput()
Synchronously waits indefinitely until the operator information area (OIA) input is not inhibited. |
void |
waitForString(java.lang.String s)
Waits until the given text string is in the presentation space, or until a timeout occurs. |
void |
waitForString(java.lang.String s,
java.util.ArrayList stringsToHide)
Waits until the given text string is in the presentation space, or until a timeout occurs. |
void |
waitForStringAndInput(java.lang.String s)
Equivalent to calling waitForString(String) followed by waitForInput() |
void |
waitForStringAndInput(java.lang.String s,
java.util.ArrayList stringsToHide)
Equivalent to calling #waitForString(String, String) followed by waitForInput() |
boolean |
waitForStringFound(java.lang.String s)
Waits until the given text string is in the presentation space, or until a timeout occurs. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
protected static Trace _trace
public static java.lang.String WAIT_FOR_INPUT
public static final java.lang.String RA_TN3270E
public static final java.lang.String RA_PROPS
Constructor Detail |
public HostAccess(HostAccessLogin haLogin) throws java.lang.Exception
haLogin
- the instance of HostAccessLogin from which this
object will be configured. This method is typically called from the
pool which is responsible for caching/creating HostAccess objects.
java.lang.Exception
- an incorrectly configured HostAccessLogin objectMethod Detail |
public java.lang.String getHost()
public void setHost(java.lang.String host)
host
- the name of the host or TN serverpublic java.lang.String getContainerPoolKey()
public void setContainerPoolKey(java.lang.String containerPoolKey)
containerPoolKey
- container's pool keypublic java.lang.String getPort()
public void setPort(java.lang.String port)
port
- the port of the host or TN serverpublic ServerAffinity getAffinity()
public void setAffinity(ServerAffinity affinity)
affinity
- the ServerAffinitypublic java.util.Properties getProperties()
public void setProperties(java.util.Properties props)
This is usually called with the set of properties returned from
HostAccessLogin.getProperties()
props
- additional Properties to configure the host ECLSessionretrieveProperties(com.waveset.object.Resource)
public int getNumRows()
NOTE: There have been some issues with the underlying libraries not returning the correct number of rows.
public int getNumCols()
Note: There have been some issues with the underlying libraries not returning the correct number of columns.
public int getIdleTimeout()
The idle timeout defaults to 200,000 milliseconds, but can be adjusted by changing the 'Idle Timeout' resource attribute.
public void setIdleTimeout(int to)
public long getLastUse()
public int getCmdTimeouts()
public java.lang.String getKey()
public void setKey(java.lang.String key)
key
- the pool key for this objectpublic boolean isBogus()
setBogus(boolean)
public void setBogus(boolean isBogus)
isBogus
- new value for corruption flagpublic void connect() throws java.lang.Exception
java.lang.Exception
- Thrown if communication could not be established with the hostpublic void connectAndLogin() throws java.lang.Exception
java.lang.Exception
- Thrown if communication could not be established with the host, or
login was unsuccessfulpublic void close()
public void logoffAndClose()
public int convertRowColToPos(int row, int col) throws java.lang.Exception
row
- The row of the coordinate.col
- The column of the coordinate.
java.lang.Exception
- Thrown if the coordinates are not within the presentation space boundaries.public boolean waitForInput()
public void sendKeys(java.lang.String s) throws java.lang.Exception
The text string can contain any number or combination of characters and mnemonics. For example, the following string, "userID[tab]password[enter]", can be used to send a user's ID, tab to the next field, send the user's password, and then send the Enter key to logon to a host.
To send a left or right square bracket, the character must be doubled. To send a left square bracket use "[[". To send a right square bracket use "]]".
s
- The string of characters and aid key mnemonics to be sent.
java.lang.Exception
- Thrown on mnemonic error.public void sendKeysAndWait(java.lang.String s, java.lang.String errMsg) throws java.lang.Exception
sendKeys(s)
and then waitForInput()
.
s
- The string of characters and aid key mnemonics to be sent.errMsg
- the string to prepend to the exception message if waitForInput() fails
java.lang.Exception
- if waitForInput() returns false. The thrown exception will be prepended with
the errMsg string.public java.lang.String hideFields(java.lang.String screen, java.util.ArrayList stringsToHide) throws java.lang.Exception
screen
- original stringstringsToHide
- list of Strings which, if present in the screen, will be blanked out.
java.lang.Exception
- internal errorpublic int getRequiredString(java.lang.String s) throws java.lang.Exception
s
- the string to search for
java.lang.Exception
- if the string is not foundpublic int getRequiredString(java.lang.String s, java.util.ArrayList stringsToHide) throws java.lang.Exception
s
- the string to search forstringsToHide
- currently unused
java.lang.Exception
- if the string is not foundpublic void waitForString(java.lang.String s) throws java.lang.Exception
If string is not seen before timeout, then exception is thrown.
s
- the string to wait for
java.lang.Exception
- if string was not found before timeout, or an interruption occurredpublic void waitForStringAndInput(java.lang.String s) throws java.lang.Exception
waitForString(String)
followed by waitForInput()
java.lang.Exception
public void waitForStringAndInput(java.lang.String s, java.util.ArrayList stringsToHide) throws java.lang.Exception
#waitForString(String, String)
followed by waitForInput()
java.lang.Exception
public void waitForString(java.lang.String s, java.util.ArrayList stringsToHide) throws java.lang.Exception
If string is not seen before timeout, then exception is thrown.
s
- the string to wait forstringsToHide
- list of strings to blank out in the exception message,
which includes a dump of the current presentation space text.
java.lang.Exception
- if string was not found before timeout, or an interruption occurredpublic boolean waitForStringFound(java.lang.String s) throws java.lang.Exception
s
- the string to wait for
java.lang.Exception
- an interruption occurredpublic int searchText(java.lang.String string, boolean forward)
string
- the string to search forforward
- If true, search forward. Otherwise, search backward.
public int getCursorPos() throws java.lang.Exception
Note: The cursor positioning system is 1-based rather than 0-based. The valid cursor positions for a 24 x 80 presentation space are between 1 and 1920 inclusive.
java.lang.Exception
public void setCursorPos(int pos) throws java.lang.Exception
pos
- The new linear cursor position. This number must
be between 1 and the size of the presentation space inclusive.
java.lang.Exception
- Thrown when the given position is out of range.public java.lang.String getLine(int line) throws java.lang.Exception
line
- The line of text which is wanted. A value of 1 indicates
the first line.
java.lang.Exception
- if line is out of rangepublic java.lang.String getScreenRect(int startRow, int startCol, int endRow, int endCol) throws java.lang.Exception
startRow
- starting row of the rectanglestartCol
- starting column of the rectangleendRow
- ending row of the rectangleendCol
- ending column of the rectangle
java.lang.Exception
- if either of the positions specified is not within the plane.public java.lang.String getScreen() throws java.lang.Exception
java.lang.Exception
- internal error. Unlikely to occur.public java.lang.String getScreen(int plane) throws java.lang.Exception
plane
- the plane to return. Valid values are:
java.lang.Exception
- if the plane parameter is incorrectpublic java.lang.String doCmd(java.lang.String cmd, java.lang.String prompt, java.lang.String morePrompt) throws java.lang.Exception
Before the command is sent sent to the host, a [clear] key is first sent.
cmd
- the command to send. Note that cmd must contain the [enter] mnemonic.prompt
- the string in the command response which indicates the final end of the response (e.g. " ?")morePrompt
- the string expected in the command response which indicates the end of a page (e.g. " ***")
java.lang.Exception
- if cmd was not completed before timeout, or an interruption occurred. The timeout defaults
to 60,000 milliseconds, but can be adjusted by changing the 'Request Timeout' resource attribute.public java.lang.String doCmd(java.lang.String cmd, java.lang.String prompt, java.lang.String morePrompt, int timeout) throws java.lang.Exception
Before the command is sent sent to the host, a [clear] key is first sent.
cmd
- the command to send. Note that cmd must contain the [enter] mnemonic.prompt
- the string in the command response which indicates the final end of the response (e.g. " ?")morePrompt
- the string expected in the command response which indicates the end of a page (e.g. " ***")timeout
- the number of milliseconds to wait for the command to complete. If timeout < 0, then
the timeout defaults to 60,000 milliseconds, but can be adjusted by changing the
'Request Timeout' resource attribute.
java.lang.Exception
- if cmd was not completed before timeout, or an interruption occurredpublic java.lang.String doCmd(java.lang.String cmd, java.lang.String prompt, java.lang.String morePrompt, int timeout, ScreenNotifier notifier) throws java.lang.Exception
Before the command is sent sent to the host, a [clear] key is first sent.
cmd
- the command to send. Note that cmd must contain the [enter] mnemonic.prompt
- the string in the command response which indicates the final end of the response (e.g. " ?")morePrompt
- the string expected in the command response which indicates the end of a page (e.g. " ***")timeout
- the number of milliseconds to wait for the command to complete. If timeout < 0, then
the timeout defaults to 60,000 milliseconds, but can be adjusted by changing the
'Request Timeout' resource attribute.notifier
- if not null, the notifier will be called asynchronously with the contents of
each page returned by the host in response to the command.
java.lang.Exception
- if cmd was not completed before timeout, or an interruption occurredpublic java.lang.String doCmd(java.lang.String cmd, java.lang.String prompt, java.lang.String morePrompt, java.lang.String displayCmd, java.util.List stringsToHide, int timeout, ScreenNotifier notifier) throws java.lang.Exception
Before the command is sent sent to the host, a [clear] key is first sent.
cmd
- the command to send. Note that cmd must contain the [enter] mnemonic.prompt
- the string in the command response which indicates the final end of the response (e.g. " ?")morePrompt
- the string expected in the command response which indicates the end of a page (e.g. " ***")displayCmd
- If not null, this is command that will be sent to logs and/or exceptions. If not null, make sure
no passwords are embedded in this string.stringsToHide
- if displayCmd is null, then displayCmd is calculated by calling
getDisplayableCommand(cmd, stringsToHide). If displayCmd argument is not
null, then this argument is ignored.timeout
- the number of milliseconds to wait for the command to complete. If timeout < 0, then
the timeout defaults to 60,000 milliseconds, but can be adjusted by changing the
'Request Timeout' resource attribute.notifier
- if not null, the notifier will be called asynchronously with the contents of
each page returned by the host in response to the command.
java.lang.Exception
- if cmd was not completed before timeout, or an interruption occurredpublic void PSNotifyError(com.ibm.eNetwork.ECL.ECLPS ps, com.ibm.eNetwork.ECL.ECLErr err)
PSNotifyError
in interface com.ibm.eNetwork.ECL.event.ECLPSListener
protected int searchBackwards(com.ibm.eNetwork.ECL.ECLPS ps, java.lang.String str) throws com.ibm.eNetwork.ECL.ECLErr
ps
- host presentation space to searchstr
- the string to search for
com.ibm.eNetwork.ECL.ECLErr
public void PSNotifyEvent(com.ibm.eNetwork.ECL.event.ECLPSEvent evt)
PSNotifyEvent
in interface com.ibm.eNetwork.ECL.event.ECLPSListener
public void PSNotifyStop(com.ibm.eNetwork.ECL.ECLPS ps, int reason)
PSNotifyStop
in interface com.ibm.eNetwork.ECL.event.ECLPSListener
public void NotifyEvent(com.ibm.eNetwork.ECL.ECLConnection connection, boolean connected)
NotifyEvent
in interface com.ibm.eNetwork.ECL.ECLCommNotify
public void NotifyStop(com.ibm.eNetwork.ECL.ECLConnection connection, int reason)
NotifyStop
in interface com.ibm.eNetwork.ECL.ECLCommNotify
public void NotifyError(com.ibm.eNetwork.ECL.ECLConnection connection, com.ibm.eNetwork.ECL.ECLErr e)
NotifyError
in interface com.ibm.eNetwork.ECL.ECLCommNotify
public void traceString(java.lang.String s)
s
- The string to output to the trace log.protected void trace(java.lang.String s)
s
- The string to output to the trace log.public static java.util.Properties retrieveProperties(Resource resource)
Typically called from the HostAccessLogin.getProperties() interface method implementation for a resource adapter, so it can support the standard way of exposing the setting of these properties.
The set of resource attributes read by this method are:
For example:
SESSION_TRACE
ECLSession=3 ECLPS=3 ECLCommEvent=3
protected static java.lang.String getDisplayableCommand(java.lang.String command, java.util.List stringsToHide)
command
- string to be transformed to hide passwords and other sensitive datastringsToHide
- a list of strings that need to be hidden in command
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |