Examples of BrokerAdmin


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

    public void handleBrokerAdminEvents(BrokerAdminEvent bae) {
        int type      = bae.getType();
        ConsoleBrokerAdminManager baMgr = app.getBrokerListCObj().getBrokerAdminManager();
        ConsoleObj selObj    = app.getSelectedObj();
  BrokerAdmin ba;
  BrokerCObj bCObj;

        switch (type)  {
        case BrokerAdminEvent.ADD_BROKER:
            if (selObj instanceof BrokerListCObj) {
                try {
                    ba = new BrokerAdmin(bae.getHost(),
                                         bae.getPort(),
                                         bae.getUsername(),
                                         bae.getPassword(),
                                         -1,
                                         JMQ_RECONNECT,
                                         JMQ_RECONNECT_RETRIES,
                                         JMQ_RECONNECT_DELAY
                                         );

        ba.setKey(bae.getBrokerName());

                } catch (BrokerAdminException baex) {
                    JOptionPane.showOptionDialog(app.getFrame(),
                        acr.getString(acr.E_BROKER_ADD_BROKER, bae.getBrokerName()) +
                           printBrokerAdminExceptionDetails(baex),
                        acr.getString(acr.I_ADD_BROKER) + ": " +
                           acr.getString(acr.I_ERROR_CODE,
                              AdminConsoleResources.E_BROKER_ADD_BROKER),
                        JOptionPane.YES_NO_OPTION,
                        JOptionPane.ERROR_MESSAGE, null, close, close[0]);
                    return;

                } catch (Exception e) {
                    JOptionPane.showOptionDialog(app.getFrame(),
                        acr.getString(acr.E_BROKER_ADD_BROKER, bae.getBrokerName()) +
                           e.toString(),
                        acr.getString(acr.I_ADD_BROKER) + ": " +
                           acr.getString(acr.I_ERROR_CODE,
                              AdminConsoleResources.E_BROKER_ADD_BROKER),
                        JOptionPane.YES_NO_OPTION,
                        JOptionPane.ERROR_MESSAGE, null, close, close[0]);
                    return;
                }

                if (baMgr.exist(ba.getKey())) {
                    JOptionPane.showOptionDialog(app.getFrame(),
      acr.getString(acr.E_BROKER_EXISTS, ba.getKey()),
                        acr.getString(acr.I_ADD_BROKER) + ": " +
         acr.getString(acr.I_ERROR_CODE,
            AdminConsoleResources.E_BROKER_EXISTS)
                        JOptionPane.YES_NO_OPTION,
                        JOptionPane.ERROR_MESSAGE, null, close, close[0]);
View Full Code Here

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

    }

    private void handleBrokerCmdStatusEvent(BrokerCmdStatusEvent cse)  {
        int    type                 = cse.getType(),
      msgType;
  BrokerAdmin  ba = cse.getBrokerAdmin();
  boolean    success = cse.getSuccess();
  Exception  ex = cse.getLinkedException();
  String    dstName = cse.getDestinationName(),
      svcName = cse.getServiceName(),
      clientID = cse.getClientID(),
      durName = cse.getDurableName(),
      bkrName = ba.getKey(),
      title, msg;
  DestinationInfo dstInfo = cse.getDestinationInfo();
  ServiceInfo svcInfo = cse.getServiceInfo();
  Object refreshObj = ba.getAssociatedObj();

  if (type == BrokerCmdStatusEvent.BROKER_BUSY)  {
      int numRetriesAttempted = cse.getNumRetriesAttempted(),
      maxNumRetries = cse.getMaxNumRetries();
      long retryTimeount = cse.getRetryTimeount();
      Object args[] = new Object [ 3 ];

      args[0] = Integer.toString(numRetriesAttempted);
      args[1] = Integer.toString(maxNumRetries);
      args[2] = Long.toString(retryTimeount);
      /*
       * This string is of the form:
       *  Broker not responding, retrying [1 of 5 attempts, timeout=20 seconds]
       */
      String s = ar.getString(ar.I_JMQCMD_BROKER_BUSY, args);
            app.getStatusArea().appendText(s + "\n");
      return;
  }


        /*
         * Do not bring up the result dialog for
         * 1.  QUERY_SVC
         * 2.  QUERY_DST
         * 3.  LIST_DUR (for querying destination)
         * 4.  QUERY_BKR
         */
        if ((type == BrokerCmdStatusEvent.QUERY_SVC) ||
            (type == BrokerCmdStatusEvent.QUERY_DST) ||
            (type == BrokerCmdStatusEvent.LIST_DUR||
            (type == BrokerCmdStatusEvent.QUERY_BKR)) {
      /*
       * We need to refresh the console if 'connect' is successful
       * but 'query broker' is not upon connecting to a broker.
       */
      if (refreshObj instanceof BrokerCObj) {
                app.getExplorer().nodeChanged((DefaultMutableTreeNode)refreshObj);
    controller.setActions((BrokerCObj)refreshObj);
      }
            return;
        }

  /*
   * Type of dialog depends on success/failure
   */
  if (success)  {
            msgType = JOptionPane.INFORMATION_MESSAGE;
  } else  {
         msgType = JOptionPane.ERROR_MESSAGE;
  }

  /*
   * Dialog title reads:
   *   Status received from broker
   */
  title = acr.getString(acr.I_STATUS_RECV);

  switch (type)  {
  case BrokerCmdStatusEvent.HELLO:
      if (success)  {
          msg = acr.getString(acr.S_BROKER_CONNECT, bkrName);

    if (refreshObj instanceof BrokerCObj) {
                    BrokerCObj bCObj = (BrokerCObj)refreshObj;
        /*
         * Connection is considered created when the hello protocol
         * handshake takes place successfully.
         */
        ba.setIsConnected(true);
                    if (refreshBrokerServiceListCObj(bCObj.getBrokerServiceListCObj())) {
                        if (refreshBrokerDestListCObj(bCObj.getBrokerDestListCObj())) {
                      app.getExplorer().nodeChanged((DefaultMutableTreeNode)bCObj);
                      app.getInspector().refresh();
                    controller.setActions(bCObj);
View Full Code Here

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

                JOptionPane.YES_NO_OPTION,
                msgType, null, close, close[0]);
    }

    private void doConnectToBroker(BrokerCObj bCObj) {
        BrokerAdmin ba = bCObj.getBrokerAdmin();
  /*
   * This value should be true only when restart is requested.
   */
        ba.setReconnect(false);
        /*
   * Broker may take more time to complete the task than the specified
   * timeout value.
   * The associated object is used when refreshing the console in
   * such cases.  We only set the associated object when BrokerAdmin is
   * not busy; otherwise, we could be pointing to the wrong ConsoleObj.
   */
  if (!ba.isBusy())
            ba.setAssociatedObj(bCObj);

  boolean authenticationNeeded = false;

  if (ba.getUserName().length() == 0) {
      authenticationNeeded = true;
  }

  if (ba.getPassword().length() == 0) {
      authenticationNeeded = true;
  }

  if (authenticationNeeded) {
            if (brokerPasswdDialog == null) {
View Full Code Here

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

    private void doUpdateLogin(BrokerAdminEvent bae, ConsoleObj selObj) {

  if (selObj instanceof BrokerCObj) {

      BrokerCObj bCObj = (BrokerCObj)selObj;
      BrokerAdmin ba = bCObj.getBrokerAdmin();

      String tempUsername = bae.getUsername();
      String tempPasswd = bae.getPassword();

            if (connectToBroker(ba, tempUsername, tempPasswd, true)) {
View Full Code Here

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

     * Update a running broker's properties.
     */
    private void doUpdateBroker(BrokerAdminEvent bae, ConsoleObj selObj) {
  Properties bkrProps  = bae.getBrokerProps();
  BrokerCObj bCObj;
        BrokerAdmin ba;

  if (!(selObj instanceof BrokerCObj))  {
      /*
       * REMINDER: Need to flag this error ?
       */
      return;
  }

  bCObj = (BrokerCObj)selObj;
        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(bCObj);

        try {
            ba.sendUpdateBrokerPropsMessage(bkrProps);
            ba.receiveUpdateBrokerPropsReplyMessage();

            app.getStatusArea().appendText
    (acr.getString(acr.S_BROKER_UPDATE, ba.getKey()));

      if (bae.isOKAction())  {
    brokerBkrQueryDialog.hide();
      }

        } catch (BrokerAdminException bae2) {
            JOptionPane.showOptionDialog(app.getFrame(),
                acr.getString(acr.E_UPDATE_BROKER, ba.getKey()) +
                   printBrokerAdminExceptionDetails(bae2),
                acr.getString(acr.I_QUERY_BROKER) + ": " +
                   acr.getString(acr.I_ERROR_CODE,
                      AdminConsoleResources.E_UPDATE_BROKER),
                JOptionPane.YES_NO_OPTION,
View Full Code Here

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

        }
    }

    private void doDeleteDurable(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_DELETE_DUR, durableName, clientID),
                acr.getString(acr.I_DELETE_DURABLE),
                JOptionPane.YES_NO_OPTION);

  if (result == JOptionPane.NO_OPTION)
            return;

        try {
            ba.sendDestroyDurableMessage(durableName, clientID);
            ba.receiveDestroyDurableReplyMessage();

            app.getStatusArea().appendText
                (acr.getString(acr.S_BROKER_DESTROY_DUR, durableName, clientID));

        } catch (BrokerAdminException baex) {
View Full Code Here

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

            brokerDestPropsDialog.refresh(durables);
    }

    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, durableName, clientID));

        } catch (BrokerAdminException baex) {
View Full Code Here

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

            brokerDestPropsDialog.refresh(durables);
    }

    private void doUpdateService(BrokerAdminEvent bae, ConsoleObj selObj) {
        BrokerServiceCObj    bSvcCObj;
        BrokerAdmin        ba;
        String             serviceName = null;
        int              portValue = -1;
        int              minThreadsValue = -1;
        int              maxThreadsValue = -1;

        if (!(selObj instanceof BrokerServiceCObj)) {
            /*
             * REMINDER: Need to flag this error ?
             */
            return;
        }

        bSvcCObj = (BrokerServiceCObj)selObj;
        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);

  serviceName = bSvcCObj.getServiceInfo().name;
        portValue = bae.getPort();
        minThreadsValue = bae.getMinThreads();
        maxThreadsValue = bae.getMaxThreads();

  ServiceInfo svcInfo = new ServiceInfo();
  svcInfo.setName(serviceName);
  svcInfo.setPort(portValue);
  svcInfo.setMinThreads(minThreadsValue);
  svcInfo.setMaxThreads(maxThreadsValue);

        try {
            ba.sendUpdateServiceMessage(svcInfo);
            ba.receiveUpdateServiceReplyMessage();

            app.getStatusArea().appendText
                (acr.getString(acr.S_BROKER_UPDATE_SVC, serviceName));

            if (bae.isOKAction())  {
View Full Code Here

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

  }
    }

    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())  {
View Full Code Here

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

     */
    private void doUpdateBrokerEntry(BrokerAdminEvent bae, ConsoleObj selObj) {
        ConsoleBrokerAdminManager baMgr =
      app.getBrokerListCObj().getBrokerAdminManager();
  BrokerCObj  bCObj;
  BrokerAdmin  ba;
  String    oldPasswd, oldUserName, oldHost, oldPort, oldName,
      newName = bae.getBrokerName();

  if (!(selObj instanceof BrokerCObj))  {
      return;
  }

  bCObj = (BrokerCObj)selObj;
  ba = bCObj.getBrokerAdmin();

  /*
   * Get old/current values.
   */
  oldName = ba.getKey();
  oldHost = ba.getBrokerHost();
  oldPort = ba.getBrokerPort();
  oldUserName = ba.getUserName();
  oldPasswd = ba.getPassword();

  if (!oldName.equals(newName))  {
            if (baMgr.exist(newName)) {
                JOptionPane.showOptionDialog(app.getFrame(),
      acr.getString(acr.E_BROKER_EXISTS, newName),
                        acr.getString(acr.I_BROKER_PROPS) + ": " +
         acr.getString(acr.I_ERROR_CODE,
            AdminConsoleResources.E_BROKER_EXISTS)
                        JOptionPane.YES_NO_OPTION,
                        JOptionPane.ERROR_MESSAGE, null, close, close[0]);
                return;
            }

  }

  try  {
      ba.setKey(bae.getBrokerName());
      ba.setBrokerHost(bae.getHost());
      ba.setBrokerPort(Integer.toString(bae.getPort()));
      ba.setUserName(bae.getUsername());
      ba.setPassword(bae.getPassword());
  } catch(BrokerAdminException baex)  {
      int    type = baex.getType();
      String  badVal = baex.getBadValue(),
      errorStrId = acr.E_INVALID_PORT;

      /*
       * Revert to old values
       */
      try  {
          ba.setKey(oldName);
          ba.setBrokerHost(oldHost);
          ba.setBrokerPort(oldPort);
          ba.setUserName(oldUserName);
          ba.setPassword(oldPasswd);
      } catch (Exception e)  {
    /*
     * Don't check for any errors since these were
     * the original values
     */
 
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.