public EvaluationResultItem Evaluate(Configuration configuration) { AggregatedSourceFieldIndexResultItem resultItem = new AggregatedSourceFieldIndexResultItem(); resultItem.Passed = true; foreach (Session session in configuration.SessionGroup.Sessions.Session) { string settingXml = BusinessModelManager.GenericSettingXmlToString(session.CustomSettings.SettingXml); if (!string.IsNullOrEmpty(settingXml)) { if (session.SessionType != SessionTypeEnum.WorkItemTracking) { continue; } foreach (FieldMap fieldMap in session.WITCustomSetting.FieldMaps.FieldMap) { foreach (FieldsAggregationGroup aggregationGroup in fieldMap.AggregatedFields.FieldsAggregationGroup) { if (!IsSourceFieldIndexValid(aggregationGroup)) { resultItem.AddInvalidAggregationGroup(fieldMap, aggregationGroup); resultItem.Passed = false; } } } } } return(resultItem); }
private void LaunchActiveGroupsFromDB() { BusinessModelManager manager = new BusinessModelManager(); List <Guid> runningSessionGroups = manager.GetActiveSessionGroupUniqueIds(); if (runningSessionGroups.Count() == 0) { throw new NoActiveSessionGroupException(); } if (m_commandSwitch.CommandSwitchSet) { Configuration configuration; foreach (Guid sessionGroupId in runningSessionGroups) { configuration = manager.LoadConfiguration(sessionGroupId); preAuthorizeRules(configuration); } } // If we are self hosting, use the IMigrationService interface // to start some sessions before trying to list the active ones. foreach (Guid sessionGroupId in runningSessionGroups) { m_pipeProxy.StartSessionGroup(sessionGroupId); } while (true) { try { runningSessionGroups.Clear(); runningSessionGroups.AddRange(m_pipeProxy.GetRunningSessionGroups()); // uncomment the following lines for richer debugging message // Console.WriteLine(String.Format("Received {0} entries", runningSessionGroups.Count)); //foreach (Guid guid in runningSessionGroups) //{ // Console.WriteLine(guid.ToString()); //} if (runningSessionGroups.Count() == 0 || AllRunningSessionGroupsAreInStoppedSyncState(runningSessionGroups.ToArray())) { break; } } catch (Exception e) { // Ugly, but this approach lets us start the test app // before the endpoint is ready to service requests. Console.WriteLine("Error: {0}", e.Message); // re-initialize proxy InitializeProxy(); } Thread.Sleep(RunningSessionPollingIntervalMillisec); } }
public static ConfigurationModel Load(Guid sessionGroupUniqueId) { // TODO: Statics on the ConfigurationManager should take the sessionGroupUniqueId BusinessModelManager businessModelManager = new BusinessModelManager(); ConfigurationModel model = new ConfigurationModel(); model.Configuration = businessModelManager.LoadConfiguration(sessionGroupUniqueId); return(model); }
/// <summary> /// Proposes the current configuration changes to the BusinessModelManager. /// If a manager isn't currently associated with this configuration, a new one is created /// and a detached configuration is proposed to that manager. /// </summary> /// <seealso cref="Microsoft.TeamFoundation.Migration.BusinessModel.BusinessModelManager"/> public void Propose() { if (null != Manager) { Manager.ProposeChanges(); } else { Manager = new BusinessModelManager(); Manager.ProposeDetachedConfiguration(this); } }
public static void Start(string configFileName) { Configuration config = null; try { using (FileStream fs = new FileStream(configFileName, FileMode.Open, FileAccess.Read)) { XmlSerializer serializer = new XmlSerializer(typeof(Configuration)); config = serializer.Deserialize(fs) as Configuration; } } catch (Exception ex) { Trace.TraceError("Failed to load the configuration file {0}", configFileName); Trace.TraceError(ex.ToString()); throw ex; } Trace.TraceInformation("Loaded {0} file successfully", configFileName); if (config != null) { // persist to db try { SessionGroupConfigurationManager configManager = new SessionGroupConfigurationManager(config); configManager.TrySave(false); } catch (DuplicateConfigurationException) { // the same configuration already exists // swallow the exception } Guid sessionGroupGuid = config.SessionGroupUniqueId; config = null; // load the configuration from db (instead of the deserialized object from file) BusinessModelManager businessModelManager = new BusinessModelManager(); config = businessModelManager.LoadConfiguration(sessionGroupGuid); SyncOrchestrator syncOrch = new SyncOrchestrator(config); syncOrch.ConstructPipelines(); syncOrch.InitializePipelines(); syncOrch.Start(Timeout.Infinite); syncOrch.BlockUntilAllSessionFinishes(); } }
// This is where Windows Service behavior over TFSMigrationDb lives... look for work to do when waking up private void RestartActiveSessionGroups() { TraceManager.TraceInformation("RestartActiveSessionGroups: Enter"); BusinessModelManager businessModelManager = new BusinessModelManager(); List <Guid> activeSessionGroupUniqueIds = businessModelManager.GetActiveSessionGroupUniqueIds(); TraceManager.TraceInformation("RestartActiveSessionGroups: BusinessModelManager returned # sessions: {0}", activeSessionGroupUniqueIds.Count); foreach (Guid activeSessionGroupUniqueId in activeSessionGroupUniqueIds) { m_migrationServiceProxy.StartSessionGroup(activeSessionGroupUniqueId); } }
public ConfigurationChangeTracker(Configuration newConfig) { if (null == newConfig) { throw new ArgumentNullException("newConfig"); } ImpactScope = ConfigChangeImpactScope.None; UpdatedSessionGroupId = Guid.Empty; UpdatedSessionIds = new List <Guid>(); m_newConfig = newConfig; BusinessModelManager manager = new BusinessModelManager(); m_currentActiveConfig = manager.LoadConfiguration(m_newConfig.SessionGroupUniqueId); }
public EvaluationResultItem Evaluate(Configuration configuration) { NoMultipleMapsOnSameTargetFieldResultItem resultItem = new NoMultipleMapsOnSameTargetFieldResultItem(); resultItem.Passed = true; foreach (Session session in configuration.SessionGroup.Sessions.Session) { string settingXml = BusinessModelManager.GenericSettingXmlToString(session.CustomSettings.SettingXml); if (!string.IsNullOrEmpty(settingXml)) { if (session.SessionType != SessionTypeEnum.WorkItemTracking) { continue; } foreach (FieldMap fieldMap in session.WITCustomSetting.FieldMaps.FieldMap) { Reset(); foreach (MappedField mappedField in fieldMap.MappedFields.MappedField) { string collidedField; if (IsTargetFieldMapped(mappedField, out collidedField)) { resultItem.AddCollidedField(fieldMap, collidedField); } UpdateTargetFieldCache(mappedField.MapFromSide, mappedField.LeftName, mappedField.RightName); } foreach (FieldsAggregationGroup aggregationGroup in fieldMap.AggregatedFields.FieldsAggregationGroup) { if (IsTargetFieldMapped(aggregationGroup)) { resultItem.AddCollidedField(fieldMap, aggregationGroup.TargetFieldName); } UpdateTargetFieldCache(aggregationGroup.MapFromSide, aggregationGroup.TargetFieldName, aggregationGroup.TargetFieldName); } } } } return(resultItem); }
private void ExportConfiguration(Guid sessionGroupUniqueId, string exportConfigFileName) { BusinessModelManager bmMgr = new BusinessModelManager(); Configuration config = bmMgr.LoadConfiguration(sessionGroupUniqueId); if (null == config) { throw new NonExistingSessionGroupUniqueIdException(sessionGroupUniqueId); } XmlSerializer configSerializer = new XmlSerializer(typeof(Configuration)); using (FileStream fs = new FileStream(exportConfigFileName, FileMode.Create)) { configSerializer.Serialize(fs, config); fs.Dispose(); } }
public static Configuration LoadFromXml(string configXmlString, bool validate) { if (string.IsNullOrEmpty(configXmlString)) { throw new ArgumentNullException("configXmlString"); } configXmlString = GuidStrToLower(configXmlString); if (validate) { // session group config validation XmlDocument doc = new XmlDocument(); doc.LoadXml(configXmlString); ConfigurationValidator validator = new ConfigurationValidator(); validator.ValidateXmlFragment(string.Empty, doc.DocumentElement, Constants.ConfigXsdResourcePath); var result = validator.ValidationResult; if (!result.IsValid) { throw new ConfigurationSchemaViolationException(result); } } Configuration config = BusinessModelManager.Deserialize(configXmlString, typeof(Configuration)) as Configuration; if (validate) { // session-type-sepecific custom setting validation foreach (Session session in config.SessionGroup.Sessions.Session) { ValidateCustomSettings(session.CustomSettings, session.SessionType); } BusinessRuleEvaluationEngine evaluationEngine = new BusinessRuleEvaluationEngine(); var evaluationResult = evaluationEngine.Evaluate(config); if (!evaluationResult.Passed) { throw new ConfigurationBusinessRuleViolationException(evaluationResult); } } return(config); }
public EvaluationResultItem Evaluate(Configuration configuration) { NonEmptyVCFilterStringResultItem resultItem = new NonEmptyVCFilterStringResultItem(); resultItem.Passed = true; foreach (Session session in configuration.SessionGroup.Sessions.Session) { bool isValid = true; string settingXml = BusinessModelManager.GenericSettingXmlToString(session.CustomSettings.SettingXml); if (!string.IsNullOrEmpty(settingXml)) { XmlDocument settingDoc = new XmlDocument(); settingDoc.LoadXml(settingXml); if (session.SessionType != SessionTypeEnum.VersionControl) { continue; } foreach (FilterPair pair in session.Filters.FilterPair) { if (!isValid) { break; } foreach (FilterItem item in pair.FilterItem) { if (string.IsNullOrEmpty(item.FilterString)) { resultItem.Passed = false; resultItem.AddInvalidSession(session); isValid = false; break; } } } } } return(resultItem); }
public void SetSessionGroupUniqueId(Guid sessionGroupUniqueId, bool constructPipelines) { try { m_allActiveConflicts = null; m_rules = null; CurrentRule = null; SessionGroupUniqueId = sessionGroupUniqueId; if (ShellViewModel != null) { Config = ShellViewModel.DataModel.Configuration; } else // only used for automated testing { BusinessModelManager businessModelManager = new BusinessModelManager(); Config = businessModelManager.LoadConfiguration(sessionGroupUniqueId); } if (Config != null) { if (m_constructPipelinesBW == null) { m_constructPipelinesBW = new BackgroundWorker(); m_constructPipelinesBW.DoWork += new DoWorkEventHandler(m_constructPipelinesBW_DoWork); m_constructPipelinesBW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(m_constructPipelinesBW_RunWorkerCompleted); } if (!m_constructPipelinesBW.IsBusy) { IsBusy = true; m_constructPipelinesBW.RunWorkerAsync(constructPipelines); } } } catch (Exception e) { SessionGroupUniqueId = Guid.Empty; Utilities.HandleException(e); } }
public void Save(bool saveAsNew) { BusinessModelManager businessModelManager = new BusinessModelManager(); if (businessModelManager.IsConfigurationPersisted(this.Configuration)) { Configuration.UniqueId = Guid.NewGuid().ToString(); if (saveAsNew) { Configuration.SessionGroup.SessionGroupGUID = Guid.NewGuid().ToString(); foreach (Session session in Configuration.SessionGroup.Sessions.Session) { session.SessionUniqueId = Guid.NewGuid().ToString(); } } } SessionGroupConfigurationManager configSaver = new SessionGroupConfigurationManager(this.Configuration); configSaver.TrySave(!saveAsNew); }
public EvaluationResultItem Evaluate(Configuration configuration) { DisallowSameSourceFieldMappedTwiceInMappedFieldsResultItem resultItem = new DisallowSameSourceFieldMappedTwiceInMappedFieldsResultItem(); resultItem.Passed = true; foreach (Session session in configuration.SessionGroup.Sessions.Session) { string settingXml = BusinessModelManager.GenericSettingXmlToString(session.CustomSettings.SettingXml); if (!string.IsNullOrEmpty(settingXml)) { if (session.SessionType != SessionTypeEnum.WorkItemTracking) { continue; } foreach (FieldMap fieldMap in session.WITCustomSetting.FieldMaps.FieldMap) { Reset(); foreach (MappedField mappedField in fieldMap.MappedFields.MappedField) { if (!IsSourceFieldMissing(mappedField)) { string collidedField; if (IsSourceFieldMapped(mappedField, out collidedField)) { resultItem.AddCollidedField(fieldMap, collidedField); } UpdateMappedFieldCache(mappedField.MapFromSide, mappedField.LeftName, mappedField.RightName); } } } } } return(resultItem); }
public static List <Guid> FindAllActiveSessionsOfType(SessionTypeEnum sessionType) { List <Guid> allActiveSessionsOfSelectedType = new List <Guid>(); using (RuntimeEntityModel context = RuntimeEntityModel.CreateInstance()) { // Query all of the session groups ordered by Id descending to get the most recent first var sessionGroupQuery = (from sg in context.RTSessionGroupSet orderby sg.Id select sg); // Iterate through the session groups until we find one that has the requested sessionType foreach (RTSessionGroup rtSessionGroup in sessionGroupQuery) { BusinessModelManager bmManager = new BusinessModelManager(); Configuration config = bmManager.LoadConfiguration(rtSessionGroup.GroupUniqueId); if (config == null) { continue; } HashSet <Guid> sessionGroupActiveSessions = new HashSet <Guid>(); rtSessionGroup.Sessions.Load(); foreach (RTSession rtSession in rtSessionGroup.Sessions) { if (rtSession.OrchestrationStatus != (int)PipelineState.Default && rtSession.OrchestrationStatus != (int)PipelineState.Stopped) { sessionGroupActiveSessions.Add(rtSession.SessionUniqueId); } } List <Guid> sessionGroupActiveSessionsOfSelectedType = FilterActiveSessionsByType(config, sessionGroupActiveSessions, sessionType); allActiveSessionsOfSelectedType.AddRange(sessionGroupActiveSessionsOfSelectedType); } } return(allActiveSessionsOfSelectedType); }
public static void ValidateCustomSettings(GenericSettingsElement customSettings, SessionTypeEnum sessionType) { string settingXml = BusinessModelManager.GenericSettingXmlToString(customSettings.SettingXml); if (!string.IsNullOrEmpty(settingXml)) { XmlDocument settingDoc = new XmlDocument(); settingDoc.LoadXml(settingXml); string pathToXsd = string.Empty; switch (sessionType) { case SessionTypeEnum.WorkItemTracking: pathToXsd = Constants.WITConfigXsdResourcePath; break; case SessionTypeEnum.VersionControl: pathToXsd = Constants.VCConfigXsdResourcePath; break; default: break; } if (!string.IsNullOrEmpty(pathToXsd)) { ConfigurationValidator configValidator = new ConfigurationValidator(); configValidator.ValidateXmlFragment(string.Empty, settingDoc.DocumentElement, pathToXsd); var sessionConfigValidateResult = configValidator.ValidationResult; if (!sessionConfigValidateResult.IsValid) { throw new ConfigurationSchemaViolationException(sessionConfigValidateResult); } } } }
public void StartSingleSessionInSessionGroup(Guid sessionGroupUniqueId, Guid sessionUniqueId) { try { lock (m_runningSessionGroupsLock) { PollLivenessAndUpdateHostedSessionGroups(); // mark session group init status to be Starting if (!m_sessionGroupInitializationStatus.ContainsKey(sessionGroupUniqueId)) { m_sessionGroupInitializationStatus.Add(sessionGroupUniqueId, SessionGroupInitializationStatus.Initializing); } else { m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.Initializing; } if (IsSessionGroupObsoleteOrDeleted(sessionGroupUniqueId)) { TraceManager.TraceError(MigrationToolkitResources.ErrorRestartDeletedSessionGroup, sessionGroupUniqueId.ToString()); m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.NotInitialized; return; } else if (IsSessionGroupOneTimeCompleted(sessionGroupUniqueId)) { TraceManager.TraceError(MigrationToolkitResources.ErrorRestartOneTimeCompleteSessionGroup, sessionGroupUniqueId.ToString()); m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.NotInitialized; return; } TraceManager.TraceInformation("StartSingleSessionInSessionGroup: Enter with sessionGroupUniqueId: {0}, sessionUniqueId: {1}", sessionGroupUniqueId.ToString(), sessionUniqueId.ToString()); using (RuntimeEntityModel context = RuntimeEntityModel.CreateInstance()) { var sessionQuery = from s in context.RTSessionSet where s.SessionUniqueId.Equals(sessionUniqueId) && s.SessionGroup.GroupUniqueId.Equals(sessionGroupUniqueId) select s; if (sessionQuery.Count() == 0) { return; } sessionQuery.First().State = (int)BusinessModelManager.SessionStateEnum.StartedInStandaloneProcess; context.TrySaveChanges(); } // Create a SyncOrchestrator if we don't already have one servicing the referenced SessionGroup if (!m_runningSessionGroups.ContainsKey(sessionGroupUniqueId)) { TraceManager.TraceInformation("StartSessionGroup: Creating new SyncOrchestrator"); BusinessModelManager businessModelManager = new BusinessModelManager(); Configuration configuration = businessModelManager.LoadConfiguration(sessionGroupUniqueId); List <Guid> sessionIdsToExclude = new List <Guid>(); foreach (var session in configuration.SessionGroup.Sessions.Session) { var sessionId = new Guid(session.SessionUniqueId); if (sessionId.Equals(sessionUniqueId)) { continue; } sessionIdsToExclude.Add(sessionId); } // extract only the session we need ExcludeSessionFromGroupInConfig(configuration, sessionIdsToExclude.ToArray()); SyncOrchestrator syncOrchestrator = new SyncOrchestrator(configuration); // phase1 light-weight initialization syncOrchestrator.ConstructPipelines(); // phase2 heavy-weight initialization syncOrchestrator.InitializePipelines(); syncOrchestrator.CleanUpSyncOrchStatus(); TraceManager.TraceInformation("StartSessionGroup: Starting SyncOrchestrator; now {0} running sessions", m_runningSessionGroups.Count); syncOrchestrator.Start(); m_runningSessionGroups.Add(sessionGroupUniqueId, syncOrchestrator); m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.Initialized; } } } catch (Exception e) { TraceManager.TraceException(e); m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.NotInitialized; } }
public Endpoint( MonitorWatcher watcher, RuntimeEntityModel context, RTSession rtSession, RTMigrationSource rtMigrationSource, bool isRightMigrationSource, RTMigrationSource peerMigrationSource) { m_monitorWatcher = watcher; // TODO: Consider moving all of this initialization code to a new EndpointContext class that contains everything that the // Poll() method needs to do its job, and then have MonitorWatcher.GetEndpoints() pass the EndpointContext object as the single // arg to this constructor. this.Context = context; this.RTMigrationSource = rtMigrationSource; this.IsRightMigrationSource = isRightMigrationSource; this.PeerRTMigrationSource = peerMigrationSource; BusinessModelManager businessModelManager = new BusinessModelManager(); if (rtSession.SessionGroup == null) { rtSession.SessionGroupReference.Load(); } Config = businessModelManager.LoadConfiguration(rtSession.SessionGroup.GroupUniqueId); if (Config == null) { throw new ApplicationException( String.Format(CultureInfo.InvariantCulture, MigrationToolkitResources.SessionGroupNotFound, rtSession.SessionGroup.GroupUniqueId.ToString())); } // TODO: Modify ProdviderManager to take a constructor that does not require a Config and that just loads // all providers in the Plugins directory, then move this code up to the MonitorWatcher constructor and pass the // providerHandlers down as another argument to this constructor ProviderManager providerManager = new ProviderManager(Config); Dictionary <Guid, ProviderHandler> providerHandlers = providerManager.LoadProvider(new DirectoryInfo(Constants.PluginsFolderName)); ProviderHandler providerHandler; if (!providerHandlers.TryGetValue(this.RTMigrationSource.UniqueId, out providerHandler)) { throw new Exception(string.Format(CultureInfo.InvariantCulture, MigrationToolkitResources.ProviderHandlerNotLoadedForMigrationSouce, this.RTMigrationSource.FriendlyName)); } Debug.Assert(providerHandler.Provider != null); SyncMonitorProvider = providerHandler.Provider.GetService(typeof(ISyncMonitorProvider)) as ISyncMonitorProvider; if (SyncMonitorProvider == null) { throw new NotImplementedException(string.Format(CultureInfo.InvariantCulture, MigrationToolkitResources.ProviderDoesNotImplementISyncMonitor, providerHandler.ProviderName)); } // Find the Session object corresponding to the RTSession if (Config.SessionGroup != null && Config.SessionGroup.Sessions != null) { foreach (var aSession in Config.SessionGroup.Sessions.Session) { if (string.Equals(aSession.SessionUniqueId, rtSession.SessionUniqueId.ToString(), StringComparison.Ordinal)) { Session = aSession; break; } } } if (Session == null) { throw new Exception(string.Format(CultureInfo.InvariantCulture, MigrationToolkitResources.SessionNotFoundForMigrationSource, rtSession.SessionGroup.GroupUniqueId.ToString(), RTMigrationSource.FriendlyName)); } Guid migrationSourceGuid = new Guid(isRightMigrationSource ? Session.RightMigrationSourceUniqueId : Session.LeftMigrationSourceUniqueId); Microsoft.TeamFoundation.Migration.BusinessModel.MigrationSource migrationSource = Config.GetMigrationSource(migrationSourceGuid); Session.MigrationSources.Add(migrationSourceGuid, migrationSource); var serviceContainer = new ServiceContainer(); serviceContainer.AddService(typeof(ITranslationService), new SyncMonitorTranslationService(Session)); // We pass null for the global Configuration to the ConfigurationService constructor because its not handy and not needed in this context serviceContainer.AddService(typeof(ConfigurationService), new ConfigurationService(null, Session, migrationSourceGuid)); SyncMonitorProvider.InitializeServices(serviceContainer); SyncMonitorProvider.InitializeClient(migrationSource); int filterPairIndex = IsRightMigrationSource ? 1 : 0; foreach (var filterPair in Session.Filters.FilterPair) { if (!filterPair.Neglect) { m_filterStrings.Add(VCTranslationService.TrimTrailingPathSeparator(filterPair.FilterItem[filterPairIndex].FilterString)); } } }
/// <summary> /// Loads the active configuration for the specified session. /// </summary> /// <param name="sessionGroupId">Identifier for the session group</param> /// <returns>A Configuration object populated with the desired configuration.</returns> public static Configuration LoadActiveConfiguration(int sessionGroupId) { BusinessModelManager manager = new BusinessModelManager(); return(manager.LoadActiveConfiguration(sessionGroupId)); }
/// <summary> /// Loads the configuration for the specified configuration id. /// </summary> /// <param name="internalConfigurationId">Identifier for the configuration</param> /// <returns>A Configuration object populated with the desired configuration.</returns> public static Configuration LoadConfiguration(int internalConfigurationId) { BusinessModelManager manager = new BusinessModelManager(); return(manager.LoadConfiguration(internalConfigurationId)); }
public void StartSessionGroup(Guid sessionGroupUniqueId) { try { lock (m_runningSessionGroupsLock) { TraceManager.TraceInformation("StartSessionGroup: Enter with sessionGroupUniqueId: {0}", sessionGroupUniqueId); PollLivenessAndUpdateHostedSessionGroups(); // Create a SyncOrchestrator if we don't already have one servicing the referenced SessionGroup if (!m_runningSessionGroups.ContainsKey(sessionGroupUniqueId)) { // mark session group init status to be Starting if (!m_sessionGroupInitializationStatus.ContainsKey(sessionGroupUniqueId)) { m_sessionGroupInitializationStatus.Add(sessionGroupUniqueId, SessionGroupInitializationStatus.Initializing); } else { m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.Initializing; } if (IsSessionGroupObsoleteOrDeleted(sessionGroupUniqueId)) { TraceManager.TraceError(MigrationToolkitResources.ErrorRestartDeletedSessionGroup, sessionGroupUniqueId.ToString()); m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.NotInitialized; return; } else if (IsSessionGroupOneTimeCompleted(sessionGroupUniqueId)) { TraceManager.TraceError(MigrationToolkitResources.ErrorRestartOneTimeCompleteSessionGroup, sessionGroupUniqueId.ToString()); m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.NotInitialized; return; } TraceManager.TraceInformation("StartSessionGroup: Creating new SyncOrchestrator"); BusinessModelManager businessModelManager = new BusinessModelManager(); Configuration configuration = businessModelManager.LoadConfiguration(sessionGroupUniqueId); // exclude sessions that are started in standalone process Guid[] standaloneSessionsInGroup = new Guid[0]; using (RuntimeEntityModel context = RuntimeEntityModel.CreateInstance()) { int StartedInStandaloneProcessState = (int)BusinessModelManager.SessionStateEnum.StartedInStandaloneProcess; var sessionQuery = from s in context.RTSessionSet where s.State == StartedInStandaloneProcessState && s.SessionGroup.GroupUniqueId.Equals(sessionGroupUniqueId) select s.SessionUniqueId; if (sessionQuery.Count() > 0) { standaloneSessionsInGroup = sessionQuery.ToArray(); } } ExcludeSessionFromGroupInConfig(configuration, standaloneSessionsInGroup); SyncOrchestrator syncOrchestrator = new SyncOrchestrator(configuration); // phase1 light-weight initialization syncOrchestrator.ConstructPipelines(); // phase2 heavy-weight initialization syncOrchestrator.InitializePipelines(); // clean-up the sync orchestration status and command queue, in case // previous session process aborted syncOrchestrator.CleanUpSyncOrchStatus(); TraceManager.TraceInformation("StartSessionGroup: Starting SyncOrchestrator; now {0} running sessions", m_runningSessionGroups.Count); syncOrchestrator.Start(); m_runningSessionGroups.Add(sessionGroupUniqueId, syncOrchestrator); m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.Initialized; } } } catch (Exception e) { TraceManager.TraceException(e); m_sessionGroupInitializationStatus[sessionGroupUniqueId] = SessionGroupInitializationStatus.NotInitialized; } }