public EPServiceProviderIsolated GetIsolationUnit(string name, int?optionalUnitId)
        {
            var serviceProviderIsolated = _isolatedProviders.Get(name);

            if (serviceProviderIsolated != null)
            {
                return(serviceProviderIsolated);
            }

            FilterServiceSPI filterService = FilterServiceProvider.NewService(
                _epServicesContext.LockManager,
                _epServicesContext.RWLockManager,
                _epServicesContext.ConfigSnapshot.EngineDefaults.Execution.FilterServiceProfile,
                true);

            var scheduleService = new SchedulingServiceImpl(
                _epServicesContext.TimeSource,
                _epServicesContext.LockManager);
            var services = new EPIsolationUnitServices(name, currentUnitId, filterService, scheduleService);

            serviceProviderIsolated = new EPServiceProviderIsolatedImpl(
                name, services, _epServicesContext, _isolatedProviders);
            _isolatedProviders.Put(name, serviceProviderIsolated);
            return(serviceProviderIsolated);
        }
Esempio n. 2
0
 /// <summary>Ctor. </summary>
 /// <param name="name">the isolation unit name</param>
 /// <param name="unitId">id of the isolation unit</param>
 /// <param name="filterService">isolated filter service</param>
 /// <param name="schedulingService">isolated scheduling service</param>
 public EPIsolationUnitServices(String name,
                                int unitId,
                                FilterServiceSPI filterService,
                                SchedulingServiceSPI schedulingService)
 {
     Name              = name;
     UnitId            = unitId;
     FilterService     = filterService;
     SchedulingService = schedulingService;
 }
Esempio n. 3
0
        public static FilterValueSetParam[] GetFilterMulti(EPStatementSPI statementSPI)
        {
            FilterServiceSPI filterServiceSPI = (FilterServiceSPI)statementSPI.StatementContext.FilterService;
            FilterSet        set = filterServiceSPI.Take(Collections.SingletonSet(statementSPI.StatementId));

            Assert.AreEqual(1, set.Filters.Count);
            FilterValueSet valueSet = set.Filters[0].FilterValueSet;

            return(valueSet.Parameters[0]);
        }
        public void TestSubselect()
        {
            FilterServiceSPI filterSPI = (FilterServiceSPI)_spi.FilterService;

            SendTimeEvent("2002-05-1 8:00:00.000");
            _epService.EPAdministrator.CreateEPL("create context NineToFive as start (0, 9, *, *, *) end (0, 17, *, *, *)");

            String[] fields = "TheString,col".Split(',');
            SupportUpdateListener listener  = new SupportUpdateListener();
            EPStatementSPI        statement = (EPStatementSPI)_epService.EPAdministrator.CreateEPL("context NineToFive select TheString, (select p00 from SupportBean_S0.std:lastevent()) as col from SupportBean");

            statement.Events += listener.Update;
            Assert.AreEqual(0, filterSPI.FilterCountApprox);   // from the context

            // now started
            SendTimeEvent("2002-05-1 9:00:00.000");
            Assert.AreEqual(2, filterSPI.FilterCountApprox);   // from the context

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new Object[] { "E1", null });

            _epService.EPRuntime.SendEvent(new SupportBean_S0(11, "S01"));
            _epService.EPRuntime.SendEvent(new SupportBean("E2", 2));
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new Object[] { "E2", "S01" });

            // now gone
            SendTimeEvent("2002-05-1 17:00:00.000");
            Assert.AreEqual(0, filterSPI.FilterCountApprox);   // from the context

            _epService.EPRuntime.SendEvent(new SupportBean("Ex", 0));
            Assert.IsFalse(listener.IsInvoked);

            // now started
            SendTimeEvent("2002-05-2 9:00:00.000");
            Assert.AreEqual(2, filterSPI.FilterCountApprox);   // from the context
            Assert.IsFalse(listener.IsInvoked);

            _epService.EPRuntime.SendEvent(new SupportBean("E3", 3));
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new Object[] { "E3", null });

            _epService.EPRuntime.SendEvent(new SupportBean_S0(12, "S02"));
            _epService.EPRuntime.SendEvent(new SupportBean("E4", 4));
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new Object[] { "E4", "S02" });
            AgentInstanceAssertionUtil.AssertInstanceCounts(statement.StatementContext, 1, 1, 0, 0);

            // now gone
            SendTimeEvent("2002-05-2 17:00:00.000");
            Assert.AreEqual(0, filterSPI.FilterCountApprox);   // from the context

            _epService.EPRuntime.SendEvent(new SupportBean("Ey", 0));
            Assert.IsFalse(listener.IsInvoked);
            AgentInstanceAssertionUtil.AssertInstanceCounts(statement.StatementContext, 0, 0, 0, 0);
        }
