public SiddhiAppValidationException(String message, Throwable throwable, int[] queryContextStartIndex, int[] queryContextEndIndex, String siddhiAppName, String siddhiAppString) { super(message, throwable); this.message = message; setQueryContextIndexIfAbsent(queryContextStartIndex, queryContextEndIndex, siddhiAppName, siddhiAppString); }
public Selector limit(Constant constant) { if (constant instanceof IntConstant || constant instanceof LongConstant) { limit = constant; return this; } else { throw new UnsupportedAttributeTypeException("'limit' only supports int or long constants, but found '" + constant + "'"); } }
public static String getMessageWithContext(Throwable t, String siddhiAppName, String siddhiApp) { if (t instanceof SiddhiAppContextException) { ((SiddhiAppContextException) t).setQueryContextIndexIfAbsent(null, null, siddhiAppName, siddhiApp); return t.getMessage(); } else { return getMessageWithContext(siddhiAppName, null, null, null, t.getMessage()); } }
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; }
private void checkDuplicateFunctionExist(FunctionDefinition functionDefinition) { if (this.functionDefinitionMap.get(functionDefinition.getId()) != null) { throw new DuplicateDefinitionException("The function definition with the same id exists " + functionDefinition.getId(), functionDefinition.getQueryContextStartIndex(), functionDefinition.getQueryContextEndIndex()); } }
private void checkSelection(OutputAttribute newAttribute) { for (OutputAttribute attribute : selectionList) { if (attribute.getRename().equals(newAttribute.getRename())) { throw new DuplicateAttributeException(newAttribute.getRename() + " is already defined as an output " + "attribute ", newAttribute.getQueryContextStartIndex(), attribute.getQueryContextEndIndex()); } } }
public static Annotation getAnnotation(String annotationName, List<Annotation> annotationList) { Annotation annotation = null; for (Annotation aAnnotation : annotationList) { if (annotationName.equalsIgnoreCase(aAnnotation.getName())) { if (annotation == null) { annotation = aAnnotation; } else { throw new DuplicateAnnotationException("Annotation @" + annotationName + " is defined twice", aAnnotation.getQueryContextStartIndex(), aAnnotation.getQueryContextEndIndex()); } } } return annotation; }
public Attribute.Type getAttributeType(String attributeName) { for (Attribute attribute : attributeList) { if (attribute.getName().equals(attributeName)) { return attribute.getType(); } } throw new AttributeNotExistException("Cannot find attribute type as '" + attributeName + "' does not exist in" + " '" + id + "'; " + this.toString()); }
public SiddhiApp defineAggregation(AggregationDefinition aggregationDefinition) { if (aggregationDefinition == null) { throw new SiddhiAppValidationException("Aggregation Definition should not be null"); } if (aggregationDefinition.getId() == null) { throw new SiddhiAppValidationException("Aggregation Id should not be null for Aggregation Definition", aggregationDefinition.getQueryContextStartIndex(), aggregationDefinition.getQueryContextEndIndex()); } checkDuplicateDefinition(aggregationDefinition); this.aggregationDefinitionMap.put(aggregationDefinition.getId(), aggregationDefinition); return this; }
public SiddhiAppValidationException(String message, Throwable throwable, int[] queryContextStartIndex, int[] queryContextEndIndex) { super(message, throwable); this.message = message; setQueryContextIndexIfAbsent(queryContextStartIndex, queryContextEndIndex, siddhiAppName, null); }
public Selector offset(Constant constant) { if (constant instanceof IntConstant || constant instanceof LongConstant) { offset = constant; return this; } else { throw new UnsupportedAttributeTypeException("'offset' only supports int or long constants, but found '" + constant + "'"); } } public List<OutputAttribute> getSelectionList() {
protected void checkAttribute(String attributeName) { for (Attribute attribute : attributeList) { if (attribute.getName().equals(attributeName)) { throw new DuplicateAttributeException("'" + attributeName + "' is already defined for with type '" + attribute.getType() + "' for '" + id + "'; " + this.toString(), attribute.getQueryContextStartIndex(), attribute.getQueryContextEndIndex()); } } }
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; }
public SiddhiAppValidationException(String message, int[] queryContextStartIndex, int[] queryContextEndIndex, String siddhiAppName, String siddhiAppString) { super(message); this.message = message; setQueryContextIndexIfAbsent(queryContextStartIndex, queryContextEndIndex, siddhiAppName, siddhiAppString); }
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; }
public SiddhiAppValidationException(String message, int[] queryContextStartIndex, int[] queryContextEndIndex) { super(message); this.message = message; setQueryContextIndexIfAbsent(queryContextStartIndex, queryContextEndIndex, siddhiAppName, null); }
private void addPartitionType(PartitionType partitionType) { String partitionedStream = partitionType.getStreamId(); if (partitionTypeMap.containsKey(partitionedStream)) { throw new SiddhiAppValidationException("Duplicate partition for Stream " + partitionedStream + "!, " + partitionType.toString() + " cannot be added as " + partitionTypeMap.get(partitionType .getStreamId()) + " already exist.", partitionType.getQueryContextStartIndex(), partitionType.getQueryContextEndIndex()); } partitionTypeMap.put(partitionType.getStreamId(), partitionType); }
public AnonymousInputStream(Query query) { super("Anonymous-" + UUID.randomUUID()); if (query.getOutputStream() != null && !(query.getOutputStream() instanceof ReturnStream)) { throw new SiddhiAppValidationException("OutputStream of the query is not on type Return!", query.getOutputStream().getQueryContextStartIndex(), query.getOutputStream().getQueryContextEndIndex()); } this.query = query; }
public static AbsentStreamStateElement logicalNot(StreamStateElement streamStateElement, TimeConstant time) { if (streamStateElement.getBasicSingleInputStream().getStreamReferenceId() != null) { throw new SiddhiAppValidationException("NOT pattern cannot have reference id but found " + streamStateElement.getBasicSingleInputStream().getStreamReferenceId()); } return new AbsentStreamStateElement(streamStateElement.getBasicSingleInputStream(), time); }
public static AbsentStreamStateElement logicalNot(StreamStateElement streamStateElement) { if (streamStateElement.getBasicSingleInputStream().getStreamReferenceId() != null) { throw new SiddhiAppValidationException("NOT pattern cannot have reference id but found " + streamStateElement.getBasicSingleInputStream().getStreamReferenceId(), streamStateElement.getBasicSingleInputStream().getQueryContextStartIndex(), streamStateElement.getBasicSingleInputStream().getQueryContextEndIndex()); } return new AbsentStreamStateElement(streamStateElement.getBasicSingleInputStream()); }