/// <summary>
        /// Launches the Visual Studio debugger.
        /// </summary>
        protected async Task DoLaunchAsync(IVsDebuggerLaunchCompletionCallback cb, params IDebugLaunchSettings[] launchSettings)
        {
            if (launchSettings.Length == 0)
            {
                cb.OnComplete(0, 0, null);
                return;
            }

            VsDebugTargetInfo4[] launchSettingsNative = launchSettings.Select(GetDebuggerStruct4).ToArray();

            try
            {
                // The debugger needs to be called on the UI thread
                await ThreadingService.SwitchToUIThread();

                IVsDebuggerLaunchAsync shellDebugger = await _vsDebuggerService.GetValueAsync();

                shellDebugger.LaunchDebugTargetsAsync((uint)launchSettingsNative.Length, launchSettingsNative, cb);
            }
            finally
            {
                // Free up the memory allocated to the (mostly) managed debugger structure.
                foreach (VsDebugTargetInfo4 nativeStruct in launchSettingsNative)
                {
                    FreeVsDebugTargetInfoStruct(nativeStruct);
                }
            }
        }
Example #2
0
 public StageRuntimeServices(
     DispatchService dispatchService,
     EventBeanService eventBeanService,
     EventBeanTypedEventFactory eventBeanTypedEventFactory,
     EventTypeRepository eventTypeRepositoryBus,
     EventTypeResolvingBeanFactory eventTypeResolvingBeanFactory,
     ExceptionHandlingService exceptionHandlingService,
     NamedWindowDispatchService namedWindowDispatchService,
     string runtimeURI,
     RuntimeSettingsService runtimeSettingsService,
     StatementLifecycleService statementLifecycleService,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     ThreadingService threadingService,
     VariableManagementService variableManagementService)
 {
     DispatchService = dispatchService;
     EventBeanService = eventBeanService;
     EventBeanTypedEventFactory = eventBeanTypedEventFactory;
     EventTypeRepositoryBus = eventTypeRepositoryBus;
     EventTypeResolvingBeanFactory = eventTypeResolvingBeanFactory;
     ExceptionHandlingService = exceptionHandlingService;
     NamedWindowDispatchService = namedWindowDispatchService;
     RuntimeURI = runtimeURI;
     RuntimeSettingsService = runtimeSettingsService;
     StatementLifecycleService = statementLifecycleService;
     TableExprEvaluatorContext = tableExprEvaluatorContext;
     ThreadingService = threadingService;
     VariableManagementService = variableManagementService;
 }
Example #3
0
        private async Task ProjectUpdateAsync(IProjectVersionedValue <IProjectSnapshot> update)
        {
            // Switch to the Main thread (if necessary):
            await ThreadingService.SwitchToUIThread();

            OnProjectChanged(new ProjectChangedEventArgs(update.Value.ProjectInstance));
        }
Example #4
0
        /// <summary>
        /// Launches the Visual Studio debugger.
        /// </summary>
        protected async Task <IReadOnlyList <VsDebugTargetProcessInfo> > DoLaunchAsync(params IDebugLaunchSettings[] launchSettings)
        {
            VsDebugTargetInfo4[] launchSettingsNative = launchSettings.Select(GetDebuggerStruct4).ToArray();
            if (launchSettingsNative.Length == 0)
            {
                return(Array.Empty <VsDebugTargetProcessInfo>());
            }

            try
            {
                // The debugger needs to be called on the UI thread
                await ThreadingService.SwitchToUIThread();

                IVsDebugger4 shellDebugger = await _vsDebuggerService.GetValueAsync();

                var launchResults = new VsDebugTargetProcessInfo[launchSettingsNative.Length];
                shellDebugger.LaunchDebugTargets4((uint)launchSettingsNative.Length, launchSettingsNative, launchResults);
                return(launchResults);
            }
            finally
            {
                // Free up the memory allocated to the (mostly) managed debugger structure.
                foreach (VsDebugTargetInfo4 nativeStruct in launchSettingsNative)
                {
                    FreeVsDebugTargetInfoStruct(nativeStruct);
                }
            }
        }
Example #5
0
    public IEnumerator TestCoroutine()
    {
        updateCounter = 0;
        ThreadingService.RunRoutine(CoroutineAsync());
        yield return(new WaitForSeconds(1));

        Assert.IsTrue(updateCounter == 5);
    }
