public void Start() { AppDomain.CurrentDomain.UnhandledException += UnhandledException; CreateCoordinatorChannel(); BeforeStartingServices(); _startupServices.Each((name, builder) => { ActorFactory <IServiceController> factory = _controllerFactory.CreateFactory(inbox => { IServiceController controller = builder(inbox, this); _serviceCache.Add(name, controller); return(controller); }); ActorInstance instance = factory.GetActor(); _actorCache.Add(name, instance); instance.Send(new CreateService(name)); }); WaitUntilServicesAreRunning(_startupServices.GetAllKeys(), _timeout); AfterStartingServices(); }
private string GetServiceName(IServiceController controller) { var type = controller.GetType(); var attributes = type.GetCustomAttributes(typeof(DisplayNameAttribute), false); return(0 < attributes.Length ? ((DisplayNameAttribute)attributes[0]).DisplayName : type.Name); }
public MainForm() { InitializeComponent(); indexer = (IServiceController)Activator.CreateInstance(Type.GetType("ASC.FullTextIndex.Service.FullTextIndexLauncher, ASC.FullTextIndex"), true); indexer.Start(); }
public override Host Build() { if (ServiceBuilders.Count > 1) { throw new HostConfigurationException("A shelf can only have one service configured"); } ServiceBuilder builder = ServiceBuilders.Single(); _log.DebugFormat("[Shelf:{0}] Building Service: {1}", Description.Name, builder.Name); var controllerFactory = new ServiceControllerFactory(); ActorFactory <IServiceController> factory = controllerFactory.CreateFactory(inbox => { var publish = new PublishChannel(_channel, inbox); IServiceController service = builder.Build(inbox, publish); return(service); }); ActorRef instance = factory.GetActor(); _channel.Connect(x => x.AddChannel(instance)); // this creates the state machine instance in the shelf and tells the servicecontroller // to create the service instance.Send(new CreateService(Description.Name)); return(new ShelfHost(instance)); }
public void EstablishContext() { using (var startEvent = new ManualResetEvent(false)) { _srv = new TestService(); _channelAdaptor = new ChannelAdapter(); _hostChannel = WellknownAddresses.GetServiceCoordinatorHost(_channelAdaptor); using (_channelAdaptor.Connect(config => config.AddConsumerOf<ServiceStarted>().UsingConsumer(msg => startEvent.Set()))) { ServiceConfigurator<TestService> c = new ServiceConfigurator<TestService>(); c.WhenStarted(s => s.Start()); c.WhenStopped(s => s.Stop()); c.WhenPaused(s => { _wasPaused = true; }); c.WhenContinued(s => { _wasContinued = true; }); c.HowToBuildService(name => _srv); _serviceController = c.Create(WellknownAddresses.GetServiceCoordinatorProxy()); _serviceController.Start(); startEvent.WaitOne(5.Seconds()); _serviceController.State.ShouldEqual(ServiceState.Started); } } }
public EntryPoint( IServiceController controller, ILogger logger) { _controller = controller; _logger = logger; }
internal void BuildObjectGraph() { const int ONE_SECOND = 1000; const int FIVE_SECONDS = 5000; var backupFilePath = BuildBackupFilePath(); InitializeLogging(); var featureBackup = new FeatureConfigurationBackup(backupFilePath, new ModuleLogger(logger, nameof(FeatureConfigurationBackup))); var featureFactory = new FeatureConfigurationFactory(new ModuleLogger(logger, nameof(FeatureConfigurationFactory))); var featureMonitor = new FeatureConfigurationMonitor(new ModuleLogger(logger, nameof(FeatureConfigurationMonitor)), ONE_SECOND); var proxyFactory = new ProxyFactory(new ProxyObjectFactory(), new ModuleLogger(logger, nameof(ProxyFactory))); var serviceHost = new ServiceHost(AppConfig.SERVICE_ADDRESS, new HostObjectFactory(), new ModuleLogger(logger, nameof(ServiceHost)), FIVE_SECONDS); var sessionContext = new SessionContext(); var systemConfigurationUpdate = new SystemConfigurationUpdate(new ModuleLogger(logger, nameof(SystemConfigurationUpdate))); var bootstrapOperations = new Queue <IOperation>(); var sessionOperations = new Queue <IOperation>(); sessionContext.AutoRestoreMechanism = new AutoRestoreMechanism(featureBackup, new ModuleLogger(logger, nameof(AutoRestoreMechanism)), systemConfigurationUpdate, FIVE_SECONDS); bootstrapOperations.Enqueue(new RestoreOperation(featureBackup, logger, sessionContext)); bootstrapOperations.Enqueue(new CommunicationHostOperation(serviceHost, logger)); bootstrapOperations.Enqueue(new ServiceEventCleanupOperation(logger, sessionContext)); sessionOperations.Enqueue(new SessionInitializationOperation(logger, ServiceEventFactory, sessionContext)); sessionOperations.Enqueue(new LockdownOperation(featureBackup, featureFactory, featureMonitor, logger, sessionContext)); sessionOperations.Enqueue(new SessionActivationOperation(logger, sessionContext)); var bootstrapSequence = new OperationSequence(logger, bootstrapOperations); var sessionSequence = new OperationSequence(logger, sessionOperations); ServiceController = new ServiceController(logger, LogWriterFactory, bootstrapSequence, sessionSequence, serviceHost, sessionContext, systemConfigurationUpdate); }
public PortfolioService(IServiceBundleController serviceBundleController, IServiceController serviceController, ILifecycleStatusController lifecycleStatusController, IServiceSwotController serviceSwotController, ISwotActivityController swotActivityController, IServiceDocumentController serviceDocumentController, IServiceGoalController serviceGoalController, IServiceContractController serviceContractController, IServiceWorkUnitController serviceWorkUnitController, IServiceMeasureController serviceMeasureController, IServiceOptionController serviceOptionController, IServiceOptionCategoryController optionCategoryController, IServiceProcessController serviceProcessController, ITextInputController textInputController, ISelectionInputController selectionInputController, IScriptedSelectionInputController scriptedSelectionController, IServiceRequestPackageController serviceRequestPackageController) { _serviceBundleController = serviceBundleController; _serviceController = serviceController; _lifecycleStatusController = lifecycleStatusController; _serviceSwotController = serviceSwotController; _swotActivityController = swotActivityController; _serviceDocumentController = serviceDocumentController; _serviceGoalController = serviceGoalController; _serviceContractController = serviceContractController; _serviceWorkUnitController = serviceWorkUnitController; _serviceMeasureController = serviceMeasureController; _serviceOptionController = serviceOptionController; _optionCategoryController = optionCategoryController; _serviceProcessController = serviceProcessController; _textInputController = textInputController; _selectionInputController = selectionInputController; _scriptedSelectionController = scriptedSelectionController; _serviceRequestPackageController = serviceRequestPackageController; }
internal void BuildObjectGraph() { logger = new Logger(); InitializeLogging(); ServiceController = new ServiceController(); }
/// <summary> /// Creates a new instance of <see cref="Environment"/>. /// </summary> /// <param name="serviceController">The service controller.</param> /// <param name="logger">The logger.</param> public Environment(IServiceController serviceController, ILogger logger) { ServiceController = serviceController; Logger = logger; // Set initial state Ready(); }
private void Awake() { Application.targetFrameRate = 30; _serviceControllerInstance = new MainServiceDataController(); _coroutinePerformerInstance = this; _serviceControllerInstance.Initialization(); }
public ServiceController(IServiceController context) { this.context = context; var assembly = Assembly.GetExecutingAssembly(); serverVariables.Version = assembly.GetName().Version.ToString(); serverVariables.ServerId = context.ServerId; }
/// <summary> /// Creates a new instance of <see cref="ActorGameController"/>. /// </summary> /// <param name="name">The environment name.</param> /// <param name="serviceController">The service controller.</param> /// <param name="logger">The logger.</param> public ActorGameController(string name, IServiceController serviceController, ILogger logger) { Logger = logger; using (Logger.Log(CONTEXT, "Initialising actor system")) { ActorSystem = ActorSystem.Create(name); ServiceController = serviceController; } }
static void Main() { //Application.Run(new MainForm()); indexer = (IServiceController)Activator.CreateInstance(Type.GetType("ASC.FullTextIndex.Service.FullTextIndexLauncher, ASC.FullTextIndex"), true); indexer.Start(); Console.ReadKey(); indexer.Stop(); }
public ServiceController(IServiceController context, IHostApplicationLifetime serviceLifeTime) { this.context = context; this.serviceLifeTime = serviceLifeTime; var assembly = Assembly.GetExecutingAssembly(); serverVariables.Version = assembly.GetName().Version.ToString(); serverVariables.ServerId = context.ServerId; }
private static void RunInteractive(string[] args, IServiceController controller) { var startupArguments = new DefaultStartupArguments(); var handle = new ManualResetEvent(false); Console.CancelKeyPress += (s, e) => { if (e.SpecialKey == ConsoleSpecialKey.ControlC) { log.Info("Received Ctrl+C command, stopping services."); e.Cancel = true; handle.Set(); startupArguments.AbortStartup = true; } }; controller.Run(startupArguments); ThreadPool.QueueUserWorkItem(o => { bool run = true; while (run) { Console.WriteLine("Type cls to clear screen, or quit|exit to stop."); string input = (Console.ReadLine() ?? "").ToLowerInvariant(); switch (input) { case "cls": Console.Clear(); break; case "quit": case "exit": { // stop running run = false; log.Info(string.Format("Received {0} command, stopping service.", input)); handle.Set(); break; } default: Console.WriteLine("'" + input + "' is not a valid operation."); break; } } }); handle.WaitOne(); Console.WriteLine("Shutting down application."); var shutdownArguments = new DefaultShutdownArguments(); controller.Shutdown(shutdownArguments); }
public ServiceController(IServiceController context, IHostApplicationLifetime serviceLifeTime) { this.context = context; this.serviceLifeTime = serviceLifeTime; var assembly = Assembly.GetExecutingAssembly(); var version = assembly.GetName().Version; serverVariables.Version = (version != null) ? version.ToString() : "unknown"; serverVariables.ServerId = context.ServerId; serverVariables.AutoDetect = context.AutoDetect; }
public void EstablishContext() { _srv = new TestService(); ServiceConfigurator<TestService> c = new ServiceConfigurator<TestService>(); c.WhenStarted(s => s.Start()); c.WhenStopped(s => s.Stop()); c.WhenPaused(s => { _wasPaused = true; }); c.WhenContinued(s => { _wasContinued = true; }); c.HowToBuildService((name)=> _srv); _serviceController = c.Create(); _serviceController.Start(); }
public ClientConfigurationPacketHandler(IPacketSerialiser packetSerialiser, INetworkClient client, IServiceController serviceController, IAudioRecorderService recorderService, ICameraRecorderService cameraRecorderService, ILocalizationService localizationService) : base(packetSerialiser) { this.client = client; this.serviceController = serviceController; this.recorderService = recorderService; this.cameraRecorderService = cameraRecorderService; this.localizationService = localizationService; }
public HostController(IServiceController controller, ServiceDirectory directory) { _Controller = controller; Name = directory.Folder.Name; Status = HostStatus.Created; // create our app domain var setup = AppDomain.CurrentDomain.SetupInformation; setup.ShadowCopyFiles = "true"; setup.ConfigurationFile = directory.ConfigurationFile.FullName; setup.ApplicationBase = directory.Folder.FullName; log.Debug(string.Format("[{0}] Creating AppDomain.", Name)); Domain = AppDomain.CreateDomain("ServiceHost." + Name, null, setup); }
private void InitializeCLI() { cli = new CLIApp(); serviceController = new ServiceController.ServiceController(); disabledOutputLevels = new HashSet <OutputLevel>(); disabledReasons = new HashSet <LogReason>(); RegisterLogging(); AddCLICommands(); AddServiceCommands(); AddFileManagementCommands(); AddLoggingCommands(); cli.Start(); }
public void EstablishContext() { var c = new IsolatedServiceConfigurator<TestService>(); c.WhenStarted(s => s.Start()); c.WhenStopped(s => s.Stop()); //c.WhenPaused(s => { _wasPaused = true; }); //need to change these //c.WhenContinued(s => { _wasContinued = true; }); //need to change these c.HowToBuildService((name)=> { return new TestService(); }); _serviceController = c.Create(); _serviceController.Start(); }
public Client(Credential Credential, IHttpClient HttpClient = null, IServiceController Controller = null, Configuration.IConfigurationReader ConfigurationReader = null) { if (ConfigurationReader == null) { #if WINDOWS_PHONE ConfigurationReader = new Configuration.IsolatedStorageConfigurationReader(); #else ConfigurationReader = new Configuration.AppConfigConfigurationReader(); #endif } this.ConfigurationReader = ConfigurationReader; if (HttpClient == null) { if (HttpClient == null) HttpClient = new HTTP.VirtualClientHttp(this.Credential); } if (Controller == null) { Controller = new VirtualScenes34.VitualScenes34Controller(Credential); } Logger = LogManager.GetLogger<Client>(); this.Credential = Credential; this.VirtualScenesController = Controller; if (this.VirtualScenesController.Credential == null) this.VirtualScenesController.Credential = Credential; this.VirtualScenesController.OnError += new Error(VirtualScenesController_OnError); Logger.Debug("New Client Created"); Logger.DebugFormat("HttpClient:{0}", HttpClient.ToString()); Logger.DebugFormat("Controller:{0}", Controller.ToString()); Logger.DebugFormat("Credential:{0}", Helpers.Serialization.NewtonSerializer<Credential>.ToJSON(Credential)); VirtualScenesController.OnLogin += new LoginResponse(VirtualScenesController_OnLogin); VirtualScenesController.OnLogout += new LogoutResponse(VirtualScenesController_OnLogout); VirtualScenesController.OnDevices += new DevicesResponse(VirtualScenesController_OnDevices); VirtualScenesController.OnDeviceDetails += new DeviceDetailsResponse(VirtualScenesController_OnDeviceDetails); VirtualScenesController.OnDeviceCommands += new DeviceCommandsResponse(VirtualScenesController_OnDeviceCommands); VirtualScenesController.OnDeviceCommand += new DeviceCommandResponse(VirtualScenesController_OnDeviceCommand); VirtualScenesController.OnDeviceValues += new DeviceValuesResponse(VirtualScenesController_OnDeviceValues); VirtualScenesController.OnScenes += new SceneResponse(VirtualScenesController_OnScenes); VirtualScenesController.OnChangeSceneName += new SceneNameChangeResponse(VirtualScenesController_OnChangeSceneName); VirtualScenesController.OnStartScene += new SceneNameChangeResponse(VirtualScenesController_OnStartScene); VirtualScenesController.OnGroups += new GroupsResponse(VirtualScenesController_OnGroups); VirtualScenesController.OnGroupDetails += new GroupDetailsResponse(VirtualScenesController_OnGroupDetails); VirtualScenesController.OnCommands += new CommandsResponse(VirtualScenesController_OnCommands); VirtualScenesController.OnSendCommand += new CommandsResponse(VirtualScenesController_OnSendCommand); LoadCookie(); }
protected override void OnStart(string[] args) { try { // start all services from config or start only one service from parameter -t ServiceType if (args.Length == 0) { args = Environment.GetCommandLineArgs(); } var serviceType = string.Empty; for (var i = 0; i < args.Length; i++) { if (args[i] == "-s" || args[i] == "--service") { if (string.IsNullOrEmpty(args[i + 1])) { throw new ArgumentNullException("--service", "Type of service not found."); } serviceType = args[i + 1].Trim().Trim('"'); } } } catch (Exception error) { log.ErrorFormat("Can not start services: {0}", error); return; } jabberService = (IServiceController)Activator.CreateInstance(Type.GetType("ASC.Xmpp.Host.XmppServerLauncher, ASC.Xmpp.Host", true)); try { jabberService.Start(); log.InfoFormat("Jabber service started."); } catch (Exception error) { log.ErrorFormat("Can not start jabber service {0}", error); } }
public bool StartSocks(String ipToListen, ushort localPort, IServiceController controller, ManualResetEvent cmdChannelRunning = null) { _controller = controller; var onOff = (WaitOnConnect) ? "on" : "off"; ServerComms.LogMessage($"Wait for Implant TCP Connect before SOCKS Proxy response is {onOff}"); if (null != cmdChannelRunning) { Task.Factory.StartNew(() => { ServerComms.LogMessage($"Waiting for command channel before starting SOCKS proxy"); cmdChannelRunning.WaitOne(); StartSocksInternal(ipToListen, localPort); }); } else { return(StartSocksInternal(ipToListen, localPort)); } return(true); }
public PrintersController(IServiceController context) { this.context = context; }
public IHostController CreateController(IServiceController controller, ServiceDirectory directory) { return new HostController(controller, directory); }
public SequenceController(IServiceController serviceController, ISequence sequence) { _serviceController = serviceController; Sequence = sequence; }
private string GetServiceName(IServiceController controller) { var type = controller.GetType(); var attributes = type.GetCustomAttributes(typeof(DisplayNameAttribute), false); return 0 < attributes.Length ? ((DisplayNameAttribute)attributes[0]).DisplayName : type.Name; }
public void AddNewService( IServiceController controller ) { Services.Add( controller ); }
public KeepAliveService( IServiceController context) { this.Context = context; }
public HydrousService(IServiceController controller) { Controller = controller; }
public APIServiceController(ILogger <ServiceController> logger, IYamlScriptController yamlScriptController, IRoutingController routingController) { _serviceController = new ServiceController(logger, yamlScriptController, routingController); }
public KeepAliveHostedService( IServiceController context) : base(context) { }
public SimpleDiscoveryService(IServiceController context) { this.context = context; }
public void AddNewService(IServiceController controller) { _services.Add(controller); //TODO: How to best call start here? }
public void AddNewService(IServiceController controller) { Services.Add(controller); }