public override void InlineInitializeOnTriggerBase(
            CodegenExpressionRef saiff,
            CodegenMethod method,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            method.Block
                .SetProperty(
                    saiff,
                    "NamedWindow",
                    namedWindow == null
                        ? ConstantNull()
                        : NamedWindowDeployTimeResolver.MakeResolveNamedWindow(
                            namedWindow,
                            symbols.GetAddInitSvc(method)))
                .SetProperty(
                    saiff,
                    "Table",
                    table == null
                        ? ConstantNull()
                        : TableDeployTimeResolver.MakeResolveTable(table, symbols.GetAddInitSvc(method)))
                .SetProperty(saiff, "QueryPlan", queryPlanForge.Make(method, symbols, classScope))
                .SetProperty(
                    saiff,
                    "NonSelectRSPFactoryProvider",
                    nonSelectRSPProviderClassName == null
                        ? ConstantNull()
                        : NewInstanceInner(nonSelectRSPProviderClassName, symbols.GetAddInitSvc(method), Ref("statementFields")))
                .ExprDotMethod(symbols.GetAddInitSvc(method), "AddReadyCallback", saiff); // add ready-callback

            InlineInitializeOnTriggerSpecific(saiff, method, symbols, classScope);
        }
Esempio n. 2
0
        public CodegenMethod InitializeCodegen(
            CodegenMethodScope parent,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            CodegenMethod method = parent.MakeChild(
                typeof(StatementAgentInstanceFactoryCreateNW),
                this.GetType(),
                classScope);
            method.Block
                .DeclareVar<StatementAgentInstanceFactoryCreateNW>(
                    "saiff",
                    NewInstance(typeof(StatementAgentInstanceFactoryCreateNW)));

            method.Block
                .SetProperty(Ref("saiff"), "Activator", activator.MakeCodegen(method, symbols, classScope))
                .SetProperty(Ref("saiff"), "NamedWindowName", Constant(namedWindowName))
                .SetProperty(
                    Ref("saiff"),
                    "ViewFactories",
                    ViewFactoryForgeUtil.CodegenForgesWInit(views, 0, null, method, symbols, classScope))
                .SetProperty(
                    Ref("saiff"),
                    "InsertFromNamedWindow",
                    insertFromNamedWindow == null
                        ? ConstantNull()
                        : NamedWindowDeployTimeResolver.MakeResolveNamedWindow(
                            insertFromNamedWindow,
                            symbols.GetAddInitSvc(method)))
                .SetProperty(
                    Ref("saiff"),
                    "InsertFromFilter",
                    insertFromFilter == null
                        ? ConstantNull()
                        : ExprNodeUtilityCodegen.CodegenEvaluator(
                            insertFromFilter.Forge,
                            method,
                            this.GetType(),
                            classScope))
                .SetProperty(
                    Ref("saiff"),
                    "AsEventType",
                    asEventType == null
                        ? ConstantNull()
                        : EventTypeUtility.ResolveTypeCodegen(asEventType, EPStatementInitServicesConstants.REF))
                .SetProperty(
                    Ref("saiff"),
                    "ResultSetProcessorFactoryProvider",
                    NewInstance(
                        resultSetProcessorProviderClassName,
                        symbols.GetAddInitSvc(method),
                        Ref("statementFields")))
                .ExprDotMethod(symbols.GetAddInitSvc(method), "AddReadyCallback", Ref("saiff"));

            method.Block.MethodReturn(Ref("saiff"));
            return method;
        }
