Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive_Milestone3/sources/HeuristicLab.Hive.Server.Console/3.2/ServiceLocator.cs @ 6452

Last change on this file since 6452 was 2103, checked in by mbecirov, 16 years ago

#586: Handling of exceptions when user enters a wrong IP or Port at Login

File size: 1.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6using HeuristicLab.Hive.Contracts.Interfaces;
7using System.ServiceModel;
8using HeuristicLab.Hive.Contracts;
9
10namespace HeuristicLab.Hive.Server.ServerConsole {
11  internal class ServiceLocator {
12    private static IServerConsoleFacade serverConsoleFacade = null;
13
14    internal static string Address { get; set; }
15    internal static string Port { get; set; }
16
17    internal static IClientManager GetClientManager() {
18      return GetServerConsoleFacade() as IClientManager;
19    }
20
21    internal static IJobManager GetJobManager() {
22      return GetServerConsoleFacade() as IJobManager;
23    }
24
25    internal static IServerConsoleFacade GetServerConsoleFacade() {
26      if (serverConsoleFacade == null &&
27        Address != String.Empty &&
28        Port != String.Empty) {
29
30        //binding.MaxReceivedMessageSize = 5000000;
31
32        ChannelFactory<IServerConsoleFacade> factory =
33          new ChannelFactory<IServerConsoleFacade>(
34            WcfSettings.GetBinding(),
35            new EndpointAddress("net.tcp://" + Address + ":" + Port + "/HiveServerConsole/ServerConsoleFacade"));
36                         
37        serverConsoleFacade = factory.CreateChannel();
38      }
39     
40      return serverConsoleFacade;
41    }
42
43    internal static void ShutDownFacade() {
44      serverConsoleFacade = null;
45    }
46  }
47}
Note: See TracBrowser for help on using the repository browser.