public synchronized void processCas(CAS aCAS) throws ResourceProcessException {
    JCas jcas;
    try {
      jcas = aCAS.getJCas();
    } catch (CASException e) {
      throw new ResourceProcessException(e);
    }
    int flag = 0;
    boolean titleP = false;
    String docUri = null;
    Iterator it = jcas.getAnnotationIndex(SourceDocumentInformation.type).iterator();
    if (it.hasNext()) {
      SourceDocumentInformation srcDocInfo = (SourceDocumentInformation) it.next();
      docUri = srcDocInfo.getUri();
    }

    // iterate and print annotations
    Iterator annotationIter = (Iterator) jcas.getIndexRepository().getIndex("geneindex").iterator();
    while (annotationIter.hasNext()) {
      Sentence annot = (Sentence) annotationIter.next();
      String aText = annot.getCoveredText();
      aText = aText.replace('\n', ' ');
      aText = aText.replace('\r', ' ');
      try {
        fileWriter.write(annot.getSentenceId()+"|"+annot.getBegin()+" "+annot.getEnd() +"|"+ annot.getTextstring() + "\n");
        fileWriter.flush();
      } catch (IOException e) {
        throw new ResourceProcessException(e);
      }
    }
  }