示例#1
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);
        }
 public void MakeMethod(
     CodegenMethod method,
     SAIFFInitializeSymbol symbols,
     CodegenClassScope classScope)
 {
     CodegenExpressionRef queryMethod = Ref("qm");
     method.Block
         .DeclareVar(TypeOfMethod(), queryMethod.Ref, NewInstance(TypeOfMethod()))
         .SetProperty(
             queryMethod,
             "Annotations",
             annotations == null
                 ? ConstantNull()
                 : LocalMethod(MakeAnnotations(typeof(Attribute[]), annotations, method, classScope)))
         .SetProperty(
             queryMethod, "Processor", processor.Make(method, symbols, classScope))
         .SetProperty(
             queryMethod,
             "QueryGraph",
             queryGraph == null ? ConstantNull() : queryGraph.Make(method, symbols, classScope))
         .SetProperty(
             queryMethod,
             "InternalEventRouteDest",
             ExprDotName(
                 symbols.GetAddInitSvc(method), EPStatementInitServicesConstants.INTERNALEVENTROUTEDEST))
         .SetProperty(
             queryMethod,
             "TableAccesses",
             ExprTableEvalStrategyUtil.CodegenInitMap(
                 tableAccessForges,
                 this.GetType(),
                 method,
                 symbols,
                 classScope))
         .SetProperty(
             queryMethod, "HasTableAccess", Constant(hasTableAccess))
         .SetProperty(
             queryMethod, "Subselects", SubSelectFactoryForge.CodegenInitMap(
                 _subselectForges, GetType(), method, symbols, classScope));
         
     MakeInlineSpecificSetter(queryMethod, method, symbols, classScope);
     method.Block.MethodReturn(queryMethod);
 }
        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));
        }