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 com.google.common.annotations.Beta;
023import java.util.Date;
024import javax.annotation.CheckForNull;
025import org.sonar.api.ExtensionPoint;
026import org.sonar.api.ce.ComputeEngineSide;
027
028/**
029 * Extension point of which any plugin can provide an implementation and will allow them to be notified whenever some
030 * analysis report processing ends in the Compute Engine.
031 *
032 * <p>
033 * If more then one implementation of {@link PostProjectAnalysisTask} is found, they will be executed in no specific order.
034 * 
035 *
036 * <p>
037 * Class {@link PostProjectAnalysisTaskTester} is provided to write unit tests of implementations of this interface.
038 * 
039 *
040 * @since 5.5
041 * @see PostProjectAnalysisTaskTester
042 */
043@ExtensionPoint
044@ComputeEngineSide
045@Beta
046public interface PostProjectAnalysisTask {
047  /**
048   * This method is called whenever the processing of a Project analysis has finished, whether successfully or not.
049   */
050  void finished(ProjectAnalysis analysis);
051
052  /**
053   * @since 5.5
054   */
055  @Beta
056  interface ProjectAnalysis {
057    /**
058     * Details of the Compute Engine task in which the project analysis was run.
059     */
060    CeTask getCeTask();
061
062    /**
063     * Details of the analyzed project.
064     */
065    Project getProject();
066
067    /**
068     * Status and details of the Quality Gate of the project (if any was configured on the project).
069     */
070    @CheckForNull
071    QualityGate getQualityGate();
072
073    /**
074     * Date of the analysis.
075     * <p>
076     * This date is the same as the date of the project analysis report and the snapshot.
077     * 
078     */
079    Date getDate();
080  }
081}