Changeset 4092 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/ServiceLocator.cs
- Timestamp:
- 07/23/10 14:17:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/ServiceLocator.cs
r4060 r4092 31 31 using HeuristicLab.Security.Contracts.Interfaces; 32 32 33 /// <summary> 34 /// The service locator for the server core 35 /// </summary> 36 public class ServiceLocator { 37 private static IClientManager clientManager = null; 33 namespace HeuristicLab.Hive.Server.Core { 34 /// <summary> 35 /// The service locator for the server core 36 /// </summary> 37 public class ServiceLocator { 38 private static IClientManager clientManager = null; 38 39 39 private static IJobManager jobManager = null;40 private static IJobManager jobManager = null; 40 41 41 private static IClientCommunicator clientCommunicator = null;42 private static IClientCommunicator clientCommunicator = null; 42 43 43 private static ILifecycleManager lifecycleManager = null;44 private static ILifecycleManager lifecycleManager = null; 44 45 45 private static ISessionFactory sessionFactory = null;46 private static ISessionFactory sessionFactory = null; 46 47 47 private static IScheduler scheduler = null;48 private static IScheduler scheduler = null; 48 49 49 private static IPermissionManager permManager = null;50 private static IPermissionManager permManager = null; 50 51 51 private static IHivePermissionManager hivePermManager = null;52 private static IHivePermissionManager hivePermManager = null; 52 53 53 /// <summary> 54 /// Gets the client manager 55 /// </summary> 56 /// <returns></returns> 57 [MethodImpl(MethodImplOptions.Synchronized)] 58 public static IClientManager GetClientManager() { 59 if (clientManager == null) 60 clientManager = new ClientManager(); 54 private static IContextFactory contextFactory = null; 61 55 62 return clientManager; 63 } 56 /// <summary> 57 /// Gets the client manager 58 /// </summary> 59 /// <returns></returns> 60 [MethodImpl(MethodImplOptions.Synchronized)] 61 public static IClientManager GetClientManager() { 62 if (clientManager == null) 63 clientManager = new ClientManager(); 64 64 65 /// <summary> 66 /// Gets the job manager 67 /// </summary> 68 /// <returns></returns> 69 [MethodImpl(MethodImplOptions.Synchronized)] 70 public static IJobManager GetJobManager() { 71 if (jobManager == null) 72 jobManager = new JobManager(); 73 74 return jobManager; 75 } 76 77 /// <summary> 78 /// Gets the client Communicator 79 /// </summary> 80 /// <returns></returns> 81 [MethodImpl(MethodImplOptions.Synchronized)] 82 public static IClientCommunicator GetClientCommunicator() { 83 if (clientCommunicator == null) 84 clientCommunicator = new ClientCommunicator(); 85 86 return clientCommunicator; 87 } 88 89 /// <summary> 90 /// Gets the lifecycle manager 91 /// </summary> 92 /// <returns></returns> 93 [MethodImpl(MethodImplOptions.Synchronized)] 94 public static ILifecycleManager GetLifecycleManager() { 95 if (lifecycleManager == null) { 96 lifecycleManager = new LifecycleManager(); 97 } 98 return lifecycleManager; 99 } 100 101 /// <summary> 102 /// Gets the db session factory 103 /// </summary> 104 /// <returns></returns> 105 [MethodImpl(MethodImplOptions.Synchronized)] 106 public static ISessionFactory GetSessionFactory() { 107 if (sessionFactory == null) { 108 sessionFactory = 109 ApplicationManager.Manager.GetInstances<ISessionFactory>().First(); 110 111 sessionFactory.DbConnectionType = 112 typeof(SqlConnection); 113 114 sessionFactory.DbConnectionString = 115 HeuristicLab.Hive.Server.Core.Properties.Settings.Default.HiveServerConnectionString; 65 return clientManager; 116 66 } 117 67 118 return sessionFactory; 119 } 68 /// <summary> 69 /// Gets the job manager 70 /// </summary> 71 /// <returns></returns> 72 [MethodImpl(MethodImplOptions.Synchronized)] 73 public static IJobManager GetJobManager() { 74 if (jobManager == null) 75 jobManager = new JobManager(); 120 76 121 /// <summary> 122 /// Gets the scheduler 123 /// </summary> 124 /// <returns></returns> 125 [MethodImpl(MethodImplOptions.Synchronized)] 126 public static IScheduler GetScheduler() { 127 if (scheduler == null) { 128 scheduler = ApplicationManager.Manager.GetInstances<IScheduler>().First(); 77 return jobManager; 129 78 } 130 79 131 return scheduler; 132 } 80 /// <summary> 81 /// Gets the client Communicator 82 /// </summary> 83 /// <returns></returns> 84 [MethodImpl(MethodImplOptions.Synchronized)] 85 public static IClientCommunicator GetClientCommunicator() { 86 if (clientCommunicator == null) 87 clientCommunicator = new ClientCommunicator(); 133 88 134 /// <summary> 135 /// Gets the permission manager 136 /// </summary> 137 /// <returns></returns> 138 [MethodImpl(MethodImplOptions.Synchronized)] 139 public static IPermissionManager GetPermissionManager() { 140 if (permManager == null) 141 permManager = ApplicationManager.Manager.GetInstances<IPermissionManager>().First(); 142 return permManager; 143 144 } 89 return clientCommunicator; 90 } 145 91 146 /// <summary> 147 /// Gets the permission manager 148 /// </summary> 149 /// <returns></returns> 150 [MethodImpl(MethodImplOptions.Synchronized)] 151 public static IHivePermissionManager GetHivePermissionManager() { 152 if (hivePermManager == null) 153 hivePermManager = ApplicationManager.Manager.GetInstances<IHivePermissionManager>().First(); 154 return hivePermManager; 92 /// <summary> 93 /// Gets the lifecycle manager 94 /// </summary> 95 /// <returns></returns> 96 [MethodImpl(MethodImplOptions.Synchronized)] 97 public static ILifecycleManager GetLifecycleManager() { 98 if (lifecycleManager == null) { 99 lifecycleManager = new LifecycleManager(); 100 } 101 return lifecycleManager; 102 } 155 103 104 /// <summary> 105 /// Gets the db session factory 106 /// </summary> 107 /// <returns></returns> 108 [MethodImpl(MethodImplOptions.Synchronized)] 109 public static ISessionFactory GetSessionFactory() { 110 if (sessionFactory == null) { 111 sessionFactory = ApplicationManager.Manager.GetInstances<ISessionFactory>().First(); 112 sessionFactory.DbConnectionType = typeof(SqlConnection); 113 sessionFactory.DbConnectionString = HeuristicLab.Hive.Server.Core.Properties.Settings.Default.HiveServerConnectionString; 114 } 115 116 return sessionFactory; 117 } 118 119 /// <summary> 120 /// Gets the scheduler 121 /// </summary> 122 /// <returns></returns> 123 [MethodImpl(MethodImplOptions.Synchronized)] 124 public static IScheduler GetScheduler() { 125 if (scheduler == null) { 126 scheduler = ApplicationManager.Manager.GetInstances<IScheduler>().First(); 127 } 128 129 return scheduler; 130 } 131 132 /// <summary> 133 /// Gets the permission manager 134 /// </summary> 135 /// <returns></returns> 136 [MethodImpl(MethodImplOptions.Synchronized)] 137 public static IPermissionManager GetPermissionManager() { 138 if (permManager == null) 139 permManager = ApplicationManager.Manager.GetInstances<IPermissionManager>().First(); 140 return permManager; 141 142 } 143 144 /// <summary> 145 /// Gets the permission manager 146 /// </summary> 147 /// <returns></returns> 148 [MethodImpl(MethodImplOptions.Synchronized)] 149 public static IHivePermissionManager GetHivePermissionManager() { 150 if (hivePermManager == null) 151 hivePermManager = ApplicationManager.Manager.GetInstances<IHivePermissionManager>().First(); 152 return hivePermManager; 153 154 } 155 156 /// <summary> 157 /// Gets the database context manager 158 /// </summary> 159 /// <returns></returns> 160 [MethodImpl(MethodImplOptions.Synchronized)] 161 public static IContextFactory GetContextFactory() { 162 if (contextFactory == null) 163 contextFactory = ApplicationManager.Manager.GetInstances<IContextFactory>().First(); 164 return contextFactory; 165 } 156 166 } 157 167 }
Note: See TracChangeset
for help on using the changeset viewer.