Esempio n. 3
0
        public CodegenExpression MakeCodegen(
            CodegenMethodScope parent,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            if (spec.NamedWindowConsumerId == -1) {
                throw new IllegalStateException("Unassigned named window consumer id");
            }

            var method = parent.MakeChild(typeof(ViewableActivatorNamedWindow), GetType(), classScope);

            CodegenExpression filter;
            if (filterEvaluator == null) {
                filter = ConstantNull();
            }
            else {
                filter = ExprNodeUtilityCodegen.CodegenEvaluator(filterEvaluator.Forge, method, GetType(), classScope);
            }

            method.Block
                .DeclareVar<ViewableActivatorNamedWindow>(
                    "activator",
                    ExprDotMethodChain(symbols.GetAddInitSvc(method))
                        .Get(EPStatementInitServicesConstants.VIEWABLEACTIVATORFACTORY)
                        .Add("CreateNamedWindow"))
                .SetProperty(
                    Ref("activator"),
                    "NamedWindow",
                    NamedWindowDeployTimeResolver.MakeResolveNamedWindow(namedWindow, symbols.GetAddInitSvc(method)))
                .SetProperty(Ref("activator"), "NamedWindowConsumerId", Constant(spec.NamedWindowConsumerId))
                .SetProperty(Ref("activator"), "FilterEvaluator", filter)
                .SetProperty(
                    Ref("activator"),
                    "FilterQueryGraph",
                    filterQueryGraph == null ? ConstantNull() : filterQueryGraph.Make(method, symbols, classScope))
                .SetProperty(Ref("activator"), "Subquery", Constant(subquery))
                .SetProperty(
                    Ref("activator"),
                    "OptPropertyEvaluator",
                    optPropertyEvaluator == null
                        ? ConstantNull()
                        : optPropertyEvaluator.Make(method, symbols, classScope))
                .ExprDotMethod(
                    symbols.GetAddInitSvc(method),
                    "AddReadyCallback",
                    Ref("activator")) // add ready-callback
                .MethodReturn(Ref("activator"));
            return LocalMethod(method);
        }
        private CodegenExpression MakeNamedWindows(
            CodegenMethod method,
            SAIFFInitializeSymbol symbols)
        {
            var init = new CodegenExpression[NamedWindowsPerStream.Length];
            for (var i = 0; i < init.Length; i++) {
                init[i] = NamedWindowsPerStream[i] == null
                    ? ConstantNull()
                    : NamedWindowDeployTimeResolver.MakeResolveNamedWindow(
                        NamedWindowsPerStream[i],
                        symbols.GetAddInitSvc(method));
            }

            return NewArrayWithInit(typeof(NamedWindow), init);
        }
        public CodegenExpression MakeCodegen(
            CodegenMethodScope parent,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            CodegenMethod method = parent.MakeChild(typeof(SubSelectStrategyFactoryIndexShare), GetType(), classScope);

            CodegenExpression groupKeyEval = MultiKeyCodegen.CodegenExprEvaluatorMayMultikey(_groupKeys, null, _groupByMultiKey, method, classScope);

            var tableExpr = _table == null
                                ? ConstantNull()
                                : TableDeployTimeResolver.MakeResolveTable(_table, symbols.GetAddInitSvc(method));

            var namedWindowExpr = _namedWindow == null
                                ? ConstantNull()
                                : NamedWindowDeployTimeResolver.MakeResolveNamedWindow(_namedWindow, symbols.GetAddInitSvc(method));

            var aggregationServiceFactoryExpr = SubSelectStrategyFactoryLocalViewPreloadedForge.MakeAggregationService(
                _subqueryNumber,
                _aggregationServiceForgeDesc,
                classScope,
                method,
                symbols);
            var filterExprEvalExpr = _filterExprEval == null
                                ? ConstantNull()
                                : ExprNodeUtilityCodegen.CodegenEvaluatorNoCoerce(_filterExprEval, method, GetType(), classScope);

            var queryPlanExpr = _queryPlan == null
                                ? ConstantNull()
                                : _queryPlan.Make(method, symbols, classScope);

            method.Block
            .DeclareVar <SubSelectStrategyFactoryIndexShare>("s", NewInstance(typeof(SubSelectStrategyFactoryIndexShare)))
            .SetProperty(Ref("s"), "Table", tableExpr)
            .SetProperty(Ref("s"), "NamedWindow", namedWindowExpr)
            .SetProperty(Ref("s"), "AggregationServiceFactory", aggregationServiceFactoryExpr)
            .SetProperty(Ref("s"), "FilterExprEval", filterExprEvalExpr)
            .SetProperty(Ref("s"), "GroupKeyEval", groupKeyEval)
            .SetProperty(Ref("s"), "QueryPlan", queryPlanExpr)
            .MethodReturn(Ref("s"));
            return(LocalMethod(method));
        }
        public CodegenExpression MakeCodegen(
            CodegenMethodScope parent,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            CodegenMethod method = parent.MakeChild(typeof(SubSelectStrategyFactoryLocalViewPreloaded), GetType(), classScope);

            CodegenExpression groupKeyEval = MultiKeyCodegen.CodegenExprEvaluatorMayMultikey(_groupKeys, null, _groupByMultiKeyClasses, method, classScope);

            method.Block
            .DeclareVar <SubSelectStrategyFactoryLocalViewPreloaded>("factory", NewInstance(typeof(SubSelectStrategyFactoryLocalViewPreloaded)))
            .SetProperty(Ref("factory"), "SubqueryNumber", Constant(_subqueryNumber))
            .SetProperty(Ref("factory"), "ViewFactories", ViewFactoryForgeUtil.CodegenForgesWInit(_viewForges, 0, _subqueryNumber, method, symbols, classScope))
            .SetProperty(Ref("factory"), "ViewResourceDelegate", _viewResourceDelegateDesc.ToExpression())
            .SetProperty(Ref("factory"), "EventTableFactoryFactory", _lookupStrategy.First.Make(method, symbols, classScope))
            .SetProperty(Ref("factory"), "LookupStrategyFactory", _lookupStrategy.Second.Make(method, symbols, classScope))
            .SetProperty(Ref("factory"), "AggregationServiceFactory", MakeAggregationService(_subqueryNumber, _aggregationServiceForgeDesc, classScope, method, symbols))
            .SetProperty(Ref("factory"), "CorrelatedSubquery", Constant(_correlatedSubquery))
            .SetProperty(Ref("factory"), "GroupKeyEval", groupKeyEval)
            .SetProperty(Ref("factory"), "FilterExprEval", _filterExprNode == null
                                                ? ConstantNull()
                                                : ExprNodeUtilityCodegen.CodegenEvaluatorNoCoerce(_filterExprNode.Forge, method, GetType(), classScope));

            if (_namedWindow != null)
            {
                method.Block.SetProperty(
                    Ref("factory"), "NamedWindow", NamedWindowDeployTimeResolver.MakeResolveNamedWindow(_namedWindow, symbols.GetAddInitSvc(method)));
                if (_namedWindowFilterExpr != null)
                {
                    method.Block
                    .SetProperty(Ref("factory"), "NamedWindowFilterQueryGraph",
                                 _namedWindowFilterQueryGraph.Make(method, symbols, classScope))
                    .SetProperty(Ref("factory"), "NamedWindowFilterExpr",
                                 ExprNodeUtilityCodegen.CodegenEvaluator(_namedWindowFilterExpr.Forge, method, GetType(), classScope));
                }
            }

            method.Block.MethodReturn(Ref("factory"));
            return(LocalMethod(method));
        }
