private Path getPackedIndexPath(Repository repo) throws IOException { IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); Path repoDir = repo.getLocalPath(); URI indexDir = icf.getPackedIndexPath(); Path indexDirectory = null; if ( ! StringUtils.isEmpty(indexDir.toString( ) ) ) { indexDirectory = PathUtil.getPathFromUri( indexDir ); // not absolute so create it in repository directory if ( !indexDirectory.isAbsolute( ) ) { indexDirectory = repoDir.resolve( indexDirectory ); } } else { indexDirectory = repoDir.resolve( DEFAULT_PACKED_INDEX_DIR ); } if ( !Files.exists( indexDirectory ) ) { Files.createDirectories( indexDirectory ); } return indexDirectory; }
private Path getIndexPath(Repository repo) throws IOException { IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); Path repoDir = repo.getLocalPath(); URI indexDir = icf.getIndexPath(); Path indexDirectory = null; if ( ! StringUtils.isEmpty(indexDir.toString( ) ) ) { indexDirectory = PathUtil.getPathFromUri( indexDir ); // not absolute so create it in repository directory if ( !indexDirectory.isAbsolute( ) ) { indexDirectory = repoDir.resolve( indexDirectory ); } } else { indexDirectory = repoDir.resolve( DEFAULT_INDEXER_DIR); } if ( !Files.exists( indexDirectory ) ) { Files.createDirectories( indexDirectory ); } return indexDirectory; }
private Path getIndexPath(Repository repo) throws IOException { IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); Path repoDir = repo.getLocalPath(); URI indexDir = icf.getIndexPath(); Path indexDirectory = null; if ( ! StringUtils.isEmpty(indexDir.toString( ) ) ) { indexDirectory = PathUtil.getPathFromUri( indexDir ); // not absolute so create it in repository directory if ( !indexDirectory.isAbsolute( ) ) { indexDirectory = repoDir.resolve( indexDirectory ); } } else { indexDirectory = repoDir.resolve( DEFAULT_INDEXER_DIR ); } if ( !Files.exists( indexDirectory ) ) { Files.createDirectories( indexDirectory ); } return indexDirectory; }
@Override public void updateLocalIndexPath(Repository repo) { if (repo.supportsFeature(IndexCreationFeature.class)) { IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); try { icf.setLocalIndexPath(getIndexPath(repo)); } catch (IOException e) { log.error("Could not set local index path for {}. New URI: {}", repo.getId(), icf.getIndexPath()); } } }
@Override public void updateLocalIndexPath(Repository repo) { if (repo.supportsFeature(IndexCreationFeature.class)) { IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); try { icf.setLocalIndexPath(getIndexPath(repo)); icf.setLocalPackedIndexPath(getPackedIndexPath(repo)); } catch (IOException e) { log.error("Could not set local index path for {}. New URI: {}", repo.getId(), icf.getIndexPath()); } } }
RemoteIndexFeature rif = context.getRepository().getFeature(RemoteIndexFeature.class).get(); remoteUpdateUri = context.getRepository().getLocation().resolve(rif.getIndexUri());