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 |
|
---|
22 | using HeuristicLab.PluginInfrastructure.Manager;
|
---|
23 |
|
---|
24 | namespace HeuristicLab.PluginInfrastructure
|
---|
25 | {
|
---|
26 |
|
---|
27 | /// <summary>
|
---|
28 | /// The ApplicationManager has a reference to the application manager singleton.
|
---|
29 | /// </summary>
|
---|
30 | public static class ApplicationManager
|
---|
31 | {
|
---|
32 | // the singleton instance is initialized to LightweightApplicationManager as long as no other application manager is registered
|
---|
33 | private static IApplicationManager appManager;
|
---|
34 |
|
---|
35 |
|
---|
36 | public static void InitializeForWeb()
|
---|
37 | {
|
---|
38 | DefaultApplicationManager applicationManager = new DefaultApplicationManager();
|
---|
39 | appManager = applicationManager;
|
---|
40 | PluginManager manager = new PluginManager(@"C:\HeuristicSVN\HeuristicLab.Clients.Hive.WebJobManager\bin\Debug\dnx451\win7-x64");
|
---|
41 | manager.DiscoverAndCheckPlugins();
|
---|
42 | applicationManager.PrepareApplicationDomain(manager.Applications, manager.Plugins);
|
---|
43 | }
|
---|
44 |
|
---|
45 | /// <summary>
|
---|
46 | /// Gets the application manager singleton.
|
---|
47 | /// </summary>
|
---|
48 | public static IApplicationManager Manager
|
---|
49 | {
|
---|
50 | get
|
---|
51 | {
|
---|
52 | if (appManager == null)
|
---|
53 | appManager = new LightweightApplicationManager();
|
---|
54 | return appManager;
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | /// <summary>
|
---|
59 | /// Registers a new application manager.
|
---|
60 | /// </summary>
|
---|
61 | /// <param name="manager"></param>
|
---|
62 | internal static void RegisterApplicationManager(IApplicationManager manager)
|
---|
63 | {
|
---|
64 | if (appManager != null)
|
---|
65 | {
|
---|
66 | appManager = manager;
|
---|
67 | }
|
---|
68 | }
|
---|
69 | }
|
---|
70 | }
|
---|