use of org.apache.archiva.repository.features.IndexCreationEvent in project archiva by apache.
the class RepositoryRegistry method raise.
@Override
public <T> void raise(RepositoryEvent<T> event) {
if (event instanceof IndexCreationEvent) {
if (managedRepositories.containsKey(event.getRepository().getId()) || remoteRepositories.containsKey(event.getRepository().getId())) {
EditableRepository repo = (EditableRepository) event.getRepository();
if (repo != null && repo.getIndexingContext() != null) {
try {
ArchivaIndexManager idxmgr = getIndexManager(repo.getType());
if (idxmgr != null) {
ArchivaIndexingContext newCtx = idxmgr.move(repo.getIndexingContext(), repo);
repo.setIndexingContext(newCtx);
idxmgr.updateLocalIndexPath(repo);
}
} catch (IndexCreationFailedException e) {
log.error("Could not move index to new directory {}", e.getMessage(), e);
}
}
}
}
for (RepositoryEventListener listener : listeners) {
listener.raise(event);
}
}
Aggregations