本文整理匯總了Java中org.eclipse.jgit.util.FS.DETECTED屬性的典型用法代碼示例。如果您正苦於以下問題:Java FS.DETECTED屬性的具體用法?Java FS.DETECTED怎麽用?Java FS.DETECTED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jgit.util.FS
的用法示例。
在下文中一共展示了FS.DETECTED屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: VirtualHostConfig
@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: saveSecure
private static void saveSecure(final FileBasedConfig sec) throws IOException {
if (FileUtil.modified(sec)) {
final byte[] out = Constants.encode(sec.toText());
final File path = sec.getFile();
final LockFile lf = new LockFile(path, FS.DETECTED);
if (!lf.lock()) {
throw new IOException("Cannot lock " + path);
}
try {
FileUtil.chmod(0600, new File(path.getParentFile(), path.getName()
+ ".lock"));
lf.write(out);
if (!lf.commit()) {
throw new IOException("Cannot commit write to " + path);
}
} finally {
lf.unlock();
}
}
}
示例3: getSecureStoreFromGerritConfig
private static String getSecureStoreFromGerritConfig(Path sitePath) {
AbstractModule m =
new AbstractModule() {
@Override
protected void configure() {
bind(Path.class).annotatedWith(SitePath.class).toInstance(sitePath);
bind(SitePaths.class);
}
};
Injector injector = Guice.createInjector(m);
SitePaths site = injector.getInstance(SitePaths.class);
FileBasedConfig cfg = new FileBasedConfig(site.gerrit_config.toFile(), FS.DETECTED);
if (!cfg.getFile().exists()) {
return DefaultSecureStore.class.getName();
}
try {
cfg.load();
String className = cfg.getString("gerrit", null, "secureStoreClass");
return nullToDefault(className);
} catch (IOException | ConfigInvalidException e) {
throw new ProvisionException(e.getMessage(), e);
}
}
示例4: CiDataSourceProvider
@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;
}
示例5: submoduleRemove
@Override
public void submoduleRemove(String folderName) {
configRemoveSection(folderName);
Repository repository = null;
try {
repository = getRepository(workingDir);
StoredConfig gitSubmodulesConfig = new FileBasedConfig(null, new File(repository.getWorkTree(), Constants.DOT_GIT_MODULES), FS.DETECTED);
gitSubmodulesConfig.unsetSection(ConfigConstants.CONFIG_SUBMODULE_SECTION, folderName);
gitSubmodulesConfig.save();
Git git = Git.wrap(repository);
git.rm().setCached(true).addFilepattern(folderName).call();
FileUtils.deleteQuietly(new File(workingDir, folderName));
} catch (Exception e) {
throw new RuntimeException("sub-module remove failed", e);
} finally {
if (repository != null) {
repository.close();
}
}
}
示例6: DevServer
DevServer(File cfgFile) throws IOException, ConfigInvalidException {
sourceRoot = findSourceRoot();
Config cfg = defaultConfig();
if (cfgFile.exists() && cfgFile.isFile()) {
FileBasedConfig fcfg = new FileBasedConfig(cfg, cfgFile, FS.DETECTED);
fcfg.load();
cfg = fcfg;
} else {
log.info("Config file {} not found, using defaults", cfgFile.getPath());
}
this.cfg = cfg;
httpd = new Server();
httpd.setConnectors(connectors());
httpd.setThreadPool(threadPool());
httpd.setHandler(handler());
}
示例7: GitVersionControl
public GitVersionControl(Path path) throws IOException {
try {
// Cribbed from Git.open, but with findGitDir rather than setGitDir
// and extracting the location.
FS fs = FS.DETECTED;
RepositoryCache.FileKey key = RepositoryCache.FileKey.lenient(path.toFile(), fs);
RepositoryBuilder builder = new RepositoryBuilder()
.setFS(fs)
.findGitDir(key.getFile())
.setMustExist(true);
repositoryRoot = Paths.get(builder.getGitDir().getAbsolutePath()).getParent();
repo = new Git(builder.build());
checkMergeDriver(repositoryRoot);
} catch (RuntimeException ex) {
throw new IOException(ex);
}
}
示例8: testExtension
public void testExtension () throws Exception {
// ping the factory
FS fs = FS.DETECTED;
Field f = FS.class.getDeclaredField("factory");
f.setAccessible(true);
FSFactory fact = (FSFactory) f.get(FS.class);
assertEquals("org.eclipse.jgit.util.Java7FSFactory", fact.getClass().getName());
}
示例9: run
@Override
public void run() throws Exception {
File configFile = site.etc_dir.resolve(pluginName + ".config").toFile();
if (!configFile.exists()) {
return;
}
FileBasedConfig config = new FileBasedConfig(configFile, FS.DETECTED);
config.load();
for (String name : config.getSubsections("remote")) {
if (!Strings.isNullOrEmpty(config.getString("remote", name, "rescheduleDelay"))) {
continue;
}
int replicationDelay =
config.getInt("remote", name, "replicationDelay", DEFAULT_REPLICATION_DELAY);
if (replicationDelay > 0) {
int delay = Math.max(replicationDelay, DEFAULT_RESCHEDULE_DELAY);
ui.message("Setting remote.%s.rescheduleDelay = %d\n", name, delay);
config.setInt("remote", name, "rescheduleDelay", delay);
} else {
ui.message(
"INFO: Assuming default (%d s) for remote.%s.rescheduleDelay\n",
DEFAULT_RESCHEDULE_DELAY, name);
}
}
config.save();
}
示例10: Derby
@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);
}
示例11: MySql
@Inject
public MySql(SitePaths site,
@PluginName String pluginName) {
super("com.mysql.jdbc.Driver");
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);
}
示例12: H2
@Inject
H2(SitePaths site,
@PluginName String pluginName) {
super("org.h2.Driver");
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);
}
示例13: Oracle
@Inject
public Oracle(SitePaths site,
@PluginName String pluginName) {
super("oracle.jdbc.driver.OracleDriver");
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);
}
示例14: PostgreSQL
@Inject
public PostgreSQL(SitePaths site,
@PluginName String pluginName) {
super("org.postgresql.Driver");
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: CiDataSourceTypeGuesser
@Inject
CiDataSourceTypeGuesser(SitePaths site,
@PluginName String pluginName) {
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);
}