Beispiel #1
0
        private void StartServiceOnGingerNode(PluginServiceBase service, string NodeName, string GingerGridHost = "127.0.0.1", int GingerGridPort = 15001)
        {
            Console.WriteLine("Service Name: " + service.Name);
            bool bReady = false;

            bNodest = true;
            Task t = new Task(() =>
            {
                GingerNode GN = new GingerNode(service);
                GN.StartGingerNode(NodeName, GingerGridHost, GingerGridPort);
                GN.GingerNodeMessage += GingerNodeMessage;
                GingerNodes.Add(GN);
                bReady = true;
            });

            t.Start();
            while (!bReady) // TODO: add timeout or use ManualResetEvent with timeout
            {
                Console.WriteLine("Waiting for service Node to be ready");
                Thread.Sleep(500);
            }
            Console.WriteLine("Ginger Service started - " + NodeName);  // Add ports and GingerGrid details
        }
Beispiel #2
0
        // Services are used for standalone action/ ActWithoutDriver
        public PluginServiceBase GetService(string serviceName)
        {
            if (!Isloaded)
            {
                ScanPackage();
            }
            // TODO: fix make more efficent and load only what needed
            foreach (PluginAssemblyInfo PAI in mAssembliesInfo)
            {
                var list = from type in PAI.Assembly.GetTypes()
                           where typeof(PluginServiceBase).IsAssignableFrom(type) && type.IsAbstract == false
                           select type;

                foreach (Type t in list)
                {
                    PluginServiceBase service = (PluginServiceBase)PAI.Assembly.CreateInstance(t.FullName);   // TODO: fix me find the driver without creating instance
                    if (service.Name == serviceName)
                    {
                        return(service);
                    }
                }
            }
            throw new Exception("Service not found in Plugin Package - " + serviceName);
        }
Beispiel #3
0
        public List <PluginServiceBase> GetServices()
        {
            if (!Isloaded)
            {
                ScanPackage();
            }

            List <PluginServiceBase> services = new List <PluginServiceBase>();

            // TODO: fix make more efficent and load only what needed
            foreach (PluginAssemblyInfo PAI in mAssembliesInfo)
            {
                var list = from type in PAI.Assembly.GetTypes()
                           where typeof(PluginServiceBase).IsAssignableFrom(type) && type.IsAbstract == false
                           select type;

                foreach (Type t in list)
                {
                    PluginServiceBase service = (PluginServiceBase)PAI.Assembly.CreateInstance(t.FullName);   // TODO: fix me find the driver without creating instance
                    services.Add(service);
                }
            }
            return(services);
        }
Beispiel #4
0
        public void StartService(string Name, string ID, string GingerGridHost = "127.0.0.1", int GingerGridPort = 15001)
        {
            PluginServiceBase d = P.GetService(Name);

            StartServiceOnGingerNode(d, ID, GingerGridHost, GingerGridPort);
        }
Beispiel #5
0
 public GingerNode(PluginServiceBase service)
 {
     this.mService = service;
 }