Package hermes

Examples of hermes.Hermes


            }
         }
      }
      else if (getBrowserTree().getSelectedHermesNode() != null)
      {
         final Hermes hermes = getBrowserTree().getSelectedHermesNode().getHermes();

         String namne = JOptionPane.showInputDialog(HermesBrowser.getBrowser(), "Enter name for this watch tab:", hermes.getId());

         if (namne != null && !namne.equals(""))
         {
            HermesBrowser.getBrowser().addOrCreateWatch(namne, hermes);
         }
View Full Code Here


    }
    catch( Exception e )
    {
      SoapUI.log.info( "no hermes context" );
    }
    Hermes hermes = null;
    try
    {
      if( sessionOptions != null && sessionOptions.length > 0 )
      {
        hermes = ( Hermes )ctx.lookup( sessionOptions[0] );
View Full Code Here

        {
          public void valueChanged( XFormField sourceField, String newValue, String oldValue )
          {
            if( !"".equals( newValue ) )
            {
              Hermes hermes = null;
              try
              {
                Context ctx = getHermesContext( iface, newValue );
                iface.getProject().setHermesConfig( newValue );
                String[] sessions = getSessionOptions( iface, newValue );
                mainForm.setOptions( SESSION, sessions );
                if( sessions != null && sessions.length > 0 )
                {
                  hermes = ( Hermes )ctx.lookup( sessions[0] );
                }
              }
              catch( Exception e )
              {
                SoapUI.logError( e );
              }
              if( hermes != null )
              {
                updateDestinations( hermes );
              }
              else
              {
                mainForm.setOptions( SESSION, new String[] {} );
                mainForm.setOptions( SEND, new String[] {} );
                mainForm.setOptions( RECEIVE, new String[] {} );
              }
            }
          }
        } );
    mainForm.addComboBox( SESSION, new String[] {}, "Session name from HermesJMS" ).addFormFieldListener(
        new XFormFieldListener()
        {

          public void valueChanged( XFormField sourceField, String newValue, String oldValue )
          {
            String hermesConfigPath = mainForm.getComponent( HERMES_CONFIG ).getValue();

            Hermes hermes = null;
            try
            {
              Context ctx = getHermesContext( iface, hermesConfigPath );
              hermes = ( Hermes )ctx.lookup( newValue );
            }
View Full Code Here

    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();
    try
    {
      Context ctx = hermesContext( project );

      Hermes hermes = ( Hermes )ctx.lookup( sessionName );
      return hermes;
    }
    catch( NamingException ne )
    {
      UISupport
View Full Code Here

  public void actionPerformed(ActionEvent arg0) {
    try {
      TaskSupport task = null;
      String f = null;
      Hermes h = null;

      TreePath currentPath = HermesBrowser.getBrowser().getBrowserTree().getSelectionModel().getSelectionPath();

      if (currentPath.getLastPathComponent() instanceof DestinationConfigTreeNode) {
        final DestinationConfigTreeNode destinationNode = HermesBrowser.getBrowser().getBrowserTree().getSelectedDestinationNodes().get(0);
        final DestinationConfig destinationConfig = destinationNode.getConfig();
        h = ((HermesTreeNode) destinationNode.getParent()).getHermes();
        task = new BrowseDestinationTask(h, destinationConfig);
        f = destinationConfig.getName();
      } else {
        MessageStore messageStore = HermesBrowser.getBrowser().getBrowserTree().getSelectedMessageStore();
        h = getMyHermes();
        task = new BrowseMessageStoreTask(h, messageStore, null, null);
        f = messageStore.getId();
      }

      final Hermes hermes = h ;
      final String from = f ;
      JFileChooser chooser;

      if (DirectoryCache.lastSaveAsDirectory == null) {
        chooser = new JFileChooser(new File(HermesBrowser.getBrowser().getRepositoryManager().getDirectory()));
      } else {
        chooser = new JFileChooser(DirectoryCache.lastSaveAsDirectory);
      }

      if (chooser.showDialog(HermesBrowser.getBrowser(), "Save All Messages...") == JFileChooser.APPROVE_OPTION) {
        DirectoryCache.lastSaveAsDirectory = chooser.getCurrentDirectory();

        final File file = chooser.getSelectedFile();
        final List<Message> messages = new ArrayList<Message>();
        final ProgressMonitor progress = new ProgressMonitor(HermesBrowser.getBrowser(), "Saving from " + from + " to " + file.getName(),
            "Browsing...", 0, 3);
        progress.setMillisToPopup(0);
        progress.setMillisToDecideToPopup(0);

        task.addTaskListener(new MessageTaskListener() {

          public void onMessage(Task task, Message message) {
            if (progress.isCanceled()) {
              task.stop();
            }

            messages.add(message);
            progress.setNote(messages.size() + " message" + TextUtils.plural(messages.size()) + " read");
          }

          public void onThrowable(Task task, Throwable t) {
            HermesBrowser.getBrowser().showErrorDialog(t);

          }

          public void onStopped(Task task) {
            if (!progress.isCanceled()) {
              doSave();
            } else {
              Hermes.ui.getDefaultMessageSink().add("Cancelled");
            }
          }

          public void onStatus(Task task, String status) {
            // NOP

          }

          public void onStarted(Task task) {
            Hermes.ui.getDefaultMessageSink().add("Browsing " + from + "...");
            progress.setProgress(1);
          }

          private void doSave() {
            FileOutputStream ostream = null;

            try {
              progress.setProgress(2);
              progress.setNote("Saving to " + file.getName());
              Hermes.ui.getDefaultMessageSink().add("Saving to " + file.getName());
              ostream = new FileOutputStream(file);
              hermes.toXML(messages, ostream);
              ostream.close();
              Hermes.ui.getDefaultMessageSink().add(
                  messages.size() + " message" + TextUtils.plural(messages.size()) + " saved to " + file.getName());

            } catch (Exception ex) {
View Full Code Here

  }

  @Override
  public boolean equals(Object obj) {
    if (obj instanceof Hermes) {
      Hermes other = (Hermes) obj;

      return getId().equals(other.getId());
    } else {
      return false;
    }
  }
View Full Code Here

        final String selector = JOptionPane.showInputDialog(HermesBrowser.getBrowser(), "Enter Selector", "");

        if (!TextUtils.isEmpty(selector)) {
          if (selectionPath.getLastPathComponent() instanceof DestinationConfigTreeNode) {
            final DestinationConfigTreeNode destinationNode = (DestinationConfigTreeNode) selectionPath.getLastPathComponent();
            final Hermes hermes = ((HermesTreeNode) destinationNode.getHermesTreeNode()).getHermes();

            DestinationConfig newConfig = HermesBrowser.getConfigDAO().duplicate(destinationNode.getConfig());
            newConfig.setSelector(selector);

            log.info("browsing " + hermes.getId() + ": " + destinationNode.getDestinationName() + " with user selector " + selector);

            HermesBrowser.getBrowser().getActionFactory().createQueueBrowseAction(hermes, newConfig);
          } else if (selectionPath.getLastPathComponent() instanceof MessageStoreTreeNode) {
            final MessageStoreTreeNode node = (MessageStoreTreeNode) selectionPath.getLastPathComponent();
            final Hermes hermes = HermesBrowser.getBrowser().getBrowserTree().getHermesAsMessageFactory();

            HermesBrowser.getBrowser().getActionFactory().createMessageStoreBrowseAction(node.getMessageStore(), hermes, selector);

          } else if (selectionPath.getLastPathComponent() instanceof MessageStoreQueueTreeNode) {
            final MessageStoreQueueTreeNode queueNode = (MessageStoreQueueTreeNode) selectionPath.getLastPathComponent();

            if (queueNode.getParent() instanceof MessageStoreTreeNode) {
              final MessageStoreTreeNode storeNode = (MessageStoreTreeNode) queueNode.getParent();
              final Hermes hermes = HermesBrowser.getBrowser().getBrowserTree().getHermesAsMessageFactory();

              HermesBrowser.getBrowser().getActionFactory()
                  .createMessageStoreBrowseAction(storeNode.getMessageStore(), hermes, (Queue) queueNode.getBean(), selector);

            }
          } else if (selectionPath.getLastPathComponent() instanceof MessageStoreTopicTreeNode) {
            final MessageStoreTopicTreeNode topicNode = (MessageStoreTopicTreeNode) selectionPath.getLastPathComponent();

            if (topicNode.getParent() instanceof MessageStoreTreeNode) {
              final MessageStoreTreeNode storeNode = (MessageStoreTreeNode) topicNode.getParent();
              final Hermes hermes = HermesBrowser.getBrowser().getBrowserTree().getHermesAsMessageFactory();

              HermesBrowser.getBrowser().getActionFactory()
                  .createMessageStoreBrowseAction(storeNode.getMessageStore(), hermes, (Topic) topicNode.getBean(), selector);
            }
          }
View Full Code Here

  private String[] getDestinations(Domain domain, String hermesId) {
    Context ctx = HermesBrowser.getBrowser().getLoader().getContext();
    ArrayList<String> destinations = new ArrayList<String>();

    try {
      Hermes hermes = (Hermes) ctx.lookup(hermesId);

      for (Iterator<DestinationConfig> iter = hermes.getDestinations(); iter.hasNext();) {
        final DestinationConfig destinationConfig = iter.next();

        if (destinationConfig.getDomain() == domain.getId()) {
          if (destinationConfig.getDomain() == Domain.TOPIC.getId()) {
            if (destinations.contains(destinationConfig.getName())) {
View Full Code Here

    try {
      for (NamingEnumeration iter = ctx.listBindings(""); iter.hasMoreElements();) {
        final Binding binding = (Binding) iter.next();

        if (binding.getObject() instanceof Hermes) {
          final Hermes hermes = (Hermes) binding.getObject();
          hermesIds.add(binding.getName());
        }
      }
    } catch (NamingException ex) {
      HermesBrowser.getBrowser().showErrorDialog(ex);
View Full Code Here

    }
    return null;
  }

  protected void replay() {
    Hermes hermes = getSelectedHermes();
    DestinationConfig dConfig = getSelectedDestination();

    if (hermes != null && dConfig != null) {
      ThreadPool.get().invokeLater(new ReplayMessagesFromStoreTask(store, hermes, dConfig));
    }
View Full Code Here

TOP

Related Classes of hermes.Hermes

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.