@Override public Repository open(Object req, String name) throws RepositoryNotFoundException { throw new RepositoryNotFoundException(name); } };
@Override public Repository open(boolean mustExist) throws IOException { if (mustExist && !isGitRepository(path, fs)) throw new RepositoryNotFoundException(path); return new FileRepository(path); }
throws RepositoryNotFoundException, ServiceNotEnabledException { if (isUnreasonableName(name)) throw new RepositoryNotFoundException(name); db = RepositoryCache.open(key, true); } catch (IOException e) { throw new RepositoryNotFoundException(name, e); throw new RepositoryNotFoundException(name, e); throw new RepositoryNotFoundException(name, e); throw new RepositoryNotFoundException(name, new RepositoryNotFoundException(dir)); throw new RepositoryNotFoundException(name);
/** * Create a repository matching the configuration in this builder. * <p> * If an option was not set, the build method will try to default the option * based on other options. If insufficient information is available, an * exception is thrown to the caller. * * @return a repository matching this configuration. The caller is * responsible to close the repository instance when it is no longer * needed. * @throws java.lang.IllegalArgumentException * insufficient parameters were set. * @throws java.io.IOException * the repository could not be accessed to configure the rest of * the builder's parameters. */ @SuppressWarnings({ "unchecked", "resource" }) public R build() throws IOException { R repo = (R) new FileRepository(setup()); if (isMustExist() && !repo.getObjectDatabase().exists()) throw new RepositoryNotFoundException(getGitDir()); return repo; }
/** * {@inheritDoc} * <p> * Create a repository matching the configuration in this builder. * <p> * If an option was not set, the build method will try to default the option * based on other options. If insufficient information is available, an * exception is thrown to the caller. * * @since 3.0 */ @Override public Repository build() throws IOException { FileRepository repo = new FileRepository(setup()); if (isMustExist() && !repo.getObjectDatabase().exists()) throw new RepositoryNotFoundException(getGitDir()); return repo; }
public Repository open(Object req, String name) throws RepositoryNotFoundException { throw new RepositoryNotFoundException(name); } };
@Override public Repository open(Object req, String name) throws RepositoryNotFoundException { throw new RepositoryNotFoundException(name); } };
public Repository open(HttpServletRequest req, String name) throws RepositoryNotFoundException, ServiceNotEnabledException { if (!name.equals(nameOf(db))) throw new RepositoryNotFoundException(name); db.incrementOpen(); return db; } });
@Override public Repository open(HttpServletRequest req, String name) throws RepositoryNotFoundException, ServiceNotEnabledException { if (!name.equals(nameOf(db))) throw new RepositoryNotFoundException(name); db.incrementOpen(); return db; } });
public Repository open(final boolean mustExist) throws IOException { if (mustExist && !isGitRepository(path, fs)) throw new RepositoryNotFoundException(path); return new FileRepository(path); }
@Override public Repository open( final DaemonClient client, final String name ) throws RepositoryNotFoundException, ServiceNotAuthorizedException, ServiceNotEnabledException, ServiceMayNotContinueException { final JGitFileSystem fs = fileSystems.get( name ); if ( fs == null ) { throw new RepositoryNotFoundException( name ); } return fs.gitRepo().getRepository(); } }
@Override public Repository open(boolean mustExist) throws IOException { if (mustExist && !isGitRepository(path, fs)) throw new RepositoryNotFoundException(path); return new FileRepository(path); }
public Repository openRepository(String name) throws RepositoryNotFoundException { if (isUnreasonableName(name)) { throw new RepositoryNotFoundException("Invalid name: " + name); } try { final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED); return RepositoryCache.open(loc); } catch (IOException e1) { final RepositoryNotFoundException e2; e2 = new RepositoryNotFoundException("Cannot open repository " + name); e2.initCause(e1); throw e2; } }
public Repository openRepository(String name) throws RepositoryNotFoundException { if (isUnreasonableName(name)) { throw new RepositoryNotFoundException("Invalid name: " + name); } try { final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED); return RepositoryCache.open(loc); } catch (IOException e1) { final RepositoryNotFoundException e2; e2 = new RepositoryNotFoundException("Cannot open repository " + name); e2.initCause(e1); throw e2; } }
@Override public Repository open(final T client, final String name) throws RepositoryNotFoundException, ServiceNotAuthorizedException, ServiceNotEnabledException, ServiceMayNotContinueException { final JGitFileSystem fs = fsManager.get(name); if (fs == null) { throw new RepositoryNotFoundException(name); } return fs.getGit().getRepository(); }
private GitServlet createGitServlet() { final GitServlet gitServlet = new GitServlet(); gitServlet.setRepositoryResolver((req, name) -> { String trimmedName = name.endsWith(SUFFIX) ? name.substring(0, name.length() - SUFFIX.length()) : name; trimmedName = trimmedName.substring(trimmedName.lastIndexOf('/') + 1); if (repositories.containsKey(trimmedName)) { final LazilyLoadedRepository lazilyLoadedRepository = repositories.get(trimmedName); synchronized (gitServlet) { lazilyLoadedRepository.cloneRepository(); final Repository repository = lazilyLoadedRepository.get(); enableInsecureReceiving(repository); repository.incrementOpen(); return repository; } } else { throw new RepositoryNotFoundException("Repository " + name + "does not exist"); } }); gitServlet.addReceivePackFilter(new AfterReceivePackResetFilter(repositories.values())); return gitServlet; }
public Repository open(HttpServletRequest req, String name) throws RepositoryNotFoundException, ServiceNotAuthorizedException, ServiceNotEnabledException { String pluginKey = extractKeyFromUrl(name); Plugin plugin = pluginAccessor.getPlugin(pluginKey); if ((plugin != null && isPureSpeakeasyExtension(bundleContext, plugin)) || new File(gitRepositoryManager.getRepositoriesDir(), pluginKey).exists()) { gitRepositoryManager.ensureRepository(pluginKey); return resolver.open(req, pluginKey); } else { throw new RepositoryNotFoundException(name); } }
/** * Synchronises the given repository with Overleaf. * * It acquires the project lock and calls * {@link #getUpdatedRepoCritical(Optional, String)}. * @param oauth2 The oauth2 to use * @param projectName The name of the project * @throws IOException * @throws GitUserException */ public ProjectRepo getUpdatedRepo( Optional<Credential> oauth2, String projectName ) throws IOException, GitUserException { try (LockGuard __ = lock.lockGuard(projectName)) { if (!snapshotAPI.projectExists(oauth2, projectName)) { throw new RepositoryNotFoundException(projectName); } Log.info("[{}] Updating repository", projectName); return getUpdatedRepoCritical(oauth2, projectName); } }
/** * {@inheritDoc} * <p> * Create a repository matching the configuration in this builder. * <p> * If an option was not set, the build method will try to default the option * based on other options. If insufficient information is available, an * exception is thrown to the caller. * * @since 3.0 */ @Override public Repository build() throws IOException { FileRepository repo = new FileRepository(setup()); if (isMustExist() && !repo.getObjectDatabase().exists()) throw new RepositoryNotFoundException(getGitDir()); return repo; }
/** * Create a repository matching the configuration in this builder. * <p> * If an option was not set, the build method will try to default the option * based on other options. If insufficient information is available, an * exception is thrown to the caller. * * @return a repository matching this configuration. * @throws IllegalArgumentException * insufficient parameters were set. * @throws IOException * the repository could not be accessed to configure the rest of * the builder's parameters. * @since 3.0 */ @Override public Repository build() throws IOException { FileRepository repo = new FileRepository(setup()); if (isMustExist() && !repo.getObjectDatabase().exists()) throw new RepositoryNotFoundException(getGitDir()); return repo; }