Search in sources :

Example 6 with AbstractStreamProcessor

use of org.wso2.siddhi.core.query.processor.stream.AbstractStreamProcessor in project siddhi by wso2.

the class AbstractStreamProcessor method initProcessor.

public AbstractDefinition initProcessor(AbstractDefinition inputDefinition, ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader, SiddhiAppContext siddhiAppContext, boolean outputExpectsExpiredEvents, String queryName, SiddhiElement siddhiElement) {
    this.configReader = configReader;
    this.outputExpectsExpiredEvents = outputExpectsExpiredEvents;
    try {
        this.inputDefinition = inputDefinition;
        this.attributeExpressionExecutors = attributeExpressionExecutors;
        this.siddhiAppContext = siddhiAppContext;
        this.attributeExpressionLength = attributeExpressionExecutors.length;
        this.queryName = queryName;
        if (elementId == null) {
            elementId = "AbstractStreamProcessor-" + siddhiAppContext.getElementIdGenerator().createNewId();
        }
        siddhiAppContext.getSnapshotService().addSnapshotable(queryName, this);
        this.additionalAttributes = init(inputDefinition, attributeExpressionExecutors, configReader, siddhiAppContext, outputExpectsExpiredEvents);
        siddhiAppContext.addEternalReferencedHolder(this);
        StreamDefinition outputDefinition = StreamDefinition.id(inputDefinition.getId());
        outputDefinition.setQueryContextStartIndex(siddhiElement.getQueryContextStartIndex());
        outputDefinition.setQueryContextEndIndex(siddhiElement.getQueryContextEndIndex());
        for (Attribute attribute : inputDefinition.getAttributeList()) {
            outputDefinition.attribute(attribute.getName(), attribute.getType());
        }
        for (Attribute attribute : additionalAttributes) {
            outputDefinition.attribute(attribute.getName(), attribute.getType());
        }
        return outputDefinition;
    } catch (Throwable t) {
        throw new SiddhiAppCreationException(t);
    }
}
Also used : StreamDefinition(org.wso2.siddhi.query.api.definition.StreamDefinition) Attribute(org.wso2.siddhi.query.api.definition.Attribute) SiddhiAppCreationException(org.wso2.siddhi.core.exception.SiddhiAppCreationException)

Aggregations

SiddhiAppCreationException (org.wso2.siddhi.core.exception.SiddhiAppCreationException)3 Test (org.testng.annotations.Test)2 SiddhiAppRuntime (org.wso2.siddhi.core.SiddhiAppRuntime)2 SiddhiManager (org.wso2.siddhi.core.SiddhiManager)2 MetaStateEvent (org.wso2.siddhi.core.event.state.MetaStateEvent)2 MetaStreamEvent (org.wso2.siddhi.core.event.stream.MetaStreamEvent)2 ExpressionExecutor (org.wso2.siddhi.core.executor.ExpressionExecutor)2 AbstractStreamProcessor (org.wso2.siddhi.core.query.processor.stream.AbstractStreamProcessor)2 InputHandler (org.wso2.siddhi.core.stream.input.InputHandler)2 Attribute (org.wso2.siddhi.query.api.definition.Attribute)2 Map (java.util.Map)1 ComplexEvent (org.wso2.siddhi.core.event.ComplexEvent)1 Event (org.wso2.siddhi.core.event.Event)1 StateEventCloner (org.wso2.siddhi.core.event.state.StateEventCloner)1 StreamEvent (org.wso2.siddhi.core.event.stream.StreamEvent)1 StreamEventCloner (org.wso2.siddhi.core.event.stream.StreamEventCloner)1 StreamEventPool (org.wso2.siddhi.core.event.stream.StreamEventPool)1 ComplexEventPopulater (org.wso2.siddhi.core.event.stream.populater.ComplexEventPopulater)1 SiddhiAppRuntimeException (org.wso2.siddhi.core.exception.SiddhiAppRuntimeException)1 VariableExpressionExecutor (org.wso2.siddhi.core.executor.VariableExpressionExecutor)1