Package org.apache.uima.analysis_engine

Examples of org.apache.uima.analysis_engine.AnalysisEngineProcessException


  public final Flow newCasProduced(AbstractCas newCas, String producedBy)
          throws AnalysisEngineProcessException {
    if (newCas instanceof CAS) {
      return newCasProduced((CAS) newCas, producedBy);
    } else {
      throw new AnalysisEngineProcessException(
              AnalysisEngineProcessException.INCORRECT_CAS_INTERFACE, new Object[] { CAS.class,
                  newCas.getClass() });
    }
  }
View Full Code Here


  public final Flow newCasProduced(AbstractCas newCas, String producedBy)
          throws AnalysisEngineProcessException {
    if (newCas instanceof JCas) {
      return newCasProduced((JCas) newCas, producedBy);
    } else {
      throw new AnalysisEngineProcessException(
              AnalysisEngineProcessException.INCORRECT_CAS_INTERFACE, new Object[] { JCas.class,
                  newCas.getClass() });
    }
  }
View Full Code Here

   *
   * @see org.apache.uima.annotator.Annotator#process(org.apache.uima.core.AbstractCas)
   */
  public void process(AbstractCas aCAS) throws AnalysisEngineProcessException {
    if (!mCasInterface.isAssignableFrom(aCAS.getClass())) {
      throw new AnalysisEngineProcessException(
              AnalysisEngineProcessException.INCORRECT_CAS_INTERFACE, new Object[] { mCasInterface,
                  aCAS.getClass() });
    }

    // check if type system changed; if so, notify Annotator
    checkTypeSystemChange(aCAS);

    // do proper typecasts and call process method
    try {
      if (mAnnotator instanceof TextAnnotator) {
        CAS cas = (CAS) aCAS;
        ResultSpecification rs = getResultSpecForLanguage(cas.getDocumentLanguage());
        rs.setTypeSystem(cas.getTypeSystem());
        ((TextAnnotator) mAnnotator).process(cas, rs);
      } else if (mAnnotator instanceof JTextAnnotator) {
        JCas jcas = (JCas) aCAS;
        ResultSpecification rs = getResultSpecForLanguage(jcas.getDocumentLanguage());
        rs.setTypeSystem(jcas.getTypeSystem());
        ((JTextAnnotator) mAnnotator).process(jcas, rs);
      } else if (mAnnotator instanceof GenericAnnotator) {
        mDefaultResultSpecification.setTypeSystem(((CAS) aCAS).getTypeSystem());
        ((GenericAnnotator) mAnnotator).process((CAS) aCAS, mDefaultResultSpecification);
      }
    } catch (AnnotatorProcessException e) {
      throw new AnalysisEngineProcessException(e);
    }
  }
View Full Code Here

      if (typeSystem != mLastTypeSystem) {
        mAnnotator.typeSystemInit(typeSystem);
        mLastTypeSystem = typeSystem;
      }
    } catch (AnnotatorConfigurationException e) {
      throw new AnalysisEngineProcessException(e);
    } catch (AnnotatorInitializationException e) {
      throw new AnalysisEngineProcessException(e);
    }
  }
View Full Code Here

  public final Flow computeFlow(AbstractCas aCAS) throws AnalysisEngineProcessException {
    if (aCAS instanceof CAS) {
      checkTypeSystemChange((CAS) aCAS);
      return computeFlow((CAS) aCAS);
    } else {
      throw new AnalysisEngineProcessException(
              AnalysisEngineProcessException.INCORRECT_CAS_INTERFACE, new Object[] { CAS.class,
                  aCAS.getClass() });
    }
  }
View Full Code Here

      if (typeSystem != mLastTypeSystem) {
        mCollectionReader.typeSystemInit(typeSystem);
        mLastTypeSystem = typeSystem;
      }
    } catch (ResourceInitializationException e) {
      throw new AnalysisEngineProcessException(e);
    }
  }
View Full Code Here

    // try to do by calling its reconfigure method.
    if (mProcessCalled) {
      try {
        reconfigure();
      } catch (ResourceInitializationException e) {
        throw new AnalysisEngineProcessException(e);
      } catch (ResourceConfigurationException e) {
        throw new AnalysisEngineProcessException(e);
      }
    }
    else {
      mProcessCalled = true;
    }
View Full Code Here

   */
  public boolean hasNext() throws AnalysisEngineProcessException {
    try {
      return mCollectionReader.hasNext();
    } catch (CollectionException e) {
      throw new AnalysisEngineProcessException(e);
    } catch (IOException e) {
      throw new AnalysisEngineProcessException(e);
    }
  }
View Full Code Here

    }

    try {
      mCollectionReader.getNext(view);
    } catch (CollectionException e) {
      throw new AnalysisEngineProcessException(e);
    } catch (IOException e) {
      throw new AnalysisEngineProcessException(e);
    }
    return cas;
  }
View Full Code Here

   *
   * @see org.apache.uima.analysis_component.AnalysisComponent#next(org.apache.uima.core.AbstractCas)
   */
  public void next(AbstractCas aEmptyCas) throws AnalysisEngineProcessException {
    if (!CAS.class.isAssignableFrom(aEmptyCas.getClass())) {
      throw new AnalysisEngineProcessException(
              AnalysisEngineProcessException.INCORRECT_CAS_INTERFACE, new Object[] { CAS.class,
                  aEmptyCas.getClass() });
    }

  }
View Full Code Here

TOP

Related Classes of org.apache.uima.analysis_engine.AnalysisEngineProcessException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.