Example #1
0
  public void execute(SensorContext context) {
    Collection<PostJob> postJobs = selector.select(PostJob.class, project, true, null);

    eventBus.fireEvent(new PostJobPhaseEvent(Lists.newArrayList(postJobs), true));
    execute(context, postJobs);
    eventBus.fireEvent(new PostJobPhaseEvent(Lists.newArrayList(postJobs), false));
  }
Example #2
0
  private void execute(SensorContext context, Collection<PostJob> postJobs) {
    logPostJobs(postJobs);

    for (PostJob postJob : postJobs) {
      LOG.info("Executing post-job {}", postJob.toString());
      eventBus.fireEvent(new PostJobExecutionEvent(postJob, true));
      postJob.executeOn(project, context);
      eventBus.fireEvent(new PostJobExecutionEvent(postJob, false));
    }
  }
Example #3
0
  public void execute(SensorContext context) {
    Collection<Sensor> sensors = selector.select(Sensor.class, module, true, null);
    eventBus.fireEvent(new SensorsPhaseEvent(Lists.newArrayList(sensors), true));

    for (Sensor sensor : sensors) {
      executeSensor(context, sensor);
    }

    eventBus.fireEvent(new SensorsPhaseEvent(Lists.newArrayList(sensors), false));
  }
 public void execute() {
   if (analysisMode.isPreview()) {
     // Decorators are not executed in preview mode
     return;
   }
   Collection<Decorator> decorators = decoratorsSelector.select(project);
   eventBus.fireEvent(new DecoratorsPhaseEvent(Lists.newArrayList(decorators), true));
   ((DefaultDecoratorContext) decorateResource(project, decorators, true)).end();
   eventBus.fireEvent(new DecoratorsPhaseEvent(Lists.newArrayList(decorators), false));
 }
Example #5
0
  public void execute(SensorContext context) {
    Collection<Sensor> sensors = selector.select(Sensor.class, module, true, sensorMatcher);
    eventBus.fireEvent(new SensorsPhaseEvent(Lists.newArrayList(sensors), true));

    for (Sensor sensor : sensors) {
      // SONAR-2965 In case the sensor takes too much time we close the session to not face a
      // timeout
      session.commitAndClose();

      executeSensor(context, sensor);
    }

    eventBus.fireEvent(new SensorsPhaseEvent(Lists.newArrayList(sensors), false));
  }
  void executeDecorator(Decorator decorator, DefaultDecoratorContext context, Resource resource) {
    try {
      eventBus.fireEvent(new DecoratorExecutionEvent(decorator, true));
      decorator.decorate(resource, context);
      eventBus.fireEvent(new DecoratorExecutionEvent(decorator, false));

    } catch (MessageException e) {
      throw e;

    } catch (Exception e) {
      // SONAR-2278 the resource should not be lost in exception stacktrace.
      throw new SonarException("Fail to decorate '" + resource + "'", e);
    }
  }
Example #7
0
 private void executeSensor(SensorContext context, Sensor sensor) {
   eventBus.fireEvent(new SensorExecutionEvent(sensor, true));
   executeMavenPlugin(sensor);
   sensor.analyse(module, context);
   eventBus.fireEvent(new SensorExecutionEvent(sensor, false));
 }