- Timestamp:
- 12/07/10 11:19:33 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4
- Files:
-
- 1 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj
r5043 r5055 84 84 <Compile Include="Exceptions\OptimizerNotFoundException.cs" /> 85 85 <Compile Include="HiveExperiment\PluginClient.cs" /> 86 <Compile Include="IServiceLocator.cs" /> 86 87 <Compile Include="Jobs\OptimizerJob.cs" /> 87 88 <Compile Include="HeuristicLabClientsHivePlugin.cs" /> … … 96 97 <Compile Include="PersistenceUtil.cs" /> 97 98 <None Include="Properties\AssemblyInfo.cs.frame" /> 98 <Compile Include="ServiceClients\ServiceClientFactory.cs" />99 99 <Compile Include="Exceptions\ServiceClientFactoryException.cs" /> 100 100 <Compile Include="ServiceLocator.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/HiveExperimentClient.cs
r5053 r5055 34 34 using HeuristicLab.Services.Hive.Common.DataTransfer; 35 35 using HeuristicLab.Clients.Hive.Jobs; 36 using HeuristicLab.Clients.Common; 36 37 37 38 /// <summary> … … 223 224 this.progress = new Progress("Connecting to server..."); 224 225 IsProgressing = true; 225 using (Disposable<IHiveService> service = ServiceLocator.Instance. ServicePool.GetService()) {226 using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) { 226 227 IEnumerable<string> groups = ToResourceIdList(this.ResourceIds); 227 228 this.HiveJob.SetIndexInParentOptimizerList(null); … … 303 304 304 305 public void Stop() { 305 using (Disposable<IHiveService> service = ServiceLocator.Instance. ServicePool.GetService()) {306 using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) { 306 307 foreach (HiveJob hj in HiveJob.GetAllHiveJobs()) { 307 308 service.Obj.StopJob(hj.Job.Id); … … 531 532 int jobCount = 0; 532 533 progress.Status = "Connecting to Server..."; 533 using (var service = ServiceLocator.Instance. ServicePool.GetService()) {534 using (var service = ServiceLocator.Instance.GetService()) { 534 535 // fetch all Job objects to create the full tree of tree of HiveJob objects 535 536 progress.Status = "Downloading list of jobs..."; … … 607 608 608 609 private OptimizerJob LoadOptimizerJob(Guid jobId) { 609 using (var service = ServiceLocator.Instance. ServicePool.GetService()) {610 using (var service = ServiceLocator.Instance.GetService()) { 610 611 JobData jobData = service.Obj.GetJobData(jobId); 611 612 try { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/HiveExperimentManagerClient.cs
r4905 r5055 32 32 using HeuristicLab.Common; 33 33 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 34 using HeuristicLab.Clients.Common; 34 35 35 36 [Item("Hive Client", "Connects to Hive and lists all submitted experiments by the current user.")] … … 96 97 this.HiveExperiments = new ItemList<HiveExperimentClient>(); 97 98 } 98 using (var service = ServiceLocator.Instance. ServicePool.GetService()) {99 using (var service = ServiceLocator.Instance.GetService()) { 99 100 currentlyUpdating = true; 100 101 IEnumerable<DT.HiveExperiment> response = service.Obj.GetHiveExperiments(); … … 138 139 void hiveExperiments_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<HiveExperimentClient>> e) { 139 140 if (!currentlyUpdating) { 140 using (Disposable<IHiveService> service = ServiceLocator.Instance. ServicePool.GetService()) {141 using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) { 141 142 foreach (IndexedItem<HiveExperimentClient> item in e.Items) { 142 143 if (item.Value.HiveExperimentId != Guid.Empty) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/HiveJobClient.cs
r5053 r5055 464 464 465 465 IEnumerable<IPluginDescription> neededPlugins = ApplicationManager.Manager.Plugins; //HivePluginInfoDto.FindPluginsNeeded(optimizerJob.GetType()); 466 using (var service = ServiceLocator.Instance. ServicePool.GetService()) {466 using (var service = ServiceLocator.Instance.GetService()) { 467 467 IEnumerable<Plugin> availablePlugins = service.Obj.GetPlugins(); 468 468 foreach (IPluginDescription neededPlugin in neededPlugins) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/JobResultPoller.cs
r4629 r5055 27 27 using HeuristicLab.Services.Hive.Common.DataTransfer; 28 28 using System.Collections.Generic; 29 using HeuristicLab.Clients.Common; 29 30 30 31 namespace HeuristicLab.Clients.Hive { … … 95 96 96 97 private void FetchJobResults() { 97 using (Disposable<IHiveService> service = ServiceLocator.Instance. ServicePool.GetService()) {98 using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) { 98 99 IEnumerable<LightweightJob> response = service.Obj.GetLightweightChildJobs(hiveJob.Job.Id, true, true); 99 100 OnJobResultsReceived(response); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/PluginClient.cs
r4905 r5055 16 16 17 17 public void Load() { 18 using (var service = ServiceLocator.Instance. ServicePool.GetService()) {18 using (var service = ServiceLocator.Instance.GetService()) { 19 19 20 20 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceLocator.cs
r4905 r5055 22 22 using HeuristicLab.Services.Hive.Common.ServiceContracts; 23 23 using HeuristicLab.Clients.Hive.Properties; 24 using HeuristicLab.Clients.Common; 24 25 25 26 namespace HeuristicLab.Clients.Hive { 26 public class ServiceLocator { 27 private static ServiceLocator instance = null; 28 private ServiceClientFactory<IHiveService> serviceFactory = null; 29 30 public static ServiceLocator Instance { 27 public class ServiceLocator : IServiceLocator { 28 private static IServiceLocator instance = null; 29 public static IServiceLocator Instance { 31 30 get { 32 31 if (instance == null) { … … 35 34 return instance; 36 35 } 37 } 38 39 public ServiceLocator() { 40 Settings.Default.SettingChanging += new System.Configuration.SettingChangingEventHandler(Default_SettingChanging); 41 } 42 43 private void Default_SettingChanging(object sender, System.Configuration.SettingChangingEventArgs e) { 44 if (serviceFactory != null) { 45 serviceFactory.Username = Settings.Default.HiveUsername; 46 serviceFactory.Password = Settings.Default.HivePassword; 36 set { 37 instance = value; 47 38 } 48 39 } 49 40 50 public ServiceClientFactory<IHiveService> ServicePool { 51 get { 52 if (serviceFactory == null) { 53 serviceFactory = new ServiceClientFactory<IHiveService>(Settings.Default.HiveUsername, Settings.Default.HivePassword, "wsHttpBinding_IHiveService"); 54 } 55 return serviceFactory; 56 } 41 public Disposable<IHiveService> GetService() { 42 return ClientFactory.CreateClient<IHiveService>("wsHttpBinding_IHiveService"); 57 43 } 58 44 }
Note: See TracChangeset
for help on using the changeset viewer.