Add top level /config REST API

/config/server/ part is hard coded for now, but we may add more
config specific resource names later.

/config/server/capabilities retrieves the known server wide
capabilities list. The list has to be loaded dynamically from
the server to permit plugins to declare their own capabilities.

Change-Id: I83692bd021925d37659bfbc88b3e3b67b92c18c1
This commit is contained in:
David Ostrovsky
2013-06-09 02:16:57 +02:00
committed by Shawn Pearce
parent 665c2a88d3
commit 28b8ea6f9e
23 changed files with 628 additions and 64 deletions

View File

@@ -0,0 +1,30 @@
// 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.google.gerrit.server.config;
import static com.google.gerrit.server.config.ConfigResource.CONFIG_KIND;
import static com.google.gerrit.server.config.CapabilityResource.CAPABILITY_KIND;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.restapi.RestApiModule;
public class Module extends RestApiModule {
@Override
protected void configure() {
DynamicMap.mapOf(binder(), CONFIG_KIND);
DynamicMap.mapOf(binder(), CAPABILITY_KIND);
child(CONFIG_KIND, "capabilities").to(CapabilitiesCollection.class);
}
}