/// <summary> /// Perform startup duties associated with this tracking service. /// <remarks> /// This implementation calls a virtual method to create a single /// resource provider for this tracking service and initialises /// a timer to poll for tracking profile changes. /// </remarks> /// </summary> protected override void Start() { TraceHelper.Trace(); try { // retrieve the active resource provider this.resourceProvider = CreateResourceProvider(); // configure the profile change poll timer this.profileChangeTimer = new Timer(profileChangeInterval.TotalMilliseconds); this.profileChangeTimer.AutoReset = false; this.profileChangeTimer.Elapsed += profileChangeTimer_Elapsed; this.profileChangeTimer.Start(); base.Start(); } catch (Exception e) { string errorMessage = RM.Get_Error_TrackingServiceException(e.ToString()); TraceHelper.Trace(errorMessage); TrackingException trackingException = new TrackingException(errorMessage, e); base.RaiseServicesExceptionNotHandledEvent( trackingException, Guid.Empty); throw trackingException; } }
///<summary> ///Must be overridden in the derived class, and when implemented, returns the tracking profile for the specified workflow instance. ///</summary> /// ///<returns> ///A <see cref="T:System.Workflow.Runtime.Tracking.TrackingProfile"></see>. ///</returns> /// ///<param name="workflowInstanceId">The <see cref="T:System.Guid"></see> of the workflow instance.</param> protected override TrackingProfile GetProfile(Guid workflowInstanceId) { TraceHelper.Trace(); TrackingProfile trackingProfile; try { using (ITrackingServiceResourceAccessor resourceAccessor = CreateAccessor(resourceProvider)) { trackingProfile = resourceAccessor.GetTrackingProfile(workflowInstanceId); } } catch (Exception e) { string errorMessage = RM.Get_Error_TrackingServiceException(e.ToString()); TraceHelper.Trace(errorMessage); TrackingException trackingException = new TrackingException(errorMessage, e); base.RaiseServicesExceptionNotHandledEvent( trackingException, workflowInstanceId); throw trackingException; } return(trackingProfile); }
///<summary> ///Must be overridden in the derived class, and when implemented, retrieves a new tracking profile for the specified workflow instance if the tracking profile has changed since it was last loaded. ///</summary> /// ///<returns> ///true if a new <see cref="T:System.Workflow.Runtime.Tracking.TrackingProfile"></see> should be loaded; otherwise, false. If true, the <see cref="T:System.Workflow.Runtime.Tracking.TrackingProfile"></see> is returned in profile. ///</returns> /// ///<param name="workflowType">The <see cref="T:System.Type"></see> of the workflow instance.</param> ///<param name="profile">When this method returns, contains the <see cref="T:System.Workflow.Runtime.Tracking.TrackingProfile"></see> to load. This parameter is passed un-initialized.</param> ///<param name="workflowInstanceId">The <see cref="T:System.Guid"></see> of the workflow instance.</param> protected override bool TryReloadProfile(Type workflowType, Guid workflowInstanceId, out TrackingProfile profile) { TraceHelper.Trace(); try { using (ITrackingServiceResourceAccessor resourceAccessor = CreateAccessor(resourceProvider)) { return(resourceAccessor.TryReloadTrackingProfile(workflowType, workflowInstanceId, out profile)); } } catch (Exception e) { string errorMessage = RM.Get_Error_TrackingServiceException(e.ToString()); TraceHelper.Trace(errorMessage); TrackingException trackingException = new TrackingException(errorMessage, e); base.RaiseServicesExceptionNotHandledEvent( trackingException, Guid.Empty); throw trackingException; } }
/// <summary> /// Perform shutdown duties associated with this tracking service. /// </summary> protected override void Stop() { TraceHelper.Trace(); try { if (this.profileChangeTimer != null) { this.profileChangeTimer.Dispose(); this.profileChangeTimer = null; } base.Stop(); } catch (Exception e) { string errorMessage = RM.Get_Error_TrackingServiceException(e.ToString()); TraceHelper.Trace(errorMessage); TrackingException trackingException = new TrackingException(errorMessage, e); base.RaiseServicesExceptionNotHandledEvent( trackingException, Guid.Empty); throw trackingException; } }
///<summary> ///Must be overridden in the derived class, and when implemented, retrieves a new tracking profile for the specified workflow instance if the tracking profile has changed since it was last loaded. ///</summary> /// ///<returns> ///true if a new <see cref="T:System.Workflow.Runtime.Tracking.TrackingProfile"></see> should be loaded; otherwise, false. If true, the <see cref="T:System.Workflow.Runtime.Tracking.TrackingProfile"></see> is returned in profile. ///</returns> /// ///<param name="workflowType">The <see cref="T:System.Type"></see> of the workflow instance.</param> ///<param name="profile">When this method returns, contains the <see cref="T:System.Workflow.Runtime.Tracking.TrackingProfile"></see> to load. This parameter is passed un-initialized.</param> ///<param name="workflowInstanceId">The <see cref="T:System.Guid"></see> of the workflow instance.</param> protected override bool TryReloadProfile(Type workflowType, Guid workflowInstanceId, out TrackingProfile profile) { TraceHelper.Trace(); try { using (ITrackingServiceResourceAccessor resourceAccessor = CreateAccessor(resourceProvider)) { return resourceAccessor.TryReloadTrackingProfile(workflowType, workflowInstanceId, out profile); } } catch (Exception e) { string errorMessage = RM.Get_Error_TrackingServiceException(e.ToString()); TraceHelper.Trace(errorMessage); TrackingException trackingException = new TrackingException(errorMessage, e); base.RaiseServicesExceptionNotHandledEvent( trackingException, Guid.Empty); throw trackingException; } }
///<summary> ///Must be overridden in the derived class, and when implemented, returns the tracking profile for the specified workflow instance. ///</summary> /// ///<returns> ///A <see cref="T:System.Workflow.Runtime.Tracking.TrackingProfile"></see>. ///</returns> /// ///<param name="workflowInstanceId">The <see cref="T:System.Guid"></see> of the workflow instance.</param> protected override TrackingProfile GetProfile(Guid workflowInstanceId) { TraceHelper.Trace(); TrackingProfile trackingProfile; try { using (ITrackingServiceResourceAccessor resourceAccessor = CreateAccessor(resourceProvider)) { trackingProfile = resourceAccessor.GetTrackingProfile(workflowInstanceId); } } catch (Exception e) { string errorMessage = RM.Get_Error_TrackingServiceException(e.ToString()); TraceHelper.Trace(errorMessage); TrackingException trackingException = new TrackingException(errorMessage, e); base.RaiseServicesExceptionNotHandledEvent( trackingException, workflowInstanceId); throw trackingException; } return trackingProfile; }