Line data Source code
1 : // Copyright (C) 2018 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.schema; 16 : 17 : import com.google.gerrit.server.GerritPersonIdent; 18 : import com.google.gerrit.server.config.AllProjectsName; 19 : import com.google.gerrit.server.config.AllUsersName; 20 : import com.google.gerrit.server.git.GitRepositoryManager; 21 : import com.google.gerrit.server.group.SystemGroupBackend; 22 : import com.google.gerrit.server.index.group.GroupIndexCollection; 23 : import com.google.gerrit.server.project.ProjectConfig; 24 : import com.google.inject.Inject; 25 : import com.google.inject.Singleton; 26 : import org.eclipse.jgit.lib.PersonIdent; 27 : 28 : /** 29 : * Schema upgrade implementation. 30 : * 31 : * <p>Implementations must have a single non-private constructor with no arguments (e.g. the default 32 : * constructor). 33 : */ 34 : public interface NoteDbSchemaVersion { 35 : @Singleton 36 : class Arguments { 37 : final GitRepositoryManager repoManager; 38 : final AllProjectsName allProjects; 39 : final AllUsersName allUsers; 40 : final ProjectConfig.Factory projectConfigFactory; 41 : final SystemGroupBackend systemGroupBackend; 42 : final PersonIdent serverUser; 43 : final GroupIndexCollection groupIndexCollection; 44 : 45 : @Inject 46 : Arguments( 47 : GitRepositoryManager repoManager, 48 : AllProjectsName allProjects, 49 : AllUsersName allUsers, 50 : ProjectConfig.Factory projectConfigFactory, 51 : SystemGroupBackend systemGroupBackend, 52 : @GerritPersonIdent PersonIdent serverUser, 53 16 : GroupIndexCollection groupIndexCollection) { 54 16 : this.repoManager = repoManager; 55 16 : this.allProjects = allProjects; 56 16 : this.allUsers = allUsers; 57 16 : this.projectConfigFactory = projectConfigFactory; 58 16 : this.systemGroupBackend = systemGroupBackend; 59 16 : this.serverUser = serverUser; 60 16 : this.groupIndexCollection = groupIndexCollection; 61 16 : } 62 : } 63 : 64 : void upgrade(Arguments args, UpdateUI ui) throws Exception; 65 : }