Example usage for org.eclipse.jgit.storage.file FileBasedConfig FileBasedConfig

List of usage examples for org.eclipse.jgit.storage.file FileBasedConfig FileBasedConfig

Introduction

In this page you can find the example usage for org.eclipse.jgit.storage.file FileBasedConfig FileBasedConfig.

Prototype

public FileBasedConfig(Config base, File cfgLocation, FS fs) 

Source Link

Document

The constructor

Usage

From source file:com.google.gitiles.dev.DevServer.java

License:Open Source License

DevServer(File cfgFile) throws IOException, ConfigInvalidException {
    sourceRoot = findSourceRoot();//from w  w  w.  j a  v a 2  s  .  co  m

    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());
}

From source file:com.googlesource.gerrit.plugins.secureconfig.SecureConfigSettings.java

License:Apache License

@Inject
SecureConfigSettings(SitePaths site) throws IOException, ConfigInvalidException {
    Config baseConfig = new Config();
    baseConfig.setString(SECURE_CONFIG, null, CIPHER, "PBEWithMD5AndDES");
    baseConfig.setString(SECURE_CONFIG, null, PASSWORD_DEVICE, "/dev/zero");
    baseConfig.setInt(SECURE_CONFIG, null, PASSWORD_LENGTH, DEF_PASSWORD_LENGTH);
    baseConfig.setString(SECURE_CONFIG, null, ENCODING, DEF_ENCODING);
    baseConfig.setString(SECURE_CONFIG, null, JCE_PROVIDER, DEF_JCE_PROVIDER);

    gerritConfig = new FileBasedConfig(baseConfig, site.gerrit_config.toFile(), FS.DETECTED);
    gerritConfig.load();/*from   w  w w .  j a  va2  s. c  o  m*/
    password = readPassword();
}

From source file:jetbrains.buildServer.buildTriggers.vcs.git.tests.SubmoduleTest.java

License:Apache License

/**
 * Test loading mapping for submodules//from  ww w  .j ava2s. c  o m
 *
 * @throws IOException if there is IO problem
 */
@Test
public void testSubmoduleMultiEntryMapping() throws Exception {
    File masterRep = dataFile("repo.git");
    File submodulesFile = dataFile("content", "dotgitmodules");
    Repository r = new RepositoryBuilder().setGitDir(masterRep).build();
    try {
        FileBasedConfig config = new FileBasedConfig(null, submodulesFile, FS.DETECTED);
        config.load();
        SubmodulesConfig s = new SubmodulesConfig(r.getConfig(), config);
        assertTrue(s.isSubmodulePrefix(""));
        assertFalse(s.isSubmodulePrefix("c/"));
        Submodule m = s.findSubmodule("b");
        assertEquals(m.getName(), "b");
        assertEquals(m.getPath(), "b");
        assertEquals(m.getUrl(), "git@gitrep:/git/b.git");
        m = s.findSubmodule("c/D");
        assertEquals(m.getName(), "c/D");
        assertEquals(m.getPath(), "c/D");
        assertEquals(m.getUrl(), "git@gitrep:/git/d.git");
    } finally {
        r.close();
    }
}

From source file:org.eclipse.orion.server.git.servlets.GitSubmoduleHandlerV1.java

License:Open Source License

private static StoredConfig getGitSubmodulesConfig(Repository repository)
        throws IOException, ConfigInvalidException {
    File gitSubmodulesFile = new File(repository.getWorkTree(), DOT_GIT_MODULES);
    FileBasedConfig gitSubmodulesConfig = new FileBasedConfig(null, gitSubmodulesFile, FS.DETECTED);
    gitSubmodulesConfig.load();//from  w ww.  j a v  a  2  s . com
    return gitSubmodulesConfig;
}