Search in sources :

Example 1 with ReactiveParameters

use of com.dexels.navajo.reactive.api.ReactiveParameters in project navajo by Dexels.

the class ReactiveParseItem method materializeReactive.

private Operand materializeReactive() {
    switch(type) {
        case REACTIVE_SOURCE:
            ReactiveSourceFactory sourceFactory = Reactive.finderInstance().getSourceFactory(name);
            if (sourceFactory == null) {
                throw new ReactiveParseException("No source found named: " + name);
            }
            return new Operand(sourceFactory.build(ReactiveParameters.of(sourceFactory, namedParams, unnamedParams)), Reactive.ReactiveItemType.REACTIVE_MAPPER.toString());
        case REACTIVE_HEADER:
            break;
        case REACTIVE_MAPPER:
            ReactiveMerger mergerFactory = Reactive.finderInstance().getMergerFactory(name);
            ReactiveParameters mergeParameters = ReactiveParameters.of(mergerFactory, namedParams, unnamedParams);
            return new Operand(mergerFactory.execute(mergeParameters), Reactive.ReactiveItemType.REACTIVE_MAPPER.toString());
        case REACTIVE_TRANSFORMER:
            ReactiveTransformerFactory transformerFactory = Reactive.finderInstance().getTransformerFactory(name);
            List<ReactiveParseProblem> problems = new ArrayList<>();
            ReactiveParameters transParameters = ReactiveParameters.of(transformerFactory, namedParams, unnamedParams);
            // TODO problems?
            return new Operand(transformerFactory.build(problems, transParameters), Reactive.ReactiveItemType.REACTIVE_MAPPER.toString());
        default:
            break;
    }
    // TODO rather throw something
    return null;
}
Also used : ReactiveTransformerFactory(com.dexels.navajo.reactive.api.ReactiveTransformerFactory) ReactiveParseProblem(com.dexels.navajo.document.stream.ReactiveParseProblem) ReactiveParameters(com.dexels.navajo.reactive.api.ReactiveParameters) Operand(com.dexels.navajo.document.Operand) ArrayList(java.util.ArrayList) ReactiveSourceFactory(com.dexels.navajo.reactive.api.ReactiveSourceFactory) ReactiveMerger(com.dexels.navajo.reactive.api.ReactiveMerger)

Aggregations

Operand (com.dexels.navajo.document.Operand)1 ReactiveParseProblem (com.dexels.navajo.document.stream.ReactiveParseProblem)1 ReactiveMerger (com.dexels.navajo.reactive.api.ReactiveMerger)1 ReactiveParameters (com.dexels.navajo.reactive.api.ReactiveParameters)1 ReactiveSourceFactory (com.dexels.navajo.reactive.api.ReactiveSourceFactory)1 ReactiveTransformerFactory (com.dexels.navajo.reactive.api.ReactiveTransformerFactory)1 ArrayList (java.util.ArrayList)1