BridgeMgrStatusEvent.Type.LIST,
AdminMessageType.Type.LIST_REPLY, "LIST_REPLY", debugMode);
ArrayList<BridgeCmdSharedReplyData> data = broker.receiveListReplyMessage();
Iterator<BridgeCmdSharedReplyData> itr = data.iterator();
BridgeMgrPrinter bcp = null;
BridgeCmdSharedReplyData reply = null;
while (itr.hasNext()) {
reply = itr.next();
bcp = new BridgeMgrPrinter();
bcp.copy(reply);
bcp.println();
Globals.stdOutPrintln("");
}
} else if (cmd.equals(Cmd.START)) {
broker.sendCommandMessage(cmd, bn, bt, null,
AdminMessageType.Type.START, "START",
BridgeMgrStatusEvent.Type.START,
AdminMessageType.Type.START_REPLY, "START_REPLY");
startRet = broker.receiveCommandReplyMessage(cmd, AdminMessageType.Type.START_REPLY, "START_REPLY");
} else if (cmd.equals(Cmd.STOP)) {
broker.sendCommandMessage(cmd, bn, bt, null,
AdminMessageType.Type.STOP, "STOP",
BridgeMgrStatusEvent.Type.STOP,
AdminMessageType.Type.STOP_REPLY, "STOP_REPLY");
broker.receiveCommandReplyMessage(cmd, AdminMessageType.Type.STOP_REPLY, "STOP_REPLY");
} else if (cmd.equals(Cmd.RESUME)) {
broker.sendCommandMessage(cmd, bn, bt, null,
AdminMessageType.Type.RESUME, "RESUME",
BridgeMgrStatusEvent.Type.RESUME,
AdminMessageType.Type.RESUME_REPLY, "RESUME_REPLY");
broker.receiveCommandReplyMessage(cmd, AdminMessageType.Type.RESUME_REPLY, "RESUME_REPLY");
} else if (cmd.equals(Cmd.PAUSE)) {
broker.sendCommandMessage(cmd, bn, bt, null,
AdminMessageType.Type.PAUSE, "PAUSE",
BridgeMgrStatusEvent.Type.PAUSE,
AdminMessageType.Type.PAUSE_REPLY, "PAUSE_REPLY");
broker.receiveCommandReplyMessage(cmd, AdminMessageType.Type.PAUSE_REPLY, "PAUSE_REPLY");
} else {
return 1;
}
if (single) {
if (cmd.equals(Cmd.START) && !startRet) {
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGE_ASYNC_STARTED));
} else {
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGE_CMD_SUC, getLocalizedcmded(cmd)));
}
} else {
if (cmd.equals(Cmd.START) && !startRet) {
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGES_ASYNC_STARTED));
} else {
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGES_CMD_SUC, getLocalizedcmded(cmd)));
}
}
} catch (BrokerAdminException bae) {
handleBrokerAdminException(bae);
if (single) {
Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_BRIDGE_CMD_FAIL, getLocalizedCmding(cmd)));
} else {
Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_BRIDGES_CMD_FAIL, getLocalizedCmding(cmd)));
}
return (1);
}
} else if (noShort.equalsIgnoreCase(input) || no.equalsIgnoreCase(input)) {
if (single) {
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGE_CMD_NOOP, getLocalizedcmded(cmd)));
} else {
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGES_CMD_NOOP, getLocalizedcmded(cmd)));
}
return (0);
} else {
Globals.stdOutPrintln(ar.getString(ar.I_UNRECOGNIZED_RES, input));
Globals.stdOutPrintln("");
if (single) {
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGE_CMD_NOOP, getLocalizedcmded(cmd)));
} else {
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGES_CMD_NOOP, getLocalizedcmded(cmd)));
}
return (1);
}
} else if (CmdArg.LINK.equals(commandArg)) {
if (broker == null) {
Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_LINK_CMD_FAIL, getLocalizedCmding(cmd)));
return (1);
}
if (!force) broker = (BridgeAdmin)CommonCmdRunnerUtil.promptForAuthentication(broker);
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_LINK_CMD, getLocalizedCmding(cmd)));
printLinkInfo();
Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_SPECIFY_BKR));
printBrokerInfo(broker);
try {
connectToBroker(broker);
} catch (BrokerAdminException bae) {
handleBrokerAdminException(bae);
Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_LINK_CMD_FAIL, getLocalizedCmding(cmd)));
return (1);
}
if (cmd.equals(Cmd.LIST)) {
force = true;
}
if (!force) {
input = getUserInput(ar.getString(ar.Q_LINK_CMD_OK, getLocalizedcmd(cmd)), noShort);
Globals.stdOutPrintln("");
}
boolean startRet = true;
if (yesShort.equalsIgnoreCase(input) || yes.equalsIgnoreCase(input) || force) {
try {
if (cmd.equals(Cmd.LIST)) {
broker.sendCommandMessage(cmd, bn, bt, ln,
AdminMessageType.Type.LIST, "LIST",
BridgeMgrStatusEvent.Type.LIST,
AdminMessageType.Type.LIST_REPLY, "LIST_REPLY", debugMode);
ArrayList<BridgeCmdSharedReplyData> data = broker.receiveListReplyMessage();
Iterator<BridgeCmdSharedReplyData> itr = data.iterator();
BridgeMgrPrinter bcp = null;
BridgeCmdSharedReplyData reply = null;
while (itr.hasNext()) {
reply = itr.next();
bcp = new BridgeMgrPrinter();
bcp.copy(reply);
bcp.println();