[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 |
|
---|
| 22 | using HeuristicLab.Services.Hive.DataAccess;
|
---|
[12468] | 23 | using HeuristicLab.Services.Hive.DataAccess.Interfaces;
|
---|
| 24 | using HeuristicLab.Services.Hive.DataAccess.Manager;
|
---|
[12691] | 25 | using HeuristicLab.Services.Hive.Manager;
|
---|
[6983] | 26 |
|
---|
| 27 | namespace 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 |
|
---|
[12468] | 39 | public IPersistenceManager PersistenceManager {
|
---|
[12691] | 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 | }
|
---|
[12468] | 46 | }
|
---|
| 47 |
|
---|
[6983] | 48 | private IHiveDao hiveDao;
|
---|
| 49 | public IHiveDao HiveDao {
|
---|
| 50 | get {
|
---|
| 51 | if (hiveDao == null) hiveDao = new HiveDao();
|
---|
| 52 | return hiveDao;
|
---|
| 53 | }
|
---|
| 54 | }
|
---|
| 55 |
|
---|
[9665] | 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 |
|
---|
[8051] | 65 | private Access.IRoleVerifier roleVerifier;
|
---|
| 66 | public Access.IRoleVerifier RoleVerifier {
|
---|
[6983] | 67 | get {
|
---|
[8051] | 68 | if (roleVerifier == null) roleVerifier = new Access.RoleVerifier();
|
---|
| 69 | return roleVerifier;
|
---|
[6983] | 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 {
|
---|
[12789] | 84 | if (eventManager == null) eventManager = new NewEventManager();
|
---|
[6983] | 85 | return eventManager;
|
---|
| 86 | }
|
---|
| 87 | }
|
---|
| 88 |
|
---|
[12441] | 89 | private IStatisticsGenerator statisticsGenerator;
|
---|
| 90 | public IStatisticsGenerator StatisticsGenerator {
|
---|
| 91 | get { return statisticsGenerator ?? (statisticsGenerator = new HiveStatisticsGenerator()); }
|
---|
| 92 | }
|
---|
| 93 |
|
---|
[6983] | 94 | private ITransactionManager transactionManager;
|
---|
| 95 | public ITransactionManager TransactionManager {
|
---|
| 96 | get {
|
---|
| 97 | if (transactionManager == null) transactionManager = new TransactionManager();
|
---|
| 98 | return transactionManager;
|
---|
| 99 | }
|
---|
| 100 | }
|
---|
| 101 |
|
---|
[8051] | 102 | private Access.IUserManager userManager;
|
---|
| 103 | public Access.IUserManager UserManager {
|
---|
[6983] | 104 | get {
|
---|
[8051] | 105 | if (userManager == null) userManager = new Access.UserManager();
|
---|
[6983] | 106 | return userManager;
|
---|
| 107 | }
|
---|
| 108 | }
|
---|
| 109 |
|
---|
[12691] | 110 | private NewHeartbeatManager newheartbeatManager;
|
---|
| 111 | public NewHeartbeatManager NewHeartbeatManager {
|
---|
| 112 | get {
|
---|
| 113 | if (newheartbeatManager == null) newheartbeatManager = new NewHeartbeatManager();
|
---|
| 114 | return newheartbeatManager;
|
---|
| 115 | }
|
---|
| 116 | }
|
---|
| 117 |
|
---|
[6983] | 118 | private HeartbeatManager heartbeatManager;
|
---|
| 119 | public HeartbeatManager HeartbeatManager {
|
---|
| 120 | get {
|
---|
[8051] | 121 | if (heartbeatManager == null) heartbeatManager = new HeartbeatManager();
|
---|
[6983] | 122 | return heartbeatManager;
|
---|
| 123 | }
|
---|
| 124 | }
|
---|
[9123] | 125 |
|
---|
| 126 | private ITaskScheduler taskScheduler;
|
---|
| 127 | public ITaskScheduler TaskScheduler {
|
---|
| 128 | get {
|
---|
| 129 | if (taskScheduler == null) taskScheduler = new RoundRobinTaskScheduler();
|
---|
| 130 | return taskScheduler;
|
---|
| 131 | }
|
---|
| 132 | }
|
---|
[12691] | 133 | private ITaskScheduler newtaskScheduler;
|
---|
| 134 | public ITaskScheduler NewTaskScheduler {
|
---|
| 135 | get {
|
---|
| 136 | if (newtaskScheduler == null) newtaskScheduler = new RoundRobinTaskScheduler();
|
---|
| 137 | return newtaskScheduler;
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
[6983] | 140 | }
|
---|
| 141 | }
|
---|