當前位置: 首頁>>代碼示例>>Java>>正文


Java FS.detect方法代碼示例

本文整理匯總了Java中org.eclipse.jgit.util.FS.detect方法的典型用法代碼示例。如果您正苦於以下問題:Java FS.detect方法的具體用法?Java FS.detect怎麽用?Java FS.detect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jgit.util.FS的用法示例。


在下文中一共展示了FS.detect方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setMetadataDefaults

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
private void setMetadataDefaults(X509Metadata metadata) {
	metadata.serverHostname = gitblitSettings.getString(Keys.web.siteName, Constants.NAME);
	if (StringUtils.isEmpty(metadata.serverHostname)) {
		metadata.serverHostname = Constants.NAME;
	}
	
	// set default values from config file
	File certificatesConfigFile = new File(folder, X509Utils.CA_CONFIG);
	FileBasedConfig config = new FileBasedConfig(certificatesConfigFile, FS.detect());
	if (certificatesConfigFile.exists()) {
		try {
			config.load();
		} catch (Exception e) {
			Utils.showException(GitblitAuthority.this, e);
		}
		NewCertificateConfig certificateConfig = NewCertificateConfig.KEY.parse(config);
		certificateConfig.update(metadata);
	}
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:20,代碼來源:GitblitAuthority.java

示例2: cloneProject

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
public static TestRepository<InMemoryRepository> cloneProject(Project.NameKey project, String uri)
    throws Exception {
  DfsRepositoryDescription desc = new DfsRepositoryDescription("clone of " + project.get());

  FS fs = FS.detect();

  // Avoid leaking user state into our tests.
  fs.setUserHome(null);

  InMemoryRepository dest =
      new InMemoryRepository.Builder()
          .setRepositoryDescription(desc)
          // SshTransport depends on a real FS to read ~/.ssh/config, but
          // InMemoryRepository by default uses a null FS.
          // TODO(dborowitz): Remove when we no longer depend on SSH.
          .setFS(fs)
          .build();
  Config cfg = dest.getConfig();
  cfg.setString("remote", "origin", "url", uri);
  cfg.setString("remote", "origin", "fetch", "+refs/heads/*:refs/remotes/origin/*");
  TestRepository<InMemoryRepository> testRepo = newTestRepository(dest);
  FetchResult result = testRepo.git().fetch().setRemote("origin").call();
  String originMaster = "refs/remotes/origin/master";
  if (result.getTrackingRefUpdate(originMaster) != null) {
    testRepo.reset(originMaster);
  }
  return testRepo;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:29,代碼來源:GitUtil.java

示例3: GerritIndexStatus

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
public GerritIndexStatus(SitePaths sitePaths) throws ConfigInvalidException, IOException {
  cfg =
      new FileBasedConfig(
          sitePaths.index_dir.resolve("gerrit_index.config").toFile(), FS.detect());
  cfg.load();
  convertLegacyConfig();
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:8,代碼來源:GerritIndexStatus.java

示例4: setUp

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
  assume().that(NoteDbMode.get()).isEqualTo(NoteDbMode.OFF);
  gerritConfig = new FileBasedConfig(sitePaths.gerrit_config.toFile(), FS.detect());
  // Unlike in the running server, for tests, we don't stack notedb.config on gerrit.config.
  noteDbConfig = new FileBasedConfig(sitePaths.notedb_config.toFile(), FS.detect());
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:8,代碼來源:StandaloneNoteDbMigrationIT.java

示例5: setUp

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
  assume().that(NoteDbMode.get()).isEqualTo(NoteDbMode.OFF);
  // Unlike in the running server, for tests, we don't stack notedb.config on gerrit.config.
  noteDbConfig = new FileBasedConfig(sitePaths.notedb_config.toFile(), FS.detect());
  assertNotesMigrationState(REVIEW_DB, false, false);
  addedListeners = new ArrayList<>();
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:9,代碼來源:OnlineNoteDbMigrationIT.java

示例6: NoteDbMigrator

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
private NoteDbMigrator(
    SitePaths sitePaths,
    SchemaFactory<ReviewDb> schemaFactory,
    GitRepositoryManager repoManager,
    NoteDbUpdateManager.Factory updateManagerFactory,
    ChangeBundleReader bundleReader,
    AllProjectsName allProjects,
    ThreadLocalRequestContext requestContext,
    InternalUser.Factory userFactory,
    ChangeRebuilderImpl rebuilder,
    MutableNotesMigration globalNotesMigration,
    PrimaryStorageMigrator primaryStorageMigrator,
    DynamicSet<NotesMigrationStateListener> listeners,
    ListeningExecutorService executor,
    ImmutableList<Project.NameKey> projects,
    ImmutableList<Change.Id> changes,
    OutputStream progressOut,
    NotesMigrationState stopAtState,
    boolean trial,
    boolean forceRebuild,
    int sequenceGap,
    boolean autoMigrate)
    throws MigrationException {
  if (!changes.isEmpty() && !projects.isEmpty()) {
    throw new MigrationException("Cannot set both changes and projects");
  }
  if (sequenceGap < 0) {
    throw new MigrationException("Sequence gap must be non-negative: " + sequenceGap);
  }

  this.schemaFactory = schemaFactory;
  this.rebuilder = rebuilder;
  this.repoManager = repoManager;
  this.updateManagerFactory = updateManagerFactory;
  this.bundleReader = bundleReader;
  this.allProjects = allProjects;
  this.requestContext = requestContext;
  this.userFactory = userFactory;
  this.globalNotesMigration = globalNotesMigration;
  this.primaryStorageMigrator = primaryStorageMigrator;
  this.listeners = listeners;
  this.executor = executor;
  this.projects = projects;
  this.changes = changes;
  this.progressOut = progressOut;
  this.stopAtState = stopAtState;
  this.trial = trial;
  this.forceRebuild = forceRebuild;
  this.sequenceGap = sequenceGap;
  this.autoMigrate = autoMigrate;

  // Stack notedb.config over gerrit.config, in the same way as GerritServerConfigProvider.
  this.gerritConfig = new FileBasedConfig(sitePaths.gerrit_config.toFile(), FS.detect());
  this.noteDbConfig =
      new FileBasedConfig(gerritConfig, sitePaths.notedb_config.toFile(), FS.detect());
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:57,代碼來源:NoteDbMigrator.java

示例7: setOnlineUpgradeConfig

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
private void setOnlineUpgradeConfig(boolean enable) throws Exception {
  FileBasedConfig cfg = new FileBasedConfig(sitePaths.gerrit_config.toFile(), FS.detect());
  cfg.load();
  cfg.setBoolean("index", null, "onlineUpgrade", enable);
  cfg.save();
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:7,代碼來源:ReindexIT.java

示例8: newConfig

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
private MergeableFileBasedConfig newConfig() throws Exception {
  File f = File.createTempFile(getClass().getSimpleName(), ".config");
  f.deleteOnExit();
  return new MergeableFileBasedConfig(f, FS.detect());
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:6,代碼來源:MergeableFileBasedConfigTest.java

示例9: configureContext

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
/**
 * Configure the Gitblit singleton with the specified settings source. This
 * source may be file settings (Gitblit GO) or may be web.xml settings
 * (Gitblit WAR).
 * 
 * @param settings
 */
public void configureContext(IStoredSettings settings, File folder, boolean startFederation) {
	this.settings = settings;
	this.baseFolder = folder;

	repositoriesFolder = getRepositoriesFolder();

	logger.info("Gitblit base folder     = " + folder.getAbsolutePath());
	logger.info("Git repositories folder = " + repositoriesFolder.getAbsolutePath());
	logger.info("Gitblit settings        = " + settings.toString());

	// prepare service executors
	mailExecutor = new MailExecutor(settings);
	luceneExecutor = new LuceneExecutor(settings, repositoriesFolder);
	gcExecutor = new GCExecutor(settings);
	
	// calculate repository list settings checksum for future config changes
	repositoryListSettingsChecksum.set(getRepositoryListSettingsChecksum());

	// build initial repository list
	if (settings.getBoolean(Keys.git.cacheRepositoryList,  true)) {
		logger.info("Identifying available repositories...");
		getRepositoryList();
	}
	
	logTimezone("JVM", TimeZone.getDefault());
	logTimezone(Constants.NAME, getTimezone());

	serverStatus = new ServerStatus(isGO());

	if (this.userService == null) {
		String realm = settings.getString(Keys.realm.userService, "${baseFolder}/users.properties");
		IUserService loginService = null;
		try {
			// check to see if this "file" is a login service class
			Class<?> realmClass = Class.forName(realm);
			loginService = (IUserService) realmClass.newInstance();
		} catch (Throwable t) {
			loginService = new GitblitUserService();
		}
		setUserService(loginService);
	}
	
	// load and cache the project metadata
	projectConfigs = new FileBasedConfig(getFileOrFolder(Keys.web.projectsFile, "${baseFolder}/projects.conf"), FS.detect());
	getProjectConfigs();
	
	configureMailExecutor();		
	configureLuceneIndexing();
	configureGarbageCollector();
	if (startFederation) {
		configureFederation();
	}
	configureJGit();
	configureFanout();
	configureGitDaemon();
	
	ContainerUtils.CVE_2007_0450.test();
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:66,代碼來源:GitBlit.java

示例10: getConfig

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
private StoredConfig getConfig() throws IOException, ConfigInvalidException {
	File configFile  = new File(folder, X509Utils.CA_CONFIG);
	FileBasedConfig config = new FileBasedConfig(configFile, FS.detect());
	config.load();
	return config;
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:7,代碼來源:GitblitAuthority.java

示例11: getConfig

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
private StoredConfig getConfig() throws IOException, ConfigInvalidException {
	FileBasedConfig config = new FileBasedConfig(configFile, FS.detect());
	config.load();
	return config;
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:6,代碼來源:GitblitManager.java

示例12: getConfig

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
/**
 * Returns the Lucene configuration for the specified repository.
 * 
 * @param repository
 * @return a config object
 */
private FileBasedConfig getConfig(Repository repository) {
	File file = new File(repository.getDirectory(), CONF_FILE);
	FileBasedConfig config = new FileBasedConfig(file, FS.detect());
	return config;
}
 
開發者ID:tomaswolf,項目名稱:gerrit-gitblit-plugin,代碼行數:12,代碼來源:LuceneService.java


注:本文中的org.eclipse.jgit.util.FS.detect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。