Example #6
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="runtimeEventSender">for processing events</param>
 /// <param name="baseXMLEventType">the event type</param>
 /// <param name="eventAdapterService">for event bean creation</param>
 /// <param name="threadingService">for inbound threading</param>
 public EventSenderXMLDOM(EPRuntimeEventSender runtimeEventSender, BaseXMLEventType baseXMLEventType, EventAdapterService eventAdapterService, ThreadingService threadingService)
 {
     _runtimeEventSender  = runtimeEventSender;
     _baseXmlEventType    = baseXMLEventType;
     _validateRootElement = baseXMLEventType.ConfigurationEventTypeXMLDOM.IsEventSenderValidatesRoot;
     _eventAdapterService = eventAdapterService;
     _threadingService    = threadingService;
 }
Example #7
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="runtimeEventSender">for processing events</param>
 /// <param name="mapEventType">the event type</param>
 /// <param name="threadingService">for inbound threading</param>
 /// <param name="eventAdapterService">for event bean creation</param>
 public EventSenderMap(EPRuntimeEventSender runtimeEventSender, MapEventType mapEventType,
                       EventAdapterService eventAdapterService, ThreadingService threadingService)
 {
     _runtimeEventSender  = runtimeEventSender;
     _mapEventType        = mapEventType;
     _threadingService    = threadingService;
     _eventAdapterService = eventAdapterService;
 }
Example #8
0
        public async Task TestCoroutine()
        {
            updateCounter = 0;
            ThreadingService.RunRoutine(CoroutineAsync());
            await Task.Delay(5000);

            Console.WriteLine(updateCounter);
            Assert.IsTrue(updateCounter == 5);
        }
Example #9
0
 /// <summary>Ctor. </summary>
 /// <param name="runtime">for processing events</param>
 /// <param name="beanEventType">the event type</param>
 /// <param name="eventAdapterService">factory for event beans and event types</param>
 /// <param name="threadingService">for inbound threading</param>
 public EventSenderBean(EPRuntimeEventSender runtime, BeanEventType beanEventType, EventAdapterService eventAdapterService, ThreadingService threadingService)
 {
     _iLock               = LockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     _runtime             = runtime;
     _beanEventType       = beanEventType;
     _eventAdapterService = eventAdapterService;
     _compatibleClasses   = new HashSet <Type>();
     _threadingService    = threadingService;
 }
 /// <summary>Ctor. </summary>
 /// <param name="runtimeEventSender">for processing events</param>
 /// <param name="objectArrayEventType">the event type</param>
 /// <param name="threadingService">for inbound threading</param>
 /// <param name="eventAdapterService">for event bean creation</param>
 public EventSenderObjectArray(EPRuntimeEventSender runtimeEventSender,
                               ObjectArrayEventType objectArrayEventType,
                               EventAdapterService eventAdapterService,
                               ThreadingService threadingService)
 {
     _runtimeEventSender   = runtimeEventSender;
     _objectArrayEventType = objectArrayEventType;
     _threadingService     = threadingService;
     _eventAdapterService  = eventAdapterService;
 }
