org.locationtech.geogig.repository.Hints.get()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.locationtech.geogig.repository.Hints.get()方法的一些代码示例,展示了Hints.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hints.get()方法的具体详情如下:
包路径:org.locationtech.geogig.repository.Hints
类名称:Hints
方法名:get

Hints.get介绍

[英]Retrieves a hint with the given key.
[中]检索具有给定键的提示。

代码示例

代码示例来源:origin: locationtech/geogig

public EnvironmentBuilder(Hints hints) throws URISyntaxException {
  Optional<Serializable> repoUrl = hints.get(Hints.REPOSITORY_URL);
  checkArgument(repoUrl.isPresent(), "%s was not given", Hints.REPOSITORY_URL);
  URI url = new URI(String.valueOf(repoUrl.get()));
  init(url, false);
}

代码示例来源:origin: locationtech/geogig

@Test
public void testHints() {
  Hints hints = new Hints();
  assertTrue(hints.getAll().isEmpty());
  assertFalse(hints.get("not present").isPresent());
  hints.set("key", "myValue");
  assertEquals("myValue", hints.get("key").get());
  assertFalse(hints.getBoolean("key"));
  hints.set("key2", true);
  assertTrue(hints.getBoolean("key2"));
}

代码示例来源:origin: org.locationtech.geogig/geogig-postgres

public EnvironmentBuilder(Hints hints) throws URISyntaxException {
  Optional<Serializable> repoUrl = hints.get(Hints.REPOSITORY_URL);
  checkArgument(repoUrl.isPresent(), "%s was not given", Hints.REPOSITORY_URL);
  URI url = new URI(String.valueOf(repoUrl.get()));
  init(url);
}

代码示例来源:origin: locationtech/geogig

@Override
  public Platform get() {
    if (resolved == null) {
      Hints hints = this.hints.get();
      resolved = (Platform) hints.get(Hints.PLATFORM).or(new DefaultPlatform());
    }
    return resolved;
  }
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

@Override
  public Platform get() {
    if (resolved == null) {
      Hints hints = this.hints.get();
      resolved = (Platform) hints.get(Hints.PLATFORM).or(new DefaultPlatform());
    }
    return resolved;
  }
}

代码示例来源:origin: locationtech/geogig

if (hints != null && (repoUrl = hints.get(Hints.REPOSITORY_URL)).isPresent()) {
  try {
    URI uri = new URI(String.valueOf(repoUrl.get()));

代码示例来源:origin: org.locationtech.geogig/geogig-core

if (hints != null && (repoUrl = hints.get(Hints.REPOSITORY_URL)).isPresent()) {
  try {
    URI uri = new URI(String.valueOf(repoUrl.get()));

代码示例来源:origin: org.locationtech.geogig/geogig-cli

private Context newGeogigInjector(Hints hints) {
  if (repositoryURI != null) {
    LOGGER.debug("using REPO_URL '{}'", repositoryURI);
    hints.set(Hints.REPOSITORY_URL, repositoryURI);
  }
  if (!hints.get(Hints.PLATFORM).isPresent()) {
    hints.set(Hints.PLATFORM, this.platform);
  }
  Context geogigInjector = GlobalContextBuilder.builder().build(hints);
  return geogigInjector;
}

代码示例来源:origin: locationtech/geogig

private Context newGeogigInjector(Hints hints) {
  if (repositoryURI != null) {
    LOGGER.debug("using REPO_URL '{}'", repositoryURI);
    hints.set(Hints.REPOSITORY_URL, repositoryURI);
  }
  if (!hints.get(Hints.PLATFORM).isPresent()) {
    hints.set(Hints.PLATFORM, this.platform);
  }
  Context geogigInjector = GlobalContextBuilder.builder().build(hints);
  return geogigInjector;
}

代码示例来源:origin: org.locationtech.geogig/geogig-cli-core

private Context newGeogigInjector(Hints hints) {
  if (repositoryURI != null) {
    LOGGER.debug("using REPO_URL '{}'", repositoryURI);
    hints.set(Hints.REPOSITORY_URL, repositoryURI);
  }
  if (!hints.get(Hints.PLATFORM).isPresent()) {
    hints.set(Hints.PLATFORM, this.platform);
  }
  Context geogigInjector = GlobalContextBuilder.builder().build(hints);
  return geogigInjector;
}

代码示例来源:origin: org.locationtech.geogig/geogig-web-api

final String newRepoName = hints.get(Hints.REPOSITORY_NAME).get().toString();
final URI parentUri = new File(parentDir).getCanonicalFile().toURI();
final RepositoryResolver resolver = RepositoryResolver.lookup(parentUri);
final String repoName = hints.get(Hints.REPOSITORY_NAME).get().toString();
final StringBuilder pathBuilder = new StringBuilder(128);

代码示例来源:origin: org.geoserver.community/gs-geogig

if (hints.get(Hints.REPOSITORY_URL).isPresent()) {
  repoURI = URI.create(hints.get(Hints.REPOSITORY_URL).get().toString());
} else {

代码示例来源:origin: org.locationtech.geogig/geogig-web-app

private static Optional<Repository> createGeoGIG(RepositoryResolver defaultResolver,
      URI rootRepoURI, String repositoryName,
      Map<String, String> parameters) {
    try {
      final Hints hints = InitRequestUtil.createHintsFromParameters(repositoryName,
          parameters);
      Optional<Serializable> repositoryUri = hints.get(Hints.REPOSITORY_URL);
      if (!repositoryUri.isPresent()) {
        URI repoURI = defaultResolver.buildRepoURI(rootRepoURI, repositoryName);
        hints.set(Hints.REPOSITORY_URL, repoURI);
        repositoryUri = hints.get(Hints.REPOSITORY_URL);
      }
      final URI repoUri = URI.create(repositoryUri.get().toString());
      final RepositoryResolver resolver = RepositoryResolver.lookup(repoUri);
      final Repository repository = GlobalContextBuilder.builder().build(hints).repository();
      if (resolver.repoExists(repoUri)) {
        // open it
        repository.open();
      }
      // now build the repo with the Hints
      return Optional.fromNullable(repository);
    } catch (Exception ex) {
      Throwables.propagate(ex);
    }
    return Optional.absent();
  }
}

代码示例来源:origin: org.geoserver.community/gs-geogig

private static Optional<Repository> importGeogig(
      String repositoryName, Map<String, String> parameters) {
    // if the request is a POST, and the request path ends in "importExistingRepo"
    try {
      final Hints hints =
          InitRequestUtil.createHintsFromParameters(repositoryName, parameters);
      // now build the repo with the Hints
      RepositoryInfo repoInfo = new RepositoryInfo();
      // set the repo location from the URI
      if (!hints.get(Hints.REPOSITORY_URL).isPresent()) {
        return Optional.absent();
      }
      URI uri = new URI(hints.get(Hints.REPOSITORY_URL).get().toString());
      repoInfo.setLocation(uri);
      // check to see if repo is initialized
      RepositoryResolver repoResolver = RepositoryResolver.lookup(uri);
      if (!repoResolver.repoExists(uri)) {
        return Optional.absent();
      }
      // save the repo, this will set a UUID
      RepositoryManager.get().save(repoInfo);
      return Optional.of(RepositoryManager.get().getRepository(repoInfo.getId()));
    } catch (IOException | URISyntaxException e) {
      Throwables.propagate(e);
    } catch (RepositoryConnectionException e) {
      e.printStackTrace();
    }
    return Optional.absent();
  }
}

代码示例来源:origin: locationtech/geogig

@Test
public void testUri() throws URISyntaxException {
  Hints hints = new Hints();
  assertFalse(hints.get(Hints.REPOSITORY_URL).isPresent());
  URI repoURI = new URI("repoURI");
  hints.uri(repoURI);
  assertEquals(repoURI, hints.get(Hints.REPOSITORY_URL).get());
}

代码示例来源:origin: locationtech/geogig

@Override
public Context build(Hints hints) {
  if (!hints.get(Hints.PLATFORM).isPresent() && this.platform != null) {
    hints = hints.platform(platform);
  }
  Module[] overrides = { new MemoryModule(), new HintsModule(hints) };
  if (this.additionalOverrides != null) {
    List<Module> list = Lists.newArrayList(overrides);
    list.addAll(Arrays.asList(additionalOverrides));
    overrides = list.toArray(new Module[list.size()]);
  }
  GeogigModule geogigModule = new GeogigModule();
  Module override = Modules.override(geogigModule).with(overrides);
  return Guice.createInjector(override).getInstance(Context.class);
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

@Override
public Context build(Hints hints) {
  if (!hints.get(Hints.PLATFORM).isPresent() && this.platform != null) {
    hints = hints.platform(platform);
  }
  Module[] overrides = { new MemoryModule(), new HintsModule(hints) };
  if (this.additionalOverrides != null) {
    List<Module> list = Lists.newArrayList(overrides);
    list.addAll(Arrays.asList(additionalOverrides));
    overrides = list.toArray(new Module[list.size()]);
  }
  GeogigModule geogigModule = new GeogigModule();
  Module override = Modules.override(geogigModule).with(overrides);
  return Guice.createInjector(override).getInstance(Context.class);
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

Optional<Serializable> repoName = hints.get(Hints.REPOSITORY_NAME);
if (repoName.isPresent()) {
  effectiveConfigBuilder.put("repo.name", String.valueOf(repoName.get()));

代码示例来源:origin: locationtech/geogig

Optional<Serializable> repoName = hints.get(Hints.REPOSITORY_NAME);
if (repoName.isPresent()) {
  effectiveConfigBuilder.put("repo.name", String.valueOf(repoName.get()));

代码示例来源:origin: locationtech/geogig

assertFalse(hints.get(Hints.PLATFORM).isPresent());
hints.platform(platform);
assertEquals(platform, hints.get(Hints.PLATFORM).get());

相关文章