Example #1
0
 public FileServer(string relativePrefix, HttpServer s, ProcessService p)
 {
     parent = p;
     server = s;
     logger = server.Logger;
     server.Register(relativePrefix, HandlePutRequest, HandleGetRequest);
     prefix = server.Prefix + relativePrefix;
     baseUri = server.BaseURI + relativePrefix;
 }
Example #2
0
        static void Main(string[] args)
        {
            ILogger logger = new SimpleLogger("processservice.log");
            logger.Log("startup", "-------- Starting Dryad Process Service --------");

            var directory = Directory.GetCurrentDirectory();

            if (!GetEnvironmentDetails(logger))
            {
                logger.Log("Failed to read environment variables");
                logger.Stop();
                return;
            }

            XDocument config;
            try
            {
                string configFile = args[0];
                logger.Log("Opening config file " + configFile);
                config = XDocument.Load(configFile);
                logger.Log("Opened config file " + configFile);
            }
            catch (Exception e)
            {
                logger.Log("Failed to read config file: " + e.ToString());
                logger.Stop();
                return;
            }

            using (var processService = new ProcessService(logger))
            {
                string processUri;
                string fileUri;

                logger.Log("starting process service");
                if (processService.Start(config, groupName, identifier, out processUri, out fileUri))
                {
                    logger.Log("done starting process service");

                    if (!RendezvousWithParent(processUri, fileUri, directory, logger))
                    {
                        processService.ShutDown();
                    }
                }
                else
                {
                    logger.Log("process service start failed");
                }

                logger.Log("waiting for process service to exit");
                processService.WaitForExit();
                logger.Log("process service has exited");
            }

            logger.Log("-------- Stopping Dryad Process Service --------");
            logger.Stop();
        }