aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs4
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServer.cs4
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs2
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs4
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs2
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs2
-rw-r--r--OpenSim/Framework/Console/LogBase.cs63
-rw-r--r--OpenSim/Framework/General/Types/EstateSettings.cs8
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs18
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs4
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs2
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs121
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs4
17 files changed, 186 insertions, 66 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 17829b2..9dbd50e 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Framework.Communications.Cache
72 /// </summary> 72 /// </summary>
73 public AssetCache(IAssetServer assetServer) 73 public AssetCache(IAssetServer assetServer)
74 { 74 {
75 System.Console.WriteLine("Creating Asset cache"); 75 OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSTORAGE","Creating Asset cache");
76 _assetServer = assetServer; 76 _assetServer = assetServer;
77 _assetServer.SetReceiver(this); 77 _assetServer.SetReceiver(this);
78 Assets = new Dictionary<LLUUID, AssetInfo>(); 78 Assets = new Dictionary<LLUUID, AssetInfo>();
@@ -89,7 +89,7 @@ namespace OpenSim.Framework.Communications.Cache
89 89
90 public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) 90 public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey)
91 { 91 {
92 System.Console.WriteLine("Creating Asset cache"); 92 OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSTORAGE", "Creating Asset cache");
93 _assetServer = this.LoadAssetDll(assetServerDLLName); 93 _assetServer = this.LoadAssetDll(assetServerDLLName);
94 94
95 95
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs
index 22bdc5c..aebda00 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications.Cache
51 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); 51 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap"));
52 52
53 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); 53 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap"));
54 MainLog.Instance.Verbose("Db4 Asset database creation"); 54 MainLog.Instance.Verbose("ASSETS","Db4 Asset database creation");
55 55
56 if (!yapfile) 56 if (!yapfile)
57 { 57 {
@@ -75,7 +75,7 @@ namespace OpenSim.Framework.Communications.Cache
75 75
76 if (db != null) 76 if (db != null)
77 { 77 {
78 MainLog.Instance.Verbose("Closing local asset server database"); 78 MainLog.Instance.Verbose("ASSETSERVER","Closing local asset server database");
79 db.Close(); 79 db.Close();
80 } 80 }
81 } 81 }
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
index 08d5b87..a3ec346 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Framework.Communications.Cache
37 37
38 public AssetServerBase() 38 public AssetServerBase()
39 { 39 {
40 System.Console.WriteLine("Starting Db4o asset storage system"); 40 OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSERVER","Starting Db4o asset storage system");
41 this._assetRequests = new BlockingQueue<ARequest>(); 41 this._assetRequests = new BlockingQueue<ARequest>();
42 42
43 this._localAssetServerThread = new Thread( RunRequests ); 43 this._localAssetServerThread = new Thread( RunRequests );
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
index 69f83d2..580e5c4 100644
--- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Framework.Communications.Cache
68 m_assetProviderPlugin = plug; 68 m_assetProviderPlugin = plug;
69 m_assetProviderPlugin.Initialise(); 69 m_assetProviderPlugin.Initialise();
70 70
71 MainLog.Instance.Verbose("AssetStorage: Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version); 71 MainLog.Instance.Verbose("AssetStorage","Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version);
72 } 72 }
73 73
74 typeInterface = null; 74 typeInterface = null;
@@ -92,7 +92,7 @@ namespace OpenSim.Framework.Communications.Cache
92 { 92 {
93 ARequest req = this._assetRequests.Dequeue(); 93 ARequest req = this._assetRequests.Dequeue();
94 94
95 MainLog.Instance.Verbose("Requesting asset: " + req.AssetID); 95 MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID);
96 96
97 AssetBase asset = null; 97 AssetBase asset = null;
98 lock (syncLock) 98 lock (syncLock)
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 65eb509..06a1ca8 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Framework.Communications
70 (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 70 (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
71 plug.Initialise(); 71 plug.Initialise();
72 this.m_plugins.Add(plug.getName(), plug); 72 this.m_plugins.Add(plug.getName(), plug);
73 MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface"); 73 MainLog.Instance.Verbose("INVENTORY","Added IInventoryData Interface");
74 } 74 }
75 } 75 }
76 } 76 }
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 674c746..f4648df 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Framework.UserManagement
66 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 66 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
67 { 67 {
68 68
69 MainLog.Instance.Verbose("Attempting login now..."); 69 MainLog.Instance.Verbose("LOGIN","Attempting login now...");
70 XmlRpcResponse response = new XmlRpcResponse(); 70 XmlRpcResponse response = new XmlRpcResponse();
71 Hashtable requestData = (Hashtable)request.Params[0]; 71 Hashtable requestData = (Hashtable)request.Params[0];
72 72
diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs
index 5a7ce4d..246afa1 100644
--- a/OpenSim/Framework/Console/LogBase.cs
+++ b/OpenSim/Framework/Console/LogBase.cs
@@ -170,8 +170,11 @@ namespace OpenSim.Framework.Console
170 /// <param name="args">WriteLine-style message arguments</param> 170 /// <param name="args">WriteLine-style message arguments</param>
171 public void Verbose(string format, params object[] args) 171 public void Verbose(string format, params object[] args)
172 { 172 {
173 WriteNewLine(ConsoleColor.Gray, format, args); 173 if (!m_silent)
174 return; 174 {
175 WriteNewLine(ConsoleColor.Gray, format, args);
176 return;
177 }
175 } 178 }
176 179
177 /// <summary> 180 /// <summary>
@@ -182,9 +185,12 @@ namespace OpenSim.Framework.Console
182 /// <param name="args">WriteLine-style message arguments</param> 185 /// <param name="args">WriteLine-style message arguments</param>
183 public void Verbose(string sender, string format, params object[] args) 186 public void Verbose(string sender, string format, params object[] args)
184 { 187 {
185 WritePrefixLine(DeriveColor(sender), sender); 188 if (!m_silent)
186 WriteNewLine(ConsoleColor.Gray, format, args); 189 {
187 return; 190 WritePrefixLine(DeriveColor(sender), sender);
191 WriteNewLine(ConsoleColor.Gray, format, args);
192 return;
193 }
188 } 194 }
189 195
190 /// <summary> 196 /// <summary>
@@ -234,22 +240,20 @@ namespace OpenSim.Framework.Console
234 Log.Write(now); 240 Log.Write(now);
235 Log.WriteLine(format, args); 241 Log.WriteLine(format, args);
236 Log.Flush(); 242 Log.Flush();
237 if (!m_silent) 243
244 System.Console.Write(now);
245 try
238 { 246 {
239 System.Console.Write(now); 247 if (color != ConsoleColor.White)
240 try 248 System.Console.ForegroundColor = color;
241 {
242 if (color != ConsoleColor.White)
243 System.Console.ForegroundColor = color;
244 249
245 System.Console.WriteLine(format, args); 250 System.Console.WriteLine(format, args);
246 System.Console.ResetColor(); 251 System.Console.ResetColor();
247 } 252 }
248 catch (ArgumentNullException) 253 catch (ArgumentNullException)
249 { 254 {
250 // Some older systems dont support coloured text. 255 // Some older systems dont support coloured text.
251 System.Console.WriteLine(format, args); 256 System.Console.WriteLine(format, args);
252 }
253 } 257 }
254 return; 258 return;
255 } 259 }
@@ -265,19 +269,16 @@ namespace OpenSim.Framework.Console
265 269
266 System.Console.Write("["); 270 System.Console.Write("[");
267 271
268 if (!m_silent) 272 try
269 { 273 {
270 try 274 System.Console.ForegroundColor = color;
271 { 275 System.Console.Write(sender);
272 System.Console.ForegroundColor = color; 276 System.Console.ResetColor();
273 System.Console.Write(sender); 277 }
274 System.Console.ResetColor(); 278 catch (ArgumentNullException)
275 } 279 {
276 catch (ArgumentNullException) 280 // Some older systems dont support coloured text.
277 { 281 System.Console.WriteLine(sender);
278 // Some older systems dont support coloured text.
279 System.Console.WriteLine(sender);
280 }
281 } 282 }
282 283
283 System.Console.Write("] \t"); 284 System.Console.Write("] \t");
diff --git a/OpenSim/Framework/General/Types/EstateSettings.cs b/OpenSim/Framework/General/Types/EstateSettings.cs
index abdcf6f..2675e52 100644
--- a/OpenSim/Framework/General/Types/EstateSettings.cs
+++ b/OpenSim/Framework/General/Types/EstateSettings.cs
@@ -557,8 +557,12 @@ namespace OpenSim.Framework.Types
557 private ConfigurationMember configMember; 557 private ConfigurationMember configMember;
558 public EstateSettings() 558 public EstateSettings()
559 { 559 {
560 configMember = new ConfigurationMember(Path.Combine(Util.configDir(),"estate_settings.xml"), "ESTATE SETTINGS", this.loadConfigurationOptions, this.handleIncomingConfiguration); 560 // Temporary hack to prevent multiple loadings.
561 configMember.performConfigurationRetrieve(); 561 if (configMember == null)
562 {
563 configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", this.loadConfigurationOptions, this.handleIncomingConfiguration);
564 configMember.performConfigurationRetrieve();
565 }
562 } 566 }
563 567
564 public void loadConfigurationOptions() 568 public void loadConfigurationOptions()
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 6d432fd..179a651 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -224,7 +224,7 @@ namespace OpenSim.Framework.Servers
224 { 224 {
225 try 225 try
226 { 226 {
227 MainLog.Instance.Status("HTTPD", "Spawned main thread OK"); 227 MainLog.Instance.Verbose("HTTPD", "Spawned main thread OK");
228 m_httpListener = new HttpListener(); 228 m_httpListener = new HttpListener();
229 229
230 m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); 230 m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index d2f5648..9de3831 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -262,8 +262,10 @@ namespace OpenSim
262 } 262 }
263 else 263 else
264 { 264 {
265 MainLog.Instance.Verbose("No startup command script specified. Moving on..."); 265 MainLog.Instance.Verbose("STARTUP","No startup command script specified. Moving on...");
266 } 266 }
267
268 MainLog.Instance.Status("STARTUP","Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)");
267 } 269 }
268 270
269 private static void CreateDefaultRegionInfoXml(string fileName) 271 private static void CreateDefaultRegionInfoXml(string fileName)
@@ -361,11 +363,11 @@ namespace OpenSim
361 RunCommandScript(m_shutdownCommandsFile); 363 RunCommandScript(m_shutdownCommandsFile);
362 } 364 }
363 365
364 m_log.Verbose("Closing all threads"); 366 m_log.Verbose("SHUTDOWN", "Closing all threads");
365 m_log.Verbose("Killing listener thread"); 367 m_log.Verbose("SHUTDOWN", "Killing listener thread");
366 m_log.Verbose("Killing clients"); 368 m_log.Verbose("SHUTDOWN", "Killing clients");
367 // IMPLEMENT THIS 369 // IMPLEMENT THIS
368 m_log.Verbose("Closing console and terminating"); 370 m_log.Verbose("SHUTDOWN", "Closing console and terminating");
369 371
370 m_sceneManager.Close(); 372 m_sceneManager.Close();
371 373
@@ -380,7 +382,7 @@ namespace OpenSim
380 /// <param name="fileName"></param> 382 /// <param name="fileName"></param>
381 private void RunCommandScript(string fileName) 383 private void RunCommandScript(string fileName)
382 { 384 {
383 MainLog.Instance.Verbose("Running command script (" + fileName + ")"); 385 MainLog.Instance.Verbose("COMMANDFILE", "Running " + fileName);
384 if (File.Exists(fileName)) 386 if (File.Exists(fileName))
385 { 387 {
386 StreamReader readFile = File.OpenText(fileName); 388 StreamReader readFile = File.OpenText(fileName);
@@ -389,14 +391,14 @@ namespace OpenSim
389 { 391 {
390 if (currentCommand != "") 392 if (currentCommand != "")
391 { 393 {
392 MainLog.Instance.Verbose("Running '" + currentCommand + "'"); 394 MainLog.Instance.Verbose("COMMANDFILE", "Running '" + currentCommand + "'");
393 MainLog.Instance.MainLogRunCommand(currentCommand); 395 MainLog.Instance.MainLogRunCommand(currentCommand);
394 } 396 }
395 } 397 }
396 } 398 }
397 else 399 else
398 { 400 {
399 MainLog.Instance.Error("Command script missing. Can not run commands"); 401 MainLog.Instance.Error("COMMANDFILE","Command script missing. Can not run commands");
400 } 402 }
401 } 403 }
402 404
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
index 1a00f2c..e375343 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
@@ -47,8 +47,8 @@ namespace OpenSim.Region.Environment.Interfaces
47 47
48 List<SceneObjectGroup> LoadObjects(LLUUID regionUUID); 48 List<SceneObjectGroup> LoadObjects(LLUUID regionUUID);
49 49
50 void StoreTerrain(double[,] terrain); 50 void StoreTerrain(double[,] terrain, LLUUID regionID);
51 double[,] LoadTerrain(); 51 double[,] LoadTerrain(LLUUID regionID);
52 52
53 void StoreParcel(Land Parcel); 53 void StoreParcel(Land Parcel);
54 void RemoveLandObject(uint ID); 54 void RemoveLandObject(uint ID);
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index c579c1d..4fc45a0 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -168,7 +168,7 @@ namespace OpenSim.Region.Environment
168 } 168 }
169 catch( BadImageFormatException e ) 169 catch( BadImageFormatException e )
170 { 170 {
171 m_log.Warn( "MODULES", "The file [{0}] is not a module assembly.", e.FileName ); 171 m_log.Verbose( "MODULES", "The file [{0}] is not a module assembly.", e.FileName );
172 } 172 }
173 } 173 }
174 174
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index e2430f8..ee47678 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -370,7 +370,7 @@ namespace OpenSim.Region.Environment.Scenes
370 phyScene.SetTerrain(Terrain.GetHeights1D()); 370 phyScene.SetTerrain(Terrain.GetHeights1D());
371 } 371 }
372 372
373 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 373 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(),RegionInfo.RegionID);
374 374
375 float[] terData = Terrain.GetHeights1D(); 375 float[] terData = Terrain.GetHeights1D();
376 376
@@ -466,7 +466,7 @@ namespace OpenSim.Region.Environment.Scenes
466 { 466 {
467 try 467 try
468 { 468 {
469 double[,] map = storageManager.DataStore.LoadTerrain(); 469 double[,] map = storageManager.DataStore.LoadTerrain(RegionInfo.RegionID);
470 if (map == null) 470 if (map == null)
471 { 471 {
472 if (string.IsNullOrEmpty(m_regInfo.EstateSettings.terrainFile)) 472 if (string.IsNullOrEmpty(m_regInfo.EstateSettings.terrainFile))
@@ -474,7 +474,7 @@ namespace OpenSim.Region.Environment.Scenes
474 MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain."); 474 MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain.");
475 Terrain.HillsGenerator(); 475 Terrain.HillsGenerator();
476 476
477 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 477 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(),RegionInfo.RegionID);
478 } 478 }
479 else 479 else
480 { 480 {
@@ -488,7 +488,7 @@ namespace OpenSim.Region.Environment.Scenes
488 MainLog.Instance.Verbose("TERRAIN", "No terrain found in database or default. Generating a new terrain."); 488 MainLog.Instance.Verbose("TERRAIN", "No terrain found in database or default. Generating a new terrain.");
489 Terrain.HillsGenerator(); 489 Terrain.HillsGenerator();
490 } 490 }
491 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 491 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
492 } 492 }
493 } 493 }
494 else 494 else
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
index be27a0b..95ab2ca 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
70 70
71 public void Initialise(Scene scene, IConfigSource config) 71 public void Initialise(Scene scene, IConfigSource config)
72 { 72 {
73 System.Console.WriteLine("Initialising Extensions Scripting Module"); 73 OpenSim.Framework.Console.MainLog.Instance.Verbose("SCRIPTMODULE", "Initialising Extensions Scripting Module");
74 m_scene = scene; 74 m_scene = scene;
75 75
76 m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); 76 m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 87b6d34..81bc938 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.Physics.Manager
93 IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 93 IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
94 plug.Init(); 94 plug.Init();
95 this._plugins.Add(plug.GetName(),plug); 95 this._plugins.Add(plug.GetName(),plug);
96 Console.WriteLine("added physics engine: " + plug.GetName()); 96 OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS","Added physics engine: " + plug.GetName());
97 97
98 } 98 }
99 99
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 733e4c4..cc0ff7a 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -43,10 +43,12 @@ namespace OpenSim.DataStore.MonoSqlite
43 { 43 {
44 private const string primSelect = "select * from prims"; 44 private const string primSelect = "select * from prims";
45 private const string shapeSelect = "select * from primshapes"; 45 private const string shapeSelect = "select * from primshapes";
46 private const string terrainSelect = "select * from terrain";
46 47
47 private DataSet ds; 48 private DataSet ds;
48 private SqliteDataAdapter primDa; 49 private SqliteDataAdapter primDa;
49 private SqliteDataAdapter shapeDa; 50 private SqliteDataAdapter shapeDa;
51 private SqliteDataAdapter terrainDa;
50 52
51 /*********************************************************************** 53 /***********************************************************************
52 * 54 *
@@ -70,6 +72,8 @@ namespace OpenSim.DataStore.MonoSqlite
70 shapeDa = new SqliteDataAdapter(shapeSelectCmd); 72 shapeDa = new SqliteDataAdapter(shapeSelectCmd);
71 // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); 73 // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
72 74
75 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn);
76 terrainDa = new SqliteDataAdapter(terrainSelectCmd);
73 77
74 // We fill the data set, now we've got copies in memory for the information 78 // We fill the data set, now we've got copies in memory for the information
75 // TODO: see if the linkage actually holds. 79 // TODO: see if the linkage actually holds.
@@ -83,6 +87,10 @@ namespace OpenSim.DataStore.MonoSqlite
83 87
84 ds.Tables.Add(createShapeTable()); 88 ds.Tables.Add(createShapeTable());
85 setupShapeCommands(shapeDa, conn); 89 setupShapeCommands(shapeDa, conn);
90
91 ds.Tables.Add(createTerrainTable());
92 setupTerrainCommands(terrainDa, conn);
93 terrainDa.Fill(ds.Tables["terrain"]);
86 94
87 // WORKAROUND: This is a work around for sqlite on 95 // WORKAROUND: This is a work around for sqlite on
88 // windows, which gets really unhappy with blob columns 96 // windows, which gets really unhappy with blob columns
@@ -210,14 +218,57 @@ namespace OpenSim.DataStore.MonoSqlite
210 } 218 }
211 219
212 220
213 public void StoreTerrain(double[,] ter) 221 public void StoreTerrain(double[,] ter, LLUUID regionID)
214 { 222 {
223 int revision = OpenSim.Framework.Utilities.Util.UnixTimeSinceEpoch();
224
225 MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString());
226
227 DataTable terrain = ds.Tables["terrain"];
228
229 DataRow newrow = terrain.NewRow();
230 fillTerrainRow(newrow, regionID, revision, ter);
231 terrain.Rows.Add(newrow);
215 232
233 Commit();
216 } 234 }
217 235
218 public double[,] LoadTerrain() 236 public double[,] LoadTerrain(LLUUID regionID)
219 { 237 {
220 return null; 238 double[,] terret = new double[256, 256];
239 terret.Initialize();
240
241 DataTable terrain = ds.Tables["terrain"];
242
243 DataRow[] rows = terrain.Select("RegionUUID = '" + regionID.ToString() + "'","Revision DESC");
244
245 int rev = 0;
246
247 if (rows.Length > 0)
248 {
249 DataRow row = rows[0];
250
251 byte[] heightmap = (byte[])row["Heightfield"];
252 for (int x = 0; x < 256; x++)
253 {
254 for (int y = 0; y < 256; y++)
255 {
256 terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8);
257 }
258 }
259
260 rev = (int)row["Revision"];
261 }
262 else
263 {
264 MainLog.Instance.Verbose("DATASTORE", "No terrain found for region");
265 return null;
266 }
267
268
269 MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString());
270
271 return terret;
221 } 272 }
222 273
223 public void RemoveLandObject(uint id) 274 public void RemoveLandObject(uint id)
@@ -240,6 +291,7 @@ namespace OpenSim.DataStore.MonoSqlite
240 lock (ds) { 291 lock (ds) {
241 primDa.Update(ds, "prims"); 292 primDa.Update(ds, "prims");
242 shapeDa.Update(ds, "primshapes"); 293 shapeDa.Update(ds, "primshapes");
294 terrainDa.Update(ds, "terrain");
243 ds.AcceptChanges(); 295 ds.AcceptChanges();
244 } 296 }
245 } 297 }
@@ -263,6 +315,22 @@ namespace OpenSim.DataStore.MonoSqlite
263 dt.Columns.Add(col); 315 dt.Columns.Add(col);
264 } 316 }
265 317
318 private DataTable createTerrainTable()
319 {
320 DataTable terrain = new DataTable("terrain");
321
322 createCol(terrain, "RegionUUID", typeof(System.String));
323 createCol(terrain, "Revision", typeof(System.Int32));
324 createCol(terrain, "Heightfield", typeof(System.Byte[]));
325
326 /* // Attempting to work out requirements to get SQLite to actually *save* the data.
327 createCol(terrain, "PrIndex", typeof(System.String));
328 terrain.PrimaryKey = new DataColumn[] { terrain.Columns["PrIndex"] };
329 */
330
331 return terrain;
332 }
333
266 private DataTable createPrimTable() 334 private DataTable createPrimTable()
267 { 335 {
268 DataTable prims = new DataTable("prims"); 336 DataTable prims = new DataTable("prims");
@@ -431,6 +499,22 @@ namespace OpenSim.DataStore.MonoSqlite
431 return prim; 499 return prim;
432 } 500 }
433 501
502 private void fillTerrainRow(DataRow row, LLUUID regionUUID, int rev, double[,] val)
503 {
504 row["RegionUUID"] = regionUUID;
505 row["Revision"] = rev;
506
507 System.IO.MemoryStream str = new System.IO.MemoryStream(65536 * sizeof(double));
508 System.IO.BinaryWriter bw = new System.IO.BinaryWriter(str);
509
510 // TODO: COMPATIBILITY - Add byte-order conversions
511 for (int x = 0; x < 256; x++)
512 for (int y = 0; y < 256; y++)
513 bw.Write(val[x, y]);
514
515 row["Heightfield"] = str.ToArray();
516 }
517
434 private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) 518 private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
435 { 519 {
436 row["UUID"] = prim.UUID; 520 row["UUID"] = prim.UUID;
@@ -692,7 +776,7 @@ namespace OpenSim.DataStore.MonoSqlite
692 subsql += ",\n"; 776 subsql += ",\n";
693 } 777 }
694 subsql += col.ColumnName + " " + sqliteType(col.DataType); 778 subsql += col.ColumnName + " " + sqliteType(col.DataType);
695 if (col == dt.PrimaryKey[0]) 779 if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0])
696 { 780 {
697 subsql += " primary key"; 781 subsql += " primary key";
698 } 782 }
@@ -746,6 +830,12 @@ namespace OpenSim.DataStore.MonoSqlite
746 da.DeleteCommand = delete; 830 da.DeleteCommand = delete;
747 } 831 }
748 832
833 private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn)
834 {
835 da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]);
836 da.InsertCommand.Connection = conn;
837 }
838
749 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) 839 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
750 { 840 {
751 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); 841 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]);
@@ -764,12 +854,15 @@ namespace OpenSim.DataStore.MonoSqlite
764 { 854 {
765 string createPrims = defineTable(createPrimTable()); 855 string createPrims = defineTable(createPrimTable());
766 string createShapes = defineTable(createShapeTable()); 856 string createShapes = defineTable(createShapeTable());
857 string createTerrain = defineTable(createTerrainTable());
767 858
768 SqliteCommand pcmd = new SqliteCommand(createPrims, conn); 859 SqliteCommand pcmd = new SqliteCommand(createPrims, conn);
769 SqliteCommand scmd = new SqliteCommand(createShapes, conn); 860 SqliteCommand scmd = new SqliteCommand(createShapes, conn);
861 SqliteCommand tcmd = new SqliteCommand(createTerrain, conn);
770 conn.Open(); 862 conn.Open();
771 pcmd.ExecuteNonQuery(); 863 pcmd.ExecuteNonQuery();
772 scmd.ExecuteNonQuery(); 864 scmd.ExecuteNonQuery();
865 tcmd.ExecuteNonQuery();
773 conn.Close(); 866 conn.Close();
774 } 867 }
775 868
@@ -779,12 +872,15 @@ namespace OpenSim.DataStore.MonoSqlite
779 SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd); 872 SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd);
780 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); 873 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn);
781 SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd); 874 SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd);
875 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn);
876 SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd);
782 877
783 DataSet tmpDS = new DataSet(); 878 DataSet tmpDS = new DataSet();
784 try 879 try
785 { 880 {
786 pDa.Fill(tmpDS, "prims"); 881 pDa.Fill(tmpDS, "prims");
787 sDa.Fill(tmpDS, "primshapes"); 882 sDa.Fill(tmpDS, "primshapes");
883 tDa.Fill(tmpDS, "terrain");
788 } 884 }
789 catch (Mono.Data.SqliteClient.SqliteSyntaxException) 885 catch (Mono.Data.SqliteClient.SqliteSyntaxException)
790 { 886 {
@@ -794,6 +890,7 @@ namespace OpenSim.DataStore.MonoSqlite
794 890
795 pDa.Fill(tmpDS, "prims"); 891 pDa.Fill(tmpDS, "prims");
796 sDa.Fill(tmpDS, "primshapes"); 892 sDa.Fill(tmpDS, "primshapes");
893 tDa.Fill(tmpDS, "terrain");
797 894
798 foreach (DataColumn col in createPrimTable().Columns) 895 foreach (DataColumn col in createPrimTable().Columns)
799 { 896 {
@@ -811,6 +908,14 @@ namespace OpenSim.DataStore.MonoSqlite
811 return false; 908 return false;
812 } 909 }
813 } 910 }
911 foreach (DataColumn col in createTerrainTable().Columns)
912 {
913 if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName))
914 {
915 MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName);
916 return false;
917 }
918 }
814 return true; 919 return true;
815 } 920 }
816 921
@@ -834,6 +939,14 @@ namespace OpenSim.DataStore.MonoSqlite
834 { 939 {
835 return DbType.Double; 940 return DbType.Double;
836 } 941 }
942 else if (type == typeof(System.Byte))
943 {
944 return DbType.Byte;
945 }
946 else if (type == typeof(System.Double))
947 {
948 return DbType.Double;
949 }
837 else if (type == typeof(System.Byte[])) 950 else if (type == typeof(System.Byte[]))
838 { 951 {
839 return DbType.Binary; 952 return DbType.Binary;
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
index 91b1914..f726ea2 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
@@ -61,12 +61,12 @@ namespace OpenSim.DataStore.NullStorage
61 return new List<SceneObjectGroup>(); 61 return new List<SceneObjectGroup>();
62 } 62 }
63 63
64 public void StoreTerrain(double[,] ter) 64 public void StoreTerrain(double[,] ter, LLUUID regionID)
65 { 65 {
66 66
67 } 67 }
68 68
69 public double[,] LoadTerrain() 69 public double[,] LoadTerrain(LLUUID regionID)
70 { 70 {
71 return null; 71 return null;
72 } 72 }