public DataFlowOpForgeInitializeResult initializeForge(DataFlowOpForgeInitializeContext context) throws ExprValidationException { if (context.getOutputPorts().size() != 1) { throw new IllegalArgumentException("EPStatementSource operator requires one output stream but produces " + context.getOutputPorts().size() + " streams"); } if (statementName != null && statementFilter != null) { throw new ExprValidationException("Both 'statementName' or 'statementFilter' parameters were provided, only either one is expected"); } if ((statementDeploymentId == null && statementName != null) | (statementDeploymentId != null && statementName == null)) { throw new ExprValidationException("Both 'statementDeploymentId' and 'statementName' are required when either of these are specified"); } DataFlowOpOutputPort portZero = context.getOutputPorts().get(0); if (portZero != null && portZero.getOptionalDeclaredType() != null && portZero.getOptionalDeclaredType().isWildcard()) { submitEventBean = true; } return null; }
private static Map<Integer, DataFlowOpOutputPort> getDeclaredOutputPorts(GraphOperatorSpec operatorSpec, Map<String, EventType> types, StatementCompileTimeServices services) throws ExprValidationException { Map<Integer, DataFlowOpOutputPort> outputPorts = new LinkedHashMap<Integer, DataFlowOpOutputPort>(); for (int outputPortNum = 0; outputPortNum < operatorSpec.getOutput().getItems().size(); outputPortNum++) { GraphOperatorOutputItem outputItem = operatorSpec.getOutput().getItems().get(outputPortNum); GraphTypeDesc typeDesc = null; if (!outputItem.getTypeInfo().isEmpty()) { typeDesc = determineTypeOutputPort(outputItem.getTypeInfo().get(0), types, services); } outputPorts.put(outputPortNum, new DataFlowOpOutputPort(outputItem.getStreamName(), typeDesc)); } return outputPorts; }
assertEquals(0, forgeCtx.getInputPorts().size()); assertEquals(1, forgeCtx.getOutputPorts().size()); assertEquals("outstream", forgeCtx.getOutputPorts().get(0).getStreamName()); assertEquals("SupportBean", forgeCtx.getOutputPorts().get(0).getOptionalDeclaredType().getEventType().getName()); assertEquals(2, forgeCtx.getOperatorAnnotations().length); assertEquals("Goodie", ((Name) forgeCtx.getOperatorAnnotations()[0]).value());
public DataFlowOpForgeInitializeResult initializeForge(DataFlowOpForgeInitializeContext context) throws ExprValidationException { iterations = DataFlowParameterValidation.validate("iterations", iterations, Number.class, context); initialDelay = DataFlowParameterValidation.validate("initialDelay", initialDelay, Number.class, context); interval = DataFlowParameterValidation.validate("interval", interval, Number.class, context); if (context.getOutputPorts().size() != 1) { throw new IllegalArgumentException("BeaconSource operator requires one output stream but produces " + context.getOutputPorts().size() + " streams"); } DataFlowOpOutputPort port = context.getOutputPorts().get(0); // Check if a type is declared if (port.getOptionalDeclaredType() == null || port.getOptionalDeclaredType().getEventType() == null) { return initializeTypeUndeclared(context); } return initializeTypeDeclared(port, context); }
public DataFlowOpForgeInitializeResult initializeForge(DataFlowOpForgeInitializeContext context) throws ExprValidationException { if (context.getOutputPorts().size() != 1) { throw new IllegalArgumentException("EventBusSource operator requires one output stream but produces " + context.getOutputPorts().size() + " streams"); } DataFlowOpOutputPort portZero = context.getOutputPorts().get(0); if (portZero.getOptionalDeclaredType() == null || portZero.getOptionalDeclaredType().getEventType() == null) { throw new IllegalArgumentException("EventBusSource operator requires an event type declated for the output stream"); } EventType eventType = portZero.getOptionalDeclaredType().getEventType(); if (!portZero.getOptionalDeclaredType().isUnderlying()) { submitEventBean = true; } DataFlowParameterValidation.validate("filter", filter, eventType, boolean.class, context); try { List<ExprNode> filters = Collections.emptyList(); if (filter != null) { filters = Collections.singletonList(filter); } StreamTypeServiceImpl streamTypeService = new StreamTypeServiceImpl(eventType, eventType.getName(), true); filterSpecCompiled = FilterSpecCompiler.makeFilterSpec(eventType, eventType.getName(), filters, null, null, null, streamTypeService, null, context.getStatementRawInfo(), context.getServices()); } catch (ExprValidationException ex) { throw new ExprValidationException("Failed to obtain filter parameters: " + ex.getMessage(), ex); } return null; }
public DataFlowOpForgeInitializeResult initializeForge(DataFlowOpForgeInitializeContext context) throws ExprValidationException { outputEventType = context.getOutputPorts().get(0).getOptionalDeclaredType() != null ? context.getOutputPorts().get(0).getOptionalDeclaredType().getEventType() : null; if (outputEventType == null) { throw new ExprValidationException("No event type provided for output, please provide an event type name"); } outputPortTypes = new EventType[context.getOutputPorts().size()]; for (Map.Entry<Integer, DataFlowOpOutputPort> entry : context.getOutputPorts().entrySet()) { outputPortTypes[entry.getKey()] = entry.getValue().getOptionalDeclaredType().getEventType(); } file = DataFlowParameterValidation.validate("file", file, String.class, context); classpathFile = DataFlowParameterValidation.validate("classpathFile", classpathFile, boolean.class, context); hasHeaderLine = DataFlowParameterValidation.validate("hasHeaderLine", hasHeaderLine, boolean.class, context); hasTitleLine = DataFlowParameterValidation.validate("hasTitleLine", hasTitleLine, boolean.class, context); numLoops = DataFlowParameterValidation.validate("numLoops", numLoops, Integer.class, context); format = DataFlowParameterValidation.validate("format", format, String.class, context); propertyNameLine = DataFlowParameterValidation.validate("propertyNameLine", propertyNameLine, String.class, context); propertyNameFile = DataFlowParameterValidation.validate("propertyNameFile", propertyNameFile, String.class, context); dateFormat = DataFlowParameterValidation.validate("dateFormat", dateFormat, String.class, context); return null; }
public DataFlowOpForgeInitializeResult initializeForge(DataFlowOpForgeInitializeContext context) throws ExprValidationException { outputEventType = context.getOutputPorts().get(0).getOptionalDeclaredType() != null ? context.getOutputPorts().get(0).getOptionalDeclaredType().getEventType() : null; if (outputEventType == null) { throw new ExprValidationException("No event type provided for output, please provide an event type name"); } outputPortTypes = new EventType[context.getOutputPorts().size()]; for (Map.Entry<Integer, DataFlowOpOutputPort> entry : context.getOutputPorts().entrySet()) { outputPortTypes[entry.getKey()] = entry.getValue().getOptionalDeclaredType().getEventType(); } file = DataFlowParameterValidation.validate("file", file, String.class, context); classpathFile = DataFlowParameterValidation.validate("classpathFile", classpathFile, boolean.class, context); hasHeaderLine = DataFlowParameterValidation.validate("hasHeaderLine", hasHeaderLine, boolean.class, context); hasTitleLine = DataFlowParameterValidation.validate("hasTitleLine", hasTitleLine, boolean.class, context); numLoops = DataFlowParameterValidation.validate("numLoops", numLoops, Integer.class, context); format = DataFlowParameterValidation.validate("format", format, String.class, context); propertyNameLine = DataFlowParameterValidation.validate("propertyNameLine", propertyNameLine, String.class, context); propertyNameFile = DataFlowParameterValidation.validate("propertyNameFile", propertyNameFile, String.class, context); dateFormat = DataFlowParameterValidation.validate("dateFormat", dateFormat, String.class, context); return null; }
public void run(RegressionEnvironment env) { env.compile("create schema MySchema(key string, value int);\n" + "@name('flow') create dataflow MyDataFlowOne MyCaptureOutputPortOp -> outstream<EventBean<MySchema>> {}"); assertEquals("MySchema", MyCaptureOutputPortOpForge.getPort().getOptionalDeclaredType().getEventType().getName()); env.undeployAll(); } }
private DataFlowOpForgeInitializeResult initializeTypeDeclared(DataFlowOpOutputPort port, DataFlowOpForgeInitializeContext context) throws ExprValidationException { produceEventBean = port.getOptionalDeclaredType() != null && !port.getOptionalDeclaredType().isUnderlying(); outputEventType = port.getOptionalDeclaredType().getEventType(); Set<String> props = allProperties.keySet(); props.removeAll(PARAMETER_PROPERTIES);
if (portZero.getOptionalDeclaredType() != null && !portZero.getOptionalDeclaredType().isUnderlying()) { submitEventBean = true;