Esempio n. 1
0
  public RepositoryInfo save(RepositoryInfo info) {
    Preconditions.checkNotNull(info.getLocation());
    if (info.getId() == null) {
      create(info);
    } else {
      // see if the name has changed. If so, update the repo config
      try {
        RepositoryInfo currentInfo = get(info.getId());
        handleRepoRename(currentInfo, info);
      } catch (IOException ioe) {

      }
    }
    // so far we don't need to invalidate the GeoGIG instance from the cache here... re-evaluate
    // if any configuration option would require so in the future
    return store.save(info);
  }
Esempio n. 2
0
 private void handleRepoRename(RepositoryInfo oldRepo, RepositoryInfo newRepo) {
   if (Objects.equal(oldRepo.getId(), newRepo.getId())) {
     // repos have the same ID, check the names
     final String oldName = oldRepo.getRepoName();
     final String newName = newRepo.getRepoName();
     if (!Objects.equal(oldName, newName)) {
       // name has been changed, update the repo
       try {
         getRepository(oldRepo.getId())
             .command(ConfigOp.class)
             .setAction(ConfigOp.ConfigAction.CONFIG_SET)
             .setName("repo.name")
             .setScope(ConfigOp.ConfigScope.LOCAL)
             .setValue(newName)
             .call();
       } catch (IOException ioe) {
         // log?
       }
     }
   }
 }