com.isti.quakewatch.util
Class QWConnectionMgr

java.lang.Object
  extended by com.isti.quakewatch.util.QWConnectionMgr
All Implemented Interfaces:
ConnectRejectCallBack, ConnLoginRejectCallBack

public class QWConnectionMgr
extends java.lang.Object
implements ConnectRejectCallBack, ConnLoginRejectCallBack

Class QWConnectionMgr manages the configuration, initialization and closing of the connection to the QuakeWatch host.


Nested Class Summary
static interface QWConnectionMgr.ConnectAttemptFailedCallBack
          Interface UpgradeInfoCallBack defines the method called after a connect attempt failed to reach the server.
static interface QWConnectionMgr.UpgradeInfoCallBack
          Interface UpgradeInfoCallBack defines the method called after an upgrade-information string has been fetched from the server.
 
Field Summary
protected  java.lang.String acceptorRejectIDString
           
protected  java.lang.String acceptorRejectReasonStr
           
protected  AddrPortListMgr altServersListMgr
           
protected  QWConnProperties cfgObj
           
protected  boolean closingFlag
           
static java.lang.String COMM_VERSION_STR
          Version number of communications code.
protected  QWConnectionMgr.ConnectAttemptFailedCallBack connAttemptFailedCallBackObj
           
protected  ConnectRejectCallBack connAttemptRejectCallBackObj
           
protected  java.lang.Object connAttFailCallBackSyncObj
           
protected  java.lang.Object connAttRejectCallBackSyncObj
           
protected  boolean connectingFlag
           
protected  java.lang.Object connectionSyncObj
           
protected  FifoHashtable connInfoPropsTableObj
           
protected  ConnStatusInterface connStatusObj
           
protected  QWDataMsgProcessor dataMsgProcObj
           
protected  boolean errorStatusPopupShownFlag
           
protected  boolean inhibitReinitFlag
           
protected  InitReqMsgsCallBack initReqMsgsCallBackObj
           
protected  java.lang.String initReqMsgsCancelString
           
protected  IstiDialogInterface initReqMsgsDialogObj
           
protected  DataChgdListenerSupport initReqMsgsDoneLstnrSupportObj
           
protected  ProgressIndicatorInterface initReqMsgsProgIndObj
           
protected  LogFile logObj
           
protected  QWMessageHandler msgHandlerObj
           
static java.lang.String NOTCONN_CLICKFDET_STR
           
protected  java.lang.String[] programArgs
           
protected  QWAbstractConnector qwConnectorObj
           
protected  java.lang.Object qwConnectorSyncObj
           
protected  boolean reinitingFlag
           
protected  DataChangedListener saveToConfigFileCallBackObj
           
protected  ServerTrackingThread serverTrackingThreadObj
           
protected  StatusCheckingThread statusCheckingThreadObj
           
protected  java.lang.String subscribeDomainTypeListStr
           
protected  boolean terminatingFlag
           
protected  QWConnectionMgr.UpgradeInfoCallBack upgradeInfoCallBackObj
           
 
Constructor Summary
QWConnectionMgr(java.lang.String[] programArgs, QWConnProperties connPropsObj, QWDataMsgProcessor dataMsgProcObj, ConnStatusInterface connStatusObj, LogFile logObj)
          Creates a connection-manager object.
QWConnectionMgr(java.lang.String[] programArgs, QWConnProperties connPropObj, QWDataMsgProcessor dataMsgProcObj, LogFile logObj)
          Creates a connection-manager object.
QWConnectionMgr(java.lang.String[] programArgs, QWDataMsgProcessor dataMsgProcObj, LogFile logObj)
          Creates a connection-manager object.
 
Method Summary
protected  void addConfigChangedListeners(DataChangedListener connCfgListener)
          Adds the given data-changed listener to the host-address, port-number, server-login and web services server configuration properties.
 void addHdlrAliveMsgListener(QWAliveMsgListener listenerObj)
          Adds the given 'QWAliveMsgListener' object (to be used by the message handler).
 void addInitReqMsgsDoneListener(DataChangedListener listenerObj)
          Adds an 'initialRequestMessagesFromServer'-done listener.
 void closeConnection()
          Closes the connection to the server.
 void closeConnection(boolean showPopupFlag, boolean waitFlag)
          Closes the connection to the server.
 void connectAttemptRejected(int connStatusVal, java.lang.String connStatusStr)
          Call-back method invoked when a connect attempt is rejected by the server.
 void connLoginAttemptRejected(java.lang.String msgStr)
          Method invoked when a connection login attempt is rejected by the server.
protected  void doCloseConnection(boolean showPopupFlag)
          Closes the connection to the server.
