Search in sources :

Example 6 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method doPurgeDurable.

private void doPurgeDurable(BrokerAdminEvent bae, ConsoleObj selObj) {
    BrokerDestCObj bDestCObj;
    BrokerAdmin ba;
    String durableName = null;
    String clientID = null;
    if (!(selObj instanceof BrokerDestCObj)) {
        /*
             * REMINDER: Need to flag this error ?
             */
        return;
    }
    bDestCObj = (BrokerDestCObj) selObj;
    ba = bDestCObj.getBrokerAdmin();
    /*
         * Broker may take more time to complete the task than the specified timeout value. This value is used when refreshing
         * the console in such cases.
         */
    if (!ba.isBusy()) {
        ba.setAssociatedObj(bDestCObj);
    }
    durableName = bae.getDurableName();
    clientID = bae.getClientID();
    int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_BROKER_PURGE_DUR, durableName, "" + clientID), acr.getString(acr.I_PURGE_DURABLE), JOptionPane.YES_NO_OPTION);
    if (result == JOptionPane.NO_OPTION) {
        return;
    }
    try {
        ba.sendPurgeDurableMessage(durableName, clientID);
        ba.receivePurgeDurableReplyMessage();
        app.getStatusArea().appendText(acr.getString(acr.S_BROKER_PURGE_DUR, BrokerAdminUtil.getDSubLogString(clientID, durableName)));
    } catch (BrokerAdminException baex) {
        JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_BROKER_PURGE_DUR, BrokerAdminUtil.getDSubLogString(clientID, durableName)) + printBrokerAdminExceptionDetails(baex), acr.getString(acr.I_DELETE_DURABLE) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_BROKER_PURGE_DUR), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
        return;
    }
    /*
         * Refresh the durable subscription table.
         */
    refreshBrokerDestCObj(bDestCObj, bae.getType());
    Vector durables = bDestCObj.getDurables();
    if (durables != null) {
        brokerDestPropsDialog.refresh(durables);
    }
}
Also used : BrokerAdminException(com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException) BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) Vector(java.util.Vector)

Example 7 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method doResumeBroker.

private void doResumeBroker(BrokerCObj bCObj) {
    BrokerAdmin ba = bCObj.getBrokerAdmin();
    int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_BROKER_RESUME, ba.getKey()), acr.getString(acr.I_RESUME_BROKER), JOptionPane.YES_NO_OPTION);
    if (result == JOptionPane.NO_OPTION) {
        return;
    }
    /*
         * Broker may take more time to complete the task than the specified timeout value. This value is used when refreshing
         * the console in such cases.
         */
    if (!ba.isBusy()) {
        ba.setAssociatedObj(bCObj);
    }
    if (resumeBroker(ba)) {
        Enumeration e = bCObj.children();
        BrokerServiceListCObj bSvclCObj = null;
        while (e.hasMoreElements()) {
            ConsoleObj cObj = (ConsoleObj) e.nextElement();
            if (cObj instanceof BrokerServiceListCObj) {
                bSvclCObj = (BrokerServiceListCObj) cObj;
            }
        }
        Vector svcs = queryAllServiceInfo(ba);
        if (svcs != null) {
            updateAllServiceInfo(bSvclCObj, svcs);
            // Update menu items, buttons.
            controller.setActions(bCObj);
            app.getInspector().refresh();
        }
    }
}
Also used : BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) Enumeration(java.util.Enumeration) Vector(java.util.Vector)

Example 8 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method loadBrokerList.

/*
     * Load broker list from property file. See ConsoleBrokerAdminManager and BrokerListProperties for details on the actual
     * file loading.
     */
