/// <summary>
 /// Creates an instance of a queue manager.
 /// </summary>
 /// <param name="projectIntegratorListFactory">The integrator factory.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="stateManager">The state manager to use.</param>
 /// <returns>The new queue manager.</returns>
 public virtual IQueueManager Create(IProjectIntegratorListFactory projectIntegratorListFactory,
     IConfiguration configuration,
     IProjectStateManager stateManager)
 {
     IQueueManager integrationQueueManager = new IntegrationQueueManager(projectIntegratorListFactory, configuration, stateManager);
     return integrationQueueManager;
 }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CruiseServer" /> class.	
        /// </summary>
        /// <param name="configurationService">The configuration service.</param>
        /// <param name="projectIntegratorListFactory">The project integrator list factory.</param>
        /// <param name="projectSerializer">The project serializer.</param>
        /// <param name="stateManager">The state manager.</param>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="executionEnvironment">The execution environment.</param>
        /// <param name="extensionList">The extension list.</param>
        /// <remarks></remarks>
        public CruiseServer(IConfigurationService configurationService,
                            IProjectIntegratorListFactory projectIntegratorListFactory,
                            IProjectSerializer projectSerializer,
                            IProjectStateManager stateManager,
                            IFileSystem fileSystem,
                            IExecutionEnvironment executionEnvironment,
                            List<ExtensionConfiguration> extensionList)
        {
            this.configurationService = configurationService;
            this.projectSerializer = projectSerializer;
            this.fileSystem = fileSystem;
            this.executionEnvironment = executionEnvironment;

            // Leave the manager for backwards compatability - it is marked as obsolete
#pragma warning disable 0618
            manager = new CruiseManager(this);
#pragma warning restore 0618
            serverClient = new CruiseServerClient(this);
            InitializeServerThread();

            // Initialise the configuration
            configuration = configurationService.Load();

            // Initialise the queue manager
            integrationQueueManager = IntegrationQueueManagerFactory.CreateManager(projectIntegratorListFactory, configuration, stateManager);
            integrationQueueManager.AssociateIntegrationEvents(OnIntegrationStarted, OnIntegrationCompleted);
            securityManager = configuration.SecurityManager;

            // Load the extensions
            if (extensionList != null)
            {
                InitialiseExtensions(extensionList);
            }

            this.configurationService.AddConfigurationUpdateHandler(Restart);
            programmDataFolder = this.executionEnvironment.GetDefaultProgramDataFolder(ApplicationType.Server);

            // Initialise the cache time
            var cacheTimeInConfig = ConfigurationManager.AppSettings["cacheTime"];
            if (string.IsNullOrEmpty(cacheTimeInConfig))
            {
                // Set the default cache time to five minutes
                this.cacheTime = new TimeSpan(0, 5, 0);
                Log.Info("Log cache time set to 5 minutes");
            }
            else
            {
                this.cacheTime = TimeSpan.FromSeconds(Convert.ToDouble(cacheTimeInConfig, CultureInfo.CurrentCulture));
                if (this.cacheTime.TotalSeconds < 5)
                {
                    // If the cache time is less then 5s then turn off caching
                    this.cacheTime = TimeSpan.MinValue;
                    Log.Info("Log cache has been turned off");
                }
                else
                {
                    Log.Info("Log cache time set to " + this.cacheTime.TotalSeconds.ToString(CultureInfo.CurrentCulture) + " seconds");
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Creates an instance of a queue manager.
        /// </summary>
        /// <param name="projectIntegratorListFactory">The integrator factory.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="stateManager">The state manager to use.</param>
        /// <returns>The new queue manager.</returns>
        public virtual IQueueManager Create(IProjectIntegratorListFactory projectIntegratorListFactory,
                                            IConfiguration configuration,
                                            IProjectStateManager stateManager)
        {
            IQueueManager integrationQueueManager = new IntegrationQueueManager(projectIntegratorListFactory, configuration, stateManager);

            return(integrationQueueManager);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IntegrationQueueManager" /> class.	
        /// </summary>
        /// <param name="projectIntegratorListFactory">The project integrator list factory.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="stateManager">The state manager.</param>
        /// <remarks></remarks>
		public IntegrationQueueManager(IProjectIntegratorListFactory projectIntegratorListFactory,
		                               IConfiguration configuration,
                                       IProjectStateManager stateManager)
		{
			this.projectIntegratorListFactory = projectIntegratorListFactory;
			Initialize(configuration);
            this.stateManager = stateManager;
		}
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IntegrationQueueManager" /> class.
 /// </summary>
 /// <param name="projectIntegratorListFactory">The project integrator list factory.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="stateManager">The state manager.</param>
 /// <remarks></remarks>
 public IntegrationQueueManager(IProjectIntegratorListFactory projectIntegratorListFactory,
                                IConfiguration configuration,
                                IProjectStateManager stateManager)
 {
     this.projectIntegratorListFactory = projectIntegratorListFactory;
     Initialize(configuration);
     this.stateManager = stateManager;
 }
 /// <summary>
 /// Generates a queue manager using the default factory.
 /// </summary>
 /// <param name="projectIntegratorListFactory">The integrator factory.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="stateManager">The state manager to use.</param>
 /// <returns>The new queue manager.</returns>
 public static IQueueManager CreateManager(IProjectIntegratorListFactory projectIntegratorListFactory,
     IConfiguration configuration,
     IProjectStateManager stateManager)
 {
     return managerFactory.Create(projectIntegratorListFactory, configuration, stateManager);
 }
Esempio n. 7
0
 /// <summary>
 /// Generates a queue manager using the default factory.
 /// </summary>
 /// <param name="projectIntegratorListFactory">The integrator factory.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="stateManager">The state manager to use.</param>
 /// <returns>The new queue manager.</returns>
 public static IQueueManager CreateManager(IProjectIntegratorListFactory projectIntegratorListFactory,
                                           IConfiguration configuration,
                                           IProjectStateManager stateManager)
 {
     return(managerFactory.Create(projectIntegratorListFactory, configuration, stateManager));
 }