当前位置: 首页>>代码示例>>Java>>正文


Java LifecycleModule类代码示例

本文整理汇总了Java中com.google.gerrit.lifecycle.LifecycleModule的典型用法代码示例。如果您正苦于以下问题:Java LifecycleModule类的具体用法?Java LifecycleModule怎么用?Java LifecycleModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LifecycleModule类属于com.google.gerrit.lifecycle包,在下文中一共展示了LifecycleModule类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: module

import com.google.gerrit.lifecycle.LifecycleModule; //导入依赖的package包/类
public static Module module() {
  return new CacheModule() {
    @Override
    protected void configure() {
      cache(CACHE_NAME, String.class, ProjectState.class).loader(Loader.class);

      cache(CACHE_LIST, ListKey.class, new TypeLiteral<SortedSet<Project.NameKey>>() {})
          .maximumWeight(1)
          .loader(Lister.class);

      bind(ProjectCacheImpl.class);
      bind(ProjectCache.class).to(ProjectCacheImpl.class);

      install(
          new LifecycleModule() {
            @Override
            protected void configure() {
              listener().to(ProjectCacheWarmer.class);
              listener().to(ProjectCacheClock.class);
            }
          });
    }
  };
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:25,代码来源:ProjectCacheImpl.java

示例2: configure

import com.google.gerrit.lifecycle.LifecycleModule; //导入依赖的package包/类
@Override
protected void configure() {
  bind(PluginUser.class).toInstance(plugin.getPluginUser());
  bind(String.class).annotatedWith(PluginName.class).toInstance(plugin.getName());
  bind(String.class)
      .annotatedWith(PluginCanonicalWebUrl.class)
      .toInstance(plugin.getPluginCanonicalWebUrl());

  install(
      new LifecycleModule() {
        @Override
        public void configure() {
          PluginMetricMaker metrics =
              new PluginMetricMaker(
                  serverMetrics,
                  MoreObjects.firstNonNull(
                      plugin.getMetricsPrefix(), String.format("plugins/%s/", plugin.getName())));
          bind(MetricMaker.class).toInstance(metrics);
          listener().toInstance(metrics);
        }
      });
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:ServerPluginInfoModule.java

示例3: configure

import com.google.gerrit.lifecycle.LifecycleModule; //导入依赖的package包/类
@Override
protected void configure() {
  List<Module> modules = new ArrayList<>();
  modules.add(new LifecycleModule() {
    @Override
    protected void configure() {
      // For bootstrap we need to retrieve the ds type first
      CiDataSourceTypeGuesser guesser =
          injector.createChildInjector(
              new CiDataSourceModule()).getInstance(
                  Key.get(CiDataSourceTypeGuesser.class));

      // For the ds type we retrieve the underlying implementation
      CiDataSourceType dst = injector.createChildInjector(
          new CiDataSourceModule()).getInstance(
              Key.get(CiDataSourceType.class,
                  Names.named(guesser.guessDataSourceType())));
      // Bind the type to the retrieved instance
      bind(CiDataSourceType.class).toInstance(dst);
      bind(CiDataSourceProvider.Context.class).toInstance(
          CiDataSourceProvider.Context.MULTI_USER);
      bind(Key.get(DataSource.class, Names.named("CiDb"))).toProvider(
          CiDataSourceProvider.class).in(SINGLETON);
      listener().to(CiDataSourceProvider.class);
    }
  });
  modules.add(new CiDatabaseModule());
  for (Module module : modules) {
    install(module);
  }
}
 
开发者ID:davido,项目名称:gerrit-ci-plugin,代码行数:32,代码来源:GlobalModule.java

示例4: module

import com.google.gerrit.lifecycle.LifecycleModule; //导入依赖的package包/类
public static Module module() {
  return new LifecycleModule() {
    @Override
    protected void configure() {
      listener().to(SchemaVersionCheck.class);
    }
  };
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:SchemaVersionCheck.java

示例5: buildInjector

import com.google.gerrit.lifecycle.LifecycleModule; //导入依赖的package包/类
private Injector buildInjector(final Injector parent) {
  List<Module> modules = new ArrayList<>();

  modules.add(new LifecycleModule() {
    @Override
    protected void configure() {
      // For bootstrap we need to retrieve the ds type first
      CiDataSourceTypeGuesser guesser =
          parent.createChildInjector(
              new CiDataSourceModule()).getInstance(
                  Key.get(CiDataSourceTypeGuesser.class));

      // For the ds type we retrieve the underlying implementation
      CiDataSourceType dst = parent.createChildInjector(
          new CiDataSourceModule()).getInstance(
              Key.get(CiDataSourceType.class,
                  Names.named(guesser.guessDataSourceType())));

      // Bind the type to the retrieved instance
      bind(CiDataSourceType.class).toInstance(dst);
      bind(CiDataSourceProvider.Context.class).toInstance(
          CiDataSourceProvider.Context.MULTI_USER);
      bind(Key.get(DataSource.class, Names.named("CiDb"))).toProvider(
          CiDataSourceProvider.class).in(SINGLETON);

      listener().to(CiDataSourceProvider.class);
    }
  });

  modules.add(new CiDatabaseModule());

  modules.add(new AbstractModule() {
    @Override
    protected void configure() {
      bind(SchemaVersion.class).to(SchemaVersion.C);
      bind(MetricMaker.class).to(DisabledMetricMaker.class);
    }
  });

  return parent.createChildInjector(modules);
}
 
开发者ID:davido,项目名称:gerrit-ci-plugin,代码行数:42,代码来源:InitPlugin.java

示例6: createDbInjector

import com.google.gerrit.lifecycle.LifecycleModule; //导入依赖的package包/类
private Injector createDbInjector() {
  final List<Module> modules = new ArrayList<>();
  AbstractModule secureStore = createSecureStoreModule();
  modules.add(secureStore);
  if (sitePath != null) {
    Module sitePathModule =
        new AbstractModule() {
          @Override
          protected void configure() {
            bind(Path.class).annotatedWith(SitePath.class).toInstance(sitePath);
          }
        };
    modules.add(sitePathModule);

    Module configModule = new GerritServerConfigModule();
    modules.add(configModule);

    Injector cfgInjector = Guice.createInjector(sitePathModule, configModule, secureStore);
    Config cfg = cfgInjector.getInstance(Key.get(Config.class, GerritServerConfig.class));
    String dbType = cfg.getString("database", null, "type");

    final DataSourceType dst =
        Guice.createInjector(new DataSourceModule(), configModule, sitePathModule, secureStore)
            .getInstance(Key.get(DataSourceType.class, Names.named(dbType.toLowerCase())));
    modules.add(
        new LifecycleModule() {
          @Override
          protected void configure() {
            bind(DataSourceType.class).toInstance(dst);
            bind(DataSourceProvider.Context.class)
                .toInstance(DataSourceProvider.Context.MULTI_USER);
            bind(Key.get(DataSource.class, Names.named("ReviewDb")))
                .toProvider(DataSourceProvider.class)
                .in(SINGLETON);
            listener().to(DataSourceProvider.class);
          }
        });

  } else {
    modules.add(
        new LifecycleModule() {
          @Override
          protected void configure() {
            bind(Key.get(DataSource.class, Names.named("ReviewDb")))
                .toProvider(ReviewDbDataSourceProvider.class)
                .in(SINGLETON);
            listener().to(ReviewDbDataSourceProvider.class);
          }
        });

    // If we didn't get the site path from the system property
    // we need to get it from the database, as that's our old
    // method of locating the site path on disk.
    //
    modules.add(
        new AbstractModule() {
          @Override
          protected void configure() {
            bind(Path.class)
                .annotatedWith(SitePath.class)
                .toProvider(SitePathFromSystemConfigProvider.class)
                .in(SINGLETON);
          }
        });
    modules.add(new GerritServerConfigModule());
  }
  modules.add(new DatabaseModule());
  modules.add(new NotesMigration.Module());
  modules.add(new DropWizardMetricMaker.ApiModule());
  return Guice.createInjector(PRODUCTION, modules);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:72,代码来源:WebAppInitializer.java


注:本文中的com.google.gerrit.lifecycle.LifecycleModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。