use of org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException in project archiva by apache.
the class ArchivaIndexManagerMock method createRemoteContext.
private IndexingContext createRemoteContext(RemoteRepository remoteRepository) throws IOException {
Path appServerBase = archivaConfiguration.getAppServerBaseDir();
String contextKey = "remote-" + remoteRepository.getId();
// create remote repository path
Path repoDir = remoteRepository.getLocalPath();
if (!Files.exists(repoDir)) {
Files.createDirectories(repoDir);
}
Path indexDirectory = null;
// is there configured indexDirectory ?
if (remoteRepository.supportsFeature(RemoteIndexFeature.class)) {
RemoteIndexFeature rif = remoteRepository.getFeature(RemoteIndexFeature.class).get();
indexDirectory = getIndexPath(remoteRepository);
String remoteIndexUrl = calculateIndexRemoteUrl(remoteRepository.getLocation(), rif);
try {
return getIndexingContext(remoteRepository, contextKey, repoDir, indexDirectory, remoteIndexUrl);
} catch (IndexFormatTooOldException e) {
// existing index with an old lucene format so we need to delete it!!!
// delete it first then recreate it.
//
log.warn(//
"the index of repository {} is too old we have to delete and recreate it", remoteRepository.getId());
org.apache.archiva.common.utils.FileUtils.deleteDirectory(indexDirectory);
return getIndexingContext(remoteRepository, contextKey, repoDir, indexDirectory, remoteIndexUrl);
}
} else {
throw new IOException("No remote index defined");
}
}
use of org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException in project archiva by apache.
the class MavenIndexManager method createManagedContext.
private IndexingContext createManagedContext(ManagedRepository repository) throws IOException {
IndexingContext context;
// take care first about repository location as can be relative
Path repositoryDirectory = repository.getLocalPath();
if (!Files.exists(repositoryDirectory)) {
try {
Files.createDirectories(repositoryDirectory);
} catch (IOException e) {
log.error("Could not create directory {}", repositoryDirectory);
}
}
Path indexDirectory = null;
if (repository.supportsFeature(IndexCreationFeature.class)) {
indexDirectory = getIndexPath(repository);
String indexUrl = repositoryDirectory.toUri().toURL().toExternalForm();
try {
context = getIndexingContext(repository, repository.getId(), repositoryDirectory, indexDirectory, indexUrl);
context.setSearchable(repository.isScanned());
} catch (IndexFormatTooOldException e) {
// existing index with an old lucene format so we need to delete it!!!
// delete it first then recreate it.
//
log.warn(//
"the index of repository {} is too old we have to delete and recreate it", repository.getId());
org.apache.archiva.common.utils.FileUtils.deleteDirectory(indexDirectory);
context = getIndexingContext(repository, repository.getId(), repositoryDirectory, indexDirectory, indexUrl);
context.setSearchable(repository.isScanned());
}
return context;
} else {
throw new IOException("No repository index defined");
}
}
use of org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException in project archiva by apache.
the class ArchivaIndexManagerMock method createManagedContext.
private IndexingContext createManagedContext(ManagedRepository repository) throws IOException {
IndexingContext context;
// take care first about repository location as can be relative
Path repositoryDirectory = repository.getLocalPath();
if (!Files.exists(repositoryDirectory)) {
try {
Files.createDirectories(repositoryDirectory);
} catch (IOException e) {
log.error("Could not create directory {}", repositoryDirectory);
}
}
Path indexDirectory = null;
if (repository.supportsFeature(IndexCreationFeature.class)) {
indexDirectory = getIndexPath(repository);
String indexUrl = repositoryDirectory.toUri().toURL().toExternalForm();
try {
context = getIndexingContext(repository, repository.getId(), repositoryDirectory, indexDirectory, indexUrl);
context.setSearchable(repository.isScanned());
} catch (IndexFormatTooOldException e) {
// existing index with an old lucene format so we need to delete it!!!
// delete it first then recreate it.
//
log.warn(//
"the index of repository {} is too old we have to delete and recreate it", repository.getId());
org.apache.archiva.common.utils.FileUtils.deleteDirectory(indexDirectory);
context = getIndexingContext(repository, repository.getId(), repositoryDirectory, indexDirectory, indexUrl);
context.setSearchable(repository.isScanned());
}
return context;
} else {
throw new IOException("No repository index defined");
}
}
use of org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException in project archiva by apache.
the class MavenIndexManager method createRemoteContext.
private IndexingContext createRemoteContext(RemoteRepository remoteRepository) throws IOException {
Path appServerBase = archivaConfiguration.getAppServerBaseDir();
String contextKey = "remote-" + remoteRepository.getId();
// create remote repository path
Path repoDir = remoteRepository.getLocalPath();
if (!Files.exists(repoDir)) {
Files.createDirectories(repoDir);
}
Path indexDirectory = null;
// is there configured indexDirectory ?
if (remoteRepository.supportsFeature(RemoteIndexFeature.class)) {
RemoteIndexFeature rif = remoteRepository.getFeature(RemoteIndexFeature.class).get();
indexDirectory = getIndexPath(remoteRepository);
String remoteIndexUrl = calculateIndexRemoteUrl(remoteRepository.getLocation(), rif);
try {
return getIndexingContext(remoteRepository, contextKey, repoDir, indexDirectory, remoteIndexUrl);
} catch (IndexFormatTooOldException e) {
// existing index with an old lucene format so we need to delete it!!!
// delete it first then recreate it.
//
log.warn(//
"the index of repository {} is too old we have to delete and recreate it", remoteRepository.getId());
org.apache.archiva.common.utils.FileUtils.deleteDirectory(indexDirectory);
return getIndexingContext(remoteRepository, contextKey, repoDir, indexDirectory, remoteIndexUrl);
}
} else {
throw new IOException("No remote index defined");
}
}
use of org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException in project archiva by apache.
the class ArchivaIndexManagerMock method createRemoteContext.
private IndexingContext createRemoteContext(RemoteRepository remoteRepository) throws IOException {
Path appServerBase = archivaConfiguration.getAppServerBaseDir();
String contextKey = "remote-" + remoteRepository.getId();
// create remote repository path
Path repoDir = remoteRepository.getLocalPath();
if (!Files.exists(repoDir)) {
Files.createDirectories(repoDir);
}
Path indexDirectory = null;
// is there configured indexDirectory ?
if (remoteRepository.supportsFeature(RemoteIndexFeature.class)) {
RemoteIndexFeature rif = remoteRepository.getFeature(RemoteIndexFeature.class).get();
indexDirectory = getIndexPath(remoteRepository);
String remoteIndexUrl = calculateIndexRemoteUrl(remoteRepository.getLocation(), rif);
try {
return getIndexingContext(remoteRepository, contextKey, repoDir, indexDirectory, remoteIndexUrl);
} catch (IndexFormatTooOldException e) {
// existing index with an old lucene format so we need to delete it!!!
// delete it first then recreate it.
//
log.warn(//
"the index of repository {} is too old we have to delete and recreate it", remoteRepository.getId());
org.apache.archiva.common.utils.FileUtils.deleteDirectory(indexDirectory);
return getIndexingContext(remoteRepository, contextKey, repoDir, indexDirectory, remoteIndexUrl);
}
} else {
throw new IOException("No remote index defined");
}
}
Aggregations