Changeset 800
- Timestamp:
- 11/20/08 17:52:05 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Contracts/HeuristicLab.Hive.Contracts.csproj
r795 r800 69 69 <Compile Include="Interfaces\IClientManager.cs" /> 70 70 <Compile Include="Interfaces\IJobManager.cs" /> 71 <Compile Include="Interfaces\IServerConsoleFacade.cs" /> 71 72 <Compile Include="Interfaces\IUserRoleManager.cs" /> 72 73 <Compile Include="MessageContainer.cs" /> -
trunk/sources/HeuristicLab.Hive.Server.Core/HeuristicLab.Hive.Server.Core.csproj
r744 r800 49 49 <ItemGroup> 50 50 <Compile Include="ClientCommunicator.cs" /> 51 <Compile Include="ClientManager.cs" /> 51 52 <Compile Include="HiveServerCorePlugin.cs" /> 53 <Compile Include="JobManager.cs" /> 52 54 <Compile Include="Properties\AssemblyInfo.cs" /> 55 <Compile Include="ServerConsoleFacade.cs" /> 56 <Compile Include="UserRoleManager.cs" /> 53 57 </ItemGroup> 54 58 <ItemGroup> -
trunk/sources/HeuristicLab.Hive.Server/HiveServerApplication.cs
r780 r800 36 36 AutoRestart = true)] 37 37 class HiveServerApplication : ApplicationBase { 38 const int port = 9000; 38 const int port = 39 9000; 39 40 40 public override void Run() { 41 IPHostEntry IPHost = Dns.GetHostEntry(Dns.GetHostName()); 42 string externalIP = IPHost.AddressList[0].ToString(); 41 DiscoveryService discService = 42 new DiscoveryService(); 43 43 44 DiscoveryService discService = 45 new DiscoveryService(); 46 IClientCommunicator[] instances = 44 private bool AddMexEndpoint(ServiceHost serviceHost) { 45 if(serviceHost != null) { 46 ServiceMetadataBehavior behavior = 47 new ServiceMetadataBehavior(); 48 serviceHost.Description.Behaviors.Add(behavior); 49 50 return serviceHost.AddServiceEndpoint( 51 typeof(IMetadataExchange), 52 MetadataExchangeBindings.CreateMexTcpBinding(), 53 "mex") != null; 54 } else 55 return false; 56 } 57 58 private ServiceHost StartClientCommunicator(Uri uriTcp) { 59 IClientCommunicator[] clientCommunicatorInstances = 47 60 discService.GetInstances<IClientCommunicator>(); 48 61 49 if (instances.Length > 0) { 50 Uri uriTcp = 51 new Uri("net.tcp://" + externalIP + ":" + port +"/HiveServer/"); 52 62 if (clientCommunicatorInstances.Length > 0) { 53 63 ServiceHost serviceHost = 54 new ServiceHost( instances[0].GetType(),64 new ServiceHost(clientCommunicatorInstances[0].GetType(), 55 65 uriTcp); 56 66 57 System.ServiceModel.Channels.Binding binding = 67 System.ServiceModel.Channels.Binding binding = 58 68 new NetTcpBinding(); 59 69 … … 63 73 "ClientCommunicator"); 64 74 65 ServiceMetadataBehavior behavior = 66 new ServiceMetadataBehavior(); 67 serviceHost.Description.Behaviors.Add(behavior); 68 69 serviceHost.AddServiceEndpoint( 70 typeof(IMetadataExchange), 71 MetadataExchangeBindings.CreateMexTcpBinding(), 72 "mex"); 75 AddMexEndpoint(serviceHost); 73 76 74 77 serviceHost.Open(); 75 78 76 Form mainForm = new MainForm(serviceHost.BaseAddresses[0]); 77 Application.Run(mainForm); 79 return serviceHost; 80 } else 81 return null; 82 } 78 83 79 serviceHost.Close(); 80 } else { 81 MessageBox.Show("Error - no ClientCommunicator instance"); 82 } 84 private ServiceHost StartServerConsoleFacade(Uri uriTcp) { 85 IServerConsoleFacade[] serverConsoleInstances = 86 discService.GetInstances<IServerConsoleFacade>(); 87 88 if (serverConsoleInstances.Length > 0) { 89 ServiceHost serviceHost = 90 new ServiceHost(serverConsoleInstances[0].GetType(), 91 uriTcp); 92 93 System.ServiceModel.Channels.Binding binding = 94 new NetTcpBinding(); 95 96 serviceHost.AddServiceEndpoint( 97 typeof(IClientManager), 98 binding, 99 "ClientManager"); 100 101 serviceHost.AddServiceEndpoint( 102 typeof(IJobManager), 103 binding, 104 "JobManager"); 105 106 serviceHost.AddServiceEndpoint( 107 typeof(IUserRoleManager), 108 binding, 109 "UserRoleManager"); 110 111 AddMexEndpoint(serviceHost); 112 113 serviceHost.Open(); 114 115 return serviceHost; 116 } else 117 return null; 118 } 119 120 public override void Run() { 121 string externalIP = 122 Dns.GetHostEntry(Dns.GetHostName()).AddressList[0].ToString(); 123 124 Uri uriTcp = 125 new Uri("net.tcp://" + externalIP + ":" + port + "/HiveServer/"); 126 127 ServiceHost clientCommunicator = 128 StartClientCommunicator(uriTcp); 129 130 uriTcp = 131 new Uri("net.tcp://" + externalIP + ":" + port + "/HiveServerConsole/"); 132 133 ServiceHost serverConsoleFacade = 134 StartServerConsoleFacade(uriTcp); 135 136 Form mainForm = new MainForm(clientCommunicator.BaseAddresses[0], 137 serverConsoleFacade.BaseAddresses[0]); 138 139 Application.Run(mainForm); 140 141 clientCommunicator.Close(); 142 serverConsoleFacade.Close(); 83 143 } 84 144 } -
trunk/sources/HeuristicLab.Hive.Server/MainForm.Designer.cs
r741 r800 30 30 { 31 31 this.label1 = new System.Windows.Forms.Label(); 32 this.lblAddress = new System.Windows.Forms.Label(); 32 this.lblAddress1 = new System.Windows.Forms.Label(); 33 this.label2 = new System.Windows.Forms.Label(); 34 this.lblAddress2 = new System.Windows.Forms.Label(); 33 35 this.SuspendLayout(); 34 36 // … … 42 44 this.label1.Text = "Hive server running @"; 43 45 // 44 // lblAddress 46 // lblAddress1 45 47 // 46 this.lblAddress.AutoSize = true; 47 this.lblAddress.Location = new System.Drawing.Point(18, 43); 48 this.lblAddress.Name = "lblAddress"; 49 this.lblAddress.Size = new System.Drawing.Size(44, 13); 50 this.lblAddress.TabIndex = 1; 51 this.lblAddress.Text = "address"; 48 this.lblAddress1.AutoSize = true; 49 this.lblAddress1.Location = new System.Drawing.Point(18, 43); 50 this.lblAddress1.Name = "lblAddress1"; 51 this.lblAddress1.Size = new System.Drawing.Size(44, 13); 52 this.lblAddress1.TabIndex = 1; 53 this.lblAddress1.Text = "address"; 54 // 55 // label2 56 // 57 this.label2.AutoSize = true; 58 this.label2.Location = new System.Drawing.Point(18, 76); 59 this.label2.Name = "label2"; 60 this.label2.Size = new System.Drawing.Size(195, 13); 61 this.label2.TabIndex = 2; 62 this.label2.Text = "Hive Server Console Facade running @"; 63 // 64 // lblAddress2 65 // 66 this.lblAddress2.AutoSize = true; 67 this.lblAddress2.Location = new System.Drawing.Point(18, 102); 68 this.lblAddress2.Name = "lblAddress2"; 69 this.lblAddress2.Size = new System.Drawing.Size(44, 13); 70 this.lblAddress2.TabIndex = 3; 71 this.lblAddress2.Text = "address"; 52 72 // 53 73 // MainForm … … 55 75 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 56 76 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 57 this.ClientSize = new System.Drawing.Size(304, 78); 58 this.Controls.Add(this.lblAddress); 77 this.ClientSize = new System.Drawing.Size(304, 128); 78 this.Controls.Add(this.lblAddress2); 79 this.Controls.Add(this.label2); 80 this.Controls.Add(this.lblAddress1); 59 81 this.Controls.Add(this.label1); 60 82 this.Name = "MainForm"; … … 68 90 69 91 private System.Windows.Forms.Label label1; 70 private System.Windows.Forms.Label lblAddress; 92 private System.Windows.Forms.Label lblAddress1; 93 private System.Windows.Forms.Label label2; 94 private System.Windows.Forms.Label lblAddress2; 71 95 } 72 96 } -
trunk/sources/HeuristicLab.Hive.Server/MainForm.cs
r741 r800 11 11 { 12 12 public partial class MainForm : Form { 13 public MainForm(Uri address ) {13 public MainForm(Uri address1, Uri address2) { 14 14 InitializeComponent(); 15 if(address != null) 16 this.lblAddress.Text = address.ToString(); 15 if(address1 != null) 16 this.lblAddress1.Text = address1.ToString(); 17 if (address2 != null) 18 this.lblAddress2.Text = address2.ToString(); 17 19 } 18 20 }
Note: See TracChangeset
for help on using the changeset viewer.