Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 |
|
---|
6 | using HeuristicLab.Hive.Contracts.Interfaces;
|
---|
7 | using System.ServiceModel;
|
---|
8 | using HeuristicLab.Hive.Contracts;
|
---|
9 |
|
---|
10 | namespace 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 | ChannelFactory<IServerConsoleFacade> factory =
|
---|
31 | new ChannelFactory<IServerConsoleFacade>(
|
---|
32 | WcfSettings.GetBinding(),
|
---|
33 | new EndpointAddress("net.tcp://" + Address + ":" + Port + "/HiveServerConsole/ServerConsoleFacade"));
|
---|
34 |
|
---|
35 | serverConsoleFacade = factory.CreateChannel();
|
---|
36 | }
|
---|
37 |
|
---|
38 | return serverConsoleFacade;
|
---|
39 | }
|
---|
40 |
|
---|
41 | internal static void ShutDownFacade() {
|
---|
42 | serverConsoleFacade = null;
|
---|
43 | }
|
---|
44 | }
|
---|
45 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.