Ejemplo n.º 1
0
        public Message Process(Message request)
        {
            var content = request.CacheFileRequest.Content;
            var file    = request.CacheFileRequest.FilePath;
            var status  = request.CacheFileRequest.Status;

            switch (status)
            {
            case FileStatus.Changed:
            case FileStatus.Opened:
                _loader.ReloadSteps(content, file);
                break;

            case FileStatus.Created:
                if (!_loader.GetStepRegistry().IsFileCached(file))
                {
                    LoadFromDisk(file);
                }
                break;

            case FileStatus.Closed:
                LoadFromDisk(file);
                break;

            case FileStatus.Deleted:
                _loader.RemoveSteps(file);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(new Message());
        }
 public RunnerServiceHandler(IStaticLoader loader, Server server)
 {
     _loader            = loader;
     this._server       = server;
     this._stepRegistry = loader.GetStepRegistry();
     this.InitializeMessageProcessors();
 }
 public AuthoringRunnerServiceHandler(IStaticLoader loader, ExecutorPool pool, IHostApplicationLifetime lifetime)
 {
     this._pool    = pool;
     this.lifetime = lifetime;
     this._loader  = loader;
     _stepRegistry = loader.GetStepRegistry();
     this.InitializeMessageProcessors();
 }
Ejemplo n.º 4
0
 public MessageProcessorFactory(IStaticLoader loader)
 {
     _loader       = loader;
     _stepRegistry = loader.GetStepRegistry();
     _messageProcessorsDictionary = InitializeMessageHandlers();
 }
Ejemplo n.º 5
0
        public void StartServer()
        {
            var server            = new Server();
            var assemblies        = new AssemblyLocater(new DirectoryWrapper(), new FileWrapper()).GetAllAssemblies();
            var reflectionWrapper = new ReflectionWrapper();
            var activatorWrapper  = new ActivatorWrapper();
            var assemblyLoader    = new AssemblyLoader(new AssemblyWrapper(), assemblies, reflectionWrapper, activatorWrapper, _staticLoader.GetStepRegistry());
            var handler           = new RunnerServiceHandler(activatorWrapper, reflectionWrapper, assemblyLoader, _staticLoader, server);

            server.Services.Add(Runner.BindService(handler));
            var port = server.Ports.Add(new ServerPort("127.0.0.1", 0, ServerCredentials.Insecure));

            server.Start();
            Console.WriteLine("Listening on port:" + port);
            server.ShutdownTask.Wait();
            Environment.Exit(Environment.ExitCode);
        }