aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs
diff options
context:
space:
mode:
authorSean Dague2008-09-03 18:04:37 +0000
committerSean Dague2008-09-03 18:04:37 +0000
commit12beaccec79319186ae2a7bf3663510584117a63 (patch)
tree0dadf7a61269ae5215d1c007a2c8b7749e84e434 /OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs
parentUpdate svn properties. (diff)
downloadopensim-SC_OLD-12beaccec79319186ae2a7bf3663510584117a63.zip
opensim-SC_OLD-12beaccec79319186ae2a7bf3663510584117a63.tar.gz
opensim-SC_OLD-12beaccec79319186ae2a7bf3663510584117a63.tar.bz2
opensim-SC_OLD-12beaccec79319186ae2a7bf3663510584117a63.tar.xz
Merge branch 'cms' of http://pokgsa.ibm.com/~jbongio/public/opensim
Diffstat (limited to 'OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs111
1 files changed, 111 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs
new file mode 100644
index 0000000..22177ae
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementModule.cs
@@ -0,0 +1,111 @@
1// ContentManagementModule.cs
2// User: bongiojp
3
4
5
6using System;
7using System.Collections.Generic;
8using libsecondlife;
9using Nini.Config;
10using OpenSim;
11using OpenSim.Framework;
12using OpenSim.Region.Environment.Interfaces;
13using OpenSim.Region.Environment.Scenes;
14using log4net;
15using OpenSim.Region.Physics.Manager;
16using Axiom.Math;
17using System.Threading;
18
19namespace OpenSim.Region.Environment.Modules.ContentManagement
20{
21 public class ContentManagementModule : IRegionModule
22 {
23 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
24 CMController m_control = null;
25 CMModel m_model = null;
26 CMView m_view = null;
27 bool initialised = false;
28 bool m_posted = false;
29 bool m_enabled = true;
30
31 public void Initialise(Scene scene, IConfigSource source)
32 {
33 string databaseDir = "./";
34 string database = "FilesyStemDatabase";
35 int channel = 345;
36 try
37 {
38 if (!source.Configs["CMS"].GetBoolean("Enabled", false))
39 m_enabled = false;
40
41 databaseDir = source.Configs["CMS"].GetString("Directory", databaseDir);
42 database = source.Configs["CMS"].GetString("Database", database);
43 channel = source.Configs["CMS"].GetInt("Channel", channel);
44 if (database != "FileSystemDatabase" && database != "GitDatabase")
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
56 if (!m_enabled)
57 {
58 m_log.Info("[Content Management]: Content Management System is not Enabled.");
59 return;
60 }
61
62 lock(this)
63 {
64 if (!initialised) //only init once
65 {
66 m_view = new CMView();
67 m_model = new CMModel();
68 m_control = new CMController(m_model, m_view, scene, channel);
69 m_model.Initialise(database);
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()
84 {
85 if (! m_enabled)
86 return;
87
88 lock(this)
89 {
90 if (!m_posted) //only post once
91 {
92 m_model.PostInitialise();
93 m_posted = true;
94 }
95 }
96 }
97
98 public void Close()
99 {}
100
101 public string Name
102 {
103 get { return "ContentManagementModule"; }
104 }
105
106 public bool IsSharedModule
107 {
108 get { return true; }
109 }
110 }
111}