Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/ServiceLocator.cs @ 4760

Last change on this file since 4760 was 4760, checked in by cneumuel, 13 years ago

#1260

  • finished renaming of Hive.Experiment to Hive.ExperimentManager
  • renamed HiveClient to HiveExperimentManager
  • restructured menuitems in optimizer
File size: 2.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Hive.Contracts;
23using HeuristicLab.Hive.Contracts.Interfaces;
24using HeuristicLab.Hive.ExperimentManager.Properties;
25
26namespace HeuristicLab.Hive.ExperimentManager {
27  internal class ServiceLocator {
28    private static ServiceLocator instance = null;
29    private WcfServicePool<IClientFacade> clientFacadePool = null;
30    private WcfServicePool<IClientFacade> streamedClientFacadePool = null;
31
32    internal static ServiceLocator Instance {
33      get {
34        if (instance == null) {
35          instance = new ServiceLocator();
36        }
37        return instance;
38      }
39    }
40
41    public ServiceLocator() {
42      Settings.Default.SettingChanging += new System.Configuration.SettingChangingEventHandler(Default_SettingChanging);
43    }
44
45    internal void Default_SettingChanging(object sender, System.Configuration.SettingChangingEventArgs e) {
46      if (clientFacadePool != null) {
47        clientFacadePool.Username = Settings.Default.HiveUsername;
48        clientFacadePool.Password = Settings.Default.HivePassword;
49      }
50      if (streamedClientFacadePool != null) {
51        streamedClientFacadePool.Username = Settings.Default.HiveUsername;
52        streamedClientFacadePool.Password = Settings.Default.HivePassword;
53      }
54    }
55
56    internal WcfServicePool<IClientFacade> ClientFacadePool {
57      get {
58        if (clientFacadePool == null) {
59          clientFacadePool = new WcfServicePool<IClientFacade>(Settings.Default.HiveUsername, Settings.Default.HivePassword, "ClientHttpEndpoint");
60        }
61        return clientFacadePool;
62      }
63    }
64
65    internal WcfServicePool<IClientFacade> StreamedClientFacadePool {
66      get {
67        if (streamedClientFacadePool == null) {
68          streamedClientFacadePool = new WcfServicePool<IClientFacade>(Settings.Default.HiveUsername, Settings.Default.HivePassword, "ClientTcpStreamedEndpoint");
69        }
70        return streamedClientFacadePool;
71      }
72    }
73  }
74}
Note: See TracBrowser for help on using the repository browser.