Esempio n. 5
0
        private void RunAssertionCreateSchemaNamedWindowInsert(EPServiceProvider epService)
        {
            string text = "module test.test1;\n" +
                          "create schema MyTypeOne(col1 string, col2 int);" +
                          "create window MyWindowOne#keepall as select * from MyTypeOne;" +
                          "insert into MyWindowOne select * from MyTypeOne;";

            DeploymentResult resultOne = epService.EPAdministrator.DeploymentAdmin.ParseDeploy(text, "uri1", "arch1", null);

            epService.EPAdministrator.DeploymentAdmin.UndeployRemove(resultOne.DeploymentId);

            DeploymentResult resultTwo = epService.EPAdministrator.DeploymentAdmin.ParseDeploy(text, "uri2", "arch2", null);

            epService.EPAdministrator.DeploymentAdmin.UndeployRemove(resultTwo.DeploymentId);
            text = "module test.test1;\n" +
                   "create schema MyTypeOne(col1 string, col2 int, col3 long);" +
                   "create window MyWindowOne#keepall as select * from MyTypeOne;" +
                   "insert into MyWindowOne select * from MyTypeOne;";

            DeploymentResult resultThree = epService.EPAdministrator.DeploymentAdmin.ParseDeploy(text, "uri1", "arch1", null);

            epService.EPAdministrator.DeploymentAdmin.UndeployRemove(resultThree.DeploymentId);

            FilterService    filterService = ((EPServiceProviderSPI)epService).FilterService;
            FilterServiceSPI filterSPI     = (FilterServiceSPI)filterService;

            Assert.AreEqual(0, filterSPI.CountTypes);

            // test on-merge
            epService.EPAdministrator.Configuration.AddEventType <SupportBean>();
            string moduleString =
                "@Name('S0') create window MyWindow#unique(IntPrimitive) as SupportBean;\n" +
                "@Name('S1') on MyWindow insert into SecondStream select *;\n" +
                "@Name('S2') on SecondStream merge MyWindow when matched then insert into ThirdStream select * then delete\n";
            Module module = epService.EPAdministrator.DeploymentAdmin.Parse(moduleString);

            epService.EPAdministrator.DeploymentAdmin.Deploy(module, null, "myid_101");
            epService.EPAdministrator.DeploymentAdmin.UndeployRemove("myid_101");
            epService.EPAdministrator.DeploymentAdmin.Deploy(module, null, "myid_101");

            // test table
            string           moduleTableOne = "create table MyTable(c0 string, c1 string)";
            DeploymentResult d = epService.EPAdministrator.DeploymentAdmin.ParseDeploy(moduleTableOne);

            epService.EPAdministrator.DeploymentAdmin.UndeployRemove(d.DeploymentId);
            string moduleTableTwo = "create table MyTable(c0 string, c1 string, c2 string)";

            epService.EPAdministrator.DeploymentAdmin.ParseDeploy(moduleTableTwo);

            UndeployRemoveAll(epService);
        }
Esempio n. 6
0
 public StageSpecificServices(
     DeploymentLifecycleService deploymentLifecycleService,
     IReaderWriterLock eventProcessingRWLock,
     FilterServiceSPI filterService,
     InternalEventRouter internalEventRouter,
     MetricReportingService metricReportingService,
     SchedulingServiceSPI schedulingService,
     StageRuntimeServices stageRuntimeServices,
     ThreadingService threadingService)
 {
     this.deploymentLifecycleService = deploymentLifecycleService;
     this.eventProcessingRWLock      = eventProcessingRWLock;
     this.filterService          = filterService;
     this.internalEventRouter    = internalEventRouter;
     this.metricReportingService = metricReportingService;
     this.schedulingService      = schedulingService;
     this.stageRuntimeServices   = stageRuntimeServices;
     this.threadingService       = threadingService;
 }
