Esempio n. 1
0
        public DataFlowOpForgeInitializeResult InitializeForge(DataFlowOpForgeInitializeContext context)
        {
            if (context.InputPorts.Count != 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.OutputPorts.IsEmpty() || context.OutputPorts.Count > 2) {
                throw new ArgumentException(
                    "Filter operator requires one or two output stream(s) but produces " +
                    context.OutputPorts.Count +
                    " streams");
            }

            eventType = context.InputPorts[0].TypeDesc.EventType;
            singleOutputPort = context.OutputPorts.Count == 1;

            filter = DataFlowParameterValidation.Validate("filter", filter, eventType, typeof(bool?), context);

            GraphTypeDesc[] typesPerPort = new GraphTypeDesc[context.OutputPorts.Count];
            for (int i = 0; i < typesPerPort.Length; i++) {
                typesPerPort[i] = new GraphTypeDesc(false, true, eventType);
            }

            return new DataFlowOpForgeInitializeResult(typesPerPort);
        }
Esempio n. 2
0
        public DataFlowOpForgeInitializeResult InitializeForge(DataFlowOpForgeInitializeContext context)
        {
            _outputEventType = context.OutputPorts.Get(0).OptionalDeclaredType != null?context.OutputPorts.Get(0).OptionalDeclaredType.EventType : null;

            if (_outputEventType == null)
            {
                throw new ExprValidationException("No event type provided for output, please provide an event type name");
            }

            _outputPortTypes = new EventType[context.OutputPorts.Count];
            foreach (var entry in context.OutputPorts)
            {
                _outputPortTypes[entry.Key] = entry.Value.OptionalDeclaredType.EventType;
            }

            _file             = DataFlowParameterValidation.Validate("file", _file, typeof(string), context);
            _classpathFile    = DataFlowParameterValidation.Validate("classpathFile", _classpathFile, typeof(bool), context);
            _hasHeaderLine    = DataFlowParameterValidation.Validate("hasHeaderLine", _hasHeaderLine, typeof(bool), context);
            _hasTitleLine     = DataFlowParameterValidation.Validate("hasTitleLine", _hasTitleLine, typeof(bool), context);
            _numLoops         = DataFlowParameterValidation.Validate("numLoops", _numLoops, typeof(int?), context);
            _format           = DataFlowParameterValidation.Validate("format", _format, typeof(string), context);
            _propertyNameLine = DataFlowParameterValidation.Validate("propertyNameLine", _propertyNameLine, typeof(string), context);
            _propertyNameFile = DataFlowParameterValidation.Validate("propertyNameFile", _propertyNameFile, typeof(string), context);
            _dateFormat       = DataFlowParameterValidation.Validate("dateFormat", _dateFormat, typeof(string), context);
            return(null);
        }
Esempio n. 3
0
        public DataFlowOpForgeInitializeResult InitializeForge(DataFlowOpForgeInitializeContext context)
        {
            if (context.OutputPorts.Count != 1) {
                throw new ArgumentException(
                    "EventBusSource operator requires one output stream but produces " +
                    context.OutputPorts.Count +
                    " streams");
            }

            var portZero = context.OutputPorts[0];
            if (portZero.OptionalDeclaredType == null || portZero.OptionalDeclaredType.EventType == null) {
                throw new ArgumentException(
                    "EventBusSource operator requires an event type declated for the output stream");
            }

            var eventType = portZero.OptionalDeclaredType.EventType;
            if (!portZero.OptionalDeclaredType.IsUnderlying) {
                submitEventBean = true;
            }

            DataFlowParameterValidation.Validate("filter", filter, eventType, typeof(bool), context);

            try {
                IList<ExprNode> filters = EmptyList<ExprNode>.Instance;
                if (filter != null) {
                    filters = Collections.SingletonList(filter);
                }

                var streamTypeService = new StreamTypeServiceImpl(eventType, eventType.Name, true);
                var compiledDesc = FilterSpecCompiler.MakeFilterSpec(
                    eventType,
                    eventType.Name,
                    filters,
                    null,
                    null,
                    null,
                    null,
                    streamTypeService,
                    null,
                    context.StatementRawInfo,
                    context.Services);
                FilterSpecCompiled = compiledDesc.FilterSpecCompiled;
            }
            catch (ExprValidationException ex) {
                throw new ExprValidationException("Failed to obtain filter parameters: " + ex.Message, ex);
            }

            return null;
        }
Esempio n. 4
0
        public DataFlowOpForgeInitializeResult InitializeForge(DataFlowOpForgeInitializeContext context)
        {
            if (context.InputPorts.Count != 1)
            {
                throw new EPException(GetType().Name + " expected a single input port");
            }

            eventType = context.InputPorts.Get(0).TypeDesc.EventType;
            if (eventType == null)
            {
                throw new EPException("No event type defined for input port");
            }

            file   = DataFlowParameterValidation.Validate("file", file, typeof(string), context);
            append = DataFlowParameterValidation.Validate("append", append, typeof(bool), context);
            return(null);
        }
Esempio n. 5
0
        public DataFlowOpForgeInitializeResult InitializeForge(DataFlowOpForgeInitializeContext context)
        {
            if (!context.OutputPorts.IsEmpty()) {
                throw new ArgumentException("LogSink operator does not provide an output stream");
            }

            eventTypes = new EventType[context.InputPorts.Count];
            foreach (KeyValuePair<int, DataFlowOpInputPort> entry in context.InputPorts) {
                eventTypes[entry.Key] = entry.Value.TypeDesc.EventType;
            }

            title = DataFlowParameterValidation.Validate("title", title, typeof(string), context);
            layout = DataFlowParameterValidation.Validate("layout", layout, typeof(string), context);
            format = DataFlowParameterValidation.Validate("format", format, typeof(string), context);
            log = DataFlowParameterValidation.Validate("log", log, typeof(bool), context);
            linefeed = DataFlowParameterValidation.Validate("linefeed", linefeed, typeof(bool), context);
            return null;
        }
Esempio n. 6
0
        public DataFlowOpForgeInitializeResult InitializeForge(DataFlowOpForgeInitializeContext context)
        {
            iterations = DataFlowParameterValidation.Validate("iterations", iterations, typeof(object), context);
            initialDelay = DataFlowParameterValidation.Validate("initialDelay", initialDelay, typeof(object), context);
            interval = DataFlowParameterValidation.Validate("interval", interval, typeof(object), context);

            if (context.OutputPorts.Count != 1) {
                throw new ArgumentException(
                    "BeaconSource operator requires one output stream but produces " +
                    context.OutputPorts.Count +
                    " streams");
            }

            var port = context.OutputPorts[0];

            // Check if a type is declared
            if (port.OptionalDeclaredType == null || port.OptionalDeclaredType.EventType == null) {
                return InitializeTypeUndeclared(context);
            }

            return InitializeTypeDeclared(port, context);
        }