Пример #1
0
        public static void CheckModulePreconditions(
            string deploymentId,
            string moduleName,
            DeploymentInternal deployment,
            EPServicesContext services)
        {
            foreach (var namedWindow in deployment.PathNamedWindows)
            {
                CheckDependency(services.NamedWindowPathRegistry, namedWindow, moduleName);
            }

            foreach (var table in deployment.PathTables)
            {
                CheckDependency(services.TablePathRegistry, table, moduleName);
            }

            foreach (var variable in deployment.PathVariables)
            {
                CheckDependency(services.VariablePathRegistry, variable, moduleName);
            }

            foreach (var context in deployment.PathContexts)
            {
                CheckDependency(services.ContextPathRegistry, context, moduleName);
            }

            foreach (var eventType in deployment.PathEventTypes)
            {
                CheckDependency(services.EventTypePathRegistry, eventType, moduleName);
            }

            foreach (var exprDecl in deployment.PathExprDecls)
            {
                CheckDependency(services.ExprDeclaredPathRegistry, exprDecl, moduleName);
            }

            foreach (var script in deployment.PathScripts)
            {
                CheckDependency(services.ScriptPathRegistry, script, moduleName);
            }

            foreach (var index in deployment.PathIndexes)
            {
                if (index.IsNamedWindow)
                {
                    var namedWindow = services.NamedWindowPathRegistry.GetWithModule(index.InfraName, index.InfraModuleName);
                    ValidateIndexPrecondition(namedWindow.IndexMetadata, index, deploymentId);
                }
                else
                {
                    var table = services.TablePathRegistry.GetWithModule(index.InfraName, index.InfraModuleName);
                    ValidateIndexPrecondition(table.IndexMetadata, index, deploymentId);
                }
            }

            foreach (var classProvided in deployment.PathClassProvideds)
            {
                CheckDependency(services.ClassProvidedPathRegistry, classProvided, moduleName);
            }
        }
Пример #2
0
 public EpFireAndForgetServiceImpl(
     EPServicesContext services,
     AtomicBoolean serviceStatusProvider)
 {
     _services = services;
     _serviceStatusProvider = serviceStatusProvider;
 }
Пример #3
0
 public void Init(
     EPServicesContext servicesContext,
     EPEventServiceSPI runtimeSPI,
     EPDeploymentServiceSPI adminSPI,
     EPStageServiceSPI stageServiceSPI)
 {
 }
Пример #4
0
 public EPDeploymentServiceImpl(
     EPServicesContext services,
     EPRuntimeSPI runtime)
 {
     _services = services;
     _runtime  = runtime;
 }
Пример #5
0
        private static void RolloutCleanStatements(
            EPStatement[][] statements,
            DeployerModuleStatementLightweights[] stmtLightweights,
            DeployerRolloutInitResult[] inits,
            string[] deploymentIds,
            ModuleProviderCLPair[] moduleProviders,
            EPServicesContext services)
        {
            for (var i = statements.Length - 1; i >= 0; i--)
            {
                if (statements[i] != null)
                {
                    DeployerHelperResolver.ReverseDeployment(
                        deploymentIds[i],
                        inits[i].ModulePaths.DeploymentTypes,
                        stmtLightweights[i].Lightweights,
                        statements[i],
                        moduleProviders[i],
                        services);
                    stmtLightweights[i] = null;
                    inits[i]            = null;
                }
            }

            RolloutCleanLightweights(stmtLightweights, inits, deploymentIds, moduleProviders, services);
        }
Пример #6
0
 private static void RolloutCleanClassloader(
     string[] deploymentIds,
     EPServicesContext services)
 {
     for (var i = 0; i < deploymentIds.Length; i++)
     {
         services.ClassLoaderParent.Remove(deploymentIds[i]);
     }
 }
Пример #7
0
 public StatementResultServiceImpl(
     StatementInformationalsRuntime statementInformationals,
     EPServicesContext epServicesContext)
 {
     StatementDispatchTl = new SlimThreadLocal<StatementDispatchTLEntry>(() => new StatementDispatchTLEntry());
     _statementInformationals = statementInformationals;
     _epServicesContext = epServicesContext;
     _outboundThreading = epServicesContext.ThreadingService.IsOutboundThreading;
     IsMakeSynthetic = statementInformationals.IsAlwaysSynthesizeOutputEvents;
 }
Пример #8
0
 public static void DeleteFromEventTypeBus(
     EPServicesContext services,
     IDictionary <long, EventType> eventTypes)
 {
     foreach (var entry in eventTypes)
     {
         if (entry.Value.Metadata.BusModifier == EventTypeBusModifier.BUS)
         {
             services.EventTypeRepositoryBus.RemoveType(entry.Value);
         }
     }
 }
Пример #9
0
 public static void DeleteFromPathRegistries(
     EPServicesContext services,
     string deploymentId)
 {
     services.EventTypePathRegistry.DeleteDeployment(deploymentId);
     services.NamedWindowPathRegistry.DeleteDeployment(deploymentId);
     services.TablePathRegistry.DeleteDeployment(deploymentId);
     services.ContextPathRegistry.DeleteDeployment(deploymentId);
     services.VariablePathRegistry.DeleteDeployment(deploymentId);
     services.ExprDeclaredPathRegistry.DeleteDeployment(deploymentId);
     services.ScriptPathRegistry.DeleteDeployment(deploymentId);
     services.ClassProvidedPathRegistry.DeleteDeployment(deploymentId);
     services.EventTypeSerdeRepository.RemoveSerdes(deploymentId);
 }
Пример #10
0
        private void StartEngineMetrics(
            EPServicesContext services,
            EPEventService runtime)
        {
#if FALSE
            lock (this) {
                var filterName = MetricNameFactory.Name(services.RuntimeURI, "filter");
                CommonJMXUtil.RegisterMbean(services.FilterService, filterName);
                var scheduleName = MetricNameFactory.Name(services.RuntimeURI, "schedule");
                CommonJMXUtil.RegisterMbean(services.SchedulingService, scheduleName);
                var runtimeName = MetricNameFactory.Name(services.RuntimeURI, "runtime");
                CommonJMXUtil.RegisterMbean(runtime, runtimeName);
            }
#endif
        }
Пример #11
0
        private static void RolloutCleanPathAndTypes(
            DeployerRolloutInitResult[] inits,
            string[] deploymentIds,
            EPServicesContext services)
        {
            RolloutCleanClassloader(deploymentIds, services);

            for (var i = 0; i < inits.Length; i++)
            {
                Undeployer.DeleteFromPathRegistries(services, deploymentIds[i]);
                if (inits[i] != null)
                {
                    Undeployer.DeleteFromEventTypeBus(services, inits[i].ModulePaths.DeploymentTypes);
                }
            }
        }
