Line data Source code
1 : // Copyright (C) 2015 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.extensions.api.config; 16 : 17 : import com.google.gerrit.extensions.client.DiffPreferencesInfo; 18 : import com.google.gerrit.extensions.client.EditPreferencesInfo; 19 : import com.google.gerrit.extensions.client.GeneralPreferencesInfo; 20 : import com.google.gerrit.extensions.common.ServerInfo; 21 : import com.google.gerrit.extensions.restapi.NotImplementedException; 22 : import com.google.gerrit.extensions.restapi.RestApiException; 23 : import com.google.gerrit.extensions.webui.TopMenu; 24 : import java.util.List; 25 : 26 : public interface Server { 27 : /** Returns version of server. */ 28 : String getVersion() throws RestApiException; 29 : 30 : ServerInfo getInfo() throws RestApiException; 31 : 32 : GeneralPreferencesInfo getDefaultPreferences() throws RestApiException; 33 : 34 : GeneralPreferencesInfo setDefaultPreferences(GeneralPreferencesInfo in) throws RestApiException; 35 : 36 : DiffPreferencesInfo getDefaultDiffPreferences() throws RestApiException; 37 : 38 : DiffPreferencesInfo setDefaultDiffPreferences(DiffPreferencesInfo in) throws RestApiException; 39 : 40 : EditPreferencesInfo getDefaultEditPreferences() throws RestApiException; 41 : 42 : EditPreferencesInfo setDefaultEditPreferences(EditPreferencesInfo in) throws RestApiException; 43 : 44 : ConsistencyCheckInfo checkConsistency(ConsistencyCheckInput in) throws RestApiException; 45 : 46 : List<TopMenu.MenuEntry> topMenus() throws RestApiException; 47 : 48 : /** 49 : * A default implementation which allows source compatibility when adding new methods to the 50 : * interface. 51 : */ 52 0 : class NotImplemented implements Server { 53 : @Override 54 : public String getVersion() throws RestApiException { 55 0 : throw new NotImplementedException(); 56 : } 57 : 58 : @Override 59 : public ServerInfo getInfo() throws RestApiException { 60 0 : throw new NotImplementedException(); 61 : } 62 : 63 : @Override 64 : public GeneralPreferencesInfo getDefaultPreferences() throws RestApiException { 65 0 : throw new NotImplementedException(); 66 : } 67 : 68 : @Override 69 : public GeneralPreferencesInfo setDefaultPreferences(GeneralPreferencesInfo in) 70 : throws RestApiException { 71 0 : throw new NotImplementedException(); 72 : } 73 : 74 : @Override 75 : public DiffPreferencesInfo getDefaultDiffPreferences() throws RestApiException { 76 0 : throw new NotImplementedException(); 77 : } 78 : 79 : @Override 80 : public DiffPreferencesInfo setDefaultDiffPreferences(DiffPreferencesInfo in) 81 : throws RestApiException { 82 0 : throw new NotImplementedException(); 83 : } 84 : 85 : @Override 86 : public EditPreferencesInfo getDefaultEditPreferences() throws RestApiException { 87 0 : throw new NotImplementedException(); 88 : } 89 : 90 : @Override 91 : public EditPreferencesInfo setDefaultEditPreferences(EditPreferencesInfo in) 92 : throws RestApiException { 93 0 : throw new NotImplementedException(); 94 : } 95 : 96 : @Override 97 : public ConsistencyCheckInfo checkConsistency(ConsistencyCheckInput in) throws RestApiException { 98 0 : throw new NotImplementedException(); 99 : } 100 : 101 : @Override 102 : public List<TopMenu.MenuEntry> topMenus() throws RestApiException { 103 0 : throw new NotImplementedException(); 104 : } 105 : } 106 : }