/// <summary>Uninitializes this object.</summary> /// <param name="force">Indicates if the uninitialization shall be forced.</param> private static void Uninitialize(bool force) { lock (_initializationLock) { if (_initializationCount < 2 || force) { IDisposable disposable = _requestProcessor as IDisposable; if (disposable != null) { disposable.Dispose(); } if (_t2gManager != null) { _t2gManager.Dispose(); _t2gManager = null; } _remoteDataStoreFactory = null; _rtpisDataStore = null; _sessionManager = null; _notificationSender = null; _instanceCreator = null; _requestProcessor = null; } } if (_initializationCount != 0 && !force) { _initializationCount--; } }
/// <summary> /// Initializes a new instance of the <see cref="DataPackageServiceStub"/> class. /// </summary> /// <param name="sessionManager">The session manager.</param> /// <param name="notificationSender">The notification sender.</param> /// <param name="t2gManager">The T2G manager.</param> /// <param name="requestsFactory">The requests factory.</param> /// <param name="remoteDataStoreFactory">The remote data store factory.</param> /// <param name="requestManager">The request manager.</param> /// <param name="baselineStatusUpdater">The baseline status updater.</param> public DataPackageServiceStub(ISessionManager sessionManager, INotificationSender notificationSender, IT2GManager t2gManager, IRequestContextFactory requestsFactory, IRemoteDataStoreFactory remoteDataStoreFactory, IRequestManager requestManager, BaselineStatusUpdater baselineStatusUpdater) : base(sessionManager, notificationSender, t2gManager, requestsFactory, remoteDataStoreFactory, requestManager, baselineStatusUpdater) { // No logic body. }
/// <summary>Initializes a new instance of the RealTimeService class.</summary> /// <param name="t2gManager">The manager to interact with T2G application.</param> /// <param name="sessionManager">Manager for session.</param> /// <param name="notificationSender">The object to use to send notifications.</param> /// <param name="requestProcessor">The request processor instance.</param> /// <param name="remoteDataStoreFactory">The remote data store factory.</param> /// <param name="rtpisDataStore">The rtpis data store.</param> public RealTimeService( IT2GManager t2gManager, ISessionManagerExtended sessionManager, INotificationSender notificationSender, IRequestProcessor requestProcessor, IRemoteDataStoreFactory remoteDataStoreFactory, IRTPISDataStore rtpisDataStore) { Initialize(this, t2gManager, sessionManager, notificationSender, requestProcessor, remoteDataStoreFactory, rtpisDataStore); }
/// <summary> /// Initializes a new instance of the BaselineDistributingRequestContextProcessor class. /// </summary> /// <exception cref="ArgumentNullException">Thrown when one or more required arguments are null.</exception> /// <param name="remoteDataStoreFactory">The remote data store factory.</param> /// <param name="trainToGroundManager">Manager for train to ground.</param> public BaselineDistributingRequestContextProcessor(IRemoteDataStoreFactory remoteDataStoreFactory, IT2GManager trainToGroundManager, BaselineStatusUpdater baselineStatusUpdater) { if (null == remoteDataStoreFactory) { throw new ArgumentNullException("remoteDataStoreFactory"); } else if (null == trainToGroundManager) { throw new ArgumentNullException("trainToGroundManager"); } else if (null == baselineStatusUpdater) { throw new ArgumentNullException("baselineStatusUpdater"); } _remoteDataStoreFactory = remoteDataStoreFactory; _trainToGroundManager = trainToGroundManager; _baselineStatusUpdater = baselineStatusUpdater; }
/// <summary>Initializes a new instance of the RequestContextFactory class.</summary> public RequestContextFactory(IT2GManager t2gManager, IRemoteDataStoreFactory remoteDataStoreFactory, BaselineStatusUpdater baselineStatusUpdater) { if (t2gManager == null) { throw new ArgumentNullException("t2gManager"); } else if (remoteDataStoreFactory == null) { throw new ArgumentNullException("remoteDataStoreFactory"); } else if (baselineStatusUpdater == null) { throw new ArgumentNullException("baselineStatusUpdater"); } _t2gManager = t2gManager; _remoteDataStoreFactory = remoteDataStoreFactory; _baselineStatusUpdater = baselineStatusUpdater; }
/// <summary>Initializes this object.</summary> private void Initialize() { lock (_initializationLock) { if (_initializationCount == 0) { try { _instanceCreator = this; _sessionManager = new SessionManager(); _notificationSender = new NotificationSender(_sessionManager); _t2gManager = T2GManagerContainer.T2GManager; _remoteDataStoreFactory = new RemoteDataStoreFactory(); _rtpisDataStore = new RTPISDataStore(); _requestProcessor = new RequestProcessor( _t2gManager, _rtpisDataStore); _initializationCount = 1; } catch (System.Exception e) { Uninitialize(true); LogManager.WriteLog(TraceType.ERROR, e.Message, "PIS.Ground.RealTime.RealTimeService.Initialize", e, EventIdEnum.RealTime); } } else { _initializationCount++; } } }
/// <summary>Initializes this object.</summary> /// <param name="instance">The instance that create this object</param> /// <param name="t2gManager">The manager to interact with T2G application.</param> /// <param name="sessionManager">Manager for session.</param> /// <param name="notificationSender">The object to use to send notifications.</param> /// <param name="requestProcessor">The request processor instance.</param> /// <param name="remoteDataStoreFactory">The remote data store factory.</param> /// <param name="rtpisDataStore">The rtpis data store.</param> private static void Initialize( RealTimeService instance, IT2GManager t2gManager, ISessionManagerExtended sessionManager, INotificationSender notificationSender, IRequestProcessor requestProcessor, IRemoteDataStoreFactory remoteDataStoreFactory, IRTPISDataStore rtpisDataStore) { if (instance == null) { throw new ArgumentNullException("instance"); } if (t2gManager == null) { throw new ArgumentNullException("t2gManager"); } if (sessionManager == null) { throw new ArgumentNullException("sessionManager"); } if (notificationSender == null) { throw new ArgumentNullException("notificationSender"); } if (requestProcessor == null) { throw new ArgumentNullException("requestProcessor"); } if (remoteDataStoreFactory == null) { throw new ArgumentNullException("remoteDataStoreFactory"); } if (rtpisDataStore == null) { throw new ArgumentNullException("rtpisDataStore"); } lock (_initializationLock) { try { if (_initializationCount != 0) { Uninitialize(true); } RealTimeService._instanceCreator = instance; RealTimeService._t2gManager = t2gManager; RealTimeService._sessionManager = sessionManager; RealTimeService._notificationSender = notificationSender; RealTimeService._remoteDataStoreFactory = remoteDataStoreFactory; RealTimeService._rtpisDataStore = rtpisDataStore; RealTimeService._requestProcessor = requestProcessor; _initializationCount++; } catch (System.Exception e) { Uninitialize(true); LogManager.WriteLog(TraceType.ERROR, e.Message, "PIS.Ground.RealTime.RealTimeService.Initialize", e, EventIdEnum.RealTime); } } }