Search in sources :

Example 1 with OBlock

use of com.orientechnologies.orient.etl.block.OBlock in project orientdb by orientechnologies.

the class OETLProcessor method configureBeginBlocks.

private void configureBeginBlocks(Collection<ODocument> iBeginBlocks, OCommandContext iContext) throws IllegalAccessException, InstantiationException {
    // BEGIN BLOCKS
    String name;
    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);
            // Execution is necessary to resolve let blocks and provide resolved variables to other components
            b.execute();
        }
    }
}
Also used : OBlock(com.orientechnologies.orient.etl.block.OBlock) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 2 with OBlock

use of com.orientechnologies.orient.etl.block.OBlock in project orientdb by orientechnologies.

the class OETLProcessor method end.

protected void end() {
    for (OTransformer t : transformers) t.end();
    if (source != null)
        source.end();
    extractor.end();
    loader.end();
    for (OBlock t : endBlocks) {
        t.begin();
        t.execute();
        t.end();
    }
    elapsed = System.currentTimeMillis() - startTime;
    if (dumpTask != null) {
        dumpTask.cancel();
    }
    out(LOG_LEVELS.INFO, "END ETL PROCESSOR");
    dumpProgress();
}
Also used : OTransformer(com.orientechnologies.orient.etl.transformer.OTransformer) OBlock(com.orientechnologies.orient.etl.block.OBlock)

Example 3 with OBlock

use of com.orientechnologies.orient.etl.block.OBlock in project orientdb by orientechnologies.

the class OETLProcessor method configureEndBlocks.

private void configureEndBlocks(Collection<ODocument> iEndBlocks, OCommandContext iContext) throws IllegalAccessException, InstantiationException {
    endBlocks = new ArrayList<OBlock>();
    if (iEndBlocks != null) {
        for (ODocument block : iEndBlocks) {
            final String name = block.fieldNames()[0];
            final OBlock b = factory.getBlock(name);
            endBlocks.add(b);
            configureComponent(b, block.<ODocument>field(name), iContext);
        }
    }
}
Also used : OBlock(com.orientechnologies.orient.etl.block.OBlock) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 4 with OBlock

use of com.orientechnologies.orient.etl.block.OBlock in project orientdb by orientechnologies.

the class OETLProcessor method begin.

protected void begin() {
    out(LOG_LEVELS.INFO, "BEGIN ETL PROCESSOR");
    final Integer cfgMaxRetries = (Integer) context.getVariable("maxRetries");
    if (cfgMaxRetries != null)
        maxRetries = cfgMaxRetries;
    final Integer dumpEveryMs = (Integer) context.getVariable("dumpEveryMs");
    if (dumpEveryMs != null && dumpEveryMs > 0) {
        dumpTask = new TimerTask() {

            @Override
            public void run() {
                dumpProgress();
            }
        };
        Orient.instance().scheduleTask(dumpTask, dumpEveryMs, dumpEveryMs);
        startTime = System.currentTimeMillis();
    }
    for (OBlock t : beginBlocks) {
        t.begin();
        t.execute();
        t.end();
    }
    if (source != null)
        source.begin();
    extractor.begin();
}
Also used : TimerTask(java.util.TimerTask) OBlock(com.orientechnologies.orient.etl.block.OBlock)

Aggregations

OBlock (com.orientechnologies.orient.etl.block.OBlock)4 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)2 OTransformer (com.orientechnologies.orient.etl.transformer.OTransformer)1 TimerTask (java.util.TimerTask)1