Esempio n. 7
0
        // Supplied after construction to avoid circular dependency

        /// <summary>
        /// Constructor - sets up new set of services.
        /// </summary>
        /// <param name="engineURI">is the engine URI</param>
        /// <param name="schedulingService">service to get time and schedule callbacks</param>
        /// <param name="eventAdapterService">service to resolve event types</param>
        /// <param name="engineImportService">is engine imported static func packages and aggregation functions</param>
        /// <param name="engineSettingsService">provides engine settings</param>
        /// <param name="databaseConfigService">service to resolve a database name to database connection factory and configs</param>
        /// <param name="plugInViews">resolves view namespace and name to view factory class</param>
        /// <param name="statementLockFactory">creates statement-level locks</param>
        /// <param name="eventProcessingRWLock">is the engine lock for statement management</param>
        /// <param name="extensionServicesContext">marker interface allows adding additional services</param>
        /// <param name="engineEnvContext">is engine environment/directory information for use with adapters and external env</param>
        /// <param name="statementContextFactory">is the factory to use to create statement context objects</param>
        /// <param name="plugInPatternObjects">resolves plug-in pattern objects</param>
        /// <param name="timerService">is the timer service</param>
        /// <param name="filterService">the filter service</param>
        /// <param name="streamFactoryService">is hooking up filters to streams</param>
        /// <param name="namedWindowMgmtService">The named window MGMT service.</param>
        /// <param name="namedWindowDispatchService">The named window dispatch service.</param>
        /// <param name="variableService">provides access to variable values</param>
        /// <param name="tableService">The table service.</param>
        /// <param name="timeSourceService">time source provider class</param>
        /// <param name="valueAddEventService">handles Update events</param>
        /// <param name="metricsReportingService">for metric reporting</param>
        /// <param name="statementEventTypeRef">statement to event type reference holding</param>
        /// <param name="statementVariableRef">statement to variabke reference holding</param>
        /// <param name="configSnapshot">configuration snapshot</param>
        /// <param name="threadingServiceImpl">engine-level threading services</param>
        /// <param name="internalEventRouter">routing of events</param>
        /// <param name="statementIsolationService">maintains isolation information per statement</param>
        /// <param name="schedulingMgmtService">schedule management for statements</param>
        /// <param name="deploymentStateService">The deployment state service.</param>
        /// <param name="exceptionHandlingService">The exception handling service.</param>
        /// <param name="patternNodeFactory">The pattern node factory.</param>
        /// <param name="eventTypeIdGenerator">The event type id generator.</param>
        /// <param name="statementMetadataFactory">The statement metadata factory.</param>
        /// <param name="contextManagementService">The context management service.</param>
        /// <param name="patternSubexpressionPoolSvc">The pattern subexpression pool SVC.</param>
        /// <param name="matchRecognizeStatePoolEngineSvc">The match recognize state pool engine SVC.</param>
        /// <param name="dataFlowService">The data flow service.</param>
        /// <param name="exprDeclaredService">The expr declared service.</param>
        /// <param name="contextControllerFactoryFactorySvc">The context controller factory factory SVC.</param>
        /// <param name="contextManagerFactoryService">The context manager factory service.</param>
        /// <param name="epStatementFactory">The ep statement factory.</param>
        /// <param name="regexHandlerFactory">The regex handler factory.</param>
        /// <param name="viewableActivatorFactory">The viewable activator factory.</param>
        /// <param name="filterNonPropertyRegisteryService">The filter non property registery service.</param>
        /// <param name="resultSetProcessorHelperFactory">The result set processor helper factory.</param>
        /// <param name="viewServicePreviousFactory">The view service previous factory.</param>
        /// <param name="eventTableIndexService">The event table index service.</param>
        /// <param name="epRuntimeIsolatedFactory">The ep runtime isolated factory.</param>
        /// <param name="filterBooleanExpressionFactory">The filter boolean expression factory.</param>
        /// <param name="dataCacheFactory">The data cache factory.</param>
        /// <param name="multiMatchHandlerFactory">The multi match handler factory.</param>
        /// <param name="namedWindowConsumerMgmtService">The named window consumer MGMT service.</param>
        /// <param name="aggregationFactoryFactory"></param>
        /// <param name="scriptingService">The scripting service.</param>
        public EPServicesContext(
            string engineURI,
            SchedulingServiceSPI schedulingService,
            EventAdapterService eventAdapterService,
            EngineImportService engineImportService,
            EngineSettingsService engineSettingsService,
            DatabaseConfigService databaseConfigService,
            PluggableObjectCollection plugInViews,
            StatementLockFactory statementLockFactory,
            IReaderWriterLock eventProcessingRWLock,
            EngineLevelExtensionServicesContext extensionServicesContext,
            Directory engineEnvContext,
            StatementContextFactory statementContextFactory,
            PluggableObjectCollection plugInPatternObjects,
            TimerService timerService,
            FilterServiceSPI filterService,
            StreamFactoryService streamFactoryService,
            NamedWindowMgmtService namedWindowMgmtService,
            NamedWindowDispatchService namedWindowDispatchService,
            VariableService variableService,
            TableService tableService,
            TimeSourceService timeSourceService,
            ValueAddEventService valueAddEventService,
            MetricReportingServiceSPI metricsReportingService,
            StatementEventTypeRef statementEventTypeRef,
            StatementVariableRef statementVariableRef,
            ConfigurationInformation configSnapshot,
            ThreadingService threadingServiceImpl,
            InternalEventRouterImpl internalEventRouter,
            StatementIsolationService statementIsolationService,
            SchedulingMgmtService schedulingMgmtService,
            DeploymentStateService deploymentStateService,
            ExceptionHandlingService exceptionHandlingService,
            PatternNodeFactory patternNodeFactory,
            EventTypeIdGenerator eventTypeIdGenerator,
            StatementMetadataFactory statementMetadataFactory,
            ContextManagementService contextManagementService,
            PatternSubexpressionPoolEngineSvc patternSubexpressionPoolSvc,
            MatchRecognizeStatePoolEngineSvc matchRecognizeStatePoolEngineSvc,
            DataFlowService dataFlowService,
            ExprDeclaredService exprDeclaredService,
            ContextControllerFactoryFactorySvc contextControllerFactoryFactorySvc,
            ContextManagerFactoryService contextManagerFactoryService,
            EPStatementFactory epStatementFactory,
            RegexHandlerFactory regexHandlerFactory,
            ViewableActivatorFactory viewableActivatorFactory,
            FilterNonPropertyRegisteryService filterNonPropertyRegisteryService,
            ResultSetProcessorHelperFactory resultSetProcessorHelperFactory,
            ViewServicePreviousFactory viewServicePreviousFactory,
            EventTableIndexService eventTableIndexService,
            EPRuntimeIsolatedFactory epRuntimeIsolatedFactory,
            FilterBooleanExpressionFactory filterBooleanExpressionFactory,
            DataCacheFactory dataCacheFactory,
            MultiMatchHandlerFactory multiMatchHandlerFactory,
            NamedWindowConsumerMgmtService namedWindowConsumerMgmtService,
            AggregationFactoryFactory aggregationFactoryFactory,
            ScriptingService scriptingService)
        {
            EngineURI             = engineURI;
            SchedulingService     = schedulingService;
            EventAdapterService   = eventAdapterService;
            EngineImportService   = engineImportService;
            EngineSettingsService = engineSettingsService;
            DatabaseRefService    = databaseConfigService;
            FilterService         = filterService;
            TimerService          = timerService;
            DispatchService       = DispatchServiceProvider.NewService();
            ViewService           = ViewServiceProvider.NewService();
            StreamService         = streamFactoryService;
            PlugInViews           = plugInViews;
            StatementLockFactory  = statementLockFactory;
            EventProcessingRWLock = eventProcessingRWLock;
            EngineLevelExtensionServicesContext = extensionServicesContext;
            EngineEnvContext           = engineEnvContext;
            StatementContextFactory    = statementContextFactory;
            PlugInPatternObjects       = plugInPatternObjects;
            NamedWindowMgmtService     = namedWindowMgmtService;
            NamedWindowDispatchService = namedWindowDispatchService;
            VariableService            = variableService;
            TableService                     = tableService;
            TimeSource                       = timeSourceService;
            ValueAddEventService             = valueAddEventService;
            MetricsReportingService          = metricsReportingService;
            StatementEventTypeRefService     = statementEventTypeRef;
            ConfigSnapshot                   = configSnapshot;
            ThreadingService                 = threadingServiceImpl;
            InternalEventRouter              = internalEventRouter;
            StatementIsolationService        = statementIsolationService;
            SchedulingMgmtService            = schedulingMgmtService;
            StatementVariableRefService      = statementVariableRef;
            DeploymentStateService           = deploymentStateService;
            ExceptionHandlingService         = exceptionHandlingService;
            PatternNodeFactory               = patternNodeFactory;
            EventTypeIdGenerator             = eventTypeIdGenerator;
            StatementMetadataFactory         = statementMetadataFactory;
            ContextManagementService         = contextManagementService;
            PatternSubexpressionPoolSvc      = patternSubexpressionPoolSvc;
            MatchRecognizeStatePoolEngineSvc = matchRecognizeStatePoolEngineSvc;
            DataFlowService                  = dataFlowService;
            ExprDeclaredService              = exprDeclaredService;
            ExpressionResultCacheSharable    = new ExpressionResultCacheService(
                configSnapshot.EngineDefaults.ExecutionConfig.DeclaredExprValueCacheSize);
            ContextControllerFactoryFactorySvc = contextControllerFactoryFactorySvc;
            ContextManagerFactoryService       = contextManagerFactoryService;
            EpStatementFactory                = epStatementFactory;
            RegexHandlerFactory               = regexHandlerFactory;
            ViewableActivatorFactory          = viewableActivatorFactory;
            FilterNonPropertyRegisteryService = filterNonPropertyRegisteryService;
            ResultSetProcessorHelperFactory   = resultSetProcessorHelperFactory;
            ViewServicePreviousFactory        = viewServicePreviousFactory;
            EventTableIndexService            = eventTableIndexService;
            EpRuntimeIsolatedFactory          = epRuntimeIsolatedFactory;
            FilterBooleanExpressionFactory    = filterBooleanExpressionFactory;
            DataCacheFactory               = dataCacheFactory;
            MultiMatchHandlerFactory       = multiMatchHandlerFactory;
            NamedWindowConsumerMgmtService = namedWindowConsumerMgmtService;
            AggregationFactoryFactory      = aggregationFactoryFactory;
            ScriptingService               = scriptingService;
        }
