// Copyright (C) 2013 The Android Open Source Project
//
// 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.googlesource.gerrit.plugins.cookbook;

import static com.google.gerrit.server.change.RevisionResource.REVISION_KIND;
import static com.google.gerrit.server.project.ProjectResource.PROJECT_KIND;

import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.extensions.restapi.RestApiModule;
import com.google.gerrit.extensions.webui.TopMenu;
import com.google.inject.AbstractModule;

public class Module extends AbstractModule {

  @Override
  protected void configure() {
    DynamicSet.bind(binder(), TopMenu.class)
        .to(HelloTopMenu.class);
    install(new RestApiModule() {
      @Override
      protected void configure() {
        post(REVISION_KIND, "hello-revision").to(HelloRevisionAction.class);
        post(PROJECT_KIND, "hello-project").to(HelloProjectAction.class);
        get(REVISION_KIND, "greetings").to(Greetings.class);
      }
    });
  }
}

@@ -809,16 +809,121 @@
 _KIND;%0A%0A
+import com.google.common.collect.ImmutableList;%0Aimport com.google.gerrit.extensions.annotations.Exports;%0A
 import c
@@ -1085,16 +1085,144 @@
 opMenu;%0A
+import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;%0Aimport com.google.gerrit.server.config.ProjectConfigEntry;%0A
 import c
@@ -1735,14 +1735,1242 @@
     %7D);%0A
+    configurePluginParameters();%0A  %7D%0A%0A  private void configurePluginParameters() %7B%0A    bind(ProjectConfigEntry.class)%0A        .annotatedWith(Exports.named(%22enabled-hello%22))%0A        .toInstance(new ProjectConfigEntry(%22Enable Greeting%22, true));%0A    bind(ProjectConfigEntry.class)%0A       .annotatedWith(Exports.named(%22enabled-goodby%22))%0A       .toInstance(new ProjectConfigEntry(%22Enable Say Good By%22,%0A           InheritableBoolean.TRUE,%0A           InheritableBoolean.class, true));%0A    bind(ProjectConfigEntry.class)%0A       .annotatedWith(Exports.named(%22default-greet%22))%0A       .toInstance(new ProjectConfigEntry(%22Default Greet%22,%0A           %22Hey dude, how are you?%22, true));%0A    bind(ProjectConfigEntry.class)%0A        .annotatedWith(Exports.named(%22language%22))%0A        .toInstance(new ProjectConfigEntry(%22Preferred Language%22, %22en%22,%0A            ImmutableList.of(%22en%22, %22de%22, %22fr%22), true));%0A    bind(ProjectConfigEntry.class)%0A        .annotatedWith(Exports.named(%22greet-number-per-week%22))%0A        .toInstance(new ProjectConfigEntry(%22Greets Per Week%22, 42, true));%0A    bind(ProjectConfigEntry.class)%0A       .annotatedWith(Exports.named(%22greet-number-per-year%22))%0A       .toInstance(new ProjectConfigEntry(%22Greets Per Year%22, 4711L, true));%0A
   %7D%0A%7D%0A

Configure plugin specific list parameters as ProjectConfigEntries