001/*
002 * SonarQube
003 * Copyright (C) 2009-2016 SonarSource SA
004 * mailto:contact AT sonarsource DOT com
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.api.ce.posttask;
021
022import java.util.Date;
023import javax.annotation.CheckForNull;
024import org.sonar.api.ExtensionPoint;
025import org.sonar.api.ce.ComputeEngineSide;
026
027/**
028 * Extension point of which any plugin can provide an implementation and will allow them to be notified whenever some
029 * analysis report processing ends in the Compute Engine.
030 *
031 * <p>
032 * If more then one implementation of {@link PostProjectAnalysisTask} is found, they will be executed in no specific order.
033 * 
034 *
035 * <p>
036 * Class {@link PostProjectAnalysisTaskTester} is provided to write unit tests of implementations of this interface.
037 * 
038 *
039 * @since 5.5
040 * @see PostProjectAnalysisTaskTester
041 */
042@ExtensionPoint
043@ComputeEngineSide
044public interface PostProjectAnalysisTask {
045  /**
046   * This method is called whenever the processing of a Project analysis has finished, whether successfully or not.
047   */
048  void finished(ProjectAnalysis analysis);
049
050  /**
051   * @since 5.5
052   */
053  interface ProjectAnalysis {
054    /**
055     * Details of the Compute Engine task in which the project analysis was run.
056     */
057    CeTask getCeTask();
058
059    /**
060     * Details of the analyzed project.
061     */
062    Project getProject();
063
064    /**
065     * Status and details of the Quality Gate of the project (if any was configured on the project).
066     */
067    @CheckForNull
068    QualityGate getQualityGate();
069
070    /**
071     * Date of the analysis.
072     * <p>
073     * This date is the same as the date of the project analysis report and the snapshot.
074     * 
075     */
076    Date getDate();
077  }
078}