/** * Calls on {@link ResolveGeogigURI} to get the repository's URI, looks up the proper * {@link RepsitoryResolver} through the provided SPI mechanism, and calls * {@link RepositoryResolver#delete(URI)} to delete the repo. * <p> * Precondition: {#link #isOpen()} must return {code false} */ public static void delete(URI repoURI) throws Exception { RepositoryResolver resolver = RepositoryResolver.lookup(repoURI); resolver.delete(repoURI); } }
/** * @param repositoryLocation the URI with the location of the repository to load * @return a {@link Repository} loaded from the given URI, already {@link Repository#open() * open} * @throws IllegalArgumentException if no registered {@link RepositoryResolver} implementation * can load the repository at the given location * @throws RepositoryConnectionException if the repository can't be opened */ public static Repository load(URI repositoryLocation) throws RepositoryConnectionException { RepositoryResolver initializer = RepositoryResolver.lookup(repositoryLocation); Repository repository = initializer.open(repositoryLocation); return repository; }
/** * Calls on {@link ResolveGeogigURI} to get the repository's URI, looks up the proper * {@link RepsitoryResolver} through the provided SPI mechanism, and calls * {@link RepositoryResolver#delete(URI)} to delete the repo. * <p> * Precondition: {#link #isOpen()} must return {code false} */ public static void delete(URI repoURI) throws Exception { RepositoryResolver resolver = RepositoryResolver.lookup(repoURI); resolver.delete(repoURI); } }
public MultiRepositoryProvider(final URI rootRepoURI) { checkNotNull(rootRepoURI, "root repo URI is null"); resolver = RepositoryResolver.lookup(rootRepoURI); this.rootRepoURI = rootRepoURI; try { this.repositories = buildCache(); } catch (IOException e) { throw Throwables.propagate(e); } }
/** * @param repositoryLocation the URI with the location of the repository to load * @return a {@link Repository} loaded from the given URI, already {@link Repository#open() * open} * @throws IllegalArgumentException if no registered {@link RepositoryResolver} implementation * can load the repository at the given location * @throws RepositoryConnectionException if the repository can't be opened */ public static Repository load(URI repositoryLocation) throws RepositoryConnectionException { RepositoryResolver initializer = RepositoryResolver.lookup(repositoryLocation); Repository repository = initializer.open(repositoryLocation); return repository; }
/** * Resolve the config database using the provided parameters. * * @param repoURI the repository URI * @param repoContext the repository context * @param rootUri {@code true} if {@code repoURI} represents a root URI to a group of * repositories * @return the config database */ public static ConfigDatabase resolveConfigDatabase(URI repoURI, Context repoContext, boolean rootUri) { RepositoryResolver initializer = RepositoryResolver.lookup(repoURI); return initializer.getConfigDatabase(repoURI, repoContext, rootUri); }
public String getRepoName() { if (this.location != null) { if (this.repoName == null) { // lookup the resolver if (RepositoryResolver.resolverAvailableForURIScheme(this.location.getScheme())) { RepositoryResolver resolver = RepositoryResolver.lookup(this.location); this.repoName = resolver.getName(this.location); } } } return this.repoName; }
/** * @return the name of the repository * @see org.locationtech.geogig.repository.AbstractGeoGigOp#call() */ @Override protected String _call() { Optional<String> repoName = configDb.get("repo.name"); if (repoName.isPresent()) { return repoName.get(); } URI repoURI = repository().getLocation(); RepositoryResolver resolver = RepositoryResolver.lookup(repoURI); return resolver.getName(repoURI); } }
@Override public Object getDisplayValue(String repoUriStr) { try { URI repoUri = new URI(repoUriStr); RepositoryResolver resolver = RepositoryResolver.lookup(repoUri); RepositoryInfo info = RepositoryManager.get().getByRepoName(resolver.getName(repoUri)); return info.getRepoName() + " (" + info.getMaskedLocation() + ")"; } catch (URISyntaxException e) { throw Throwables.propagate(e); } }
@Test public void testLookup() throws URISyntaxException { URI uri = new URI("test://somerepo"); RepositoryResolver initializer = RepositoryResolver.lookup(uri); assertNotNull(initializer); assertTrue(initializer instanceof TestResolver); }
@Test public void testLookup() throws URISyntaxException { URI uri = new URI("test://somerepo"); RepositoryResolver initializer = RepositoryResolver.lookup(uri); assertNotNull(initializer); assertTrue(initializer instanceof TestResolver); }
@Then("^the repository shall exist$") public void the_repository_shall_exist() throws Throwable { List<String> output = localRepo.runAndParseCommand(true, "rev-parse", "--resolve-geogig-uri"); assertEquals(output.toString(), 1, output.size()); String location = output.get(0); assertNotNull(location); URI repoURI = resolveURI(location); boolean repoExists = RepositoryResolver.lookup(repoURI).repoExists(repoURI); assertTrue("Repository not found: " + repoURI, repoExists); }
@Then("^the repository shall exist$") public void the_repository_shall_exist() throws Throwable { List<String> output = localRepo.runAndParseCommand(true, "rev-parse", "--resolve-geogig-uri"); assertEquals(output.toString(), 1, output.size()); String location = output.get(0); assertNotNull(location); URI repoURI = resolveURI(location); boolean repoExists = RepositoryResolver.lookup(repoURI).repoExists(repoURI); assertTrue("Repository not found: " + repoURI, repoExists); }
@Then("^the repository shall exist$") public void the_repository_shall_exist() throws Throwable { List<String> output = localRepo.runAndParseCommand(true, "rev-parse", "--resolve-geogig-uri"); assertEquals(output.toString(), 1, output.size()); String location = output.get(0); assertNotNull(location); URI repoURI = resolveURI(location); boolean repoExists = RepositoryResolver.lookup(repoURI).repoExists(repoURI); assertTrue("Repository not found: " + repoURI, repoExists); }
@Then("^the repository at \"([^\"]*)\" shall not exist$") public void the_repository_at_shall_not_exist(String repoUri) throws Throwable { repoUri = replaceKnownVariables(repoUri); URI uri = resolveURI(repoUri); boolean exists = RepositoryResolver.lookup(uri).repoExists(uri); assertFalse("Repository exists: " + uri, exists); }
@Then("^the repository at \"([^\"]*)\" shall exist$") public void the_repository_at_shall_exist(String repoUri) throws Throwable { repoUri = replaceKnownVariables(repoUri); URI uri = resolveURI(repoUri); boolean exists = RepositoryResolver.lookup(uri).repoExists(uri); assertTrue("Repository does not exist: " + uri, exists); }
@Then("^the repository at \"([^\"]*)\" shall exist$") public void the_repository_at_shall_exist(String repoUri) throws Throwable { repoUri = replaceKnownVariables(repoUri); URI uri = resolveURI(repoUri); boolean exists = RepositoryResolver.lookup(uri).repoExists(uri); assertTrue("Repository does not exist: " + uri, exists); }
@Then("^the repository at \"([^\"]*)\" shall not exist$") public void the_repository_at_shall_not_exist(String repoUri) throws Throwable { repoUri = replaceKnownVariables(repoUri); URI uri = resolveURI(repoUri); boolean exists = RepositoryResolver.lookup(uri).repoExists(uri); assertFalse("Repository exists: " + uri, exists); }
@Then("^the repository at \"([^\"]*)\" shall exist$") public void the_repository_at_shall_exist(String repoUri) throws Throwable { repoUri = replaceKnownVariables(repoUri); URI uri = resolveURI(repoUri); boolean exists = RepositoryResolver.lookup(uri).repoExists(uri); assertTrue("Repository does not exist: " + uri, exists); }
@Then("^the repository at \"([^\"]*)\" shall not exist$") public void the_repository_at_shall_not_exist(String repoUri) throws Throwable { repoUri = replaceKnownVariables(repoUri); URI uri = resolveURI(repoUri); boolean exists = RepositoryResolver.lookup(uri).repoExists(uri); assertFalse("Repository exists: " + uri, exists); }