Пример #12
0
        private static StatementAgentInstanceFactoryResult StartStatementNoContext(
            StatementLightweight lightweight,
            bool recovery,
            EPServicesContext services)
        {
            var statementContext     = lightweight.StatementContext;
            var agentInstanceContext = statementContext.MakeAgentInstanceContextUnpartitioned();

            // start
            var result =
                lightweight.StatementProvider.StatementAIFactoryProvider.Factory.NewContext(agentInstanceContext, recovery);

            // keep
            var holder = services.StatementResourceHolderBuilder.Build(agentInstanceContext, result);

            statementContext.StatementCPCacheService.StatementResourceService.Unpartitioned = holder;

            return(result);
        }
Пример #13
0
        /// <summary>
        ///     Loads and initializes adapter loaders.
        /// </summary>
        /// <param name="services">is the runtime instance services</param>
        private void LoadAdapters(EPServicesContext services)
        {
            var pluginLoaders = _configLastProvided.Runtime.PluginLoaders;
            if (pluginLoaders == null || pluginLoaders.Count == 0) {
                return;
            }

            foreach (var config in pluginLoaders) {
                var className = config.ClassName;
                Type pluginLoaderClass;
                try {
                    pluginLoaderClass = services.ClassForNameProvider.ClassForName(className);
                }
                catch (TypeLoadException ex) {
                    throw new ConfigurationException("Failed to load adapter loader class '" + className + "'", ex);
                }

                object pluginLoaderObj;
                try {
                    pluginLoaderObj = TypeHelper.Instantiate(pluginLoaderClass);
                }
                catch (Exception ex) {
                    throw new ConfigurationException("Failed to instantiate adapter loader class '" + className + "' via default constructor", ex);
                }

                if (!(pluginLoaderObj is PluginLoader)) {
                    throw new ConfigurationException("Failed to cast adapter loader class '" + className + "' to " + typeof(PluginLoader).Name);
                }

                var pluginLoader = (PluginLoader) pluginLoaderObj;
                var context = new PluginLoaderInitContext(config.LoaderName, config.ConfigProperties, config.ConfigurationXML, this);
                pluginLoader.Init(context);

                // register adapter loader in JNDI context tree
                try {
                    services.RuntimeEnvContext.Bind("plugin-loader/" + config.LoaderName, pluginLoader);
                }
                catch (Exception e) {
                    throw new EPException("Failed to use context to bind adapter loader", e);
                }
            }
        }
Пример #14
0
        public static ClassLoader GetClassLoader(
            int rolloutItemNumber,
            DeploymentClassLoaderOption deploymentClassLoaderOption,
            EPServicesContext servicesContext)
        {
            ClassLoader deploymentClassLoader = servicesContext.ClassLoaderParent;

            if (deploymentClassLoaderOption != null)
            {
                deploymentClassLoader = deploymentClassLoaderOption(
                    new DeploymentClassLoaderContext(
                        servicesContext.ClassLoaderParent,
                        servicesContext.ConfigSnapshot));
                if (deploymentClassLoader == null)
                {
                    throw new EPDeployException("Deployment classloader option returned a null value for the classloader", rolloutItemNumber);
                }
            }

            return(deploymentClassLoader);
        }
Пример #15
0
 public EPRuntimeEnv(
     EPServicesContext services,
     EPEventServiceSPI eventService,
     EPDeploymentServiceSPI deploymentService,
     EPEventTypeService eventTypeService,
     EPContextPartitionService contextPartitionService,
     EPVariableService variableService,
     EPMetricsService metricsService,
     EPFireAndForgetService fireAndForgetService,
     EPStageServiceSPI stageService)
 {
     Services = services;
     Runtime = eventService;
     DeploymentService = deploymentService;
     EventTypeService = eventTypeService;
     ContextPartitionService = contextPartitionService;
     VariableService = variableService;
     MetricsService = metricsService;
     FireAndForgetService = fireAndForgetService;
     StageService = stageService;
 }
Пример #16
0
        public static void ReverseDeployment(
            string deploymentId,
            IDictionary <long, EventType> deploymentTypes,
            IList <StatementLightweight> lightweights,
            EPStatement[] statements,
            ModuleProviderCLPair provider,
            EPServicesContext services)
        {
            var revert = new List <StatementContext>();

            foreach (var stmtToRemove in lightweights)
            {
                revert.Add(stmtToRemove.StatementContext);
            }

            revert.Reverse();
            var reverted = revert.ToArray();

            Undeployer.Disassociate(statements);
            Undeployer.Undeploy(deploymentId, deploymentTypes, reverted, provider.ModuleProvider, services);
        }
Пример #17
0
        private static DeployerRolloutInitResult ResolveDependenciesInitEPLObjects(
            int rolloutItemNumber,
            string deploymentId,
            ModuleProviderCLPair moduleProvider,
            EPServicesContext services,
            EPStageService stageService)
        {
            var moduleDependencies       = moduleProvider.ModuleProvider.ModuleDependencies;
            var deploymentIdDependencies = DeployerHelperResolver.ResolveDependencies(rolloutItemNumber, moduleDependencies, services);

            // initialize EPL objects defined by module
            var moduleEPLObjects = InitializeEPLObjects(moduleProvider, deploymentId, services);

            // determine staged EPL object overlap
            ValidateStagedEPLObjects(moduleEPLObjects, moduleProvider.ModuleProvider.ModuleName, rolloutItemNumber, stageService);

            // add EPL objects defined by module to path
            var moduleName  = moduleProvider.ModuleProvider.ModuleName;
            var modulePaths = UpdatePath(rolloutItemNumber, moduleEPLObjects, moduleName, deploymentId, services);

            return(new DeployerRolloutInitResult(deploymentIdDependencies, moduleEPLObjects, modulePaths, moduleName));
        }
Пример #18
0
 public EPMetricsServiceImpl(EPServicesContext services)
 {
     this.services = services;
 }
