Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Services.Hive/3.3/ServiceLocator.cs @ 13957

Last change on this file since 13957 was 12878, checked in by ascheibe, 9 years ago

#2388 merged hive statistics branch into trunk

File size: 3.3 KB
RevLine 
[6983]1#region License Information
2/* HeuristicLab
[12012]3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[6983]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.Services.Hive.DataAccess;
[12878]23using HeuristicLab.Services.Hive.DataAccess.Interfaces;
24using HeuristicLab.Services.Hive.DataAccess.Manager;
25using HeuristicLab.Services.Hive.Manager;
[6983]26
27namespace HeuristicLab.Services.Hive {
28  public class ServiceLocator : IServiceLocator {
29    private static IServiceLocator instance;
30    public static IServiceLocator Instance {
31      get {
32        if (instance == null) instance = new ServiceLocator();
33        return instance;
34      }
35      set { instance = value; }
36    }
37
[12878]38    public IPersistenceManager PersistenceManager {
[6983]39      get {
[9665]40        var dataContext = HiveOperationContext.Current != null
41                            ? HiveOperationContext.Current.DataContext
42                            : new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString);
[12878]43        return new PersistenceManager(dataContext);
[9665]44      }
45    }
46
[8051]47    private Access.IRoleVerifier roleVerifier;
48    public Access.IRoleVerifier RoleVerifier {
[6983]49      get {
[8051]50        if (roleVerifier == null) roleVerifier = new Access.RoleVerifier();
51        return roleVerifier;
[6983]52      }
53    }
54
55    private IAuthorizationManager authorizationManager;
56    public IAuthorizationManager AuthorizationManager {
57      get {
58        if (authorizationManager == null) authorizationManager = new AuthorizationManager();
59        return authorizationManager;
60      }
61    }
62
63    private IEventManager eventManager;
64    public IEventManager EventManager {
65      get {
66        if (eventManager == null) eventManager = new EventManager();
67        return eventManager;
68      }
69    }
70
[12878]71    private IStatisticsGenerator statisticsGenerator;
72    public IStatisticsGenerator StatisticsGenerator {
73      get { return statisticsGenerator ?? (statisticsGenerator = new HiveStatisticsGenerator()); }
[6983]74    }
75
[8051]76    private Access.IUserManager userManager;
77    public Access.IUserManager UserManager {
[6983]78      get {
[8051]79        if (userManager == null) userManager = new Access.UserManager();
[6983]80        return userManager;
81      }
82    }
83
84    private HeartbeatManager heartbeatManager;
85    public HeartbeatManager HeartbeatManager {
86      get {
[8051]87        if (heartbeatManager == null) heartbeatManager = new HeartbeatManager();
[6983]88        return heartbeatManager;
89      }
90    }
[9123]91
92    private ITaskScheduler taskScheduler;
93    public ITaskScheduler TaskScheduler {
94      get {
95        if (taskScheduler == null) taskScheduler = new RoundRobinTaskScheduler();
96        return taskScheduler;
97      }
98    }
[6983]99  }
100}
Note: See TracBrowser for help on using the repository browser.