diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs index 22177ae..413d00d 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs | |||
@@ -1,8 +1,6 @@ | |||
1 | // ContentManagementModule.cs | 1 | // ContentManagementModule.cs |
2 | // User: bongiojp | 2 | // User: bongiojp |
3 | 3 | ||
4 | |||
5 | |||
6 | using System; | 4 | using System; |
7 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
8 | using libsecondlife; | 6 | using libsecondlife; |
@@ -18,86 +16,88 @@ using System.Threading; | |||
18 | 16 | ||
19 | namespace OpenSim.Region.Environment.Modules.ContentManagement | 17 | namespace OpenSim.Region.Environment.Modules.ContentManagement |
20 | { | 18 | { |
21 | public class ContentManagementModule : IRegionModule | 19 | public class ContentManagementModule : IRegionModule |
22 | { | 20 | { |
23 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 21 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
24 | CMController m_control = null; | 22 | CMController m_control = null; |
25 | CMModel m_model = null; | 23 | CMModel m_model = null; |
26 | CMView m_view = null; | 24 | CMView m_view = null; |
27 | bool initialised = false; | 25 | bool initialised = false; |
28 | bool m_posted = false; | 26 | bool m_posted = false; |
29 | bool m_enabled = true; | 27 | bool m_enabled = false; |
30 | 28 | ||
31 | public void Initialise(Scene scene, IConfigSource source) | 29 | public void Initialise(Scene scene, IConfigSource source) |
32 | { | 30 | { |
33 | string databaseDir = "./"; | 31 | string databaseDir = "./"; |
34 | string database = "FilesyStemDatabase"; | 32 | string database = "FileSystemDatabase"; |
35 | int channel = 345; | 33 | int channel = 345; |
36 | try | 34 | try |
37 | { | 35 | { |
38 | if (!source.Configs["CMS"].GetBoolean("Enabled", false)) | 36 | if (source.Configs["CMS"] == null) |
39 | m_enabled = false; | 37 | return; |
40 | 38 | ||
41 | databaseDir = source.Configs["CMS"].GetString("Directory", databaseDir); | 39 | m_enabled = source.Configs["CMS"].GetBoolean("Enabled", false); |
42 | database = source.Configs["CMS"].GetString("Database", database); | 40 | databaseDir = source.Configs["CMS"].GetString("Directory", databaseDir); |
43 | channel = source.Configs["CMS"].GetInt("Channel", channel); | 41 | database = source.Configs["CMS"].GetString("Database", database); |
44 | if (database != "FileSystemDatabase" && database != "GitDatabase") | 42 | channel = source.Configs["CMS"].GetInt("Channel", channel); |
45 | { | ||
46 | m_log.ErrorFormat("[Content Management]: The Database attribute must be defined as either FileSystemDatabase or GitDatabase"); | ||
47 | m_enabled = false; | ||
48 | } | ||
49 | } | ||
50 | catch (Exception e) | ||
51 | { | ||
52 | m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e); | ||
53 | m_enabled = false; | ||
54 | } | ||
55 | 43 | ||
56 | if (!m_enabled) | 44 | if (database != "FileSystemDatabase" && database != "GitDatabase") |
57 | { | 45 | { |
58 | m_log.Info("[Content Management]: Content Management System is not Enabled."); | 46 | m_log.ErrorFormat("[Content Management]: The Database attribute must be defined as either FileSystemDatabase or GitDatabase"); |
59 | return; | 47 | m_enabled = false; |
60 | } | 48 | } |
61 | 49 | } | |
62 | lock(this) | 50 | catch (Exception e) |
63 | { | 51 | { |
64 | if (!initialised) //only init once | 52 | m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e); |
65 | { | 53 | m_enabled = false; |
66 | m_view = new CMView(); | 54 | } |
67 | m_model = new CMModel(); | 55 | |
68 | m_control = new CMController(m_model, m_view, scene, channel); | 56 | if (!m_enabled) |
69 | m_model.Initialise(database); | 57 | { |
70 | m_view.Initialise(m_model); | 58 | m_log.Info("[Content Management]: Content Management System is not Enabled."); |
71 | 59 | return; | |
72 | initialised = true; | 60 | } |
73 | m_model.InitialiseDatabase(scene, databaseDir); | 61 | |
74 | } | 62 | lock(this) |
75 | else | 63 | { |
76 | { | 64 | if (!initialised) //only init once |
77 | m_model.InitialiseDatabase(scene, databaseDir); | 65 | { |
78 | m_control.RegisterNewRegion(scene); | 66 | m_view = new CMView(); |
79 | } | 67 | m_model = new CMModel(); |
80 | } | 68 | m_control = new CMController(m_model, m_view, scene, channel); |
81 | } | 69 | m_model.Initialise(database); |
82 | 70 | m_view.Initialise(m_model); | |
71 | |||
72 | initialised = true; | ||
73 | m_model.InitialiseDatabase(scene, databaseDir); | ||
74 | } | ||
75 | else | ||
76 | { | ||
77 | m_model.InitialiseDatabase(scene, databaseDir); | ||
78 | m_control.RegisterNewRegion(scene); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public void PostInitialise() | 83 | public void PostInitialise() |
84 | { | 84 | { |
85 | if (! m_enabled) | 85 | if (! m_enabled) |
86 | return; | 86 | return; |
87 | 87 | ||
88 | lock(this) | 88 | lock(this) |
89 | { | 89 | { |
90 | if (!m_posted) //only post once | 90 | if (!m_posted) //only post once |
91 | { | 91 | { |
92 | m_model.PostInitialise(); | 92 | m_model.PostInitialise(); |
93 | m_posted = true; | 93 | m_posted = true; |
94 | } | 94 | } |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | public void Close() | 98 | public void Close() |
99 | {} | 99 | {} |
100 | 100 | ||
101 | public string Name | 101 | public string Name |
102 | { | 102 | { |
103 | get { return "ContentManagementModule"; } | 103 | get { return "ContentManagementModule"; } |
@@ -107,5 +107,5 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
107 | { | 107 | { |
108 | get { return true; } | 108 | get { return true; } |
109 | } | 109 | } |
110 | } | 110 | } |
111 | } | 111 | } |