Examples of HermesConfig


Examples of hermes.config.HermesConfig

   * @throws JMSException
   */
  private void init() throws NamingException, JMSException, IOException {
    // Set up the repository manager

    HermesConfig config = (HermesConfig) context.lookup(HermesContext.CONFIG);

    if (config.getMessageFilesDir() == null) {
      config.setMessageFilesDir("./messages");
    }

    File repDir = new File(TextUtils.replaceClasspathVariables(config.getMessageFilesDir()));

    try {
      loader.save();
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }

    if (!repDir.exists()) {
      repDir.mkdir();
    }

    repManager = new FileRepositoryManager(repDir, 5000);
    repManager.addRepositoryListener((BrowserTreeModel) getBrowserTree().getModel());

    log.debug("setting maxThreadPoolSize");

    if (config.getMaxThreadPoolSize() == 0) {
      config.setMaxThreadPoolSize(1);
    }

    ThreadPool.get().setThreads(config.getMaxThreadPoolSize());
  }
View Full Code Here

Examples of hermes.config.HermesConfig

   * @throws NamingException
   */
  public void loadConfig() throws NamingException, HermesException {
    Properties props = new Properties();
    Context oldContext = context;
    HermesConfig oldConfig = null;

    props.put(Context.INITIAL_CONTEXT_FACTORY, HermesInitialContextFactory.class.getName());
    props.put(Context.PROVIDER_URL, getCurrentConfigURL());
    props.put("hermes.loader", JAXBHermesLoader.class.getName());

    log.debug("props=" + props);

    Iterator listeners = null;

    if (loader != null) {
      listeners = loader.getConfigurationListeners();
      oldConfig = loader.getConfig();
    }

    if (oldConfig != null) {
      Set naming = new HashSet();
      naming.addAll(oldConfig.getNaming());

      for (Iterator iter = naming.iterator(); iter.hasNext();) {
        NamingConfig oldNaming = (NamingConfig) iter.next();

        loader.notifyNamingRemoved(oldNaming);
View Full Code Here

Examples of hermes.config.HermesConfig

   private void updateFilterConfig()
   {
      try
      {
         HermesConfig config = HermesBrowser.getBrowser().getConfig();
        
         config.getFilters().clear();
        
         for (String filter : filters)
         {
            if (!TextUtils.isEmpty(filter))
            {
               config.getFilters().add(filter);
            }
         }

         HermesBrowser.getBrowser().backupConfig();
         HermesBrowser.getBrowser().saveConfig();
View Full Code Here

Examples of hermes.config.HermesConfig

  
   private void updateFilterConfig()
   {
      try
      {
         HermesConfig config = HermesBrowser.getBrowser().getConfig() ;
         config.getFilters().clear() ;
         config.getFilters().addAll(filterHistory) ;
        
        
         HermesBrowser.getBrowser().backupConfig() ;
         HermesBrowser.getBrowser().saveConfig() ;
      }
View Full Code Here

Examples of hermes.config.HermesConfig

   }

   private void doDelete(NamingConfigTreeNode namingNode) throws HermesException
   {
      final HermesConfig config = HermesBrowser.getBrowser().getConfig();
      final DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) namingNode.getParent();

      HermesBrowser.getConfigDAO().removeNamingConfig(config, namingNode.getConfig().getId());
      HermesBrowser.getBrowser().saveConfig();
      Hermes.ui.getDefaultMessageSink().add(namingNode.getId() + " removed");
View Full Code Here

Examples of hermes.config.HermesConfig

      HermesBrowser.getBrowser().getBrowserTree().getBrowserModel().nodesWereRemoved(parentNode, index, objects);
   }

   private void doDelete(MessageStoreURLTreeNode node) throws JMSException
   {
      final HermesConfig config = HermesBrowser.getBrowser().getConfig();
      final MutableTreeNode parent = (MutableTreeNode) node.getParent();
      final int index = parent.getIndex(node);
      HermesBrowser.getConfigDAO().removeJDBC(config, node.getConfig());

      parent.remove(node);
View Full Code Here

Examples of hermes.config.HermesConfig

      HermesBrowser.getBrowser().saveConfig();
   }

   private void doDelete(DestinationConfigTreeNode destinationNode) throws JMSException
   {
      final HermesConfig config = HermesBrowser.getBrowser().getConfig();
      final HermesTreeNode hermesNode = (HermesTreeNode) destinationNode.getHermesTreeNode();
      final String type = destinationNode.isQueue() ? "queue" : "topic";

      HermesBrowser.getConfigDAO().removeDestination(config, hermesNode.getHermes().getId(), destinationNode.getDestinationName());
      hermesNode.getHermes().removeDestinationConfig(destinationNode.getConfig());
View Full Code Here

Examples of hermes.config.HermesConfig

      }
   }

   private void doDelete(HermesTreeNode hermesNode) throws HermesException
   {
      final HermesConfig config = HermesBrowser.getBrowser().getConfig();
      final MutableTreeNode parentNode = (MutableTreeNode) hermesNode.getParent();

      HermesBrowser.getConfigDAO().removeHermes(config, hermesNode.getHermes().getId());

      HermesBrowser.getBrowser().saveConfig();
View Full Code Here

Examples of hermes.config.HermesConfig

  /**
   * Create a copy of a message
   */
  public Message duplicate(Destination to, Message in) throws JMSException {
    HermesConfig config = HermesBrowser.getBrowser().getConfig();

    Thread.currentThread().setContextClassLoader(contextClassLoader);

    Message out = null;

    if (in instanceof TextMessage) {
      out = createTextMessage(((TextMessage) in).getText());
    } else if (in instanceof ObjectMessage) {
      out = createObjectMessage();
      ((ObjectMessage) out).setObject(((ObjectMessage) in).getObject());

    } else if (in instanceof MapMessage) {
      out = createMapMessage();
      final MapMessage inMap = (MapMessage) in;
      final MapMessage outMap = (MapMessage) out;

      for (Enumeration iter = inMap.getMapNames(); iter.hasMoreElements();) {
        String key = (String) iter.nextElement();

        outMap.setObject(key, inMap.getObject(key));
      }
    } else if (in instanceof StreamMessage) {
      out = createStreamMessage();
      final StreamMessage inS = (StreamMessage) in;
      final StreamMessage outS = (StreamMessage) out;

      try {
        for (;;) {
          outS.writeObject(inS.readObject());
        }
      } catch (MessageEOFException ex2) {
        // NOP
      }
    } else if (in instanceof BytesMessage) {
      out = createBytesMessage();
      final BytesMessage inBytes = (BytesMessage) in;
      final BytesMessage outBytes = (BytesMessage) out;
      inBytes.reset();
      try {
        outBytes.writeBytes(MessageUtils.asBytes(inBytes));
      } catch (MessageEOFException ex2) {
        // NOP
      }
    } else if (in instanceof Message) {
      out = createMessage();
    } else {
      throw new HermesException("Cannot handle " + in.getClass().getName());
    }

    try {
      out.setJMSDestination(to);
    } catch (Exception ex) {
      log.error(ex.getMessage(), ex);
    }
    //
    // Header properties

    if (config.isCopyJMSCorrelationID()) {
      try {
        out.setJMSCorrelationID(in.getJMSCorrelationID());
      } catch (JMSException ex) {
        log.error(ex.getMessage(), ex);
      }
    }

    if (config.isCopyJMSExpiration()) {
      try {
        out.setJMSExpiration(in.getJMSExpiration());
      } catch (JMSException ex) {
        log.error(ex.getMessage(), ex);
      }
    }

    if (config.isCopyJMSPriority()) {
      try {
        out.setJMSPriority(in.getJMSPriority());
      } catch (JMSException ex) {
        log.error(ex.getMessage(), ex);
      }
    }

    if (config.isCopyJMSReplyTo()) {
      try {
        if (in.getJMSReplyTo() != null) {
          out.setJMSReplyTo(getDestination(getDestinationName(in.getJMSReplyTo()), Domain.getDomain(in.getJMSReplyTo())));
        }
      }

      catch (JMSException ex) {
        log.error(ex.getMessage(), ex);
      } catch (NamingException ex) {
        throw new HermesRuntimeException(ex);
      }
    }

    if (config.isCopyJMSType()) {
      try {
        out.setJMSType(in.getJMSType());
      } catch (JMSException ex) {
        log.error(ex.getMessage(), ex);
      }
    }

    if (in.getPropertyNames() != null) {
      for (final Enumeration iter = in.getPropertyNames(); iter.hasMoreElements();) {
        final String key = (String) iter.nextElement();

        //
        // Dont copy over provider properties unless
        // copyJMSProviderProperties
        // is set.

        if (!key.startsWith("JMS") || config.isCopyJMSProviderProperties()) {
          out.setObjectProperty(key, in.getObjectProperty(key));
        }
      }
    }

View Full Code Here

Examples of hermes.config.HermesConfig

  public UserHeaderPropertyPanel(Message message) throws JMSException {
    super(true);

    if (message != null) {
      HermesConfig config = HermesBrowser.getBrowser().getConfig() ;
      for (Enumeration<String> e = message.getPropertyNames(); e.hasMoreElements();) {
        PropertyRow row = new PropertyRow();
        row.name = e.nextElement();
        row.value = message.getObjectProperty(row.name);
        row.type = PropertyType.fromObject(row.value);
       
        if (config.isCopyJMSProviderProperties() || !row.name.startsWith("JMS")) {
          model.addRow(row);
        }
      }
    }
  }
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.