Package com.sun.messaging.jmq.util.admin

Examples of com.sun.messaging.jmq.util.admin.DestinationInfo


    private boolean refreshBrokerDestCObj(BrokerDestCObj bDestCObj) {
  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.
       */ 
      if (eventType == BrokerAdminEvent.DELETE_DUR ||
    eventType == BrokerAdminEvent.UPDATE_DEST) {
    return false;
      }

            JOptionPane.showOptionDialog(app.getFrame(),
                acr.getString(acr.E_RETRIEVE_DEST, oldDestInfo.name) +
                    printBrokerAdminExceptionDetails(baex),
                acr.getString(acr.I_BROKER_DEST_PROPS) + ": " +
                    acr.getString(acr.I_ERROR_CODE,
                    AdminConsoleResources.E_RETRIEVE_DEST),
                JOptionPane.YES_NO_OPTION,
                JOptionPane.ERROR_MESSAGE, null, close, close[0]);

            return false;
        }

         if ((dests != null) && (dests.size() == 1)) {
      Enumeration e = dests.elements();
      DestinationInfo dInfo = (DestinationInfo)e.nextElement();
      if ((!DestType.isTemporary(dInfo.type)) &&
          (!DestType.isInternal(dInfo.fulltype)) &&
                  (!MessageType.JMQ_BRIDGE_ADMIN_DEST.equals(dInfo.name)) &&
                  (!MessageType.JMQ_ADMIN_DEST.equals(dInfo.name))) {
    bDestCObj.setDestinationInfo(dInfo);
View Full Code Here


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

        }
    }

    private void doResumeDest(BrokerDestCObj bDestCObj) {
  BrokerAdmin ba = bDestCObj.getBrokerAdmin();
        DestinationInfo destInfo = bDestCObj.getDestinationInfo();

        int result = JOptionPane.showConfirmDialog(app.getFrame(),
                acr.getString(acr.Q_DEST_RESUME, destInfo.name, ba.getKey()),
                acr.getString(acr.I_RESUME_DEST),
                JOptionPane.YES_NO_OPTION);
View Full Code Here

            }
        }
    }

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

    }

    private BrokerDestCObj addDestination(BrokerCObj bCObj, BrokerAdminEvent bae) {

  BrokerDestCObj bDestCObj;
  DestinationInfo destInfo = createDestination(bae);
  BrokerAdmin 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.
View Full Code Here

        }
  return bDestCObj;
    }

    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;
    }
View Full Code Here

         * This value is used when refreshing the console in such cases.
         */
  if (!ba.isBusy())
            ba.setAssociatedObj(bDestCObj);

  DestinationInfo destInfo = bDestCObj.getDestinationInfo();

  int result = JOptionPane.showConfirmDialog(app.getFrame(),
                acr.getString(acr.Q_BROKER_DELETE_DEST, destInfo.name, ba.getKey()),
                acr.getString(acr.I_DELETE_BROKER_DEST),
                JOptionPane.YES_NO_OPTION);
View Full Code Here

    }

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

        ObjectMessage requestMesg = null;
        Message replyMesg = null;

        // Create DestinationInfo.
        DestinationInfo di = new DestinationInfo();
        di.setName(destinationName);

  // REVISIT:
  // We only check for queueDeliveryPolicy in the properties
  // hard-coded string; left here because we are not sure
  // if we are going to expose this attribute yet
  String qPolicy = null;

  /*
   * Early initialization to be used in error messages
   */
  int typeMask = this.getDestTypeMask(destinationType, null);

  if (properties != null)  {
      if (properties.containsKey("queueDeliveryPolicy")) {
          qPolicy = (String)properties.get("queueDeliveryPolicy");
          typeMask = this.getDestTypeMask(destinationType, qPolicy);
      }

      if (properties.containsKey(
    BrokerCmdOptions.PROP_NAME_MAX_ACTIVE_CONSUMER_COUNT)) {
    Object tmp = null;
    String val = null;
    tmp = properties.get(
        BrokerCmdOptions.PROP_NAME_MAX_ACTIVE_CONSUMER_COUNT);

    if (tmp != null)  {
        if (!(tmp instanceof String))  {
            JMSException jmse;
            jmse = new JMSException(
                ar.getString(ar.E_SPI_DEST_CREATION_FAILED,
        DestType.toString(typeMask),
                    destinationName)
          + "\n"
          + ar.getString(ar.E_SPI_ATTR_TYPE_NOT_STRING,
                    BrokerCmdOptions.PROP_NAME_MAX_ACTIVE_CONSUMER_COUNT)
          );

            throw jmse;
        }

        val = (String)tmp;

            try  {
            di.setMaxActiveConsumers(Integer.parseInt(val));
        } catch (Exception e)  {
            JMSException jmse;
            jmse = new JMSException(
                ar.getString(ar.E_SPI_DEST_CREATION_FAILED,
        DestType.toString(typeMask),
                    destinationName)
          + "\n"
          + ar.getString(ar.E_INVALID_INTEGER_VALUE,
                    val,
                    BrokerCmdOptions.PROP_NAME_MAX_ACTIVE_CONSUMER_COUNT));
                        throw (jmse);
                    }
    }
      }
  }

  di.setType(typeMask);

        requestMesg = session.createObjectMessage();
        requestMesg.setJMSReplyTo(replyQueue);
        requestMesg.setIntProperty
            (MessageType.JMQ_MESSAGE_TYPE, MessageType.CREATE_DESTINATION);
View Full Code Here

     * destinations into this new Vector.
     */
    Vector validDests = new Vector();
 
    for (int i = 0; i < dests.size(); i++) {
        DestinationInfo di = (DestinationInfo)dests.elementAt(i);
        if ((!MessageType.JMQ_ADMIN_DEST.equals(di.name)) &&
            (!MessageType.JMQ_BRIDGE_ADMIN_DEST.equals(di.name)) &&
      (!DestType.isInternal(di.fulltype)) &&
      (!DestType.isTemporary(di.type))) {
      validDests.add(di);
        }
    }

          int numElements = validDests.size();
          String[][] destinations = new String[2][numElements];

          for (int i = 0; i < numElements; i++) {
            DestinationInfo di = (DestinationInfo)validDests.get(i);
        destinations[0][i] = di.name;
        destinations[1][i] = this.getDestinationType(di.type);
          }
          return destinations;
            }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.util.admin.DestinationInfo

Copyright © 2018 www.massapicom. 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.