protected  void doReinitConnection(boolean showPopupFlag, boolean userInitFlag)
          Performs the actual work of closing and reopening the connection to the server.
protected  boolean doServerRedirectFetchAndSwitch()
          Fetches the redirect server from the currently-connected server and switches the connection to it.
 boolean equalsFirstAlternateServer(java.lang.String hostAddr, int portNum)
          Compares the given host-address/port-number to those held by the first entry in the list of alternate servers.
 java.lang.String fetchClientUpgradeInfoFromServer()
          Returns information about available client-program upgrades via the QWServices 'getClientUpgradeInfo()' method.
 void fireConnectAttemptFailedCallBack(boolean allServersFlag, boolean anyConnectedFlag)
          Invokes the connect-attempt-failed call-back method.
protected  void fireConnectAttemptRejectCallBack(int connStatusVal, java.lang.String connStatusStr)
          Invokes the connect-attempt-rejected call-back method.
 void fireConnectionStatusChanged()
          Runs the 'connectionStatusChanged()' method on the status-checking thread to get the client check-in to be performed immediately.
 void fireSaveToConfigFileCallBack()
          Invokes the call-back object setup via the 'setSaveToConfigFileCallBackObj()' method.
 boolean getAlternateServersAvailFlag()
          Returns true if alternate servers are enabled and alternate server entries are available.
 AddrPortListMgr getAltServersListMgr()
          Returns the alternate-servers list manager object.
 byte[] getCertificateFileDataArr()
          Returns the certificate-file data that was fetched from the server at connect time.
 QWConnProperties getConnProperties()
          Returns the 'QWConnProperties' object holding the connection configuration property items.
 QWDataMsgProcessor getDataMsgProcObj()
          Returns the data-message-processor object.
 int getDebugMissedMsgTestValue()
          Returns the value of the 'debugMissedMsgTestValue' parameter.
 LogFile getLogFileObj()
          Returns the log-file object held by this object.
 long getMaxServerEventAgeMs()
          Returns the value for 'maxServerEventAgeMs'.
 QWMessageHandler getMsgHandlerObj()
          Returns the message-handler object.
