Examples of BrokerAdmin


Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

    }

    private boolean reconnectToBroker(BrokerCObj bCObj)
  throws BrokerAdminException {

  BrokerAdmin ba = bCObj.getBrokerAdmin();

  boolean connected = false;
  int count = 0;

  while (!connected && (count < BrokerAdmin.RECONNECT_RETRIES)) {
            try {
    count++;
                ba.connect();
                ba.sendHelloMessage();
                ba.receiveHelloReplyMessage();
    connected = true;

                /*
                 * Add a listener to unexpected error reporting only
                 * after a successful connect.
                 * Set the initiator to false.  This flag should only
                 * be set to true when it is ready to preform a shutdown.
                 */
                ba.addAdminEventListener(this);
                ba.setInitiator(false);

            } catch (BrokerAdminException baex) {
    // try to reconnect based on RECONNECT attributes
    if (baex.getType() == BrokerAdminException.CONNECT_ERROR) {
        try {
            Thread.sleep(BrokerAdmin.RECONNECT_DELAY);
        } catch (InterruptedException ie) {
                  JOptionPane.showOptionDialog(app.getFrame(),
                            acr.getString(acr.E_RECONNECT_BROKER, ba.getKey()) +
                             ie.toString(),
                            acr.getString(acr.I_BROKER) + ": " +
                               acr.getString(acr.I_ERROR_CODE,
                                  AdminConsoleResources.E_RECONNECT_BROKER),
                            JOptionPane.YES_NO_OPTION,
                            JOptionPane.ERROR_MESSAGE, null, close, close[0]);
                  // Update the node
                  app.getExplorer().nodeChanged((DefaultMutableTreeNode)bCObj);
                  // Update menu items, buttons.
                  controller.setActions(bCObj);
        }
    } else {
                     JOptionPane.showOptionDialog(app.getFrame(),
                        acr.getString(acr.E_RECONNECT_BROKER, ba.getKey()) +
                           baex.toString(),
                        acr.getString(acr.I_BROKER) + ": " +
                           acr.getString(acr.I_ERROR_CODE,
                              AdminConsoleResources.E_RECONNECT_BROKER),
                      JOptionPane.YES_NO_OPTION,
                      JOptionPane.ERROR_MESSAGE, null, close, close[0]);
                    // Update the node
                    app.getExplorer().nodeChanged((DefaultMutableTreeNode)bCObj);
                    // Update menu items, buttons.
                    controller.setActions(bCObj);
    }
   
            } catch (Exception ex) {
                JOptionPane.showOptionDialog(app.getFrame(),
                    acr.getString(acr.E_RECONNECT_BROKER, ba.getKey()) +
                       ex.toString(),
                    acr.getString(acr.I_BROKER) + ": " +
                       acr.getString(acr.I_ERROR_CODE,
                          AdminConsoleResources.E_RECONNECT_BROKER),
                    JOptionPane.YES_NO_OPTION,
View Full Code Here

Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

        }
  return connected;
    }

    private void doDisconnectFromBroker(BrokerCObj bCObj) {
  BrokerAdmin ba = bCObj.getBrokerAdmin();

  if (ba == null)  {
      /*
       * Should not get here.
       */
      return;
  }

  /*
   * If BrokerAdmin is busy, disallow disconnect.
   */
  if (ba.isBusy())  {
      Object  args[] = new Object [ 3 ];
      String  busyMsg;


      args[0] = ba.getKey();
      args[1] = ba.getBrokerHost();
      args[2] = ba.getBrokerPort();
      busyMsg = acr.getString(acr.I_BUSY_WAIT_FOR_REPLY, args);

            JOptionPane.showOptionDialog(app.getFrame(),
                acr.getString(acr.E_DISCONNECT_BROKER_NOT_POSSIBLE)
        + busyMsg,
                acr.getString(acr.I_DISCONNECT_BROKER),
                JOptionPane.YES_NO_OPTION,
                JOptionPane.ERROR_MESSAGE, null, close, close[0]);

      return;
  }

        // Remove a listener to unexpected error reporting
        ba.removeAdminEventListener(this);

        /*
         * This value should be true only when restart is requested.
         */
  ba.setReconnect(false);

        if ((ba != null) && (disconnectFromBroker(ba))) {
      bCObj.setBrokerProps(null);
      /*
       * Remove destinations and services from this broker's node
View Full Code Here

Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

  return refreshBrokerServiceListCObj(bSvclCObj);
    }

    private boolean refreshBrokerServiceListCObj(BrokerServiceListCObj bSvclCObj) {
        BrokerCObj bCObj;
        BrokerAdmin ba;
        Vector svcs = null;

        bCObj = bSvclCObj.getBrokerCObj();
        ba = bCObj.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(bSvclCObj);

        try {
            ba.sendGetServicesMessage(null);
            svcs = ba.receiveGetServicesReplyMessage();

        } catch (BrokerAdminException baex) {
            JOptionPane.showOptionDialog(app.getFrame(),
    acr.getString(acr.E_REFRESH_SVCLIST) +
                    printBrokerAdminExceptionDetails(baex),
View Full Code Here

Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

        }
    }

    private boolean refreshBrokerServiceCObj(BrokerServiceCObj bSvcCObj) {
        ServiceInfo oldSvcInfo = bSvcCObj.getServiceInfo();
        BrokerAdmin ba = bSvcCObj.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(bSvcCObj);

        Vector svc = null;
        try {
            ba.sendGetServicesMessage(oldSvcInfo.name);
            /*
             * False because users do not need to know whether
             * or not the operation had succeeded after timeout.
             */
            svc = ba.receiveGetServicesReplyMessage(false);

        } catch (BrokerAdminException baex) {
            JOptionPane.showOptionDialog(app.getFrame(),
                acr.getString(acr.E_RETRIEVE_SVC, oldSvcInfo.name) +
                    printBrokerAdminExceptionDetails(baex),
View Full Code Here

Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

  return refreshBrokerDestListCObj(bDestlCObj);
    }

    private boolean refreshBrokerDestListCObj(BrokerDestListCObj bDestlCObj) {
        BrokerCObj bCObj;
        BrokerAdmin ba;
        Vector dests = null;

  bCObj = bDestlCObj.getBrokerCObj();
  ba = bDestlCObj.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(bDestlCObj);

        try {
            ba.sendGetDestinationsMessage(null, -1);
            dests = ba.receiveGetDestinationsReplyMessage();

        } catch (BrokerAdminException baex) {
            JOptionPane.showOptionDialog(app.getFrame(),
                acr.getString(acr.E_REFRESH_DESTLIST) +
                    printBrokerAdminExceptionDetails(baex),
View Full Code Here

Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

  return refreshBrokerDestCObj(bDestCObj, -1);
    }

    private boolean refreshBrokerDestCObj(BrokerDestCObj bDestCObj, int eventType) {
  DestinationInfo  oldDestInfo = bDestCObj.getDestinationInfo();
  BrokerAdmin 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);

        Vector dests = null;
        Vector durables = null;

  boolean succeed = false;
        try {
            ba.sendGetDurablesMessage(oldDestInfo.name, null);
            /*
             * False because users do not need to know whether
             * or not the operation had succeeded after timeout.
             */
            durables = ba.receiveGetDurablesReplyMessage(false);

        } catch (BrokerAdminException baex) {
            JOptionPane.showOptionDialog(app.getFrame(),
                acr.getString(acr.E_RETRIEVE_DUR, oldDestInfo.name) +
                    printBrokerAdminExceptionDetails(baex),
                acr.getString(acr.I_BROKER_DEST_PROPS) + ": " +
                    acr.getString(acr.I_ERROR_CODE,
                    AdminConsoleResources.E_RETRIEVE_DUR),
                JOptionPane.YES_NO_OPTION,
                JOptionPane.ERROR_MESSAGE, null, close, close[0]);
            return false;
        }

        if (durables.size() >= 0) {
            bDestCObj.setDurables(durables);
            succeed = true;
        }

        try {
            ba.sendGetDestinationsMessage(oldDestInfo.name, oldDestInfo.type);
            /*
             * False because users do not need to know whether
             * or not the operation had succeeded after timeout.
             */
            dests = ba.receiveGetDestinationsReplyMessage(false);

        } catch (BrokerAdminException baex) {
      /*
       *Do not pop up an error message, as another error message will be popped up.
       */ 
 
View Full Code Here

Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

    }

    private void doDeleteBroker(BrokerCObj bCObj) {

        ConsoleBrokerAdminManager baMgr = app.getBrokerListCObj().getBrokerAdminManager();
        BrokerAdmin ba = bCObj.getBrokerAdmin();

        int result = JOptionPane.showConfirmDialog(app.getFrame(),
                acr.getString(acr.Q_BROKER_DELETE, ba.getKey()),
                acr.getString(acr.I_DELETE_BROKER),
                JOptionPane.YES_NO_OPTION);

        if (result == JOptionPane.NO_OPTION)
            return;

  if (ba != null) {
            baMgr.deleteBrokerAdmin(ba);
            saveBrokerList();
            ba.close();

            app.getExplorer().removeFromParent(bCObj);
            controller.clearSelection();
        }
    }
View Full Code Here

Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

            controller.clearSelection();
        }
    }

    private void doPauseService(BrokerServiceCObj bSvcCObj) {
  BrokerAdmin ba = bSvcCObj.getBrokerAdmin();
        ServiceInfo svcInfo = bSvcCObj.getServiceInfo();

        int result = JOptionPane.showConfirmDialog(app.getFrame(),
                acr.getString(acr.Q_SERVICE_PAUSE, svcInfo.name, ba.getKey()),
                acr.getString(acr.I_PAUSE_SERVICE),
                JOptionPane.YES_NO_OPTION);

        if (result == JOptionPane.NO_OPTION)
            return;

  if (ba != null) {
            /*
             * 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(bSvcCObj);

            if (pauseService(ba, svcInfo.name)) {
                svcInfo = queryServiceInfo(ba, svcInfo.name);
    if (svcInfo != null) {
                    bSvcCObj.setServiceInfo(svcInfo);
View Full Code Here

Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

  return true;
    }

    private void doResumeService(BrokerServiceCObj bSvcCObj) {

  BrokerAdmin ba = bSvcCObj.getBrokerAdmin();
        ServiceInfo svcInfo = bSvcCObj.getServiceInfo();

        int result = JOptionPane.showConfirmDialog(app.getFrame(),
                acr.getString(acr.Q_SERVICE_RESUME, svcInfo.name, ba.getKey()),
                acr.getString(acr.I_RESUME_SERVICE),
                JOptionPane.YES_NO_OPTION);

        if (result == JOptionPane.NO_OPTION)
            return;

  if (ba != null) {
            /*
             * 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(bSvcCObj);

            if (resumeService(ba, svcInfo.name)) {
                svcInfo = queryServiceInfo(ba, svcInfo.name);
    if (svcInfo != null) {
                    bSvcCObj.setServiceInfo(svcInfo);
View Full Code Here

Examples of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin

        }
  return true;
    }

    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;

  /*
   * REVISIT:
   * At this point we can ask the user what pauseType they want:
   *  ALL
   *  PRODUCERS
   *  CONSUMERS
   * For now, we assume 'ALL' (== DestState.PAUSED).
   */

  if (ba != null) {
            /*
             * 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);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.