Search in sources :

Example 1 with SchemaDefinitions

use of com.google.gerrit.index.SchemaDefinitions in project gerrit by GerritCodeReview.

the class Init method afterInit.

@Override
protected void afterInit(SiteRun run) throws Exception {
    List<SchemaDefinitions<?>> schemaDefs = ImmutableList.of(AccountSchemaDefinitions.INSTANCE, ChangeSchemaDefinitions.INSTANCE, GroupSchemaDefinitions.INSTANCE, ProjectSchemaDefinitions.INSTANCE);
    List<Module> modules = new ArrayList<>();
    modules.add(new AbstractModule() {

        @Override
        protected void configure() {
            bind(Path.class).annotatedWith(SitePath.class).toInstance(getSitePath());
            bind(Browser.class);
            bind(String.class).annotatedWith(SecureStoreClassName.class).toProvider(Providers.of(getConfiguredSecureStoreClass()));
        }
    });
    modules.add(new GerritServerConfigModule());
    Guice.createInjector(modules).injectMembers(this);
    if (!ReplicaUtil.isReplica(run.flags.cfg)) {
        List<String> indicesToReindex = new ArrayList<>();
        for (SchemaDefinitions<?> schemaDef : schemaDefs) {
            if (!indexStatus.exists(schemaDef.getName())) {
                indicesToReindex.add(schemaDef.getName());
            }
        }
        reindex(indicesToReindex, run.flags.isNew);
    }
    start(run);
}
Also used : Path(java.nio.file.Path) SitePath(com.google.gerrit.server.config.SitePath) ArrayList(java.util.ArrayList) AbstractModule(com.google.inject.AbstractModule) GerritServerConfigModule(com.google.gerrit.server.config.GerritServerConfigModule) Module(com.google.inject.Module) GerritServerConfigModule(com.google.gerrit.server.config.GerritServerConfigModule) AbstractModule(com.google.inject.AbstractModule) AccountSchemaDefinitions(com.google.gerrit.server.index.account.AccountSchemaDefinitions) SchemaDefinitions(com.google.gerrit.index.SchemaDefinitions) ProjectSchemaDefinitions(com.google.gerrit.index.project.ProjectSchemaDefinitions) GroupSchemaDefinitions(com.google.gerrit.server.index.group.GroupSchemaDefinitions) ChangeSchemaDefinitions(com.google.gerrit.server.index.change.ChangeSchemaDefinitions) Browser(com.google.gerrit.pgm.init.Browser)

Aggregations

SchemaDefinitions (com.google.gerrit.index.SchemaDefinitions)1 ProjectSchemaDefinitions (com.google.gerrit.index.project.ProjectSchemaDefinitions)1 Browser (com.google.gerrit.pgm.init.Browser)1 GerritServerConfigModule (com.google.gerrit.server.config.GerritServerConfigModule)1 SitePath (com.google.gerrit.server.config.SitePath)1 AccountSchemaDefinitions (com.google.gerrit.server.index.account.AccountSchemaDefinitions)1 ChangeSchemaDefinitions (com.google.gerrit.server.index.change.ChangeSchemaDefinitions)1 GroupSchemaDefinitions (com.google.gerrit.server.index.group.GroupSchemaDefinitions)1 AbstractModule (com.google.inject.AbstractModule)1 Module (com.google.inject.Module)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1