private void loadBrokerList() {
    ConsoleBrokerAdminManager baMgr = app.getBrokerListCObj().getBrokerAdminManager();
    try {
        baMgr.setFileName(BROKERLIST_FILENAME);
        baMgr.readBrokerAdminsFromFile();
    } catch (Exception ex) {
        String errStr = acr.getString(acr.E_LOAD_BKR_LIST) + ex.getMessage();
        /*
             * Show popup to indicate that the loading failed.
             */
        JOptionPane.showOptionDialog(app.getFrame(), errStr, acr.getString(acr.I_LOAD_BKR_LIST) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_LOAD_BKR_LIST), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
    /*
             * At this point, should we make sure the ConsoleBrokerAdminManager contains no obj stores ?
             */
    }
    Vector v = baMgr.getBrokerAdmins();
    for (int i = 0; i < v.size(); i++) {
        BrokerAdmin ba = (BrokerAdmin) v.get(i);
        ConsoleObj brokerCObj = new BrokerCObj(ba);
        /*
             * Add code to populate broker node here if connected
             */
        app.getExplorer().addBroker(brokerCObj);
    }
    app.getInspector().refresh();
}
Also used : BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) Vector(java.util.Vector) BrokerAdminException(com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException)

Example 9 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method doPurgeDestination.

private void doPurgeDestination(BrokerDestCObj bDestCObj) {
    BrokerAdmin ba = bDestCObj.getBrokerAdmin();
    DestinationInfo destInfo = bDestCObj.getDestinationInfo();
    int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_BROKER_PURGE_DEST, destInfo.name, ba.getKey()), acr.getString(acr.I_PURGE_MESSAGES), JOptionPane.YES_NO_OPTION);
    if (result == JOptionPane.NO_OPTION) {
        return;
    }
    if (!purgeDestination(ba, destInfo.name, destInfo.type)) {
        return;
    }
    destInfo = queryDestinationInfo(ba, destInfo.name, destInfo.type);
    if (destInfo != null) {
        bDestCObj.setDestinationInfo(destInfo);
        app.getInspector().selectedObjectUpdated();
    }
}
Also used : BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo)

Example 10 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method doPauseBroker.

private void doPauseBroker(BrokerCObj bCObj) {
    BrokerAdmin ba = bCObj.getBrokerAdmin();
    int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_BROKER_PAUSE, ba.getKey()), acr.getString(acr.I_PAUSE_BROKER), JOptionPane.YES_NO_OPTION);
    if (result == JOptionPane.NO_OPTION) {
        return;
    }
    /*
         * Broker may take more time to complete the task than the specified timeout value. This value is used when refreshing
         * the console in such cases.
         */
    if (!ba.isBusy()) {
        ba.setAssociatedObj(bCObj);
    }
    if (pauseBroker(ba)) {
        Enumeration e = bCObj.children();
        BrokerServiceListCObj bSvclCObj = null;
        while (e.hasMoreElements()) {
            ConsoleObj cObj = (ConsoleObj) e.nextElement();
            if (cObj instanceof BrokerServiceListCObj) {
                bSvclCObj = (BrokerServiceListCObj) cObj;
            }
        }
        Vector svcs = queryAllServiceInfo(ba);
        if (svcs != null) {
            updateAllServiceInfo(bSvclCObj, svcs);
            // Update menu items, buttons.
            controller.setActions(bCObj);
            app.getInspector().refresh();
        }
    }
}
Also used : BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) Enumeration(java.util.Enumeration) Vector(java.util.Vector)

Aggregations

BrokerAdmin (com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin)69 BrokerAdminException (com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException)44 SizeString (com.sun.messaging.jmq.util.SizeString)27 Vector (java.util.Vector)20 DestinationInfo (com.sun.messaging.jmq.util.admin.DestinationInfo)14 Enumeration (java.util.Enumeration)14 Properties (java.util.Properties)12 ServiceInfo (com.sun.messaging.jmq.util.admin.ServiceInfo)9 Hashtable (java.util.Hashtable)6 DurableInfo (com.sun.messaging.jmq.util.admin.DurableInfo)2 HashMap (java.util.HashMap)2 UserProperties (com.sun.messaging.jmq.admin.util.UserProperties)1 DestMetricsCounters (com.sun.messaging.jmq.util.DestMetricsCounters)1 MetricCounters (com.sun.messaging.jmq.util.MetricCounters)1 ConsumerInfo (com.sun.messaging.jmq.util.admin.ConsumerInfo)1 Message (jakarta.jms.Message)1 Map (java.util.Map)1