Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.RepositoryNotFoundException


  }

  public Repository createRepository(final Project.NameKey name)
      throws RepositoryNotFoundException, RepositoryCaseMismatchException {
    if (isUnreasonableName(name)) {
      throw new RepositoryNotFoundException("Invalid name: " + name);
    }

    File dir = FileKey.resolve(gitDirOf(name), FS.DETECTED);
    FileKey loc;
    if (dir != null) {
      // Already exists on disk, use the repository we found.
      //
      loc = FileKey.exact(dir, FS.DETECTED);

      if (!names.contains(name)) {
        throw new RepositoryCaseMismatchException(name);
      }
    } else {
      // It doesn't exist under any of the standard permutations
      // of the repository name, so prefer the standard bare name.
      //
      String n = name.get();
      if (!n.endsWith(Constants.DOT_GIT_EXT)) {
        n = n + Constants.DOT_GIT_EXT;
      }
      loc = FileKey.exact(new File(basePath, n), FS.DETECTED);
    }

    try {
      Repository db = RepositoryCache.open(loc, false);
      db.create(true /* bare */);

      StoredConfig config = db.getConfig();
      config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION,
        null, ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, true);
      config.save();

      onCreateProject(name);

      return db;
    } catch (IOException e1) {
      final RepositoryNotFoundException e2;
      e2 = new RepositoryNotFoundException("Cannot create repository " + name);
      e2.initCause(e1);
      throw e2;
    }
  }
View Full Code Here


      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        final FileRepository db = remoteRepository.getRepository();
        if (!name.equals(nameOf(db)))
          throw new RepositoryNotFoundException(name);

        db.incrementOpen();
        return db;
      }
    });
View Full Code Here

    gs.setRepositoryResolver(new RepositoryResolver() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);

        final Repository db = src.getRepository();
        db.incrementOpen();
        return db;
      }
View Full Code Here

    gs.setRepositoryResolver(new RepositoryResolver() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);

        final Repository db = src.getRepository();
        db.incrementOpen();
        return db;
      }
View Full Code Here

  public Repository open(final HttpServletRequest req,
      final String repositoryName) throws RepositoryNotFoundException,
      ServiceNotEnabledException {
    if (isUnreasonableName(repositoryName))
      throw new RepositoryNotFoundException(repositoryName);

    final Repository db;
    try {
      final File gitdir = new File(basePath, repositoryName);
      db = RepositoryCache.open(FileKey.lenient(gitdir, FS.DETECTED), true);
    } catch (IOException e) {
      throw new RepositoryNotFoundException(repositoryName, e);
    }

    try {
      if (isExportOk(req, repositoryName, db)) {
        // We have to leak the open count to the caller, they
        // are responsible for closing the repository if we
        // complete successfully.
        return db;
      } else
        throw new ServiceNotEnabledException();

    } catch (RuntimeException e) {
      db.close();
      throw new RepositoryNotFoundException(repositoryName, e);

    } catch (IOException e) {
      db.close();
      throw new RepositoryNotFoundException(repositoryName, e);

    } catch (ServiceNotEnabledException e) {
      db.close();
      throw e;
    }
View Full Code Here

    gs.setRepositoryResolver(new RepositoryResolver() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);

        final Repository db = src.getRepository();
        db.incrementOpen();
        return db;
      }
View Full Code Here

    gs.setRepositoryResolver(new RepositoryResolver() {
      public Repository open(HttpServletRequest req, String name)
          throws RepositoryNotFoundException,
          ServiceNotEnabledException {
        if (!name.equals(srcName))
          throw new RepositoryNotFoundException(name);

        final Repository db = src.getRepository();
        db.incrementOpen();
        return db;
      }
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  public R build() throws IOException {
    R repo = (R) new FileRepository(setup());
    if (isMustExist() && !repo.getObjectDatabase().exists())
      throw new RepositoryNotFoundException(getGitDir());
    return repo;
  }
View Full Code Here

   */
  @Override
  public FileRepository build() throws IOException {
    FileRepository repo = new FileRepository(setup());
    if (isMustExist() && !repo.getObjectDatabase().exists())
      throw new RepositoryNotFoundException(getGitDir());
    return repo;
  }
View Full Code Here

      } catch (TimeoutException e) {
        throw new DhtTimeoutException(MessageFormat.format(
            DhtText.get().timeoutLocatingRepository, name), e);
      }
      if (isMustExist() && r == null)
        throw new RepositoryNotFoundException(getRepositoryName());
      if (r != null)
        setRepositoryKey(r);
    }
    return self();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.errors.RepositoryNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.