Esempio n. 8
0
        private void RunAssertionHashSegmented(EPServiceProvider epService)
        {
            // Comment-in to see CRC32 code.
            for (int i = 0; i < 10; i++)
            {
                string key      = "E" + i;
                long   code     = SupportHashCodeFuncGranularCRC32.ComputeCrc32(key) % 4;
                int    hashCode = i.GetHashCode() % 4;
                //Log.Info(key + " code " + code + " hashCode " + hashCode);
            }

            // test CRC32 Hash
            FilterServiceSPI filterSPI = (FilterServiceSPI)((EPServiceProviderSPI)epService).FilterService;
            string           ctx       = "HashSegmentedContext";
            string           eplCtx    = "@Name('context') create context " + ctx + " as " +
                                         "coalesce consistent_hash_crc32(TheString) from SupportBean " +
                                         "granularity 4 " +
                                         "preallocate";

            epService.EPAdministrator.CreateEPL(eplCtx);

            string eplStmt = "context " + ctx + " " +
                             "select context.name as c0, TheString as c1, sum(IntPrimitive) as c2 from SupportBean#keepall group by TheString";
            EPStatementSPI statement = (EPStatementSPI)epService.EPAdministrator.CreateEPL(eplStmt);
            var            listener  = new SupportUpdateListener();

            statement.Events += listener.Update;
            Assert.AreEqual(4, filterSPI.FilterCountApprox);
            AgentInstanceAssertionUtil.AssertInstanceCounts(statement.StatementContext, 4, 0, 0, 0);

            TryAssertionHash(epService, listener, ctx, statement, new SupportHashCodeFuncGranularCRC32(4).CodeFor);
            Assert.AreEqual(0, filterSPI.FilterCountApprox);

            // test same with SODA
            EPStatementObjectModel modelCtx = epService.EPAdministrator.CompileEPL(eplCtx);

            Assert.AreEqual(eplCtx, modelCtx.ToEPL());
            EPStatement stmtCtx = epService.EPAdministrator.Create(modelCtx);

            Assert.AreEqual(eplCtx, stmtCtx.Text);

            statement         = (EPStatementSPI)epService.EPAdministrator.CreateEPL(eplStmt);
            statement.Events += listener.Update;
            TryAssertionHash(epService, listener, ctx, statement, new SupportHashCodeFuncGranularCRC32(4).CodeFor);

            // test with Java-hashCode string hash
            epService.EPAdministrator.CreateEPL("@Name('context') create context " + ctx + " " +
                                                "coalesce hash_code(TheString) from SupportBean " +
                                                "granularity 6 " +
                                                "preallocate");

            statement = (EPStatementSPI)epService.EPAdministrator.CreateEPL("context " + ctx + " " +
                                                                            "select context.name as c0, TheString as c1, sum(IntPrimitive) as c2 from SupportBean#keepall group by TheString");
            statement.Events += listener.Update;
            Assert.AreEqual(6, filterSPI.FilterCountApprox);
            AgentInstanceAssertionUtil.AssertInstanceCounts(statement.StatementContext, 6, 0, 0, 0);

            TryAssertionHash(epService, listener, ctx, statement, HashCodeFuncGranularInternalHash(6));
            Assert.AreEqual(0, filterSPI.FilterCountApprox);

            // test no pre-allocate
            epService.EPAdministrator.CreateEPL("@Name('context') create context " + ctx + " " +
                                                "coalesce hash_code(TheString) from SupportBean " +
                                                "granularity 16 ");

            statement = (EPStatementSPI)epService.EPAdministrator.CreateEPL("context " + ctx + " " +
                                                                            "select context.name as c0, TheString as c1, sum(IntPrimitive) as c2 from SupportBean#keepall group by TheString");
            statement.Events += listener.Update;
            Assert.AreEqual(1, filterSPI.FilterCountApprox);
            AgentInstanceAssertionUtil.AssertInstanceCounts(statement.StatementContext, 0, 0, 0, 0);

            TryAssertionHash(epService, listener, ctx, statement, HashCodeFuncGranularInternalHash(16));
            Assert.AreEqual(0, filterSPI.FilterCountApprox);
        }