Esempio n. 7
0
        public CodegenMethod InitializeCodegen(
            CodegenMethodScope parent,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            CodegenMethod method = parent.MakeChild(
                typeof(StatementAgentInstanceFactoryCreateIndex),
                this.GetType(),
                classScope);
            CodegenExpressionRef saiff = Ref("saiff");
            method.Block
                .DeclareVar<StatementAgentInstanceFactoryCreateIndex>(
                    saiff.Ref,
                    NewInstance(typeof(StatementAgentInstanceFactoryCreateIndex)))
                .SetProperty(
                    saiff,
                    "EventType",
                    EventTypeUtility.ResolveTypeCodegen(eventType, symbols.GetAddInitSvc(method)))
                .SetProperty(saiff, "IndexName", Constant(indexName))
                .SetProperty(saiff, "IndexModuleName", Constant(indexModuleName))
                .SetProperty(saiff, "IndexMultiKey", imk.Make(method, classScope))
                .SetProperty(saiff, "ExplicitIndexDesc", explicitIndexDesc.Make(method, classScope));
            if (namedWindow != null) {
                method.Block.SetProperty(
                    saiff,
                    "NamedWindow",
                    NamedWindowDeployTimeResolver.MakeResolveNamedWindow(namedWindow, symbols.GetAddInitSvc(method)));
            }
            else {
                method.Block.SetProperty(
                    saiff,
                    "Table",
                    TableDeployTimeResolver.MakeResolveTable(table, symbols.GetAddInitSvc(method)));
            }

            method.Block.MethodReturn(saiff);
            return method;
        }