CruiseServerEventsBase.cs :  » Build-Systems » CruiseControl.NET » ThoughtWorks » CruiseControl » Core » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Build Systems » CruiseControl.NET 
CruiseControl.NET » ThoughtWorks » CruiseControl » Core » CruiseServerEventsBase.cs

using System;
using ThoughtWorks.CruiseControl.Remote;
using ThoughtWorks.CruiseControl.Remote.Events;

namespace ThoughtWorks.CruiseControl.Core{
    /// <summary>
    /// Provides a base implementation of all the events required for <see cref="ICruiseServer"/>.
    /// </summary>
    public abstract class CruiseServerEventsBase
    {
        #region Events
        /// <summary>
        /// A project is starting.
        /// </summary>
        public event EventHandler<CancelProjectEventArgs> ProjectStarting;

        /// <summary>
        /// A project has started.
        /// </summary>
        public event EventHandler<ProjectEventArgs> ProjectStarted;

        /// <summary>
        /// A project is stopping.
        /// </summary>
        public event EventHandler<CancelProjectEventArgs> ProjectStopping;

        /// <summary>
        /// A project has stopped.
        /// </summary>
        public event EventHandler<ProjectEventArgs> ProjectStopped;

        /// <summary>
        /// A force build has been received.
        /// </summary>
        public event EventHandler<CancelProjectEventArgs<string>> ForceBuildReceived;

        /// <summary>
        /// A force build has been processed.
        /// </summary>
        public event EventHandler<ProjectEventArgs<string>> ForceBuildProcessed;

        /// <summary>
        /// An abort build has been received.
        /// </summary>
        public event EventHandler<CancelProjectEventArgs<string>> AbortBuildReceived;

        /// <summary>
        /// An abort build has been processed.
        /// </summary>
        public event EventHandler<ProjectEventArgs<string>> AbortBuildProcessed;

        /// <summary>
        /// A send message has been received.
        /// </summary>
        public event EventHandler<CancelProjectEventArgs<Message>> SendMessageReceived;

        /// <summary>
        /// A send message has been processed.
        /// </summary>
        public event EventHandler<ProjectEventArgs<Message>> SendMessageProcessed;

        /// <summary>
        /// A project integrator is starting an integration.
        /// </summary>
        public event EventHandler<IntegrationStartedEventArgs> IntegrationStarted;

        /// <summary>
        /// A project integrator has completed an integration.
        /// </summary>
        public event EventHandler<IntegrationCompletedEventArgs> IntegrationCompleted;
        #endregion

        #region Event triggers
        #region StartProject
        /// <summary>
        /// Fires the ProjectStarting event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <returns>Whether this event was canceled or not.</returns>
        protected virtual bool FireProjectStarting(string projectName)
        {
            bool isCanceled = false;
            if (ProjectStarting != null)
            {
                CancelProjectEventArgs args = new CancelProjectEventArgs(projectName);
                ProjectStarting(this, args);
                isCanceled = args.Cancel;
            }
            return isCanceled;
        }

        /// <summary>
        /// Fires the ProjectStarted event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        protected virtual void FireProjectStarted(string projectName)
        {
            if (ProjectStarted != null)
            {
                ProjectEventArgs args = new ProjectEventArgs(projectName);
                ProjectStarted(this, args);
            }
        }
        #endregion

        #region StopProject
        /// <summary>
        /// Fires the ProjectStopping event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <returns>Whether this event was canceled or not.</returns>
        protected virtual bool FireProjectStopping(string projectName)
        {
            bool isCanceled = false;
            if (ProjectStopping != null)
            {
                CancelProjectEventArgs args = new CancelProjectEventArgs(projectName);
                ProjectStopping(this, args);
                isCanceled = args.Cancel;
            }
            return isCanceled;
        }

        /// <summary>
        /// Fires the ProjectStopped event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        protected virtual void FireProjectStopped(string projectName)
        {
            if (ProjectStopped != null)
            {
                ProjectEventArgs args = new ProjectEventArgs(projectName);
                ProjectStopped(this, args);
            }
        }
        #endregion

