Search in sources :

Example 16 with Element

use of io.siddhi.query.api.annotation.Element in project siddhi by wso2.

the class Partition method addQuery.

public Partition addQuery(Query query) {
    if (query == null) {
        throw new SiddhiAppValidationException("Query should not be null");
    }
    String name = null;
    Element element = AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_INFO, SiddhiConstants.ANNOTATION_ELEMENT_NAME, query.getAnnotations());
    if (element != null) {
        name = element.getValue();
    }
    if (name != null && queryNameList.contains(name)) {
        throw new SiddhiAppValidationException("Cannot add Query as another Execution Element already uses " + "its name=" + name + " within the same Partition", element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
    }
    queryNameList.add(name);
    this.queryList.add(query);
    return this;
}
Also used : SiddhiElement(io.siddhi.query.api.SiddhiElement) Element(io.siddhi.query.api.annotation.Element) ExecutionElement(io.siddhi.query.api.execution.ExecutionElement) SiddhiAppValidationException(io.siddhi.query.api.exception.SiddhiAppValidationException)

Aggregations

Element (io.siddhi.query.api.annotation.Element)16 SiddhiAppCreationException (io.siddhi.core.exception.SiddhiAppCreationException)8 Annotation (io.siddhi.query.api.annotation.Annotation)8 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)6 SiddhiAppValidationException (io.siddhi.query.api.exception.SiddhiAppValidationException)5 ExecutionElement (io.siddhi.query.api.execution.ExecutionElement)5 Map (java.util.Map)5 SiddhiAppContext (io.siddhi.core.config.SiddhiAppContext)4 MetaStreamEvent (io.siddhi.core.event.stream.MetaStreamEvent)3 Attribute (io.siddhi.query.api.definition.Attribute)3 AggregationRuntime (io.siddhi.core.aggregation.AggregationRuntime)2 SiddhiQueryContext (io.siddhi.core.config.SiddhiQueryContext)2 StreamEventFactory (io.siddhi.core.event.stream.StreamEventFactory)2 VariableExpressionExecutor (io.siddhi.core.executor.VariableExpressionExecutor)2 QueryRuntimeImpl (io.siddhi.core.query.QueryRuntimeImpl)2 Table (io.siddhi.core.table.Table)2 SiddhiConstants (io.siddhi.core.util.SiddhiConstants)2 OptionHolder (io.siddhi.core.util.transport.OptionHolder)2 Window (io.siddhi.core.window.Window)2