Search in sources :

Example 11 with SiddhiAppValidationException

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

the class SiddhiApp method defineWindow.

public SiddhiApp defineWindow(WindowDefinition windowDefinition) {
    if (windowDefinition == null) {
        throw new SiddhiAppValidationException("Window Definition should not be null");
    } else if (windowDefinition.getId() == null) {
        throw new SiddhiAppValidationException("Window Id should not be null for Window Definition", windowDefinition.getQueryContextStartIndex(), windowDefinition.getQueryContextEndIndex());
    }
    checkDuplicateDefinition(windowDefinition);
    this.windowDefinitionMap.put(windowDefinition.getId(), windowDefinition);
    return this;
}
Also used : SiddhiAppValidationException(org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)

Example 12 with SiddhiAppValidationException

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

the class SiddhiApp method defineTable.

public SiddhiApp defineTable(TableDefinition tableDefinition) {
    if (tableDefinition == null) {
        throw new SiddhiAppValidationException("Table Definition should not be null");
    } else if (tableDefinition.getId() == null) {
        throw new SiddhiAppValidationException("Table Id should not be null for Table Definition", tableDefinition.getQueryContextStartIndex(), tableDefinition.getQueryContextEndIndex());
    }
    checkDuplicateDefinition(tableDefinition);
    this.tableDefinitionMap.put(tableDefinition.getId(), tableDefinition);
    return this;
}
Also used : SiddhiAppValidationException(org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)

Example 13 with SiddhiAppValidationException

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

the class SiddhiApp method addPartition.

public SiddhiApp addPartition(Partition partition) {
    if (partition == null) {
        throw new SiddhiAppValidationException("Partition should not be null");
    }
    String name = null;
    Element element = AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_INFO, SiddhiConstants.ANNOTATION_ELEMENT_NAME, partition.getAnnotations());
    if (element != null) {
        name = element.getValue();
    }
    if (name != null && executionElementNameList.contains(name)) {
        throw new SiddhiAppValidationException("Cannot add Partition as another Execution Element already " + "uses its name=" + name, element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
    }
    executionElementNameList.add(name);
    this.executionElementList.add(partition);
    return this;
}
Also used : Element(org.wso2.siddhi.query.api.annotation.Element) ExecutionElement(org.wso2.siddhi.query.api.execution.ExecutionElement) SiddhiAppValidationException(org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)

Example 14 with SiddhiAppValidationException

use of org.wso2.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(org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)

Example 15 with SiddhiAppValidationException

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

the class SiddhiApp method addQuery.

public SiddhiApp 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 && executionElementNameList.contains(name)) {
        throw new SiddhiAppValidationException("Cannot add Query as another Execution Element already uses " + "its name=" + name, element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
    }
    executionElementNameList.add(name);
    this.executionElementList.add(query);
    return this;
}
Also used : Element(org.wso2.siddhi.query.api.annotation.Element) ExecutionElement(org.wso2.siddhi.query.api.execution.ExecutionElement) SiddhiAppValidationException(org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)

Aggregations

SiddhiAppValidationException (org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)23 ConstantExpressionExecutor (org.wso2.siddhi.core.executor.ConstantExpressionExecutor)7 Element (org.wso2.siddhi.query.api.annotation.Element)5 Attribute (org.wso2.siddhi.query.api.definition.Attribute)5 StreamEvent (org.wso2.siddhi.core.event.stream.StreamEvent)4 SiddhiAppCreationException (org.wso2.siddhi.core.exception.SiddhiAppCreationException)4 ExecutionElement (org.wso2.siddhi.query.api.execution.ExecutionElement)4 ArrayList (java.util.ArrayList)3 MetaStreamEvent (org.wso2.siddhi.core.event.stream.MetaStreamEvent)3 AbstractDefinition (org.wso2.siddhi.query.api.definition.AbstractDefinition)3 SiddhiAppContext (org.wso2.siddhi.core.config.SiddhiAppContext)2 MetaStateEvent (org.wso2.siddhi.core.event.state.MetaStateEvent)2 StreamEventPool (org.wso2.siddhi.core.event.stream.StreamEventPool)2 ZeroStreamEventConverter (org.wso2.siddhi.core.event.stream.converter.ZeroStreamEventConverter)2 OperationNotSupportedException (org.wso2.siddhi.core.exception.OperationNotSupportedException)2 VariableExpressionExecutor (org.wso2.siddhi.core.executor.VariableExpressionExecutor)2 Window (org.wso2.siddhi.core.window.Window)2 Annotation (org.wso2.siddhi.query.api.annotation.Annotation)2 AttributeNotExistException (org.wso2.siddhi.query.api.exception.AttributeNotExistException)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1