aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-09-10 06:45:54 +0000
committerMW2007-09-10 06:45:54 +0000
commit15423539f98d47201a819e35f80b0c30ee459556 (patch)
tree3eb7831bfaaf5e0309c49f966d19869a9fe72e2b
parent* Fixed: Accessing xmlrpc with invalid xml data would crash the sim. (diff)
downloadopensim-SC-15423539f98d47201a819e35f80b0c30ee459556.zip
opensim-SC-15423539f98d47201a819e35f80b0c30ee459556.tar.gz
opensim-SC-15423539f98d47201a819e35f80b0c30ee459556.tar.bz2
opensim-SC-15423539f98d47201a819e35f80b0c30ee459556.tar.xz
hooked up sdague new sqlite asset database provider to the old asset system. So we can still use sqlite for assets while we wait for the rest of the new asset system to be wrote.
Needs more testing, so if it causes problems will have to swap back to db4o.
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs12
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServer.cs4
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs297
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs22
-rw-r--r--OpenSim/Framework/General/Interfaces/IAssetProvider.cs18
-rw-r--r--OpenSim/Framework/General/Interfaces/IAssetServer.cs4
-rw-r--r--OpenSim/Framework/General/Types/AssetBase.cs3
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs3
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs4
-rw-r--r--OpenSim/Region/Environment/Interfaces/IXfer.cs11
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs33
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs5
-rw-r--r--OpenSim/Region/Environment/Types/UpdateQueue.cs33
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs1
19 files changed, 428 insertions, 47 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index d947228..2dceb54 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -144,14 +144,14 @@ namespace OpenSim.Framework.Communications.Caches
144 AssetBase asset = GetAsset(assetID); 144 AssetBase asset = GetAsset(assetID);
145 if (asset == null) 145 if (asset == null)
146 { 146 {
147 this._assetServer.RequestAsset(assetID, isTexture); 147 this._assetServer.FetchAsset(assetID, isTexture);
148 } 148 }
149 return asset; 149 return asset;
150 } 150 }
151 151
152 public void AddAsset(AssetBase asset) 152 public void AddAsset(AssetBase asset)
153 { 153 {
154 System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); 154 // System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
155 if (asset.Type == 0) 155 if (asset.Type == 0)
156 { 156 {
157 //Console.WriteLine("which is a texture"); 157 //Console.WriteLine("which is a texture");
@@ -159,7 +159,7 @@ namespace OpenSim.Framework.Communications.Caches
159 { //texture 159 { //texture
160 TextureImage textur = new TextureImage(asset); 160 TextureImage textur = new TextureImage(asset);
161 this.Textures.Add(textur.FullID, textur); 161 this.Textures.Add(textur.FullID, textur);
162 this._assetServer.UploadNewAsset(asset); 162 this._assetServer.CreateAsset(asset);
163 } 163 }
164 else 164 else
165 { 165 {
@@ -173,7 +173,7 @@ namespace OpenSim.Framework.Communications.Caches
173 { 173 {
174 AssetInfo assetInf = new AssetInfo(asset); 174 AssetInfo assetInf = new AssetInfo(asset);
175 this.Assets.Add(assetInf.FullID, assetInf); 175 this.Assets.Add(assetInf.FullID, assetInf);
176 this._assetServer.UploadNewAsset(asset); 176 this._assetServer.CreateAsset(asset);
177 } 177 }
178 } 178 }
179 } 179 }
@@ -384,7 +384,7 @@ namespace OpenSim.Framework.Communications.Caches
384 request.AssetRequestSource = source; 384 request.AssetRequestSource = source;
385 request.Params = transferRequest.TransferInfo.Params; 385 request.Params = transferRequest.TransferInfo.Params;
386 this.RequestedAssets.Add(requestID, request); 386 this.RequestedAssets.Add(requestID, request);
387 this._assetServer.RequestAsset(requestID, false); 387 this._assetServer.FetchAsset(requestID, false);
388 } 388 }
389 return; 389 return;
390 } 390 }
@@ -561,7 +561,7 @@ namespace OpenSim.Framework.Communications.Caches
561 request.IsTextureRequest = true; 561 request.IsTextureRequest = true;
562 request.DiscardLevel = discard; 562 request.DiscardLevel = discard;
563 this.RequestedTextures.Add(imageID, request); 563 this.RequestedTextures.Add(imageID, request);
564 this._assetServer.RequestAsset(imageID, true); 564 this._assetServer.FetchAsset(imageID, true);
565 } 565 }
566 return; 566 return;
567 } 567 }
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs
index fd203f7..4e2644c 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Framework.Communications.Caches
73 this._receiver = receiver; 73 this._receiver = receiver;
74 } 74 }
75 75
76 public void RequestAsset(LLUUID assetID, bool isTexture) 76 public void FetchAsset(LLUUID assetID, bool isTexture)
77 { 77 {
78 ARequest req = new ARequest(); 78 ARequest req = new ARequest();
79 req.AssetID = assetID; 79 req.AssetID = assetID;
@@ -86,7 +86,7 @@ namespace OpenSim.Framework.Communications.Caches
86 86
87 } 87 }
88 88
89 public void UploadNewAsset(AssetBase asset) 89 public void CreateAsset(AssetBase asset)
90 { 90 {
91 AssetStorage store = new AssetStorage(); 91 AssetStorage store = new AssetStorage();
92 store.Data = asset.Data; 92 store.Data = asset.Data;
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
new file mode 100644
index 0000000..50653d8
--- /dev/null
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -0,0 +1,297 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.IO;
30using System.Threading;
31using System.Reflection;
32using libsecondlife;
33using Nini.Config;
34using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types;
37using OpenSim.Framework.Utilities;
38
39namespace OpenSim.Framework.Communications.Caches
40{
41
42 public class SQLAssetServer : IAssetServer
43 {
44 private IAssetReceiver _receiver;
45 private BlockingQueue<ARequest> _assetRequests;
46 private Thread _localAssetServerThread;
47 protected IAssetProvider m_plugin;
48
49
50 public SQLAssetServer()
51 {
52 _assetRequests = new BlockingQueue<ARequest>();
53 AddPlugin("OpenSim.Framework.Data.SQLite.dll");
54 this.SetUpAssetDatabase();
55
56 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
57 this._localAssetServerThread.IsBackground = true;
58 this._localAssetServerThread.Start();
59
60 }
61
62 public void AddPlugin(string FileName)
63 {
64 //MainLog.Instance.Verbose("SQLAssetServer", "AssetStorage: Attempting to load " + FileName);
65 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
66
67 foreach (Type pluginType in pluginAssembly.GetTypes())
68 {
69 if (!pluginType.IsAbstract)
70 {
71 Type typeInterface = pluginType.GetInterface("IAssetProvider", true);
72
73 if (typeInterface != null)
74 {
75 IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
76 m_plugin = plug;
77 m_plugin.Initialise("AssetStorage.db", "");
78
79 //MainLog.Instance.Verbose("AssetStorage: Added IAssetProvider Interface");
80 }
81
82 typeInterface = null;
83 }
84 }
85
86 pluginAssembly = null;
87 }
88
89 public void SetReceiver(IAssetReceiver receiver)
90 {
91 this._receiver = receiver;
92 }
93
94 public void FetchAsset(LLUUID assetID, bool isTexture)
95 {
96 ARequest req = new ARequest();
97 req.AssetID = assetID;
98 req.IsTexture = isTexture;
99 this._assetRequests.Enqueue(req);
100 }
101
102 public void UpdateAsset(AssetBase asset)
103 {
104 m_plugin.UpdateAsset(asset);
105 m_plugin.CommitAssets();
106 }
107
108 public void CreateAsset(AssetBase asset)
109 {
110 m_plugin.CreateAsset(asset);
111 m_plugin.CommitAssets();
112 }
113
114 public void SetServerInfo(string ServerUrl, string ServerKey)
115 {
116
117 }
118 public void Close()
119 {
120 m_plugin.CommitAssets();
121 }
122
123 private void RunRequests()
124 {
125
126 while (true)
127 {
128 ARequest req = this._assetRequests.Dequeue();
129
130 m_plugin.FetchAsset(req.AssetID);
131
132 AssetBase asset = m_plugin.FetchAsset(req.AssetID);
133 if (asset != null)
134 {
135 _receiver.AssetReceived(asset, req.IsTexture);
136 }
137 else
138 {
139 _receiver.AssetNotFound(req.AssetID);
140 }
141
142 }
143
144 }
145
146 private void SetUpAssetDatabase()
147 {
148 MainLog.Instance.Verbose("Setting up asset database");
149
150 AssetBase Image = new AssetBase();
151 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
152 Image.Name = "Bricks";
153 this.LoadAsset(Image, true, "bricks.jp2");
154 m_plugin.CreateAsset(Image);
155
156 Image = new AssetBase();
157 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
158 Image.Name = "Plywood";
159 this.LoadAsset(Image, true, "plywood.jp2");
160 m_plugin.CreateAsset(Image);
161
162 Image = new AssetBase();
163 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
164 Image.Name = "Rocks";
165 this.LoadAsset(Image, true, "rocks.jp2");
166 m_plugin.CreateAsset(Image);
167
168 Image = new AssetBase();
169 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
170 Image.Name = "Granite";
171 this.LoadAsset(Image, true, "granite.jp2");
172 m_plugin.CreateAsset(Image);
173
174 Image = new AssetBase();
175 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
176 Image.Name = "Hardwood";
177 this.LoadAsset(Image, true, "hardwood.jp2");
178 m_plugin.CreateAsset(Image);
179
180 Image = new AssetBase();
181 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
182 Image.Name = "Prim Base Texture";
183 this.LoadAsset(Image, true, "plywood.jp2");
184 m_plugin.CreateAsset(Image);
185
186 Image = new AssetBase();
187 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006");
188 Image.Name = "Map Base Texture";
189 this.LoadAsset(Image, true, "map_base.jp2");
190 m_plugin.CreateAsset(Image);
191
192 Image = new AssetBase();
193 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007");
194 Image.Name = "Map Texture";
195 this.LoadAsset(Image, true, "map1.jp2");
196 m_plugin.CreateAsset(Image);
197
198 Image = new AssetBase();
199 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010");
200 Image.Name = "Female Body Texture";
201 this.LoadAsset(Image, true, "femalebody.jp2");
202 m_plugin.CreateAsset(Image);
203
204 Image = new AssetBase();
205 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011");
206 Image.Name = "Female Bottom Texture";
207 this.LoadAsset(Image, true, "femalebottom.jp2");
208 m_plugin.CreateAsset(Image);
209
210 Image = new AssetBase();
211 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012");
212 Image.Name = "Female Face Texture";
213 this.LoadAsset(Image, true, "femaleface.jp2");
214 m_plugin.CreateAsset(Image);
215
216 Image = new AssetBase();
217 Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb");
218 Image.Name = "Skin";
219 Image.Type = 13;
220 Image.InvType = 13;
221 this.LoadAsset(Image, false, "base_skin.dat");
222 m_plugin.CreateAsset(Image);
223
224 Image = new AssetBase();
225 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
226 Image.Name = "Shape";
227 Image.Type = 13;
228 Image.InvType = 13;
229 this.LoadAsset(Image, false, "base_shape.dat");
230 m_plugin.CreateAsset(Image);
231
232 Image = new AssetBase();
233 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110");
234 Image.Name = "Shirt";
235 Image.Type = 5;
236 Image.InvType = 18;
237 this.LoadAsset(Image, false, "newshirt.dat");
238 m_plugin.CreateAsset(Image);
239
240 Image = new AssetBase();
241 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120");
242 Image.Name = "Shirt";
243 Image.Type = 5;
244 Image.InvType = 18;
245 this.LoadAsset(Image, false, "newpants.dat");
246 m_plugin.CreateAsset(Image);
247
248 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml");
249 if (File.Exists(filePath))
250 {
251 XmlConfigSource source = new XmlConfigSource(filePath);
252 ReadAssetDetails(source);
253 }
254
255 m_plugin.CommitAssets();
256 }
257
258 protected void ReadAssetDetails(IConfigSource source)
259 {
260 AssetBase newAsset = null;
261 for (int i = 0; i < source.Configs.Count; i++)
262 {
263 newAsset = new AssetBase();
264 newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
265 newAsset.Name = source.Configs[i].GetString("name", "");
266 newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0);
267 newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0);
268 string fileName = source.Configs[i].GetString("fileName", "");
269 if (fileName != "")
270 {
271 this.LoadAsset(newAsset, false, fileName);
272 m_plugin.CreateAsset(newAsset);
273 }
274 }
275 }
276
277 private void LoadAsset(AssetBase info, bool image, string filename)
278 {
279 //should request Asset from storage manager
280 //but for now read from file
281
282 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
283 string fileName = Path.Combine(dataPath, filename);
284 FileInfo fInfo = new FileInfo(fileName);
285 long numBytes = fInfo.Length;
286 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
287 byte[] idata = new byte[numBytes];
288 BinaryReader br = new BinaryReader(fStream);
289 idata = br.ReadBytes((int)numBytes);
290 br.Close();
291 fStream.Close();
292 info.Data = idata;
293 //info.loaded=true;
294 }
295 }
296
297}
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs
index 9138673..b53076c 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs
@@ -34,13 +34,14 @@ using System.Data.SqlTypes;
34using Mono.Data.SqliteClient; 34using Mono.Data.SqliteClient;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Framework.Interfaces;
37 38
38namespace OpenSim.Framework.Data.SQLite 39namespace OpenSim.Framework.Data.SQLite
39{ 40{
40 /// <summary> 41 /// <summary>
41 /// A User storage interface for the DB4o database system 42 /// A User storage interface for the DB4o database system
42 /// </summary> 43 /// </summary>
43 public class SQLiteAssetData : SQLiteBase 44 public class SQLiteAssetData : SQLiteBase, IAssetProvider
44 { 45 {
45 /// <summary> 46 /// <summary>
46 /// The database manager 47 /// The database manager
@@ -64,7 +65,15 @@ namespace OpenSim.Framework.Data.SQLite
64 ds.Tables.Add(createAssetsTable()); 65 ds.Tables.Add(createAssetsTable());
65 66
66 setupAssetCommands(da, conn); 67 setupAssetCommands(da, conn);
67 da.Fill(ds.Tables["assets"]); 68 try
69 {
70 da.Fill(ds.Tables["assets"]);
71 }
72 catch (Exception)
73 {
74 MainLog.Instance.Verbose("AssetStorage", "Caught fill error on asset table");
75 }
76
68 77
69 return; 78 return;
70 } 79 }
@@ -172,7 +181,14 @@ namespace OpenSim.Framework.Data.SQLite
172 { 181 {
173 row["UUID"] = asset.FullID; 182 row["UUID"] = asset.FullID;
174 row["Name"] = asset.Name; 183 row["Name"] = asset.Name;
175 row["Description"] = asset.Description; 184 if (asset.Description != null)
185 {
186 row["Description"] = asset.Description;
187 }
188 else
189 {
190 row["Description"] = " ";
191 }
176 row["Type"] = asset.Type; 192 row["Type"] = asset.Type;
177 row["InvType"] = asset.InvType; 193 row["InvType"] = asset.InvType;
178 row["Local"] = asset.Local; 194 row["Local"] = asset.Local;
diff --git a/OpenSim/Framework/General/Interfaces/IAssetProvider.cs b/OpenSim/Framework/General/Interfaces/IAssetProvider.cs
new file mode 100644
index 0000000..a2ef826
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/IAssetProvider.cs
@@ -0,0 +1,18 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Types;
5using libsecondlife;
6
7namespace OpenSim.Framework.Interfaces
8{
9 public interface IAssetProvider
10 {
11 void Initialise(string dbfile, string dbname);
12 AssetBase FetchAsset(LLUUID uuid);
13 void CreateAsset(AssetBase asset);
14 void UpdateAsset(AssetBase asset);
15 bool ExistsAsset(LLUUID uuid);
16 void CommitAssets(); // force a sync to the database
17 }
18} \ No newline at end of file
diff --git a/OpenSim/Framework/General/Interfaces/IAssetServer.cs b/OpenSim/Framework/General/Interfaces/IAssetServer.cs
index cdce979..da3f61a 100644
--- a/OpenSim/Framework/General/Interfaces/IAssetServer.cs
+++ b/OpenSim/Framework/General/Interfaces/IAssetServer.cs
@@ -37,9 +37,9 @@ namespace OpenSim.Framework.Interfaces
37 public interface IAssetServer 37 public interface IAssetServer
38 { 38 {
39 void SetReceiver(IAssetReceiver receiver); 39 void SetReceiver(IAssetReceiver receiver);
40 void RequestAsset(LLUUID assetID, bool isTexture); 40 void FetchAsset(LLUUID assetID, bool isTexture);
41 void UpdateAsset(AssetBase asset); 41 void UpdateAsset(AssetBase asset);
42 void UploadNewAsset(AssetBase asset); 42 void CreateAsset(AssetBase asset);
43 void SetServerInfo(string ServerUrl, string ServerKey); 43 void SetServerInfo(string ServerUrl, string ServerKey);
44 void Close(); 44 void Close();
45 } 45 }
diff --git a/OpenSim/Framework/General/Types/AssetBase.cs b/OpenSim/Framework/General/Types/AssetBase.cs
index 71642a2..7d5ee7b 100644
--- a/OpenSim/Framework/General/Types/AssetBase.cs
+++ b/OpenSim/Framework/General/Types/AssetBase.cs
@@ -42,7 +42,8 @@ namespace OpenSim.Framework.Types
42 42
43 public AssetBase() 43 public AssetBase()
44 { 44 {
45 45 Name = " ";
46 Description = " ";
46 } 47 }
47 } 48 }
48} 49}
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 9e0bc09..8437933 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -266,7 +266,8 @@ namespace OpenSim
266 { 266 {
267 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 267 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
268 268
269 LocalAssetServer assetServer = new LocalAssetServer(); 269 // LocalAssetServer assetServer = new LocalAssetServer();
270 SQLAssetServer assetServer = new SQLAssetServer();
270 assetServer.SetServerInfo(m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); 271 assetServer.SetServerInfo(m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
271 m_assetCache = new AssetCache(assetServer); 272 m_assetCache = new AssetCache(assetServer);
272 // m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); 273 // m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
index 082eec2..e2617b3 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack
58 58
59 protected bool AgentTextureCached(ClientView simclient, Packet packet) 59 protected bool AgentTextureCached(ClientView simclient, Packet packet)
60 { 60 {
61 // Console.WriteLine(packet.ToString()); 61 //System.Console.WriteLine("texture cached: " + packet.ToString());
62 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet; 62 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet;
63 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); 63 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
64 cachedresp.AgentData.AgentID = this.AgentID; 64 cachedresp.AgentData.AgentID = this.AgentID;
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index a35666d..4e2599f 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -170,6 +170,7 @@ namespace OpenSim.Region.ClientStack
170 } 170 }
171 break; 171 break;
172 case PacketType.AgentSetAppearance: 172 case PacketType.AgentSetAppearance:
173 //OpenSim.Framework.Console.MainLog.Instance.Verbose("set appear", Pack.ToString());
173 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; 174 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
174 if (OnSetAppearance != null) 175 if (OnSetAppearance != null)
175 { 176 {
@@ -366,8 +367,9 @@ namespace OpenSim.Region.ClientStack
366 m_assetCache.AddAssetRequest(this, transfer); 367 m_assetCache.AddAssetRequest(this, transfer);
367 break; 368 break;
368 case PacketType.AssetUploadRequest: 369 case PacketType.AssetUploadRequest:
369 //Console.WriteLine("upload request " + Pack.ToString());
370 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; 370 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
371 // Console.WriteLine("upload request " + Pack.ToString());
372 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
371 if (OnAssetUploadRequest != null) 373 if (OnAssetUploadRequest != null)
372 { 374 {
373 OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); 375 OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
diff --git a/OpenSim/Region/Environment/Interfaces/IXfer.cs b/OpenSim/Region/Environment/Interfaces/IXfer.cs
new file mode 100644
index 0000000..a19ba8d
--- /dev/null
+++ b/OpenSim/Region/Environment/Interfaces/IXfer.cs
@@ -0,0 +1,11 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Environment.Interfaces
6{
7 public interface IXfer
8 {
9 bool AddNewFile(string fileName, byte[] data);
10 }
11}
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index be3384b..ea416cb 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -28,27 +28,23 @@ namespace OpenSim.Region.Environment
28 /// <param name="scene"></param> 28 /// <param name="scene"></param>
29 public void CreateDefaultModules(Scene scene, string exceptModules) 29 public void CreateDefaultModules(Scene scene, string exceptModules)
30 { 30 {
31 XferModule xferManager = new XferModule(); 31 IRegionModule module = new XferModule();
32 xferManager.Initialise(scene); 32 InitialiseModule(module, scene);
33 scene.AddModule(xferManager.GetName(), xferManager);
34 LoadedModules.Add(xferManager);
35 33
36 ChatModule chatModule = new ChatModule(); 34 module = new ChatModule();
37 chatModule.Initialise(scene); 35 InitialiseModule(module, scene);
38 scene.AddModule(chatModule.GetName(), chatModule); 36
39 LoadedModules.Add(chatModule); 37 module = new AvatarProfilesModule();
40 38 InitialiseModule(module, scene);
41 AvatarProfilesModule avatarProfiles = new AvatarProfilesModule();
42 avatarProfiles.Initialise(scene);
43 scene.AddModule(avatarProfiles.GetName(), avatarProfiles);
44 LoadedModules.Add(avatarProfiles);
45 39
46 this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); 40 this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
47 41
48 string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); 42 string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
49 this.LoadRegionModule(lslPath, "LSLScriptingModule", scene); 43 this.LoadRegionModule(lslPath, "LSLScriptingModule", scene);
44
50 } 45 }
51 46
47
52 public void LoadDefaultSharedModules(string exceptModules) 48 public void LoadDefaultSharedModules(string exceptModules)
53 { 49 {
54 DynamicTextureModule dynamicModule = new DynamicTextureModule(); 50 DynamicTextureModule dynamicModule = new DynamicTextureModule();
@@ -64,6 +60,13 @@ namespace OpenSim.Region.Environment
64 } 60 }
65 } 61 }
66 62
63 private void InitialiseModule(IRegionModule module, Scene scene)
64 {
65 module.Initialise(scene);
66 scene.AddModule(module.GetName(), module);
67 LoadedModules.Add(module);
68 }
69
67 /// <summary> 70 /// <summary>
68 /// Loads/initialises a Module instance that can be used by mutliple Regions 71 /// Loads/initialises a Module instance that can be used by mutliple Regions
69 /// </summary> 72 /// </summary>
@@ -84,9 +87,7 @@ namespace OpenSim.Region.Environment
84 IRegionModule module = this.LoadModule(dllName, moduleName); 87 IRegionModule module = this.LoadModule(dllName, moduleName);
85 if (module != null) 88 if (module != null)
86 { 89 {
87 module.Initialise(scene); 90 this.InitialiseModule(module, scene);
88 scene.AddModule(module.GetName(), module);
89 LoadedModules.Add(module);
90 } 91 }
91 } 92 }
92 93
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index eec9f97..44b4d7a 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -10,7 +10,7 @@ using OpenSim.Region.Environment.Interfaces;
10 10
11namespace OpenSim.Region.Environment.Modules 11namespace OpenSim.Region.Environment.Modules
12{ 12{
13 public class XferModule : IRegionModule 13 public class XferModule : IRegionModule, IXfer
14 { 14 {
15 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); 15 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
16 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); 16 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
@@ -27,7 +27,7 @@ namespace OpenSim.Region.Environment.Modules
27 m_scene = scene; 27 m_scene = scene;
28 m_scene.EventManager.OnNewClient += NewClient; 28 m_scene.EventManager.OnNewClient += NewClient;
29 29
30 m_scene.RegisterAPIMethod("API_AddXferFile", new ModuleAPIMethod2<bool, string, byte[]>(this.AddNewFile)); 30 m_scene.RegisterModuleInterface<IXfer>(this);
31 } 31 }
32 32
33 public void PostInitialise() 33 public void PostInitialise()
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index e5ab41f..70b34cf 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -201,9 +201,9 @@ namespace OpenSim.Region.Environment.Scenes
201 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); 201 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID);
202 if (fileChange) 202 if (fileChange)
203 { 203 {
204 if (this.AddXferFile != null) 204 if (this.XferManager != null)
205 { 205 {
206 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, AddXferFile); 206 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager);
207 } 207 }
208 } 208 }
209 break; 209 break;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 1af41be..d0edcda 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -91,10 +91,9 @@ namespace OpenSim.Region.Environment.Scenes
91 public Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>(); 91 public Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>();
92 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); 92 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
93 93
94 //API method Delegates and interfaces 94 //API module interfaces
95 95
96 // this most likely shouldn't be handled as a API method like this, but doing it for testing purposes 96 public IXfer XferManager;
97 public ModuleAPIMethod2<bool, string, byte[]> AddXferFile = null;
98 97
99 private IHttpRequests m_httpRequestModule = null; 98 private IHttpRequests m_httpRequestModule = null;
100 private ISimChat m_simChatModule = null; 99 private ISimChat m_simChatModule = null;
@@ -206,8 +205,7 @@ namespace OpenSim.Region.Environment.Scenes
206 m_simChatModule = this.RequestModuleInterface<ISimChat>(); 205 m_simChatModule = this.RequestModuleInterface<ISimChat>();
207 m_httpRequestModule = this.RequestModuleInterface<IHttpRequests>(); 206 m_httpRequestModule = this.RequestModuleInterface<IHttpRequests>();
208 207
209 //should change so it uses the module interface functions 208 XferManager = this.RequestModuleInterface<IXfer>();
210 AddXferFile = (ModuleAPIMethod2<bool, string, byte[]>)this.RequestAPIMethod("API_AddXferFile");
211 } 209 }
212 210
213 #region Script Handling Methods 211 #region Script Handling Methods
@@ -605,7 +603,7 @@ namespace OpenSim.Region.Environment.Scenes
605 { 603 {
606 if (!Entities.ContainsKey(sceneObject.UUID)) 604 if (!Entities.ContainsKey(sceneObject.UUID))
607 { 605 {
608 QuadTree.AddObject(sceneObject); 606 // QuadTree.AddObject(sceneObject);
609 Entities.Add(sceneObject.UUID, sceneObject); 607 Entities.Add(sceneObject.UUID, sceneObject);
610 } 608 }
611 } 609 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 45d975c..eff622a 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -11,6 +11,7 @@ using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types; 11using OpenSim.Framework.Types;
12using OpenSim.Region.Physics.Manager; 12using OpenSim.Region.Physics.Manager;
13using OpenSim.Framework.Data; 13using OpenSim.Framework.Data;
14using OpenSim.Region.Environment.Interfaces;
14 15
15namespace OpenSim.Region.Environment.Scenes 16namespace OpenSim.Region.Environment.Scenes
16{ 17{
@@ -676,12 +677,12 @@ namespace OpenSim.Region.Environment.Scenes
676 return false; 677 return false;
677 } 678 }
678 679
679 public string RequestInventoryFile(uint localID, ModuleAPIMethod2<bool, string, byte[]> addXferFile) 680 public string RequestInventoryFile(uint localID, IXfer xferManager)
680 { 681 {
681 SceneObjectPart part = this.GetChildPart(localID); 682 SceneObjectPart part = this.GetChildPart(localID);
682 if (part != null) 683 if (part != null)
683 { 684 {
684 part.RequestInventoryFile(addXferFile); 685 part.RequestInventoryFile(xferManager);
685 } 686 }
686 return ""; 687 return "";
687 } 688 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 9e207c8..2122a4f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -12,6 +12,7 @@ using OpenSim.Framework.Types;
12using OpenSim.Region.Environment.Scenes.Scripting; 12using OpenSim.Region.Environment.Scenes.Scripting;
13using OpenSim.Framework.Utilities; 13using OpenSim.Framework.Utilities;
14using OpenSim.Region.Physics.Manager; 14using OpenSim.Region.Physics.Manager;
15using OpenSim.Region.Environment.Interfaces;
15 16
16namespace OpenSim.Region.Environment.Scenes 17namespace OpenSim.Region.Environment.Scenes
17{ 18{
@@ -494,7 +495,7 @@ namespace OpenSim.Region.Environment.Scenes
494 return false; 495 return false;
495 } 496 }
496 497
497 public string RequestInventoryFile(ModuleAPIMethod2<bool, string, byte[]> addXferFile) 498 public string RequestInventoryFile(IXfer xferManager)
498 { 499 {
499 byte[] fileData = new byte[0]; 500 byte[] fileData = new byte[0];
500 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, this.UUID); 501 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, this.UUID);
@@ -528,7 +529,7 @@ namespace OpenSim.Region.Environment.Scenes
528 fileData = Helpers.StringToField(invString.BuildString); 529 fileData = Helpers.StringToField(invString.BuildString);
529 if (fileData.Length > 2) 530 if (fileData.Length > 2)
530 { 531 {
531 addXferFile(m_inventoryFileName, fileData); 532 xferManager.AddNewFile(m_inventoryFileName, fileData);
532 } 533 }
533 return ""; 534 return "";
534 } 535 }
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs
index d7eb6ee..dab4258 100644
--- a/OpenSim/Region/Environment/Types/UpdateQueue.cs
+++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs
@@ -12,10 +12,43 @@ namespace OpenSim.Region.Environment.Types
12 12
13 private List<LLUUID> m_ids; 13 private List<LLUUID> m_ids;
14 14
15 public int Count
16 {
17 get { return m_queue.Count; }
18 }
19
15 public UpdateQueue() 20 public UpdateQueue()
16 { 21 {
17 m_queue = new Queue<SceneObjectPart>(); 22 m_queue = new Queue<SceneObjectPart>();
18 m_ids = new List<LLUUID>(); 23 m_ids = new List<LLUUID>();
19 } 24 }
25
26 public void Enqueue(SceneObjectPart part)
27 {
28 lock (m_ids)
29 {
30 if (!m_ids.Contains(part.UUID))
31 {
32 m_ids.Add(part.UUID);
33 m_queue.Enqueue(part);
34 }
35 }
36 }
37
38 public SceneObjectPart Dequeue()
39 {
40 SceneObjectPart part = null;
41 if (m_queue.Count > 0)
42 {
43 part = m_queue.Dequeue();
44 lock (m_ids)
45 {
46 m_ids.Remove(part.UUID);
47 }
48 }
49
50 return part;
51 }
52
20 } 53 }
21} 54}
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 5f7360e..65b03ad 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -187,6 +187,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
187 return retvals; 187 return retvals;
188 } 188 }
189 189
190
190 public void StoreTerrain(double[,] ter) 191 public void StoreTerrain(double[,] ter)
191 { 192 {
192 193