static java.lang.String getOpenOrbVersionStr()
          Returns the OpenORB version string.
 QWAbstractConnector getQWConnectorObj()
          Returns the QW connector object held by this object.
 java.lang.String getServerIDNameStr()
          Returns the ID name string for the currently-connected QWServer (defined in the QWServer's configuration file).
 java.lang.String getServerRevisionStr()
          Returns the revision string for the currently-connected QWServer.
protected  void indicateLoginAttemptRejected(java.lang.String msgStr)
          Indicates that the login-to-server attempt failed.
 boolean initializeConnection()
          Initializes the connection to the server.
 boolean initializeConnection(boolean initialFlag)
          Initializes the connection to the server.
 void initialRequestMessagesFromServer(boolean serverChangedFlag)
          Performs the initial request of messages from the server, via a worker thread.
protected  void invokeUpgradeInfoCallBack(java.lang.String xmlInfoStr, boolean notConnFlag)
          Invokes the call-back method used to return the upgrade-information string fetched from the server.
 boolean isConnectAttemptFailedCallBackSet()
          Determines whether or not a connect-attempt-failed call-back object has been set.
 boolean isConnectionValidated()
          Returns the status of whether or not the connection has been "validated" via the receipt of any server-alive messages.
 boolean isEventChannelConnected()
          Returns the connection status to the server event channel.
 boolean isFetchAndProcessMessagesRunning()
          Returns the status of the message handler's 'fetchAndProcessMessagesFromServer()' method.
 boolean isLastMsgFromCurrentServer()
          Determines if the server ID for the last message in storage matches the server ID for the currently-connected server.
 boolean isReqServerMsgsAvailable()
          Returns an indicator of whether or not the 'requestMessages()' method is available via the 'QWServices' on the current server.
 void performClientStatusCheck()
          Calls the QWServices 'clientStatusCheck()' method.
 void performExitCleanup()
          Performs exit-cleanup needed for a clean program exit.
 boolean reinitConnection()
          Closes and reopens the connection to the server.
 boolean reinitConnection(boolean showPopupFlag, boolean sepThreadFlag, boolean userInitFlag)
          Closes and reopens the connection to the server.
 boolean reinitConnWithAlternateServer(java.lang.String compAddrStr, int compPortNum, boolean sepThreadFlag)
          Reinitializes the connection, using an alternate server (if available).
 void removeHdlrAliveMsgListener(QWAliveMsgListener listenerObj)
          Removes the given 'QWAliveMsgListener' object (used by the message handler).
 void removeInitReqMsgsDoneListener(DataChangedListener listenerObj)
          Removes an 'initialRequestMessagesFromServer'-done listener.
 java.lang.String requestServerMessages(long timeVal, long msgNum, java.lang.String hostMsgNumListStr)
          Requests that messages newer or equal to the specified time value or later than the specified message number be returned from the server.
 void setAcceptorRejectIDStr(java.lang.String accIDStr, java.lang.String reasonStr)
          Sets the identifier for a QWServer 'Acceptor' that should be rejected when a connection attempt is made.
 void setConnectAttemptFailedCallBackObj(QWConnectionMgr.ConnectAttemptFailedCallBack callBackObj)
          Sets the connect-attempt-failed call-back object.
 void setConnectAttemptRejectCallBackObj(ConnectRejectCallBack callBackObj)
          Sets the connect-attempt-rejected call-back object.
 void setMaxServerEventAgeMs(long ageVal)
          Sets the value for the maximum age for events fetched from the server.
 void setMsgProcessingEnabledFlag(boolean flgVal)
          Sets the message-processing-enabled and check-missed-msgs-enabled flags.
 void setSaveToConfigFileCallBackObj(DataChangedListener listenerObj)
          Sets up the call-back object to be called when the connection configuration-property items should be saved to the config file.
protected  void setServerAddressPortValues(java.lang.String addrStr, int portNum, boolean inhibitFlag)
          Sets the server-address and port-number configuration properties to the given values.
 void setServerLoginPropertyEditor(java.beans.PropertyEditor propertyEditorObj)
          Enters the login-dialog property editor for the 'QWServerLoginInformation' object held by the "serverLogin" connection-property item.
 void setTerminatingFlag()
          Called to indicate that program termination is in progress.
 void setupConnInfoProps(java.lang.String clientNameStr, java.lang.String clientVerStr, java.lang.String startupTimeStr)
          Sets up the connection-information properties string to be sent when the client connects to the server.
 void setupConnInfoProps(java.lang.String clientNameStr, java.lang.String clientVerStr, java.lang.String startupTimeStr, java.lang.String distribNameStr)
          Sets up the connection-information properties string to be sent when the client connects to the server.
 void setUpgradeInfoCallBackObj(QWConnectionMgr.UpgradeInfoCallBack callBackObj)
          Sets the upgrade-information call-back object.
 void setupInitReqMsgsObjs(IstiDialogInterface initReqMsgsDialogObj, java.lang.String initReqMsgsCancelString, ProgressIndicatorInterface initReqMsgsProgIndObj, InitReqMsgsCallBack initReqMsgsCallBackObj)
          Sets up dialog, progress and call-back objects used by the 'initialRequestMessagesFromServer()' method.
 void terminateHdlrFetchAndProcessMsgs()
          Terminates any 'fetchAndProcessMessages' thread that is running via the message handler.
 void updateLastUpgradeAvailTime()
          Updates timestamp value for last time upgrade-avail call-back was called.
 void updateLoginInfoTwoWayEncFlag()
          Updates the two-way encryption flag for the current server-login-information object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMM_VERSION_STR

public static final java.lang.String COMM_VERSION_STR
Version number of communications code.

See Also:
Constant Field Values

programArgs

protected final java.lang.String[] programArgs

cfgObj

protected final QWConnProperties cfgObj

dataMsgProcObj

protected final QWDataMsgProcessor dataMsgProcObj

connStatusObj

protected final ConnStatusInterface connStatusObj

logObj

protected final LogFile logObj

qwConnectorObj

protected QWAbstractConnector qwConnectorObj

qwConnectorSyncObj

protected final java.lang.Object qwConnectorSyncObj

msgHandlerObj

protected final QWMessageHandler msgHandlerObj

connectingFlag

protected boolean connectingFlag

closingFlag

protected boolean closingFlag

reinitingFlag

protected boolean reinitingFlag

terminatingFlag

protected boolean terminatingFlag

inhibitReinitFlag

protected boolean inhibitReinitFlag

serverTrackingThreadObj

protected ServerTrackingThread serverTrackingThreadObj

connectionSyncObj

protected final java.lang.Object connectionSyncObj

saveToConfigFileCallBackObj

protected DataChangedListener saveToConfigFileCallBackObj

altServersListMgr

protected final AddrPortListMgr altServersListMgr

initReqMsgsDialogObj

protected IstiDialogInterface initReqMsgsDialogObj

initReqMsgsCancelString

protected java.lang.String initReqMsgsCancelString

initReqMsgsProgIndObj

protected ProgressIndicatorInterface initReqMsgsProgIndObj

initReqMsgsCallBackObj

protected InitReqMsgsCallBack initReqMsgsCallBackObj

initReqMsgsDoneLstnrSupportObj

protected final DataChgdListenerSupport initReqMsgsDoneLstnrSupportObj

connInfoPropsTableObj

protected final FifoHashtable connInfoPropsTableObj

subscribeDomainTypeListStr

protected java.lang.String subscribeDomainTypeListStr

statusCheckingThreadObj

protected StatusCheckingThread statusCheckingThreadObj

upgradeInfoCallBackObj

protected QWConnectionMgr.UpgradeInfoCallBack upgradeInfoCallBackObj

errorStatusPopupShownFlag

protected boolean errorStatusPopupShownFlag

connAttemptFailedCallBackObj

protected QWConnectionMgr.ConnectAttemptFailedCallBack connAttemptFailedCallBackObj

connAttFailCallBackSyncObj

protected final java.lang.Object connAttFailCallBackSyncObj

connAttemptRejectCallBackObj

protected ConnectRejectCallBack connAttemptRejectCallBackObj

connAttRejectCallBackSyncObj

protected final java.lang.Object connAttRejectCallBackSyncObj

acceptorRejectIDString

protected java.lang.String acceptorRejectIDString

acceptorRejectReasonStr

protected java.lang.String acceptorRejectReasonStr

NOTCONN_CLICKFDET_STR

public static final java.lang.String NOTCONN_CLICKFDET_STR
See Also:
Constant Field Values
Constructor Detail

QWConnectionMgr

public QWConnectionMgr(java.lang.String[] programArgs,
                       QWConnProperties connPropsObj,
                       QWDataMsgProcessor dataMsgProcObj,
                       ConnStatusInterface connStatusObj,
                       LogFile logObj)
Creates a connection-manager object.

Parameters:
programArgs - the array of command-line arguments to be passed on to the CORBA ORB.
connPropsObj - a 'QWConnProperties' object holding the configuration property items for the connection, or null to use defaults.
dataMsgProcObj - the 'QWDataMsgProcessor' object to be used, or null for none.
connStatusObj - connection-status panel object, or null for none.
logObj - log-file object to be used, or null for none.

QWConnectionMgr

public QWConnectionMgr(java.lang.String[] programArgs,
                       QWConnProperties connPropObj,
                       QWDataMsgProcessor dataMsgProcObj,
                       LogFile logObj)
Creates a connection-manager object.

Parameters:
programArgs - the array of command-line arguments to be passed on to the CORBA ORB.
connPropObj - a 'QWConnProperties' object holding the configuration property items for the connection, or null to use defaults.
dataMsgProcObj - the 'QWDataMsgProcessor' object to be used, or null for none.
logObj - log-file object to be used, or null for none.

QWConnectionMgr

public QWConnectionMgr(java.lang.String[] programArgs,
                       QWDataMsgProcessor dataMsgProcObj,
                       LogFile logObj)
Creates a connection-manager object.

Parameters:
programArgs - the array of command-line arguments to be passed on to the CORBA ORB.
dataMsgProcObj - the 'QWDataMsgProcessor' object to be used, or null for none.
logObj - log-file object to be used, or null for none.
Method Detail

setServerLoginPropertyEditor

public void setServerLoginPropertyEditor(java.beans.PropertyEditor propertyEditorObj)
Enters the login-dialog property editor for the 'QWServerLoginInformation' object held by the "serverLogin" connection-property item. GUI clients that want to be able to display the login dialog should call this method with "new LoginPropertyEditor()" as the parameter.

Parameters:
propertyEditorObj - the property-editor object to enter.

setSaveToConfigFileCallBackObj

public void setSaveToConfigFileCallBackObj(DataChangedListener listenerObj)
Sets up the call-back object to be called when the connection configuration-property items should be saved to the config file.

Parameters:
listenerObj - The 'DataChangedListener' to use, or null for none.

addConfigChangedListeners

protected final void addConfigChangedListeners(DataChangedListener connCfgListener)
Adds the given data-changed listener to the host-address, port-number, server-login and web services server configuration properties.

Parameters:
connCfgListener - the 'DataChangedListener' object to add.

setupInitReqMsgsObjs

public void setupInitReqMsgsObjs(IstiDialogInterface initReqMsgsDialogObj,
                                 java.lang.String initReqMsgsCancelString,
                                 ProgressIndicatorInterface initReqMsgsProgIndObj,
                                 InitReqMsgsCallBack initReqMsgsCallBackObj)
Sets up dialog, progress and call-back objects used by the 'initialRequestMessagesFromServer()' method.

Parameters:
initReqMsgsDialogObj - dialog-popup object.
initReqMsgsCancelString - 'Cancel' string for dialog-popup object.
initReqMsgsProgIndObj - for progress-indicator object.
initReqMsgsCallBackObj - call-back object.

setupConnInfoProps

public void setupConnInfoProps(java.lang.String clientNameStr,
                               java.lang.String clientVerStr,
                               java.lang.String startupTimeStr,
                               java.lang.String distribNameStr)
Sets up the connection-information properties string to be sent when the client connects to the server.

Parameters:
clientNameStr - the client program name to use, or null for none.
clientVerStr - the client version string to use, or null for none.
startupTimeStr - the client startup time string to use, or null for none.
distribNameStr - the distribution name to use, or null for none.

setupConnInfoProps

public void setupConnInfoProps(java.lang.String clientNameStr,
                               java.lang.String clientVerStr,
                               java.lang.String startupTimeStr)
Sets up the connection-information properties string to be sent when the client connects to the server.

Parameters:
clientNameStr - the client program name to use, or null for none.
clientVerStr - the client version string to use, or null for none.
startupTimeStr - the client startup time string to use, or null for none.

setUpgradeInfoCallBackObj

public void setUpgradeInfoCallBackObj(QWConnectionMgr.UpgradeInfoCallBack callBackObj)
Sets the upgrade-information call-back object. When client-upgrade information is available from the QWServer, it is fetched and then returned as a string via this call-back. The call-back method should return quickly.

Parameters:
callBackObj - the call-back object to use, or null for none.

setMaxServerEventAgeMs

public final void setMaxServerEventAgeMs(long ageVal)
Sets the value for the maximum age for events fetched from the server.

Parameters:
ageVal - the value for the maximum age for events fetched from the server, in milliseconds.

getMaxServerEventAgeMs

public long getMaxServerEventAgeMs()
Returns the value for 'maxServerEventAgeMs'.

Returns:
The value for 'maxServerEventAgeMs'.

initializeConnection

public boolean initializeConnection(boolean initialFlag)
Initializes the connection to the server.

Parameters:
initialFlag - true if this is the first connection to server for the program.
Returns:
true if a connect attempt was made, false if not (because of no server-locator information).

initializeConnection

public boolean initializeConnection()
Initializes the connection to the server.

Returns:
true if a connect attempt was made, false if not (because of no server-locator information).

closeConnection

public void closeConnection(boolean showPopupFlag,
                            boolean waitFlag)
Closes the connection to the server.

Parameters:
showPopupFlag - true to force the connection status popup dialog to be shown.
waitFlag - if true and a close-connection attempt is already in progress then this method waits until the attempt completes and repeats the close-connection attempt if necessary.

closeConnection

public void closeConnection()
Closes the connection to the server.


doCloseConnection

protected void doCloseConnection(boolean showPopupFlag)
Closes the connection to the server.

Parameters:
showPopupFlag - true to force the connection status popup dialog to be shown.

reinitConnection

public boolean reinitConnection(boolean showPopupFlag,
                                boolean sepThreadFlag,
                                boolean userInitFlag)
Closes and reopens the connection to the server.

Parameters:
showPopupFlag - true to force the connection status popup dialog to be shown.
sepThreadFlag - true to use a separate thread (to prevent menu item or dialog that called this from being blocked during reinitialization), false to use same thread (i.e. if called from server tracking thread).
userInitFlag - true to indicate that the connnection-reinit was signaled via user input.
Returns:
true if reinitialization attempt made, false if aborted because connect or disconnect already in progress or "inhibit" flag set.

reinitConnection

public boolean reinitConnection()
Closes and reopens the connection to the server.

Returns:
true if reinitialization attempt made, false if aborted because connect or disconnect already in progress.

doReinitConnection

protected void doReinitConnection(boolean showPopupFlag,
                                  boolean userInitFlag)
Performs the actual work of closing and reopening the connection to the server.

Parameters:
showPopupFlag - true to force the connection status popup dialog to be shown.
userInitFlag - true to indicate that the connnection-reinit was signaled via user input.

setServerAddressPortValues

protected void setServerAddressPortValues(java.lang.String addrStr,
                                          int portNum,
                                          boolean inhibitFlag)
Sets the server-address and port-number configuration properties to the given values.

Parameters:
addrStr - the server-address value to use.
portNum - the port-number value to use.
inhibitFlag - true to set "inhibit" flag so that 'reinitConnection()' will not be called.

reinitConnWithAlternateServer

public boolean reinitConnWithAlternateServer(java.lang.String compAddrStr,
                                             int compPortNum,
                                             boolean sepThreadFlag)
Reinitializes the connection, using an alternate server (if available).

Parameters:
compAddrStr - host address to compare to.
compPortNum - port number to compare to.
sepThreadFlag - true to use a separate thread (to prevent menu item or dialog that called this from being blocked during reinitialization), false to use same thread (if called from server tracking thread).
Returns:
true if the current server was switched to one other than the one specified by the given host address and port number.

fireSaveToConfigFileCallBack

public void fireSaveToConfigFileCallBack()
Invokes the call-back object setup via the 'setSaveToConfigFileCallBackObj()' method.


initialRequestMessagesFromServer

public void initialRequestMessagesFromServer(boolean serverChangedFlag)
Performs the initial request of messages from the server, via a worker thread. This method also enables message processing in the message manager (after the message request is completed).

Parameters:
serverChangedFlag - true if this is the initial fetch from a "new" server (one that was not connected to previously) and the "requestSourced...()" methods should be used.

requestServerMessages

public java.lang.String requestServerMessages(long timeVal,
                                              long msgNum,
                                              java.lang.String hostMsgNumListStr)
Requests that messages newer or equal to the specified time value or later than the specified message number be returned from the server. If a 'hostMsgNumListStr' value is not given and a non-zero message number is given and the given time value matches then messages with message numbers greater than the given message number are returned; otherwise messages newer or equal to the specified time value are returned (within a tolerance value). If a 'hostMsgNumListStr' value is given then it is used with the QWServices "requestSourced...()" methods (and any given message number is ignored).

Parameters:
timeVal - the time-generated value for message associated with the given message number, or the requested time value to be used (milliseconds since 1/1/1970).
msgNum - the message number to use, or 0 or none.
hostMsgNumListStr - a list of feeder-data-source host-name/message-number entries, or null or empty string if the "requestSourced...()" methods should not be used.
Returns:
An XML-formatted string containing the messages, or an empty string if an error occurs.

performClientStatusCheck

public void performClientStatusCheck()
                              throws java.lang.NoSuchMethodException,
                                     QWAbstractConnector.StatusCheckFailedException
Calls the QWServices 'clientStatusCheck()' method. If client-upgrade information is available, an upgrade-info call-back object has been setup (via the 'setUpgradeInfoCallBackObj()' method), the update-info call-back is enabled and enough time has elapsed since the last time it was called then the upgrade information string is fetched from the server and the upgrade-info call-back method is invoked with the information string.

Throws:
java.lang.NoSuchMethodException - if the 'clientStatusCheck()' method is not implemented on the server.
StatusCheckFailedException - if the call to 'clientStatusCheck()' failed with an exception other than 'NoSuchMethodException'.
QWAbstractConnector.StatusCheckFailedException

fetchClientUpgradeInfoFromServer

public java.lang.String fetchClientUpgradeInfoFromServer()
Returns information about available client-program upgrades via the QWServices 'getClientUpgradeInfo()' method.

Returns:
An XML-formatted string containing information about available client-program upgrades, or null if an error occurred.

invokeUpgradeInfoCallBack

protected void invokeUpgradeInfoCallBack(java.lang.String xmlInfoStr,
                                         boolean notConnFlag)
Invokes the call-back method used to return the upgrade-information string fetched from the server.

Parameters:
xmlInfoStr - XML upgrade-information string to be parsed and used.
notConnFlag - true if the client was unable to connect because its version was too old; false if not.

updateLastUpgradeAvailTime

public void updateLastUpgradeAvailTime()
Updates timestamp value for last time upgrade-avail call-back was called.


addHdlrAliveMsgListener

public void addHdlrAliveMsgListener(QWAliveMsgListener listenerObj)
Adds the given 'QWAliveMsgListener' object (to be used by the message handler). This object's method will be called when an alive message is received.

Parameters:
listenerObj - the listener object to add.

removeHdlrAliveMsgListener

public void removeHdlrAliveMsgListener(QWAliveMsgListener listenerObj)
Removes the given 'QWAliveMsgListener' object (used by the message handler).

Parameters:
listenerObj - the listener object to remove.

addInitReqMsgsDoneListener

public void addInitReqMsgsDoneListener(DataChangedListener listenerObj)
Adds an 'initialRequestMessagesFromServer'-done listener. The 'dataChanged()' method on the listener is invoked after the 'initialRequestMessagesFromServer()' method/thread has completed its work.

Parameters:
listenerObj - 'DataChangedListener' object to add.

removeInitReqMsgsDoneListener

public void removeInitReqMsgsDoneListener(DataChangedListener listenerObj)
Removes an 'initialRequestMessagesFromServer'-done listener.

Parameters:
listenerObj - 'DataChangedListener' object to remove.

setMsgProcessingEnabledFlag

public void setMsgProcessingEnabledFlag(boolean flgVal)
Sets the message-processing-enabled and check-missed-msgs-enabled flags.

Parameters:
flgVal - true specifies that queued and incoming messages should now be processed and that missed-message checking should be enabled; false specifies that incoming messages should be put into the waiting-messages queue and that missed-message checking should be disabled.

terminateHdlrFetchAndProcessMsgs

public void terminateHdlrFetchAndProcessMsgs()
Terminates any 'fetchAndProcessMessages' thread that is running via the message handler.


performExitCleanup

public void performExitCleanup()
Performs exit-cleanup needed for a clean program exit. The status-checking thread is terminated.


fireConnectionStatusChanged

public void fireConnectionStatusChanged()
Runs the 'connectionStatusChanged()' method on the status-checking thread to get the client check-in to be performed immediately. This is used by the 'QWWebSvcsConnector' module to make a client check-in happen right after a successful connect to the server.


isFetchAndProcessMessagesRunning

public boolean isFetchAndProcessMessagesRunning()
Returns the status of the message handler's 'fetchAndProcessMessagesFromServer()' method.

Returns:
true if the 'fetchAndProcessMessagesFromServer()' method's worker thread is running; false if not.

setAcceptorRejectIDStr

public void setAcceptorRejectIDStr(java.lang.String accIDStr,
                                   java.lang.String reasonStr)
Sets the identifier for a QWServer 'Acceptor' that should be rejected when a connection attempt is made. This identifier is used by the QWRelayFeeder to determine if the connected server is its own QWServer.

Parameters:
accIDStr - the QWServer 'Acceptor' identifer to use, or null for none.
reasonStr - a message string describing the reason why the QWServer 'Acceptor' should be rejected.

isEventChannelConnected

public boolean isEventChannelConnected()
Returns the connection status to the server event channel.

Returns:
true if the connection to the event channel is active, false if not.

isReqServerMsgsAvailable

public boolean isReqServerMsgsAvailable()
Returns an indicator of whether or not the 'requestMessages()' method is available via the 'QWServices' on the current server.

Returns:
true if the 'requestServerMessages()' method is available, false if not.

getCertificateFileDataArr

public byte[] getCertificateFileDataArr()
Returns the certificate-file data that was fetched from the server at connect time.

Returns:
The certificate-file data that was fetched from the server at connect time, or null if none was fetched.

isConnectionValidated

public boolean isConnectionValidated()
Returns the status of whether or not the connection has been "validated" via the receipt of any server-alive messages.

Returns:
true if any server-alive messages have been received since the last connect-to-server attempt, false if not.

getQWConnectorObj

public QWAbstractConnector getQWConnectorObj()
Returns the QW connector object held by this object.

Returns:
A 'QWAbstractConnector' object.

getServerIDNameStr

public java.lang.String getServerIDNameStr()
Returns the ID name string for the currently-connected QWServer (defined in the QWServer's configuration file).

Returns:
The server ID name string, or null if not available.

getServerRevisionStr

public java.lang.String getServerRevisionStr()
Returns the revision string for the currently-connected QWServer.

Returns:
The server revision string, or null if not available.

getMsgHandlerObj

public QWMessageHandler getMsgHandlerObj()
Returns the message-handler object.

Returns:
A 'QWMessageHandler' object.

getDataMsgProcObj

public QWDataMsgProcessor getDataMsgProcObj()
Returns the data-message-processor object.

Returns:
An object that implements the 'QWDataMsgProcessor' interface.

getAlternateServersAvailFlag

public boolean getAlternateServersAvailFlag()
Returns true if alternate servers are enabled and alternate server entries are available.

Returns:
true if alternate servers are enabled and alternate server entries are available, false if not.

getAltServersListMgr

public AddrPortListMgr getAltServersListMgr()
Returns the alternate-servers list manager object.

Returns:
A 'AddrPortListMgr' object.

setTerminatingFlag

public void setTerminatingFlag()
Called to indicate that program termination is in progress.


getConnProperties

public QWConnProperties getConnProperties()
Returns the 'QWConnProperties' object holding the connection configuration property items.

Returns:
The 'QWConnProperties' object holding the connection configuration property items.

getDebugMissedMsgTestValue

public int getDebugMissedMsgTestValue()
Returns the value of the 'debugMissedMsgTestValue' parameter. If this parameter is non-zero then all except 1 out of every 'debugMissedMsgTestValue' messages will be ignored. This is used to debug-test the detect-missed-messages mechanism.

Returns:
The value of the 'debugMissedMsgTestValue' parameter.

getLogFileObj

public LogFile getLogFileObj()
Returns the log-file object held by this object.

Returns:
A 'LogFile' object.

getOpenOrbVersionStr

public static java.lang.String getOpenOrbVersionStr()
Returns the OpenORB version string.

Returns:
The OpenORB version string.

connectAttemptRejected

public void connectAttemptRejected(int connStatusVal,
                                   java.lang.String connStatusStr)
Call-back method invoked when a connect attempt is rejected by the server. This method implements the 'ConnectRejectCallBack' interface.

Specified by:
connectAttemptRejected in interface ConnectRejectCallBack
Parameters:
connStatusVal - a value indicating the status of the current connection to the server, one of the 'QWServices.CS_' values.
connStatusStr - a message-string describing the status of the current connection to the server.

connLoginAttemptRejected

public void connLoginAttemptRejected(java.lang.String msgStr)
Method invoked when a connection login attempt is rejected by the server. This method implements the 'ConnLoginRejectCallBack' interface.

Specified by:
connLoginAttemptRejected in interface ConnLoginRejectCallBack
Parameters:
msgStr - a message-string describing the status of the current connection to the server.

indicateLoginAttemptRejected

protected void indicateLoginAttemptRejected(java.lang.String msgStr)
Indicates that the login-to-server attempt failed. If a 'LoginPropertyEditor' object was entered via the server-login-info object's 'setPropertyEditor()' method then the login dialog will be shown.

Parameters:
msgStr - a descriptive error message string.

doServerRedirectFetchAndSwitch

protected boolean doServerRedirectFetchAndSwitch()
Fetches the redirect server from the currently-connected server and switches the connection to it.

Returns:
true if a redirect-server entry was successfully fetched and processed; false if not.

equalsFirstAlternateServer

public boolean equalsFirstAlternateServer(java.lang.String hostAddr,
                                          int portNum)
Compares the given host-address/port-number to those held by the first entry in the list of alternate servers.

Parameters:
hostAddr - the host address to use.
portNum - the port number to use.
Returns:
true if the given host-address/port-number equals the host address string and port number fields held by the first entry in the list of alternate servers; false if not.

setConnectAttemptFailedCallBackObj

public void setConnectAttemptFailedCallBackObj(QWConnectionMgr.ConnectAttemptFailedCallBack callBackObj)
Sets the connect-attempt-failed call-back object. The call-back method will be invoked when a connect attempt fails to reach the server. The next connect attempt will not begin until the call-back method returns.

Parameters:
callBackObj - the call-back object to use, or null for none.

isConnectAttemptFailedCallBackSet

public boolean isConnectAttemptFailedCallBackSet()
Determines whether or not a connect-attempt-failed call-back object has been set. The call-back is set via the method 'setConnectAttemptFailedCallBackObj()'.

Returns:
true if a connect-attempt-failed call-back object has been set; false if not.

isLastMsgFromCurrentServer

public boolean isLastMsgFromCurrentServer()
Determines if the server ID for the last message in storage matches the server ID for the currently-connected server.

Returns:
true if the server ID for the last message in storage matches the server ID for the currently-connected server; false if not or if the server ID(s) could not be fetched.

fireConnectAttemptFailedCallBack

public void fireConnectAttemptFailedCallBack(boolean allServersFlag,
                                             boolean anyConnectedFlag)
Invokes the connect-attempt-failed call-back method. This is done after a connect attempt failed to reach the server. The call-back is set via the method 'setConnectAttemptFailedCallBackObj()'. The next connect attempt will not begin until the call-back method returns.

Parameters:
allServersFlag - true if connections to all servers have been tried and have failed at least once.
anyConnectedFlag - true if any previous connection-attempts have been successful.

setConnectAttemptRejectCallBackObj

public void setConnectAttemptRejectCallBackObj(ConnectRejectCallBack callBackObj)
Sets the connect-attempt-rejected call-back object. The call-back method will be invoked when a connect attempt reaches the server but is rejected because of obsolete version, invalid login, or some other error.

Parameters:
callBackObj - the call-back object to use, or null for none.

fireConnectAttemptRejectCallBack

protected void fireConnectAttemptRejectCallBack(int connStatusVal,
                                                java.lang.String connStatusStr)
Invokes the connect-attempt-rejected call-back method. This is done after a connect attempt reaches the server but is rejected because of obsolete version, invalid login, or some other error. The call-back is set via the method 'setConnectAttemptRejectCallBackObj()'.

Parameters:
connStatusVal - a value indicating the status of the current connection to the server, one of the 'QWServices.CS_' values.
connStatusStr - a message-string describing the status of the current connection to the server.

updateLoginInfoTwoWayEncFlag

public void updateLoginInfoTwoWayEncFlag()
Updates the two-way encryption flag for the current server-login-information object.