--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.ce.posttask;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * @since 5.5
+ */
+@Beta
+public interface CeTask {
+ /**
+ * Id of the Compute Engine task.
+ * <p>
+ * This is the id under which the processing of the project analysis report has been added to the Compute Engine
+ * queue.
+ * </p>
+ */
+ String getId();
+
+ /**
+ * Indicates whether the Compute Engine task ended successfully or not.
+ */
+ Status getStatus();
+
+ enum Status {
+ SUCCESS, FAILED
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.ce.posttask;
+
+import com.google.common.annotations.Beta;
+import java.util.Date;
+import javax.annotation.CheckForNull;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ce.ComputeEngineSide;
+
+/**
+ * Extension point of which any plugin can provide an implementation and will allow them to be notified whenever some
+ * analysis report processing ends in the Compute Engine.
+ *
+ * If more then one implementation of {@link PostProjectAnalysisTask} is found, they will be executed in no specific order.
+ *
+ * @since 5.5
+ */
+@ExtensionPoint
+@ComputeEngineSide
+@Beta
+public interface PostProjectAnalysisTask {
+ /**
+ * This method is called whenever the processing of a Project analysis has finished, whether successfully or not.
+ */
+ void finished(ProjectAnalysis analysis);
+
+ /**
+ * @since 5.5
+ */
+ @Beta
+ interface ProjectAnalysis {
+ /**
+ * Details of the Compute Engine task in which the project analysis was run.
+ */
+ CeTask getCeTask();
+
+ /**
+ * Details of the analyzed project.
+ */
+ Project getProject();
+
+ /**
+ * Status and details of the Quality Gate of the project (if any was configured on the project).
+ */
+ @CheckForNull
+ QualityGate getQualityGate();
+
+ /**
+ * Date of the analysis.
+ * <p>
+ * This date is the same as the date of the project analysis report and the snapshot.
+ * </p>
+ */
+ Date getDate();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.ce.posttask;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * @since 5.5
+ */
+@Beta
+public interface Project {
+ String getUuid();
+
+ String getKey();
+
+ String getName();
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.ce.posttask;
+
+import com.google.common.annotations.Beta;
+import java.util.Collection;
+import javax.annotation.CheckForNull;
+import org.sonar.api.measures.Metric;
+
+/**
+ * @since 5.5
+ */
+@Beta
+public interface QualityGate {
+ /**
+ * The unique identifier of the Quality Gate.
+ */
+ String getId();
+
+ /**
+ * Name of the Quality Gate.
+ */
+ String getName();
+
+ /**
+ * Status of the Quality Gate for the current project processing.
+ */
+ Status getStatus();
+
+ /**
+ * Conditions of the Quality Gate.
+ */
+ Collection<Condition> getConditions();
+
+ @Beta
+ enum Status {
+ /** at least one threshold is defined, no threshold is reached */
+ OK,
+ /** at least one warning threshold is reached, no error threshold is reached */
+ WARN,
+ /** at least one error threshold is reached */
+ ERROR
+ }
+
+ @Beta
+ interface Condition {
+ /**
+ * Evaluation status of this condition
+ */
+ EvaluationStatus getStatus();
+
+ /**
+ * The key of the metric this condition has been evaluated on.
+ * <p>
+ * The {@link org.sonar.api.measures.Metric} for the returned key can be retrieved using a
+ * {@link org.sonar.api.measures.MetricFinder} instance.
+ * </p>
+ *
+ * @see org.sonar.api.batch.measure.MetricFinder#findByKey(String)
+ */
+ String getMetricKey();
+
+ /**
+ * The operator used to evaluate the error and/or warning thresholds against the value of the measure
+ */
+ Operator getOperator();
+
+ /**
+ * <p>
+ * At least one of {@link #getErrorThreshold()} and {@link #getWarningThreshold()} is guaranteed to be non {@code null}.
+ * </p>
+ *
+ * @see #getWarningThreshold()
+ */
+ @CheckForNull
+ String getErrorThreshold();
+
+ /**
+ *
+ * <p>
+ * At least one of {@link #getErrorThreshold()} and {@link #getWarningThreshold()} is guaranteed to be non {@code null}.
+ * </p>
+ *
+ * @see #getErrorThreshold()
+ */
+ @CheckForNull
+ String getWarningThreshold();
+
+ /**
+ * Whether this condition is defined on the leak period or on an absolute value
+ */
+ boolean isOnLeakPeriod();
+
+ /**
+ * The value of the measure.
+ * <p>
+ * If the type of the metric (which key is provided by {@link #getMetricKey()}) is numerical, the value can be parsed
+ * using {@link Integer#valueOf(String)}, {@link Long#valueOf(String)} or {@link Double#valueOf(String)}.
+ * </p>
+ *
+ * @throws IllegalStateException if {@link #getStatus()} is {@link EvaluationStatus#NO_VALUE}
+ *
+ * @see Metric#getType()
+ */
+ String getValue();
+
+ }
+
+ /**
+ * Quality Gate condition operator.
+ */
+ @Beta
+ enum Operator {
+ EQUALS, NOT_EQUALS, GREATER_THAN, LESS_THAN
+ }
+
+ /**
+ * Quality gate condition evaluation status.
+ */
+ @Beta
+ enum EvaluationStatus {
+ /**
+ * No measure found or measure had no value. The condition has not been evaluated and therefor ignored in
+ * the computation of the Quality Gate status.
+ */
+ NO_VALUE,
+ /**
+ * Condition evaluated as OK, neither error nor warning thresholds have been reached.
+ */
+ OK,
+ /**
+ * Condition evaluated as WARN, only warning thresholds has been reached.
+ */
+ WARN,
+ /**
+ * Condition evaluated as ERROR, error thresholds has been reached (and most likely warning thresholds too).
+ */
+ ERROR
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.api.ce.posttask;
+
+import javax.annotation.ParametersAreNonnullByDefault;