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; }
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)); }
public CodegenMethod InitializeCodegen( CodegenClassScope classScope, CodegenMethodScope parent, SAIFFInitializeSymbol symbols) { var method = parent.MakeChild(typeof(StatementAgentInstanceFactorySelect), GetType(), classScope); method.Block .DeclareVar<StatementAgentInstanceFactorySelect>( "saiff", NewInstance(typeof(StatementAgentInstanceFactorySelect))); // stream names method.Block.SetProperty(Ref("saiff"), "StreamNames", Constant(_streamNames)); // activators method.Block.DeclareVar<ViewableActivator[]>( "activators", NewArrayByLength(typeof(ViewableActivator), Constant(_viewableActivatorForges.Length))); for (var i = 0; i < _viewableActivatorForges.Length; i++) { method.Block.AssignArrayElement( "activators", Constant(i), _viewableActivatorForges[i].MakeCodegen(method, symbols, classScope)); } method.Block.SetProperty(Ref("saiff"), "ViewableActivators", Ref("activators")); // views method.Block.DeclareVar<ViewFactory[][]>( "viewFactories", NewArrayByLength(typeof(ViewFactory[]), Constant(_views.Length))); for (var i = 0; i < _views.Length; i++) { if (_views[i] != null) { var array = ViewFactoryForgeUtil.CodegenForgesWInit( _views[i], i, null, method, symbols, classScope); method.Block.AssignArrayElement("viewFactories", Constant(i), array); } } method.Block.SetProperty(Ref("saiff"), "ViewFactories", Ref("viewFactories")); // view delegate information ('prior' and 'prev') method.Block.DeclareVar<ViewResourceDelegateDesc[]>( "viewResourceDelegates", NewArrayByLength(typeof(ViewResourceDelegateDesc), Constant(_viewResourceDelegates.Length))); for (var i = 0; i < _viewResourceDelegates.Length; i++) { method.Block.AssignArrayElement( "viewResourceDelegates", Constant(i), _viewResourceDelegates[i].ToExpression()); } method.Block.SetProperty(Ref("saiff"), "ViewResourceDelegates", Ref("viewResourceDelegates")); // result set processor method.Block.DeclareVar( _resultSetProcessorProviderClassName, RSPFACTORYPROVIDER, NewInstanceInner(_resultSetProcessorProviderClassName, symbols.GetAddInitSvc(method), Ref(StmtClassForgeableAIFactoryProviderBase.MEMBERNAME_STATEMENT_FIELDS))) .SetProperty(Ref("saiff"), "ResultSetProcessorFactoryProvider", Ref(RSPFACTORYPROVIDER)); // where-clause evaluator if (_whereClauseForge != null) { var whereEval = CodegenEvaluator(_whereClauseForge, method, GetType(), classScope); method.Block.SetProperty(Ref("saiff"), "WhereClauseEvaluator", whereEval); if (classScope.IsInstrumented) { method.Block.SetProperty( Ref("saiff"), "WhereClauseEvaluatorTextForAudit", Constant(ExprNodeUtilityPrint.ToExpressionStringMinPrecedence(_whereClauseForge))); } } // joins if (_joinSetComposerPrototypeForge != null) { method.Block.SetProperty( Ref("saiff"), "JoinSetComposerPrototype", _joinSetComposerPrototypeForge.Make(method, symbols, classScope)); } // output process view method.Block.DeclareVar( _outputProcessViewProviderClassName, OPVFACTORYPROVIDER, NewInstanceInner(_outputProcessViewProviderClassName, symbols.GetAddInitSvc(method), Ref("statementFields"))) .SetProperty(Ref("saiff"), "OutputProcessViewFactoryProvider", Ref(OPVFACTORYPROVIDER)); // subselects if (!_subselects.IsEmpty()) { method.Block.SetProperty( Ref("saiff"), "Subselects", SubSelectFactoryForge.CodegenInitMap(_subselects, GetType(), method, symbols, classScope)); } // table-access if (!_tableAccesses.IsEmpty()) { method.Block.SetProperty( Ref("saiff"), "TableAccesses", ExprTableEvalStrategyUtil.CodegenInitMap(_tableAccesses, GetType(), method, symbols, classScope)); } // order-by with no output-limit method.Block.SetProperty( Ref("saiff"), "OrderByWithoutOutputRateLimit", Constant(_orderByWithoutOutputRateLimit)); // unidirectional join method.Block.SetProperty(Ref("saiff"), "IsUnidirectionalJoin", Constant(_unidirectionalJoin)); method.Block.MethodReturn(Ref("saiff")); return method; }