aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/GridInterfaces
diff options
context:
space:
mode:
authorlbsa712007-07-17 00:07:26 +0000
committerlbsa712007-07-17 00:07:26 +0000
commit47ea453b32fe8122ed2eb0d62607f65d3dbdddb8 (patch)
tree83877e94fdc053c3c0f5d2e431cbe8f49228840e /OpenSim/Region/GridInterfaces
parent* RegionApplicationBase restructuring now complete (diff)
downloadopensim-SC_OLD-47ea453b32fe8122ed2eb0d62607f65d3dbdddb8.zip
opensim-SC_OLD-47ea453b32fe8122ed2eb0d62607f65d3dbdddb8.tar.gz
opensim-SC_OLD-47ea453b32fe8122ed2eb0d62607f65d3dbdddb8.tar.bz2
opensim-SC_OLD-47ea453b32fe8122ed2eb0d62607f65d3dbdddb8.tar.xz
* debugged quite a lot of db-related strangeness and various refactoring goofs
Diffstat (limited to 'OpenSim/Region/GridInterfaces')
-rw-r--r--OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs249
1 files changed, 116 insertions, 133 deletions
diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
index f3d7a2c..2f827cf 100644
--- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
+++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
@@ -64,22 +64,15 @@ namespace OpenSim.Region.GridInterfaces.Local
64 this._assetRequests = new BlockingQueue<ARequest>(); 64 this._assetRequests = new BlockingQueue<ARequest>();
65 yapfile = File.Exists("regionassets.yap"); 65 yapfile = File.Exists("regionassets.yap");
66 66
67 MainLog.Instance.Verbose( "Local Asset Server class created"); 67 MainLog.Instance.Verbose("Local Asset Server class created");
68 try 68 db = Db4oFactory.OpenFile("regionassets.yap");
69 { 69 MainLog.Instance.Verbose("Db4 Asset database creation");
70 db = Db4oFactory.OpenFile("regionassets.yap"); 70
71 MainLog.Instance.Verbose( "Db4 Asset database creation");
72 }
73 catch (Exception e)
74 {
75 db.Close();
76 MainLog.Instance.WriteLine(LogPriority.MEDIUM, "Db4 Asset server :Constructor - Exception occured");
77 MainLog.Instance.Warn(e.ToString());
78 }
79 if (!yapfile) 71 if (!yapfile)
80 { 72 {
81 this.SetUpAssetDatabase(); 73 this.SetUpAssetDatabase();
82 } 74 }
75
83 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); 76 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
84 this._localAssetServerThread.IsBackground = true; 77 this._localAssetServerThread.IsBackground = true;
85 this._localAssetServerThread.Start(); 78 this._localAssetServerThread.Start();
@@ -122,7 +115,7 @@ namespace OpenSim.Region.GridInterfaces.Local
122 { 115 {
123 if (db != null) 116 if (db != null)
124 { 117 {
125 MainLog.Instance.Verbose( "Closing local asset server database"); 118 MainLog.Instance.Verbose("Closing local asset server database");
126 db.Close(); 119 db.Close();
127 } 120 }
128 } 121 }
@@ -163,116 +156,106 @@ namespace OpenSim.Region.GridInterfaces.Local
163 156
164 private void SetUpAssetDatabase() 157 private void SetUpAssetDatabase()
165 { 158 {
166 try 159 MainLog.Instance.Verbose("Setting up asset database");
167 {
168 160
169 MainLog.Instance.Verbose( "Setting up asset database"); 161 AssetBase Image = new AssetBase();
170 162 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
171 AssetBase Image = new AssetBase(); 163 Image.Name = "Bricks";
172 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); 164 this.LoadAsset(Image, true, "bricks.jp2");
173 Image.Name = "Bricks"; 165 AssetStorage store = new AssetStorage();
174 this.LoadAsset(Image, true, "bricks.jp2"); 166 store.Data = Image.Data;
175 AssetStorage store = new AssetStorage(); 167 store.Name = Image.Name;
176 store.Data = Image.Data; 168 store.UUID = Image.FullID;
177 store.Name = Image.Name; 169 db.Set(store);
178 store.UUID = Image.FullID; 170 db.Commit();
179 db.Set(store); 171
180 db.Commit(); 172 Image = new AssetBase();
181 173 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
182 Image = new AssetBase(); 174 Image.Name = "Plywood";
183 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); 175 this.LoadAsset(Image, true, "plywood.jp2");
184 Image.Name = "Plywood"; 176 store = new AssetStorage();
185 this.LoadAsset(Image, true, "plywood.jp2"); 177 store.Data = Image.Data;
186 store = new AssetStorage(); 178 store.Name = Image.Name;
187 store.Data = Image.Data; 179 store.UUID = Image.FullID;
188 store.Name = Image.Name; 180 db.Set(store);
189 store.UUID = Image.FullID; 181 db.Commit();
190 db.Set(store); 182
191 db.Commit(); 183 Image = new AssetBase();
192 184 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
193 Image = new AssetBase(); 185 Image.Name = "Rocks";
194 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); 186 this.LoadAsset(Image, true, "rocks.jp2");
195 Image.Name = "Rocks"; 187 store = new AssetStorage();
196 this.LoadAsset(Image, true, "rocks.jp2"); 188 store.Data = Image.Data;
197 store = new AssetStorage(); 189 store.Name = Image.Name;
198 store.Data = Image.Data; 190 store.UUID = Image.FullID;
199 store.Name = Image.Name; 191 db.Set(store);
200 store.UUID = Image.FullID; 192 db.Commit();
201 db.Set(store); 193
202 db.Commit(); 194 Image = new AssetBase();
203 195 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
204 Image = new AssetBase(); 196 Image.Name = "Granite";
205 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); 197 this.LoadAsset(Image, true, "granite.jp2");
206 Image.Name = "Granite"; 198 store = new AssetStorage();
207 this.LoadAsset(Image, true, "granite.jp2"); 199 store.Data = Image.Data;
208 store = new AssetStorage(); 200 store.Name = Image.Name;
209 store.Data = Image.Data; 201 store.UUID = Image.FullID;
210 store.Name = Image.Name; 202 db.Set(store);
211 store.UUID = Image.FullID; 203 db.Commit();
212 db.Set(store);
213 db.Commit();
214
215 Image = new AssetBase();
216 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
217 Image.Name = "Hardwood";
218 this.LoadAsset(Image, true, "hardwood.jp2");
219 store = new AssetStorage();
220 store.Data = Image.Data;
221 store.Name = Image.Name;
222 store.UUID = Image.FullID;
223 db.Set(store);
224 db.Commit();
225
226 Image = new AssetBase();
227 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
228 Image.Name = "Prim Base Texture";
229 this.LoadAsset(Image, true, "plywood.jp2");
230 store = new AssetStorage();
231 store.Data = Image.Data;
232 store.Name = Image.Name;
233 store.UUID = Image.FullID;
234 db.Set(store);
235 db.Commit();
236
237 Image = new AssetBase();
238 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006");
239 Image.Name = "Map Base Texture";
240 this.LoadAsset(Image, true, "map_base.jp2");
241 store = new AssetStorage();
242 store.Data = Image.Data;
243 store.Name = Image.Name;
244 store.UUID = Image.FullID;
245 db.Set(store);
246 db.Commit();
247
248 Image = new AssetBase();
249 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007");
250 Image.Name = "Map Texture";
251 this.LoadAsset(Image, true, "map1.jp2");
252 store = new AssetStorage();
253 store.Data = Image.Data;
254 store.Name = Image.Name;
255 store.UUID = Image.FullID;
256 db.Set(store);
257 db.Commit();
258
259 Image = new AssetBase();
260 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
261 Image.Name = "Shape";
262 this.LoadAsset(Image, false, "base_shape.dat");
263 store = new AssetStorage();
264 store.Data = Image.Data;
265 store.Name = Image.Name;
266 store.UUID = Image.FullID;
267 db.Set(store);
268 db.Commit();
269 }
270 catch (Exception e)
271 {
272 Console.WriteLine("exception loading default assets into database");
273 Console.WriteLine(e.Message);
274 }
275 204
205 Image = new AssetBase();
206 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
207 Image.Name = "Hardwood";
208 this.LoadAsset(Image, true, "hardwood.jp2");
209 store = new AssetStorage();
210 store.Data = Image.Data;
211 store.Name = Image.Name;
212 store.UUID = Image.FullID;
213 db.Set(store);
214 db.Commit();
215
216 Image = new AssetBase();
217 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
218 Image.Name = "Prim Base Texture";
219 this.LoadAsset(Image, true, "plywood.jp2");
220 store = new AssetStorage();
221 store.Data = Image.Data;
222 store.Name = Image.Name;
223 store.UUID = Image.FullID;
224 db.Set(store);
225 db.Commit();
226
227 Image = new AssetBase();
228 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006");
229 Image.Name = "Map Base Texture";
230 this.LoadAsset(Image, true, "map_base.jp2");
231 store = new AssetStorage();
232 store.Data = Image.Data;
233 store.Name = Image.Name;
234 store.UUID = Image.FullID;
235 db.Set(store);
236 db.Commit();
237
238 Image = new AssetBase();
239 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007");
240 Image.Name = "Map Texture";
241 this.LoadAsset(Image, true, "map1.jp2");
242 store = new AssetStorage();
243 store.Data = Image.Data;
244 store.Name = Image.Name;
245 store.UUID = Image.FullID;
246 db.Set(store);
247 db.Commit();
248
249 Image = new AssetBase();
250 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
251 Image.Name = "Shape";
252 this.LoadAsset(Image, false, "base_shape.dat");
253 store = new AssetStorage();
254 store.Data = Image.Data;
255 store.Name = Image.Name;
256 store.UUID = Image.FullID;
257 db.Set(store);
258 db.Commit();
276 } 259 }
277 260
278 private void LoadAsset(AssetBase info, bool image, string filename) 261 private void LoadAsset(AssetBase info, bool image, string filename)
@@ -294,18 +277,18 @@ namespace OpenSim.Region.GridInterfaces.Local
294 //info.loaded=true; 277 //info.loaded=true;
295 } 278 }
296 } 279 }
297 public class AssetUUIDQuery : Predicate 280 public class AssetUUIDQuery : Predicate
298 { 281 {
299 private LLUUID _findID; 282 private LLUUID _findID;
300 283
301 public AssetUUIDQuery(LLUUID find) 284 public AssetUUIDQuery(LLUUID find)
302 { 285 {
303 _findID = find; 286 _findID = find;
304 } 287 }
305 public bool Match(AssetStorage asset) 288 public bool Match(AssetStorage asset)
306 { 289 {
307 return (asset.UUID == _findID); 290 return (asset.UUID == _findID);
308 }
309 } 291 }
310 292 }
293
311} 294}