Package org.fusesource.ide.fabric8.core.dto

Examples of org.fusesource.ide.fabric8.core.dto.LogEventDTO


     * (non-Javadoc)
     * @see org.fusesource.ide.fabric8.core.connector.Fabric8ConnectorType#getContainer(java.lang.String)
     */
    @Override
    public ContainerDTO getContainer(String containerId) {
      ContainerDTO container = null;
      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "getContainer(java.lang.String)", containerId);
            J4pExecResponse response = getJolokiaClient().execute(request);
            Map<String, Object> values = response.getValue();
            container = new ContainerDTO(this.fabricFacade, values);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to fetch container with ID '" + containerId + "' from fabric8.", e);
        }
      return container;
    }
View Full Code Here


    /* (non-Javadoc)
     * @see org.fusesource.ide.fabric8.core.connector.Fabric8ConnectorType#getCurrentContainer()
     */
    @Override
    public ContainerDTO getCurrentContainer() {
      ContainerDTO container = null;
      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "currentContainer()");
            J4pExecResponse response = getJolokiaClient().execute(request);
            Map<String, Object> values = response.getValue();
            container = new ContainerDTO(this.fabricFacade, values);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to fetch current container from fabric8.", e);
        }
      return container;
    }
View Full Code Here

  /* (non-Javadoc)
   * @see org.fusesource.ide.fabric8.core.connector.Fabric8ConnectorType#getFabricStatus()
   */
  @Override
  public FabricStatusDTO getFabricStatus() {
    FabricStatusDTO status = null;
    try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "fabricStatusAsJson()");
            J4pExecResponse response = getJolokiaClient().execute(request);
            String json = response.getValue();
            final ModelNode rootNode = JsonHelper.getModelNode(json);
View Full Code Here

public class LocationLabelProvider extends StyledCellLabelProvider {

  @Override
  public void update(ViewerCell cell) {
    Object element = cell.getElement();
    LogEventDTO log = (LogEventDTO)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

    clearColumns();

    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getEventTimestamp();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Time");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getEventhost();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Host");


    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getContainer();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Container");


    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getLogLevel();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Level", new LogLevelImageProvider());

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getLogger();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Category");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getThreadName();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Thread");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          String msg = log.getLogMessage();
          if (msg.indexOf('\n') != -1) {
            return log.getLogMessage().substring(0, log.getLogMessage().indexOf('\n'));
          }
          return log.getLogMessage();
        }
        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) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getPropertiesMap();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Properties");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getSeq();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "ID");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getException();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Exception");
View Full Code Here

    return true;
  }
 
  @Override
  public void run() {
    LogEventDTO event = view.getSelectedEvent();
    if (event == null) {
      return;
    }

    //check that the user did not remove our console from the ConsoleView
    boolean stillRegistered = checkRegistration();
    if (!stillRegistered) {
      registerConsole();
    }

    console.clearConsole();
    console.getDocument().set(event.toString());
    ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console);
  }
View Full Code Here

   * @see
   * org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
   */
  @Override
  public Image getImage(Object element) {
    LogEventDTO le = (LogEventDTO)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) {
    LogEventDTO le = (LogEventDTO)element;
    if (le != null) {
      return le.getLogLevel();
    }
    return super.getText(element);
  }
View Full Code Here

   * org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.
   * Object)
   */
  @Override
  public String getToolTipText(Object element) {
    LogEventDTO le = (LogEventDTO)element;
    if (le != null) {
      return le.getLogMessage();
    }
    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) {
    LogEventDTO le = (LogEventDTO)element;
    if (le != null) {
      return getBackgroundForLevel(le);
    }
    return super.getBackground(element);
  }
View Full Code Here

TOP

Related Classes of org.fusesource.ide.fabric8.core.dto.LogEventDTO

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.