Пример #19
0
        public static void Undeploy(
            string deploymentId,
            IDictionary <long, EventType> deploymentTypes,
            StatementContext[] reverted,
            ModuleProvider moduleProvider,
            EPServicesContext services)
        {
            foreach (var statement in reverted)
            {
                // remove any match-recognize counts
                services.RowRecogStatePoolEngineSvc?.RemoveStatement(new DeploymentIdNamePair(statement.DeploymentId, statement.StatementName));

                var enumerator = statement.FinalizeCallbacks;
                while (enumerator.MoveNext())
                {
                    enumerator.Current.StatementDestroyed(statement);
                }

                try {
                    if (statement.DestroyCallback != null)
                    {
                        statement.DestroyCallback.Destroy(new StatementDestroyServices(services.FilterService), statement);
                    }
                    else
                    {
                        statement.StatementAIFactoryProvider.Factory.StatementDestroy(statement);
                    }
                }
                catch (Exception ex) {
                    Log.Error("Exception encountered during stop: " + ex.Message, ex);
                }

                if (statement.ContextRuntimeDescriptor != null)
                {
                    try {
                        services.ContextManagementService.StoppedStatement(
                            statement.ContextRuntimeDescriptor.ContextDeploymentId,
                            statement.ContextName,
                            statement.StatementId,
                            statement.StatementName,
                            statement.DeploymentId);
                    }
                    catch (Exception ex) {
                        Log.Error("Exception encountered during stop: " + ex.Message, ex);
                    }
                }

                services.EpServicesHA.ListenerRecoveryService.Remove(statement.StatementId);
                services.StatementLifecycleService.RemoveStatement(statement.StatementId);
                services.PatternSubexpressionPoolRuntimeSvc.RemoveStatement(statement.StatementId);
                services.FilterSharedBoolExprRepository.RemoveStatement(statement.StatementId);
                services.FilterSharedLookupableRepository.RemoveReferencesStatement(statement.StatementId);
            }

            var moduleDependencies = moduleProvider.ModuleDependencies;

            foreach (var namedWindow in moduleDependencies.PathNamedWindows)
            {
                services.NamedWindowPathRegistry.RemoveDependency(namedWindow.Name, namedWindow.ModuleName, deploymentId);
            }

            foreach (var table in moduleDependencies.PathTables)
            {
                services.TablePathRegistry.RemoveDependency(table.Name, table.ModuleName, deploymentId);
            }

            foreach (var variable in moduleDependencies.PathVariables)
            {
                services.VariablePathRegistry.RemoveDependency(variable.Name, variable.ModuleName, deploymentId);
            }

            foreach (var context in moduleDependencies.PathContexts)
            {
                services.ContextPathRegistry.RemoveDependency(context.Name, context.ModuleName, deploymentId);
            }

            foreach (var eventType in moduleDependencies.PathEventTypes)
            {
                services.EventTypePathRegistry.RemoveDependency(eventType.Name, eventType.ModuleName, deploymentId);
            }

            foreach (var exprDecl in moduleDependencies.PathExpressions)
            {
                services.ExprDeclaredPathRegistry.RemoveDependency(exprDecl.Name, exprDecl.ModuleName, deploymentId);
            }

            foreach (var script in moduleDependencies.PathScripts)
            {
                services.ScriptPathRegistry.RemoveDependency(new NameAndParamNum(script.Name, script.ParamNum), script.ModuleName, deploymentId);
            }

            foreach (var classDecl in moduleDependencies.PathClasses)
            {
                services.ClassProvidedPathRegistry.RemoveDependency(classDecl.Name, classDecl.ModuleName, deploymentId);
            }

            foreach (var index in moduleDependencies.PathIndexes)
            {
                EventTableIndexMetadata indexMetadata;
                if (index.IsNamedWindow)
                {
                    var namedWindowName = NameAndModule.FindName(index.InfraName, moduleDependencies.PathNamedWindows);
                    var namedWindow     = services.NamedWindowPathRegistry.GetWithModule(namedWindowName.Name, namedWindowName.ModuleName);
                    indexMetadata = namedWindow.IndexMetadata;
                }
                else
                {
                    var tableName = NameAndModule.FindName(index.InfraName, moduleDependencies.PathTables);
                    var table     = services.TablePathRegistry.GetWithModule(tableName.Name, tableName.ModuleName);
                    indexMetadata = table.IndexMetadata;
                }

                indexMetadata.RemoveIndexReference(index.IndexName, deploymentId);
            }

            DeleteFromEventTypeBus(services, deploymentTypes);
            DeleteFromPathRegistries(services, deploymentId);

            services.ClassLoaderParent.Remove(deploymentId);

            if (InstrumentationHelper.ENABLED)
            {
                var instrumentation = InstrumentationHelper.Get();
                foreach (var ctx in reverted)
                {
                    instrumentation.QaEngineManagementStmtStop(
                        services.RuntimeURI,
                        deploymentId,
                        ctx.StatementId,
                        ctx.StatementName,
                        (string)ctx.StatementInformationals.Properties.Get(StatementProperty.EPL),
                        services.SchedulingService.Time);
                }
            }
        }