Example #11
0
        public DeploymentDialogViewModel(IServiceProvider services, string projectName, string directoryOfProjectToDeploy, string targetFrameworkMoniker)
            : base(services)
        {
            _errorDialogService  = services.GetRequiredService <IErrorDialog>();
            TasExplorerViewModel = services.GetRequiredService <ITasExplorerViewModel>();

            OutputView      = ViewLocatorService.GetViewByViewModelName(nameof(ViewModels.OutputViewModel)) as IView;
            OutputViewModel = OutputView?.ViewModel as IOutputViewModel;

            DeploymentInProgress = false;
            PathToProjectRootDir = directoryOfProjectToDeploy;
            SelectedBuildpacks   = new ObservableCollection <string>();

            if (targetFrameworkMoniker.StartsWith(FullFrameworkTFM))
            {
                _fullFrameworkDeployment = true;
            }

            CfInstanceOptions       = new List <CloudFoundryInstance>();
            CfOrgOptions            = new List <CloudFoundryOrganization>();
            CfSpaceOptions          = new List <CloudFoundrySpace>();
            BuildpackOptions        = new List <BuildpackListItem>();
            StackOptions            = new List <string>();
            DeploymentDirectoryPath = null;

            ManifestModel = new AppManifest
            {
                Version      = 1,
                Applications = new List <AppConfig>
                {
                    new AppConfig
                    {
                        Name       = projectName,
                        Buildpacks = new List <string>(),
                    }
                }
            };

            SetManifestIfDefaultExists();

            if (TasExplorerViewModel.TasConnection != null)
            {
                TargetName = TasExplorerViewModel.TasConnection.DisplayText;
                IsLoggedIn = true;

                ThreadingService.StartTask(UpdateCfOrgOptions);
                ThreadingService.StartTask(UpdateBuildpackOptions);
                ThreadingService.StartTask(UpdateStackOptions);
            }

            _projectName = projectName;

            Expanded = false;
        }
 /// <summary>
 /// Executes a delegate, catching any thrown exceptions and converting them to HRESULTs.
 /// </summary>
 private HResult HrInvoke(Func <Task <HResult> > asyncAction, bool registerProjectFaultHandlerService = false)
 {
     return(HResult.Invoke(
                delegate
     {
         return ThreadingService.ExecuteSynchronously(asyncAction);
     },
                Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider,
                registerProjectFaultHandlerService ? ProjectFaultHandlerService : null,
                UnconfiguredProject));
 }
Example #13
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="runtimeEventSender">for processing events</param>
 /// <param name="eventType">the event type</param>
 /// <param name="threadingService">for inbound threading</param>
 /// <param name="eventAdapterService">for event bean creation</param>
 public EventSenderAvro(
     EPRuntimeEventSender runtimeEventSender,
     EventType eventType,
     EventAdapterService eventAdapterService,
     ThreadingService threadingService)
 {
     _runtimeEventSender  = runtimeEventSender;
     _eventType           = eventType;
     _threadingService    = threadingService;
     _eventAdapterService = eventAdapterService;
 }
        private ProjectItem GetProjectItemForDocumentMoniker(string documentMoniker)
        {
            ThreadingService.VerifyOnUIThread();

            HierarchyId id = _projectVsServices.VsProject.GetHierarchyId(documentMoniker);

            if (id.IsNil || id.IsRoot)
            {
                return(null);
            }

            return(_projectVsServices.VsHierarchy.GetProperty(id, VsHierarchyPropID.ExtObject, (ProjectItem)null));
        }
        /// <summary>
        /// Handles the <see cref="IActiveConfiguredProjectSubscriptionService"/> callback on the active configured project's
        /// design-time build change notification service.
        /// </summary>
        private async Task ProjectBuildRuleBlock_ChangedAsync(IProjectVersionedValue <IProjectSubscriptionUpdate> e)
        {
            await ThreadingService.SwitchToUIThread();

            using (ProjectAsynchronousTasksService.LoadedProject())
            {
                foreach (var resolvedReferenceChange in e.Value.ProjectChanges.Values)
                {
                    if (!WatchedDesignTimeBuildRules.Contains(resolvedReferenceChange.After.RuleName))
                    {
                        // This is an evaluation rule.
                        continue;
                    }

                    foreach (string resolvedReferencePath in resolvedReferenceChange.Difference.AddedItems)
                    {
                        // If this is a resolved project reference, we need to treat it specially.
                        string originalItemSpec = resolvedReferenceChange.After.Items[resolvedReferencePath]["OriginalItemSpec"];
                        if (!string.IsNullOrEmpty(originalItemSpec))
                        {
                            if (e.Value.CurrentState[ProjectReference.SchemaName].Items.ContainsKey(originalItemSpec))
                            {
                                string originalFullPath = UnconfiguredProject.MakeRooted(originalItemSpec);
                                ProjectReferenceState state;
                                if (!_projectReferenceFullPaths.TryGetValue(originalFullPath, out state))
                                {
                                    _projectReferenceFullPaths = _projectReferenceFullPaths.Add(originalFullPath, state = new ProjectReferenceState());
                                }

                                state.ResolvedPath = resolvedReferencePath;

                                // Be careful to not add assembly references that overlap with project references.
                                if (state.AsProjectReference)
                                {
                                    continue;
                                }
                            }
                        }

                        Marshal.ThrowExceptionForHR(_intellisenseEngine.AddAssemblyReference(resolvedReferencePath));
                    }

                    foreach (string resolvedReferencePath in resolvedReferenceChange.Difference.RemovedItems)
                    {
                        Marshal.ThrowExceptionForHR(_intellisenseEngine.RemoveAssemblyReference(resolvedReferencePath));
                    }

                    Marshal.ThrowExceptionForHR(_intellisenseEngine.StartIntellisenseEngine());
                }
            }
        }
