public OETLProcessor parse ( final Collection < ODocument > iBeginBlocks , final ODocument iSource , final ODocument iExtractor , final Collection < ODocument > iTransformers , final ODocument iLoader , final Collection < ODocument > iEndBlocks , final OCommandContext iContext ) { if ( iExtractor == null ) throw new IllegalArgumentException ( "No Extractor configured" ) ; context = iContext != null ? iContext : createDefaultContext ( ) ; init ( ) ; try { String name ; // BEGIN BLOCKS beginBlocks = new ArrayList < OBlock > ( ) ; if ( iBeginBlocks != null ) for ( ODocument block : iBeginBlocks ) { name = block . fieldNames ( ) [ 0 ] ; final OBlock b = factory . getBlock ( name ) ; beginBlocks . add ( b ) ; configureComponent ( b , ( ODocument ) block . field ( name ) , iContext ) ; } if ( iSource != null ) { // SOURCE name = iSource . fieldNames ( ) [ 0 ] ; source = factory . getSource ( name ) ; configureComponent ( source , ( ODocument ) iSource . field ( name ) , iContext ) ; } else source = factory . getSource ( "input" ) ; // EXTRACTOR name = iExtractor . fieldNames ( ) [ 0 ] ; extractor = factory . getExtractor ( name ) ; configureComponent ( extractor , ( ODocument ) iExtractor . field ( name ) , iContext ) ; if ( iLoader != null ) { // LOADER name = iLoader . fieldNames ( ) [ 0 ] ; loader = factory . getLoader ( name ) ; configureComponent ( loader , ( ODocument ) iLoader . field ( name ) , iContext ) ; } else loader = factory . getLoader ( "output" ) ; // TRANSFORMERS transformers = new ArrayList < OTransformer > ( ) ; if ( iTransformers != null ) for ( ODocument t : iTransformers ) { name = t . fieldNames ( ) [ 0 ] ; final OTransformer tr = factory . getTransformer ( name ) ; transformers . add ( tr ) ; configureComponent ( tr , ( ODocument ) t . field ( name ) , iContext ) ; } // END BLOCKS endBlocks = new ArrayList < OBlock > ( ) ; if ( iEndBlocks != null ) for ( ODocument block : iEndBlocks ) { name = block . fieldNames ( ) [ 0 ] ; final OBlock b = factory . getBlock ( name ) ; endBlocks . add ( b ) ; configureComponent ( b , ( ODocument ) block . field ( name ) , iContext ) ; } // analyzeFlow(); } catch ( Exception e ) { throw new OConfigurationException ( "Error on creating ETL processor" , e ) ; } return this ; }
Creates an ETL processor by setting the configuration of each component .