Package org.fusesource.ide.fabric8.ui.actions.jclouds

Examples of org.fusesource.ide.fabric8.ui.actions.jclouds.CloudDetailsEditAction


     * (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

      String filterJson = JsonHelper.convertToJson(filter);
      J4pExecRequest request = JolokiaHelpers.createExecRequest(INSIGHT_MBEAN_URL, "filterLogEvents(java.lang.String)", filterJson);
          J4pExecResponse response = getJolokiaClient().execute(request);
          String json = response.getValue();
          final ModelNode rootNode = JsonHelper.getModelNode(json);
      LogResultsDTO result = LogResultsDTO.fromJson(rootNode);
      return result;
    } catch (Exception e) {
      Fabric8CorePlugin.getLogger().error("Failed to query the logs", e);
    }
    return null;
View Full Code Here

  @Override
  public void queryLogs(LogContext context, boolean filterChanged) {
    Fabric8Facade fabricService = getFabricService();
    if (fabricService == null) return;
    LogResultsDTO res = fabricService.queryLog(context.getLogFilter());
   
    List<LogEventDTO> logs = res.getLogEvents();
    if (this.node instanceof ContainerNode) {
      // filter container
      String containerId = ((ContainerNode)this.node).getId();
      List<LogEventDTO> unwantedEntries = new ArrayList<LogEventDTO>();
      for (LogEventDTO ev : logs) {
        if (!ev.getContainer().equalsIgnoreCase(containerId)) {
          unwantedEntries.add(ev);
        }
      }
      logs.removeAll(unwantedEntries);
    }
   
    context.addLogResults(logs);
    context.getLogFilter().setAfterTimestamp(res.getTo())
    context.getLogFilter().setBeforeTimestamp(System.currentTimeMillis());
  }
View Full Code Here

      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "getProfiles(java.lang.String)", versionId);
            J4pExecResponse response = getJolokiaClient().execute(request);
            List<Map<String, Object>> values = response.getValue();
            for (Map<String, Object> value : values) {
              ProfileDTO p = new ProfileDTO(fabricFacade, value);
              if (p.isHidden()) {
                continue; // don't return hidden profiles
              }
              profiles.add(p);
            }
        } catch (Exception e) {
View Full Code Here

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

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

TOP

Related Classes of org.fusesource.ide.fabric8.ui.actions.jclouds.CloudDetailsEditAction

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.