Example #16
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="statementName">Name of the statement.</param>
        /// <param name="statementLifecycleSvc">handles persistence for statements</param>
        /// <param name="metricReportingService">for metrics reporting</param>
        /// <param name="threadingService">for outbound threading</param>
        public StatementResultServiceImpl(String statementName,
                                          StatementLifecycleSvc statementLifecycleSvc,
                                          MetricReportingServiceSPI metricReportingService,
                                          ThreadingService threadingService)
        {
            Log.Debug(".ctor");

            _isDebugEnabled         = ExecutionPathDebugLog.IsEnabled && Log.IsDebugEnabled;
            _statementName          = statementName;
            _statementLifecycleSvc  = statementLifecycleSvc;
            _metricReportingService = metricReportingService;
            _statementOutputHooks   = metricReportingService != null ? metricReportingService.StatementOutputHooks : new List <StatementResultListener>();
            _threadingService       = threadingService;
        }
Example #17
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="runtime">for processing events</param>
 /// <param name="beanEventType">the event type</param>
 /// <param name="eventAdapterService">factory for event beans and event types</param>
 /// <param name="threadingService">for inbound threading</param>
 /// <param name="lockManager">The lock manager.</param>
 public EventSenderBean(
     EPRuntimeEventSender runtime,
     BeanEventType beanEventType,
     EventAdapterService eventAdapterService,
     ThreadingService threadingService,
     ILockManager lockManager)
 {
     _iLock               = lockManager.CreateLock(GetType());
     _runtime             = runtime;
     _beanEventType       = beanEventType;
     _eventAdapterService = eventAdapterService;
     _compatibleClasses   = new HashSet <Type>();
     _threadingService    = threadingService;
 }
Example #18
0
        public async Task TestUpdate()
        {
            var task = ThreadingService.RunUpdate(Update);

            await Task.Delay(1000);

            //Asset works
            Assert.IsTrue(updateCounter >= 900);

            task.Dispose();

            var old = updateCounter;

            await Task.Delay(1000);

            //Asset Dispose works
            Assert.IsTrue(updateCounter == old);
        }
Example #19
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="statementName">Name of the statement.</param>
        /// <param name="statementLifecycleSvc">handles persistence for statements</param>
        /// <param name="metricReportingService">for metrics reporting</param>
        /// <param name="threadingService">for outbound threading</param>
        /// <param name="threadLocalManager">The thread local manager.</param>
        public StatementResultServiceImpl(
            String statementName,
            StatementLifecycleSvc statementLifecycleSvc,
            MetricReportingServiceSPI metricReportingService,
            ThreadingService threadingService,
            IThreadLocalManager threadLocalManager)
        {
            Log.Debug(".ctor");

            _threadLocalManager     = threadLocalManager;
            _lastResults            = threadLocalManager.Create(() => new LinkedList <UniformPair <EventBean[]> >());
            _isDebugEnabled         = ExecutionPathDebugLog.IsEnabled && Log.IsDebugEnabled;
            _statementName          = statementName;
            _statementLifecycleSvc  = statementLifecycleSvc;
            _metricReportingService = metricReportingService;
            _statementOutputHooks   = metricReportingService != null ? metricReportingService.StatementOutputHooks : new List <StatementResultListener>();
            _threadingService       = threadingService;
        }
Example #20
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;
 }
Example #21
0
        public CPSProjectManagerI(UnconfiguredProject unconfiguredProject)
        {
            UnconfiguredProject = unconfiguredProject;
            ProjectLockService  = unconfiguredProject.ProjectService.Services.ProjectLockService;
            ThreadingService    = unconfiguredProject.ProjectService.Services.ThreadingPolicy;
            var activeConfiguredProjectSubscription = unconfiguredProject.Services.ActiveConfiguredProjectSubscription;
            var projectSource = activeConfiguredProjectSubscription.ProjectSource;

            ProjectSubscription = projectSource.SourceBlock.LinkTo(
                new ActionBlock <IProjectVersionedValue <IProjectSnapshot> >(ProjectUpdateAsync));

            ThreadingService.ExecuteSynchronously(async() =>
            {
                using (var projectWriteLock = await ProjectLockService.ReadLockAsync())
                {
                    var configuredProject = await UnconfiguredProject.GetSuggestedConfiguredProjectAsync();
                    MSBuildProject        = await projectWriteLock.GetProjectAsync(configuredProject);
                }
            });
        }
