Search in sources :

Example 1 with Sequences

use of com.google.gerrit.server.notedb.Sequences in project gerrit by GerritCodeReview.

the class SchemaCreatorImpl method create.

@Override
public void create() throws IOException, ConfigInvalidException {
    GroupReference admins = createGroupReference("Administrators");
    GroupReference serviceUsers = createGroupReference(ServiceUserClassifier.SERVICE_USERS);
    AllProjectsInput allProjectsInput = AllProjectsInput.builder().administratorsGroup(admins).serviceUsersGroup(serviceUsers).build();
    allProjectsCreator.create(allProjectsInput);
    // We have to create the All-Users repository before we can use it to store the groups in it.
    allUsersCreator.setAdministrators(admins).create();
    // Don't rely on injection to construct Sequences, as the default GitReferenceUpdated has a
    // thick dependency stack which may not all be available at schema creation time.
    Sequences seqs = new Sequences(config, repoManager, GitReferenceUpdated.DISABLED, allProjectsName, allUsersName, metricMaker);
    try (Repository allUsersRepo = repoManager.openRepository(allUsersName)) {
        createAdminsGroup(seqs, allUsersRepo, admins);
        createBatchUsersGroup(seqs, allUsersRepo, serviceUsers, admins.getUUID());
    }
}
Also used : Sequences(com.google.gerrit.server.notedb.Sequences) Repository(org.eclipse.jgit.lib.Repository) GroupReference(com.google.gerrit.entities.GroupReference)

Aggregations

GroupReference (com.google.gerrit.entities.GroupReference)1 Sequences (com.google.gerrit.server.notedb.Sequences)1 Repository (org.eclipse.jgit.lib.Repository)1