<groupId>${project.groupId}</groupId>
<artifactId>sonar-dev-cockpit-bridge</artifactId>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sonar-governance-bridge</artifactId>
+ </dependency>
<!-- unit tests -->
<dependency>
--- /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.server.governance.bridge;
+
+import org.sonar.api.platform.Server;
+import org.sonar.api.platform.ServerStartHandler;
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
+import org.sonar.api.utils.log.Profiler;
+import org.sonar.core.platform.ComponentContainer;
+import org.sonar.server.governance.GovernanceBridge;
+
+/**
+ * Startup task to responsible to bootstrap the Governance plugin when it is installed.
+ */
+public class GovernanceBootstrap implements ServerStartHandler {
+ private static final Logger LOGGER = Loggers.get(GovernanceBootstrap.class);
+
+ private final ComponentContainer componentContainer;
+
+ public GovernanceBootstrap(ComponentContainer componentContainer) {
+ this.componentContainer = componentContainer;
+ }
+
+ @Override
+ public void onServerStart(Server server) {
+ GovernanceBridge governanceBridge = componentContainer.getComponentByType(GovernanceBridge.class);
+ if (governanceBridge != null) {
+ Profiler profiler = Profiler.create(LOGGER).startInfo("Bootstrapping Governance plugin");
+ governanceBridge.startGovernance(componentContainer);
+ profiler.stopInfo();
+ }
+ }
+
+}
--- /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.server.governance.bridge;
+
+import org.picocontainer.Startable;
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
+import org.sonar.api.utils.log.Profiler;
+import org.sonar.core.platform.ComponentContainer;
+import org.sonar.server.governance.GovernanceBridge;
+
+/**
+ * As an component of PlatformLevel4, this class is responsible for notifying shutdown to the Governance plugin when its
+ * installed.
+ */
+public class GovernanceStopper implements Startable {
+ private static final Logger LOGGER = Loggers.get(GovernanceStopper.class);
+
+ private final ComponentContainer platformContainer;
+
+ public GovernanceStopper(ComponentContainer platformContainer) {
+ this.platformContainer = platformContainer;
+ }
+
+ @Override
+ public void start() {
+ // nothing to do, Governance plugins is started by GovernanceBootstrap
+ }
+
+ @Override
+ public void stop() {
+ GovernanceBridge viewsBridge = platformContainer.getComponentByType(GovernanceBridge.class);
+ if (viewsBridge != null) {
+ Profiler profiler = Profiler.create(LOGGER).startInfo("Stopping Governance plugin");
+ viewsBridge.stopGovernance();
+ profiler.stopInfo();
+ }
+ }
+}
--- /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.server.governance.bridge;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
import org.sonar.server.es.IndexCreator;
import org.sonar.server.es.IndexDefinitions;
import org.sonar.server.event.NewAlerts;
+import org.sonar.server.governance.bridge.GovernanceBootstrap;
+import org.sonar.server.governance.bridge.GovernanceStopper;
import org.sonar.server.issue.ActionService;
import org.sonar.server.issue.AddTagsAction;
import org.sonar.server.issue.AssignAction;
DevCockpitBootstrap.class,
DevCockpitStopper.class,
+ // Governance plugin
+ GovernanceBootstrap.class,
+ GovernanceStopper.class,
+
// Compute engine (must be after Views and Developer Cockpit)
CeModule.class,
CeQueueModule.class,