aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authormingchen2007-07-19 20:39:33 +0000
committermingchen2007-07-19 20:39:33 +0000
commited69e84874b710c2cc3b8af94dd00cf725cf6d03 (patch)
tree0da9c55d9a1ddc796b66ba249fa58b093294828f /OpenSim
parentSome work on Inventory (not yet finished or enabled) (diff)
downloadopensim-SC_OLD-ed69e84874b710c2cc3b8af94dd00cf725cf6d03.zip
opensim-SC_OLD-ed69e84874b710c2cc3b8af94dd00cf725cf6d03.tar.gz
opensim-SC_OLD-ed69e84874b710c2cc3b8af94dd00cf725cf6d03.tar.bz2
opensim-SC_OLD-ed69e84874b710c2cc3b8af94dd00cf725cf6d03.tar.xz
*Moved XmlConfiguration to its own project
*Made it possible to load a configuration interface by DLL *Deleted the 1024 config files until they are updated
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Configuration/XML/XmlConfiguration.cs (renamed from OpenSim/Framework/General/Configuration/XmlConfiguration.cs)5
-rw-r--r--OpenSim/Framework/General/Configuration/ConfigurationMember.cs52
-rw-r--r--OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs3
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs28
-rw-r--r--OpenSim/Grid/GridServer/Main.cs4
-rw-r--r--OpenSim/Grid/UserServer/Main.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs4
7 files changed, 52 insertions, 48 deletions
diff --git a/OpenSim/Framework/General/Configuration/XmlConfiguration.cs b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs
index e1f3816..e56c657 100644
--- a/OpenSim/Framework/General/Configuration/XmlConfiguration.cs
+++ b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs
@@ -30,6 +30,7 @@ using System.IO;
30using System.Xml; 30using System.Xml;
31 31
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Configuration.Interfaces;
33 34
34namespace OpenSim.Framework.Configuration 35namespace OpenSim.Framework.Configuration
35{ 36{
@@ -41,9 +42,9 @@ namespace OpenSim.Framework.Configuration
41 private string fileName; 42 private string fileName;
42 private bool createdFile = false; 43 private bool createdFile = false;
43 44
44 public XmlConfiguration(string filename) 45 public void SetFileName(string file)
45 { 46 {
46 fileName = filename; 47 fileName = file;
47 } 48 }
48 49
49 public void LoadData() 50 public void LoadData()
diff --git a/OpenSim/Framework/General/Configuration/ConfigurationMember.cs b/OpenSim/Framework/General/Configuration/ConfigurationMember.cs
index e93a576..4546683 100644
--- a/OpenSim/Framework/General/Configuration/ConfigurationMember.cs
+++ b/OpenSim/Framework/General/Configuration/ConfigurationMember.cs
@@ -1,4 +1,5 @@
1using System; 1using System;
2using System.Reflection;
2using System.Collections; 3using System.Collections;
3using System.Collections.Generic; 4using System.Collections.Generic;
4using System.Text; 5using System.Text;
@@ -7,6 +8,7 @@ using System.Net;
7using libsecondlife; 8using libsecondlife;
8 9
9using OpenSim.Framework.Console; 10using OpenSim.Framework.Console;
11using OpenSim.Framework.Configuration.Interfaces;
10 12
11namespace OpenSim.Framework.Configuration 13namespace OpenSim.Framework.Configuration
12{ 14{
@@ -22,12 +24,14 @@ namespace OpenSim.Framework.Configuration
22 private ConfigurationOptionsLoad loadFunction; 24 private ConfigurationOptionsLoad loadFunction;
23 private ConfigurationOptionResult resultFunction; 25 private ConfigurationOptionResult resultFunction;
24 26
27 private IGenericConfig configurationPlugin = null;
25 public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) 28 public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
26 { 29 {
27 this.configurationFilename = configuration_filename; 30 this.configurationFilename = configuration_filename;
28 this.configurationDescription = configuration_description; 31 this.configurationDescription = configuration_description;
29 this.loadFunction = load_function; 32 this.loadFunction = load_function;
30 this.resultFunction = result_function; 33 this.resultFunction = result_function;
34 this.configurationPlugin = this.LoadConfigDll("OpenSim.Framework.Configuration.XML.dll");
31 } 35 }
32 36
33 public void setConfigurationFilename(string filename) 37 public void setConfigurationFilename(string filename)
@@ -91,18 +95,19 @@ namespace OpenSim.Framework.Configuration
91 } 95 }
92 96
93 bool useFile = true; 97 bool useFile = true;
94 XmlConfiguration xmlConfig = null; 98 if (configurationPlugin == null)
95 if (configurationFilename.Trim() != "")
96 { 99 {
97 xmlConfig = new XmlConfiguration(configurationFilename); 100 MainLog.Instance.Error("Configuration Plugin NOT LOADED!");
98 101 return;
99 } 102 }
100 103
101 if(xmlConfig != null) 104 if (configurationFilename.Trim() != "")
102 { 105 {
103 xmlConfig.LoadData(); 106 configurationPlugin.SetFileName(configurationFilename);
107 configurationPlugin.LoadData();
104 useFile = true; 108 useFile = true;
105 } 109 }
110
106 else 111 else
107 { 112 {
108 MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file."); 113 MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file.");
@@ -124,7 +129,7 @@ namespace OpenSim.Framework.Configuration
124 { 129 {
125 if (!ignoreNextFromConfig) 130 if (!ignoreNextFromConfig)
126 { 131 {
127 attribute = xmlConfig.GetAttribute(configOption.configurationKey); 132 attribute = configurationPlugin.GetAttribute(configOption.configurationKey);
128 } 133 }
129 else 134 else
130 { 135 {
@@ -304,7 +309,7 @@ namespace OpenSim.Framework.Configuration
304 { 309 {
305 if (useFile) 310 if (useFile)
306 { 311 {
307 xmlConfig.SetAttribute(configOption.configurationKey, console_result); 312 configurationPlugin.SetAttribute(configOption.configurationKey, console_result);
308 } 313 }
309 314
310 315
@@ -333,9 +338,34 @@ namespace OpenSim.Framework.Configuration
333 338
334 if(useFile) 339 if(useFile)
335 { 340 {
336 xmlConfig.Commit(); 341 configurationPlugin.Commit();
337 xmlConfig.Close(); 342 configurationPlugin.Close();
338 } 343 }
339 } 344 }
345
346 private IGenericConfig LoadConfigDll(string dllName)
347 {
348 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
349 IGenericConfig plug = null;
350
351 foreach (Type pluginType in pluginAssembly.GetTypes())
352 {
353 if (pluginType.IsPublic)
354 {
355 if (!pluginType.IsAbstract)
356 {
357 Type typeInterface = pluginType.GetInterface("IGenericConfig", true);
358
359 if (typeInterface != null)
360 {
361 plug = (IGenericConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
362 }
363 }
364 }
365 }
366
367 pluginAssembly = null;
368 return plug;
369 }
340 } 370 }
341} 371}
diff --git a/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs b/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs
index 2c379dd..5a5a20e 100644
--- a/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs
+++ b/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs
@@ -25,10 +25,11 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Interfaces 28namespace OpenSim.Framework.Configuration.Interfaces
29{ 29{
30 public interface IGenericConfig 30 public interface IGenericConfig
31 { 31 {
32 void SetFileName(string fileName);
32 void LoadData(); 33 void LoadData();
33 string GetAttribute(string attributeName); 34 string GetAttribute(string attributeName);
34 bool SetAttribute(string attributeName, string attributeValue); 35 bool SetAttribute(string attributeName, string attributeValue);
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index f29a540..5a8368c 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -291,34 +291,6 @@ namespace OpenSim.Grid.AssetServer
291 //info.loaded=true; 291 //info.loaded=true;
292 } 292 }
293 293
294 /*private GridConfig LoadConfigDll(string dllName)
295 {
296 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
297 GridConfig config = null;
298
299 foreach (Type pluginType in pluginAssembly.GetTypes())
300 {
301 if (pluginType.IsPublic)
302 {
303 if (!pluginType.IsAbstract)
304 {
305 Type typeInterface = pluginType.GetInterface("IGridConfig", true);
306
307 if (typeInterface != null)
308 {
309 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
310 config = plug.GetConfigObject();
311 break;
312 }
313
314 typeInterface = null;
315 }
316 }
317 }
318 pluginAssembly = null;
319 return config;
320 }*/
321
322 public void CreateAsset(LLUUID assetId, byte[] assetData) 294 public void CreateAsset(LLUUID assetId, byte[] assetData)
323 { 295 {
324 AssetBase asset = new AssetBase(); 296 AssetBase asset = new AssetBase();
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs
index 94ecbfc..c72948d 100644
--- a/OpenSim/Grid/GridServer/Main.cs
+++ b/OpenSim/Grid/GridServer/Main.cs
@@ -197,7 +197,7 @@ namespace OpenSim.Grid.GridServer
197 { 197 {
198 } 198 }
199 199
200 private void ConfigDB(IGenericConfig configData) 200 /*private void ConfigDB(IGenericConfig configData)
201 { 201 {
202 try 202 try
203 { 203 {
@@ -218,6 +218,6 @@ namespace OpenSim.Grid.GridServer
218 { 218 {
219 219
220 } 220 }
221 } 221 }*/
222 } 222 }
223} 223}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index da53e11..99401fc 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Grid.UserServer
147 } 147 }
148 } 148 }
149 149
150 private void ConfigDB(IGenericConfig configData) 150 /*private void ConfigDB(IGenericConfig configData)
151 { 151 {
152 try 152 try
153 { 153 {
@@ -168,7 +168,7 @@ namespace OpenSim.Grid.UserServer
168 { 168 {
169 169
170 } 170 }
171 } 171 }*/
172 172
173 public void Show(string ShowWhat) 173 public void Show(string ShowWhat)
174 { 174 {
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 8a1e0f1..3c11b90 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -197,7 +197,7 @@ namespace OpenSim
197 197
198 #endregion 198 #endregion
199 199
200 private void SetupFromConfigFile(IGenericConfig configData) 200 /*private void SetupFromConfigFile(IGenericConfig configData)
201 { 201 {
202 // Log filename 202 // Log filename
203 string attri = ""; 203 string attri = "";
@@ -295,7 +295,7 @@ namespace OpenSim
295 295
296 configData.Commit(); 296 configData.Commit();
297 297
298 } 298 }*/
299 299
300 /// <summary> 300 /// <summary>
301 /// Performs any last-minute sanity checking and shuts down the region server 301 /// Performs any last-minute sanity checking and shuts down the region server