Package com.sun.messaging.jmq.jmsserver.core

Examples of com.sun.messaging.jmq.jmsserver.core.Destination


            HashMap destNameType)  {
        HashMap h = new HashMap();
        PacketReference  pr = getPacketReference(sysMsgID);
        Packet  pkt = pr.getPacket();
        HashMap msgHeaders = pr.getHeaders();
        Destination d = pr.getDestination();
        String corrID = pkt.getCorrelationID(), errMsg;
        int typeMask = DestType.DEST_TYPE_QUEUE;
        byte b[] = null;

        h.put("CorrelationID", corrID);

        if (corrID != null)  {
      try  {
                b = corrID.getBytes("UTF8");
      } catch(Exception e)  {
      }
        }

        h.put("CorrelationIDAsBytes", b);

        h.put("DeliveryMode", (pkt.getPersistent()) ?
      new Integer(javax.jms.DeliveryMode.PERSISTENT) :
      new Integer(javax.jms.DeliveryMode.NON_PERSISTENT));

        h.put("DestinationName", pkt.getDestination());

  if (pkt.getIsQueue())  {
            typeMask = DestType.DEST_TYPE_QUEUE;
  } else  {
            typeMask = DestType.DEST_TYPE_TOPIC;
  }

        h.put("DestinationType", new Integer(typeMask));

        h.put("Expiration", new Long(pkt.getExpiration()));

        h.put("MessageID", msgHeaders.get("JMSMessageID"));
        h.put("Priority", new Integer(pkt.getPriority()));

        h.put("Redelivered", new Boolean(pkt.getRedelivered()));

  /*
   * The ReplyTo information in the packet contains
   * the destination name and class name (i.e. dest class
   * name), which the broker cannot really use.
   * We need to query/check if:
   *  - the destination exists
   *  - what it's type is
   */
        String replyToDestName = pkt.getReplyTo();

        if (replyToDestName != null)  {
      boolean destFound = false, isQueue = true;

      if (destNameType != null)  {
    Boolean isQ = (Boolean)destNameType.get(replyToDestName);

    if (isQ != null)  {
        isQueue = isQ.booleanValue();
        destFound = true;
    }
      }

      if (!destFound)  {
          try  {
              Destination topic, queue;

              queue = Destination.findDestination(replyToDestName, true);
              topic = Destination.findDestination(replyToDestName, false);

        if ((queue != null) && (topic != null))  {
View Full Code Here


            if (DEBUG) {
                logger.log(Logger.DEBUG, "QBrowse request: destination =  " + destination + "  selector = " + selectorstr);
            }
       
            Destination d = Destination.getDestination(destination,
                     DestType.isQueue(type));

            Boolean getMetrics = (Boolean)props.get("JMQMetrics");

            if (d == null) {
                status = Status.NOT_FOUND;
                reason = "Destination " + destination + " not found";
                logger.log(Logger.WARNING,BrokerResources.W_QUEUE_BROWSE_FAILED_NODEST,
                     (destination==null? "unknown" : destination));
            } else if (getMetrics != null && getMetrics == Boolean.TRUE) {
                logger.log(Logger.INFO,"Getting destination metrics on " + d);
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                try {
                    ObjectOutputStream oos = new ObjectOutputStream(bos);
                    oos.writeObject(d.getMetrics());
                    oos.close();
                    body = bos.toByteArray();
                } catch (Exception e) {
                    // Programing error. Do not need to localize
                    logger.log(Logger.ERROR, BrokerResources.E_INTERNAL_BROKER_ERROR,
View Full Code Here

            status = Status.ERROR;
  }

        if (destination != null)  {
            try {
                Destination d = Destination.getDestination(destination,
          DestType.isQueue(destType.intValue()));

    if (d != null) {
              Iterator cons = d.getConsumers();

              while (cons.hasNext())  {
            Consumer oneCon = (Consumer)cons.next();

                        HashMap h = constructConsumerInfo(oneCon.getConsumerUID(), d);
View Full Code Here

               type |= DestType.DEST_ADMIN | DestType.DEST_LOCAL
                     | DestType.DEST_AUTO;
            }
            assert pkt.getPacketType() == PacketType.CREATE_DESTINATION_REPLY;
            try {
                Destination d = null;
                if (DestType.isTemporary(type)) {
                    // deal w/ versioning .. only store
                    // 3.5 or later
                    boolean storeTemps = con.getConnectionUID().
                            getCanReconnect();
                    long reconnectTime = con.getReconnectInterval();
                    d = Destination.createTempDestination(
                         destination, type, con.getConnectionUID(),
                         storeTemps, reconnectTime);
                    if (con.getConnectionUID().equals(d.getConnectionUID())) {
                        con.attachTempDestination(d.getDestinationUID());
                    }

                } else if (destination.startsWith(Globals.INTERNAL_PREFIX)) {
                    // do nothing
                } else if (DestinationUID.isWildcard(destination)) {
                    pkt.setWildcard(true);
                    // dont create a destination
                } else {
                    d = Destination.getDestination(destination, type, true, !con.isAdminConnection());
                }

                hash.put("JMQDestType", new Integer(type));
                hash.put("JMQDestUID", destination);

    /*
     * Set XML Schema validation properties
     */
                hash.put("JMQValidateXMLSchema", new Boolean(isXMLSchemaValidationOn(d)));
    String uris = getXMLSchemaURIList(d);
    if (uris != null)  {
                    hash.put("JMQXMLSchemaURIList", uris);
    }
                hash.put("JMQReloadXMLSchemaOnFailure",
        new Boolean(getReloadXMLSchemaOnFailure(d)));

            } catch (BrokerException ex) {
                status = ex.getStatusCode();
                reason = ex.getMessage();
                if (status != Status.CONFLICT) {
                    logger.log(Logger.WARNING,
                        BrokerResources.W_CREATE_DEST_FAILED, destination, ex);
                } else if (DEBUG) {
                    logger.log(Logger.DEBUG,
                        BrokerResources.W_CREATE_DEST_FAILED, destination, ex);
                }
            } catch (IOException ex) {
                status = Status.ERROR;
                reason = ex.getMessage();
                logger.log(Logger.WARNING,
                    BrokerResources.W_CREATE_DEST_FAILED, destination, ex);
            }
        } else { // removing Interest
            assert msg.getPacketType() == PacketType.DESTROY_DESTINATION;
            assert pkt.getPacketType() == PacketType.DESTROY_DESTINATION_REPLY;

            Destination d =null;

            try {
                DestinationUID rmuid = DestinationUID.getUID(destination, DestType.isQueue(type));

                if (destination == null) {
View Full Code Here

            logger.log(Logger.ERROR, this.getClass().getName() + ": " + errMsg);
  } else  {

    try {
        Destination d= Destination.getDestination(info.name,
            DestType.isQueue(info.type));
  if (d == null)  {
     errMsg= rb.getString( rb.X_DESTINATION_NOT_FOUND,
            info.name);
     status = Status.NOT_FOUND;
  } else  {
            if (info.isModified(info.MAX_MESSAGES)) {
                int maxMessages = info.maxMessages;
                d.setCapacity(maxMessages);
            }
            if (info.isModified(info.MAX_MESSAGE_SIZE)) {
                SizeString maxSize = new SizeString();
                maxSize.setBytes(info.maxMessageSize);
                d.setMaxByteSize(maxSize);
            }
            if (info.isModified(info.MAX_MESSAGE_BYTES)) {
                SizeString maxBytes = new SizeString();
                maxBytes.setBytes(info.maxMessageBytes);
                d.setByteCapacity(maxBytes);
            }
            if (info.isModified(info.DEST_SCOPE)) {
                int scope = info.destScope;
                d.setScope(scope);
           
            }
            if (info.isModified(info.DEST_LIMIT)) {
                int destlimit = info.destLimitBehavior;
                d.setLimitBehavior(destlimit);
            }
            if (info.isModified(info.DEST_PREFETCH)) {
                int prefetch = info.maxPrefetch;
                d.setMaxPrefetch(prefetch);
            }
            if (info.isModified(info.DEST_CDP)) {
                int clusterdeliverypolicy = info.destCDP;
                d.setClusterDeliveryPolicy(clusterdeliverypolicy);
            }
            if (info.isModified(info.MAX_ACTIVE_CONSUMERS)) {
                int maxcons = info.maxActiveConsumers;
                d.setMaxActiveConsumers(maxcons);
            }
            if (info.isModified(info.MAX_FAILOVER_CONSUMERS)) {
                int maxcons = info.maxFailoverConsumers;
                d.setMaxFailoverConsumers(maxcons);
            }
            if (info.isModified(info.MAX_PRODUCERS)) {
                int maxproducers = info.maxProducers;
                d.setMaxProducers(maxproducers);
            }
            if (info.isModified(info.MAX_SHARED_CONSUMERS)) {
                int maxsharedcons = info.maxNumSharedConsumers;
                d.setMaxSharedConsumers(maxsharedcons);
            }
            if (info.isModified(info.SHARE_FLOW_LIMIT)) {
                int sflowlimit = info.sharedConsumerFlowLimit;
                d.setSharedFlowLimit(sflowlimit);
            }
            if (info.isModified(info.USE_DMQ)) {
                boolean dmq = info.useDMQ;
                d.setUseDMQ(dmq);
            }
            if (info.isModified(info.VALIDATE_XML_SCHEMA_ENABLED)) {
                d.setValidateXMLSchemaEnabled(info.validateXMLSchemaEnabled);
            }
            if (info.isModified(info.XML_SCHEMA_URI_LIST)) {
                d.setXMLSchemaUriList(info.XMLSchemaUriList);
            }
            if (info.isModified(info.RELOAD_XML_SCHEMA_ON_FAILURE)) {
                d.setReloadXMLSchemaOnFailure(info.reloadXMLSchemaOnFailure);
            }
            d.update();
  }
       
    } catch (Exception ex) {
        errMsg = getMessageFromException(ex);
        status = Status.ERROR;
View Full Code Here

  }

  ObjectName destONames[] = new ObjectName [ dests.size() ];

  for (int i =0; i < dests.size(); i ++) {
      Destination d = (Destination)dests.get(i);

      try  {
          ObjectName o = MQObjectName.createDestinationMonitor(
        d.isQueue() ? DestinationType.QUEUE : DestinationType.TOPIC,
        d.getDestinationName());

          destONames[i] = o;
      } catch (Exception e)  {
    handleOperationException(ConnectionOperations.GET_TEMP_DESTINATIONS, e);
      }
View Full Code Here

  }

  ObjectName destONames[] = new ObjectName [ dests.size() ];

  for (int i =0; i < dests.size(); i ++) {
      Destination d = (Destination)dests.get(i);

      try  {
          ObjectName o = MQObjectName.createDestinationMonitor(
        d.isQueue() ? DestinationType.QUEUE : DestinationType.TOPIC,
        d.getDestinationName());

          destONames[i] = o;
      } catch (Exception e)  {
    handleOperationException(DestinationOperations.GET_DESTINATIONS, e);
      }
View Full Code Here

  ArrayList<String> al = new ArrayList<String>();
  Set dests = p.getDestinations();
  Iterator itr = dests.iterator();
  while (itr.hasNext()) {
      Destination dest = (Destination)itr.next();
      al.add(dest.getDestinationName());
  }

  if (al.size() > 0)  {
      ret = new String [ al.size() ];
      ret = (String[])al.toArray(ret);
View Full Code Here

    public static String getDestinationType(ProducerUID pid)  {
  Producer p = Producer.getProducer(pid);

  if (p != null)  {
      DestinationUID did = p.getDestinationUID();
      Destination d = Destination.getDestination(p.getDestinationUID());

      if (d == null)  {
    return (null);
      }

      return(d.isQueue() ? DestinationType.QUEUE : DestinationType.TOPIC);
  }

  return (null);
    }
View Full Code Here

    if (!loaded) {
      loaded = true;
      Destination.loadDestinations();
      Iterator itr = Destination.getAllDestinations();
      while (itr.hasNext()) {
        Destination d = (Destination) itr.next();
        d.load();
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.core.Destination

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.