Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/ServiceLocator.cs @ 12700

Last change on this file since 12700 was 12691, checked in by dglaser, 9 years ago

#2388:

HeuristicLab.Services.Access:
HeuristicLab.Services.Access.DataAccess:

  • Changed connection strings and certificates for local usage

HeuristicLab.Services.Hive.DataAccess:

  • Added compiled queries for frequently used queries
  • Integrated string queries from OptimizedHiveDao

HeuristicLab.Services.Hive:

  • Added NewHeartbeatManager.cs
  • Added NewRoundRobinTaskScheduler.cs
  • Added PerformanceLogger
  • Updated AuthoriziationManager
  • Updated NewHiveService
    • Added Regions
    • Implemented missing methods
    • Improved performance of several queries

HeuristicLab.Services.WebApp.Status:

  • Fixed a bug which caused an error when calculating the average waiting time.
File size: 4.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
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;
23using HeuristicLab.Services.Hive.DataAccess.Interfaces;
24using HeuristicLab.Services.Hive.DataAccess.Manager;
25using HeuristicLab.Services.Hive.Manager;
26
27namespace HeuristicLab.Services.Hive {
28
29  public class ServiceLocator : IServiceLocator {
30    private static IServiceLocator instance;
31    public static IServiceLocator Instance {
32      get {
33        if (instance == null) instance = new ServiceLocator();
34        return instance;
35      }
36      set { instance = value; }
37    }
38
39    public IPersistenceManager PersistenceManager {
40      get {
41        var dataContext = HiveOperationContext.Current != null
42                            ? HiveOperationContext.Current.DataContext
43                            : new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString);
44        return new PersistenceManager(dataContext);
45      }
46    }
47
48    private IHiveDao hiveDao;
49    public IHiveDao HiveDao {
50      get {
51        if (hiveDao == null) hiveDao = new HiveDao();
52        return hiveDao;
53      }
54    }
55
56    public IOptimizedHiveDao OptimizedHiveDao {
57      get {
58        var dataContext = HiveOperationContext.Current != null
59                            ? HiveOperationContext.Current.DataContext
60                            : new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString);
61        return new OptimizedHiveDao(dataContext);
62      }
63    }
64
65    private Access.IRoleVerifier roleVerifier;
66    public Access.IRoleVerifier RoleVerifier {
67      get {
68        if (roleVerifier == null) roleVerifier = new Access.RoleVerifier();
69        return roleVerifier;
70      }
71    }
72
73    private IAuthorizationManager authorizationManager;
74    public IAuthorizationManager AuthorizationManager {
75      get {
76        if (authorizationManager == null) authorizationManager = new AuthorizationManager();
77        return authorizationManager;
78      }
79    }
80
81    private IEventManager eventManager;
82    public IEventManager EventManager {
83      get {
84        if (eventManager == null) eventManager = new EventManager();
85        return eventManager;
86      }
87    }
88
89    private IStatisticsGenerator statisticsGenerator;
90    public IStatisticsGenerator StatisticsGenerator {
91      get { return statisticsGenerator ?? (statisticsGenerator = new HiveStatisticsGenerator()); }
92    }
93
94    private ITransactionManager transactionManager;
95    public ITransactionManager TransactionManager {
96      get {
97        if (transactionManager == null) transactionManager = new TransactionManager();
98        return transactionManager;
99      }
100    }
101
102    private Access.IUserManager userManager;
103    public Access.IUserManager UserManager {
104      get {
105        if (userManager == null) userManager = new Access.UserManager();
106        return userManager;
107      }
108    }
109
110    private NewHeartbeatManager newheartbeatManager;
111    public NewHeartbeatManager NewHeartbeatManager {
112      get {
113        if (newheartbeatManager == null) newheartbeatManager = new NewHeartbeatManager();
114        return newheartbeatManager;
115      }
116    }
117
118    private HeartbeatManager heartbeatManager;
119    public HeartbeatManager HeartbeatManager {
120      get {
121        if (heartbeatManager == null) heartbeatManager = new HeartbeatManager();
122        return heartbeatManager;
123      }
124    }
125
126    private ITaskScheduler taskScheduler;
127    public ITaskScheduler TaskScheduler {
128      get {
129        if (taskScheduler == null) taskScheduler = new RoundRobinTaskScheduler();
130        return taskScheduler;
131      }
132    }
133    private ITaskScheduler newtaskScheduler;
134    public ITaskScheduler NewTaskScheduler {
135      get {
136        if (newtaskScheduler == null) newtaskScheduler = new RoundRobinTaskScheduler();
137        return newtaskScheduler;
138      }
139    }
140  }
141}
Note: See TracBrowser for help on using the repository browser.