private CollectionProcessingEngine buildCPE() throws BaleenException {
  if (collectionReader == null) {
    throw new BaleenException("No class specified for Collection Reader/Schedule, or unable to parse");
  }
  Map<String,AnalysisEngineDescription> analysisEngines=new LinkedHashMap<>();
  analysisEngines.putAll(annotators);
  analysisEngines.putAll(consumers);
  if (analysisEngines.isEmpty()) {
    throw new BaleenException("You must have at least one valid annotator, consumer or task");
  }
  AnalysisEngineDescription cpeAEs=null;
  try {
    List<String> names=new ArrayList<>();
    names.addAll(analysisEngines.keySet());
    List<AnalysisEngineDescription> engines=new ArrayList<>();
    engines.addAll(analysisEngines.values());
    cpeAEs=AnalysisEngineFactory.createEngineDescription(engines,names,null,null,null);
  }
 catch (  ResourceInitializationException rie) {
    throw new BaleenException("Couldn't create aggregate analysis engine",rie);
  }
  org.apache.uima.fit.cpe.CpeBuilder builder=new org.apache.uima.fit.cpe.CpeBuilder();
  try {
    builder.setReader(collectionReader);
    builder.setAnalysisEngine(cpeAEs);
  }
 catch (  Exception e) {
    throw new BaleenException("Couldn't build Collection Processing Engine",e);
  }
  try {
    return builder.createCpe(null);
  }
 catch (  Exception e) {
    throw new BaleenException("Couldn't create CPE",e);
  }
}

private CollectionProcessingEngine buildCPE ( ) throws BaleenException { if ( collectionReader == null ) { throw new BaleenException ( "No class specified for Collection Reader/Schedule, or unable to parse" ) ; } Map < String , AnalysisEngineDescription > analysisEngines = new LinkedHashMap < > ( ) ; analysisEngines . putAll ( annotators ) ; analysisEngines . putAll ( consumers ) ; if ( analysisEngines . isEmpty ( ) ) { throw new BaleenException ( "You must have at least one valid annotator, consumer or task" ) ; } AnalysisEngineDescription cpeAEs = null ; try { List < String > names = new ArrayList < > ( ) ; names . addAll ( analysisEngines . keySet ( ) ) ; List < AnalysisEngineDescription > engines = new ArrayList < > ( ) ; engines . addAll ( analysisEngines . values ( ) ) ; cpeAEs = AnalysisEngineFactory . createEngineDescription ( engines , names , null , null , null ) ; } catch ( ResourceInitializationException rie ) { throw new BaleenException ( "Couldn't create aggregate analysis engine" , rie ) ; } org . apache . uima . fit . cpe . CpeBuilder builder = new org . apache . uima . fit . cpe . CpeBuilder ( ) ; try { builder . setReader ( collectionReader ) ; builder . setAnalysisEngine ( cpeAEs ) ; } catch ( Exception e ) { throw new BaleenException ( "Couldn't build Collection Processing Engine" , e ) ; } try { return builder . createCpe ( null ) ; } catch ( Exception e ) { throw new BaleenException ( "Couldn't create CPE" , e ) ; } }
take the components previously created and create a single pipeline from them .
