public DataFlowOpForgeInitializeResult initializeForge(DataFlowOpForgeInitializeContext context) throws ExprValidationException { if (context.getInputPorts().size() != 1) { throw new ExprValidationException("Filter requires single input port"); } if (filter == null) { throw new ExprValidationException("Required parameter 'filter' providing the filter expression is not provided"); } if (context.getOutputPorts().isEmpty() || context.getOutputPorts().size() > 2) { throw new IllegalArgumentException("Filter operator requires one or two output stream(s) but produces " + context.getOutputPorts().size() + " streams"); } eventType = context.getInputPorts().get(0).getTypeDesc().getEventType(); singleOutputPort = context.getOutputPorts().size() == 1; filter = DataFlowParameterValidation.validate("filter", filter, eventType, Boolean.class, context); GraphTypeDesc[] typesPerPort = new GraphTypeDesc[context.getOutputPorts().size()]; for (int i = 0; i < typesPerPort.length; i++) { typesPerPort[i] = new GraphTypeDesc(false, true, eventType); } return new DataFlowOpForgeInitializeResult(typesPerPort); }
typesPerOutput = initializeResult.getTypeDescriptors(); if (initializeResult.getAdditionalForgables() != null) { additionalForgables.add(initializeResult.getAdditionalForgables());
DataFlowOpForgeInitializeResult initializeResult = new DataFlowOpForgeInitializeResult(); initializeResult.setTypeDescriptors(new GraphTypeDesc[]{new GraphTypeDesc(false, true, outputEventType)}); initializeResult.setAdditionalForgables(forablesResult.getForgeResult());
private DataFlowOpForgeInitializeResult initializeTypeUndeclared(DataFlowOpForgeInitializeContext context) throws ExprValidationException { // No type has been declared, we can create one Map<String, Object> types = new LinkedHashMap<String, Object>(); Set<String> props = allProperties.keySet(); props.removeAll(PARAMETER_PROPERTIES); int count = 0; evaluatorForges = new ExprForge[props.size()]; for (String propertyName : props) { ExprNode exprNode = allProperties.get(propertyName); ExprNode validated = EPLValidationUtil.validateSimpleGetSubtree(ExprNodeOrigin.DATAFLOWBEACON, exprNode, null, false, context.getStatementRawInfo(), context.getServices()); types.put(propertyName, validated.getForge().getEvaluationType()); evaluatorForges[count] = validated.getForge(); count++; } String eventTypeName = context.getServices().getEventTypeNameGeneratorStatement().getDataflowOperatorTypeName(context.getOperatorNumber()); EventTypeMetadata metadata = new EventTypeMetadata(eventTypeName, context.getBase().getModuleName(), EventTypeTypeClass.DBDERIVED, EventTypeApplicationType.OBJECTARR, NameAccessModifier.TRANSIENT, EventTypeBusModifier.NONBUS, false, EventTypeIdPair.unassigned()); outputEventType = BaseNestableEventUtil.makeOATypeCompileTime(metadata, types, null, null, null, null, context.getServices().getBeanEventTypeFactoryPrivate(), context.getServices().getEventTypeCompileTimeResolver()); context.getServices().getEventTypeCompileTimeRegistry().newType(outputEventType); return new DataFlowOpForgeInitializeResult(new GraphTypeDesc[]{new GraphTypeDesc(false, true, outputEventType)}); }