Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Hive.Server.Console/ServiceLocator.cs @ 1449

Last change on this file since 1449 was 1449, checked in by svonolfe, 16 years ago

Refactored DAL (now using GUIDs as IDs instead of longs) (#527)

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