Package org.fusesource.ide.jmx.commons.messages

Examples of org.fusesource.ide.jmx.commons.messages.Exchange


      } else if (value != null) {
        headers.put(key, value);
      }
    }
    Set<Entry<String, Object>> entrySet = headers.entrySet();
    return new Exchange(message);
  }
View Full Code Here


    Collections.sort((List)temp);
   
    // then update the exchange index, if missing
    for (IExchange ie : temp) {
      if (ie instanceof Exchange) {
        Exchange exchange = (Exchange) ie;
        if (exchange.getExchangeIndex() == null) {
          ie.getIn().setExchangeIndex(counter.incrementAndGet());
        }
      }
    }
View Full Code Here

      return answer;
    }
   
    public IExchange createExchange(BacklogTracerEventMessage traceMessage) throws JAXBException, SAXException {
      String xml = traceMessage.getMessageAsXml();
      Exchange exchange = null;
      if (!Strings.isBlank(xml)) {
        exchange = Exchanges.unmarshalNoNamespaceXmlString(xml);
      }
      if (exchange == null) {
        exchange = new Exchange();
      }
      IMessage in = exchange.getIn();
      in.setToNode(traceMessage.getToNode());
      in.setUuid(traceMessage.getUid());
      Date timestamp = traceMessage.getTimestamp();
      if (timestamp != null) {
        in.setTimestamp(timestamp);
        long time = timestamp.getTime();
        long relative = 0;
        boolean first = false;
        if (firstExchangeTimeMs == null) {
          firstExchangeTimeMs = time;
          first = true;
        } else {
          relative = time - firstExchangeTimeMs;
        }
        long elapsed = relative - lastTime;
        lastTime = relative;
        in.setRelativeTime(relative);
        if (!first) {
          in.setElapsedTime(elapsed);
        }
      }
      exchange.setId(traceMessage.getExchangeId());
     
      return exchange;
    }
View Full Code Here

      long size = browsable.queueSize();
      try {
        for (int i = 0; i < size; i++) {
          String xml = browsable.browseMessageAsXml(i, true);
          if (xml != null) {
            Exchange exchange = Exchanges.unmarshalNoNamespaceXmlString(xml);
            if (exchange != null) {
              IMessage in = exchange.getIn();
              if (in != null) {
                in.setEndpointUri(getEndpointUri());
              }
              answer.add(exchange);
            }
View Full Code Here

    if (browser instanceof ITraceExchangeBrowser) {
      final Function1 function = new Function1() {
        @Override
        public Object apply(Object element) {
          Exchange exchange = Exchanges.asExchange(element);
          if (exchange != null) {
            return exchange.getExchangeIndex();
          }
          return null;
        }
      };
      column = addColumnFunction(bounds, column, function, "Trace ID");
    }

    // TODO add exchange / message ID??
    if (browser instanceof ITraceExchangeBrowser) {
      if (showTraceExchangeId) {
        final Function1 function = new Function1() {
          @Override
          public Object apply(Object element) {
            Exchange exchange = Exchanges.asExchange(element);
            if (exchange != null) {
              return exchange.getId();
            }
            return null;
          }
        };
        column = addColumnFunction(bounds, column, function, "Exchange ID");
      }
    }
    if (showBody) {
      final Function1 function = new Function1() {
        @Override
        public Object apply(Object element) {
          if (element instanceof IExchange) {
            IExchange exchange = (IExchange) element;
            String answer = MessageUIHelper.getBody(exchange);
            if (answer != null) {
              // lets replace newlines
              return answer.replace('\n', ' ');
            }
          }
          return null;
        }
      };
      column = addColumnFunction(bounds, column, function, "Message Body");
    }

    SortedSet<String> headers = new TreeSet<String>();
    for (IExchange exchange : exchanges) {
      IMessage in = exchange.getIn();
      if (in != null) {
        headers.addAll(in.getHeaders().keySet());
      }
    }
    for (final String header : headers) {
      final Function1 function = new Function1() {
        @Override
        public Object apply(Object element) {
          if (element instanceof IExchange) {
            IExchange exchange = (IExchange) element;
            IMessage in = exchange.getIn();
            if (in != null) {
              return in.getHeaders().get(header);
            }
          }
          return null;
View Full Code Here

  }

  @Override
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    Object firstSelection = Selections.getFirstSelection(selection);
    Exchange exchange = Exchanges.asExchange(firstSelection);
    setSelectedExchange(exchange);
  }
View Full Code Here

TOP

Related Classes of org.fusesource.ide.jmx.commons.messages.Exchange

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.