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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations