Search in sources :

Example 26 with SiddhiAppValidationException

use of io.siddhi.query.api.exception.SiddhiAppValidationException in project siddhi by wso2.

the class SiddhiApp method defineStream.

public SiddhiApp defineStream(StreamDefinition streamDefinition) {
    if (streamDefinition == null) {
        throw new SiddhiAppValidationException("Stream Definition should not be null");
    } else if (streamDefinition.getId() == null) {
        throw new SiddhiAppValidationException("Stream Id should not be null for Stream Definition", streamDefinition.getQueryContextStartIndex(), streamDefinition.getQueryContextEndIndex());
    }
    checkDuplicateDefinition(streamDefinition);
    this.streamDefinitionMap.put(streamDefinition.getId(), streamDefinition);
    return this;
}
Also used : SiddhiAppValidationException(io.siddhi.query.api.exception.SiddhiAppValidationException)

Example 27 with SiddhiAppValidationException

use of io.siddhi.query.api.exception.SiddhiAppValidationException 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

SiddhiAppValidationException (io.siddhi.query.api.exception.SiddhiAppValidationException)27 MetaStreamEvent (io.siddhi.core.event.stream.MetaStreamEvent)7 ConstantExpressionExecutor (io.siddhi.core.executor.ConstantExpressionExecutor)7 Attribute (io.siddhi.query.api.definition.Attribute)7 SiddhiAppCreationException (io.siddhi.core.exception.SiddhiAppCreationException)6 ExpressionExecutor (io.siddhi.core.executor.ExpressionExecutor)5 VariableExpressionExecutor (io.siddhi.core.executor.VariableExpressionExecutor)5 Element (io.siddhi.query.api.annotation.Element)5 MetaStateEvent (io.siddhi.core.event.state.MetaStateEvent)4 AbstractDefinition (io.siddhi.query.api.definition.AbstractDefinition)4 ExecutionElement (io.siddhi.query.api.execution.ExecutionElement)4 ArrayList (java.util.ArrayList)4 Expression (io.siddhi.query.api.expression.Expression)3 HashMap (java.util.HashMap)3 ComplexEventChunk (io.siddhi.core.event.ComplexEventChunk)2 StreamEvent (io.siddhi.core.event.stream.StreamEvent)2 StreamEventFactory (io.siddhi.core.event.stream.StreamEventFactory)2 ZeroStreamEventConverter (io.siddhi.core.event.stream.converter.ZeroStreamEventConverter)2 QueryableRecordTableException (io.siddhi.core.exception.QueryableRecordTableException)2 SingleStreamRuntime (io.siddhi.core.query.input.stream.single.SingleStreamRuntime)2