Пример #20
0
        public static ISet <string> ResolveDependencies(
            int rolloutItemNumber,
            ModuleDependenciesRuntime moduleDependencies,
            EPServicesContext services)
        {
            ISet <string> dependencies = new HashSet <string>();

            foreach (var publicEventType in moduleDependencies.PublicEventTypes)
            {
                if (services.EventTypeRepositoryBus.GetTypeByName(publicEventType) == null)
                {
                    throw MakePreconditionExceptionPreconfigured(rolloutItemNumber, PathRegistryObjectType.EVENTTYPE, publicEventType);
                }
            }

            foreach (var publicVariable in moduleDependencies.PublicVariables)
            {
                if (services.ConfigSnapshot.Common.Variables.Get(publicVariable) == null)
                {
                    throw MakePreconditionExceptionPreconfigured(rolloutItemNumber, PathRegistryObjectType.VARIABLE, publicVariable);
                }
            }

            foreach (var pathNamedWindow in moduleDependencies.PathNamedWindows)
            {
                var depIdNamedWindow = services.NamedWindowPathRegistry.GetDeploymentId(pathNamedWindow.Name, pathNamedWindow.ModuleName);
                if (depIdNamedWindow == null)
                {
                    throw MakePreconditionExceptionPath(rolloutItemNumber, PathRegistryObjectType.NAMEDWINDOW, pathNamedWindow);
                }

                dependencies.Add(depIdNamedWindow);
            }

            foreach (var pathTable in moduleDependencies.PathTables)
            {
                var depIdTable = services.TablePathRegistry.GetDeploymentId(pathTable.Name, pathTable.ModuleName);
                if (depIdTable == null)
                {
                    throw MakePreconditionExceptionPath(rolloutItemNumber, PathRegistryObjectType.TABLE, pathTable);
                }

                dependencies.Add(depIdTable);
            }

            foreach (var pathEventType in moduleDependencies.PathEventTypes)
            {
                var depIdEventType = services.EventTypePathRegistry.GetDeploymentId(pathEventType.Name, pathEventType.ModuleName);
                if (depIdEventType == null)
                {
                    throw MakePreconditionExceptionPath(rolloutItemNumber, PathRegistryObjectType.EVENTTYPE, pathEventType);
                }

                dependencies.Add(depIdEventType);
            }

            foreach (var pathVariable in moduleDependencies.PathVariables)
            {
                var depIdVariable = services.VariablePathRegistry.GetDeploymentId(pathVariable.Name, pathVariable.ModuleName);
                if (depIdVariable == null)
                {
                    throw MakePreconditionExceptionPath(rolloutItemNumber, PathRegistryObjectType.VARIABLE, pathVariable);
                }

                dependencies.Add(depIdVariable);
            }

            foreach (var pathContext in moduleDependencies.PathContexts)
            {
                var depIdContext = services.ContextPathRegistry.GetDeploymentId(pathContext.Name, pathContext.ModuleName);
                if (depIdContext == null)
                {
                    throw MakePreconditionExceptionPath(rolloutItemNumber, PathRegistryObjectType.CONTEXT, pathContext);
                }

                dependencies.Add(depIdContext);
            }

            foreach (var pathExpression in moduleDependencies.PathExpressions)
            {
                var depIdExpression = services.ExprDeclaredPathRegistry.GetDeploymentId(pathExpression.Name, pathExpression.ModuleName);
                if (depIdExpression == null)
                {
                    throw MakePreconditionExceptionPath(rolloutItemNumber, PathRegistryObjectType.EXPRDECL, pathExpression);
                }

                dependencies.Add(depIdExpression);
            }

            foreach (var pathScript in moduleDependencies.PathScripts)
            {
                var depIdExpression = services.ScriptPathRegistry.GetDeploymentId(
                    new NameAndParamNum(pathScript.Name, pathScript.ParamNum),
                    pathScript.ModuleName);
                if (depIdExpression == null)
                {
                    throw MakePreconditionExceptionPath(
                              rolloutItemNumber,
                              PathRegistryObjectType.SCRIPT,
                              new NameAndModule(pathScript.Name, pathScript.ModuleName));
                }

                dependencies.Add(depIdExpression);
            }

            foreach (var index in moduleDependencies.PathIndexes)
            {
                string depIdIndex;
                if (index.IsNamedWindow)
                {
                    var namedWindowName = NameAndModule.FindName(index.InfraName, moduleDependencies.PathNamedWindows);
                    var namedWindow     = services.NamedWindowPathRegistry.GetWithModule(namedWindowName.Name, namedWindowName.ModuleName);
                    depIdIndex = namedWindow.IndexMetadata.GetIndexDeploymentId(index.IndexName);
                }
                else
                {
                    var tableName = NameAndModule.FindName(index.InfraName, moduleDependencies.PathTables);
                    var table     = services.TablePathRegistry.GetWithModule(tableName.Name, tableName.ModuleName);
                    depIdIndex = table.IndexMetadata.GetIndexDeploymentId(index.IndexName);
                }

                if (depIdIndex == null)
                {
                    throw MakePreconditionExceptionPath(
                              rolloutItemNumber,
                              PathRegistryObjectType.INDEX,
                              new NameAndModule(index.IndexName, index.IndexModuleName));
                }

                dependencies.Add(depIdIndex);
            }

            foreach (var pathClass in moduleDependencies.PathClasses)
            {
                var depIdClass = services.ClassProvidedPathRegistry.GetDeploymentId(pathClass.Name, pathClass.ModuleName);
                if (depIdClass == null)
                {
                    throw MakePreconditionExceptionPath(rolloutItemNumber, PathRegistryObjectType.CLASSPROVIDED, pathClass);
                }

                dependencies.Add(depIdClass);
            }

            return(dependencies);
        }
