aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.nant/local.include25
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs302
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs1014
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs13
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs6
-rw-r--r--OpenSim/Region/Application/OpenSim.cs16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs21
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs295
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs64
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs64
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs9
-rw-r--r--OpenSim/Server/ServerMain.cs2
-rw-r--r--OpenSim/Services/PresenceService/PresenceService.cs3
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs89
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs28
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs173
22 files changed, 1121 insertions, 1052 deletions
diff --git a/.nant/local.include b/.nant/local.include
index 97353e0..0b6f9fe 100644
--- a/.nant/local.include
+++ b/.nant/local.include
@@ -127,15 +127,10 @@
127 </exec> 127 </exec>
128 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" /> 128 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
129 129
130 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.sqlite.tests"> 130 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.tests">
131 <arg value="./bin/OpenSim.Data.SQLite.Tests.dll" /> 131 <arg value="./bin/OpenSim.Data.Tests.dll" />
132 </exec> 132 </exec>
133 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.sqlite.tests)==0}" /> 133 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
134
135 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.mysql.tests">
136 <arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
137 </exec>
138 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
139 134
140 <delete dir="%temp%"/> 135 <delete dir="%temp%"/>
141 136
@@ -297,14 +292,9 @@
297 <arg value="-xml=test-results/OpenSim.Region.Framework.Tests.dll-Results.xml" /> 292 <arg value="-xml=test-results/OpenSim.Region.Framework.Tests.dll-Results.xml" />
298 </exec> 293 </exec>
299 294
300 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.sqlite.tests"> 295 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.tests">
301 <arg value="./bin/OpenSim.Data.SQLite.Tests.dll" /> 296 <arg value="./bin/OpenSim.Data.Tests.dll" />
302 <arg value="-xml=test-results/OpenSim.Data.SQLite.Tests.dll-Results.xml" /> 297 <arg value="-xml=test-results/OpenSim.Data.Tests.dll-Results.xml" />
303 </exec>
304
305 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.mysql.tests">
306 <arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
307 <arg value="-xml=test-results/OpenSim.Data.MySQL.Tests.dll-Results.xml" />
308 </exec> 298 </exec>
309 299
310 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" /> 300 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
@@ -313,8 +303,7 @@
313 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" /> 303 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
314 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" /> 304 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
315 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" /> 305 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
316 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.sqlite.tests)==0}" /> 306 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
317 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
318 307
319</target> 308</target>
320<!-- <exec program="nunit-console.exe" failonerror="false" resultproperty="testresult.acceptancetestassembly"> --> 309<!-- <exec program="nunit-console.exe" failonerror="false" resultproperty="testresult.acceptancetestassembly"> -->
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
index b70a511..4369216 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
@@ -39,8 +39,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
39 39
40 public class RestAppearanceServices : IRest 40 public class RestAppearanceServices : IRest
41 { 41 {
42 42// private static readonly int PARM_USERID = 0;
43 private static readonly int PARM_USERID = 0;
44 43
45 // private static readonly int PARM_PATH = 1; 44 // private static readonly int PARM_PATH = 1;
46 45
@@ -64,6 +63,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
64 { 63 {
65 Rest.Log.InfoFormat("{0} Domain is relative, adding absolute prefix", MsgId); 64 Rest.Log.InfoFormat("{0} Domain is relative, adding absolute prefix", MsgId);
66 qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix); 65 qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix);
66 qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix);
67 Rest.Log.InfoFormat("{0} Domain is now <{1}>", MsgId, qPrefix); 67 Rest.Log.InfoFormat("{0} Domain is now <{1}>", MsgId, qPrefix);
68 } 68 }
69 69
@@ -294,31 +294,31 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
294 /// </summary> 294 /// </summary>
295 /// <param name=rdata>HTTP service request work area</param> 295 /// <param name=rdata>HTTP service request work area</param>
296 296
297 private void DoGet(AppearanceRequestData rdata) 297// private void DoGet(AppearanceRequestData rdata)
298 { 298// {
299 AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID); 299// AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
300 300//
301 if (adata == null) 301// if (adata == null)
302 { 302// {
303 rdata.Fail(Rest.HttpStatusCodeNoContent, 303// rdata.Fail(Rest.HttpStatusCodeNoContent,
304 String.Format("appearance data not found for user {0} {1}", 304// String.Format("appearance data not found for user {0} {1}",
305 rdata.userProfile.FirstName, rdata.userProfile.SurName)); 305// rdata.userProfile.FirstName, rdata.userProfile.SurName));
306 } 306// }
307 rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID); 307// rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
308 308//
309 rdata.initXmlWriter(); 309// rdata.initXmlWriter();
310 310//
311 FormatUserAppearance(rdata); 311// FormatUserAppearance(rdata);
312 312//
313 // Indicate a successful request 313// // Indicate a successful request
314 314//
315 rdata.Complete(); 315// rdata.Complete();
316 316//
317 // Send the response to the user. The body will be implicitly 317// // Send the response to the user. The body will be implicitly
318 // constructed from the result of the XML writer. 318// // constructed from the result of the XML writer.
319 319//
320 rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method)); 320// rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method));
321 } 321// }
322 322
323 /// <summary> 323 /// <summary>
324 /// POST adds NEW information to the user profile database. 324 /// POST adds NEW information to the user profile database.
@@ -326,112 +326,112 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
326 /// characteristics supplied in the request. 326 /// characteristics supplied in the request.
327 /// </summary> 327 /// </summary>
328 328
329 private void DoExtend(AppearanceRequestData rdata) 329// private void DoExtend(AppearanceRequestData rdata)
330 { 330// {
331 331//
332 bool created = false; 332// bool created = false;
333 bool modified = false; 333// bool modified = false;
334 string newnode = String.Empty; 334// string newnode = String.Empty;
335 335//
336 Rest.Log.DebugFormat("{0} POST ENTRY", MsgId); 336// Rest.Log.DebugFormat("{0} POST ENTRY", MsgId);
337 337//
338 //AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); 338// //AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
339 339//
340 rdata.userAppearance = new AvatarAppearance(); 340// rdata.userAppearance = new AvatarAppearance();
341 341//
342 // Although the following behavior is admitted by HTTP I am becoming 342// // Although the following behavior is admitted by HTTP I am becoming
343 // increasingly doubtful that it is appropriate for REST. If I attempt to 343// // increasingly doubtful that it is appropriate for REST. If I attempt to
344 // add a new record, and it already exists, then it seems to me that the 344// // add a new record, and it already exists, then it seems to me that the
345 // attempt should fail, rather than update the existing record. 345// // attempt should fail, rather than update the existing record.
346 AvatarData adata = null; 346// AvatarData adata = null;
347 if (GetUserAppearance(rdata)) 347// if (GetUserAppearance(rdata))
348 { 348// {
349 modified = rdata.userAppearance != null; 349// modified = rdata.userAppearance != null;
350 created = !modified; 350// created = !modified;
351 adata = new AvatarData(rdata.userAppearance); 351// adata = new AvatarData(rdata.userAppearance);
352 Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); 352// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
353 // Rest.UserServices.UpdateUserProfile(rdata.userProfile); 353// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
354 } 354// }
355 else 355// else
356 { 356// {
357 created = true; 357// created = true;
358 adata = new AvatarData(rdata.userAppearance); 358// adata = new AvatarData(rdata.userAppearance);
359 Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); 359// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
360 // Rest.UserServices.UpdateUserProfile(rdata.userProfile); 360// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
361 } 361// }
362 362//
363 if (created) 363// if (created)
364 { 364// {
365 newnode = String.Format("{0} {1}", rdata.userProfile.FirstName, 365// newnode = String.Format("{0} {1}", rdata.userProfile.FirstName,
366 rdata.userProfile.SurName); 366// rdata.userProfile.SurName);
367 // Must include a location header with a URI that identifies the new resource. 367// // Must include a location header with a URI that identifies the new resource.
368 368//
369 rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}{3}{4}", 369// rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}{3}{4}",
370 rdata.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode)); 370// rdata.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode));
371 rdata.Complete(Rest.HttpStatusCodeCreated); 371// rdata.Complete(Rest.HttpStatusCodeCreated);
372 372//
373 } 373// }
374 else 374// else
375 { 375// {
376 if (modified) 376// if (modified)
377 { 377// {
378 rdata.Complete(Rest.HttpStatusCodeOK); 378// rdata.Complete(Rest.HttpStatusCodeOK);
379 } 379// }
380 else 380// else
381 { 381// {
382 rdata.Complete(Rest.HttpStatusCodeNoContent); 382// rdata.Complete(Rest.HttpStatusCodeNoContent);
383 } 383// }
384 } 384// }
385 385//
386 rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); 386// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
387 387//
388 } 388// }
389 389
390 /// <summary> 390 /// <summary>
391 /// This updates the user's appearance. not all aspects need to be provided, 391 /// This updates the user's appearance. not all aspects need to be provided,
392 /// only those supplied will be changed. 392 /// only those supplied will be changed.
393 /// </summary> 393 /// </summary>
394 394
395 private void DoUpdate(AppearanceRequestData rdata) 395// private void DoUpdate(AppearanceRequestData rdata)
396 { 396// {
397 397//
398 // REFACTORING PROBLEM This was commented out. It doesn't work for 0.7 398// // REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
399 399//
400 //bool created = false; 400// //bool created = false;
401 //bool modified = false; 401// //bool modified = false;
402 402//
403 403//
404 //rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); 404// //rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
405 405//
406 //// If the user exists then this is considered a modification regardless 406// //// If the user exists then this is considered a modification regardless
407 //// of what may, or may not be, specified in the payload. 407// //// of what may, or may not be, specified in the payload.
408 408//
409 //if (rdata.userAppearance != null) 409// //if (rdata.userAppearance != null)
410 //{ 410// //{
411 // modified = true; 411// // modified = true;
412 // Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); 412// // Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
413 // Rest.UserServices.UpdateUserProfile(rdata.userProfile); 413// // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
414 //} 414// //}
415 415//
416 //if (created) 416// //if (created)
417 //{ 417// //{
418 // rdata.Complete(Rest.HttpStatusCodeCreated); 418// // rdata.Complete(Rest.HttpStatusCodeCreated);
419 //} 419// //}
420 //else 420// //else
421 //{ 421// //{
422 // if (modified) 422// // if (modified)
423 // { 423// // {
424 // rdata.Complete(Rest.HttpStatusCodeOK); 424// // rdata.Complete(Rest.HttpStatusCodeOK);
425 // } 425// // }
426 // else 426// // else
427 // { 427// // {
428 // rdata.Complete(Rest.HttpStatusCodeNoContent); 428// // rdata.Complete(Rest.HttpStatusCodeNoContent);
429 // } 429// // }
430 //} 430// //}
431 431//
432 rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); 432// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
433 433//
434 } 434// }
435 435
436 /// <summary> 436 /// <summary>
437 /// Delete the specified user's appearance. This actually performs a reset 437 /// Delete the specified user's appearance. This actually performs a reset
@@ -439,31 +439,29 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
439 /// Existing ownership is preserved. All prior updates are lost and can not 439 /// Existing ownership is preserved. All prior updates are lost and can not
440 /// be recovered. 440 /// be recovered.
441 /// </summary> 441 /// </summary>
442 442// private void DoDelete(AppearanceRequestData rdata)
443 private void DoDelete(AppearanceRequestData rdata) 443// {
444 { 444// AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
445 AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID); 445//
446 446// if (adata != null)
447 if (adata != null) 447// {
448 { 448// AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
449 AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID); 449// rdata.userAppearance = new AvatarAppearance();
450 rdata.userAppearance = new AvatarAppearance(); 450// rdata.userAppearance.Owner = old.Owner;
451 rdata.userAppearance.Owner = old.Owner; 451// adata = new AvatarData(rdata.userAppearance);
452 adata = new AvatarData(rdata.userAppearance); 452//
453 453// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
454 Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); 454//
455 455// rdata.Complete();
456 rdata.Complete(); 456// }
457 } 457// else
458 else 458// {
459 { 459//
460 460// rdata.Complete(Rest.HttpStatusCodeNoContent);
461 rdata.Complete(Rest.HttpStatusCodeNoContent); 461// }
462 } 462//
463 463// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
464 rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); 464// }
465
466 }
467 465
468#endregion method-specific processing 466#endregion method-specific processing
469 467
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index 10f387d..a4135db 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -45,10 +45,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
45{ 45{
46 public class RestInventoryServices : IRest 46 public class RestInventoryServices : IRest
47 { 47 {
48 private static readonly int PARM_USERID = 0; 48// private static readonly int PARM_USERID = 0;
49 private static readonly int PARM_PATH = 1; 49 private static readonly int PARM_PATH = 1;
50 50
51 private bool enabled = false; 51// private bool enabled = false;
52 private string qPrefix = "inventory"; 52 private string qPrefix = "inventory";
53 53
54 private static readonly string PRIVATE_ROOT_NAME = "My Inventory"; 54 private static readonly string PRIVATE_ROOT_NAME = "My Inventory";
@@ -79,7 +79,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
79 79
80 // Activate if everything went OK 80 // Activate if everything went OK
81 81
82 enabled = true; 82// enabled = true;
83 83
84 Rest.Log.InfoFormat("{0} Inventory services initialization complete", MsgId); 84 Rest.Log.InfoFormat("{0} Inventory services initialization complete", MsgId);
85 } 85 }
@@ -100,7 +100,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
100 100
101 public void Close() 101 public void Close()
102 { 102 {
103 enabled = false; 103// enabled = false;
104 Rest.Log.InfoFormat("{0} Inventory services closing down", MsgId); 104 Rest.Log.InfoFormat("{0} Inventory services closing down", MsgId);
105 } 105 }
106 106
@@ -139,7 +139,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
139 /// <param name=hdata>A consolidated HTTP request work area</param> 139 /// <param name=hdata>A consolidated HTTP request work area</param>
140 private void DoInventory(RequestData hdata) 140 private void DoInventory(RequestData hdata)
141 { 141 {
142 InventoryRequestData rdata = (InventoryRequestData) hdata; 142// InventoryRequestData rdata = (InventoryRequestData) hdata;
143 143
144 Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId); 144 Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId);
145 145
@@ -354,32 +354,32 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
354 /// corresponding subtree based upon node name. 354 /// corresponding subtree based upon node name.
355 /// </summary> 355 /// </summary>
356 /// <param name=rdata>HTTP service request work area</param> 356 /// <param name=rdata>HTTP service request work area</param>
357 private void DoGet(InventoryRequestData rdata) 357// private void DoGet(InventoryRequestData rdata)
358 { 358// {
359 rdata.initXmlWriter(); 359// rdata.initXmlWriter();
360 360//
361 rdata.writer.WriteStartElement(String.Empty,"Inventory",String.Empty); 361// rdata.writer.WriteStartElement(String.Empty,"Inventory",String.Empty);
362 362//
363 // If there are additional parameters, then these represent 363// // If there are additional parameters, then these represent
364 // a path relative to the root of the inventory. This path 364// // a path relative to the root of the inventory. This path
365 // must be traversed before we format the sub-tree thus 365// // must be traversed before we format the sub-tree thus
366 // identified. 366// // identified.
367 367//
368 traverse(rdata, rdata.root, PARM_PATH); 368// traverse(rdata, rdata.root, PARM_PATH);
369 369//
370 // Close all open elements 370// // Close all open elements
371 371//
372 rdata.writer.WriteFullEndElement(); 372// rdata.writer.WriteFullEndElement();
373 373//
374 // Indicate a successful request 374// // Indicate a successful request
375 375//
376 rdata.Complete(); 376// rdata.Complete();
377 377//
378 // Send the response to the user. The body will be implicitly 378// // Send the response to the user. The body will be implicitly
379 // constructed from the result of the XML writer. 379// // constructed from the result of the XML writer.
380 380//
381 rdata.Respond(String.Format("Inventory {0} Normal completion", rdata.method)); 381// rdata.Respond(String.Format("Inventory {0} Normal completion", rdata.method));
382 } 382// }
383 383
384 /// <summary> 384 /// <summary>
385 /// In the case of the inventory, and probably in general, 385 /// In the case of the inventory, and probably in general,
@@ -419,210 +419,210 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
419 /// context identified by the URI. 419 /// context identified by the URI.
420 /// </summary> 420 /// </summary>
421 /// <param name=rdata>HTTP service request work area</param> 421 /// <param name=rdata>HTTP service request work area</param>
422 private void DoExtend(InventoryRequestData rdata) 422// private void DoExtend(InventoryRequestData rdata)
423 { 423// {
424 bool created = false; 424// bool created = false;
425 bool modified = false; 425// bool modified = false;
426 string newnode = String.Empty; 426// string newnode = String.Empty;
427 427//
428 // Resolve the context node specified in the URI. Entity 428// // Resolve the context node specified in the URI. Entity
429 // data will be ADDED beneath this node. rdata already contains 429// // data will be ADDED beneath this node. rdata already contains
430 // information about the current content of the user's 430// // information about the current content of the user's
431 // inventory. 431// // inventory.
432 432//
433 Object InventoryNode = getInventoryNode(rdata, rdata.root, PARM_PATH, Rest.Fill); 433// Object InventoryNode = getInventoryNode(rdata, rdata.root, PARM_PATH, Rest.Fill);
434 434//
435 // Processing depends upon the type of inventory node 435// // Processing depends upon the type of inventory node
436 // identified in the URI. This is the CONTEXT for the 436// // identified in the URI. This is the CONTEXT for the
437 // change. We either got a context or we threw an 437// // change. We either got a context or we threw an
438 // exception. 438// // exception.
439 439//
440 // It follows that we can only add information if the URI 440// // It follows that we can only add information if the URI
441 // has identified a folder. So only a type of folder is supported 441// // has identified a folder. So only a type of folder is supported
442 // in this case. 442// // in this case.
443 443//
444 if (typeof(InventoryFolderBase) == InventoryNode.GetType() || 444// if (typeof(InventoryFolderBase) == InventoryNode.GetType() ||
445 typeof(InventoryFolderImpl) == InventoryNode.GetType()) 445// typeof(InventoryFolderImpl) == InventoryNode.GetType())
446 { 446// {
447 // Cast the context node appropriately. 447// // Cast the context node appropriately.
448 448//
449 InventoryFolderBase context = (InventoryFolderBase) InventoryNode; 449// InventoryFolderBase context = (InventoryFolderBase) InventoryNode;
450 450//
451 Rest.Log.DebugFormat("{0} {1}: Resource(s) will be added to folder {2}", 451// Rest.Log.DebugFormat("{0} {1}: Resource(s) will be added to folder {2}",
452 MsgId, rdata.method, rdata.path); 452// MsgId, rdata.method, rdata.path);
453 453//
454 // Reconstitute the inventory sub-tree from the XML supplied in the entity. 454// // Reconstitute the inventory sub-tree from the XML supplied in the entity.
455 // The result is a stand-alone inventory subtree, not yet integrated into the 455// // The result is a stand-alone inventory subtree, not yet integrated into the
456 // existing tree. An inventory collection consists of three components: 456// // existing tree. An inventory collection consists of three components:
457 // [1] A (possibly empty) set of folders. 457// // [1] A (possibly empty) set of folders.
458 // [2] A (possibly empty) set of items. 458// // [2] A (possibly empty) set of items.
459 // [3] A (possibly empty) set of assets. 459// // [3] A (possibly empty) set of assets.
460 // If all of these are empty, then the POST is a harmless no-operation. 460// // If all of these are empty, then the POST is a harmless no-operation.
461 461//
462 XmlInventoryCollection entity = ReconstituteEntity(rdata); 462// XmlInventoryCollection entity = ReconstituteEntity(rdata);
463 463//
464 // Inlined assets can be included in entity. These must be incorporated into 464// // Inlined assets can be included in entity. These must be incorporated into
465 // the asset database before we attempt to update the inventory. If anything 465// // the asset database before we attempt to update the inventory. If anything
466 // fails, return a failure to requestor. 466// // fails, return a failure to requestor.
467 467//
468 if (entity.Assets.Count > 0) 468// if (entity.Assets.Count > 0)
469 { 469// {
470 Rest.Log.DebugFormat("{0} Adding {1} assets to server", 470// Rest.Log.DebugFormat("{0} Adding {1} assets to server",
471 MsgId, entity.Assets.Count); 471// MsgId, entity.Assets.Count);
472 472//
473 foreach (AssetBase asset in entity.Assets) 473// foreach (AssetBase asset in entity.Assets)
474 { 474// {
475 Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", 475// Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}",
476 MsgId, asset.ID, asset.Type, asset.Name); 476// MsgId, asset.ID, asset.Type, asset.Name);
477 Rest.AssetServices.Store(asset); 477// Rest.AssetServices.Store(asset);
478 478//
479 created = true; 479// created = true;
480 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", 480// rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>",
481 asset.Name, asset.ID)); 481// asset.Name, asset.ID));
482 482//
483 if (Rest.DEBUG && Rest.DumpAsset) 483// if (Rest.DEBUG && Rest.DumpAsset)
484 { 484// {
485 Rest.Dump(asset.Data); 485// Rest.Dump(asset.Data);
486 } 486// }
487 } 487// }
488 } 488// }
489 489//
490 // Modify the context using the collection of folders and items 490// // Modify the context using the collection of folders and items
491 // returned in the XmlInventoryCollection. 491// // returned in the XmlInventoryCollection.
492 492//
493 foreach (InventoryFolderBase folder in entity.Folders) 493// foreach (InventoryFolderBase folder in entity.Folders)
494 { 494// {
495 InventoryFolderBase found; 495// InventoryFolderBase found;
496 496//
497 // If the parentID is zero, then this folder is going 497// // If the parentID is zero, then this folder is going
498 // into the root folder identified by the URI. The requestor 498// // into the root folder identified by the URI. The requestor
499 // may have already set the parent ID explicitly, in which 499// // may have already set the parent ID explicitly, in which
500 // case we don't have to do it here. 500// // case we don't have to do it here.
501 501//
502 if (folder.ParentID == UUID.Zero || folder.ParentID == context.ID) 502// if (folder.ParentID == UUID.Zero || folder.ParentID == context.ID)
503 { 503// {
504 if (newnode != String.Empty) 504// if (newnode != String.Empty)
505 { 505// {
506 Rest.Log.DebugFormat("{0} Too many resources", MsgId); 506// Rest.Log.DebugFormat("{0} Too many resources", MsgId);
507 rdata.Fail(Rest.HttpStatusCodeBadRequest, "only one root entity is allowed"); 507// rdata.Fail(Rest.HttpStatusCodeBadRequest, "only one root entity is allowed");
508 } 508// }
509 folder.ParentID = context.ID; 509// folder.ParentID = context.ID;
510 newnode = folder.Name; 510// newnode = folder.Name;
511 } 511// }
512 512//
513 // Search the existing inventory for an existing entry. If 513// // Search the existing inventory for an existing entry. If
514 // we have one, we need to decide if it has really changed. 514// // we have one, we need to decide if it has really changed.
515 // It could just be present as (unnecessary) context, and we 515// // It could just be present as (unnecessary) context, and we
516 // don't want to waste time updating the database in that 516// // don't want to waste time updating the database in that
517 // case, OR, it could be being moved from another location 517// // case, OR, it could be being moved from another location
518 // in which case an update is most certainly necessary. 518// // in which case an update is most certainly necessary.
519 519//
520 found = null; 520// found = null;
521 521//
522 foreach (InventoryFolderBase xf in rdata.folders) 522// foreach (InventoryFolderBase xf in rdata.folders)
523 { 523// {
524 // Compare identifying attribute 524// // Compare identifying attribute
525 if (xf.ID == folder.ID) 525// if (xf.ID == folder.ID)
526 { 526// {
527 found = xf; 527// found = xf;
528 break; 528// break;
529 } 529// }
530 } 530// }
531 531//
532 if (found != null && FolderHasChanged(folder,found)) 532// if (found != null && FolderHasChanged(folder,found))
533 { 533// {
534 Rest.Log.DebugFormat("{0} Updating existing folder", MsgId); 534// Rest.Log.DebugFormat("{0} Updating existing folder", MsgId);
535 Rest.InventoryServices.MoveFolder(folder); 535// Rest.InventoryServices.MoveFolder(folder);
536 536//
537 modified = true; 537// modified = true;
538 rdata.appendStatus(String.Format("<p> Created folder {0}, UUID {1} <p>", 538// rdata.appendStatus(String.Format("<p> Created folder {0}, UUID {1} <p>",
539 folder.Name, folder.ID)); 539// folder.Name, folder.ID));
540 } 540// }
541 else 541// else
542 { 542// {
543 Rest.Log.DebugFormat("{0} Adding new folder", MsgId); 543// Rest.Log.DebugFormat("{0} Adding new folder", MsgId);
544 Rest.InventoryServices.AddFolder(folder); 544// Rest.InventoryServices.AddFolder(folder);
545 545//
546 created = true; 546// created = true;
547 rdata.appendStatus(String.Format("<p> Modified folder {0}, UUID {1} <p>", 547// rdata.appendStatus(String.Format("<p> Modified folder {0}, UUID {1} <p>",
548 folder.Name, folder.ID)); 548// folder.Name, folder.ID));
549 } 549// }
550 } 550// }
551 551//
552 // Now we repeat a similar process for the items included 552// // Now we repeat a similar process for the items included
553 // in the entity. 553// // in the entity.
554 554//
555 foreach (InventoryItemBase item in entity.Items) 555// foreach (InventoryItemBase item in entity.Items)
556 { 556// {
557 InventoryItemBase found = null; 557// InventoryItemBase found = null;
558 558//
559 // If the parentID is zero, then this is going 559// // If the parentID is zero, then this is going
560 // directly into the root identified by the URI. 560// // directly into the root identified by the URI.
561 561//
562 if (item.Folder == UUID.Zero) 562// if (item.Folder == UUID.Zero)
563 { 563// {
564 item.Folder = context.ID; 564// item.Folder = context.ID;
565 } 565// }
566 566//
567 // Determine whether this is a new item or a 567// // Determine whether this is a new item or a
568 // replacement definition. 568// // replacement definition.
569 569//
570 foreach (InventoryItemBase xi in rdata.items) 570// foreach (InventoryItemBase xi in rdata.items)
571 { 571// {
572 // Compare identifying attribute 572// // Compare identifying attribute
573 if (xi.ID == item.ID) 573// if (xi.ID == item.ID)
574 { 574// {
575 found = xi; 575// found = xi;
576 break; 576// break;
577 } 577// }
578 } 578// }
579 579//
580 if (found != null && ItemHasChanged(item, found)) 580// if (found != null && ItemHasChanged(item, found))
581 { 581// {
582 Rest.Log.DebugFormat("{0} Updating item {1} {2} {3} {4} {5}", 582// Rest.Log.DebugFormat("{0} Updating item {1} {2} {3} {4} {5}",
583 MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name); 583// MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name);
584 Rest.InventoryServices.UpdateItem(item); 584// Rest.InventoryServices.UpdateItem(item);
585 modified = true; 585// modified = true;
586 rdata.appendStatus(String.Format("<p> Modified item {0}, UUID {1} <p>", item.Name, item.ID)); 586// rdata.appendStatus(String.Format("<p> Modified item {0}, UUID {1} <p>", item.Name, item.ID));
587 } 587// }
588 else 588// else
589 { 589// {
590 Rest.Log.DebugFormat("{0} Adding item {1} {2} {3} {4} {5}", 590// Rest.Log.DebugFormat("{0} Adding item {1} {2} {3} {4} {5}",
591 MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name); 591// MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name);
592 Rest.InventoryServices.AddItem(item); 592// Rest.InventoryServices.AddItem(item);
593 created = true; 593// created = true;
594 rdata.appendStatus(String.Format("<p> Created item {0}, UUID {1} <p>", item.Name, item.ID)); 594// rdata.appendStatus(String.Format("<p> Created item {0}, UUID {1} <p>", item.Name, item.ID));
595 } 595// }
596 } 596// }
597 597//
598 if (created) 598// if (created)
599 { 599// {
600 // Must include a location header with a URI that identifies the new resource. 600// // Must include a location header with a URI that identifies the new resource.
601 rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}/{3}", 601// rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}/{3}",
602 rdata.hostname, rdata.port,rdata.path,newnode)); 602// rdata.hostname, rdata.port,rdata.path,newnode));
603 rdata.Complete(Rest.HttpStatusCodeCreated); 603// rdata.Complete(Rest.HttpStatusCodeCreated);
604 } 604// }
605 else 605// else
606 { 606// {
607 if (modified) 607// if (modified)
608 { 608// {
609 rdata.Complete(Rest.HttpStatusCodeOK); 609// rdata.Complete(Rest.HttpStatusCodeOK);
610 } 610// }
611 else 611// else
612 { 612// {
613 rdata.Complete(Rest.HttpStatusCodeNoContent); 613// rdata.Complete(Rest.HttpStatusCodeNoContent);
614 } 614// }
615 } 615// }
616 616//
617 rdata.Respond(String.Format("Profile {0} : Normal completion", rdata.method)); 617// rdata.Respond(String.Format("Profile {0} : Normal completion", rdata.method));
618 } 618// }
619 else 619// else
620 { 620// {
621 Rest.Log.DebugFormat("{0} {1}: Resource {2} is not a valid context: {3}", 621// Rest.Log.DebugFormat("{0} {1}: Resource {2} is not a valid context: {3}",
622 MsgId, rdata.method, rdata.path, InventoryNode.GetType()); 622// MsgId, rdata.method, rdata.path, InventoryNode.GetType());
623 rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid resource context"); 623// rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid resource context");
624 } 624// }
625 } 625// }
626 626
627 /// <summary> 627 /// <summary>
628 /// PUT updates the URI-identified element in the inventory. This 628 /// PUT updates the URI-identified element in the inventory. This
@@ -646,243 +646,242 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
646 /// during the reconstitution process. 646 /// during the reconstitution process.
647 /// </summary> 647 /// </summary>
648 /// <param name=rdata>HTTP service request work area</param> 648 /// <param name=rdata>HTTP service request work area</param>
649 private void DoUpdate(InventoryRequestData rdata) 649// private void DoUpdate(InventoryRequestData rdata)
650 { 650// {
651 int count = 0; 651// int count = 0;
652 bool created = false; 652// bool created = false;
653 bool modified = false; 653// bool modified = false;
654 654//
655 // Resolve the inventory node that is to be modified. 655// // Resolve the inventory node that is to be modified.
656 // rdata already contains information about the current 656// // rdata already contains information about the current
657 // content of the user's inventory. 657// // content of the user's inventory.
658 658//
659 Object InventoryNode = getInventoryNode(rdata, rdata.root, PARM_PATH, Rest.Fill); 659// Object InventoryNode = getInventoryNode(rdata, rdata.root, PARM_PATH, Rest.Fill);
660 660//
661 // As long as we have a node, then we have something 661// // As long as we have a node, then we have something
662 // meaningful to do, unlike POST. So we reconstitute the 662// // meaningful to do, unlike POST. So we reconstitute the
663 // subtree before doing anything else. Note that we 663// // subtree before doing anything else. Note that we
664 // etiher got a valid node or we threw an exception. 664// // etiher got a valid node or we threw an exception.
665 665//
666 XmlInventoryCollection entity = ReconstituteEntity(rdata); 666// XmlInventoryCollection entity = ReconstituteEntity(rdata);
667 667//
668 // Incorporate any inlined assets first. Any failures 668// // Incorporate any inlined assets first. Any failures
669 // will terminate the request. 669// // will terminate the request.
670 670//
671 if (entity.Assets.Count > 0) 671// if (entity.Assets.Count > 0)
672 { 672// {
673 Rest.Log.DebugFormat("{0} Adding {1} assets to server", 673// Rest.Log.DebugFormat("{0} Adding {1} assets to server",
674 MsgId, entity.Assets.Count); 674// MsgId, entity.Assets.Count);
675 675//
676 foreach (AssetBase asset in entity.Assets) 676// foreach (AssetBase asset in entity.Assets)
677 { 677// {
678 Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", 678// Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}",
679 MsgId, asset.ID, asset.Type, asset.Name); 679// MsgId, asset.ID, asset.Type, asset.Name);
680 680//
681 // The asset was validated during the collection process 681// // The asset was validated during the collection process
682 682//
683 Rest.AssetServices.Store(asset); 683// Rest.AssetServices.Store(asset);
684 684//
685 created = true; 685// created = true;
686 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.ID)); 686// rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.ID));
687 687//
688 if (Rest.DEBUG && Rest.DumpAsset) 688// if (Rest.DEBUG && Rest.DumpAsset)
689 { 689// {
690 Rest.Dump(asset.Data); 690// Rest.Dump(asset.Data);
691 } 691// }
692 } 692// }
693 } 693// }
694 694//
695 // The URI specifies either a folder or an item to be updated. 695// // The URI specifies either a folder or an item to be updated.
696 // 696// //
697 // The root node in the entity will replace the node identified 697// // The root node in the entity will replace the node identified
698 // by the URI. This means the parent will remain the same, but 698// // by the URI. This means the parent will remain the same, but
699 // any or all attributes associated with the named element 699// // any or all attributes associated with the named element
700 // will change. 700// // will change.
701 // 701// //
702 // If the inventory collection contains an element with a zero 702// // If the inventory collection contains an element with a zero
703 // parent ID, then this is taken to be the replacement for the 703// // parent ID, then this is taken to be the replacement for the
704 // named node. The collection MAY also specify an explicit 704// // named node. The collection MAY also specify an explicit
705 // parent ID, in this case it MAY identify the same parent as 705// // parent ID, in this case it MAY identify the same parent as
706 // the current node, or it MAY specify a different parent, 706// // the current node, or it MAY specify a different parent,
707 // indicating that the folder is being moved in addition to any 707// // indicating that the folder is being moved in addition to any
708 // other modifications being made. 708// // other modifications being made.
709 709//
710 if (typeof(InventoryFolderBase) == InventoryNode.GetType() || 710// if (typeof(InventoryFolderBase) == InventoryNode.GetType() ||
711 typeof(InventoryFolderImpl) == InventoryNode.GetType()) 711// typeof(InventoryFolderImpl) == InventoryNode.GetType())
712 { 712// {
713 bool rfound = false; 713// bool rfound = false;
714 InventoryFolderBase uri = (InventoryFolderBase) InventoryNode; 714// InventoryFolderBase uri = (InventoryFolderBase) InventoryNode;
715 InventoryFolderBase xml = null; 715// InventoryFolderBase xml = null;
716 716//
717 // If the entity to be replaced resolved to be the root 717// // If the entity to be replaced resolved to be the root
718 // directory itself (My Inventory), then make sure that 718// // directory itself (My Inventory), then make sure that
719 // the supplied data include as appropriately typed and 719// // the supplied data include as appropriately typed and
720 // named folder. Note that we can;t rule out the possibility 720// // named folder. Note that we can;t rule out the possibility
721 // of a sub-directory being called "My Inventory", so that 721// // of a sub-directory being called "My Inventory", so that
722 // is anticipated. 722// // is anticipated.
723 723//
724 if (uri == rdata.root) 724// if (uri == rdata.root)
725 { 725// {
726 foreach (InventoryFolderBase folder in entity.Folders) 726// foreach (InventoryFolderBase folder in entity.Folders)
727 { 727// {
728 if ((rfound = (folder.Name == PRIVATE_ROOT_NAME))) 728// if ((rfound = (folder.Name == PRIVATE_ROOT_NAME)))
729 { 729// {
730 if ((rfound = (folder.ParentID == UUID.Zero))) 730// if ((rfound = (folder.ParentID == UUID.Zero)))
731 break; 731// break;
732 } 732// }
733 } 733// }
734 734//
735 if (!rfound) 735// if (!rfound)
736 { 736// {
737 Rest.Log.DebugFormat("{0} {1}: Path <{2}> will result in loss of inventory", 737// Rest.Log.DebugFormat("{0} {1}: Path <{2}> will result in loss of inventory",
738 MsgId, rdata.method, rdata.path); 738// MsgId, rdata.method, rdata.path);
739 rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid inventory structure"); 739// rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid inventory structure");
740 } 740// }
741 } 741// }
742 742//
743 // Scan the set of folders in the entity collection for an 743// // Scan the set of folders in the entity collection for an
744 // entry that matches the context folder. It is assumed that 744// // entry that matches the context folder. It is assumed that
745 // the only reliable indicator of this is a zero UUID (using 745// // the only reliable indicator of this is a zero UUID (using
746 // implicit context), or the parent's UUID matches that of the 746// // implicit context), or the parent's UUID matches that of the
747 // URI designated node (explicit context). We don't allow 747// // URI designated node (explicit context). We don't allow
748 // ambiguity in this case because this is POST and we are 748// // ambiguity in this case because this is POST and we are
749 // supposed to be modifying a specific node. 749// // supposed to be modifying a specific node.
750 // We assign any element IDs required as an economy; we don't 750// // We assign any element IDs required as an economy; we don't
751 // want to iterate over the fodler set again if it can be 751// // want to iterate over the fodler set again if it can be
752 // helped. 752// // helped.
753 753//
754 foreach (InventoryFolderBase folder in entity.Folders) 754// foreach (InventoryFolderBase folder in entity.Folders)
755 { 755// {
756 if (folder.ParentID == uri.ParentID || 756// if (folder.ParentID == uri.ParentID ||
757 folder.ParentID == UUID.Zero) 757// folder.ParentID == UUID.Zero)
758 { 758// {
759 folder.ParentID = uri.ParentID; 759// folder.ParentID = uri.ParentID;
760 xml = folder; 760// xml = folder;
761 count++; 761// count++;
762 } 762// }
763 } 763// }
764 764//
765 // More than one entry is ambiguous. Other folders should be 765// // More than one entry is ambiguous. Other folders should be
766 // added using the POST verb. 766// // added using the POST verb.
767 767//
768 if (count > 1) 768// if (count > 1)
769 { 769// {
770 Rest.Log.DebugFormat("{0} {1}: Request for <{2}> is ambiguous", 770// Rest.Log.DebugFormat("{0} {1}: Request for <{2}> is ambiguous",
771 MsgId, rdata.method, rdata.path); 771// MsgId, rdata.method, rdata.path);
772 rdata.Fail(Rest.HttpStatusCodeConflict, "context is ambiguous"); 772// rdata.Fail(Rest.HttpStatusCodeConflict, "context is ambiguous");
773 } 773// }
774 774//
775 // Exactly one entry means we ARE replacing the node 775// // Exactly one entry means we ARE replacing the node
776 // identified by the URI. So we delete the old folder 776// // identified by the URI. So we delete the old folder
777 // by moving it to the trash and then purging it. 777// // by moving it to the trash and then purging it.
778 // We then add all of the folders and items we 778// // We then add all of the folders and items we
779 // included in the entity. The subtree has been 779// // included in the entity. The subtree has been
780 // modified. 780// // modified.
781 781//
782 if (count == 1) 782// if (count == 1)
783 { 783// {
784 InventoryFolderBase TrashCan = GetTrashCan(rdata); 784// InventoryFolderBase TrashCan = GetTrashCan(rdata);
785 785//
786 // All went well, so we generate a UUID is one is 786// // All went well, so we generate a UUID is one is
787 // needed. 787// // needed.
788 788//
789 if (xml.ID == UUID.Zero) 789// if (xml.ID == UUID.Zero)
790 { 790// {
791 xml.ID = UUID.Random(); 791// xml.ID = UUID.Random();
792 } 792// }
793 793//
794 uri.ParentID = TrashCan.ID; 794// uri.ParentID = TrashCan.ID;
795 Rest.InventoryServices.MoveFolder(uri); 795// Rest.InventoryServices.MoveFolder(uri);
796 Rest.InventoryServices.PurgeFolder(TrashCan); 796// Rest.InventoryServices.PurgeFolder(TrashCan);
797 modified = true; 797// modified = true;
798 } 798// }
799 799//
800 // Now, regardelss of what they represent, we 800// // Now, regardelss of what they represent, we
801 // integrate all of the elements in the entity. 801// // integrate all of the elements in the entity.
802 802//
803 foreach (InventoryFolderBase f in entity.Folders) 803// foreach (InventoryFolderBase f in entity.Folders)
804 { 804// {
805 rdata.appendStatus(String.Format("<p>Moving folder {0} UUID {1} <p>", f.Name, f.ID)); 805// rdata.appendStatus(String.Format("<p>Moving folder {0} UUID {1} <p>", f.Name, f.ID));
806 Rest.InventoryServices.MoveFolder(f); 806// Rest.InventoryServices.MoveFolder(f);
807 } 807// }
808 808//
809 foreach (InventoryItemBase it in entity.Items) 809// foreach (InventoryItemBase it in entity.Items)
810 { 810// {
811 rdata.appendStatus(String.Format("<p>Storing item {0} UUID {1} <p>", it.Name, it.ID)); 811// rdata.appendStatus(String.Format("<p>Storing item {0} UUID {1} <p>", it.Name, it.ID));
812 Rest.InventoryServices.AddItem(it); 812// Rest.InventoryServices.AddItem(it);
813 } 813// }
814 } 814// }
815 815//
816 /// <summary> 816// /// <summary>
817 /// URI specifies an item to be updated 817// /// URI specifies an item to be updated
818 /// </summary> 818// /// </summary>
819 /// <remarks> 819// /// <remarks>
820 /// The entity must contain a single item node to be 820// /// The entity must contain a single item node to be
821 /// updated. ID and Folder ID must be correct. 821// /// updated. ID and Folder ID must be correct.
822 /// </remarks> 822// /// </remarks>
823 823//
824 else 824// else
825 { 825// {
826 InventoryItemBase uri = (InventoryItemBase) InventoryNode; 826// InventoryItemBase uri = (InventoryItemBase) InventoryNode;
827 InventoryItemBase xml = null; 827// InventoryItemBase xml = null;
828 828//
829 if (entity.Folders.Count != 0) 829// if (entity.Folders.Count != 0)
830 { 830// {
831 Rest.Log.DebugFormat("{0} {1}: Request should not contain any folders <{2}>", 831// Rest.Log.DebugFormat("{0} {1}: Request should not contain any folders <{2}>",
832 MsgId, rdata.method, rdata.path); 832// MsgId, rdata.method, rdata.path);
833 rdata.Fail(Rest.HttpStatusCodeBadRequest, "folder is not allowed"); 833// rdata.Fail(Rest.HttpStatusCodeBadRequest, "folder is not allowed");
834 } 834// }
835 835//
836 if (entity.Items.Count > 1) 836// if (entity.Items.Count > 1)
837 { 837// {
838 Rest.Log.DebugFormat("{0} {1}: Entity contains too many items <{2}>", 838// Rest.Log.DebugFormat("{0} {1}: Entity contains too many items <{2}>",
839 MsgId, rdata.method, rdata.path); 839// MsgId, rdata.method, rdata.path);
840 rdata.Fail(Rest.HttpStatusCodeBadRequest, "too may items"); 840// rdata.Fail(Rest.HttpStatusCodeBadRequest, "too may items");
841 } 841// }
842 842//
843 xml = entity.Items[0]; 843// xml = entity.Items[0];
844 844//
845 if (xml.ID == UUID.Zero) 845// if (xml.ID == UUID.Zero)
846 { 846// {
847 xml.ID = UUID.Random(); 847// xml.ID = UUID.Random();
848 } 848// }
849 849//
850 // If the folder reference has changed, then this item is 850// // If the folder reference has changed, then this item is
851 // being moved. Otherwise we'll just delete the old, and 851// // being moved. Otherwise we'll just delete the old, and
852 // add in the new. 852// // add in the new.
853 853//
854 // Delete the old item 854// // Delete the old item
855 855//
856 List<UUID> uuids = new List<UUID>(); 856// List<UUID> uuids = new List<UUID>();
857 uuids.Add(uri.ID); 857// uuids.Add(uri.ID);
858 Rest.InventoryServices.DeleteItems(uri.Owner, uuids); 858// Rest.InventoryServices.DeleteItems(uri.Owner, uuids);
859 859//
860 // Add the new item to the inventory 860// // Add the new item to the inventory
861 861//
862 Rest.InventoryServices.AddItem(xml); 862// Rest.InventoryServices.AddItem(xml);
863 863//
864 rdata.appendStatus(String.Format("<p>Storing item {0} UUID {1} <p>", xml.Name, xml.ID)); 864// rdata.appendStatus(String.Format("<p>Storing item {0} UUID {1} <p>", xml.Name, xml.ID));
865 } 865// }
866 866//
867 if (created) 867// if (created)
868 { 868// {
869 rdata.Complete(Rest.HttpStatusCodeCreated); 869// rdata.Complete(Rest.HttpStatusCodeCreated);
870 } 870// }
871 else 871// else
872 { 872// {
873 if (modified) 873// if (modified)
874 { 874// {
875 rdata.Complete(Rest.HttpStatusCodeOK); 875// rdata.Complete(Rest.HttpStatusCodeOK);
876 } 876// }
877 else 877// else
878 { 878// {
879 rdata.Complete(Rest.HttpStatusCodeNoContent); 879// rdata.Complete(Rest.HttpStatusCodeNoContent);
880 } 880// }
881 } 881// }
882 882//
883 rdata.Respond(String.Format("Profile {0} : Normal completion", rdata.method)); 883// rdata.Respond(String.Format("Profile {0} : Normal completion", rdata.method));
884 884// }
885 }
886 885
887 /// <summary> 886 /// <summary>
888 /// Arguably the most damaging REST interface. It deletes the inventory 887 /// Arguably the most damaging REST interface. It deletes the inventory
@@ -904,42 +903,41 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
904 /// elements. 903 /// elements.
905 /// </summary> 904 /// </summary>
906 /// <param name=rdata>HTTP service request work area</param> 905 /// <param name=rdata>HTTP service request work area</param>
907 906// private void DoDelete(InventoryRequestData rdata)
908 private void DoDelete(InventoryRequestData rdata) 907// {
909 { 908// Object InventoryNode = getInventoryNode(rdata, rdata.root, PARM_PATH, false);
910 Object InventoryNode = getInventoryNode(rdata, rdata.root, PARM_PATH, false); 909//
911 910// if (typeof(InventoryFolderBase) == InventoryNode.GetType() ||
912 if (typeof(InventoryFolderBase) == InventoryNode.GetType() || 911// typeof(InventoryFolderImpl) == InventoryNode.GetType())
913 typeof(InventoryFolderImpl) == InventoryNode.GetType()) 912// {
914 { 913// InventoryFolderBase TrashCan = GetTrashCan(rdata);
915 InventoryFolderBase TrashCan = GetTrashCan(rdata); 914//
916 915// InventoryFolderBase folder = (InventoryFolderBase) InventoryNode;
917 InventoryFolderBase folder = (InventoryFolderBase) InventoryNode; 916// Rest.Log.DebugFormat("{0} {1}: Folder {2} will be deleted",
918 Rest.Log.DebugFormat("{0} {1}: Folder {2} will be deleted", 917// MsgId, rdata.method, rdata.path);
919 MsgId, rdata.method, rdata.path); 918// folder.ParentID = TrashCan.ID;
920 folder.ParentID = TrashCan.ID; 919// Rest.InventoryServices.MoveFolder(folder);
921 Rest.InventoryServices.MoveFolder(folder); 920// Rest.InventoryServices.PurgeFolder(TrashCan);
922 Rest.InventoryServices.PurgeFolder(TrashCan); 921//
923 922// rdata.appendStatus(String.Format("<p>Deleted folder {0} UUID {1} <p>", folder.Name, folder.ID));
924 rdata.appendStatus(String.Format("<p>Deleted folder {0} UUID {1} <p>", folder.Name, folder.ID)); 923// }
925 } 924//
926 925// // Deleting items is much more straight forward.
927 // Deleting items is much more straight forward. 926//
928 927// else
929 else 928// {
930 { 929// InventoryItemBase item = (InventoryItemBase) InventoryNode;
931 InventoryItemBase item = (InventoryItemBase) InventoryNode; 930// Rest.Log.DebugFormat("{0} {1}: Item {2} will be deleted",
932 Rest.Log.DebugFormat("{0} {1}: Item {2} will be deleted", 931// MsgId, rdata.method, rdata.path);
933 MsgId, rdata.method, rdata.path); 932// List<UUID> uuids = new List<UUID>();
934 List<UUID> uuids = new List<UUID>(); 933// uuids.Add(item.ID);
935 uuids.Add(item.ID); 934// Rest.InventoryServices.DeleteItems(item.Owner, uuids);
936 Rest.InventoryServices.DeleteItems(item.Owner, uuids); 935// rdata.appendStatus(String.Format("<p>Deleted item {0} UUID {1} <p>", item.Name, item.ID));
937 rdata.appendStatus(String.Format("<p>Deleted item {0} UUID {1} <p>", item.Name, item.ID)); 936// }
938 } 937//
939 938// rdata.Complete();
940 rdata.Complete(); 939// rdata.Respond(String.Format("Profile {0} : Normal completion", rdata.method));
941 rdata.Respond(String.Format("Profile {0} : Normal completion", rdata.method)); 940// }
942 }
943 941
944#endregion method-specific processing 942#endregion method-specific processing
945 943
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index 66f483c..b17dbc0 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -141,7 +141,17 @@ namespace OpenSim.Framework.Console
141 CommandInfo commandInfo = (CommandInfo)dict[String.Empty]; 141 CommandInfo commandInfo = (CommandInfo)dict[String.Empty];
142 help.Add(commandInfo.help_text); 142 help.Add(commandInfo.help_text);
143 help.Add(commandInfo.long_help); 143 help.Add(commandInfo.long_help);
144
145 string descriptiveHelp = commandInfo.descriptive_help;
146
147 // If we do have some descriptive help then insert a spacing line before and after for readability.
148 if (descriptiveHelp != string.Empty)
149 help.Add(string.Empty);
150
144 help.Add(commandInfo.descriptive_help); 151 help.Add(commandInfo.descriptive_help);
152
153 if (descriptiveHelp != string.Empty)
154 help.Add(string.Empty);
145 } 155 }
146 else 156 else
147 { 157 {
@@ -182,8 +192,7 @@ namespace OpenSim.Framework.Console
182 public void AddCommand(string module, bool shared, string command, 192 public void AddCommand(string module, bool shared, string command,
183 string help, string longhelp, CommandDelegate fn) 193 string help, string longhelp, CommandDelegate fn)
184 { 194 {
185 AddCommand(module, shared, command, help, longhelp, 195 AddCommand(module, shared, command, help, longhelp, String.Empty, fn);
186 String.Empty, fn);
187 } 196 }
188 197
189 /// <summary> 198 /// <summary>
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 655df9d..f0f8d01 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -286,7 +286,11 @@ namespace OpenSim.Framework.Servers
286 286
287 EnhanceVersionInformation(); 287 EnhanceVersionInformation();
288 288
289 m_log.Info("[STARTUP]: Version: " + m_version + "\n"); 289 m_log.Info("[STARTUP]: OpenSimulator version: " + m_version + Environment.NewLine);
290 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
291 // the clr version number doesn't match the project version number under Mono.
292 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
293 m_log.Info("[STARTUP]: Operating system version: " + Environment.OSVersion + Environment.NewLine);
290 294
291 StartupSpecific(); 295 StartupSpecific();
292 296
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 1395030..a09b903 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -251,14 +251,20 @@ namespace OpenSim
251 "Save named prim to XML2", SavePrimsXml2); 251 "Save named prim to XML2", SavePrimsXml2);
252 252
253 m_console.Commands.AddCommand("region", false, "load oar", 253 m_console.Commands.AddCommand("region", false, "load oar",
254 "load oar [--merge] [--skip-assets] <oar name>", 254 "load oar [--merge] [--skip-assets] [<OAR path>]",
255 "Load a region's data from OAR archive. --merge will merge the oar with the existing scene. --skip-assets will load the oar but ignore the assets it contains", 255 "Load a region's data from an OAR archive.",
256 "--merge will merge the OAR with the existing scene." + Environment.NewLine
257 + "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine
258 + "The path can be either a filesystem location or a URI."
259 + " If this is not given then the command looks for an OAR named region.oar in the current directory.",
256 LoadOar); 260 LoadOar);
257 261
258 m_console.Commands.AddCommand("region", false, "save oar", 262 m_console.Commands.AddCommand("region", false, "save oar",
259 "save oar <oar name>", 263 "save oar [<OAR path>]",
260 "Save a region's data to an OAR archive", 264 "Save a region's data to an OAR archive.",
261 "More information on forthcoming options here soon", SaveOar); 265 "The OAR path must be a filesystem path."
266 + " If this is not given then the oar is saved to region.oar in the current directory.",
267 SaveOar);
262 268
263 m_console.Commands.AddCommand("region", false, "edit scale", 269 m_console.Commands.AddCommand("region", false, "edit scale",
264 "edit scale <name> <x> <y> <z>", 270 "edit scale <name> <x> <y> <z>",
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index dc7439c..806aa4f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -37,7 +37,6 @@ using log4net;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
40
41using OpenSim.Framework.Communications.Osp; 40using OpenSim.Framework.Communications.Osp;
42using OpenSim.Framework.Serialization; 41using OpenSim.Framework.Serialization;
43using OpenSim.Framework.Serialization.External; 42using OpenSim.Framework.Serialization.External;
@@ -72,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
72 scene, 71 scene,
73 userInfo, 72 userInfo,
74 invPath, 73 invPath,
75 new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress)) 74 new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress))
76 { 75 {
77 } 76 }
78 77
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index cfe3caa..8f3f65b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -37,7 +37,6 @@ using OpenSim.Framework;
37using OpenSim.Framework.Serialization; 37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
40
41using OpenSim.Framework.Communications.Osp; 40using OpenSim.Framework.Communications.Osp;
42using OpenSim.Region.CoreModules.World.Archiver; 41using OpenSim.Region.CoreModules.World.Archiver;
43using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index f570999..307db97 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -91,13 +91,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
91 91
92 scene.AddCommand( 92 scene.AddCommand(
93 this, "load iar", 93 this, "load iar",
94 "load iar <first> <last> <inventory path> <password> [<archive path>]", 94 "load iar <first> <last> <inventory path> <password> [<IAR path>]",
95 "Load user inventory archive.", HandleLoadInvConsoleCommand); 95 "Load user inventory archive (IAR).",
96 "<first> is user's first name." + Environment.NewLine
97 + "<last> is user's last name." + Environment.NewLine
98 + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
99 + "<password> is the user's password." + Environment.NewLine
100 + "<IAR path> is the filesystem path or URI from which to load the IAR."
101 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
102 HandleLoadInvConsoleCommand);
96 103
97 scene.AddCommand( 104 scene.AddCommand(
98 this, "save iar", 105 this, "save iar",
99 "save iar <first> <last> <inventory path> <password> [<archive path>]", 106 "save iar <first> <last> <inventory path> <password> [<IAR path>]",
100 "Save user inventory archive.", HandleSaveInvConsoleCommand); 107 "Save user inventory archive (IAR).",
108 "<first> is the user's first name." + Environment.NewLine
109 + "<last> is the user's last name." + Environment.NewLine
110 + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
111 + "<IAR path> is the filesystem path at which to save the IAR."
112 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
113 HandleSaveInvConsoleCommand);
101 114
102 m_aScene = scene; 115 m_aScene = scene;
103 } 116 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 9c95e78..c81f295 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -38,7 +38,6 @@ using OpenSim.Framework;
38using OpenSim.Framework.Serialization; 38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External; 39using OpenSim.Framework.Serialization.External;
40using OpenSim.Framework.Communications; 40using OpenSim.Framework.Communications;
41
42using OpenSim.Framework.Communications.Osp; 41using OpenSim.Framework.Communications.Osp;
43using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 42using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
44using OpenSim.Region.CoreModules.World.Serialiser; 43using OpenSim.Region.CoreModules.World.Serialiser;
@@ -77,125 +76,118 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
77 // Commenting for now! The mock inventory service needs more beef, at least for 76 // Commenting for now! The mock inventory service needs more beef, at least for
78 // GetFolderForType 77 // GetFolderForType
79 // REFACTORING PROBLEM. This needs to be rewritten. 78 // REFACTORING PROBLEM. This needs to be rewritten.
79 //[Test]
80 public void TestSaveIarV0_1()
81 {
82 TestHelper.InMethod();
83 log4net.Config.XmlConfigurator.Configure();
80 84
81// [Test] 85 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
82// public void TestSaveIarV0_1()
83// {
84// TestHelper.InMethod();
85// //log4net.Config.XmlConfigurator.Configure();
86
87// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
88
89// Scene scene = SceneSetupHelpers.SetupScene("Inventory");
90// SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
91// CommunicationsManager cm = scene.CommsManager;
92 86
93// // Create user 87 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
94// string userFirstName = "Jock"; 88 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
95// string userLastName = "Stirrup";
96// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
97 89
98// lock (this) 90 // Create user
99// { 91 string userFirstName = "Jock";
100// UserProfileTestUtils.CreateUserWithInventory( 92 string userLastName = "Stirrup";
101// cm, userFirstName, userLastName, userId, InventoryReceived); 93 string userPassword = "troll";
102// Monitor.Wait(this, 60000); 94 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
103// } 95 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
104 96
105// // Create asset 97 // Create asset
106// SceneObjectGroup object1; 98 SceneObjectGroup object1;
107// SceneObjectPart part1; 99 SceneObjectPart part1;
108// { 100 {
109// string partName = "My Little Dog Object"; 101 string partName = "My Little Dog Object";
110// UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); 102 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
111// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); 103 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
112// Vector3 groupPosition = new Vector3(10, 20, 30); 104 Vector3 groupPosition = new Vector3(10, 20, 30);
113// Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); 105 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
114// Vector3 offsetPosition = new Vector3(5, 10, 15); 106 Vector3 offsetPosition = new Vector3(5, 10, 15);
115 107
116// part1 108 part1
117// = new SceneObjectPart( 109 = new SceneObjectPart(
118// ownerId, shape, groupPosition, rotationOffset, offsetPosition); 110 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
119// part1.Name = partName; 111 part1.Name = partName;
120 112
121// object1 = new SceneObjectGroup(part1); 113 object1 = new SceneObjectGroup(part1);
122// scene.AddNewSceneObject(object1, false); 114 scene.AddNewSceneObject(object1, false);
123// } 115 }
124
125// UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
126// AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
127// scene.AssetService.Store(asset1);
128
129// // Create item
130// UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
131// InventoryItemBase item1 = new InventoryItemBase();
132// item1.Name = "My Little Dog";
133// item1.AssetID = asset1.FullID;
134// item1.ID = item1Id;
135// InventoryFolderBase objsFolder
136// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
137// item1.Folder = objsFolder.ID;
138// scene.AddInventoryItem(userId, item1);
139
140// MemoryStream archiveWriteStream = new MemoryStream();
141// archiverModule.OnInventoryArchiveSaved += SaveCompleted;
142
143// mre.Reset();
144// archiverModule.ArchiveInventory(
145// Guid.NewGuid(), userFirstName, userLastName, "Objects", "troll", archiveWriteStream);
146// mre.WaitOne(60000, false);
147
148// byte[] archive = archiveWriteStream.ToArray();
149// MemoryStream archiveReadStream = new MemoryStream(archive);
150// TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
151
152// //bool gotControlFile = false;
153// bool gotObject1File = false;
154// //bool gotObject2File = false;
155// string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
156// string expectedObject1FilePath = string.Format(
157// "{0}{1}{2}",
158// ArchiveConstants.INVENTORY_PATH,
159// InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
160// expectedObject1FileName);
161 116
162// string filePath; 117 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
163// TarArchiveReader.TarEntryType tarEntryType; 118 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
119 scene.AssetService.Store(asset1);
120
121 // Create item
122 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
123 InventoryItemBase item1 = new InventoryItemBase();
124 item1.Name = "My Little Dog";
125 item1.AssetID = asset1.FullID;
126 item1.ID = item1Id;
127 InventoryFolderBase objsFolder
128 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
129 item1.Folder = objsFolder.ID;
130 scene.AddInventoryItem(userId, item1);
131
132 MemoryStream archiveWriteStream = new MemoryStream();
133 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
134
135 mre.Reset();
136 archiverModule.ArchiveInventory(
137 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
138 mre.WaitOne(60000, false);
139
140 byte[] archive = archiveWriteStream.ToArray();
141 MemoryStream archiveReadStream = new MemoryStream(archive);
142 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
143
144 //bool gotControlFile = false;
145 bool gotObject1File = false;
146 //bool gotObject2File = false;
147 string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
148 string expectedObject1FilePath = string.Format(
149 "{0}{1}{2}",
150 ArchiveConstants.INVENTORY_PATH,
151 InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
152 expectedObject1FileName);
153
154 string filePath;
155 TarArchiveReader.TarEntryType tarEntryType;
164 156
165// Console.WriteLine("Reading archive"); 157// Console.WriteLine("Reading archive");
166 158
167// while (tar.ReadEntry(out filePath, out tarEntryType) != null) 159 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
168// { 160 {
169// Console.WriteLine("Got {0}", filePath); 161 Console.WriteLine("Got {0}", filePath);
170 162
171//// if (ArchiveConstants.CONTROL_FILE_PATH == filePath) 163// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
172//// {
173//// gotControlFile = true;
174//// }
175
176// if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
177// { 164// {
178//// string fileName = filePath.Remove(0, "Objects/".Length); 165// gotControlFile = true;
179////
180//// if (fileName.StartsWith(part1.Name))
181//// {
182// Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
183// gotObject1File = true;
184//// }
185//// else if (fileName.StartsWith(part2.Name))
186//// {
187//// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
188//// gotObject2File = true;
189//// }
190// } 166// }
191// } 167
168 if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
169 {
170// string fileName = filePath.Remove(0, "Objects/".Length);
171//
172// if (fileName.StartsWith(part1.Name))
173// {
174 Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
175 gotObject1File = true;
176// }
177// else if (fileName.StartsWith(part2.Name))
178// {
179// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
180// gotObject2File = true;
181// }
182 }
183 }
192 184
193//// Assert.That(gotControlFile, Is.True, "No control file in archive"); 185// Assert.That(gotControlFile, Is.True, "No control file in archive");
194// Assert.That(gotObject1File, Is.True, "No item1 file in archive"); 186 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
195//// Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 187// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
196 188
197// // TODO: Test presence of more files and contents of files. 189 // TODO: Test presence of more files and contents of files.
198// } 190 }
199 191
200 /// <summary> 192 /// <summary>
201 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 193 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
@@ -541,56 +533,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
541 /// <summary> 533 /// <summary>
542 /// Test replication of an archive path to the user's inventory. 534 /// Test replication of an archive path to the user's inventory.
543 /// </summary> 535 /// </summary>
544 //[Test] 536 [Test]
545 //public void TestReplicateArchivePathToUserInventory() 537 public void TestReplicateArchivePathToUserInventory()
546 //{ 538 {
547 // TestHelper.InMethod(); 539 TestHelper.InMethod();
548 540 //log4net.Config.XmlConfigurator.Configure();
549 // //log4net.Config.XmlConfigurator.Configure(); 541
550 542 Scene scene = SceneSetupHelpers.SetupScene("inventory");
551 // Scene scene = SceneSetupHelpers.SetupScene("inventory"); 543 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
552 // CommunicationsManager commsManager = scene.CommsManager; 544
553 // CachedUserInfo userInfo; 545 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
554 546 List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
555 // lock (this) 547
556 // { 548 string folder1Name = "a";
557 // // !!! REFACTORING PROBLEM. This needs to be rewritten 549 string folder2Name = "b";
558 // userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); 550 string itemName = "c.lsl";
559 // Monitor.Wait(this, 60000); 551
560 // } 552 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
561 553 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
562 // //Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); 554 string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
563 555
564 // Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); 556 string itemArchivePath
565 // List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); 557 = string.Format(
566 558 "{0}{1}{2}{3}",
567 // string folder1Name = "a"; 559 ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
568 // string folder2Name = "b"; 560
569 // string itemName = "c.lsl"; 561 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
570 562 .ReplicateArchivePathToUserInventory(
571 // string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); 563 itemArchivePath, false, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
572 // string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); 564 foldersCreated, nodesLoaded);
573 // string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); 565
574 566 InventoryFolderBase folder1
575 // string itemArchivePath 567 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "a");
576 // = string.Format( 568 Assert.That(folder1, Is.Not.Null, "Could not find folder a");
577 // "{0}{1}{2}{3}", 569 InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
578 // ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName); 570 Assert.That(folder2, Is.Not.Null, "Could not find folder b");
579 571 }
580 // //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
581
582 // new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null)
583 // .ReplicateArchivePathToUserInventory(
584 // itemArchivePath, false, scene.InventoryService.GetRootFolder(userInfo.UserProfile.ID),
585 // foldersCreated, nodesLoaded);
586
587 // //Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder);
588 // //InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");
589 // InventoryFolderBase folder1
590 // = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userInfo.UserProfile.ID, "a");
591 // Assert.That(folder1, Is.Not.Null, "Could not find folder a");
592 // InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
593 // Assert.That(folder2, Is.Not.Null, "Could not find folder b");
594 //}
595 } 572 }
596} 573} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
index 880bd7c..ddc3dd7 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
@@ -25,6 +25,9 @@
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
28using System;
29using System.IO;
30using System.Net;
28using OpenMetaverse; 31using OpenMetaverse;
29using OpenSim.Framework.Serialization; 32using OpenSim.Framework.Serialization;
30using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
@@ -60,5 +63,66 @@ namespace OpenSim.Region.CoreModules.World.Archiver
60 { 63 {
61 return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); 64 return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
62 } 65 }
66
67 /// <summary>
68 /// Resolve path to a working FileStream
69 /// </summary>
70 /// <param name="path"></param>
71 /// <returns></returns>
72 public static Stream GetStream(string path)
73 {
74 if (File.Exists(path))
75 {
76 return new FileStream(path, FileMode.Open, FileAccess.Read);
77 }
78 else
79 {
80 try
81 {
82 Uri uri = new Uri(path);
83 if (uri.Scheme == "file")
84 {
85 return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read);
86 }
87 else
88 {
89 if (uri.Scheme != "http")
90 throw new Exception(String.Format("Unsupported URI scheme ({0})", path));
91
92 // OK, now we know we have an HTTP URI to work with
93 return URIFetch(uri);
94 }
95 }
96 catch (UriFormatException)
97 {
98 // In many cases the user will put in a plain old filename that cannot be found so assume that
99 // this is the problem rather than confusing the issue with a UriFormatException
100 throw new Exception(String.Format("Cannot find file {0}", path));
101 }
102 }
103 }
104
105 public static Stream URIFetch(Uri uri)
106 {
107 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
108
109 // request.Credentials = credentials;
110
111 request.ContentLength = 0;
112 request.KeepAlive = false;
113
114 WebResponse response = request.GetResponse();
115 Stream file = response.GetResponseStream();
116
117 // justincc: gonna ignore the content type for now and just try anything
118 //if (response.ContentType != "application/x-oar")
119 // throw new Exception(String.Format("{0} does not identify an OAR file", uri.ToString()));
120
121 if (response.ContentLength == 0)
122 throw new Exception(String.Format("{0} returned an empty file", uri.ToString()));
123
124 // return new BufferedStream(file, (int) response.ContentLength);
125 return new BufferedStream(file, 1000000);
126 }
63 } 127 }
64} \ No newline at end of file 128} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 9c8193a..57b7672 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
78 78
79 try 79 try
80 { 80 {
81 m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); 81 m_loadStream = new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress);
82 } 82 }
83 catch (EntryPointNotFoundException e) 83 catch (EntryPointNotFoundException e)
84 { 84 {
@@ -473,68 +473,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
473 } 473 }
474 474
475 /// <summary> 475 /// <summary>
476 /// Resolve path to a working FileStream
477 /// </summary>
478 /// <param name="path"></param>
479 /// <returns></returns>
480 private Stream GetStream(string path)
481 {
482 if (File.Exists(path))
483 {
484 return new FileStream(path, FileMode.Open, FileAccess.Read);
485 }
486 else
487 {
488 try
489 {
490 Uri uri = new Uri(path);
491 if (uri.Scheme == "file")
492 {
493 return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read);
494 }
495 else
496 {
497 if (uri.Scheme != "http")
498 throw new Exception(String.Format("Unsupported URI scheme ({0})", path));
499
500 // OK, now we know we have an HTTP URI to work with
501
502 return URIFetch(uri);
503 }
504 }
505 catch (UriFormatException)
506 {
507 // In many cases the user will put in a plain old filename that cannot be found so assume that
508 // this is the problem rather than confusing the issue with a UriFormatException
509 throw new Exception(String.Format("Cannot find file {0}", path));
510 }
511 }
512 }
513
514 private static Stream URIFetch(Uri uri)
515 {
516 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
517
518 // request.Credentials = credentials;
519
520 request.ContentLength = 0;
521 request.KeepAlive = false;
522
523 WebResponse response = request.GetResponse();
524 Stream file = response.GetResponseStream();
525
526 // justincc: gonna ignore the content type for now and just try anything
527 //if (response.ContentType != "application/x-oar")
528 // throw new Exception(String.Format("{0} does not identify an OAR file", uri.ToString()));
529
530 if (response.ContentLength == 0)
531 throw new Exception(String.Format("{0} returned an empty file", uri.ToString()));
532
533 // return new BufferedStream(file, (int) response.ContentLength);
534 return new BufferedStream(file, 1000000);
535 }
536
537 /// <summary>
538 /// Load oar control file 476 /// Load oar control file
539 /// </summary> 477 /// </summary>
540 /// <param name="path"></param> 478 /// <param name="path"></param>
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index ac6a633..c6fb18d 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1014,7 +1014,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1014 1014
1015 int lastMapRefresh = 0; 1015 int lastMapRefresh = 0;
1016 int twoDays = 172800; 1016 int twoDays = 172800;
1017 int RefreshSeconds = twoDays; 1017// int RefreshSeconds = twoDays;
1018 1018
1019 try 1019 try
1020 { 1020 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3e20766..933999e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2149,7 +2149,7 @@ namespace OpenSim.Region.Framework.Scenes
2149 } 2149 }
2150 2150
2151 /// <summary> 2151 /// <summary>
2152 /// Delete every object from the scene 2152 /// Delete every object from the scene. This does not include attachments worn by avatars.
2153 /// </summary> 2153 /// </summary>
2154 public void DeleteAllSceneObjects() 2154 public void DeleteAllSceneObjects()
2155 { 2155 {
@@ -2160,7 +2160,11 @@ namespace OpenSim.Region.Framework.Scenes
2160 foreach (EntityBase e in entities) 2160 foreach (EntityBase e in entities)
2161 { 2161 {
2162 if (e is SceneObjectGroup) 2162 if (e is SceneObjectGroup)
2163 DeleteSceneObject((SceneObjectGroup)e, false); 2163 {
2164 SceneObjectGroup sog = (SceneObjectGroup)e;
2165 if (!sog.IsAttachment)
2166 DeleteSceneObject((SceneObjectGroup)e, false);
2167 }
2164 } 2168 }
2165 } 2169 }
2166 } 2170 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index bfc19b7..ee17fbf 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -376,6 +376,8 @@ namespace OpenSim.Region.Framework.Scenes
376 /// <param name="mod"></param> 376 /// <param name="mod"></param>
377 public void RegisterModuleInterface<M>(M mod) 377 public void RegisterModuleInterface<M>(M mod)
378 { 378 {
379 m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
380
379 List<Object> l = null; 381 List<Object> l = null;
380 if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) 382 if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
381 { 383 {
@@ -498,8 +500,31 @@ namespace OpenSim.Region.Framework.Scenes
498 } 500 }
499 } 501 }
500 502
503 /// <summary>
504 /// Call this from a region module to add a command to the OpenSim console.
505 /// </summary>
506 /// <param name="mod"></param>
507 /// <param name="command"></param>
508 /// <param name="shorthelp"></param>
509 /// <param name="longhelp"></param>
510 /// <param name="callback"></param>
501 public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) 511 public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
502 { 512 {
513 AddCommand(mod, command, shorthelp, longhelp, string.Empty, callback);
514 }
515
516 /// <summary>
517 /// Call this from a region module to add a command to the OpenSim console.
518 /// </summary>
519 /// <param name="mod"></param>
520 /// <param name="command"></param>
521 /// <param name="shorthelp"></param>
522 /// <param name="longhelp"></param>
523 /// <param name="descriptivehelp"></param>
524 /// <param name="callback"></param>
525 public void AddCommand(
526 object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
527 {
503 if (MainConsole.Instance == null) 528 if (MainConsole.Instance == null)
504 return; 529 return;
505 530
@@ -523,7 +548,8 @@ namespace OpenSim.Region.Framework.Scenes
523 else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); 548 else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
524 } 549 }
525 550
526 MainConsole.Instance.Commands.AddCommand(modulename, shared, command, shorthelp, longhelp, callback); 551 MainConsole.Instance.Commands.AddCommand(
552 modulename, shared, command, shorthelp, longhelp, descriptivehelp, callback);
527 } 553 }
528 554
529 public virtual ISceneObject DeserializeObject(string representation) 555 public virtual ISceneObject DeserializeObject(string representation)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 683df93..c84596b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1289,10 +1289,13 @@ namespace OpenSim.Region.Framework.Scenes
1289 { 1289 {
1290 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1290 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
1291 { 1291 {
1292 avatar.SceneViewer.QueuePartForUpdate(this); 1292 AddFullUpdateToAvatar(avatar);
1293 }); 1293 });
1294 } 1294 }
1295 1295
1296 /// <summary>
1297 /// Tell the scene presence that it should send updates for this part to its client
1298 /// </summary>
1296 public void AddFullUpdateToAvatar(ScenePresence presence) 1299 public void AddFullUpdateToAvatar(ScenePresence presence)
1297 { 1300 {
1298 presence.SceneViewer.QueuePartForUpdate(this); 1301 presence.SceneViewer.QueuePartForUpdate(this);
@@ -1313,7 +1316,7 @@ namespace OpenSim.Region.Framework.Scenes
1313 { 1316 {
1314 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1317 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
1315 { 1318 {
1316 avatar.SceneViewer.QueuePartForUpdate(this); 1319 AddTerseUpdateToAvatar(avatar);
1317 }); 1320 });
1318 } 1321 }
1319 1322
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d7660fd..e3bbe8a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -820,15 +820,6 @@ namespace OpenSim.Region.Framework.Scenes
820 820
821 #endregion 821 #endregion
822 822
823 /// <summary>
824 /// Add the part to the queue of parts for which we need to send an update to the client
825 /// </summary>
826 /// <param name="part"></param>
827 public void QueuePartForUpdate(SceneObjectPart part)
828 {
829 m_sceneViewer.QueuePartForUpdate(part);
830 }
831
832 public uint GenerateClientFlags(UUID ObjectID) 823 public uint GenerateClientFlags(UUID ObjectID)
833 { 824 {
834 return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID); 825 return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs
index d3e65a4..9503c4c 100644
--- a/OpenSim/Server/ServerMain.cs
+++ b/OpenSim/Server/ServerMain.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Server
61 string connList = serverConfig.GetString("ServiceConnectors", String.Empty); 61 string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
62 string[] conns = connList.Split(new char[] {',', ' '}); 62 string[] conns = connList.Split(new char[] {',', ' '});
63 63
64 int i = 0; 64// int i = 0;
65 foreach (string c in conns) 65 foreach (string c in conns)
66 { 66 {
67 if (c == String.Empty) 67 if (c == String.Empty)
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs
index 19f636a..601a69f 100644
--- a/OpenSim/Services/PresenceService/PresenceService.cs
+++ b/OpenSim/Services/PresenceService/PresenceService.cs
@@ -54,7 +54,8 @@ namespace OpenSim.Services.PresenceService
54 public bool LoginAgent(string userID, UUID sessionID, 54 public bool LoginAgent(string userID, UUID sessionID,
55 UUID secureSessionID) 55 UUID secureSessionID)
56 { 56 {
57 PresenceData[] d = m_Database.Get("UserID", userID); 57 //PresenceData[] d = m_Database.Get("UserID", userID);
58 m_Database.Get("UserID", userID);
58 59
59 PresenceData data = new PresenceData(); 60 PresenceData data = new PresenceData();
60 61
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 6923293..eb588f0 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -277,8 +277,9 @@ namespace OpenSim.Services.UserAccountService
277 #endregion 277 #endregion
278 278
279 #region Console commands 279 #region Console commands
280
280 /// <summary> 281 /// <summary>
281 /// Create a new user 282 /// Handle the create user command from the console.
282 /// </summary> 283 /// </summary>
283 /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param> 284 /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
284 protected void HandleCreateUser(string module, string[] cmdparams) 285 protected void HandleCreateUser(string module, string[] cmdparams)
@@ -304,6 +305,52 @@ namespace OpenSim.Services.UserAccountService
304 email = MainConsole.Instance.CmdPrompt("Email", ""); 305 email = MainConsole.Instance.CmdPrompt("Email", "");
305 else email = cmdparams[5]; 306 else email = cmdparams[5];
306 307
308 CreateUser(firstName, lastName, password, email);
309 }
310
311 protected void HandleResetUserPassword(string module, string[] cmdparams)
312 {
313 string firstName;
314 string lastName;
315 string newPassword;
316
317 if (cmdparams.Length < 4)
318 firstName = MainConsole.Instance.CmdPrompt("First name");
319 else firstName = cmdparams[3];
320
321 if (cmdparams.Length < 5)
322 lastName = MainConsole.Instance.CmdPrompt("Last name");
323 else lastName = cmdparams[4];
324
325 if (cmdparams.Length < 6)
326 newPassword = MainConsole.Instance.PasswdPrompt("New password");
327 else newPassword = cmdparams[5];
328
329 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
330 if (account == null)
331 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user");
332
333 bool success = false;
334 if (m_AuthenticationService != null)
335 success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword);
336 if (!success)
337 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.",
338 firstName, lastName);
339 else
340 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName);
341 }
342
343 #endregion
344
345 /// <summary>
346 /// Create a user
347 /// </summary>
348 /// <param name="firstName"></param>
349 /// <param name="lastName"></param>
350 /// <param name="password"></param>
351 /// <param name="email"></param>
352 public void CreateUser(string firstName, string lastName, string password, string email)
353 {
307 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); 354 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
308 if (null == account) 355 if (null == account)
309 { 356 {
@@ -338,7 +385,6 @@ namespace OpenSim.Services.UserAccountService
338 else 385 else
339 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.", 386 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
340 firstName, lastName); 387 firstName, lastName);
341
342 } 388 }
343 else 389 else
344 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.", 390 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
@@ -350,7 +396,6 @@ namespace OpenSim.Services.UserAccountService
350 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", 396 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
351 firstName, lastName); 397 firstName, lastName);
352 398
353
354 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName); 399 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
355 } 400 }
356 } 401 }
@@ -358,42 +403,6 @@ namespace OpenSim.Services.UserAccountService
358 { 403 {
359 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); 404 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
360 } 405 }
361 406 }
362 }
363
364 protected void HandleResetUserPassword(string module, string[] cmdparams)
365 {
366 string firstName;
367 string lastName;
368 string newPassword;
369
370 if (cmdparams.Length < 4)
371 firstName = MainConsole.Instance.CmdPrompt("First name");
372 else firstName = cmdparams[3];
373
374 if (cmdparams.Length < 5)
375 lastName = MainConsole.Instance.CmdPrompt("Last name");
376 else lastName = cmdparams[4];
377
378 if (cmdparams.Length < 6)
379 newPassword = MainConsole.Instance.PasswdPrompt("New password");
380 else newPassword = cmdparams[5];
381
382 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
383 if (account == null)
384 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user");
385
386 bool success = false;
387 if (m_AuthenticationService != null)
388 success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword);
389 if (!success)
390 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.",
391 firstName, lastName);
392 else
393 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName);
394 }
395
396 #endregion
397
398 } 407 }
399} 408}
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 91cf323..2756324 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.CoreModules.Agent.Capabilities; 42using OpenSim.Region.CoreModules.Agent.Capabilities;
43using OpenSim.Region.CoreModules.Avatar.Gods; 43using OpenSim.Region.CoreModules.Avatar.Gods;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; 44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; 46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 47using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
47using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; 48using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
@@ -58,6 +59,7 @@ namespace OpenSim.Tests.Common.Setup
58 // These static variables in order to allow regions to be linked by shared modules and same 59 // These static variables in order to allow regions to be linked by shared modules and same
59 // CommunicationsManager. 60 // CommunicationsManager.
60 private static ISharedRegionModule m_assetService = null; 61 private static ISharedRegionModule m_assetService = null;
62// private static ISharedRegionModule m_authenticationService = null;
61 private static ISharedRegionModule m_inventoryService = null; 63 private static ISharedRegionModule m_inventoryService = null;
62 private static ISharedRegionModule m_gridService = null; 64 private static ISharedRegionModule m_gridService = null;
63 private static ISharedRegionModule m_userAccountService = null; 65 private static ISharedRegionModule m_userAccountService = null;
@@ -177,6 +179,9 @@ namespace OpenSim.Tests.Common.Setup
177 StartAssetService(testScene, true); 179 StartAssetService(testScene, true);
178 else 180 else
179 StartAssetService(testScene, false); 181 StartAssetService(testScene, false);
182
183 // For now, always started a 'real' authenication service
184 StartAuthenticationService(testScene, true);
180 185
181 if (realServices.Contains("inventory")) 186 if (realServices.Contains("inventory"))
182 StartInventoryService(testScene, true); 187 StartInventoryService(testScene, true);
@@ -236,13 +241,34 @@ namespace OpenSim.Tests.Common.Setup
236 else 241 else
237 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); 242 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
238 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 243 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
239 assetService.Initialise(config); 244 assetService.Initialise(config);
240 assetService.AddRegion(testScene); 245 assetService.AddRegion(testScene);
241 assetService.RegionLoaded(testScene); 246 assetService.RegionLoaded(testScene);
242 testScene.AddRegionModule(assetService.Name, assetService); 247 testScene.AddRegionModule(assetService.Name, assetService);
243 m_assetService = assetService; 248 m_assetService = assetService;
244 } 249 }
245 250
251 private static void StartAuthenticationService(Scene testScene, bool real)
252 {
253 ISharedRegionModule service = new LocalAuthenticationServicesConnector();
254 IConfigSource config = new IniConfigSource();
255 config.AddConfig("Modules");
256 config.AddConfig("AuthenticationService");
257 config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector");
258 if (real)
259 config.Configs["AuthenticationService"].Set(
260 "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
261 else
262 config.Configs["AuthenticationService"].Set(
263 "LocalServiceModule", "OpenSim.Tests.Common.dll:MockuthenticationService");
264 config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
265 service.Initialise(config);
266 service.AddRegion(testScene);
267 service.RegionLoaded(testScene);
268 testScene.AddRegionModule(service.Name, service);
269 //m_authenticationService = service;
270 }
271
246 private static void StartInventoryService(Scene testScene, bool real) 272 private static void StartInventoryService(Scene testScene, bool real)
247 { 273 {
248 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); 274 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index cd61fa6..e6a7818 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -27,7 +27,8 @@
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework.Communications; 29using OpenSim.Framework.Communications;
30 30using OpenSim.Region.Framework.Scenes;
31using OpenSim.Services.Interfaces;
31 32
32namespace OpenSim.Tests.Common.Setup 33namespace OpenSim.Tests.Common.Setup
33{ 34{
@@ -36,85 +37,99 @@ namespace OpenSim.Tests.Common.Setup
36 /// </summary> 37 /// </summary>
37 public static class UserProfileTestUtils 38 public static class UserProfileTestUtils
38 { 39 {
39 // REFACTORING PROBLEM 40// /// <summary>
40 // This needs to be rewritten 41// /// Create a test user with a standard inventory
42// /// </summary>
43// /// <param name="commsManager"></param>
44// /// <param name="callback">
45// /// Callback to invoke when inventory has been loaded. This is required because
46// /// loading may be asynchronous, even on standalone
47// /// </param>
48// /// <returns></returns>
49// public static CachedUserInfo CreateUserWithInventory(
50// CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
51// {
52// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
53// return CreateUserWithInventory(commsManager, userId, callback);
54// }
55//
56// /// <summary>
57// /// Create a test user with a standard inventory
58// /// </summary>
59// /// <param name="commsManager"></param>
60// /// <param name="userId">User ID</param>
61// /// <param name="callback">
62// /// Callback to invoke when inventory has been loaded. This is required because
63// /// loading may be asynchronous, even on standalone
64// /// </param>
65// /// <returns></returns>
66// public static CachedUserInfo CreateUserWithInventory(
67// CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
68// {
69// return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
70// }
71//
72// /// <summary>
73// /// Create a test user with a standard inventory
74// /// </summary>
75// /// <param name="commsManager"></param>
76// /// <param name="firstName">First name of user</param>
77// /// <param name="lastName">Last name of user</param>
78// /// <param name="userId">User ID</param>
79// /// <param name="callback">
80// /// Callback to invoke when inventory has been loaded. This is required because
81// /// loading may be asynchronous, even on standalone
82// /// </param>
83// /// <returns></returns>
84// public static CachedUserInfo CreateUserWithInventory(
85// CommunicationsManager commsManager, string firstName, string lastName,
86// UUID userId, OnInventoryReceivedDelegate callback)
87// {
88// return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
89// }
90//
91// /// <summary>
92// /// Create a test user with a standard inventory
93// /// </summary>
94// /// <param name="commsManager"></param>
95// /// <param name="firstName">First name of user</param>
96// /// <param name="lastName">Last name of user</param>
97// /// <param name="password">Password</param>
98// /// <param name="userId">User ID</param>
99// /// <param name="callback">
100// /// Callback to invoke when inventory has been loaded. This is required because
101// /// loading may be asynchronous, even on standalone
102// /// </param>
103// /// <returns></returns>
104// public static CachedUserInfo CreateUserWithInventory(
105// CommunicationsManager commsManager, string firstName, string lastName, string password,
106// UUID userId, OnInventoryReceivedDelegate callback)
107// {
108// LocalUserServices lus = (LocalUserServices)commsManager.UserService;
109// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
110//
111// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
112// userInfo.OnInventoryReceived += callback;
113// userInfo.FetchInventory();
114//
115// return userInfo;
116// }
41 117
42 ///// <summary> 118 public static UserAccount CreateUserWithInventory(Scene scene)
43 ///// Create a test user with a standard inventory 119 {
44 ///// </summary> 120 return CreateUserWithInventory(
45 ///// <param name="commsManager"></param> 121 scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
46 ///// <param name="callback"> 122 }
47 ///// Callback to invoke when inventory has been loaded. This is required because
48 ///// loading may be asynchronous, even on standalone
49 ///// </param>
50 ///// <returns></returns>
51 //public static CachedUserInfo CreateUserWithInventory(
52 // CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
53 //{
54 // UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
55 // return CreateUserWithInventory(commsManager, userId, callback);
56 //}
57
58 ///// <summary>
59 ///// Create a test user with a standard inventory
60 ///// </summary>
61 ///// <param name="commsManager"></param>
62 ///// <param name="userId">User ID</param>
63 ///// <param name="callback">
64 ///// Callback to invoke when inventory has been loaded. This is required because
65 ///// loading may be asynchronous, even on standalone
66 ///// </param>
67 ///// <returns></returns>
68 //public static CachedUserInfo CreateUserWithInventory(
69 // CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
70 //{
71 // return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
72 //}
73 123
74 ///// <summary> 124 public static UserAccount CreateUserWithInventory(
75 ///// Create a test user with a standard inventory 125 Scene scene, string firstName, string lastName, UUID userId, string pw)
76 ///// </summary> 126 {
77 ///// <param name="commsManager"></param> 127 UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName };
78 ///// <param name="firstName">First name of user</param> 128 scene.UserAccountService.StoreUserAccount(ua);
79 ///// <param name="lastName">Last name of user</param> 129 scene.InventoryService.CreateUserInventory(ua.PrincipalID);
80 ///// <param name="userId">User ID</param> 130 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
81 ///// <param name="callback">
82 ///// Callback to invoke when inventory has been loaded. This is required because
83 ///// loading may be asynchronous, even on standalone
84 ///// </param>
85 ///// <returns></returns>
86 //public static CachedUserInfo CreateUserWithInventory(
87 // CommunicationsManager commsManager, string firstName, string lastName,
88 // UUID userId, OnInventoryReceivedDelegate callback)
89 //{
90 // return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
91 //}
92 131
93 ///// <summary> 132 return ua;
94 ///// Create a test user with a standard inventory 133 }
95 ///// </summary>
96 ///// <param name="commsManager"></param>
97 ///// <param name="firstName">First name of user</param>
98 ///// <param name="lastName">Last name of user</param>
99 ///// <param name="password">Password</param>
100 ///// <param name="userId">User ID</param>
101 ///// <param name="callback">
102 ///// Callback to invoke when inventory has been loaded. This is required because
103 ///// loading may be asynchronous, even on standalone
104 ///// </param>
105 ///// <returns></returns>
106 //public static CachedUserInfo CreateUserWithInventory(
107 // CommunicationsManager commsManager, string firstName, string lastName, string password,
108 // UUID userId, OnInventoryReceivedDelegate callback)
109 //{
110 // LocalUserServices lus = (LocalUserServices)commsManager.UserService;
111 // lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
112
113 // CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
114 // userInfo.OnInventoryReceived += callback;
115 // userInfo.FetchInventory();
116
117 // return userInfo;
118 //}
119 } 134 }
120} 135} \ No newline at end of file