Search in sources :

Example 1 with BridgeCmdSharedReplyData

use of com.sun.messaging.bridge.api.BridgeCmdSharedReplyData in project openmq by eclipse-ee4j.

the class BridgeImpl method list.

/**
 * List the bridge
 *
 * @param bc the bridge context
 * @param args list parameters
 * @param rb ResourceBundle to get String resources for data
 *
 * @throws Exception if unable to stop the bridge
 */
@Override
public ArrayList<BridgeCmdSharedReplyData> list(BridgeContext bc, String[] args, ResourceBundle rb) throws Exception {
    JMSBridge jb = getJMSBridge();
    if (jb == null) {
        throw new IllegalStateException(JMSBridge.getJMSBridgeResources().getKString(JMSBridge.getJMSBridgeResources().X_BRIDGE_NOT_INITED, getName()));
    }
    ArrayList<BridgeCmdSharedReplyData> replys = new ArrayList<>();
    BridgeCmdSharedReplyData reply = new BridgeCmdSharedReplyData(4, 3, "-");
    String[] oneRow = new String[4];
    oneRow[0] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_BRIDGE_NAME);
    oneRow[1] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_BRIDGE_TYPE);
    oneRow[2] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_BRIDGE_STATE);
    oneRow[3] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_NUM_LINKS);
    reply.addTitle(oneRow);
    oneRow[0] = getName();
    oneRow[1] = getType();
    oneRow[2] = getState().toString(rb);
    oneRow[3] = String.valueOf(jb.getNumLinks());
    reply.add(oneRow);
    replys.add(reply);
    String linkName = parseLinkName(args);
    boolean debugMode = parseDebugModeArg(args);
    ArrayList<BridgeCmdSharedReplyData> rep = jb.list(linkName, rb, debugMode);
    replys.addAll(rep);
    return replys;
}
Also used : ArrayList(java.util.ArrayList) BridgeCmdSharedReplyData(com.sun.messaging.bridge.api.BridgeCmdSharedReplyData)

Example 2 with BridgeCmdSharedReplyData

use of com.sun.messaging.bridge.api.BridgeCmdSharedReplyData in project openmq by eclipse-ee4j.

the class BridgeServiceManagerImpl method listBridge.

public synchronized ArrayList<BridgeCmdSharedReplyData> listBridge(String name, String[] args, String type, BridgeManagerResources bmr) throws Exception {
    if (type != null && !type.equals(Bridge.JMS_TYPE) && !type.equals(Bridge.STOMP_TYPE)) {
        throw new IllegalArgumentException(_bmr.getString(_bmr.X_BRIDGE_INVALID_TYPE, type));
    }
    if (name == null) {
        _bc.logDebug("Listing all bridges (type=" + type + ")", null);
        BridgeCmdSharedReplyData reply = new BridgeCmdSharedReplyData(3, 4, "-");
        String[] oneRow = new String[3];
        oneRow[0] = bmr.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_BRIDGE_NAME);
        oneRow[1] = bmr.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_BRIDGE_TYPE);
        oneRow[2] = bmr.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_BRIDGE_STATE);
        reply.addTitle(oneRow);
        Bridge b = null;
        for (Map.Entry<String, Bridge> pair : _bridges.entrySet()) {
            b = pair.getValue();
            if (type != null && !b.getType().equals(type)) {
                continue;
            }
            oneRow[0] = b.getName();
            oneRow[1] = b.getType();
            oneRow[2] = b.getState().toString(bmr);
            reply.add(oneRow);
        }
        _bc.logDebug("Listed all bridges (type=" + type + ")", null);
        ArrayList<BridgeCmdSharedReplyData> replys = new ArrayList<>();
        replys.add(reply);
        return replys;
    }
    if (args == null) {
        _bc.logInfo(_bmr.getString(_bmr.I_LISTING_BRIDGE, name), null);
    } else {
        _bc.logInfo(_bmr.getString(_bmr.I_LISTING_BRIDGE_WITH, name, BridgeUtil.toString(args)), null);
    }
    Bridge b = _bridges.get(name);
    if (b == null) {
        String emsg = _bmr.getKString(_bmr.X_BRIDGE_NAME_NOT_FOUND, name);
        _bc.logError(emsg, null);
        throw new BridgeException(emsg);
    }
    BridgeContext bc = new BridgeContextImpl(_bc, b.getName());
    return b.list(bc, args, bmr);
}
Also used : BridgeException(com.sun.messaging.bridge.api.BridgeException) ArrayList(java.util.ArrayList) BridgeContext(com.sun.messaging.bridge.api.BridgeContext) BridgeCmdSharedReplyData(com.sun.messaging.bridge.api.BridgeCmdSharedReplyData) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Bridge(com.sun.messaging.bridge.api.Bridge)