Esempio n. 9
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;
 }
Esempio n. 10
0
        public static void AssertFilterMulti(EPStatementSPI statementSPI, string eventTypeName, SupportFilterItem[][] expected)
        {
            FilterServiceSPI filterServiceSPI = (FilterServiceSPI)statementSPI.StatementContext.FilterService;
            FilterSet        set = filterServiceSPI.Take(Collections.SingletonSet(statementSPI.StatementId));

            FilterSetEntry filterSetEntry = null;

            foreach (FilterSetEntry entry in set.Filters)
            {
                if (entry.FilterValueSet.EventType.Name.Equals(eventTypeName))
                {
                    if (filterSetEntry != null)
                    {
                        Assert.Fail("Multiple filters for type " + eventTypeName);
                    }
                    filterSetEntry = entry;
                }
            }

            FilterValueSet valueSet = filterSetEntry.FilterValueSet;

            FilterValueSetParam[][] @params = valueSet.Parameters;

            var comparator = new Func <SupportFilterItem, SupportFilterItem, int>(
                (o1, o2) => {
                var o1name = o1.Name;
                var o2name = o2.Name;

                if (o1name == o2name)
                {
                    if (o1.Op > o1.Op)
                    {
                        return(1);
                    }
                    if (o1.Op < o1.Op)
                    {
                        return(-1);
                    }
                    return(0);
                }
                return(o1name.CompareTo(o2name));
            });

            var found = new SupportFilterItem[@params.Length][];

            for (int i = 0; i < found.Length; i++)
            {
                found[i] = new SupportFilterItem[@params[i].Length];
                for (int j = 0; j < @params[i].Length; j++)
                {
                    found[i][j] = new SupportFilterItem(@params[i][j].Lookupable.Expression.ToString(),
                                                        @params[i][j].FilterOperator);
                }
                Collections.SortInPlace(found[i], comparator);
            }

            for (int i = 0; i < expected.Length; i++)
            {
                Collections.SortInPlace(expected[i], comparator);
            }

            EPAssertionUtil.AssertEqualsAnyOrder(expected, found);
            filterServiceSPI.Apply(set);
        }