"Collecting deletable snapshots on repository " + repository.getId() + " from storage directory "
+ repository.getLocalUrl()
);
}
final ParentOMatic parentOMatic = new ParentOMatic();
// create a walker to collect deletables and let it loose on collections only
final SnapshotRemoverWalkerProcessor snapshotRemoveProcessor =
new SnapshotRemoverWalkerProcessor(repository, request, parentOMatic);
final DefaultWalkerContext ctxMain =
new DefaultWalkerContext(repository,
new ResourceStoreRequest("/"),
new DottedStoreWalkerFilter(),
TraversalType.BREADTH_FIRST,
false);
ctxMain.getContext().put(DeleteOperation.DELETE_OPERATION_CTX_KEY, getDeleteOperation(request));
ctxMain.getProcessors().add(snapshotRemoveProcessor);
walker.walk(ctxMain);
if (ctxMain.getStopCause() != null) {
result.setSuccessful(false);
}
// and collect results
result.setDeletedSnapshots(snapshotRemoveProcessor.getDeletedSnapshots());
result.setDeletedFiles(snapshotRemoveProcessor.getDeletedFiles());
if (log.isDebugEnabled()) {
log.debug(
"Collected and deleted " + snapshotRemoveProcessor.getDeletedSnapshots()
+ " snapshots with alltogether " + snapshotRemoveProcessor.getDeletedFiles()
+ " files on repository " + repository.getId()
);
}
// if we are processing a hosted-snapshot repository, we need to rebuild maven metadata
// without this if below, the walk would happen against proxy repositories too, but doing nothing!
if (repository.getRepositoryKind().isFacetAvailable(HostedRepository.class)) {
// expire NFC since we might create new maven metadata files
repository.expireNotFoundCaches(new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT));
RecreateMavenMetadataWalkerProcessor metadataRebuildProcessor =
new RecreateMavenMetadataWalkerProcessor(log, getDeleteOperation(request));
for (String path : parentOMatic.getMarkedPaths()) {
TaskUtil.checkInterruption();
DefaultWalkerContext ctxMd =
new DefaultWalkerContext(repository, new ResourceStoreRequest(path),
new DottedStoreWalkerFilter());