public static void ValidateDependencyPreconditions( ISet <string> deploymentSet, EPServicesPath paths, DeploymentLifecycleService deploymentLifecycleService) { foreach (var deploymentId in deploymentSet) { var consumed = GetDependenciesConsumed(deploymentId, paths, deploymentLifecycleService); if (consumed == null) { throw new EPStageException("Deployment '" + deploymentId + "' was not found"); } foreach (var item in consumed.Dependencies) { if (!deploymentSet.Contains(item.DeploymentId)) { var message = "Failed to stage deployment '" + deploymentId + "': Deployment consumes " + item.ObjectType.GetPrettyName() + " '" + item.ObjectName + "'" + " from deployment '" + item.DeploymentId + "' and must therefore also be staged"; throw new EPStagePreconditionException(message); } } var provided = GetDependenciesProvided(deploymentId, paths, deploymentLifecycleService); foreach (var item in provided.Dependencies) { foreach (var other in item.DeploymentIds) { if (!deploymentSet.Contains(other)) { var message = "Failed to stage deployment '" + deploymentId + "': Deployment provides " + item.ObjectType.GetPrettyName() + " '" + item.ObjectName + "'" + " to deployment '" + other + "' and must therefore also be staged"; throw new EPStagePreconditionException(message); } } } } }
// what are the dependencies that the given deployment provides to other modules? public static EPDeploymentDependencyProvided GetDependenciesProvided( string selfDeploymentId, EPServicesPath paths, DeploymentLifecycleService deploymentLifecycleService) { DeploymentInternal selfDeployment = deploymentLifecycleService.GetDeploymentById(selfDeploymentId); if (selfDeployment == null) { return(null); } IList <EPDeploymentDependencyProvided.Item> dependencies = new List <EPDeploymentDependencyProvided.Item>(4); string moduleName = selfDeployment.ModuleProvider.ModuleName; HandleProvided(selfDeployment.PathNamedWindows, EPObjectType.NAMEDWINDOW, paths.NamedWindowPathRegistry, moduleName, dependencies, name => name); HandleProvided(selfDeployment.PathTables, EPObjectType.TABLE, paths.TablePathRegistry, moduleName, dependencies, name => name); HandleProvided(selfDeployment.PathVariables, EPObjectType.VARIABLE, paths.VariablePathRegistry, moduleName, dependencies, name => name); HandleProvided(selfDeployment.PathContexts, EPObjectType.CONTEXT, paths.ContextPathRegistry, moduleName, dependencies, name => name); HandleProvided(selfDeployment.PathEventTypes, EPObjectType.EVENTTYPE, paths.EventTypePathRegistry, moduleName, dependencies, name => name); HandleProvided(selfDeployment.PathExprDecls, EPObjectType.EXPRESSION, paths.ExprDeclaredPathRegistry, moduleName, dependencies, name => name); HandleProvided(selfDeployment.PathScripts, EPObjectType.SCRIPT, paths.ScriptPathRegistry, moduleName, dependencies, SCRIPT_OBJECTNAME); HandleProvided( selfDeployment.PathClassProvideds, EPObjectType.CLASSPROVIDED, paths.ClassProvidedPathRegistry, moduleName, dependencies, name => name); foreach (ModuleIndexMeta objectName in selfDeployment.PathIndexes) { EventTableIndexMetadata indexMetadata = GetIndexMetadata(objectName, moduleName, paths); if (indexMetadata == null) { continue; } EventTableIndexMetadataEntry meta = indexMetadata.GetIndexEntryByName(objectName.IndexName); if (meta != null && meta.ReferringDeployments != null && meta.ReferringDeployments.Length > 0) { ISet <string> referred = new HashSet <string>(Arrays.AsList(meta.ReferringDeployments)); referred.Remove(selfDeploymentId); if (!referred.IsEmpty()) { dependencies.Add(new EPDeploymentDependencyProvided.Item(EPObjectType.INDEX, INDEX_OBJECTNAME.Invoke(objectName), referred)); } } } return(new EPDeploymentDependencyProvided(dependencies)); }
private void CheckDeploymentIdsExist( ISet <string> deploymentIds, DeploymentLifecycleService deploymentLifecycleService) { foreach (string deploymentId in deploymentIds) { DeploymentInternal deployment = deploymentLifecycleService.GetDeploymentById(deploymentId); if (deployment == null) { throw new EPStageException("Deployment '" + deploymentId + "' was not found"); } } }
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; }
public static EPDeployment ToDeployment( DeploymentLifecycleService deploymentLifecycleService, string deploymentId) { var deployed = deploymentLifecycleService.GetDeploymentById(deploymentId); if (deployed == null) { return null; } var stmts = deployed.Statements; var copy = new EPStatement[stmts.Length]; Array.Copy(stmts, 0, copy, 0, stmts.Length); return new EPDeployment( deploymentId, deployed.ModuleProvider.ModuleName, deployed.ModulePropertiesCached, copy, CollectionUtil.CopyArray(deployed.DeploymentIdDependencies), DateTimeHelper.TimeFromMillis(deployed.LastUpdateDate)); }
public static string DetermineDeploymentIdCheckExists( int rolloutItemNumber, DeploymentOptions optionsMayNull, DeploymentLifecycleService deploymentLifecycleService) { string deploymentId; if (optionsMayNull == null || optionsMayNull.DeploymentId == null) { deploymentId = Guid.NewGuid().ToString(); } else { deploymentId = optionsMayNull.DeploymentId; } if (deploymentLifecycleService.GetDeploymentById(deploymentId) != null) { throw new EPDeployDeploymentExistsException("Deployment by id '" + deploymentId + "' already exists", rolloutItemNumber); } return(deploymentId); }
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; }
// what are the dependencies that the given deployment consumes from other modules? public static EPDeploymentDependencyConsumed GetDependenciesConsumed( string selfDeploymentId, EPServicesPath paths, DeploymentLifecycleService deploymentLifecycleService) { var selfDeployment = deploymentLifecycleService.GetDeploymentById(selfDeploymentId); if (selfDeployment == null) { return(null); } string[] consumedDeploymentIds = selfDeployment.DeploymentIdDependencies; var consumed = new List <EPDeploymentDependencyConsumed.Item>(4); foreach (string providerDeploymentId in consumedDeploymentIds) { var providingDeployment = deploymentLifecycleService.GetDeploymentById(providerDeploymentId); if (providingDeployment == null) { continue; } string moduleName = providingDeployment.ModuleProvider.ModuleName; HandleConsumed( providerDeploymentId, providingDeployment.PathNamedWindows, EPObjectType.NAMEDWINDOW, paths.NamedWindowPathRegistry, moduleName, selfDeploymentId, consumed, name => name); HandleConsumed( providerDeploymentId, providingDeployment.PathTables, EPObjectType.TABLE, paths.TablePathRegistry, moduleName, selfDeploymentId, consumed, name => name); HandleConsumed( providerDeploymentId, providingDeployment.PathVariables, EPObjectType.VARIABLE, paths.VariablePathRegistry, moduleName, selfDeploymentId, consumed, name => name); HandleConsumed( providerDeploymentId, providingDeployment.PathContexts, EPObjectType.CONTEXT, paths.ContextPathRegistry, moduleName, selfDeploymentId, consumed, name => name); HandleConsumed( providerDeploymentId, providingDeployment.PathEventTypes, EPObjectType.EVENTTYPE, paths.EventTypePathRegistry, moduleName, selfDeploymentId, consumed, name => name); HandleConsumed( providerDeploymentId, providingDeployment.PathExprDecls, EPObjectType.EXPRESSION, paths.ExprDeclaredPathRegistry, moduleName, selfDeploymentId, consumed, name => name); HandleConsumed( providerDeploymentId, providingDeployment.PathScripts, EPObjectType.SCRIPT, paths.ScriptPathRegistry, moduleName, selfDeploymentId, consumed, SCRIPT_OBJECTNAME); HandleConsumed( providerDeploymentId, providingDeployment.PathClassProvideds, EPObjectType.CLASSPROVIDED, paths.ClassProvidedPathRegistry, moduleName, selfDeploymentId, consumed, name => name); foreach (ModuleIndexMeta objectName in providingDeployment.PathIndexes) { EventTableIndexMetadata indexMetadata = GetIndexMetadata(objectName, moduleName, paths); if (indexMetadata == null) { continue; } EventTableIndexMetadataEntry meta = indexMetadata.GetIndexEntryByName(objectName.IndexName); if (meta != null && meta.ReferringDeployments != null && meta.ReferringDeployments.Length > 0) { bool found = false; foreach (string dep in meta.ReferringDeployments) { if (dep.Equals(selfDeploymentId)) { found = true; break; } } if (found) { consumed.Add( new EPDeploymentDependencyConsumed.Item(providerDeploymentId, EPObjectType.INDEX, INDEX_OBJECTNAME.Invoke(objectName))); } } } } return(new EPDeploymentDependencyConsumed(consumed)); }