Пример #21
0
        public static DeployerModuleEPLObjects InitializeEPLObjects(
            ModuleProviderCLPair provider,
            string deploymentId,
            EPServicesContext services)
        {
            // keep protected types
            var beanEventTypeFactory = new BeanEventTypeFactoryPrivate(
                new EventBeanTypedEventFactoryRuntime(services.EventTypeAvroHandler),
                services.EventTypeFactory,
                services.BeanEventTypeStemService);

            // initialize module event types
            IDictionary <string, EventType> moduleEventTypes = new LinkedHashMap <string, EventType>();
            var eventTypeResolver = new EventTypeResolverImpl(
                moduleEventTypes,
                services.EventTypePathRegistry,
                services.EventTypeRepositoryBus,
                services.BeanEventTypeFactoryPrivate,
                services.EventSerdeFactory);
            var eventTypeCollector = new EventTypeCollectorImpl(
                services.Container,
                moduleEventTypes,
                beanEventTypeFactory,
                provider.ClassLoader,
                services.EventTypeFactory,
                services.BeanEventTypeStemService,
                eventTypeResolver,
                services.XmlFragmentEventTypeFactory,
                services.EventTypeAvroHandler,
                services.EventBeanTypedEventFactory,
                services.ImportServiceRuntime);

            try {
                provider.ModuleProvider.InitializeEventTypes(new EPModuleEventTypeInitServicesImpl(eventTypeCollector, eventTypeResolver));
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            JsonEventTypeUtility.AddJsonUnderlyingClass(moduleEventTypes, services.ClassLoaderParent, deploymentId);

            // initialize module named windows
            IDictionary <string, NamedWindowMetaData> moduleNamedWindows = new Dictionary <string, NamedWindowMetaData>();
            NamedWindowCollector namedWindowCollector = new NamedWindowCollectorImpl(moduleNamedWindows);

            try {
                provider.ModuleProvider.InitializeNamedWindows(new EPModuleNamedWindowInitServicesImpl(namedWindowCollector, eventTypeResolver));
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            // initialize module tables
            IDictionary <string, TableMetaData> moduleTables = new Dictionary <string, TableMetaData>();
            var tableCollector = new TableCollectorImpl(moduleTables);

            try {
                provider.ModuleProvider.InitializeTables(new EPModuleTableInitServicesImpl(tableCollector, eventTypeResolver));
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            // initialize create-index indexes
            ISet <ModuleIndexMeta> moduleIndexes = new HashSet <ModuleIndexMeta>();
            var indexCollector = new IndexCollectorRuntime(moduleIndexes);

            try {
                provider.ModuleProvider.InitializeIndexes(new EPModuleIndexInitServicesImpl(indexCollector));
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            // initialize module contexts
            IDictionary <string, ContextMetaData> moduleContexts = new Dictionary <string, ContextMetaData>();
            ContextCollector contextCollector = new ContextCollectorImpl(moduleContexts);

            try {
                provider.ModuleProvider.InitializeContexts(new EPModuleContextInitServicesImpl(contextCollector, eventTypeResolver));
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            // initialize module variables
            IDictionary <string, VariableMetaData> moduleVariables = new Dictionary <string, VariableMetaData>();
            VariableCollector variableCollector = new VariableCollectorImpl(moduleVariables);

            try {
                provider.ModuleProvider.InitializeVariables(new EPModuleVariableInitServicesImpl(variableCollector, eventTypeResolver));
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            // initialize module expressions
            IDictionary <string, ExpressionDeclItem> moduleExpressions = new Dictionary <string, ExpressionDeclItem>();
            var exprDeclaredCollector = new ExprDeclaredCollectorRuntime(moduleExpressions);

            try {
                provider.ModuleProvider.InitializeExprDeclareds(new EPModuleExprDeclaredInitServicesImpl(exprDeclaredCollector));
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            // initialize module scripts
            IDictionary <NameAndParamNum, ExpressionScriptProvided> moduleScripts = new Dictionary <NameAndParamNum, ExpressionScriptProvided>();
            var scriptCollectorRuntime = new ScriptCollectorRuntime(moduleScripts);

            try {
                provider.ModuleProvider.InitializeScripts(new EPModuleScriptInitServicesImpl(scriptCollectorRuntime));
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            // initialize module class-provided create-class
            IDictionary <string, ClassProvided> moduleClasses = new Dictionary <string, ClassProvided>();
            var classProvidedCollectorRuntime = new ClassProvidedCollectorRuntime(moduleClasses);

            try {
                provider.ModuleProvider.InitializeClassProvided(new EPModuleClassProvidedInitServicesImpl(classProvidedCollectorRuntime));
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            foreach (var moduleClass in moduleClasses)
            {
                moduleClass.Value.LoadClasses(provider.ClassLoader);
            }

            return(new DeployerModuleEPLObjects(
                       beanEventTypeFactory,
                       moduleEventTypes,
                       moduleNamedWindows,
                       moduleTables,
                       moduleIndexes,
                       moduleContexts,
                       moduleVariables,
                       moduleExpressions,
                       moduleScripts,
                       moduleClasses,
                       eventTypeCollector.Serdes,
                       eventTypeResolver));
        }
Пример #22
0
 public EPEventTypeServiceImpl(EPServicesContext services)
 {
     this.services = services;
 }
Пример #23
0
 public abstract EPEventServiceImpl CreateEPRuntime(
     EPServicesContext services,
     AtomicBoolean serviceStatusProvider);
Пример #24
0
        public static DeployerModulePaths UpdatePath(
            int rolloutItemNumber,
            DeployerModuleEPLObjects eplObjects,
            string moduleName,
            string deploymentId,
            EPServicesContext services)
        {
            // save path-visibility event types and named windows to the path
            var deploymentIdCrc32 = CRC32Util.ComputeCRC32(deploymentId);
            IDictionary <long, EventType> deploymentTypes = EmptyDictionary <long, EventType> .Instance;
            IList <string>          pathEventTypes        = new List <string>(eplObjects.ModuleEventTypes.Count);
            IList <string>          pathNamedWindows      = new List <string>(eplObjects.ModuleNamedWindows.Count);
            IList <string>          pathTables            = new List <string>(eplObjects.ModuleTables.Count);
            IList <string>          pathContexts          = new List <string>(eplObjects.ModuleContexts.Count);
            IList <string>          pathVariables         = new List <string>(eplObjects.ModuleVariables.Count);
            IList <string>          pathExprDecl          = new List <string>(eplObjects.ModuleExpressions.Count);
            IList <NameAndParamNum> pathScripts           = new List <NameAndParamNum>(eplObjects.ModuleScripts.Count);
            IList <string>          pathClasses           = new List <string>(eplObjects.ModuleClasses.Count);

            try {
                foreach (var entry in eplObjects.ModuleNamedWindows)
                {
                    if (entry.Value.EventType.Metadata.AccessModifier.IsNonPrivateNonTransient())
                    {
                        try {
                            services.NamedWindowPathRegistry.Add(entry.Key, moduleName, entry.Value, deploymentId);
                        }
                        catch (PathExceptionAlreadyRegistered ex) {
                            throw new EPDeployPreconditionException(ex.Message, ex, rolloutItemNumber);
                        }

                        pathNamedWindows.Add(entry.Key);
                    }
                }

                foreach (var entry in eplObjects.ModuleTables)
                {
                    if (entry.Value.TableVisibility.IsNonPrivateNonTransient())
                    {
                        try {
                            services.TablePathRegistry.Add(entry.Key, moduleName, entry.Value, deploymentId);
                        }
                        catch (PathExceptionAlreadyRegistered ex) {
                            throw new EPDeployPreconditionException(ex.Message, ex, rolloutItemNumber);
                        }

                        pathTables.Add(entry.Key);
                    }
                }

                foreach (var entry in eplObjects.ModuleEventTypes)
                {
                    var eventTypeSPI      = (EventTypeSPI)entry.Value;
                    var nameTypeId        = CRC32Util.ComputeCRC32(eventTypeSPI.Name);
                    var eventTypeMetadata = entry.Value.Metadata;
                    if (eventTypeMetadata.AccessModifier == NameAccessModifier.PRECONFIGURED)
                    {
                        // For XML all fragment event types are public
                        if (eventTypeMetadata.ApplicationType != EventTypeApplicationType.XML)
                        {
                            throw new IllegalStateException("Unrecognized public visibility type in deployment");
                        }
                    }
                    else if (eventTypeMetadata.AccessModifier.IsNonPrivateNonTransient())
                    {
                        if (eventTypeMetadata.BusModifier == EventTypeBusModifier.BUS)
                        {
                            eventTypeSPI.SetMetadataId(nameTypeId, -1);
                            services.EventTypeRepositoryBus.AddType(eventTypeSPI);
                        }
                        else
                        {
                            eventTypeSPI.SetMetadataId(deploymentIdCrc32, nameTypeId);
                        }

                        try {
                            services.EventTypePathRegistry.Add(entry.Key, moduleName, entry.Value, deploymentId);
                        }
                        catch (PathExceptionAlreadyRegistered ex) {
                            throw new EPDeployPreconditionException(ex.Message, ex, rolloutItemNumber);
                        }
                    }
                    else
                    {
                        eventTypeSPI.SetMetadataId(deploymentIdCrc32, nameTypeId);
                    }

                    if (eventTypeMetadata.AccessModifier.IsNonPrivateNonTransient())
                    {
                        pathEventTypes.Add(entry.Key);
                    }

                    // we retain all types to enable variant-streams
                    if (deploymentTypes.IsEmpty())
                    {
                        deploymentTypes = new Dictionary <long, EventType>();
                    }

                    deploymentTypes.Put(nameTypeId, eventTypeSPI);
                }

                // add serde information to event types
                services.EventTypeSerdeRepository.AddSerdes(
                    deploymentId,
                    eplObjects.EventTypeSerdes,
                    eplObjects.ModuleEventTypes,
                    eplObjects.BeanEventTypeFactory);

                foreach (var entry in eplObjects.ModuleContexts)
                {
                    if (entry.Value.ContextVisibility.IsNonPrivateNonTransient())
                    {
                        try {
                            services.ContextPathRegistry.Add(entry.Key, moduleName, entry.Value, deploymentId);
                        }
                        catch (PathExceptionAlreadyRegistered ex) {
                            throw new EPDeployPreconditionException(ex.Message, ex, rolloutItemNumber);
                        }

                        pathContexts.Add(entry.Key);
                    }
                }

                foreach (var entry in eplObjects.ModuleVariables)
                {
                    if (entry.Value.VariableVisibility.IsNonPrivateNonTransient())
                    {
                        try {
                            services.VariablePathRegistry.Add(entry.Key, moduleName, entry.Value, deploymentId);
                        }
                        catch (PathExceptionAlreadyRegistered ex) {
                            throw new EPDeployPreconditionException(ex.Message, ex, rolloutItemNumber);
                        }

                        pathVariables.Add(entry.Key);
                    }
                }

                foreach (var entry in eplObjects.ModuleExpressions)
                {
                    if (entry.Value.Visibility.IsNonPrivateNonTransient())
                    {
                        try {
                            services.ExprDeclaredPathRegistry.Add(entry.Key, moduleName, entry.Value, deploymentId);
                        }
                        catch (PathExceptionAlreadyRegistered ex) {
                            throw new EPDeployPreconditionException(ex.Message, ex, rolloutItemNumber);
                        }

                        pathExprDecl.Add(entry.Key);
                    }
                }

                foreach (var entry in eplObjects.ModuleScripts)
                {
                    if (entry.Value.Visibility.IsNonPrivateNonTransient())
                    {
                        try {
                            services.ScriptPathRegistry.Add(entry.Key, moduleName, entry.Value, deploymentId);
                        }
                        catch (PathExceptionAlreadyRegistered ex) {
                            throw new EPDeployPreconditionException(ex.Message, ex, rolloutItemNumber);
                        }

                        pathScripts.Add(entry.Key);
                    }
                }

                foreach (var index in eplObjects.ModuleIndexes)
                {
                    if (index.IsNamedWindow)
                    {
                        var namedWindow = services.NamedWindowPathRegistry.GetWithModule(index.InfraName, index.InfraModuleName);
                        if (namedWindow == null)
                        {
                            throw new IllegalStateException("Failed to find named window '" + index.InfraName + "'");
                        }

                        ValidateIndexPrecondition(rolloutItemNumber, namedWindow.IndexMetadata, index);
                    }
                    else
                    {
                        var table = services.TablePathRegistry.GetWithModule(index.InfraName, index.InfraModuleName);
                        if (table == null)
                        {
                            throw new IllegalStateException("Failed to find table '" + index.InfraName + "'");
                        }

                        ValidateIndexPrecondition(rolloutItemNumber, table.IndexMetadata, index);
                    }
                }

                foreach (var entry in eplObjects.ModuleClasses)
                {
                    if (entry.Value.Visibility.IsNonPrivateNonTransient())
                    {
                        try {
                            services.ClassProvidedPathRegistry.Add(entry.Key, moduleName, entry.Value, deploymentId);
                        }
                        catch (PathExceptionAlreadyRegistered ex) {
                            throw new EPDeployPreconditionException(ex.Message, ex, rolloutItemNumber);
                        }

                        pathClasses.Add(entry.Key);
                    }
                }
            }
            catch (Exception) {
                Undeployer.DeleteFromEventTypeBus(services, deploymentTypes);
                Undeployer.DeleteFromPathRegistries(services, deploymentId);
                throw;
            }

            return(new DeployerModulePaths(
                       deploymentTypes,
                       pathEventTypes,
                       pathNamedWindows,
                       pathTables,
                       pathContexts,
                       pathVariables,
                       pathExprDecl,
                       pathScripts,
                       pathClasses));
        }
Пример #25
0
        private static StatementLightweight InitStatement(
            bool recovery,
            string moduleName,
            StatementProvider statementProvider,
            string deploymentId,
            int statementId,
            EventTypeResolver eventTypeResolver,
            ModuleIncidentals moduleIncidentals,
            StatementNameRuntimeOption statementNameResolverRuntime,
            StatementUserObjectRuntimeOption userObjectResolverRuntime,
            ClassLoader moduleClassLoader,
            EPServicesContext services)
        {
            var informationals = statementProvider.Informationals;

            // set instrumentation unless already provided
            if (informationals.InstrumentationProvider == null)
            {
                informationals.InstrumentationProvider = InstrumentationDefault.INSTANCE;
            }

            var statementResultService = new StatementResultServiceImpl(informationals, services);
            FilterSharedLookupableRegistery filterSharedLookupableRegistery = new ProxyFilterSharedLookupableRegistery()
            {
                ProcRegisterLookupable = (
                    eventTypeX,
                    lookupable) => {
                    services.FilterSharedLookupableRepository.RegisterLookupable(statementId, eventTypeX, lookupable);
                },
            };

            FilterSharedBoolExprRegistery filterSharedBoolExprRegistery = new ProxyFilterSharedBoolExprRegistery()
            {
                ProcRegisterBoolExpr = (node) => { services.FilterSharedBoolExprRepository.RegisterBoolExpr(statementId, node); },
            };

            IDictionary <int, FilterSpecActivatable> filterSpecActivatables        = new Dictionary <int, FilterSpecActivatable>();
            FilterSpecActivatableRegistry            filterSpecActivatableRegistry = new ProxyFilterSpecActivatableRegistry()
            {
                ProcRegister = (filterSpecActivatable) => { filterSpecActivatables.Put(filterSpecActivatable.FilterCallbackId, filterSpecActivatable); },
            };

            var contextPartitioned       = informationals.OptionalContextName != null;
            var statementResourceService = new StatementResourceService(contextPartitioned);

            // determine statement name
            var statementName = informationals.StatementNameCompileTime;

            if (statementNameResolverRuntime != null)
            {
                string statementNameAssigned = statementNameResolverRuntime.Invoke(
                    new StatementNameRuntimeContext(
                        deploymentId,
                        statementName,
                        statementId,
                        (string)informationals.Properties.Get(StatementProperty.EPL),
                        informationals.Annotations));
                if (statementNameAssigned != null)
                {
                    statementName = statementNameAssigned;
                }
            }

            statementName = statementName.Trim();

            var epInitServices = new EPStatementInitServicesImpl(
                statementName,
                informationals.Properties,
                informationals.Annotations,
                deploymentId,
                eventTypeResolver,
                filterSpecActivatableRegistry,
                filterSharedBoolExprRegistery,
                filterSharedLookupableRegistery,
                moduleIncidentals,
                recovery,
                statementResourceService,
                statementResultService,
                services);

            if (!services.EpServicesHA.RuntimeExtensionServices.IsHAEnabled)
            {
                statementProvider.Initialize(epInitServices);
            }
            else
            {
                // for HA we set the context classloader as state may be loaded considering the module provider's classloader
                // - NEsper doesn't support HA like this, and we wouldn't want to deliver this information in
                // - this manner.  An alternative delivery mechanism must be established to carry the information
                // - without relying on the "current" thread to carry that detail.

                // ClassLoader originalClassLoader = Thread.CurrentThread().ContextClassLoader;
                // try {
                //  Thread.CurrentThread().ContextClassLoader = moduleClassLoader;
                //  statementProvider.Initialize(epInitServices);
                // }
                // finally {
                //  Thread.CurrentThread().ContextClassLoader = originalClassLoader;
                // }
            }

            var multiMatchHandler = services.MultiMatchHandlerFactory.Make(informationals.HasSubquery, informationals.IsNeedDedup);

            var stmtMetric = services.MetricReportingService.GetStatementHandle(statementId, deploymentId, statementName);

            var optionalEPL = (string)informationals.Properties.Get(StatementProperty.EPL);
            InsertIntoLatchFactory insertIntoFrontLatchFactory = null;
            InsertIntoLatchFactory insertIntoBackLatchFactory  = null;

            if (informationals.InsertIntoLatchName != null)
            {
                var latchFactoryNameBack  = "insert_stream_B_" + informationals.InsertIntoLatchName + "_" + statementName;
                var latchFactoryNameFront = "insert_stream_F_" + informationals.InsertIntoLatchName + "_" + statementName;
                var msecTimeout           = services.RuntimeSettingsService.ConfigurationRuntime.Threading.InsertIntoDispatchTimeout;
                var locking           = services.RuntimeSettingsService.ConfigurationRuntime.Threading.InsertIntoDispatchLocking;
                var latchFactoryFront = new InsertIntoLatchFactory(
                    latchFactoryNameFront,
                    informationals.IsStateless,
                    msecTimeout,
                    locking,
                    services.TimeSourceService);
                var latchFactoryBack = new InsertIntoLatchFactory(
                    latchFactoryNameBack,
                    informationals.IsStateless,
                    msecTimeout,
                    locking,
                    services.TimeSourceService);
                insertIntoFrontLatchFactory = latchFactoryFront;
                insertIntoBackLatchFactory  = latchFactoryBack;
            }

            var statementHandle = new EPStatementHandle(
                statementName,
                deploymentId,
                statementId,
                optionalEPL,
                informationals.Priority,
                informationals.IsPreemptive,
                informationals.IsCanSelfJoin,
                multiMatchHandler,
                informationals.HasVariables,
                informationals.HasTableAccess,
                stmtMetric,
                insertIntoFrontLatchFactory,
                insertIntoBackLatchFactory);

            // determine context
            StatementAIResourceRegistry statementAgentInstanceRegistry = null;
            ContextRuntimeDescriptor    contextRuntimeDescriptor       = null;
            var optionalContextName = informationals.OptionalContextName;

            if (optionalContextName != null)
            {
                var contextDeploymentId = ContextDeployTimeResolver.ResolveContextDeploymentId(
                    informationals.OptionalContextModuleName,
                    informationals.OptionalContextVisibility,
                    optionalContextName,
                    deploymentId,
                    services.ContextPathRegistry);
                var contextManager = services.ContextManagementService.GetContextManager(contextDeploymentId, optionalContextName);
                contextRuntimeDescriptor = contextManager.ContextRuntimeDescriptor;
                var registryRequirements = statementProvider.StatementAIFactoryProvider.Factory.RegistryRequirements;
                statementAgentInstanceRegistry = contextManager.AllocateAgentInstanceResourceRegistry(registryRequirements);
            }

            var statementCPCacheService = new StatementCPCacheService(
                contextPartitioned,
                statementResourceService,
                statementAgentInstanceRegistry);

            var eventType = statementProvider.StatementAIFactoryProvider.Factory.StatementEventType;

            var configurationThreading = services.RuntimeSettingsService.ConfigurationRuntime.Threading;
            var preserveDispatchOrder  = configurationThreading.IsListenerDispatchPreserveOrder && !informationals.IsStateless;
            var isSpinLocks            = configurationThreading.ListenerDispatchLocking == Locking.SPIN;
            var msecBlockingTimeout    = configurationThreading.ListenerDispatchTimeout;
            UpdateDispatchViewBase dispatchChildView;

            if (preserveDispatchOrder)
            {
                if (isSpinLocks)
                {
                    dispatchChildView = new UpdateDispatchViewBlockingSpin(
                        eventType,
                        statementResultService,
                        services.DispatchService,
                        msecBlockingTimeout,
                        services.TimeSourceService);
                }
                else
                {
                    dispatchChildView = new UpdateDispatchViewBlockingWait(eventType, statementResultService, services.DispatchService, msecBlockingTimeout);
                }
            }
            else
            {
                dispatchChildView = new UpdateDispatchViewNonBlocking(eventType, statementResultService, services.DispatchService);
            }

            var countSubexpressions = services.ConfigSnapshot.Runtime.Patterns.MaxSubexpressions != null;
            PatternSubexpressionPoolStmtSvc patternSubexpressionPoolStmtSvc = null;

            if (countSubexpressions)
            {
                var stmtCounter = new PatternSubexpressionPoolStmtHandler();
                patternSubexpressionPoolStmtSvc = new PatternSubexpressionPoolStmtSvc(services.PatternSubexpressionPoolRuntimeSvc, stmtCounter);
                services.PatternSubexpressionPoolRuntimeSvc.AddPatternContext(statementId, statementName, stmtCounter);
            }

            var countMatchRecogStates = services.ConfigSnapshot.Runtime.MatchRecognize.MaxStates != null;
            RowRecogStatePoolStmtSvc rowRecogStatePoolStmtSvc = null;

            if (countMatchRecogStates && informationals.HasMatchRecognize)
            {
                var stmtCounter = new RowRecogStatePoolStmtHandler();
                rowRecogStatePoolStmtSvc = new RowRecogStatePoolStmtSvc(services.RowRecogStatePoolEngineSvc, stmtCounter);
                services.RowRecogStatePoolEngineSvc.AddPatternContext(new DeploymentIdNamePair(deploymentId, statementName), stmtCounter);
            }

            // get user object for runtime
            object userObjectRuntime = null;

            if (userObjectResolverRuntime != null)
            {
                userObjectRuntime = userObjectResolverRuntime.GetUserObject(
                    new StatementUserObjectRuntimeContext(
                        deploymentId,
                        statementName,
                        statementId,
                        (string)informationals.Properties.Get(StatementProperty.EPL),
                        informationals.Annotations));
            }

            var statementContext = new StatementContext(
                services.Container,
                contextRuntimeDescriptor,
                deploymentId,
                statementId,
                statementName,
                moduleName,
                informationals,
                userObjectRuntime,
                services.StatementContextRuntimeServices,
                statementHandle,
                filterSpecActivatables,
                patternSubexpressionPoolStmtSvc,
                rowRecogStatePoolStmtSvc,
                new ScheduleBucket(statementId),
                statementAgentInstanceRegistry,
                statementCPCacheService,
                statementProvider.StatementAIFactoryProvider,
                statementResultService,
                dispatchChildView,
                services.FilterService,
                services.SchedulingService,
                services.InternalEventRouteDest
                );

            foreach (var readyCallback in epInitServices.ReadyCallbacks)
            {
                readyCallback.Ready(statementContext, moduleIncidentals, recovery);
            }

            return(new StatementLightweight(statementProvider, informationals, statementResultService, statementContext));
        }
Пример #26
0
        public static DeployerModuleStatementLightweights InitializeStatements(
            int rolloutItemNumber,
            bool recovery,
            DeployerModuleEPLObjects moduleEPLObjects,
            DeployerModulePaths modulePaths,
            string moduleName,
            ModuleProviderCLPair moduleProvider,
            string deploymentId,
            int statementIdFirstStatement,
            StatementUserObjectRuntimeOption userObjectResolverRuntime,
            StatementNameRuntimeOption statementNameResolverRuntime,
            StatementSubstitutionParameterOption substitutionParameterResolver,
            EPServicesContext services)
        {
            // get module statements
            IList <StatementProvider> statementResources;

            try {
                statementResources = moduleProvider.ModuleProvider.Statements;
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            // initialize all statements
            IList <StatementLightweight> lightweights = new List <StatementLightweight>();
            IDictionary <int, IDictionary <int, object> > substitutionParameters;
            ISet <string> statementNames    = new HashSet <string>();
            var           moduleIncidentals = moduleEPLObjects.Incidentals;

            try {
                var statementId = statementIdFirstStatement;
                foreach (var statement in statementResources)
                {
                    var lightweight = InitStatement(
                        recovery,
                        moduleName,
                        statement,
                        deploymentId,
                        statementId,
                        moduleEPLObjects.EventTypeResolver,
                        moduleIncidentals,
                        statementNameResolverRuntime,
                        userObjectResolverRuntime,
                        moduleProvider.ClassLoader,
                        services);
                    lightweights.Add(lightweight);
                    statementId++;

                    var statementName = lightweight.StatementContext.StatementName;
                    if (statementNames.Contains(statementName))
                    {
                        throw new EPDeployException(
                                  "Duplicate statement name provide by statement name resolver for statement name '" + statementName + "'",
                                  rolloutItemNumber);
                    }

                    statementNames.Add(statementName);
                }

                // set parameters
                substitutionParameters = SetSubstitutionParameterValues(rolloutItemNumber, deploymentId, lightweights, substitutionParameterResolver);
            }
            catch (Exception) {
                DeployerHelperResolver.ReverseDeployment(deploymentId, modulePaths.DeploymentTypes, lightweights, new EPStatement[0], moduleProvider, services);
                throw;
            }

            return(new DeployerModuleStatementLightweights(statementIdFirstStatement, lightweights, substitutionParameters));
        }
Пример #27
0
        public static void AddPathDependencies(
            string deploymentId,
            ModuleDependenciesRuntime moduleDependencies,
            EPServicesContext services)
        {
            foreach (var eventType in moduleDependencies.PathEventTypes)
            {
                services.EventTypePathRegistry.AddDependency(eventType.Name, eventType.ModuleName, deploymentId);
            }

            foreach (var namedWindow in moduleDependencies.PathNamedWindows)
            {
                services.NamedWindowPathRegistry.AddDependency(namedWindow.Name, namedWindow.ModuleName, deploymentId);
            }

            foreach (var table in moduleDependencies.PathTables)
            {
                services.TablePathRegistry.AddDependency(table.Name, table.ModuleName, deploymentId);
            }

            foreach (var variable in moduleDependencies.PathVariables)
            {
                services.VariablePathRegistry.AddDependency(variable.Name, variable.ModuleName, deploymentId);
            }

            foreach (var context in moduleDependencies.PathContexts)
            {
                services.ContextPathRegistry.AddDependency(context.Name, context.ModuleName, deploymentId);
            }

            foreach (var exprDecl in moduleDependencies.PathExpressions)
            {
                services.ExprDeclaredPathRegistry.AddDependency(exprDecl.Name, exprDecl.ModuleName, deploymentId);
            }

            foreach (var script in moduleDependencies.PathScripts)
            {
                services.ScriptPathRegistry.AddDependency(new NameAndParamNum(script.Name, script.ParamNum), script.ModuleName, deploymentId);
            }

            foreach (var classProvided in moduleDependencies.PathClasses)
            {
                services.ClassProvidedPathRegistry.AddDependency(classProvided.Name, classProvided.ModuleName, deploymentId);
            }

            foreach (var index in moduleDependencies.PathIndexes)
            {
                EventTableIndexMetadata indexMetadata;
                if (index.IsNamedWindow)
                {
                    var namedWindowName = NameAndModule.FindName(index.InfraName, moduleDependencies.PathNamedWindows);
                    var namedWindow     = services.NamedWindowPathRegistry.GetWithModule(namedWindowName.Name, namedWindowName.ModuleName);
                    indexMetadata = namedWindow.IndexMetadata;
                }
                else
                {
                    var tableName = NameAndModule.FindName(index.InfraName, moduleDependencies.PathTables);
                    var table     = services.TablePathRegistry.GetWithModule(tableName.Name, tableName.ModuleName);
                    indexMetadata = table.IndexMetadata;
                }

                indexMetadata.AddIndexReference(index.IndexName, deploymentId);
            }
        }
Пример #28
0
 public EPContextPartitionServiceImpl(EPServicesContext services)
 {
     this.services = services;
 }
Пример #29
0
 public EPVariableServiceImpl(EPServicesContext services)
 {
     this.services = services;
 }
Пример #30
0
 public override EPEventServiceImpl CreateEPRuntime(
     EPServicesContext services,
     AtomicBoolean serviceStatusProvider)
 {
     return new EPEventServiceImpl(services);
 }