本文整理汇总了Java中com.google.gerrit.server.config.GerritServerConfig类的典型用法代码示例。如果您正苦于以下问题:Java GerritServerConfig类的具体用法?Java GerritServerConfig怎么用?Java GerritServerConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GerritServerConfig类属于com.google.gerrit.server.config包,在下文中一共展示了GerritServerConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Factory
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Inject
Factory(
@GerritServerConfig Config cfg,
Provider<InternalAccountQuery> accountQueryProvider,
IdentifiedUser.GenericFactory userFactory,
@CanonicalWebUrl String webUrl) {
this.accountQueryProvider = accountQueryProvider;
this.webUrl = webUrl;
this.userFactory = userFactory;
this.maxTrustDepth = cfg.getInt("receive", null, "maxTrustDepth", 0);
String[] strs = cfg.getStringList("receive", null, "trustedKey");
if (strs.length != 0) {
Map<Long, Fingerprint> fps = Maps.newHashMapWithExpectedSize(strs.length);
for (String str : strs) {
str = CharMatcher.whitespace().removeFrom(str).toUpperCase();
Fingerprint fp = new Fingerprint(BaseEncoding.base16().decode(str));
fps.put(fp.getId(), fp);
}
trusted = ImmutableMap.copyOf(fps);
} else {
trusted = null;
}
}
示例2: GerritServer
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
private GerritServer(
Description desc,
@Nullable Path sitePath,
Injector testInjector,
Daemon daemon,
@Nullable ExecutorService daemonService) {
this.desc = checkNotNull(desc);
this.sitePath = sitePath;
this.testInjector = checkNotNull(testInjector);
this.daemon = checkNotNull(daemon);
this.daemonService = daemonService;
Config cfg = testInjector.getInstance(Key.get(Config.class, GerritServerConfig.class));
url = cfg.getString("gerrit", null, "canonicalWebUrl");
URI uri = URI.create(url);
sshdAddress = SocketUtil.resolve(cfg.getString("sshd", null, "listenAddress"), 0);
httpAddress = new InetSocketAddress(uri.getHost(), uri.getPort());
}
示例3: LuceneProjectIndex
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Inject
LuceneProjectIndex(
@GerritServerConfig Config cfg,
SitePaths sitePaths,
Provider<ProjectCache> projectCache,
@Assisted Schema<ProjectData> schema)
throws IOException {
super(
schema,
sitePaths,
dir(schema, cfg, sitePaths),
PROJECTS,
null,
new GerritIndexWriterConfig(cfg, PROJECTS),
new SearcherFactory());
this.projectCache = projectCache;
indexWriterConfig = new GerritIndexWriterConfig(cfg, PROJECTS);
queryBuilder = new QueryBuilder<>(schema, indexWriterConfig.getAnalyzer());
}
示例4: CommandFactoryProvider
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Inject
CommandFactoryProvider(
@CommandName(Commands.ROOT) DispatchCommandProvider d,
@GerritServerConfig Config cfg,
WorkQueue workQueue,
SshLog l,
SshScope s,
SchemaFactory<ReviewDb> sf) {
dispatcher = d;
log = l;
sshScope = s;
schemaFactory = sf;
int threads = cfg.getInt("sshd", "commandStartThreads", 2);
startExecutor = workQueue.createQueue(threads, "SshCommandStart");
destroyExecutor =
Executors.newSingleThreadExecutor(
new ThreadFactoryBuilder()
.setNameFormat("SshCommandDestroy-%s")
.setDaemon(true)
.build());
}
示例5: ChangeIndexer
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@AssistedInject
ChangeIndexer(
@GerritServerConfig Config cfg,
SchemaFactory<ReviewDb> schemaFactory,
NotesMigration notesMigration,
ChangeNotes.Factory changeNotesFactory,
ChangeData.Factory changeDataFactory,
ThreadLocalRequestContext context,
DynamicSet<ChangeIndexedListener> indexedListeners,
StalenessChecker stalenessChecker,
@IndexExecutor(BATCH) ListeningExecutorService batchExecutor,
@Assisted ListeningExecutorService executor,
@Assisted ChangeIndex index) {
this.executor = executor;
this.schemaFactory = schemaFactory;
this.notesMigration = notesMigration;
this.changeNotesFactory = changeNotesFactory;
this.changeDataFactory = changeDataFactory;
this.context = context;
this.indexedListeners = indexedListeners;
this.stalenessChecker = stalenessChecker;
this.batchExecutor = batchExecutor;
this.autoReindexIfStale = autoReindexIfStale(cfg);
this.index = index;
this.indexes = null;
}
示例6: Globals
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Inject
Globals(
Provider<CurrentUser> currentUser,
DynamicItem<WebSession> webSession,
Provider<ParameterParser> paramParser,
PermissionBackend permissionBackend,
AuditService auditService,
RestApiMetrics metrics,
@GerritServerConfig Config cfg) {
this.currentUser = currentUser;
this.webSession = webSession;
this.paramParser = paramParser;
this.permissionBackend = permissionBackend;
this.auditService = auditService;
this.metrics = metrics;
allowOrigin = makeAllowOrigin(cfg);
}
示例7: LuceneGroupIndex
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Inject
LuceneGroupIndex(
@GerritServerConfig Config cfg,
SitePaths sitePaths,
Provider<GroupCache> groupCache,
@Assisted Schema<InternalGroup> schema)
throws IOException {
super(
schema,
sitePaths,
dir(schema, cfg, sitePaths),
GROUPS,
null,
new GerritIndexWriterConfig(cfg, GROUPS),
new SearcherFactory());
this.groupCache = groupCache;
indexWriterConfig = new GerritIndexWriterConfig(cfg, GROUPS);
queryBuilder = new QueryBuilder<>(schema, indexWriterConfig.getAnalyzer());
}
示例8: getRobotsTxtServlet
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Provides
@Singleton
@Named(ROBOTS_TXT_SERVLET)
HttpServlet getRobotsTxtServlet(
@GerritServerConfig Config cfg,
SitePaths sitePaths,
@Named(CACHE) Cache<Path, Resource> cache) {
Path configPath = sitePaths.resolve(cfg.getString("httpd", null, "robotsFile"));
if (configPath != null) {
if (exists(configPath) && isReadable(configPath)) {
return new SingleFileServlet(cache, configPath, true);
}
log.warn("Cannot read httpd.robotsFile, using default");
}
Paths p = getPaths();
if (p.warFs != null) {
return new SingleFileServlet(cache, p.warFs.getPath("/robots.txt"), false);
}
return new SingleFileServlet(cache, webappSourcePath("robots.txt"), true);
}
示例9: IntraLineLoader
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Inject
IntraLineLoader(
@DiffExecutor ExecutorService diffExecutor,
@GerritServerConfig Config cfg,
@Assisted IntraLineDiffKey key,
@Assisted IntraLineDiffArgs args) {
this.diffExecutor = diffExecutor;
timeoutMillis =
ConfigUtil.getTimeUnit(
cfg,
"cache",
PatchListCacheImpl.INTRA_NAME,
"timeout",
TimeUnit.MILLISECONDS.convert(5, TimeUnit.SECONDS),
TimeUnit.MILLISECONDS);
this.key = key;
this.args = args;
}
示例10: PatchListLoader
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Inject
PatchListLoader(
GitRepositoryManager mgr,
PatchListCache plc,
@GerritServerConfig Config cfg,
@DiffExecutor ExecutorService de,
AutoMerger am,
@Assisted PatchListKey k,
@Assisted Project.NameKey p) {
repoManager = mgr;
patchListCache = plc;
mergeStrategy = MergeUtil.getMergeStrategy(cfg);
diffExecutor = de;
autoMerger = am;
key = k;
project = p;
timeoutMillis =
ConfigUtil.getTimeUnit(
cfg,
"cache",
PatchListCacheImpl.FILE_NAME,
"timeout",
TimeUnit.MILLISECONDS.convert(5, TimeUnit.SECONDS),
TimeUnit.MILLISECONDS);
save = AutoMerger.cacheAutomerge(cfg);
}
示例11: AbstractElasticIndex
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
AbstractElasticIndex(
@GerritServerConfig Config cfg,
SitePaths sitePaths,
Schema<V> schema,
JestClientBuilder clientBuilder,
String indexName) {
this.sitePaths = sitePaths;
this.schema = schema;
this.gson = new GsonBuilder().setFieldNamingPolicy(LOWER_CASE_WITH_UNDERSCORES).create();
this.queryBuilder = new ElasticQueryBuilder();
this.indexName =
String.format(
"%s%s%04d",
Strings.nullToEmpty(cfg.getString("elasticsearch", null, "prefix")),
indexName,
schema.getVersion());
this.client = clientBuilder.build();
}
示例12: createChangeUpdateExecutor
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Provides
@Singleton
@ChangeUpdateExecutor
public ListeningExecutorService createChangeUpdateExecutor(@GerritServerConfig Config config) {
int poolSize = config.getInt("receive", null, "changeUpdateThreads", 1);
if (poolSize <= 1) {
return MoreExecutors.newDirectExecutorService();
}
return MoreExecutors.listeningDecorator(
MoreExecutors.getExitingExecutorService(
new ThreadPoolExecutor(
1,
poolSize,
10,
TimeUnit.MINUTES,
new ArrayBlockingQueue<Runnable>(poolSize),
new ThreadFactoryBuilder().setNameFormat("ChangeUpdate-%d").setDaemon(true).build(),
new ThreadPoolExecutor.CallerRunsPolicy())));
}
示例13: MergeUtil
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@AssistedInject
MergeUtil(
@GerritServerConfig Config serverConfig,
Provider<ReviewDb> db,
IdentifiedUser.GenericFactory identifiedUserFactory,
@CanonicalWebUrl @Nullable Provider<String> urlProvider,
ApprovalsUtil approvalsUtil,
@Assisted ProjectState project,
PluggableCommitMessageGenerator commitMessageGenerator,
@Assisted boolean useContentMerge) {
this.db = db;
this.identifiedUserFactory = identifiedUserFactory;
this.urlProvider = urlProvider;
this.approvalsUtil = approvalsUtil;
this.project = project;
this.useContentMerge = useContentMerge;
this.useRecursiveMerge = useRecursiveMerge(serverConfig);
this.commitMessageGenerator = commitMessageGenerator;
}
示例14: ReviewerRecommender
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Inject
ReviewerRecommender(
ChangeQueryBuilder changeQueryBuilder,
DynamicMap<ReviewerSuggestion> reviewerSuggestionPluginMap,
Provider<InternalChangeQuery> queryProvider,
WorkQueue workQueue,
Provider<ReviewDb> dbProvider,
ApprovalsUtil approvalsUtil,
@GerritServerConfig Config config) {
Set<FillOptions> fillOptions = EnumSet.of(FillOptions.SECONDARY_EMAILS);
fillOptions.addAll(AccountLoader.DETAILED_OPTIONS);
this.changeQueryBuilder = changeQueryBuilder;
this.config = config;
this.queryProvider = queryProvider;
this.reviewerSuggestionPluginMap = reviewerSuggestionPluginMap;
this.workQueue = workQueue;
this.dbProvider = dbProvider;
this.approvalsUtil = approvalsUtil;
}
示例15: EmailSettings
import com.google.gerrit.server.config.GerritServerConfig; //导入依赖的package包/类
@Inject
EmailSettings(@GerritServerConfig Config cfg) {
// Send
html = cfg.getBoolean(SEND_EMAL, "html", true);
includeDiff = cfg.getBoolean(SEND_EMAL, "includeDiff", false);
maximumDiffSize = cfg.getInt(SEND_EMAL, "maximumDiffSize", 256 << 10);
// Receive
protocol = cfg.getEnum(RECEIVE_EMAL, null, "protocol", Protocol.NONE);
host = cfg.getString(RECEIVE_EMAL, null, "host");
port = cfg.getInt(RECEIVE_EMAL, "port", 0);
username = cfg.getString(RECEIVE_EMAL, null, "username");
password = cfg.getString(RECEIVE_EMAL, null, "password");
encryption = cfg.getEnum(RECEIVE_EMAL, null, "encryption", Encryption.NONE);
fetchInterval =
cfg.getTimeUnit(
RECEIVE_EMAL,
null,
"fetchInterval",
TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS),
TimeUnit.MILLISECONDS);
}