Example #22
0
    public IEnumerator TestUpdate()
    {
        var task = ThreadingService.RunUpdate(MyUpdate);

        yield return(1);

        yield return(new WaitForSeconds(1.2f));

        //Asset works
        Assert.IsTrue(updateCounter >= 1);

        task.Dispose();

        var old = updateCounter;

        yield return(new WaitForSeconds(1));

        //Asset Dispose works
        Assert.IsTrue(updateCounter == old);
    }
Example #23
0
        public async Task TestDelay()
        {
            var task = ThreadingService.RunDelay(UpdateDelay, 1);
            await Task.Delay(500);

            //Asset Not early executed
            Assert.IsTrue(updateCounter == 0);
            await Task.Delay(1500);

            //Asset Executed in time
            Assert.IsTrue(updateCounter == 1);
            task.Dispose();

            updateCounter = 0;
            task          = ThreadingService.RunDelay(UpdateDelay, 1);
            await Task.Delay(500);

            task.Dispose();
            await Task.Delay(1500);

            //asset early dispose
            Assert.IsTrue(updateCounter == 0);
        }
Example #24
0
    public IEnumerator TestDelay()
    {
        var task = ThreadingService.RunDelay(UpdateDelay, 1);

        yield return(new WaitForSeconds(.5f));

        //Asset Not early executed
        Assert.IsTrue(updateCounter == 0);
        yield return(new WaitForSeconds(2f));

        //Asset Executed in time
        Assert.IsTrue(updateCounter >= 1);
        task.Dispose();

        updateCounter = 0;
        task          = ThreadingService.RunDelay(UpdateDelay, 1);
        yield return(new WaitForSeconds(.5f));

        task.Dispose();
        yield return(new WaitForSeconds(1.5f));

        //asset early dispose
        Assert.IsTrue(updateCounter == 0);
    }
Example #25
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="handlingFactories">list of factories</param>
 /// <param name="epRuntime">the runtime to use to process the event</param>
 /// <param name="threadingService">for inbound threading</param>
 public EventSenderImpl(List <EventSenderURIDesc> handlingFactories, EPRuntimeEventSender epRuntime, ThreadingService threadingService)
 {
     _handlingFactories = handlingFactories;
     _epRuntime         = epRuntime;
     _threadingService  = threadingService;
 }
Example #26
0
 /// <summary>Dispose services. </summary>
 public void Dispose()
 {
     if (ScriptingService != null)
     {
         ScriptingService.Dispose();
     }
     if (ExprDeclaredService != null)
     {
         ExprDeclaredService.Dispose();
     }
     if (DataFlowService != null)
     {
         DataFlowService.Dispose();
     }
     if (VariableService != null)
     {
         VariableService.Dispose();
     }
     if (MetricsReportingService != null)
     {
         MetricsReportingService.Dispose();
     }
     if (ThreadingService != null)
     {
         ThreadingService.Dispose();
     }
     if (StatementLifecycleSvc != null)
     {
         StatementLifecycleSvc.Dispose();
     }
     if (FilterService != null)
     {
         FilterService.Dispose();
     }
     if (SchedulingService != null)
     {
         SchedulingService.Dispose();
     }
     if (SchedulingMgmtService != null)
     {
         SchedulingMgmtService.Dispose();
     }
     if (StreamService != null)
     {
         StreamService.Destroy();
     }
     if (NamedWindowMgmtService != null)
     {
         NamedWindowMgmtService.Dispose();
     }
     if (NamedWindowDispatchService != null)
     {
         NamedWindowDispatchService.Dispose();
     }
     if (EngineLevelExtensionServicesContext != null)
     {
         EngineLevelExtensionServicesContext.Dispose();
     }
     if (StatementIsolationService != null)
     {
         StatementIsolationService.Dispose();
     }
     if (DeploymentStateService != null)
     {
         DeploymentStateService.Dispose();
     }
 }
