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; }
/** * Construct and return a WindowDefinition object using the given id. * * @param id the window id * @return new instance of WindowDefinition */ public static WindowDefinition id(String id) { return new WindowDefinition(id); }
for (Expression expression : windowDefinition.getWindow().getParameters()) { parameters.add(ConfigBuildingUtilities.getDefinition(expression, siddhiAppString)); AnnotationConfigGenerator annotationConfigGenerator = new AnnotationConfigGenerator(); AttributeConfigListGenerator attributeConfigListGenerator = new AttributeConfigListGenerator(); for (Annotation annotation : windowDefinition.getAnnotations()) { annotationListObjects.add(annotation); annotationConfigs.add(annotationConfigGenerator.generateAnnotationConfig(annotation)); windowDefinition.getId(), windowDefinition.getId(), attributeConfigListGenerator.generateAttributeConfigList(windowDefinition.getAttributeList()), windowDefinition.getWindow().getName(), parameters, windowDefinition.getOutputEventType().name(), annotationConfigs, annotationListObjects);
@Override public Object visitDefinition_window(@NotNull SiddhiQLParser.Definition_windowContext ctx) { Source source = (Source) visit(ctx.source()); if (source.isInnerStream) { throw newSiddhiParserException(ctx, "'#' cannot be used, because Windows can't be defined as InnerStream!"); } WindowDefinition windowDefinition = WindowDefinition.id(source.streamId); List<SiddhiQLParser.Attribute_nameContext> attribute_names = ctx.attribute_name(); List<SiddhiQLParser.Attribute_typeContext> attribute_types = ctx.attribute_type(); for (int i = 0; i < attribute_names.size(); i++) { SiddhiQLParser.Attribute_nameContext attributeNameContext = attribute_names.get(i); SiddhiQLParser.Attribute_typeContext attributeTypeContext = attribute_types.get(i); windowDefinition.attribute((String) visit(attributeNameContext), (Attribute.Type) visit (attributeTypeContext)); } for (SiddhiQLParser.AnnotationContext annotationContext : ctx.annotation()) { windowDefinition.annotation((Annotation) visit(annotationContext)); } AttributeFunction attributeFunction = (AttributeFunction) visit(ctx.function_operation()); Window window = new Window(attributeFunction.getNamespace(), attributeFunction.getName(), attributeFunction .getParameters()); windowDefinition.window(window); // Optional output event type if (ctx.output_event_type() != null) { windowDefinition.setOutputEventType((OutputStream.OutputEventType) visit(ctx.output_event_type())); } populateQueryContext(windowDefinition, ctx); return windowDefinition; }
queryContextStartIndex = siddhiApp.getWindowDefinitionMap().get(streamId).getQueryContextStartIndex(); queryContextEndIndex = siddhiApp.getWindowDefinitionMap().get(streamId).getQueryContextEndIndex();
if (existingWindowDefinition != null && (!existingWindowDefinition.equals(definition) || definition instanceof WindowDefinition)) { throw new DuplicateDefinitionException("Stream Definition with same Window Id '" +
if (existingWindowDefinition != null && (!existingWindowDefinition.equals(definition) || definition instanceof WindowDefinition)) { throw new DuplicateDefinitionException("Stream Definition with same Window Id '" +
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; }
/** * Construct and return a WindowDefinition object using the given id. * * @param id the window id * @return new instance of WindowDefinition */ public static WindowDefinition id(String id) { return new WindowDefinition(id); }