Package hermes.config

Examples of hermes.config.DestinationConfig


    boolean keepDurableSubscriptions = true, keepDurableSubscriptionsDialogShown = false;

    // HJMS-139

    for (final Iterator iter = dConfigs.iterator(); iter.hasNext();) {
      final DestinationConfig dConfig = (DestinationConfig) iter.next();
      DestinationConfig oldConfig = null;

      try {
        if (dConfig.getDomain() == Domain.TOPIC.getId()) {
          oldConfig = hermes.getDestinationConfig(dConfig.getName(), Domain.TOPIC);
        } else {
          oldConfig = hermes.getDestinationConfig(dConfig.getName(), Domain.QUEUE);
        }
      } catch (Throwable t) {
        log.error(t.getMessage(), t);
      }

      if (oldConfig != null && oldConfig.getProperties() != null) {
        dConfig.setProperties(oldConfig.getProperties());
      }
    }

    // End HJMS-139

    if (factoryConfigById.containsKey(hermes.getId())) {
      final FactoryConfig fConfig = factoryConfigById.get(hermes.getId());

      for (final Iterator iter = fConfig.getDestination().iterator(); iter.hasNext();) {
        final DestinationConfig dConfig = (DestinationConfig) iter.next();

        if (dConfig.getDomain() == Domain.TOPIC.getId() && dConfig.isDurable()) {
          if (!keepDurableSubscriptionsDialogShown) {
            if (HermesBrowser.getBrowser() != null) {
              if (JOptionPane.showConfirmDialog(HermesBrowser.getBrowser(), "Do you want to keep configured durable subscriptions?", "Durable Subscriptions", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
                keepDurableSubscriptions = false;
              }
            }

            keepDurableSubscriptionsDialogShown = true;
          }

          if (!keepDurableSubscriptions) {
            iter.remove();
            notifyDestinationRemoved(hermes, dConfig);
          }
        } else {
          iter.remove();
          notifyDestinationRemoved(hermes, dConfig);
        }
      }

      for (final Iterator iter = dConfigs.iterator(); iter.hasNext();) {
        final DestinationConfig dConfig = (DestinationConfig) iter.next();

        fConfig.getDestination().add(dConfig);
        hermes.addDestinationConfig(dConfig);
        notifyDestinationAdded(hermes, dConfig);
      }
View Full Code Here


          rval.add(hermes);

          notifyHermesAdded(hermes);

          for (Iterator diter = hermes.getDestinations(); diter.hasNext();) {
            DestinationConfig destinationConfig = (DestinationConfig) diter.next();

            boolean isQueue = hermes.getConnectionFactory() instanceof QueueConnectionFactory;
            boolean isTopic = hermes.getConnectionFactory() instanceof TopicConnectionFactory;

            if (destinationConfig.getDomain() == 0 && HermesBrowser.getBrowser() != null) {
              if (isQueue && isTopic) {
                Object options[] = { "Queue", "Topic" };

                int n = JOptionPane.showOptionDialog(HermesBrowser.getBrowser(), "This XML is from an older version of Hermes and it is unclear which domain the destination\n"
                    + destinationConfig.getName() + " for session " + hermes.getId() + " is in. Please choose whether queue or topic domain", "Select domain",
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]);

                if (n == JOptionPane.YES_OPTION) {
                  isQueue = true;
                  isTopic = false;

                  log.info(destinationConfig.getName() + " is now in the queue domain");
                } else {
                  isQueue = false;
                  isTopic = true;

                  log.info(destinationConfig.getName() + " is now in the topic domain");
                }
              }

              if (isQueue) {
                destinationConfig.setDomain(Domain.QUEUE.getId());
              } else if (isTopic) {
                destinationConfig.setDomain(Domain.TOPIC.getId());
              }
            }

            notifyDestinationAdded(hermes, destinationConfig);
          }
View Full Code Here

      jndiFactory = (JNDIConnectionFactory) connectionFactoryManager.getConnectionFactory();
      jndiFactory._setDelegateClassLoader(classLoader);
    }

    for (Iterator iter2 = factoryConfig.getDestination().iterator(); iter2.hasNext();) {
      DestinationConfig destinationConfig = (DestinationConfig) iter2.next();

      if (destinationConfig.isDurable() && destinationConfig.getClientID() == null) {
        log.warn("removing durable subscription to " + destinationConfig.getName() + "with a null clientID");
        iter2.remove();
      } else {
        connectionFactoryManager.addDestinationConfig(destinationConfig);
      }
    }
