}
public void process(JCas jcas) throws AnalysisEngineProcessException {
Iterator<FeatureStructure> fsit = jcas.getIndexRepository().getAllIndexedFS(jcas.getCasType(Workitem.type));
if (fsit.hasNext()) {
Workitem wi = (Workitem) fsit.next();
if (outputFilename == null || !outputFilename.equals(wi.getOutputspec())) {
// this Work Item contained no documents. Create empty output file.
try {
outFile = new File(wi.getOutputspec());
File outDir = outFile.getParentFile();
if (outDir != null && !outDir.exists()) {
outDir.mkdirs();
}
zos = new ZipOutputStream(new FileOutputStream(outFile));
zos.close();
logger.log(Level.INFO, "DuccCasCC: Flushed empty "+wi.getOutputspec());
return;
} catch (Exception e) {
throw new AnalysisEngineProcessException(e);
}
}
try {
zos.close();
fos.close();
if (!outFile.renameTo(new File(outputFilename))) {
throw new IOException("Rename failed for "+outputFilename);
}
} catch (IOException e) {
throw new AnalysisEngineProcessException(e);
}
logger.log(Level.INFO, "DuccCasCC: Flushed "+wi.getOutputspec());
return;
}
fsit = jcas.getIndexRepository().getAllIndexedFS(jcas.getCasType(DuccDocumentInfo.type));
if (!fsit.hasNext()) {