Rev | Line | |
---|
[799] | 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 |
|
---|
[1089] | 9 | namespace HeuristicLab.Hive.Server.ServerConsole {
|
---|
[799] | 10 | internal class ServiceLocator {
|
---|
[1084] | 11 | private static IServerConsoleFacade serverConsoleFacade = null;
|
---|
[799] | 12 |
|
---|
| 13 | internal static string Address { get; set; }
|
---|
| 14 | internal static string Port { get; set; }
|
---|
| 15 |
|
---|
| 16 | internal static IClientManager GetClientManager() {
|
---|
[1084] | 17 | return GetServerConsoleFacade() as IClientManager;
|
---|
[799] | 18 | }
|
---|
| 19 |
|
---|
| 20 | internal static IJobManager GetJobManager() {
|
---|
[1084] | 21 | return GetServerConsoleFacade() as IJobManager;
|
---|
| 22 | }
|
---|
[799] | 23 |
|
---|
[1084] | 24 | internal static IUserRoleManager GetUserRoleManager() {
|
---|
| 25 | return GetServerConsoleFacade() as IUserRoleManager;
|
---|
[799] | 26 | }
|
---|
| 27 |
|
---|
[1084] | 28 | internal static IServerConsoleFacade GetServerConsoleFacade() {
|
---|
| 29 | if (serverConsoleFacade == null &&
|
---|
[799] | 30 | Address != String.Empty &&
|
---|
| 31 | Port != String.Empty) {
|
---|
[1136] | 32 |
|
---|
| 33 | NetTcpBinding binding =
|
---|
| 34 | new NetTcpBinding();
|
---|
| 35 |
|
---|
| 36 | binding.MaxReceivedMessageSize = 5000000;
|
---|
| 37 |
|
---|
[1084] | 38 | ChannelFactory<IServerConsoleFacade> factory =
|
---|
| 39 | new ChannelFactory<IServerConsoleFacade>(
|
---|
[1136] | 40 | binding,
|
---|
[1084] | 41 | new EndpointAddress("net.tcp://" + Address + ":" + Port + "/HiveServerConsole/ServerConsoleFacade"));
|
---|
[799] | 42 |
|
---|
[1084] | 43 | serverConsoleFacade = factory.CreateChannel();
|
---|
[799] | 44 | }
|
---|
| 45 |
|
---|
[1084] | 46 | return serverConsoleFacade;
|
---|
[799] | 47 | }
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.