View Full Code Here

            Hermes hermes = (Hermes) context.lookup(binding.getName());

            listener.onHermesAdded(hermes);

            for (Iterator diter = hermes.getDestinations(); diter.hasNext();) {
              DestinationConfig destinationConfig = (DestinationConfig) diter.next();

              listener.onDestinationAdded(hermes, destinationConfig);
            }
          }
        } catch (NamingException ex) {
View Full Code Here

         throw new BuildException("storeId not set");
      }

      Hermes myHermes = null;
      QueueBrowser browser = null;
      final DestinationConfig myDestination;
      final MessageStore messageStore;

      try
      {
         final Domain domain = queue != null ? Domain.QUEUE : Domain.TOPIC;
View Full Code Here

      {
         SessionConfig sConfig = (SessionConfig) hIter.next();

         for (Iterator iter2 = HermesBrowser.getConfigDAO().getAllDestinations(config, sConfig.getId()).iterator(); iter2.hasNext();)
         {
            DestinationConfig dConfig = (DestinationConfig) iter2.next();

            if (dConfig.getRenderer() != null)
            {
               // @@TODO Remove the old destination specific renderers.

               dConfig.setRenderer(null) ;
            }
         }
      }
   }
View Full Code Here

         for (ObjectName sub : subs)
         {
            String name = (String) getConnection().getAttribute(sub, "DestinationName");
            String subscriptionName = (String) getConnection().getAttribute(sub, "SubscriptionName");
            DestinationConfig dConfig = HermesBrowser.getConfigDAO().createDestinationConfig(name, Domain.TOPIC);
            dConfig.setDurable(true);
            dConfig.setClientID(subscriptionName);

            rval.add(dConfig);
         }
      }
      catch (Exception e)
      {
         throw new HermesException(e);
      }

      try
      {
         ObjectName[] subs = (ObjectName[]) getConnection().getAttribute(getBrokerObjectName(), "InactiveDurableTopicSubscribers");

         for (ObjectName sub : subs)
         {
            String name = (String) getConnection().getAttribute(sub, "DestinationName");
            String subscriptionName = (String) getConnection().getAttribute(sub, "SubscriptionName");
            DestinationConfig dConfig = HermesBrowser.getConfigDAO().createDestinationConfig(name, Domain.TOPIC);
            dConfig.setDurable(true);
            dConfig.setClientID(subscriptionName);

            rval.add(dConfig);
         }
      }
      catch (Exception e)
View Full Code Here

    public void addSubscriber(DestinationConfig dConfig) {
        LOG.debug("Adding Subscriber " + dConfig.getClientID() + " to topic "
                + dConfig.getName());

        for (Iterator<DestinationConfig> iter = list.iterator(); iter.hasNext();) {
            DestinationConfig element = (DestinationConfig) iter.next();
            if (dConfig.getName().equals(element.getName())) {
                LOG.debug("Subscriber already in for this topic, returning");
                return;
            }
        }
        list.add(dConfig);
View Full Code Here

        list.add(dConfig);
    }

    public void removeAllSubscribers() throws JMSException {
        for (int i = 0; i < list.size(); i++) {
            DestinationConfig dConfig = (DestinationConfig) list.get(i);
            removeSubscriber(dConfig, false);
        }
    }
View Full Code Here

  /**
   * Create browser, can be used with topics too.
   */
  public QueueBrowser createBrowser(Hermes hermes, Destination destination, String selector) throws JMSException {
    final DestinationConfig dConfig = HermesBrowser.getConfigDAO().duplicate(getDestinationConfig(destination));

    if (dConfig.getSelector() == null) {
      dConfig.setSelector(selector);
    }

    return createBrowser(hermes, dConfig);
  }
View Full Code Here

TOP

Related Classes of hermes.config.DestinationConfig

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.