diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-03-27 07:21:33 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-03-31 15:14:42 +0400 |
commit | 839e764f272932b2a01450d7b3e2a97a4cf06746 (patch) | |
tree | 01699aa30acdc47bb13b8921d05b8c4d34911b66 /sonar-plugin-api | |
parent | f9e8c73f19309058017cf0b38c7ec0c4d5df7494 (diff) | |
download | sonarqube-839e764f272932b2a01450d7b3e2a97a4cf06746.tar.gz sonarqube-839e764f272932b2a01450d7b3e2a97a4cf06746.zip |
SONAR-2279 API : new extension points to handle lifecycle events
Diffstat (limited to 'sonar-plugin-api')
6 files changed, 277 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/DecoratorExecutionHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/DecoratorExecutionHandler.java new file mode 100644 index 00000000000..0db117a37de --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/DecoratorExecutionHandler.java @@ -0,0 +1,47 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.api.batch.events; + +import org.sonar.api.batch.Decorator; + +/** + * @since 2.8 + */ +public interface DecoratorExecutionHandler extends EventHandler { + + /** + * This interface is not intended to be implemented by clients. + */ + public interface DecoratorExecutionEvent { + + Decorator getDecorator(); + + boolean isStart(); + + boolean isEnd(); + + } + + /** + * Called before and after execution of {@link Decorator}. + */ + void onDecoratorExecution(DecoratorExecutionEvent event); + +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/DecoratorsPhaseHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/DecoratorsPhaseHandler.java new file mode 100644 index 00000000000..c6a218078cb --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/DecoratorsPhaseHandler.java @@ -0,0 +1,52 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.api.batch.events; + +import org.sonar.api.batch.Decorator; + +import java.util.List; + +/** + * @since 2.8 + */ +public interface DecoratorsPhaseHandler extends EventHandler { + + /** + * This interface is not intended to be implemented by clients. + */ + public interface DecoratorsPhaseEvent { + + /** + * @return list of Decorators in the order of execution + */ + List<Decorator> getDecorators(); + + boolean isStart(); + + boolean isEnd(); + + } + + /** + * Called before and after execution of all {@link Decorator}s. + */ + void onDecoratorsPhase(DecoratorsPhaseEvent event); + +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java new file mode 100644 index 00000000000..c05d945c42b --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java @@ -0,0 +1,32 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.api.batch.events; + +import org.sonar.api.BatchExtension; + +/** + * Marker interface for event handlers. + * This interface is not intended to be implemented by clients. + * + * @since 2.8 + */ +public interface EventHandler extends BatchExtension { + +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/ProjectAnalysisHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/ProjectAnalysisHandler.java new file mode 100644 index 00000000000..110a4b5f475 --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/ProjectAnalysisHandler.java @@ -0,0 +1,47 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.api.batch.events; + +import org.sonar.api.resources.Project; + +/** + * @since 2.8 + */ +public interface ProjectAnalysisHandler extends EventHandler { + + /** + * This interface is not intended to be implemented by clients. + */ + public interface ProjectAnalysisEvent { + + Project getProject(); + + boolean isStart(); + + boolean isEnd(); + + } + + /** + * Called before and after analysis of project. + */ + void onProjectAnalysis(ProjectAnalysisEvent event); + +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/SensorExecutionHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/SensorExecutionHandler.java new file mode 100644 index 00000000000..26d78596d98 --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/SensorExecutionHandler.java @@ -0,0 +1,47 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.api.batch.events; + +import org.sonar.api.batch.Sensor; + +/** + * @since 2.8 + */ +public interface SensorExecutionHandler extends EventHandler { + + /** + * This interface is not intended to be implemented by clients. + */ + public interface SensorExecutionEvent { + + Sensor getSensor(); + + boolean isStart(); + + boolean isEnd(); + + } + + /** + * Called before and after execution of {@link Sensor}. + */ + void onSensorExecution(SensorExecutionEvent event); + +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/SensorsPhaseHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/SensorsPhaseHandler.java new file mode 100644 index 00000000000..8a54de8b442 --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/SensorsPhaseHandler.java @@ -0,0 +1,52 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.api.batch.events; + +import org.sonar.api.batch.Sensor; + +import java.util.List; + +/** + * @since 2.8 + */ +public interface SensorsPhaseHandler extends EventHandler { + + /** + * This interface is not intended to be implemented by clients. + */ + public interface SensorsPhaseEvent { + + /** + * @return list of Sensors in the order of execution + */ + List<Sensor> getSensors(); + + boolean isStart(); + + boolean isEnd(); + + } + + /** + * Called before and after execution of all {@link Sensor}s. + */ + void onSensorsPhase(SensorsPhaseEvent event); + +} |