Changeset 2591 for trunk/sources/HeuristicLab.Hive.Server
- Timestamp:
- 01/05/10 10:31:40 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Server/3.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server/3.2/HiveServerApplication.cs
r2065 r2591 23 23 using System.Collections.Generic; 24 24 using System.Text; 25 using System.Linq; 25 26 using System.Windows.Forms; 26 27 using HeuristicLab.PluginInfrastructure; … … 33 34 34 35 namespace HeuristicLab.Hive.Server { 35 [ClassInfo(Name = "Hive Server", 36 Description = "Server application for the distributed hive engine.", 37 AutoRestart = true)] 36 [Application("Hive Server", "Server application for the distributed hive engine.", true)] 38 37 public class HiveServerApplication : ApplicationBase { 39 38 public const string STR_ClientCommunicator = "ClientCommunicator"; … … 41 40 public const string STR_ExecutionEngineFacade = "ExecutionEngineFacade"; 42 41 43 private DiscoveryService discService = new DiscoveryService();44 42 private Dictionary<string, ServiceHost> runningServices = new Dictionary<string, ServiceHost>(); 45 43 private NetTcpBinding binding = (NetTcpBinding)WcfSettings.GetBinding(); … … 52 50 All 53 51 } 54 52 55 53 private bool AddMexEndpoint(ServiceHost serviceHost) { 56 54 if (serviceHost != null) { … … 69 67 string curServiceHost = ""; 70 68 Uri uriTcp; 71 I ClientFacade[] clientCommunicatorInstances = discService.GetInstances<IClientFacade>();72 I ServerConsoleFacade[] serverConsoleInstances = discService.GetInstances<IServerConsoleFacade>();73 IE xecutionEngineFacade[] executionEngineInstances = discService.GetInstances<IExecutionEngineFacade>();69 IEnumerable<IClientFacade> clientCommunicatorInstances = ApplicationManager.Manager.GetInstances<IClientFacade>(); 70 IEnumerable<IServerConsoleFacade> serverConsoleInstances = ApplicationManager.Manager.GetInstances<IServerConsoleFacade>(); 71 IEnumerable<IExecutionEngineFacade> executionEngineInstances = ApplicationManager.Manager.GetInstances<IExecutionEngineFacade>(); 74 72 ServiceHost serviceHost = null; 75 73 switch (svc) { 76 74 case Services.ClientCommunicator: 77 if (clientCommunicatorInstances. Length> 0) {78 uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/HiveServer/"); 79 serviceHost = new ServiceHost(clientCommunicatorInstances [0].GetType(), uriTcp);75 if (clientCommunicatorInstances.Count() > 0) { 76 uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/HiveServer/"); 77 serviceHost = new ServiceHost(clientCommunicatorInstances.First().GetType(), uriTcp); 80 78 serviceHost.AddServiceEndpoint(typeof(IClientFacade), streamedBinding, STR_ClientCommunicator); 81 79 curServiceHost = STR_ClientCommunicator; … … 83 81 break; 84 82 case Services.ServerConsoleFacade: 85 if (serverConsoleInstances. Length> 0) {83 if (serverConsoleInstances.Count() > 0) { 86 84 uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/HiveServerConsole/"); 87 serviceHost = new ServiceHost(serverConsoleInstances [0].GetType(), uriTcp);85 serviceHost = new ServiceHost(serverConsoleInstances.First().GetType(), uriTcp); 88 86 serviceHost.AddServiceEndpoint(typeof(IServerConsoleFacade), binding, STR_ServerConsoleFacade); 89 87 curServiceHost = STR_ServerConsoleFacade; … … 91 89 break; 92 90 case Services.ExecutionEngineFacade: 93 if (executionEngineInstances. Length> 0) {91 if (executionEngineInstances.Count() > 0) { 94 92 uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/ExecutionEngine/"); 95 serviceHost = new ServiceHost(executionEngineInstances [0].GetType(), uriTcp);93 serviceHost = new ServiceHost(executionEngineInstances.First().GetType(), uriTcp); 96 94 serviceHost.AddServiceEndpoint(typeof(IExecutionEngineFacade), streamedBinding, STR_ExecutionEngineFacade); 97 95 curServiceHost = STR_ExecutionEngineFacade; … … 143 141 break; 144 142 } 145 143 146 144 //Start services and record their base address 147 145 Dictionary<string, Uri> baseAddrDict = new Dictionary<string, Uri>(); … … 153 151 StartService(Services.ExecutionEngineFacade, addresses[index], WcfSettings.DEFAULTPORT)); 154 152 155 I LifecycleManager[] lifecycleManagers = discService.GetInstances<ILifecycleManager>();156 if (lifecycleManagers. Length> 0) {153 IEnumerable<ILifecycleManager> lifecycleManagers = ApplicationManager.Manager.GetInstances<ILifecycleManager>(); 154 if (lifecycleManagers.Count() > 0) { 157 155 ILifecycleManager lifecycleManager = 158 lifecycleManagers [0];156 lifecycleManagers.First(); 159 157 160 158 lifecycleManager.Init(); 161 159 Form mainForm = new MainForm(baseAddrDict); 162 160 Application.Run(mainForm); 163 161 164 162 lifecycleManager.Shutdown(); 165 163 } -
trunk/sources/HeuristicLab.Hive.Server/3.2/HiveServerPlugin.cs
r1530 r2591 27 27 28 28 namespace HeuristicLab.Hive.Server { 29 [ ClassInfo(Name ="HeuristicLab.Hive.Server-3.2")]30 [PluginFile( Filename = "HeuristicLab.Hive.Server-3.2.dll", Filetype =PluginFileType.Assembly)]31 [ Dependency(Dependency ="HeuristicLab.Core-3.2")]32 [ Dependency(Dependency ="HeuristicLab.Hive.Contracts-3.2")]29 [Plugin("HeuristicLab.Hive.Server-3.2")] 30 [PluginFile("HeuristicLab.Hive.Server-3.2.dll", PluginFileType.Assembly)] 31 [PluginDependency("HeuristicLab.Core-3.2")] 32 [PluginDependency("HeuristicLab.Hive.Contracts-3.2")] 33 33 public class HiveServerPlugin : PluginBase { 34 34 }
Note: See TracChangeset
for help on using the changeset viewer.