use of com.adaptris.fs.FsException in project interlok by adaptris.
the class TraversingFsConsumer method handleFile.
private int handleFile(File originalFile) throws CoreException {
int rc = 0;
logFile(originalFile, "handleFile ");
try {
if (originalFile.getName().endsWith(getWipSuffix())) {
log.debug("ignoring part-processed file [{}]", originalFile.getName());
} else if (fileFilter != null && !fileFilter.accept(originalFile)) {
log.trace("File [{}] doesn't match filter", originalFile.getName());
} else {
if (checkModified(originalFile) && isFileAccessible(originalFile)) {
File wipFile = renameFile(originalFile);
AdaptrisMessage msg = createAdaptrisMessage(wipFile);
addStandardMetadata(msg, originalFile, wipFile);
retrieveAdaptrisMessageListener().onAdaptrisMessage(msg);
fsWorker.delete(wipFile);
rc++;
} else {
log.trace("[{}] not deemed safe to process", originalFile.getName());
}
}
} catch (FsException e) {
throw new CoreException(e);
} catch (IOException e) {
throw new CoreException(e);
}
return rc;
}
use of com.adaptris.fs.FsException in project interlok by adaptris.
the class LargeFsConsumer method processFile.
@Override
protected int processFile(File originalFile) throws CoreException {
int rc = 0;
try {
if (originalFile.getName().endsWith(getWipSuffix())) {
log.debug("ignoring part-processed file [{}]", originalFile.getName());
} else {
if (checkModified(originalFile) && isFileAccessible(originalFile)) {
File wipFile = renameFile(originalFile);
AdaptrisMessage msg = decode(wipFile);
addStandardMetadata(msg, originalFile, wipFile);
retrieveAdaptrisMessageListener().onAdaptrisMessage(msg);
rc++;
tracker.track(wipFile, msg, FileDeleteStrategy.FORCE);
} else {
log.trace("{} not deemed safe to process", originalFile.getName());
}
}
} catch (FsException | IOException e) {
throw new CoreException(e);
}
return rc;
}
Aggregations