use of org.apache.archiva.consumers.RepositoryContentConsumer in project archiva by apache.
the class ConsumerWantsFilePredicate method evaluate.
@Override
public boolean evaluate(RepositoryContentConsumer object) {
boolean satisfies = false;
RepositoryContentConsumer consumer = (RepositoryContentConsumer) object;
if (wantsFile(consumer, FilenameUtils.separatorsToUnix(basefile.getRelativePath()))) {
satisfies = true;
// regardless of the timestamp, we record that it was wanted so it doesn't get counted as invalid
wantedFileCount++;
if (!consumer.isProcessUnmodified()) {
// Timestamp finished points to the last successful scan, not this current one.
if (basefile.lastModified() < changesSince) {
// Skip file as no change has occurred.
satisfies = false;
}
}
}
return satisfies;
}
use of org.apache.archiva.consumers.RepositoryContentConsumer in project archiva by apache.
the class ConsumerProcessFileClosure method execute.
@Override
public void execute(RepositoryContentConsumer input) {
RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
String id = consumer.getId();
try {
log.debug("Sending to consumer: {}", id);
long startTime = System.currentTimeMillis();
consumer.processFile(basefile.getRelativePath(), executeOnEntireRepo);
long endTime = System.currentTimeMillis();
if (consumerTimings != null) {
Long value = consumerTimings.get(id);
consumerTimings.put(id, (value != null ? value : 0) + endTime - startTime);
}
if (consumerCounts != null) {
Long value = consumerCounts.get(id);
consumerCounts.put(id, (value != null ? value : 0) + 1);
}
} catch (Exception e) {
/* Intentionally Catch all exceptions.
* So that the discoverer processing can continue.
*/
log.error("Consumer [{}] had an error when processing file [" + "{}]: {}", id, basefile.getAbsolutePath(), e.getMessage(), e);
}
}
Aggregations