[Setup] Start our plugin when gerrit starts.
So that we can listen to change events.
diff --git a/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java
new file mode 100644
index 0000000..a3e2a7d
--- /dev/null
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java
@@ -0,0 +1,33 @@
+// Copyright 2014 Criteo
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.criteo.gerrit.plugins.automerge;
+
+import com.google.gerrit.extensions.events.LifecycleListener;
+
+/**
+ * Starts at the same time as the gerrit server, and sets up our
+ * change hook listener.
+ */
+public class AutomaticMerger implements LifecycleListener {
+
+ @Override
+ public void start() {
+ // TODO(cupcicm): Add the change listener here.
+ }
+
+ @Override
+ public void stop() {
+ }
+}
diff --git a/src/main/java/com/criteo/gerrit/plugins/automerge/Module.java b/src/main/java/com/criteo/gerrit/plugins/automerge/Module.java
index 1cb4467..8ae8977 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/Module.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/Module.java
@@ -13,6 +13,9 @@
// limitations under the License.
package com.criteo.gerrit.plugins.automerge;
+
+import com.google.gerrit.extensions.events.LifecycleListener;
+import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.inject.AbstractModule;
/**
@@ -24,5 +27,6 @@
@Override
protected void configure() {
+ DynamicSet.bind(binder(), LifecycleListener.class).to(AutomaticMerger.class);
}
}