Example #1
0
 public EPServicesContext(
     IContainer container,
     AggregationServiceFactoryService aggregationServiceFactoryService,
     BeanEventTypeFactoryPrivate beanEventTypeFactoryPrivate,
     BeanEventTypeStemService beanEventTypeStemService,
     ClassForNameProvider classForNameProvider,
     ParentClassLoader classLoaderParent,
     PathRegistry <string, ClassProvided> classProvidedPathRegistry,
     Configuration configSnapshot,
     ContextManagementService contextManagementService,
     PathRegistry <string, ContextMetaData> contextPathRegistry,
     ContextServiceFactory contextServiceFactory,
     EPDataFlowServiceImpl dataflowService,
     DataFlowFilterServiceAdapter dataFlowFilterServiceAdapter,
     DatabaseConfigServiceRuntime databaseConfigServiceRuntime,
     DeploymentLifecycleService deploymentLifecycleService,
     DispatchService dispatchService,
     RuntimeEnvContext runtimeEnvContext,
     RuntimeSettingsService runtimeSettingsService,
     string runtimeURI,
     ImportServiceRuntime importServiceRuntime,
     EPStatementFactory epStatementFactory,
     PathRegistry <string, ExpressionDeclItem> exprDeclaredPathRegistry,
     IReaderWriterLock eventProcessingRWLock,
     EPServicesHA epServicesHA,
     EPRuntimeSPI epRuntime,
     EventBeanService eventBeanService,
     EventBeanTypedEventFactory eventBeanTypedEventFactory,
     EPRenderEventServiceImpl eventRenderer,
     EventSerdeFactory eventSerdeFactory,
     EventTableIndexService eventTableIndexService,
     EventTypeAvroHandler eventTypeAvroHandler,
     EventTypeFactory eventTypeFactory,
     EventTypeIdResolver eventTypeIdResolver,
     PathRegistry <string, EventType> eventTypePathRegistry,
     EventTypeRepositoryImpl eventTypeRepositoryBus,
     EventTypeResolvingBeanFactory eventTypeResolvingBeanFactory,
     EventTypeSerdeRepository eventTypeSerdeRepository,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     FilterBooleanExpressionFactory filterBooleanExpressionFactory,
     FilterServiceSPI filterService,
     FilterSharedBoolExprRepository filterSharedBoolExprRepository,
     FilterSharedLookupableRepository filterSharedLookupableRepository,
     HistoricalDataCacheFactory historicalDataCacheFactory,
     InternalEventRouterImpl internalEventRouter,
     MetricReportingService metricReportingService,
     MultiMatchHandlerFactory multiMatchHandlerFactory,
     NamedWindowConsumerManagementService namedWindowConsumerManagementService,
     NamedWindowDispatchService namedWindowDispatchService,
     NamedWindowFactoryService namedWindowFactoryService,
     NamedWindowManagementService namedWindowManagementService,
     PathRegistry <string, NamedWindowMetaData> namedWindowPathRegistry,
     PatternFactoryService patternFactoryService,
     PatternSubexpressionPoolRuntimeSvc patternSubexpressionPoolEngineSvc,
     ResultSetProcessorHelperFactory resultSetProcessorHelperFactory,
     RowRecogStateRepoFactory rowRecogStateRepoFactory,
     RowRecogStatePoolRuntimeSvc rowRecogStatePoolEngineSvc,
     SchedulingServiceSPI schedulingService,
     PathRegistry <NameAndParamNum, ExpressionScriptProvided> scriptPathRegistry,
     ScriptCompiler scriptCompiler,
     StageRecoveryService stageRecoveryService,
     StatementLifecycleService statementLifecycleService,
     StatementAgentInstanceLockFactory statementAgentInstanceLockFactory,
     StatementResourceHolderBuilder statementResourceHolderBuilder,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     TableManagementService tableManagementService,
     PathRegistry <string, TableMetaData> tablePathRegistry,
     ThreadingService threadingService,
     TimeAbacus timeAbacus,
     TimeSourceService timeSourceService,
     TimerService timerService,
     VariableManagementService variableManagementService,
     PathRegistry <string, VariableMetaData> variablePathRegistry,
     ViewableActivatorFactory viewableActivatorFactory,
     ViewFactoryService viewFactoryService,
     ViewServicePreviousFactory viewServicePreviousFactory,
     XMLFragmentEventTypeFactory xmlFragmentEventTypeFactory)
 {
     _container = container;
     _aggregationServiceFactoryService = aggregationServiceFactoryService;
     _beanEventTypeFactoryPrivate      = beanEventTypeFactoryPrivate;
     _beanEventTypeStemService         = beanEventTypeStemService;
     _classForNameProvider             = classForNameProvider;
     _classLoaderParent            = classLoaderParent;
     _classProvidedPathRegistry    = classProvidedPathRegistry;
     _configSnapshot               = configSnapshot;
     _contextManagementService     = contextManagementService;
     _contextPathRegistry          = contextPathRegistry;
     _contextServiceFactory        = contextServiceFactory;
     _dataflowService              = dataflowService;
     _dataFlowFilterServiceAdapter = dataFlowFilterServiceAdapter;
     _databaseConfigServiceRuntime = databaseConfigServiceRuntime;
     _deploymentLifecycleService   = deploymentLifecycleService;
     _dispatchService              = dispatchService;
     _runtimeEnvContext            = runtimeEnvContext;
     _runtimeSettingsService       = runtimeSettingsService;
     _runtimeUri               = runtimeURI;
     _importServiceRuntime     = importServiceRuntime;
     _epStatementFactory       = epStatementFactory;
     _exprDeclaredPathRegistry = exprDeclaredPathRegistry;
     _eventProcessingRWLock    = eventProcessingRWLock;
     _epServicesHA             = epServicesHA;
     _epRuntime                            = epRuntime;
     _eventBeanService                     = eventBeanService;
     _eventBeanTypedEventFactory           = eventBeanTypedEventFactory;
     _eventRenderer                        = eventRenderer;
     _eventSerdeFactory                    = eventSerdeFactory;
     _eventTableIndexService               = eventTableIndexService;
     _eventTypeAvroHandler                 = eventTypeAvroHandler;
     _eventTypeFactory                     = eventTypeFactory;
     _eventTypeIdResolver                  = eventTypeIdResolver;
     _eventTypePathRegistry                = eventTypePathRegistry;
     _eventTypeRepositoryBus               = eventTypeRepositoryBus;
     _eventTypeResolvingBeanFactory        = eventTypeResolvingBeanFactory;
     _eventTypeSerdeRepository             = eventTypeSerdeRepository;
     _exceptionHandlingService             = exceptionHandlingService;
     _expressionResultCacheService         = expressionResultCacheService;
     _filterBooleanExpressionFactory       = filterBooleanExpressionFactory;
     _filterService                        = filterService;
     _filterSharedBoolExprRepository       = filterSharedBoolExprRepository;
     _filterSharedLookupableRepository     = filterSharedLookupableRepository;
     _historicalDataCacheFactory           = historicalDataCacheFactory;
     _internalEventRouter                  = internalEventRouter;
     _metricReportingService               = metricReportingService;
     _multiMatchHandlerFactory             = multiMatchHandlerFactory;
     _namedWindowConsumerManagementService = namedWindowConsumerManagementService;
     _namedWindowDispatchService           = namedWindowDispatchService;
     _namedWindowFactoryService            = namedWindowFactoryService;
     _namedWindowManagementService         = namedWindowManagementService;
     _namedWindowPathRegistry              = namedWindowPathRegistry;
     _patternFactoryService                = patternFactoryService;
     _patternSubexpressionPoolEngineSvc    = patternSubexpressionPoolEngineSvc;
     _resultSetProcessorHelperFactory      = resultSetProcessorHelperFactory;
     _rowRecogStateRepoFactory             = rowRecogStateRepoFactory;
     _rowRecogStatePoolEngineSvc           = rowRecogStatePoolEngineSvc;
     _schedulingService                    = schedulingService;
     _scriptPathRegistry                   = scriptPathRegistry;
     _stageRecoveryService                 = stageRecoveryService;
     _statementLifecycleService            = statementLifecycleService;
     _statementAgentInstanceLockFactory    = statementAgentInstanceLockFactory;
     _statementResourceHolderBuilder       = statementResourceHolderBuilder;
     _tableExprEvaluatorContext            = tableExprEvaluatorContext;
     _tableManagementService               = tableManagementService;
     _tablePathRegistry                    = tablePathRegistry;
     _threadingService                     = threadingService;
     _timeAbacus                           = timeAbacus;
     _timeSourceService                    = timeSourceService;
     _timerService                         = timerService;
     _variableManagementService            = variableManagementService;
     _variablePathRegistry                 = variablePathRegistry;
     _viewableActivatorFactory             = viewableActivatorFactory;
     _viewFactoryService                   = viewFactoryService;
     _viewServicePreviousFactory           = viewServicePreviousFactory;
     _xmlFragmentEventTypeFactory          = xmlFragmentEventTypeFactory;
     _scriptCompiler                       = scriptCompiler;
 }
 public StatementContextRuntimeServices(
     IContainer container,
     ContextManagementService contextManagementService,
     ContextServiceFactory contextServiceFactory,
     DatabaseConfigServiceRuntime databaseConfigService,
     DataFlowFilterServiceAdapter dataFlowFilterServiceAdapter,
     EPDataFlowServiceImpl dataflowService,
     string runtimeURI,
     INamingContext runtimeEnvContext,
     ImportServiceRuntime importServiceRuntime,
     RuntimeSettingsService runtimeSettingsService,
     RuntimeExtensionServices runtimeExtensionServices,
     object epRuntime,
     EPRenderEventService epRuntimeRenderEvent,
     EventServiceSendEventCommon eventServiceSendEventInternal,
     EPRuntimeEventProcessWrapped epRuntimeEventProcessWrapped,
     EventBeanService eventBeanService,
     EventBeanTypedEventFactory eventBeanTypedEventFactory,
     EventTableIndexService eventTableIndexService,
     EventTypeAvroHandler eventTypeAvroHandler,
     PathRegistry<string, EventType> eventTypePathRegistry,
     EventTypeRepositoryImpl eventTypeRepositoryPreconfigured,
     EventTypeResolvingBeanFactory eventTypeResolvingBeanFactory,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     FilterBooleanExpressionFactory filterBooleanExpressionFactory,
     FilterSharedBoolExprRepository filterSharedBoolExprRepository,
     FilterSharedLookupableRepository filterSharedLookupableRepository,
     HistoricalDataCacheFactory historicalDataCacheFactory,
     InternalEventRouter internalEventRouter,
     MetricReportingService metricReportingService,
     NamedWindowConsumerManagementService namedWindowConsumerManagementService,
     NamedWindowManagementService namedWindowManagementService,
     PathRegistry<string, ContextMetaData> pathContextRegistry,
     PathRegistry<string, NamedWindowMetaData> pathNamedWindowRegistry,
     RowRecogStateRepoFactory rowRecogStateRepoFactory,
     ResultSetProcessorHelperFactory resultSetProcessorHelperFactory,
     StatementAgentInstanceLockFactory statementAgentInstanceLockFactory,
     StatementResourceHolderBuilder statementResourceHolderBuilder,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     TableManagementService tableManagementService,
     VariableManagementService variableManagementService,
     ViewFactoryService viewFactoryService,
     ViewServicePreviousFactory viewServicePreviousFactory)
 {
     Container = container;
     ContextManagementService = contextManagementService;
     ContextServiceFactory = contextServiceFactory;
     DatabaseConfigService = databaseConfigService;
     DataFlowFilterServiceAdapter = dataFlowFilterServiceAdapter;
     DataflowService = dataflowService;
     RuntimeURI = runtimeURI;
     RuntimeEnvContext = runtimeEnvContext;
     ImportServiceRuntime = importServiceRuntime;
     RuntimeSettingsService = runtimeSettingsService;
     RuntimeExtensionServices = runtimeExtensionServices;
     Runtime = epRuntime;
     EPRuntimeRenderEvent = epRuntimeRenderEvent;
     EventServiceSendEventInternal = eventServiceSendEventInternal;
     EPRuntimeEventProcessWrapped = epRuntimeEventProcessWrapped;
     EventBeanService = eventBeanService;
     EventBeanTypedEventFactory = eventBeanTypedEventFactory;
     EventTableIndexService = eventTableIndexService;
     EventTypeAvroHandler = eventTypeAvroHandler;
     EventTypePathRegistry = eventTypePathRegistry;
     EventTypeRepositoryPreconfigured = eventTypeRepositoryPreconfigured;
     EventTypeResolvingBeanFactory = eventTypeResolvingBeanFactory;
     ExceptionHandlingService = exceptionHandlingService;
     ExpressionResultCacheService = expressionResultCacheService;
     FilterBooleanExpressionFactory = filterBooleanExpressionFactory;
     FilterSharedBoolExprRepository = filterSharedBoolExprRepository;
     FilterSharedLookupableRepository = filterSharedLookupableRepository;
     HistoricalDataCacheFactory = historicalDataCacheFactory;
     InternalEventRouter = internalEventRouter;
     MetricReportingService = metricReportingService;
     NamedWindowConsumerManagementService = namedWindowConsumerManagementService;
     NamedWindowManagementService = namedWindowManagementService;
     PathContextRegistry = pathContextRegistry;
     PathNamedWindowRegistry = pathNamedWindowRegistry;
     RowRecogStateRepoFactory = rowRecogStateRepoFactory;
     ResultSetProcessorHelperFactory = resultSetProcessorHelperFactory;
     StatementAgentInstanceLockFactory = statementAgentInstanceLockFactory;
     StatementResourceHolderBuilder = statementResourceHolderBuilder;
     TableExprEvaluatorContext = tableExprEvaluatorContext;
     TableManagementService = tableManagementService;
     VariableManagementService = variableManagementService;
     ViewFactoryService = viewFactoryService;
     ViewServicePreviousFactory = viewServicePreviousFactory;
 }
        public EPServicesContext CreateServicesContext(
            EPRuntimeSPI epRuntime,
            Configuration configs)
        {
            var container = epRuntime.Container;
            var runtimeEnvContext = new RuntimeEnvContext();
            var eventProcessingRWLock = epRuntime.Container.RWLockManager().CreateLock("EventProcLock");
            var deploymentLifecycleService = new DeploymentLifecycleServiceImpl(-1);

            var runtimeSettingsService = MakeRuntimeSettingsService(configs);

            var scriptCompiler = new ScriptCompilerImpl(container, configs.Common);
            
            var timeAbacus = TimeAbacusFactory.Make(configs.Common.TimeSource.TimeUnit);
            var timeZone = configs.Runtime.Expression.TimeZone ?? TimeZoneInfo.Utc;
            var importServiceRuntime = new ImportServiceRuntime(
                container,
                configs.Common.TransientConfiguration, timeAbacus,
                configs.Common.EventTypeAutoNameNamespaces, timeZone,
                configs.Common.MethodInvocationReferences,
                configs.Common.Imports,
                configs.Common.AnnotationImports);

            var epServicesHA = InitHA(epRuntime.URI, configs, runtimeEnvContext, eventProcessingRWLock, runtimeSettingsService);

            var eventTypeAvroHandler = MakeEventTypeAvroHandler(
                importServiceRuntime, configs.Common.EventMeta.AvroSettings, epServicesHA.RuntimeExtensionServices);
            var resolvedBeanEventTypes = BeanEventTypeRepoUtil.ResolveBeanEventTypes(configs.Common.EventTypeNames, importServiceRuntime);
            var eventBeanTypedEventFactory = MakeEventBeanTypedEventFactory(eventTypeAvroHandler);
            var beanEventTypeStemService =
                BeanEventTypeRepoUtil.MakeBeanEventTypeStemService(configs, resolvedBeanEventTypes, eventBeanTypedEventFactory);
            var eventTypeRepositoryPreconfigured = new EventTypeRepositoryImpl(false);
            var eventTypeFactory = MakeEventTypeFactory(
                epServicesHA.RuntimeExtensionServices, eventTypeRepositoryPreconfigured, deploymentLifecycleService, eventBeanTypedEventFactory);
            var beanEventTypeFactoryPrivate = new BeanEventTypeFactoryPrivate(eventBeanTypedEventFactory, eventTypeFactory, beanEventTypeStemService);
            
            EventTypeRepositoryBeanTypeUtil.BuildBeanTypes(
                beanEventTypeStemService,
                eventTypeRepositoryPreconfigured,
                resolvedBeanEventTypes,
                beanEventTypeFactoryPrivate,
                configs.Common.EventTypesBean);
            EventTypeRepositoryMapTypeUtil.BuildMapTypes(
                eventTypeRepositoryPreconfigured,
                configs.Common.MapTypeConfigurations,
                configs.Common.EventTypesMapEvents,
                configs.Common.EventTypesNestableMapEvents,
                beanEventTypeFactoryPrivate,
                importServiceRuntime);
            EventTypeRepositoryOATypeUtil.BuildOATypes(
                eventTypeRepositoryPreconfigured,
                configs.Common.ObjectArrayTypeConfigurations,
                configs.Common.EventTypesNestableObjectArrayEvents,
                beanEventTypeFactoryPrivate, 
                importServiceRuntime);
            
            var xmlFragmentEventTypeFactory = new XMLFragmentEventTypeFactory(beanEventTypeFactoryPrivate, null, eventTypeRepositoryPreconfigured);
            
            EventTypeRepositoryXMLTypeUtil.BuildXMLTypes(
                eventTypeRepositoryPreconfigured,
                configs.Common.EventTypesXMLDOM,
                beanEventTypeFactoryPrivate,
                xmlFragmentEventTypeFactory,
                container.ResourceManager());
                //importServiceRuntime
            EventTypeRepositoryAvroTypeUtil.BuildAvroTypes(
                eventTypeRepositoryPreconfigured, configs.Common.EventTypesAvro, eventTypeAvroHandler,
                beanEventTypeFactoryPrivate.EventBeanTypedEventFactory);
            EventTypeRepositoryVariantStreamUtil.BuildVariantStreams(
                eventTypeRepositoryPreconfigured, configs.Common.VariantStreams, eventTypeFactory);

            var eventTypeResolvingBeanFactory = MakeEventTypeResolvingBeanFactory(eventTypeRepositoryPreconfigured, eventTypeAvroHandler);

            var viewableActivatorFactory = InitViewableActivatorFactory();

            var statementLifecycleService = new StatementLifecycleServiceImpl();

            EventTypeIdResolver eventTypeIdResolver = new ProxyEventTypeIdResolver {
                ProcGetTypeById = (
                    eventTypeIdPublic,
                    eventTypeIdProtected) => {
                    if (eventTypeIdProtected == -1) {
                        return eventTypeRepositoryPreconfigured.GetTypeById(eventTypeIdPublic);
                    }

                    var deployerResult = deploymentLifecycleService.GetDeploymentByCRC(eventTypeIdPublic);
                    return deployerResult.DeploymentTypes.Get(eventTypeIdProtected);
                }
            };
            var filterSharedBoolExprRepository = MakeFilterSharedBoolExprRepository();
            var filterSharedLookupableRepository = MakeFilterSharedLookupableRepository();
            var filterServiceSPI = MakeFilterService(
                epServicesHA.RuntimeExtensionServices, eventTypeRepositoryPreconfigured, statementLifecycleService, runtimeSettingsService,
                eventTypeIdResolver, filterSharedLookupableRepository);
            var filterBooleanExpressionFactory = MakeFilterBooleanExpressionFactory(statementLifecycleService);

            var statementResourceHolderBuilder = MakeStatementResourceHolderBuilder();

            var aggregationServiceFactoryService = MakeAggregationServiceFactoryService(epServicesHA.RuntimeExtensionServices);

            var viewFactoryService = MakeViewFactoryService();
            var patternFactoryService = MakePatternFactoryService();

            var exceptionHandlingService = InitExceptionHandling(
                epRuntime.URI, configs.Runtime.ExceptionHandling, configs.Runtime.ConditionHandling, ClassForNameProviderDefault.INSTANCE);

            var timeSourceService = MakeTimeSource(configs);
            var schedulingService = MakeSchedulingService(
                epServicesHA,
                timeSourceService,
                epServicesHA.RuntimeExtensionServices,
                runtimeSettingsService,
                statementLifecycleService,
                importServiceRuntime.TimeZone.Id);

            var internalEventRouter = new InternalEventRouterImpl(eventBeanTypedEventFactory);

            var multiMatchHandlerFactory = MakeMultiMatchHandlerFactory(configs);

            var dispatchService = new DispatchService();
            var contextServiceFactory = MakeContextServiceFactory(epServicesHA.RuntimeExtensionServices);
            ContextManagementService contextManagementService = new ContextManagementServiceImpl();

            var viewServicePreviousFactory = MakeViewServicePreviousFactory(epServicesHA.RuntimeExtensionServices);

            var epStatementFactory = MakeEPStatementFactory();

            var msecTimerResolution = configs.Runtime.Threading.InternalTimerMsecResolution;
            if (msecTimerResolution <= 0) {
                throw new ConfigurationException("Timer resolution configuration not set to a valid value, expecting a non-zero value");
            }

            TimerService timerService = new TimerServiceImpl(epRuntime.URI, msecTimerResolution);
            StatementAgentInstanceLockFactory statementAgentInstanceLockFactory = new StatementAgentInstanceLockFactoryImpl(
                configs.Runtime.Execution.IsFairlock, configs.Runtime.Execution.IsDisableLocking);

            var eventTableIndexService = MakeEventTableIndexService(epServicesHA.RuntimeExtensionServices);
            var expressionResultCacheSharable = new ExpressionResultCacheService(
                configs.Runtime.Execution.DeclaredExprValueCacheSize,
                epRuntime.Container.ThreadLocalManager());

            var resultSetProcessorHelperFactory = MakeResultSetProcessorHelperFactory(epServicesHA.RuntimeExtensionServices);

            var variableRepositoryPreconfigured = new VariableRepositoryPreconfigured();
            VariableUtil.ConfigureVariables(
                variableRepositoryPreconfigured, configs.Common.Variables, importServiceRuntime, eventBeanTypedEventFactory,
                eventTypeRepositoryPreconfigured, beanEventTypeFactoryPrivate);
            var variableManagementService = MakeVariableManagementService(
                configs, schedulingService, eventBeanTypedEventFactory, runtimeSettingsService, epServicesHA);
            foreach (var publicVariable in variableRepositoryPreconfigured.Metadata) {
                variableManagementService.AddVariable(null, publicVariable.Value, null, null);
                variableManagementService.AllocateVariableState(
                    null, publicVariable.Key, DEFAULT_AGENT_INSTANCE_ID, false, null, eventBeanTypedEventFactory);
            }

            var variablePathRegistry = new PathRegistry<string, VariableMetaData>(PathRegistryObjectType.VARIABLE);

            var tableExprEvaluatorContext = new TableExprEvaluatorContext(
                epRuntime.Container.ThreadLocalManager());
            var tableManagementService = MakeTableManagementService(epServicesHA.RuntimeExtensionServices, tableExprEvaluatorContext);
            var tablePathRegistry = new PathRegistry<string, TableMetaData>(PathRegistryObjectType.TABLE);

            var metricsReporting = new MetricReportingServiceImpl(
                configs.Runtime.MetricsReporting, epRuntime.URI, container.RWLockManager());

            var namedWindowFactoryService = MakeNamedWindowFactoryService();
            var namedWindowDispatchService = MakeNamedWindowDispatchService(
                schedulingService, configs, eventProcessingRWLock, exceptionHandlingService, variableManagementService, tableManagementService,
                metricsReporting);
            NamedWindowManagementService namedWindowManagementService = new NamedWindowManagementServiceImpl();
            var namedWindowConsumerManagementService = MakeNamedWindowConsumerManagementService(namedWindowManagementService);

            var pathNamedWindowRegistry = new PathRegistry<string, NamedWindowMetaData>(PathRegistryObjectType.NAMEDWINDOW);
            var eventTypePathRegistry = new PathRegistry<string, EventType>(PathRegistryObjectType.EVENTTYPE);
            var pathContextRegistry = new PathRegistry<string, ContextMetaData>(PathRegistryObjectType.CONTEXT);
            EventBeanService eventBeanService = new EventBeanServiceImpl(
                eventTypeRepositoryPreconfigured, eventTypePathRegistry, eventBeanTypedEventFactory);

            PatternSubexpressionPoolRuntimeSvc patternSubexpressionPoolSvc;
            if (configs.Runtime.Patterns.MaxSubexpressions != null) {
                patternSubexpressionPoolSvc = new PatternSubexpressionPoolRuntimeSvcImpl(
                    configs.Runtime.Patterns.MaxSubexpressions.Value,
                    configs.Runtime.Patterns.IsMaxSubexpressionPreventStart);
            }
            else {
                patternSubexpressionPoolSvc = PatternSubexpressionPoolRuntimeSvcNoOp.INSTANCE;
            }

            var exprDeclaredPathRegistry = new PathRegistry<string, ExpressionDeclItem>(PathRegistryObjectType.EXPRDECL);
            var scriptPathRegistry = new PathRegistry<NameAndParamNum, ExpressionScriptProvided>(PathRegistryObjectType.SCRIPT);

            RowRecogStatePoolRuntimeSvc rowRecogStatePoolEngineSvc = null;
            if (configs.Runtime.MatchRecognize.MaxStates != null) {
                rowRecogStatePoolEngineSvc = new RowRecogStatePoolRuntimeSvc(
                    configs.Runtime.MatchRecognize.MaxStates.Value,
                    configs.Runtime.MatchRecognize.IsMaxStatesPreventStart);
            }

            var rowRecogStateRepoFactory = MakeRowRecogStateRepoFactory();

            DatabaseConfigServiceRuntime databaseConfigServiceRuntime =
                new DatabaseConfigServiceImpl(
                    container,
                    configs.Common.DatabaseReferences,
                    importServiceRuntime);
            var historicalDataCacheFactory = MakeHistoricalDataCacheFactory(epServicesHA.RuntimeExtensionServices);

            var dataflowService = new EPDataFlowServiceImpl(container);
            var dataFlowFilterServiceAdapter = MakeDataFlowFilterServiceAdapter();

            var threadingService = MakeThreadingService(configs);
            var eventRenderer = new EPRenderEventServiceImpl();

            var eventSerdeFactory = MakeEventSerdeFactory(epServicesHA.RuntimeExtensionServices);
            var eventTypeSerdeRepository = MakeEventTypeSerdeRepository(eventTypeRepositoryPreconfigured, eventTypePathRegistry);
            var classLoaderParent = new ParentClassLoader(importServiceRuntime.ClassLoader);

            var stageRecoveryService = MakeStageRecoveryService(epServicesHA);

            var classProvidedPathRegistry = new PathRegistry<string, ClassProvided>(PathRegistryObjectType.CLASSPROVIDED);

            return new EPServicesContext(
                container,
                aggregationServiceFactoryService,
                beanEventTypeFactoryPrivate,
                beanEventTypeStemService,
                ClassForNameProviderDefault.INSTANCE,
                classLoaderParent,
                classProvidedPathRegistry,
                configs,
                contextManagementService,
                pathContextRegistry,
                contextServiceFactory,
                dataflowService,
                dataFlowFilterServiceAdapter,
                databaseConfigServiceRuntime,
                deploymentLifecycleService,
                dispatchService,
                runtimeEnvContext,
                runtimeSettingsService,
                epRuntime.URI,
                importServiceRuntime,
                epStatementFactory,
                exprDeclaredPathRegistry,
                eventProcessingRWLock,
                epServicesHA,
                epRuntime,
                eventBeanService,
                eventBeanTypedEventFactory,
                eventRenderer,
                eventSerdeFactory,
                eventTableIndexService,
                eventTypeAvroHandler,
                eventTypeFactory,
                eventTypeIdResolver,
                eventTypePathRegistry,
                eventTypeRepositoryPreconfigured,
                eventTypeResolvingBeanFactory,
                eventTypeSerdeRepository,
                exceptionHandlingService,
                expressionResultCacheSharable,
                filterBooleanExpressionFactory,
                filterServiceSPI,
                filterSharedBoolExprRepository,
                filterSharedLookupableRepository,
                historicalDataCacheFactory,
                internalEventRouter,
                metricsReporting,
                multiMatchHandlerFactory,
                namedWindowConsumerManagementService,
                namedWindowDispatchService,
                namedWindowFactoryService,
                namedWindowManagementService,
                pathNamedWindowRegistry,
                patternFactoryService,
                patternSubexpressionPoolSvc,
                resultSetProcessorHelperFactory,
                rowRecogStateRepoFactory,
                rowRecogStatePoolEngineSvc,
                schedulingService,
                scriptPathRegistry,
                scriptCompiler,
                stageRecoveryService,
                statementLifecycleService,
                statementAgentInstanceLockFactory,
                statementResourceHolderBuilder,
                tableExprEvaluatorContext,
                tableManagementService,
                tablePathRegistry,
                threadingService,
                timeAbacus,
                timeSourceService,
                timerService,
                variableManagementService,
                variablePathRegistry,
                viewableActivatorFactory,
                viewFactoryService,
                viewServicePreviousFactory,
                xmlFragmentEventTypeFactory);
        }