Search in sources :

Example 26 with DestinationInfo

use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method doPauseDest.

private void doPauseDest(BrokerDestCObj bDestCObj) {
    BrokerAdmin ba = bDestCObj.getBrokerAdmin();
    DestinationInfo destInfo = bDestCObj.getDestinationInfo();
    int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_DEST_PAUSE, destInfo.name, ba.getKey()), acr.getString(acr.I_PAUSE_DEST), 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(bDestCObj);
    }
    if (pauseDest(ba, destInfo.name, destInfo.type, DestState.PAUSED)) {
        destInfo = queryDestinationInfo(ba, destInfo.name, destInfo.type);
        if (destInfo != null) {
            bDestCObj.setDestinationInfo(destInfo);
            app.getInspector().selectedObjectUpdated();
        }
        // Update menu items, buttons.
        controller.setActions(bDestCObj);
    }
}
Also used : BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo)

Example 27 with DestinationInfo

use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method doUpdateDestination.

private void doUpdateDestination(BrokerAdminEvent bae, ConsoleObj selObj) {
    BrokerDestCObj bDestCObj;
    BrokerAdmin ba;
    String destName = null;
    int destTypeMask = -1;
    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);
    }
    destName = bDestCObj.getDestinationInfo().name;
    destTypeMask = bDestCObj.getDestinationInfo().type;
    DestinationInfo destInfo = bae.getDestinationInfo();
    destInfo.setName(destName);
    destInfo.setType(destTypeMask);
    try {
        ba.sendUpdateDestinationMessage(destInfo);
        ba.receiveUpdateDestinationReplyMessage();
        app.getStatusArea().appendText(acr.getString(acr.S_BROKER_UPDATE_DEST, destName));
        if (bae.isOKAction()) {
            brokerDestPropsDialog.setVisible(false);
        }
    } catch (BrokerAdminException baex) {
        JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_UPDATE_DEST, destName) + printBrokerAdminExceptionDetails(baex), acr.getString(acr.I_BROKER_DEST_PROPS) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_UPDATE_DEST), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
        return;
    }
    if (refreshBrokerDestCObj(bDestCObj, bae.getType())) {
        app.getInspector().selectedObjectUpdated();
        // Update menu items, buttons.
        controller.setActions(bDestCObj);
    }
}
Also used : BrokerAdminException(com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException) BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo)

Example 28 with DestinationInfo

use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method createDestination.

private DestinationInfo createDestination(BrokerAdminEvent bae) {
    DestinationInfo destInfo = new DestinationInfo();
    destInfo.setName(bae.getDestinationName());
    destInfo.setType(bae.getDestinationTypeMask());
    if (DestType.isQueue(bae.getDestinationTypeMask())) {
        destInfo.setMaxActiveConsumers(bae.getActiveConsumers());
        destInfo.setMaxFailoverConsumers(bae.getFailoverConsumers());
    }
    destInfo.setMaxProducers(bae.getMaxProducers());
    destInfo.setMaxMessageBytes(bae.getMaxMesgBytes());
    destInfo.setMaxMessages(bae.getMaxMesg());
    destInfo.setMaxMessageSize(bae.getMaxPerMesgSize());
    return destInfo;
}
Also used : DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo)

Example 29 with DestinationInfo

use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method queryDestinationInfo.

private DestinationInfo queryDestinationInfo(BrokerAdmin ba, String name, int type) {
    DestinationInfo destInfo = null;
    try {
        ba.sendGetDestinationsMessage(name, type);
        /*
             * False because users do not need to know whether or not the operation had succeeded after timeout.
             */
        Vector dest = ba.receiveGetDestinationsReplyMessage(false);
        if ((dest != null) && (dest.size() == 1)) {
            Enumeration e = dest.elements();
            destInfo = (DestinationInfo) e.nextElement();
        }
    } catch (BrokerAdminException bae) {
        JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_DEST_QUERY, name) + printBrokerAdminExceptionDetails(bae), acr.getString(acr.I_BROKER) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_DEST_QUERY), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
    }
    return destInfo;
}
Also used : BrokerAdminException(com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException) DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo) Enumeration(java.util.Enumeration) Vector(java.util.Vector)

Example 30 with DestinationInfo

use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.

the class BrokerDestListInspector method getValueAtCollumn.

/**
 * Returns the Object at a particular cell collumn for a given ConsoleObj object. Each row in the JTable represents one
 * ConsoleObj. This method returns the object/value for the ConsoleObj, for a particular collumn.
 *
 * @return the Object at a particular cell collumn for a given ConsoleObj object.
 */
@Override
public Object getValueAtCollumn(ConsoleObj conObj, int col) {
    BrokerDestCObj bDestCObj;
    if (!(conObj instanceof BrokerDestCObj)) {
        return null;
    }
    bDestCObj = (BrokerDestCObj) conObj;
    DestinationInfo destInfo = bDestCObj.getDestinationInfo();
    /*
         * Do not list internal destinations.
         */
    if (DestType.isInternal(destInfo.fulltype)) {
        return null;
    }
    if (col == 0) {
        return (bDestCObj);
    } else if (col == 1) {
        return (BrokerAdminUtil.getDestinationType(destInfo.type));
    } else if (col == 2) {
        // return (DestState.toString(destInfo.destState));
        return BrokerAdminUtil.getDestinationState(destInfo.destState);
    }
    return (null);
}
Also used : DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo)

Aggregations

DestinationInfo (com.sun.messaging.jmq.util.admin.DestinationInfo)31 BrokerAdmin (com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin)14 SizeString (com.sun.messaging.jmq.util.SizeString)13 BrokerAdminException (com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException)12 Vector (java.util.Vector)11 Enumeration (java.util.Enumeration)10 ServiceInfo (com.sun.messaging.jmq.util.admin.ServiceInfo)4 Properties (java.util.Properties)4 Destination (com.sun.messaging.jmq.jmsserver.core.Destination)3 DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)3 Hashtable (java.util.Hashtable)3 Iterator (java.util.Iterator)3 AdministeredObject (com.sun.messaging.AdministeredObject)2 HAMonitorService (com.sun.messaging.jmq.jmsserver.cluster.api.ha.HAMonitorService)2 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)2 ObjectMessage (jakarta.jms.ObjectMessage)2 BrokerAdminEvent (com.sun.messaging.jmq.admin.event.BrokerAdminEvent)1 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)1 Producer (com.sun.messaging.jmq.jmsserver.core.Producer)1 PartitionedStore (com.sun.messaging.jmq.jmsserver.persist.api.PartitionedStore)1