Example 3 with BridgeCmdSharedReplyData

use of com.sun.messaging.bridge.api.BridgeCmdSharedReplyData in project openmq by eclipse-ee4j.

the class CmdRunner method runCommand.

private int runCommand(BridgeMgrProperties bridgeMgrProps) {
    BridgeAdmin broker;
    String input = null;
    String yes, yesShort, no, noShort;
    yes = ar.getString(ar.Q_RESPONSE_YES);
    yesShort = ar.getString(ar.Q_RESPONSE_YES_SHORT);
    no = ar.getString(ar.Q_RESPONSE_NO);
    noShort = ar.getString(ar.Q_RESPONSE_NO_SHORT);
    broker = init();
    boolean force = bridgeMgrProps.forceModeSet();
    // Check for the target argument
    String cmd = bridgeMgrProps.getCommand();
    String commandArg = bridgeMgrProps.getCommandArg();
    String bn = bridgeMgrProps.getBridgeName();
    String bt = bridgeMgrProps.getBridgeType();
    String ln = bridgeMgrProps.getLinkName();
    boolean debugMode = bridgeMgrProps.debugModeSet();
    if (debugMode && cmd.equals(Cmd.DEBUG)) {
        if (broker == null) {
            Globals.stdErrPrintln("Problem connecting to the broker");
            return (1);
        }
        if (!force) {
            broker = (BridgeAdmin) CommonCmdRunnerUtil.promptForAuthentication(broker);
        }
        String target = bridgeMgrProps.getTargetName();
        Properties optionalProps = bridgeMgrProps.getTargetAttrs();
        Globals.stdOutPrintln("Sending the following DEBUG message:");
        if (target != null) {
            BridgeMgrPrinter bmp = new BridgeMgrPrinter(2, 4, null, BridgeMgrPrinter.LEFT, false);
            String[] row = new String[2];
            row[0] = commandArg;
            row[1] = target;
            bmp.add(row);
            bmp.println();
        } else {
            BridgeMgrPrinter bmp = new BridgeMgrPrinter(1, 4, null, BridgeMgrPrinter.LEFT, false);
            String[] row = new String[1];
            row[0] = commandArg;
            bmp.add(row);
            bmp.println();
        }
        if ((optionalProps != null) && (optionalProps.size() > 0)) {
            Globals.stdOutPrintln("Optional properties:");
            CommonCmdRunnerUtil.printAttrs(optionalProps, true, new BridgeMgrPrinter());
        }
        Globals.stdOutPrintln("To the broker specified by:");
        printBrokerInfo(broker);
        try {
            connectToBroker(broker);
            broker.sendDebugMessage(commandArg, target, optionalProps);
            Hashtable debugHash = broker.receiveDebugReplyMessage();
            if (debugHash != null && !debugHash.isEmpty()) {
                Globals.stdOutPrintln("Data received back from broker:");
                CommonCmdRunnerUtil.printDebugHash(debugHash);
            } else {
                Globals.stdOutPrintln("No additional data received back from broker.\n");
            }
            Globals.stdOutPrintln("DEBUG message sent successfully.");
        } catch (BrokerAdminException bae) {
            handleBrokerAdminException(bae);
            return (1);
        }
    } else if (CmdArg.BRIDGE.equals(commandArg)) {
        if (broker == null) {
            Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_BRIDGE_CMD_FAIL, getLocalizedCmd(cmd)));
            return (1);
        }
        if (!force) {
            broker = (BridgeAdmin) CommonCmdRunnerUtil.promptForAuthentication(broker);
        }
        boolean single = false;
        boolean startRet = true;
        if ((bn == null) || (bn.trim().equals(""))) {
            if ((bt == null) || (bt.trim().equals(""))) {
                Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_ALL_BRIDGES_CMD_ON_BKR, getLocalizedCmd(cmd)));
            } else {
                Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_ALL_TYPE_BRIDGES_CMD, getLocalizedCmd(cmd)));
                printBridgeInfo(false);
                Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_SPECIFY_BKR));
            }
        } else {
            Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGE_CMD, getLocalizedCmd(cmd)));
            printBridgeInfo();
            Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_SPECIFY_BKR));
            single = true;
        }
        printBrokerInfo(broker);
        try {
            connectToBroker(broker);
        } catch (BrokerAdminException bae) {
            handleBrokerAdminException(bae);
            if (single) {
                Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_BRIDGE_CMD_FAIL, getLocalizedCmd(cmd)));
            } else {
                Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_BRIDGES_CMD_FAIL, getLocalizedCmd(cmd)));
            }
            return (1);
        }
        if (cmd.equals(Cmd.LIST)) {
            force = true;
        }
        if (!force) {
            input = getUserInput(ar.getString(ar.Q_BRIDGE_CMD_OK, getLocalizedCmd(cmd)), noShort);
            Globals.stdOutPrintln("");
        }
        if (yesShort.equalsIgnoreCase(input) || yes.equalsIgnoreCase(input) || force) {
            try {
                if (cmd.equals(Cmd.LIST)) {
                    broker.sendCommandMessage(bn, bt, null, 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();
                        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(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(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(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(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, getLocalizedCmd(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, getLocalizedCmd(cmd)));
                    }
                }
            } catch (BrokerAdminException bae) {
                handleBrokerAdminException(bae);
                if (single) {
                    Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_BRIDGE_CMD_FAIL, getLocalizedCmd(cmd)));
                } else {
                    Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_BRIDGES_CMD_FAIL, getLocalizedCmd(cmd)));
                }
                return (1);
            }
        } else if (noShort.equalsIgnoreCase(input) || no.equalsIgnoreCase(input)) {
            if (single) {
                Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGE_CMD_NOOP, getLocalizedCmd(cmd)));
            } else {
                Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGES_CMD_NOOP, getLocalizedCmd(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, getLocalizedCmd(cmd)));
            } else {
                Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_BRIDGES_CMD_NOOP, getLocalizedCmd(cmd)));
            }
            return (1);
        }
    } else if (CmdArg.LINK.equals(commandArg)) {
        if (broker == null) {
            Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_LINK_CMD_FAIL, getLocalizedCmd(cmd)));
            return (1);
        }
        if (!force) {
            broker = (BridgeAdmin) CommonCmdRunnerUtil.promptForAuthentication(broker);
        }
        Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_LINK_CMD, getLocalizedCmd(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, getLocalizedCmd(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(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();
                    }
                } else if (cmd.equals(Cmd.START)) {
                    broker.sendCommandMessage(cmd, bn, bt, ln, AdminMessageType.Type.START, "START", BridgeMgrStatusEvent.Type.START, AdminMessageType.Type.START_REPLY, "START_REPLY");
                    startRet = broker.receiveCommandReplyMessage(AdminMessageType.Type.START_REPLY, "START_REPLY");
                } else if (cmd.equals(Cmd.STOP)) {
                    broker.sendCommandMessage(cmd, bn, bt, ln, AdminMessageType.Type.STOP, "STOP", BridgeMgrStatusEvent.Type.STOP, AdminMessageType.Type.STOP_REPLY, "STOP_REPLY");
                    broker.receiveCommandReplyMessage(AdminMessageType.Type.STOP_REPLY, "STOP_REPLY");
                } else if (cmd.equals(Cmd.RESUME)) {
                    broker.sendCommandMessage(cmd, bn, bt, ln, AdminMessageType.Type.RESUME, "RESUME", BridgeMgrStatusEvent.Type.RESUME, AdminMessageType.Type.RESUME_REPLY, "RESUME_REPLY");
                    broker.receiveCommandReplyMessage(AdminMessageType.Type.RESUME_REPLY, "RESUME_REPLY");
                } else if (cmd.equals(Cmd.PAUSE)) {
                    broker.sendCommandMessage(cmd, bn, bt, ln, AdminMessageType.Type.PAUSE, "PAUSE", BridgeMgrStatusEvent.Type.PAUSE, AdminMessageType.Type.PAUSE_REPLY, "PAUSE_REPLY");
                    broker.receiveCommandReplyMessage(AdminMessageType.Type.PAUSE_REPLY, "PAUSE_REPLY");
                } else {
                    return 1;
                }
                if (cmd.equals(Cmd.START) && !startRet) {
                    Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_LINK_ASYNC_STARTED));
                } else {
                    Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_LINK_CMD_SUC, getLocalizedCmd(cmd)));
                }
            } catch (BrokerAdminException bae) {
                handleBrokerAdminException(bae);
                Globals.stdErrPrintln(ar.getString(ar.I_BGMGR_LINK_CMD_FAIL, getLocalizedCmd(cmd)));
                return (1);
            }
        } else if (noShort.equalsIgnoreCase(input) || no.equalsIgnoreCase(input)) {
            Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_LINK_CMD_NOOP, getLocalizedCmd(cmd)));
            return (0);
        } else {
            Globals.stdOutPrintln(ar.getString(ar.I_UNRECOGNIZED_RES, input));
            Globals.stdOutPrintln("");
            Globals.stdOutPrintln(ar.getString(ar.I_BGMGR_LINK_CMD_NOOP, getLocalizedCmd(cmd)));
            return (1);
        }
    }
    broker.close();
    return (0);
}
Also used : BrokerAdminException(com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) Properties(java.util.Properties) Iterator(java.util.Iterator) BridgeCmdSharedReplyData(com.sun.messaging.bridge.api.BridgeCmdSharedReplyData)