Example #27
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;
        }
Example #28
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;
 }
        /// <summary>
        /// Handles the <see cref="IActiveConfiguredProjectSubscriptionService"/> callback event on the active configured project's
        /// change notification service.
        /// </summary>
        private async System.Threading.Tasks.Task ProjectRuleBlock_ChangedAsync(IProjectVersionedValue <IProjectSubscriptionUpdate> e)
        {
            await ThreadingService.SwitchToUIThread();

            await ProjectAsynchronousTasksService.LoadedProjectAsync(async delegate
            {
                var sourceFiles       = e.Value.ProjectChanges[CSharp.SchemaName];
                var projectReferences = e.Value.ProjectChanges[ProjectReference.SchemaName];
#pragma warning disable CA2007 // Do not directly await a Task (see https://github.com/dotnet/roslyn/issues/6770)
                var treeUpdate = await ProjectTreeService.PublishLatestTreeAsync(blockDuringLoadingTree: true);
#pragma warning restore CA2007 // Do not directly await a Task
                var tree = treeUpdate.Tree;

                foreach (var sourceUnit in sourceFiles.Difference.AddedItems.Select(item => SourceFileToLanguageServiceUnit(item, tree)).Where(u => u != null))
                {
                    Marshal.ThrowExceptionForHR(_intellisenseEngine.AddFile(sourceUnit.Item1, sourceUnit.Item2));
                }

                foreach (var sourceUnit in sourceFiles.Difference.RemovedItems.Select(item => SourceFileToLanguageServiceUnit(item, tree)).Where(u => u != null))
                {
                    Marshal.ThrowExceptionForHR(_intellisenseEngine.RemoveFile(sourceUnit.Item1, sourceUnit.Item2));
                }

                foreach (KeyValuePair <string, string> sourceFileNames in sourceFiles.Difference.RenamedItems)
                {
                    var newSourceUnit = SourceFileToLanguageServiceUnit(sourceFileNames.Value, tree);
                    if (newSourceUnit != null)
                    {
                        string beforeAbsolutePath = UnconfiguredProject.MakeRooted(sourceFileNames.Key);
                        Marshal.ThrowExceptionForHR(_intellisenseEngine.RenameFile(beforeAbsolutePath, newSourceUnit.Item1, newSourceUnit.Item2));
                    }
                }

                foreach (string projectReferencePath in projectReferences.Difference.AddedItems)
                {
                    string projectReferenceFullPath = UnconfiguredProject.MakeRooted(projectReferencePath);
                    ProjectReferenceState state;
                    if (!_projectReferenceFullPaths.TryGetValue(projectReferenceFullPath, out state))
                    {
                        _projectReferenceFullPaths = _projectReferenceFullPaths.Add(projectReferenceFullPath, state = new ProjectReferenceState());
                    }

                    IVsIntellisenseProject intellisenseProject;
                    if (LanguageServiceRegister.TryGetIntellisenseProject(projectReferenceFullPath, out intellisenseProject))
                    {
                        if (state.ResolvedPath != null && !state.AsProjectReference)
                        {
                            Marshal.ThrowExceptionForHR(_intellisenseEngine.RemoveAssemblyReference(state.ResolvedPath));
                        }

                        state.AsProjectReference = true;
                        Marshal.ThrowExceptionForHR(_intellisenseEngine.AddP2PReference(intellisenseProject));
                    }
                }

                foreach (string projectReferencePath in projectReferences.Difference.RemovedItems)
                {
                    string projectReferenceFullPath = UnconfiguredProject.MakeRooted(projectReferencePath);
                    _projectReferenceFullPaths      = _projectReferenceFullPaths.Remove(projectReferenceFullPath);

                    IVsIntellisenseProject intellisenseProject;
                    if (LanguageServiceRegister.TryGetIntellisenseProject(projectReferencePath, out intellisenseProject))
                    {
                        Marshal.ThrowExceptionForHR(_intellisenseEngine.RemoveP2PReference(_intellisenseEngine));
                    }

                    ProjectReferenceState state;
                    if (_projectReferenceFullPaths.TryGetValue(projectReferenceFullPath, out state))
                    {
                        state.AsProjectReference = false;
                    }
                }

                Marshal.ThrowExceptionForHR(_intellisenseEngine.StartIntellisenseEngine());
            });
        }