        #region ForceBuild
        /// <summary>
        /// Fires the ForceBuildReceived event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <param name="enforcerName">The name of the person forcing the build.</param>
        /// <returns>Whether this event was canceled or not.</returns>
        protected virtual bool FireForceBuildReceived(string projectName, string enforcerName)
        {
            bool isCanceled = false;
            if (ForceBuildReceived != null)
            {
                CancelProjectEventArgs<string> args = new CancelProjectEventArgs<string>(projectName, enforcerName);
                ForceBuildReceived(this, args);
                isCanceled = args.Cancel;
            }
            return isCanceled;
        }

        /// <summary>
        /// Fires the ForceBuildProcessed event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <param name="enforcerName">The name of the person forcing the build.</param>
        protected virtual void FireForceBuildProcessed(string projectName, string enforcerName)
        {
            if (ForceBuildProcessed != null)
            {
                ProjectEventArgs<string> args = new ProjectEventArgs<string>(projectName, enforcerName);
                ForceBuildProcessed(this, args);
            }
        }
        #endregion

        #region AbortBuild
        /// <summary>
        /// Fires the AbortBuildReceived event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <param name="enforcerName">The name of the person aborting the build.</param>
        /// <returns>Whether this event was canceled or not.</returns>
        protected virtual bool FireAbortBuildReceived(string projectName, string enforcerName)
        {
            bool isCanceled = false;
            if (AbortBuildReceived != null)
            {
                CancelProjectEventArgs<string> args = new CancelProjectEventArgs<string>(projectName, enforcerName);
                AbortBuildReceived(this, args);
                isCanceled = args.Cancel;
            }
            return isCanceled;
        }

        /// <summary>
        /// Fires the AbortBuildProcessed event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <param name="enforcerName">The name of the person aborting the build.</param>
        protected virtual void FireAbortBuildProcessed(string projectName, string enforcerName)
        {
            if (AbortBuildProcessed != null)
            {
                ProjectEventArgs<string> args = new ProjectEventArgs<string>(projectName, enforcerName);
                AbortBuildProcessed(this, args);
            }
        }
        #endregion

        #region SendMessage
        /// <summary>
        /// Fires the SendMessageReceived event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <param name="message">The message to be sent.</param>
        /// <returns>Whether this event was canceled or not.</returns>
        protected virtual bool FireSendMessageReceived(string projectName, Message message)
        {
            bool isCanceled = false;
            if (SendMessageReceived != null)
            {
                CancelProjectEventArgs<Message> args = new CancelProjectEventArgs<Message>(projectName, message);
                SendMessageReceived(this, args);
                isCanceled = args.Cancel;
            }
            return isCanceled;
        }

        /// <summary>
        /// Fires the SendMessageProcessed event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <param name="message">The message that was sent.</param>
        protected virtual void FireSendMessageProcessed(string projectName, Message message)
        {
            if (SendMessageProcessed != null)
            {
                ProjectEventArgs<Message> args = new ProjectEventArgs<Message>(projectName, message);
                SendMessageProcessed(this, args);
            }
        }
        #endregion

        #region Integration
        /// <summary>
        /// Fires the IntegrationStarted event.
        /// </summary>
        /// <param name="request">The integration request.</param>
        /// <param name="projectName"></param>
        protected virtual IntegrationStartedEventArgs.EventResult FireIntegrationStarted(IntegrationRequest request, string projectName)
        {
            IntegrationStartedEventArgs.EventResult result = IntegrationStartedEventArgs.EventResult.Continue;
            if (IntegrationStarted != null)
            {
                IntegrationStartedEventArgs args = new IntegrationStartedEventArgs(request, projectName);
                IntegrationStarted(this, args);
                result = args.Result;
            }
            return result;
        }

        /// <summary>
        /// Fires the IntegrationCompleted event.
        /// </summary>
        /// <param name="request">The integration request.</param>
        /// <param name="projectName">The name of the project.</param>
        /// <param name="status">The outcome of the integration.</param>
        protected virtual void FireIntegrationCompleted(IntegrationRequest request, string projectName, IntegrationStatus status)
        {
            if (IntegrationCompleted != null)
            {
                IntegrationCompletedEventArgs args = new IntegrationCompletedEventArgs(request, projectName, status);
                IntegrationCompleted(this, args);
            }
        }
        #endregion
        #endregion
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.