Package io.fabric8.patch

Examples of io.fabric8.patch.Patch


  }

  @Override
  public INodeStatistics getNodeStats(String nodeId) {
    if (nodeId != null) {
      CamelProcessorMBean processorMBean = camelContextNode.getProcessorMBean(nodeId);
      if (processorMBean != null) {
        return new ProcessorNodeStatistics(processorMBean);
      }
    }
    return null;
View Full Code Here


   * @see
   * org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
   */
  @Override
  public Image getImage(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return getLevelImage(le);
    }
    return super.getImage(element);
  }
View Full Code Here

   * @see
   * org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
   */
  @Override
  public String getText(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return le.getLevel();
    }
    return super.getText(element);
  }
View Full Code Here

   * org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.
   * Object)
   */
  @Override
  public String getToolTipText(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return le.getMessage();
    }
    return super.getToolTipText(element);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.jface.viewers.ColumnLabelProvider#getBackground(java.lang.Object)
   */
  @Override
  public Color getBackground(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return getBackgroundForLevel(le);
    }
    return super.getBackground(element);
  }
View Full Code Here

    int column = 0;
    clearColumns();
    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null) {
          return log.getTimestamp();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Time");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null) {
          return log.getHost();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Host");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null) {
          return log.getContainerName();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Container");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null) {
          return log.getLevel();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Level", new LogLevelImageProvider());
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null) {
          return log.getLogger();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Logger");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null) {
          return log.getThread();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Thread");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null) {
          return log.getMessage();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Message");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        return element;
      }
    };
    column = addColumnFunction(bounds, column, function, "Location", new LocationLabelProvider());
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null) {
          return log.getProperties();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Properties");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null) {
          return log.getSeq();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "ID");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEvent log = toLogEvent(element);
        if (log != null && log.getException() != null) {
          StringBuffer sb = new StringBuffer();
          for (String s : log.getException()) {
            sb.append(s);
            sb.append('\n');
          }
          return sb.toString();
        }
View Full Code Here

    this.view = view;
  }

  @Override
  public void run() {
    LogEvent event = view.getSelectedEvent();
    if (event == null) {
      return;
    }
    StringBuffer buf = new StringBuffer();
    String[] lines = event.getException();
    if (lines != null && lines.length > 0) {
      for (int i = 0; i < lines.length; i++) {
        buf.append(lines[i]).append(NEW_LINE);
      }
    } else {
      // lets use the location of the
      String className = event.getClassName();
      String methodName = event.getMethodName();
      String fileName = event.getFileName();
      String lineNumber = event.getLineNumber();
      if (Strings.isBlank(className) || Strings.isBlank(methodName)
          || Strings.isBlank(fileName) || Strings.isBlank(lineNumber)) {
        return;
      }
      buf.append(event.getMessage()).append(NEW_LINE);
      buf.append("\tat " + className + "." + methodName + "(" + fileName + ":" + lineNumber + ")").append(NEW_LINE);
      ;
    }
    // check that the user did not remove our console from the ConsoleView
    boolean stillRegistered = checkRegistration();
View Full Code Here

   * @see org.eclipse.jface.viewers.StyledCellLabelProvider#update(org.eclipse.jface.viewers.ViewerCell)
   */
  @Override
  public void update(ViewerCell cell) {
    Object element = cell.getElement();
    LogEvent log = LogViewTabSection.toLogEvent(element);
    if (log != null) {
      String className = log.getClassName();
      // we don't want to display ? as location
      if (className.trim().equals("?"))
        className = null;
      if (className != null) {
        Styler style = null;
        StyledString styledString = new StyledString(className, style);
        String fileName = log.getFileName();
        if (fileName != null) {
          styledString.append(fileName, StyledString.COUNTER_STYLER);
        }
        cell.setText(styledString.toString());
        cell.setStyleRanges(styledString.getStyleRanges());
View Full Code Here

          Long seq = JsonHelper.getAsLong(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_SEQ);
          String threadName = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_THREAD);
          Date eventTimestamp = new Date(JsonHelper.getAsLong(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_TIMESTAMP));
          Map<String, String> propertiesMap = JsonHelper.getAsPropertiesMap(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_PROPERTIES);
         
          LogEvent event = new LogEvent();
          event.setClassName(className);
          event.setContainerName(container);
          event.setException(exception);
          event.setFileName(fileName);
          event.setHost(Strings.isBlank(eventhost) ? host : eventhost);
          event.setLevel(logLevel);
          event.setLineNumber(lineNo);
          event.setLogger(logger);
          event.setMessage(logMessage);
          event.setMethodName(methodName);
          event.setSeq(seq);
          event.setThread(threadName);
          event.setTimestamp(eventTimestamp);
          event.setProperties(propertiesMap);
         
          res.addEvent(event);
        }
       
        return res.getEvents();
View Full Code Here

        final ModelNode rootNode = JsonHelper.getModelNode(json);
        final String host = JsonHelper.getAsString(rootNode, IFabric8JsonConstants.PROPERTY_LOGRESULTS_HOST);
        final Long from = JsonHelper.getAsLong(rootNode, IFabric8JsonConstants.PROPERTY_LOGRESULTS_FROM);
        final Long to = JsonHelper.getAsLong(rootNode, IFabric8JsonConstants.PROPERTY_LOGRESULTS_TO);
       
        LogResults res = new LogResults();
        res.setHost(host);
        res.setFromTimestamp(from);
        res.setToTimestamp(to);
       
        final List<ModelNode> events = JsonHelper.getAsList(rootNode, IFabric8JsonConstants.PROPERTY_LOGRESULTS_EVENTS);
        for (ModelNode ev : events) {
          String className = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_CLASS);
          String container = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_CONTAINER);
          String[] exception = JsonHelper.getAsStringArray(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_EXCEPTION);
          String fileName = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_FILE);
          String eventhost = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_HOST);
          String logLevel = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_LOGLEVEL);
          String lineNo = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_LINE);
          String logger = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_LOGGER);
          String logMessage = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_MESSAGE);
          String methodName = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_METHOD);
          Long seq = JsonHelper.getAsLong(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_SEQ);
          String threadName = JsonHelper.getAsString(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_THREAD);
          Date eventTimestamp = new Date(JsonHelper.getAsLong(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_TIMESTAMP));
          Map<String, String> propertiesMap = JsonHelper.getAsPropertiesMap(ev, IFabric8JsonConstants.PROPERTY_LOGEVENT_PROPERTIES);
         
          LogEvent event = new LogEvent();
          event.setClassName(className);
          event.setContainerName(container);
          event.setException(exception);
          event.setFileName(fileName);
          event.setHost(Strings.isBlank(eventhost) ? host : eventhost);
          event.setLevel(logLevel);
          event.setLineNumber(lineNo);
          event.setLogger(logger);
          event.setMessage(logMessage);
          event.setMethodName(methodName);
          event.setSeq(seq);
          event.setThread(threadName);
          event.setTimestamp(eventTimestamp);
          event.setProperties(propertiesMap);
         
          res.addEvent(event);
        }
       
        return res.getEvents();
      }
    });
  }
View Full Code Here

TOP

Related Classes of io.fabric8.patch.Patch

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.