All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.hortis.sonar.mvn.mc.MetricsCollector Maven / Gradle / Ivy

/*
 * This program is copyright (c) 2007 Hortis-GRC SA.
 * 
 * This file is part of Sonar.
 * Sonar is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 2 of the License, or 
 * (at your option) any later version.
 * 
 * Sonar is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License 
 * along with Sonar; if not, write to the Free Software 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 */
package ch.hortis.sonar.mvn.mc;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;

import java.util.Collection;

/**
 * Base interface of a report plugins metrics collector, the metric collector has multiple life cycle phases
 */
public interface MetricsCollector {

  /**
   * first lifecycle phase : Enable the logging of the metric collector
   *
   * @param log the logger
   */
  public void enableLogging( Log log );

  /**
   * second lifecycle phase : Preparing the collection of metrics
   */
  public boolean initialize( MavenProject project ) throws MojoExecutionException;

  /**
   * final lifecycle phase : Collect metrics for a given maven project and report plugin. The scope of the collected metrics is at the project level
   * Meaning that the returned metrics should represent a sum of metrics data for the whole project.
   *
   * @return a collection of project metrics for the given report plugin or null if no metrics can be collected
   * @throws MojoExecutionException if some errors occurs such as parsing errors.
   */
  public Collection collectMeasures() throws MojoExecutionException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy