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

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

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

Hints.set介绍

[英]Sets a hint with the given key and value.
[中]使用给定的键和值设置提示。

代码示例

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

/**
 * Sets a hint for the provided repository URI.
 * 
 * @param repoURI the URI to use
 * @return {@code this}
 */
public Hints uri(URI repoURI) {
  set(REPOSITORY_URL, repoURI);
  return this;
}

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

/**
   * Sets a hint for the provided {@link Platform}
   * 
   * @param platform the platform to set
   * @return {@code this}
   */
  public Hints platform(Platform platform) {
    set(PLATFORM, platform);
    return this;
  }
}

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

private void checkAnnotationHint(Class<? extends CLICommand> cmdClass,
    Class<? extends Annotation> annotation, String key, Hints hints) {
  if (cmdClass.isAnnotationPresent(annotation)) {
    hints.set(key, Boolean.TRUE);
  }
}

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

private void checkAnnotationHint(Class<? extends CLICommand> cmdClass,
    Class<? extends Annotation> annotation, String key, Hints hints) {
  if (cmdClass.isAnnotationPresent(annotation)) {
    hints.set(key, Boolean.TRUE);
  }
}

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

/**
 * @return a new {@code Hints} object with the hints for a read only repository
 */
public static Hints readOnly() {
  Hints hints = new Hints();
  hints.set(Hints.OBJECTS_READ_ONLY, Boolean.TRUE);
  hints.set(Hints.REMOTES_READ_ONLY, Boolean.TRUE);
  return hints;
}

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

/**
 * @return a new {@code Hints} object with the hints for a repository with read/write access
 */
public static Hints readWrite() {
  Hints hints = new Hints();
  hints.set(Hints.OBJECTS_READ_ONLY, Boolean.FALSE);
  hints.set(Hints.REMOTES_READ_ONLY, Boolean.FALSE);
  return hints;
}

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

/**
 * @return a new {@code Hints} object with the hints for a read only repository
 */
public static Hints readOnly() {
  Hints hints = new Hints();
  hints.set(Hints.OBJECTS_READ_ONLY, Boolean.TRUE);
  hints.set(Hints.REMOTES_READ_ONLY, Boolean.TRUE);
  return hints;
}

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

/**
 * @return a new {@code Hints} object with the hints for a repository with read/write access
 */
public static Hints readWrite() {
  Hints hints = new Hints();
  hints.set(Hints.OBJECTS_READ_ONLY, Boolean.FALSE);
  hints.set(Hints.REMOTES_READ_ONLY, Boolean.FALSE);
  return hints;
}

代码示例来源: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-web-api

public static Hints createHintsFromParameters(final String repositoryName,
      final Map<String, String> parameters) throws UnsupportedEncodingException,
      URISyntaxException, IOException, RepositoryConnectionException {
    final Hints hints = new Hints();
    hints.set(Hints.REPOSITORY_NAME, repositoryName);
    // try to build the Repo URI from any Request parameters.
    INSTANCE.updateHintsWithParams(hints, parameters);
    return hints;
  }
}

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

@Override
public Repository open(URI repositoryLocation) throws RepositoryConnectionException {
  Preconditions.checkArgument(canHandle(repositoryLocation), "Not a PostgreSQL URI: %s",
      repositoryLocation);
  Hints hints = new Hints();
  hints.set(Hints.REPOSITORY_URL, repositoryLocation.toString());
  Context context = GlobalContextBuilder.builder().build(hints);
  Repository repository = new GeoGIG(context).getRepository();
  repository.open();
  return repository;
}

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

@Test
public void testToString() {
  Hints hints = new Hints();
  hints.set("key1", "value1");
  hints.set("key2", "value2");
  assertEquals(hints.getAll().toString(), hints.toString());
}

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

@Override
protected ObjectStore createObjectStore() throws IOException {
  Platform platform = new DefaultPlatform();
  platform.setWorkingDir(tmp.getRoot());
  tmp.newFolder(".geogig");
  Hints hints = Hints.readWrite().platform(platform);
  try {
    hints.set(Hints.REPOSITORY_URL, tmp.getRoot().toURI().toURL());
  } catch (MalformedURLException e) {
    throw new RuntimeException(e);
  }
  return new RocksdbObjectStore(platform, hints);
}

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

@Override
protected HeapObjectDatabase createOpen(boolean readOnly) {
  Platform platform = new DefaultPlatform();
  Hints hints = new Hints();
  hints.set(Hints.OBJECTS_READ_ONLY, readOnly);
  HeapObjectDatabase store = new HeapObjectDatabase(platform, hints);
  store.open();
  return store;
}

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

@Override
protected HeapObjectDatabase createOpen(boolean readOnly) {
  Platform platform = new DefaultPlatform();
  Hints hints = new Hints();
  hints.set(Hints.OBJECTS_READ_ONLY, readOnly);
  HeapObjectDatabase store = new HeapObjectDatabase(platform, hints);
  store.open();
  return store;
}

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

@Override
  protected Context createInjector() {

    String repoUrl = testConfig.getRepoURL();

    Hints hints = new Hints();
    hints.set(Hints.REPOSITORY_URL, repoUrl);
    return Guice.createInjector(Modules.override(new GeogigModule())
        .with(new HintsModule(hints), new PGStorageModule())).getInstance(Context.class);
  }
}

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

@Override
  protected Context createInjector() {

    String repoUrl = testConfig.getRepoURL();

    Hints hints = new Hints();
    hints.set(Hints.REPOSITORY_URL, repoUrl);
    return Guice.createInjector(Modules.override(new GeogigModule())
        .with(new HintsModule(hints), new PGStorageModule())).getInstance(Context.class);
  }
}

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

@Override
  protected Context createInjector() {

    String repoUrl = testConfig.getRepoURL();

    Hints hints = new Hints();
    hints.set(Hints.REPOSITORY_URL, repoUrl);
    Context context = Guice.createInjector(Modules.override(new GeogigModule())
        .with(new HintsModule(hints), new PGStorageModule())).getInstance(Context.class);
    return context;
  }
}

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

@Override
protected RocksdbObjectDatabase createOpen(boolean readOnly) {
  Hints hints = new Hints();
  hints.set(Hints.OBJECTS_READ_ONLY, readOnly);
  configdb = new HeapConfigDatabase();
  RocksdbObjectDatabase database = new RocksdbObjectDatabase(platform, hints, configdb);
  database.open();
  return database;
}

相关文章