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

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

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

Hints.readOnly介绍

暂无

代码示例

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

@Override
public String getName(URI repoURI) {
  String repoName = null;
  // if the repo exists, get the name from it
  if (repoExists(repoURI)) {
    // it exists, load it and fetch the name
    Hints hints = Hints.readOnly().uri(repoURI);
    Context context = GlobalContextBuilder.builder().build(hints);
    ConfigDatabase configDatabase = context.configDatabase();
    repoName = configDatabase.get("repo.name").orNull();
  }
  if (repoName == null) {
    // the repo doesn't exist or name is not configured, derive the name from the
    // location
    File file = toFile(repoURI);
    try {
      file = file.getCanonicalFile();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    if (file.getName().equals(".geogig")) {
      file = file.getParentFile();
    }
    repoName = file.getName();
  }
  return repoName;
}

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

private static Ref pingRemote(Remote remote) throws Exception {
  Optional<IRemoteRepo> remoteRepo;
  try {
    Hints hints = Hints.readOnly();
    Repository localRepo = GlobalContextBuilder.builder().build(hints).repository();
    remoteRepo = RemoteResolver.newRemote(remote, null);
    if (!remoteRepo.isPresent()) {
      throw new IllegalArgumentException("Repository not found or not reachable");
    } else {
      IRemoteRepo repo = remoteRepo.get();
      try {
        repo.open();
        Optional<Ref> head = repo.headRef();
        return head.orNull();
      } finally {
        repo.close();
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Unable to connect: " + e.getMessage(), e);
  }
}

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

@Override
public String getName(URI repoURI) {
  String repoName = null;
  try {
    // if the repo exists, get the name from it
    if (repoExists(repoURI)) {
      // it exists, load it and fetch the name
      Hints hints = Hints.readOnly().uri(repoURI);
      Context context = GlobalContextBuilder.builder().build(hints);
      ConfigDatabase configDatabase = context.configDatabase();
      repoName = configDatabase.get("repo.name").orNull();
    }
    if (repoName == null) {
      // the repo doesn't exist or name is not configured, derive the name from the
      // location
      File file = toFile(repoURI);
      file = file.getCanonicalFile();
      if (file.getName().equals(".geogig")) {
        file = file.getParentFile();
      }
      repoName = file.getName();
    }
  } catch (IOException e) {
    Throwables.propagate(e);
  }
  return repoName;
}

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

final Context context = GlobalContextBuilder.builder().build(Hints.readOnly());
final RepositoryResolver resolver = RepositoryResolver.lookup(uri);
final boolean repoExists = resolver.repoExists(uri);

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

final Context context = GlobalContextBuilder.builder().build(Hints.readOnly());
final RepositoryResolver resolver = RepositoryResolver.lookup(uri);
final boolean repoExists = resolver.repoExists(uri);

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

final Context context = GlobalContextBuilder.builder().build(Hints.readOnly());
final RepositoryResolver resolver = RepositoryResolver.lookup(uri);
final boolean repoExists = resolver.repoExists(uri);

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

Context context = GlobalContextBuilder.builder().build(Hints.readOnly());

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

@Test
public void testReadOnly() {
  Hints hints = Hints.readOnly();
  assertTrue(hints.getBoolean(Hints.OBJECTS_READ_ONLY));
  assertTrue(hints.getBoolean(Hints.REMOTES_READ_ONLY));
}

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

geogig = cli.newGeoGIG(Hints.readOnly());
closeIt = true;

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

geogig = cli.newGeoGIG(Hints.readOnly());
closeIt = true;

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

geogig = cli.newGeoGIG(Hints.readOnly());
closeIt = true;

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

if (closeIt) {
  geogig = cli.newGeoGIG(Hints.readOnly());

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

if (closeIt) {
  geogig = cli.newGeoGIG(Hints.readOnly());

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

if (closeIt) {
  geogig = cli.newGeoGIG(Hints.readOnly());

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

@Given("^I have a merge conflict state$")
public void I_have_a_merge_conflict_state() throws Throwable {
  I_have_conflicting_branches();
  Ref branch = localRepo.geogigCLI.getGeogig(Hints.readOnly()).command(RefParse.class)
      .setName("branch1").call().get();
  try {
    localRepo.geogigCLI.getGeogig(Hints.readWrite()).command(MergeOp.class)
        .addCommit(branch.getObjectId()).call();
    fail();
  } catch (MergeConflictsException e) {
  }
}

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

@Given("^I have a merge conflict state$")
public void I_have_a_merge_conflict_state() throws Throwable {
  I_have_conflicting_branches();
  Ref branch = localRepo.geogigCLI.getGeogig(Hints.readOnly()).command(RefParse.class)
      .setName("branch1").call().get();
  try {
    localRepo.geogigCLI.getGeogig(Hints.readWrite()).command(MergeOp.class)
        .addCommit(branch.getObjectId()).call();
    fail();
  } catch (MergeConflictsException e) {
  }
}

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

@Given("^I have a merge conflict state$")
public void I_have_a_merge_conflict_state() throws Throwable {
  I_have_conflicting_branches();
  Ref branch = localRepo.geogigCLI.getGeogig(Hints.readOnly()).command(RefParse.class)
      .setName("branch1").call().get();
  try {
    localRepo.geogigCLI.getGeogig(Hints.readWrite()).command(MergeOp.class)
        .addCommit(branch.getObjectId()).call();
    fail();
  } catch (MergeConflictsException e) {
  }
}

相关文章