Esempio n. 1
0
 public List<RequestMapping> getRequestMappings() {
   try {
     String json = rest.getForObject(target + "/mappings", String.class);
     if (json != null) {
       // System.out.println("Got some json:\n"+json);
       return parse(json);
     }
   } catch (Exception e) {
     BootDashActivator.log(e);
   }
   return null;
 }
Esempio n. 2
0
 /**
  * Returns the raw string found in the requestmapping info. This is a 'toString' value of
  * java.lang.reflect.Method object.
  */
 public String getMethodString() {
   try {
     if (beanInfo != null) {
       if (beanInfo.has("method")) {
         return beanInfo.getString("method");
       }
     }
   } catch (Exception e) {
     BootDashActivator.log(e);
   }
   return null;
 }
  @Override
  protected synchronized void doCloudOp(IProgressMonitor monitor)
      throws Exception, OperationCanceledException {
    model.setState(RefreshState.LOADING);
    try {

      // 1. Fetch basic list of applications. Should be the "faster" of
      // the
      // two refresh operations

      List<CloudApplication> apps = requests.getApplicationsWithBasicInfo();

      Map<CloudAppInstances, IProject> updatedApplications =
          new HashMap<CloudAppInstances, IProject>();
      if (apps != null) {

        Map<String, String> existingProjectToAppMappings =
            this.model.getProjectToAppMappingStore().getMapping();

        for (CloudApplication app : apps) {

          String projectName = existingProjectToAppMappings.get(app.getName());
          IProject project = null;
          if (projectName != null) {
            project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
            if (project == null || !project.isAccessible()) {
              project = null;
            }
          }

          // No stats available at this stage. Just set stats to null
          // for now.
          updatedApplications.put(new CloudAppInstances(app, null), project);
        }
      }

      this.model.updateElements(updatedApplications);

      // 2. Launch the slower app stats/instances refresh operation.
      this.model.getOperationsExecution().runOpAsynch(new AppInstancesRefreshOperation(this.model));
      this.model.getOperationsExecution().runOpAsynch(new HealthCheckRefreshOperation(this.model));
      model.setState(RefreshState.READY);
    } catch (Exception e) {
      model.setState(RefreshState.error(e));
      BootDashActivator.log(e);
    }
  }