Line data Source code
1 : // Copyright (C) 2013 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.restapi.config; 16 : 17 : import static com.google.gerrit.server.config.ConfigResource.CONFIG_KIND; 18 : import static com.google.gerrit.server.config.TaskResource.TASK_KIND; 19 : 20 : import com.google.gerrit.extensions.registration.DynamicMap; 21 : import com.google.gerrit.extensions.restapi.RestApiModule; 22 : import com.google.gerrit.server.config.CapabilityResource; 23 : import com.google.gerrit.server.config.TopMenuResource; 24 : 25 152 : public class ConfigRestApiModule extends RestApiModule { 26 : @Override 27 : protected void configure() { 28 152 : DynamicMap.mapOf(binder(), CapabilityResource.CAPABILITY_KIND); 29 152 : DynamicMap.mapOf(binder(), CONFIG_KIND); 30 152 : DynamicMap.mapOf(binder(), TASK_KIND); 31 152 : DynamicMap.mapOf(binder(), TopMenuResource.TOP_MENU_KIND); 32 152 : child(CONFIG_KIND, "capabilities").to(CapabilitiesCollection.class); 33 152 : child(CONFIG_KIND, "tasks").to(TasksCollection.class); 34 152 : get(TASK_KIND).to(GetTask.class); 35 152 : delete(TASK_KIND).to(DeleteTask.class); 36 152 : child(CONFIG_KIND, "top-menus").to(TopMenuCollection.class); 37 152 : get(CONFIG_KIND, "version").to(GetVersion.class); 38 152 : get(CONFIG_KIND, "info").to(GetServerInfo.class); 39 152 : post(CONFIG_KIND, "check.consistency").to(CheckConsistency.class); 40 152 : post(CONFIG_KIND, "index.changes").to(IndexChanges.class); 41 152 : post(CONFIG_KIND, "reload").to(ReloadConfig.class); 42 152 : get(CONFIG_KIND, "preferences").to(GetPreferences.class); 43 152 : put(CONFIG_KIND, "preferences").to(SetPreferences.class); 44 152 : get(CONFIG_KIND, "preferences.diff").to(GetDiffPreferences.class); 45 152 : put(CONFIG_KIND, "preferences.diff").to(SetDiffPreferences.class); 46 152 : get(CONFIG_KIND, "preferences.edit").to(GetEditPreferences.class); 47 152 : put(CONFIG_KIND, "preferences.edit").to(SetEditPreferences.class); 48 152 : put(CONFIG_KIND, "email.confirm").to(ConfirmEmail.class); 49 152 : } 50 : }