/// <summary>
        /// Starts this service instance.
        /// </summary>
        /// <param name="args">The <see cref="CommandLineArguments" /> provided to the start command.</param>
        protected override void StartService(CommandLineArguments args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            // Load the settings, either from the command line or the local cache
            FrameworkServiceHelper.LoadSettings(args);

            Task.Factory.StartNew(() =>
            {
                TraceFactory.Logger.Debug("Updating Server Info");
                FrameworkServiceHelper.UpdateServerInfo();
                TraceFactory.Logger.Debug("Updating Server Info - Complete");
            });
            // Load and start the print monitor service
            _printMonitorService = new WcfHost <IPrintMonitorService>(
                typeof(PrintMonitorService),
                MessageTransferType.Http,
                WcfService.PrintMonitor.GetLocalHttpUri());

            _printMonitorService.Open();
            PrintMonitorService.Instance.Start();
        }
        /// <summary>
        /// Starts this service instance.
        /// </summary>
        /// <param name="args">The <see cref="CommandLineArguments" /> provided to the start command.</param>
        /// <remarks>
        /// Valid startup args are:
        /// 0: Database Host Name where the SystemSettings database resides.
        /// 1: [Optional] Session Expiration Interval in hours.
        /// </remarks>
        protected override void StartService(CommandLineArguments args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            FrameworkServiceHelper.LoadSettings(args);

            Task.Factory.StartNew(() =>
            {
                FrameworkServiceHelper.UpdateServerInfo();
                TraceFactory.Logger.Debug("Updating Server Info - Complete");
            });

            int expirationInterval = args.GetParameterValue <int>("expirationInterval");

            //Start the service
            _monitorService = new STFMonitorService(expirationInterval);
            _monitorService.Start();

            //Open the server WCF endpoint
            _serviceEndpoint = new WcfHost <ISTFMonitorService>
                               (
                _monitorService,
                MessageTransferType.Http,
                WcfService.STFMonitor.GetLocalHttpUri()
                               );

            _serviceEndpoint.Open();
        }
Esempio n. 3
0
        protected override void StartService(CommandLineArguments args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            FrameworkServiceHelper.LoadSettings(args, autoRefresh: true);
            using (EnterpriseTestContext dataContext = new EnterpriseTestContext())
            {
                GlobalSettings.IsDistributedSystem = dataContext.VirtualResources.Any(r => r.ResourceType == "OfficeWorker");
            }
            string dispatcherHostName = "localhost";

            if (GlobalSettings.IsDistributedSystem)
            {
                using (AssetInventoryContext context = DbConnect.AssetInventoryContext())
                {
                    var dispatcher = context.FrameworkServers.FirstOrDefault(x => x.Active && x.ServerTypes.Any(n => n.Name == "BTF"));
                    if (dispatcher == null)
                    {
                        TraceFactory.Logger.Error("Could not find any dispatchers reserved for BTF Execution.");
                        return;
                    }
                }
            }

            SessionClient.Instance.Initialize(dispatcherHostName);
            SessionClient.Instance.SessionStartupTransitionReceived += Instance_SessionStartupTransitionReceived;
            SessionClient.Instance.SessionStateReceived             += Instance_SessionStateReceived;
            _server = WebApp.Start <Startup>(url: _baseAddress);
            _executionTimer.Start();
        }
        /// <summary>
        /// Starts this service instance.
        /// </summary>
        /// <param name="args">The <see cref="CommandLineArguments" /> provided to the start command.</param>
        protected override void StartService(CommandLineArguments args)
        {
            Thread.CurrentThread.SetName("Main");

            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            TraceFactory.Logger.Debug("Load settings");
            // Load the settings, either from the command line or the local cache
            FrameworkServiceHelper.LoadSettings(args, autoRefresh: true);
            TraceFactory.Logger.Debug("Load settings - Complete");

            Task.Factory.StartNew(() =>
            {
                TraceFactory.Logger.Debug("Updating Server Info");
                FrameworkServiceHelper.UpdateServerInfo();
                TraceFactory.Logger.Debug("Updating Server Info - Complete");
            });

            Task.Factory.StartNew(() =>
            {
                _sessionManagementService = new WcfHost <ISessionDispatcher>
                                            (
                    typeof(SessionDispatcher),
                    MessageTransferType.CompressedHttp,
                    WcfService.SessionServer.GetLocalHttpUri()
                                            );
                TraceFactory.Logger.Debug("Starting Session Management Service");
                _sessionManagementService.Open();
                TraceFactory.Logger.Debug("Starting Session Management Service - Complete");
            });
        }
        /// <summary>
        /// Starts this service instance.
        /// </summary>
        /// <param name="args">The <see cref="CommandLineArguments" /> provided to the start command.</param>
        protected override void StartService(CommandLineArguments args)
        {
            Thread.CurrentThread.SetName("Main");
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            TraceFactory.Logger.Debug("Load settings");
            // Load the settings, either from the command line or the local cache
            FrameworkServiceHelper.LoadSettings(args);

            StringBuilder exePath = new StringBuilder(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            exePath.Append("\\dart.exe");
            File.WriteAllBytes(exePath.ToString(), Properties.Resources.Dart);

            TraceFactory.Logger.Debug("Load settings - Complete");


            _logCollectionService = new WcfHost <IDartLogCollectorService>(
                typeof(DartCollectorService),
                MessageTransferType.Http,
                WcfService.CollectDartLogService.GetLocalHttpUri());

            _logCollectionService.Open();

            _bashLogCollectionWindowsService = new WcfHost <IBashLogCollectorService>(
                typeof(BashLogCollectorService),
                MessageTransferType.Http,
                WcfService.BashLogcollectorService.GetLocalHttpUri());

            _bashLogCollectionWindowsService.Open();
        }
        /// <summary>
        /// Starts this service instance.
        /// </summary>
        /// <param name="args">The <see cref="CommandLineArguments" /> provided to the start command.</param>
        protected override void StartService(CommandLineArguments args)
        {
            try
            {
                // Load settings from the database
                FrameworkServiceHelper.LoadSettings(args, true);

                _service = new PhysicalDeviceJobLogMonitorService();
                StartService();
            }
            catch (Exception ex)
            {
                TraceFactory.Logger.Error("Error starting services", ex);
            }
        }
        /// <summary>
        /// Starts this service instance.
        /// </summary>
        /// <param name="args">The <see cref="CommandLineArguments" /> provided to the start command.</param>
        protected override void StartService(CommandLineArguments args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            // Load the settings, either from the command line or the local cache
            FrameworkServiceHelper.LoadSettings(args);

            ReservationExpirationManager expirationManager = new ReservationExpirationManager(DbConnect.AssetInventoryConnectionString);
            ExpirationNotifier expirationNotifier = new ExpirationNotifier(GlobalSettings.Items[Setting.AdminEmailServer]);
            _assetInventory = new AssetInventoryService(new[] { expirationManager }, expirationNotifier);

            Task.Factory.StartNew(() => _lock.Open());

            DataLogConnectionString connectionString = new DataLogConnectionString(GlobalSettings.Items[Setting.DataLogDatabase]);
            _dataLogService = new WcfHost<IDataLogService>(new DataLogService(connectionString), DataLogServiceEndpoint.MessageTransferType, DataLogServiceEndpoint.BuildUri("localhost"));
            Task.Factory.StartNew(() => _dataLogService.Open());
        }