}
private void handleBrokerCmdStatusEvent(BrokerCmdStatusEvent cse) {
int type = cse.getType(),
msgType;
BrokerAdmin ba = cse.getBrokerAdmin();
boolean success = cse.getSuccess();
Exception ex = cse.getLinkedException();
String dstName = cse.getDestinationName(),
svcName = cse.getServiceName(),
clientID = cse.getClientID(),
durName = cse.getDurableName(),
bkrName = ba.getKey(),
title, msg;
DestinationInfo dstInfo = cse.getDestinationInfo();
ServiceInfo svcInfo = cse.getServiceInfo();
Object refreshObj = ba.getAssociatedObj();
if (type == BrokerCmdStatusEvent.BROKER_BUSY) {
int numRetriesAttempted = cse.getNumRetriesAttempted(),
maxNumRetries = cse.getMaxNumRetries();
long retryTimeount = cse.getRetryTimeount();
Object args[] = new Object [ 3 ];
args[0] = Integer.toString(numRetriesAttempted);
args[1] = Integer.toString(maxNumRetries);
args[2] = Long.toString(retryTimeount);
/*
* This string is of the form:
* Broker not responding, retrying [1 of 5 attempts, timeout=20 seconds]
*/
String s = ar.getString(ar.I_JMQCMD_BROKER_BUSY, args);
app.getStatusArea().appendText(s + "\n");
return;
}
/*
* Do not bring up the result dialog for
* 1. QUERY_SVC
* 2. QUERY_DST
* 3. LIST_DUR (for querying destination)
* 4. QUERY_BKR
*/
if ((type == BrokerCmdStatusEvent.QUERY_SVC) ||
(type == BrokerCmdStatusEvent.QUERY_DST) ||
(type == BrokerCmdStatusEvent.LIST_DUR) ||
(type == BrokerCmdStatusEvent.QUERY_BKR)) {
/*
* We need to refresh the console if 'connect' is successful
* but 'query broker' is not upon connecting to a broker.
*/
if (refreshObj instanceof BrokerCObj) {
app.getExplorer().nodeChanged((DefaultMutableTreeNode)refreshObj);
controller.setActions((BrokerCObj)refreshObj);
}
return;
}
/*
* Type of dialog depends on success/failure
*/
if (success) {
msgType = JOptionPane.INFORMATION_MESSAGE;
} else {
msgType = JOptionPane.ERROR_MESSAGE;
}
/*
* Dialog title reads:
* Status received from broker
*/
title = acr.getString(acr.I_STATUS_RECV);
switch (type) {
case BrokerCmdStatusEvent.HELLO:
if (success) {
msg = acr.getString(acr.S_BROKER_CONNECT, bkrName);
if (refreshObj instanceof BrokerCObj) {
BrokerCObj bCObj = (BrokerCObj)refreshObj;
/*
* Connection is considered created when the hello protocol
* handshake takes place successfully.
*/
ba.setIsConnected(true);
if (refreshBrokerServiceListCObj(bCObj.getBrokerServiceListCObj())) {
if (refreshBrokerDestListCObj(bCObj.getBrokerDestListCObj())) {
app.getExplorer().nodeChanged((DefaultMutableTreeNode)bCObj);
app.getInspector().refresh();
controller.setActions(bCObj);