Changeset 4091 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Communication/3.3/WcfService.cs
- Timestamp:
- 07/23/10 09:37:57 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Communication/3.3/WcfService.cs
r3931 r4091 26 26 using System.ServiceModel; 27 27 using HeuristicLab.Hive.Contracts.Interfaces; 28 using HeuristicLab.Hive.Contracts;29 using HeuristicLab.Hive.Contracts.BusinessObjects;30 28 using HeuristicLab.Hive.Client.Common; 31 using HeuristicLab.Hive.Client.Communication.ServerService;32 29 using HeuristicLab.PluginInfrastructure; 33 30 using System.IO; 34 31 using System.Runtime.Serialization.Formatters.Binary; 35 32 using HeuristicLab.Tracing; 33 using HeuristicLab.Hive.Contracts; 34 using HeuristicLab.Hive.Contracts.BusinessObjects; 36 35 37 36 namespace HeuristicLab.Hive.Client.Communication { 37 using Service = HeuristicLab.Hive.Client.Communication.ServerService; 38 38 39 /// <summary> 39 40 /// WcfService class is implemented as a Singleton and works as a communication Layer with the Server … … 64 65 public event EventHandler Connected; 65 66 66 public ClientFacadeClient proxy = null;67 public Service.ClientFacadeClient proxy = null; 67 68 68 69 /// <summary> … … 85 86 86 87 Logger.Debug("Creating the new connection proxy"); 87 proxy = new ClientFacadeClient(88 WcfSettings.GetStreamedBinding(),88 proxy = new HeuristicLab.Hive.Client.Communication.ServerService.ClientFacadeClient( 89 HeuristicLab.Hive.Contracts.WcfSettings.GetStreamedBinding(), 89 90 new EndpointAddress("net.tcp://" + ServerIP + ":" + ServerPort + "/HiveServer/ClientCommunicator") 90 91 ); … … 92 93 93 94 Logger.Debug("Registring new Events"); 94 proxy.LoginCompleted += new EventHandler< LoginCompletedEventArgs>(proxy_LoginCompleted);95 proxy.SendStreamedJobCompleted += new EventHandler<Se ndStreamedJobCompletedEventArgs>(proxy_SendStreamedJobCompleted);96 proxy.StoreFinishedJobResultStreamedCompleted += new EventHandler<S toreFinishedJobResultStreamedCompletedEventArgs>(proxy_StoreFinishedJobResultStreamedCompleted);97 proxy.ProcessSnapshotStreamedCompleted += new EventHandler< ProcessSnapshotStreamedCompletedEventArgs>(proxy_ProcessSnapshotStreamedCompleted);98 proxy.ProcessHeartBeatCompleted += new EventHandler< ProcessHeartBeatCompletedEventArgs>(proxy_ProcessHeartBeatCompleted);95 proxy.LoginCompleted += new EventHandler<Service.LoginCompletedEventArgs>(proxy_LoginCompleted); 96 proxy.SendStreamedJobCompleted += new EventHandler<Service.SendStreamedJobCompletedEventArgs>(proxy_SendStreamedJobCompleted); 97 proxy.StoreFinishedJobResultStreamedCompleted += new EventHandler<Service.StoreFinishedJobResultStreamedCompletedEventArgs>(proxy_StoreFinishedJobResultStreamedCompleted); 98 proxy.ProcessSnapshotStreamedCompleted += new EventHandler<Service.ProcessSnapshotStreamedCompletedEventArgs>(proxy_ProcessSnapshotStreamedCompleted); 99 proxy.ProcessHeartBeatCompleted += new EventHandler<Service.ProcessHeartBeatCompletedEventArgs>(proxy_ProcessHeartBeatCompleted); 99 100 Logger.Debug("Registered new Events"); 100 101 Logger.Debug("Opening the Connection"); … … 164 165 /// </summary> 165 166 #region Login 166 public event System.EventHandler< LoginCompletedEventArgs> LoginCompleted;167 public event System.EventHandler<Service.LoginCompletedEventArgs> LoginCompleted; 167 168 public void LoginAsync(ClientDto clientInfo) { 168 169 if (ConnState == NetworkEnum.WcfConnState.Connected) { … … 171 172 } 172 173 } 173 private void proxy_LoginCompleted(object sender, LoginCompletedEventArgs e) {174 private void proxy_LoginCompleted(object sender, Service.LoginCompletedEventArgs e) { 174 175 if (e.Error == null) { 175 176 Logger.Debug("ENDED: Login Async"); … … 183 184 if (ConnState == NetworkEnum.WcfConnState.Connected) { 184 185 Logger.Debug("STARTED: Login Sync"); 185 Response res = proxy.Login(clientInfo);186 HeuristicLab.Hive.Contracts.Response res = proxy.Login(clientInfo); 186 187 if (!res.Success) { 187 188 Logger.Error("FAILED: Login Failed! " + res.StatusMessage); … … 204 205 /// </summary> 205 206 #region PullJob 206 public event System.EventHandler<Se ndJobCompletedEventArgs> SendJobCompleted;207 public event System.EventHandler<Service.SendJobCompletedEventArgs> SendJobCompleted; 207 208 public void SendJobAsync(Guid guid) { 208 209 if (ConnState == NetworkEnum.WcfConnState.Loggedin) { … … 212 213 } 213 214 214 void proxy_SendStreamedJobCompleted(object sender, Se ndStreamedJobCompletedEventArgs e) {215 void proxy_SendStreamedJobCompleted(object sender, Service.SendStreamedJobCompletedEventArgs e) { 215 216 if (e.Error == null) { 216 217 Logger.Debug("ENDED: Fetching of Jobs from Server for Client"); … … 238 239 memStream.Close(); 239 240 240 Se ndJobCompletedEventArgs completedEventArgs =241 new Se ndJobCompletedEventArgs(new object[] { response, memStream.GetBuffer() }, e.Error, e.Cancelled, e.UserState);241 Service.SendJobCompletedEventArgs completedEventArgs = 242 new Service.SendJobCompletedEventArgs(new object[] { response, memStream.GetBuffer() }, e.Error, e.Cancelled, e.UserState); 242 243 SendJobCompleted(sender, completedEventArgs); 243 244 } catch (Exception ex) { … … 260 261 /// </summary> 261 262 #region SendJobResults 262 public event System.EventHandler<S toreFinishedJobResultCompletedEventArgs> StoreFinishedJobResultCompleted;263 public event System.EventHandler<Service.StoreFinishedJobResultCompletedEventArgs> StoreFinishedJobResultCompleted; 263 264 public void StoreFinishedJobResultAsync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception, bool finished) { 264 265 if (ConnState == NetworkEnum.WcfConnState.Loggedin) { … … 272 273 } 273 274 } 274 private void proxy_StoreFinishedJobResultStreamedCompleted(object sender, S toreFinishedJobResultStreamedCompletedEventArgs e) {275 private void proxy_StoreFinishedJobResultStreamedCompleted(object sender, Service.StoreFinishedJobResultStreamedCompletedEventArgs e) { 275 276 Logger.Debug("Finished storing the job"); 276 277 Stream stream = … … 281 282 } 282 283 if (e.Error == null) { 283 S toreFinishedJobResultCompletedEventArgs args =284 new S toreFinishedJobResultCompletedEventArgs(284 Service.StoreFinishedJobResultCompletedEventArgs args = 285 new Service.StoreFinishedJobResultCompletedEventArgs( 285 286 new object[] { e.Result }, e.Error, e.Cancelled, e.UserState); 286 287 Logger.Debug("calling the Finished Job Event"); … … 294 295 295 296 #region Processsnapshots 296 public event System.EventHandler< ProcessSnapshotCompletedEventArgs> ProcessSnapshotCompleted;297 public event System.EventHandler<Service.ProcessSnapshotCompletedEventArgs> ProcessSnapshotCompleted; 297 298 public void ProcessSnapshotAsync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception, bool finished) { 298 299 if (ConnState == NetworkEnum.WcfConnState.Loggedin) { … … 303 304 } 304 305 } 305 void proxy_ProcessSnapshotStreamedCompleted(object sender, ProcessSnapshotStreamedCompletedEventArgs e) {306 void proxy_ProcessSnapshotStreamedCompleted(object sender, Service.ProcessSnapshotStreamedCompletedEventArgs e) { 306 307 Stream stream = 307 308 (Stream)e.UserState; … … 310 311 311 312 if (e.Error == null) { 312 ProcessSnapshotCompletedEventArgs args =313 new ProcessSnapshotCompletedEventArgs(313 Service.ProcessSnapshotCompletedEventArgs args = 314 new Service.ProcessSnapshotCompletedEventArgs( 314 315 new object[] { e.Result }, e.Error, e.Cancelled, e.UserState); 315 316 … … 326 327 #region Heartbeat 327 328 328 public event System.EventHandler< ProcessHeartBeatCompletedEventArgs> ProcessHeartBeatCompleted;329 public event System.EventHandler<Service.ProcessHeartBeatCompletedEventArgs> ProcessHeartBeatCompleted; 329 330 public void ProcessHeartBeatAsync(HeartBeatData hbd) { 330 331 if (ConnState == NetworkEnum.WcfConnState.Loggedin) … … 333 334 } 334 335 335 private void proxy_ProcessHeartBeatCompleted(object sender, ProcessHeartBeatCompletedEventArgs e) {336 private void proxy_ProcessHeartBeatCompleted(object sender, Service.ProcessHeartBeatCompletedEventArgs e) { 336 337 if (e.Error == null && e.Result.Success) { 337 338 ProcessHeartBeatCompleted(sender, e); … … 406 407 } 407 408 408 public List< CachedHivePluginInfoDto> RequestPlugins(List<HivePluginInfoDto> requestedPlugins) {409 public List<HeuristicLab.PluginInfrastructure.CachedHivePluginInfoDto> RequestPlugins(List<HivePluginInfoDto> requestedPlugins) { 409 410 try { 410 411 Logger.Debug("STARTED: Requesting Plugins for Job"); … … 451 452 } 452 453 453 public Response SetCalendarStatus 454 public Response SetCalendarStatus(Guid clientId, CalendarState state) { 454 455 try { 455 456 Logger.Debug("STARTED: Setting Calendar status to: " + state);
Note: See TracChangeset
for help on using the changeset viewer.