Example 4 with BridgeCmdSharedReplyData

use of com.sun.messaging.bridge.api.BridgeCmdSharedReplyData in project openmq by eclipse-ee4j.

the class JMSBridge method list.

public ArrayList<BridgeCmdSharedReplyData> list(String linkName, ResourceBundle rb, boolean all) throws Exception {
    ArrayList<BridgeCmdSharedReplyData> replys = new ArrayList<>();
    BridgeCmdSharedReplyData reply = new BridgeCmdSharedReplyData(5, 3, "-");
    String[] oneRow = new String[5];
    oneRow[0] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_LINK_NAME);
    oneRow[1] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_LINK_STATE);
    oneRow[2] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_SOURCE);
    oneRow[3] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_TARGET);
    oneRow[4] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_TRANSACTED);
    reply.addTitle(oneRow);
    Link l = null;
    if (linkName != null) {
        l = _links.get(linkName);
        if (l == null || !l.isEnabled()) {
            throw new IllegalArgumentException(_jbr.getKString(_jbr.X_LINK_NOT_FOUND, linkName, _name));
        }
        oneRow[0] = l.getName();
        oneRow[1] = l.getState().toString();
        oneRow[2] = l.getSourceString();
        oneRow[3] = l.getTargetString();
        oneRow[4] = String.valueOf(l.isTransacted());
        reply.add(oneRow);
        replys.add(reply);
        if (!all) {
            return replys;
        }
        if (l.isTransacted()) {
            BridgeCmdSharedReplyData rep = new BridgeCmdSharedReplyData(1, 3, "-");
            String[] toneRow = new String[1];
            toneRow[0] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_TRANSACTIONS);
            rep.addTitle(toneRow);
            if (_tma != null) {
                try {
                    String[] txns = _tma.getAllTransactions();
                    if (txns != null) {
                        for (int i = 0; i < txns.length; i++) {
                            toneRow[0] = txns[i];
                            rep.add(toneRow);
                        }
                    }
                } catch (Exception e) {
                    _logger.log(Level.WARNING, _jbr.getKString(_jbr.W_FAILED_GET_ALL_TXNS, _name));
                }
            }
            replys.add(rep);
        }
        return replys;
    }
    Link[] ls = null;
    synchronized (_links) {
        ls = _links.values().toArray(new Link[_links.size()]);
    }
    for (int i = 0; i < ls.length; i++) {
        l = ls[i];
        if (!l.isEnabled()) {
            continue;
        }
        oneRow[0] = l.getName();
        oneRow[1] = l.getState().toString();
        oneRow[2] = l.getSourceString();
        oneRow[3] = l.getTargetString();
        oneRow[4] = String.valueOf(l.isTransacted());
        reply.add(oneRow);
    }
    replys.add(reply);
    if (!all) {
        return replys;
    }
    BridgeCmdSharedReplyData pcfreply = new BridgeCmdSharedReplyData(7, 3, "-", BridgeCmdSharedReplyData.CENTER);
    pcfreply.setTitleAlign(BridgeCmdSharedReplyData.CENTER);
    String[] poneRow = new String[7];
    poneRow[0] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_POOLED);
    poneRow[1] = "XA";
    poneRow[2] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_NUM_INUSE);
    poneRow[3] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_NUM_IDLE);
    poneRow[4] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_IDLE);
    poneRow[5] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_MAX);
    poneRow[6] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_RETRY);
    pcfreply.addTitle(poneRow);
    poneRow[0] = "ConnectionFactory";
    poneRow[1] = "";
    poneRow[2] = "";
    poneRow[3] = "";
    poneRow[4] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_TIMEOUT);
    poneRow[5] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_RETRIES);
    poneRow[6] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_INTERVAL);
    pcfreply.addTitle(poneRow);
    BridgeCmdSharedReplyData scfreply = new BridgeCmdSharedReplyData(6, 3, "-", BridgeCmdSharedReplyData.CENTER);
    scfreply.setTitleAlign(BridgeCmdSharedReplyData.CENTER);
    String[] soneRow = new String[6];
    soneRow[0] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_SHARED);
    soneRow[1] = "XA";
    soneRow[2] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_REF);
    soneRow[3] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_IDLE);
    soneRow[4] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_MAX);
    soneRow[5] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_RETRY);
    scfreply.addTitle(soneRow);
    soneRow[0] = "ConnectionFactory";
    soneRow[1] = "";
    soneRow[2] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_COUNT);
    soneRow[3] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_TIMEOUT);
    soneRow[4] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_RETRIES);
    soneRow[5] = rb.getString(BridgeCmdSharedResources.I_BGMGR_TITLE_INTERVAL);
    scfreply.addTitle(soneRow);
    Object[] spcfs = null;
    synchronized (_spcfs) {
        spcfs = _spcfs.values().toArray();
    }
    PooledConnectionFactory pcf = null;
    SharedConnectionFactory scf = null;
    for (int i = 0; i < spcfs.length; i++) {
        if (spcfs[i] instanceof PooledConnectionFactory) {
            pcf = (PooledConnectionFactory) spcfs[i];
            poneRow[0] = ((Refable) pcf.getCF()).getRef();
            poneRow[1] = String.valueOf(pcf.getCF() instanceof XAConnectionFactory);
            poneRow[2] = String.valueOf(pcf.getNumInUseConns());
            poneRow[3] = String.valueOf(pcf.getNumIdleConns());
            poneRow[4] = String.valueOf(pcf.getIdleTimeout());
            poneRow[5] = String.valueOf(pcf.getMaxRetries());
            poneRow[6] = String.valueOf(pcf.getRetryInterval());
            pcfreply.add(poneRow);
        } else if (spcfs[i] instanceof SharedConnectionFactory) {
            scf = (SharedConnectionFactory) spcfs[i];
            soneRow[0] = ((Refable) scf.getCF()).getRef();
            soneRow[1] = String.valueOf(scf.getCF() instanceof XAConnectionFactory);
            soneRow[2] = String.valueOf(scf.getRefCount());
            soneRow[3] = String.valueOf(scf.getIdleTimeout());
            soneRow[4] = String.valueOf(scf.getMaxRetries());
            soneRow[5] = String.valueOf(scf.getRetryInterval());
            scfreply.add(soneRow);
        }
    }
    replys.add(pcfreply);
    replys.add(scfreply);
    return replys;
}
Also used : ArrayList(java.util.ArrayList) JMSException(jakarta.jms.JMSException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) IOException(java.io.IOException) InvalidClientIDException(jakarta.jms.InvalidClientIDException) JMSSecurityException(jakarta.jms.JMSSecurityException) XAConnectionFactory(jakarta.jms.XAConnectionFactory) BridgeCmdSharedReplyData(com.sun.messaging.bridge.api.BridgeCmdSharedReplyData)

Aggregations

BridgeCmdSharedReplyData (com.sun.messaging.bridge.api.BridgeCmdSharedReplyData)4 ArrayList (java.util.ArrayList)4 Bridge (com.sun.messaging.bridge.api.Bridge)1 BridgeContext (com.sun.messaging.bridge.api.BridgeContext)1 BridgeException (com.sun.messaging.bridge.api.BridgeException)1 BrokerAdminException (com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException)1 InvalidClientIDException (jakarta.jms.InvalidClientIDException)1 JMSException (jakarta.jms.JMSException)1 JMSSecurityException (jakarta.jms.JMSSecurityException)1 XAConnectionFactory (jakarta.jms.XAConnectionFactory)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Hashtable (java.util.Hashtable)1 Iterator (java.util.Iterator)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Properties (java.util.Properties)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1