Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 1 | // Copyright (C) 2012 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.project; |
| 16 | |
Edwin Kempin | a686de9 | 2013-05-09 15:12:34 +0200 | [diff] [blame] | 17 | import static com.google.gerrit.server.project.BranchResource.BRANCH_KIND; |
Edwin Kempin | 4425c74 | 2013-03-18 13:23:00 +0100 | [diff] [blame] | 18 | import static com.google.gerrit.server.project.ChildProjectResource.CHILD_PROJECT_KIND; |
Edwin Kempin | 1b99360 | 2014-07-08 16:18:45 +0200 | [diff] [blame] | 19 | import static com.google.gerrit.server.project.CommitResource.COMMIT_KIND; |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 20 | import static com.google.gerrit.server.project.DashboardResource.DASHBOARD_KIND; |
Edwin Kempin | d31e558 | 2013-11-30 12:07:08 +0100 | [diff] [blame] | 21 | import static com.google.gerrit.server.project.FileResource.FILE_KIND; |
Edwin Kempin | 1b99360 | 2014-07-08 16:18:45 +0200 | [diff] [blame] | 22 | import static com.google.gerrit.server.project.ProjectResource.PROJECT_KIND; |
David Pursehouse | 8cc6890 | 2014-10-06 18:17:16 +0900 | [diff] [blame] | 23 | import static com.google.gerrit.server.project.TagResource.TAG_KIND; |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 24 | |
| 25 | import com.google.gerrit.extensions.registration.DynamicMap; |
| 26 | import com.google.gerrit.extensions.restapi.RestApiModule; |
Bruce Zu | 798ea12 | 2013-02-18 16:55:43 +0800 | [diff] [blame] | 27 | import com.google.inject.assistedinject.FactoryModuleBuilder; |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 28 | |
| 29 | public class Module extends RestApiModule { |
| 30 | @Override |
| 31 | protected void configure() { |
Shawn O. Pearce | 43265b5 | 2012-11-19 17:52:02 -0800 | [diff] [blame] | 32 | bind(ProjectsCollection.class); |
| 33 | bind(DashboardsCollection.class); |
| 34 | |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 35 | DynamicMap.mapOf(binder(), PROJECT_KIND); |
Edwin Kempin | 4425c74 | 2013-03-18 13:23:00 +0100 | [diff] [blame] | 36 | DynamicMap.mapOf(binder(), CHILD_PROJECT_KIND); |
Edwin Kempin | a686de9 | 2013-05-09 15:12:34 +0200 | [diff] [blame] | 37 | DynamicMap.mapOf(binder(), BRANCH_KIND); |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 38 | DynamicMap.mapOf(binder(), DASHBOARD_KIND); |
Edwin Kempin | d31e558 | 2013-11-30 12:07:08 +0100 | [diff] [blame] | 39 | DynamicMap.mapOf(binder(), FILE_KIND); |
Edwin Kempin | 1b99360 | 2014-07-08 16:18:45 +0200 | [diff] [blame] | 40 | DynamicMap.mapOf(binder(), COMMIT_KIND); |
David Pursehouse | 8cc6890 | 2014-10-06 18:17:16 +0900 | [diff] [blame] | 41 | DynamicMap.mapOf(binder(), TAG_KIND); |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 42 | |
Bruce Zu | 798ea12 | 2013-02-18 16:55:43 +0800 | [diff] [blame] | 43 | put(PROJECT_KIND).to(PutProject.class); |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 44 | get(PROJECT_KIND).to(GetProject.class); |
| 45 | get(PROJECT_KIND, "description").to(GetDescription.class); |
Shawn Pearce | f3acb07 | 2013-01-29 09:25:54 -0800 | [diff] [blame] | 46 | put(PROJECT_KIND, "description").to(PutDescription.class); |
| 47 | delete(PROJECT_KIND, "description").to(PutDescription.class); |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 48 | |
| 49 | get(PROJECT_KIND, "parent").to(GetParent.class); |
| 50 | put(PROJECT_KIND, "parent").to(SetParent.class); |
| 51 | |
Edwin Kempin | 4425c74 | 2013-03-18 13:23:00 +0100 | [diff] [blame] | 52 | child(PROJECT_KIND, "children").to(ChildProjectsCollection.class); |
Edwin Kempin | 5b6c406 | 2013-03-19 09:26:03 +0100 | [diff] [blame] | 53 | get(CHILD_PROJECT_KIND).to(GetChildProject.class); |
Edwin Kempin | 4425c74 | 2013-03-18 13:23:00 +0100 | [diff] [blame] | 54 | |
Edwin Kempin | 6b81337 | 2013-03-13 17:07:33 +0100 | [diff] [blame] | 55 | get(PROJECT_KIND, "HEAD").to(GetHead.class); |
| 56 | put(PROJECT_KIND, "HEAD").to(SetHead.class); |
| 57 | |
Edwin Kempin | 6294674 | 2014-07-09 11:17:58 +0200 | [diff] [blame] | 58 | put(PROJECT_KIND, "ban").to(BanCommit.class); |
| 59 | |
Edwin Kempin | 19ea9b9 | 2013-03-20 13:20:26 +0100 | [diff] [blame] | 60 | get(PROJECT_KIND, "statistics.git").to(GetStatistics.class); |
Edwin Kempin | ef3542f | 2013-03-19 13:31:49 +0100 | [diff] [blame] | 61 | post(PROJECT_KIND, "gc").to(GarbageCollect.class); |
Edwin Kempin | 19ea9b9 | 2013-03-20 13:20:26 +0100 | [diff] [blame] | 62 | |
Edwin Kempin | a686de9 | 2013-05-09 15:12:34 +0200 | [diff] [blame] | 63 | child(PROJECT_KIND, "branches").to(BranchesCollection.class); |
Edwin Kempin | 5c0d6b3 | 2013-05-09 19:54:37 +0200 | [diff] [blame] | 64 | put(BRANCH_KIND).to(PutBranch.class); |
Edwin Kempin | 196e173 | 2013-05-09 15:12:34 +0200 | [diff] [blame] | 65 | get(BRANCH_KIND).to(GetBranch.class); |
Edwin Kempin | 6ce96a1 | 2013-06-06 13:20:01 +0200 | [diff] [blame] | 66 | delete(BRANCH_KIND).to(DeleteBranch.class); |
Hugo Arès | ef8e320 | 2015-01-12 15:09:06 -0500 | [diff] [blame] | 67 | post(PROJECT_KIND, "branches:delete").to(DeleteBranches.class); |
Edwin Kempin | 5c0d6b3 | 2013-05-09 19:54:37 +0200 | [diff] [blame] | 68 | install(new FactoryModuleBuilder().build(CreateBranch.Factory.class)); |
Edwin Kempin | 87504d9 | 2014-07-04 12:59:19 +0200 | [diff] [blame] | 69 | get(BRANCH_KIND, "reflog").to(GetReflog.class); |
Edwin Kempin | d31e558 | 2013-11-30 12:07:08 +0100 | [diff] [blame] | 70 | child(BRANCH_KIND, "files").to(FilesCollection.class); |
| 71 | get(FILE_KIND, "content").to(GetContent.class); |
Edwin Kempin | a686de9 | 2013-05-09 15:12:34 +0200 | [diff] [blame] | 72 | |
Edwin Kempin | 1b99360 | 2014-07-08 16:18:45 +0200 | [diff] [blame] | 73 | child(PROJECT_KIND, "commits").to(CommitsCollection.class); |
| 74 | get(COMMIT_KIND).to(GetCommit.class); |
Edwin Kempin | 6f7410a | 2014-07-09 15:46:22 +0200 | [diff] [blame] | 75 | child(COMMIT_KIND, "files").to(FilesInCommitCollection.class); |
Edwin Kempin | 1b99360 | 2014-07-08 16:18:45 +0200 | [diff] [blame] | 76 | |
David Pursehouse | 8cc6890 | 2014-10-06 18:17:16 +0900 | [diff] [blame] | 77 | child(PROJECT_KIND, "tags").to(TagsCollection.class); |
| 78 | get(TAG_KIND).to(GetTag.class); |
| 79 | |
Shawn O. Pearce | 43265b5 | 2012-11-19 17:52:02 -0800 | [diff] [blame] | 80 | child(PROJECT_KIND, "dashboards").to(DashboardsCollection.class); |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 81 | get(DASHBOARD_KIND).to(GetDashboard.class); |
Shawn O. Pearce | a7d9c9b | 2012-11-16 15:00:21 -0800 | [diff] [blame] | 82 | put(DASHBOARD_KIND).to(SetDashboard.class); |
| 83 | delete(DASHBOARD_KIND).to(DeleteDashboard.class); |
Bruce Zu | 798ea12 | 2013-02-18 16:55:43 +0800 | [diff] [blame] | 84 | install(new FactoryModuleBuilder().build(CreateProject.Factory.class)); |
Dave Borowitz | 237073a | 2013-04-04 16:52:27 -0700 | [diff] [blame] | 85 | |
| 86 | get(PROJECT_KIND, "config").to(GetConfig.class); |
Edwin Kempin | a23eb10 | 2013-07-17 09:10:54 +0200 | [diff] [blame] | 87 | put(PROJECT_KIND, "config").to(PutConfig.class); |
Shawn O. Pearce | ea6d0b5 | 2012-11-16 10:57:31 -0800 | [diff] [blame] | 88 | } |
| 89 | } |