本文整理汇总了Java中com.google.gerrit.server.config.SitePaths类的典型用法代码示例。如果您正苦于以下问题:Java SitePaths类的具体用法?Java SitePaths怎么用?Java SitePaths使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SitePaths类属于com.google.gerrit.server.config包,在下文中一共展示了SitePaths类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VirtualHostConfig
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
@Inject
VirtualHostConfig(SitePaths sitePaths) {
File configFile = sitePaths.etc_dir.resolve("virtualhost.config").toFile();
FileBasedConfig fileConfig = new FileBasedConfig(configFile, FS.DETECTED);
config = fileConfig;
try {
fileConfig.load();
} catch (IOException | ConfigInvalidException e) {
log.error("Unable to open or parse " + configFile + ": virtual domains are disabled", e);
enabled = false;
defaultProjects = new String[0];
return;
}
defaultProjects = config.getStringList("default", null, "projects");
enabled = !config.getSubsections("server").isEmpty() || defaultProjects.length > 0;
}
示例2: CiDataSourceProvider
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
@Inject
protected CiDataSourceProvider(SitePaths site,
@PluginName String pluginName,
@Nullable MetricMaker metrics,
Context ctx,
CiDataSourceType dst) {
File file = site.gerrit_config.toFile();
FileBasedConfig cfg = new FileBasedConfig(file, FS.DETECTED);
try {
cfg.load();
} catch (IOException | ConfigInvalidException e) {
throw new ProvisionException(e.getMessage(), e);
}
this.config = new PluginConfig(pluginName, cfg);
this.metrics = metrics;
this.ctx = ctx;
this.dst = dst;
}
示例3: createDataSource
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
private static DataSource createDataSource(
Config cfg, SitePaths sitePaths, ThreadSettingsConfig threadSettingsConfig) {
BasicDataSource datasource = new BasicDataSource();
String url = getUrl(cfg, sitePaths);
int poolLimit = threadSettingsConfig.getDatabasePoolLimit();
datasource.setUrl(url);
datasource.setDriverClassName(getDriverFromUrl(url));
datasource.setMaxActive(cfg.getInt(ACCOUNT_PATCH_REVIEW_DB, "poolLimit", poolLimit));
datasource.setMinIdle(cfg.getInt(ACCOUNT_PATCH_REVIEW_DB, "poolminidle", 4));
datasource.setMaxIdle(
cfg.getInt(ACCOUNT_PATCH_REVIEW_DB, "poolmaxidle", Math.min(poolLimit, 16)));
datasource.setInitialSize(datasource.getMinIdle());
datasource.setMaxWait(
ConfigUtil.getTimeUnit(
cfg,
ACCOUNT_PATCH_REVIEW_DB,
null,
"poolmaxwait",
MILLISECONDS.convert(30, SECONDS),
MILLISECONDS));
long evictIdleTimeMs = 1000L * 60;
datasource.setMinEvictableIdleTimeMillis(evictIdleTimeMs);
datasource.setTimeBetweenEvictionRunsMillis(evictIdleTimeMs / 2);
return datasource;
}
示例4: createAccountPatchReviewStore
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
public static JdbcAccountPatchReviewStore createAccountPatchReviewStore(
Config cfg, SitePaths sitePaths, ThreadSettingsConfig threadSettingsConfig) {
String url = cfg.getString(ACCOUNT_PATCH_REVIEW_DB, null, URL);
if (url == null || url.contains(H2_DB)) {
return new H2AccountPatchReviewStore(cfg, sitePaths, threadSettingsConfig);
}
if (url.contains(POSTGRESQL)) {
return new PostgresqlAccountPatchReviewStore(cfg, sitePaths, threadSettingsConfig);
}
if (url.contains(MYSQL)) {
return new MysqlAccountPatchReviewStore(cfg, sitePaths, threadSettingsConfig);
}
if (url.contains(MARIADB)) {
return new MariaDBAccountPatchReviewStore(cfg, sitePaths, threadSettingsConfig);
}
throw new IllegalArgumentException(
"unsupported driver type for account patch reviews db: " + url);
}
示例5: LuceneProjectIndex
import com.google.gerrit.server.config.SitePaths; //导入依赖的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());
}
示例6: AbstractElasticIndex
import com.google.gerrit.server.config.SitePaths; //导入依赖的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();
}
示例7: DatabasePubKeyAuth
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
@Inject
DatabasePubKeyAuth(
SshKeyCacheImpl skc,
SshLog l,
IdentifiedUser.GenericFactory uf,
PeerDaemonUser.Factory pf,
SitePaths site,
KeyPairProvider hostKeyProvider,
@GerritServerConfig Config cfg,
SshScope s) {
sshKeyCache = skc;
sshLog = l;
userFactory = uf;
peerFactory = pf;
config = cfg;
sshScope = s;
myHostKeys = myHostKeys(hostKeyProvider);
peerKeyCache = new PeerKeyCache(site.peer_keys);
}
示例8: getRobotsTxtServlet
import com.google.gerrit.server.config.SitePaths; //导入依赖的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: VersionManager
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
protected VersionManager(
SitePaths sitePaths,
DynamicSet<OnlineUpgradeListener> listeners,
Collection<IndexDefinition<?, ?, ?>> defs,
boolean onlineUpgrade) {
this.sitePaths = sitePaths;
this.listeners = listeners;
this.defs = Maps.newHashMapWithExpectedSize(defs.size());
for (IndexDefinition<?, ?, ?> def : defs) {
this.defs.put(def.getName(), def);
}
this.reindexers = Maps.newHashMapWithExpectedSize(defs.size());
this.onlineUpgrade = onlineUpgrade;
this.runReindexMsg =
"No index versions for index '%s' ready; run java -jar "
+ sitePaths.gerrit_war.toAbsolutePath()
+ " reindex --index %s";
}
示例10: AutoReloadSecureCredentialsFactoryDecorator
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
@Inject
public AutoReloadSecureCredentialsFactoryDecorator(
SitePaths site, ReplicationFileBasedConfig config)
throws ConfigInvalidException, IOException {
this.site = site;
this.config = config;
this.secureCredentialsFactory = new AtomicReference<>(new SecureCredentialsFactory(site));
this.secureCredentialsFactoryLoadTs = getSecureConfigLastEditTs();
}
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:10,代码来源:AutoReloadSecureCredentialsFactoryDecorator.java
示例11: AutoReloadConfigDecorator
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
@Inject
public AutoReloadConfigDecorator(
SitePaths site, WorkQueue workQueue, DestinationFactory destinationFactory)
throws ConfigInvalidException, IOException {
this.site = site;
this.destinationFactory = destinationFactory;
this.currentConfig = loadConfig();
this.currentConfigTs = getLastModified(currentConfig);
this.workQueue = workQueue;
}
示例12: ReplicationFileBasedConfig
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
@Inject
public ReplicationFileBasedConfig(SitePaths site, DestinationFactory destinationFactory)
throws ConfigInvalidException, IOException {
this.cfgPath = site.etc_dir.resolve("replication.config");
this.config = new FileBasedConfig(cfgPath.toFile(), FS.DETECTED);
this.destinations = allDestinations(destinationFactory);
}
示例13: InitPlugin
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
@Inject
InitPlugin(Section.Factory sections,
@PluginName String pluginName,
ConsoleUI ui,
SitePaths site,
Injector parent) {
this.ui = ui;
this.site = site;
this.configSection = sections.get("plugin", pluginName);
this.parent = parent;
}
示例14: Derby
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
@Inject
Derby(SitePaths site,
@PluginName String pluginName) {
super("org.apache.derby.jdbc.EmbeddedDriver");
this.site = site;
File file = site.gerrit_config.toFile();
FileBasedConfig cfg = new FileBasedConfig(file, FS.DETECTED);
try {
cfg.load();
} catch (IOException | ConfigInvalidException e) {
throw new ProvisionException(e.getMessage(), e);
}
this.config = new PluginConfig(pluginName, cfg);
}
示例15: setUp
import com.google.gerrit.server.config.SitePaths; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
site = new SitePaths(TempFileUtil.createTempDirectory().toPath());
site.resolve("git").toFile().mkdir();
cfg = new Config();
cfg.setString("gerrit", null, "basePath", "git");
configMock = createNiceMock(RepositoryConfig.class);
expect(configMock.getAllBasePaths()).andReturn(new ArrayList<Path>()).anyTimes();
replay(configMock);
repoManager = new MultiBaseLocalDiskRepositoryManager(site, cfg, configMock);
}