aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMic Bowman2011-04-18 11:29:43 -0700
committerMic Bowman2011-04-18 11:29:43 -0700
commit452ae375f0fdd62ba16fb170869ea470c6906cfe (patch)
treeb5a7d364e509f2ff7f1b9086e2ba5658f4ee99ac /OpenSim
parentRemove the call to remove tokens from the parent. Under heavy load (diff)
parentMantis #5442: Add admin_save_heightmap (diff)
downloadopensim-SC-452ae375f0fdd62ba16fb170869ea470c6906cfe.zip
opensim-SC-452ae375f0fdd62ba16fb170869ea470c6906cfe.tar.gz
opensim-SC-452ae375f0fdd62ba16fb170869ea470c6906cfe.tar.bz2
opensim-SC-452ae375f0fdd62ba16fb170869ea470c6906cfe.tar.xz
Merge branch 'master' into test-merge0418
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs252
-rw-r--r--OpenSim/Framework/WebUtil.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs57
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs52
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs416
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs60
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs4
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs10
-rw-r--r--OpenSim/Services/Interfaces/IAssetService.cs5
-rw-r--r--OpenSim/Tests/Common/Mock/MockAssetService.cs109
-rw-r--r--OpenSim/Tests/Common/Mock/MockInventoryService.cs186
-rw-r--r--OpenSim/Tests/Common/Setup/AssetHelpers.cs25
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs98
22 files changed, 626 insertions, 801 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 1b4d1ea..5a011ce 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -94,7 +94,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
94 94
95 public void Initialise() 95 public void Initialise()
96 { 96 {
97 m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!"); 97 m_log.Error("[RADMIN]: " + Name + " cannot be default-initialized!");
98 throw new PluginNotInitialisedException(Name); 98 throw new PluginNotInitialisedException(Name);
99 } 99 }
100 100
@@ -111,7 +111,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
111 else 111 else
112 { 112 {
113 m_config = m_configSource.Configs["RemoteAdmin"]; 113 m_config = m_configSource.Configs["RemoteAdmin"];
114 m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); 114 m_log.Debug("[RADMIN]: Remote Admin Plugin Enabled");
115 m_requiredPassword = m_config.GetString("access_password", String.Empty); 115 m_requiredPassword = m_config.GetString("access_password", String.Empty);
116 int port = m_config.GetInt("port", 0); 116 int port = m_config.GetInt("port", 0);
117 117
@@ -130,6 +130,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
130 availableMethods["admin_broadcast"] = XmlRpcAlertMethod; 130 availableMethods["admin_broadcast"] = XmlRpcAlertMethod;
131 availableMethods["admin_restart"] = XmlRpcRestartMethod; 131 availableMethods["admin_restart"] = XmlRpcRestartMethod;
132 availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; 132 availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod;
133 availableMethods["admin_save_heightmap"] = XmlRpcSaveHeightmapMethod;
133 // User management 134 // User management
134 availableMethods["admin_create_user"] = XmlRpcCreateUserMethod; 135 availableMethods["admin_create_user"] = XmlRpcCreateUserMethod;
135 availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod; 136 availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod;
@@ -230,8 +231,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
230 } 231 }
231 catch (Exception e) 232 catch (Exception e)
232 { 233 {
233 m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message); 234 m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace);
234 m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
235 responseData["accepted"] = false; 235 responseData["accepted"] = false;
236 responseData["success"] = false; 236 responseData["success"] = false;
237 responseData["rebooting"] = false; 237 responseData["rebooting"] = false;
@@ -277,8 +277,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
277 } 277 }
278 catch (Exception e) 278 catch (Exception e)
279 { 279 {
280 m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); 280 m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message, e.StackTrace);
281 m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
282 281
283 responseData["accepted"] = false; 282 responseData["accepted"] = false;
284 responseData["success"] = false; 283 responseData["success"] = false;
@@ -301,7 +300,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
301 { 300 {
302 Hashtable requestData = (Hashtable) request.Params[0]; 301 Hashtable requestData = (Hashtable) request.Params[0];
303 302
304 m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); 303 m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request);
305 // foreach (string k in requestData.Keys) 304 // foreach (string k in requestData.Keys)
306 // { 305 // {
307 // m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}", 306 // m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}",
@@ -348,8 +347,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
348 } 347 }
349 catch (Exception e) 348 catch (Exception e)
350 { 349 {
351 m_log.ErrorFormat("[RADMIN]: Terrain Loading: failed: {0}", e.Message); 350 m_log.ErrorFormat("[RADMIN]: Terrain Loading: failed: {0} {1}", e.Message, e.StackTrace);
352 m_log.DebugFormat("[RADMIN]: Terrain Loading: failed: {0}", e.ToString());
353 351
354 responseData["success"] = false; 352 responseData["success"] = false;
355 responseData["error"] = e.Message; 353 responseData["error"] = e.Message;
@@ -360,6 +358,61 @@ namespace OpenSim.ApplicationPlugins.RemoteController
360 return response; 358 return response;
361 } 359 }
362 360
361 public XmlRpcResponse XmlRpcSaveHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient)
362
363 {
364 XmlRpcResponse response = new XmlRpcResponse();
365 Hashtable responseData = new Hashtable();
366
367 m_log.Info("[RADMIN]: Save height maps request started");
368
369 try
370 {
371 Hashtable requestData = (Hashtable)request.Params[0];
372
373 m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString());
374
375 CheckStringParameters(request, new string[] { "password", "filename", "regionid" });
376
377 if (m_requiredPassword != String.Empty &&
378 (!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword))
379 throw new Exception("wrong password");
380
381 string file = (string)requestData["filename"];
382 UUID regionID = (UUID)(string)requestData["regionid"];
383 m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file);
384
385 responseData["accepted"] = true;
386
387 Scene region = null;
388
389 if (!m_application.SceneManager.TryGetScene(regionID, out region))
390 throw new Exception("1: unable to get a scene with that name");
391
392 ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
393 if (null == terrainModule) throw new Exception("terrain module not available");
394
395 terrainModule.SaveToFile(file);
396
397 responseData["success"] = false;
398
399 response.Value = responseData;
400 }
401 catch (Exception e)
402 {
403 m_log.ErrorFormat("[RADMIN]: Terrain Saving: failed: {0}", e.Message);
404 m_log.DebugFormat("[RADMIN]: Terrain Saving: failed: {0}", e.ToString());
405
406 responseData["success"] = false;
407 responseData["error"] = e.Message;
408
409 }
410
411 m_log.Info("[RADMIN]: Save height maps request complete");
412
413 return response;
414 }
415
363 public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient) 416 public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient)
364 { 417 {
365 m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); 418 m_log.Info("[RADMIN]: Received Shutdown Administrator Request");
@@ -417,14 +470,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
417 } 470 }
418 catch (Exception e) 471 catch (Exception e)
419 { 472 {
420 m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message); 473 m_log.ErrorFormat("[RADMIN]: Shutdown: failed: {0} {1}", e.Message, e.StackTrace);
421 m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString());
422 474
423 responseData["accepted"] = false; 475 responseData["accepted"] = false;
424 responseData["error"] = e.Message; 476 responseData["error"] = e.Message;
425 477
426 response.Value = responseData; 478 response.Value = responseData;
427 } 479 }
480
428 m_log.Info("[RADMIN]: Shutdown Administrator Request complete"); 481 m_log.Info("[RADMIN]: Shutdown Administrator Request complete");
429 return response; 482 return response;
430 } 483 }
@@ -725,8 +778,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
725 } 778 }
726 catch (Exception e) 779 catch (Exception e)
727 { 780 {
728 m_log.ErrorFormat("[RADMIN] CreateRegion: failed {0}", e.Message); 781 m_log.ErrorFormat("[RADMIN] CreateRegion: failed {0} {1}", e.Message, e.StackTrace);
729 m_log.DebugFormat("[RADMIN] CreateRegion: failed {0}", e.ToString());
730 782
731 responseData["success"] = false; 783 responseData["success"] = false;
732 responseData["error"] = e.Message; 784 responseData["error"] = e.Message;
@@ -792,8 +844,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
792 } 844 }
793 catch (Exception e) 845 catch (Exception e)
794 { 846 {
795 m_log.ErrorFormat("[RADMIN] DeleteRegion: failed {0}", e.Message); 847 m_log.ErrorFormat("[RADMIN] DeleteRegion: failed {0} {1}", e.Message, e.StackTrace);
796 m_log.DebugFormat("[RADMIN] DeleteRegion: failed {0}", e.ToString());
797 848
798 responseData["success"] = false; 849 responseData["success"] = false;
799 responseData["error"] = e.Message; 850 responseData["error"] = e.Message;
@@ -884,8 +935,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
884 } 935 }
885 catch (Exception e) 936 catch (Exception e)
886 { 937 {
887 m_log.ErrorFormat("[RADMIN] CloseRegion: failed {0}", e.Message); 938 m_log.ErrorFormat("[RADMIN]: CloseRegion: failed {0} {1}", e.Message, e.StackTrace);
888 m_log.DebugFormat("[RADMIN] CloseRegion: failed {0}", e.ToString());
889 939
890 responseData["success"] = false; 940 responseData["success"] = false;
891 responseData["error"] = e.Message; 941 responseData["error"] = e.Message;
@@ -982,8 +1032,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
982 } 1032 }
983 catch (Exception e) 1033 catch (Exception e)
984 { 1034 {
985 m_log.ErrorFormat("[RADMIN] ModifyRegion: failed {0}", e.Message); 1035 m_log.ErrorFormat("[RADMIN] ModifyRegion: failed {0} {1}", e.Message, e.StackTrace);
986 m_log.DebugFormat("[RADMIN] ModifyRegion: failed {0}", e.ToString());
987 1036
988 responseData["success"] = false; 1037 responseData["success"] = false;
989 responseData["error"] = e.Message; 1038 responseData["error"] = e.Message;
@@ -1106,8 +1155,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1106 } 1155 }
1107 catch (Exception e) 1156 catch (Exception e)
1108 { 1157 {
1109 m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message); 1158 m_log.ErrorFormat("[RADMIN]: CreateUser: failed: {0} {1}", e.Message, e.StackTrace);
1110 m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
1111 1159
1112 responseData["success"] = false; 1160 responseData["success"] = false;
1113 responseData["avatar_uuid"] = UUID.Zero.ToString(); 1161 responseData["avatar_uuid"] = UUID.Zero.ToString();
@@ -1198,8 +1246,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1198 } 1246 }
1199 catch (Exception e) 1247 catch (Exception e)
1200 { 1248 {
1201 m_log.ErrorFormat("[RADMIN] UserExists: failed: {0}", e.Message); 1249 m_log.ErrorFormat("[RADMIN]: UserExists: failed: {0} {1}", e.Message, e.StackTrace);
1202 m_log.DebugFormat("[RADMIN] UserExists: failed: {0}", e.ToString());
1203 1250
1204 responseData["success"] = false; 1251 responseData["success"] = false;
1205 responseData["error"] = e.Message; 1252 responseData["error"] = e.Message;
@@ -1372,9 +1419,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1372 } 1419 }
1373 catch (Exception e) 1420 catch (Exception e)
1374 { 1421 {
1375 1422 m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0} {1}", e.Message, e.StackTrace);
1376 m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message);
1377 m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString());
1378 1423
1379 responseData["success"] = false; 1424 responseData["success"] = false;
1380 responseData["avatar_uuid"] = UUID.Zero.ToString(); 1425 responseData["avatar_uuid"] = UUID.Zero.ToString();
@@ -1382,6 +1427,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1382 1427
1383 response.Value = responseData; 1428 response.Value = responseData;
1384 } 1429 }
1430
1385 m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); 1431 m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
1386 return response; 1432 return response;
1387 } 1433 }
@@ -1397,7 +1443,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1397 1443
1398 private void UpdateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) 1444 private void UpdateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid)
1399 { 1445 {
1400 m_log.DebugFormat("[RADMIN] updateUserAppearance"); 1446 m_log.DebugFormat("[RADMIN]: updateUserAppearance");
1401 1447
1402 string defaultMale = m_config.GetString("default_male", "Default Male"); 1448 string defaultMale = m_config.GetString("default_male", "Default Male");
1403 string defaultFemale = m_config.GetString("default_female", "Default Female"); 1449 string defaultFemale = m_config.GetString("default_female", "Default Female");
@@ -1437,16 +1483,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1437 1483
1438 if (String.IsNullOrEmpty(model)) 1484 if (String.IsNullOrEmpty(model))
1439 { 1485 {
1440 m_log.DebugFormat("[RADMIN] Appearance update not requested"); 1486 m_log.DebugFormat("[RADMIN]: Appearance update not requested");
1441 return; 1487 return;
1442 } 1488 }
1443 1489
1444 m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model); 1490 m_log.DebugFormat("[RADMIN]: Setting appearance for avatar {0}, using model <{1}>", userid, model);
1445 1491
1446 string[] modelSpecifiers = model.Split(); 1492 string[] modelSpecifiers = model.Split();
1447 if (modelSpecifiers.Length != 2) 1493 if (modelSpecifiers.Length != 2)
1448 { 1494 {
1449 m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); 1495 m_log.WarnFormat("[RADMIN]: User appearance not set for {0}. Invalid model name : <{1}>", userid, model);
1450 // modelSpecifiers = dmodel.Split(); 1496 // modelSpecifiers = dmodel.Split();
1451 return; 1497 return;
1452 } 1498 }
@@ -1457,7 +1503,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1457 1503
1458 if (modelProfile == null) 1504 if (modelProfile == null)
1459 { 1505 {
1460 m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); 1506 m_log.WarnFormat("[RADMIN]: Requested model ({0}) not found. Appearance unchanged", model);
1461 return; 1507 return;
1462 } 1508 }
1463 1509
@@ -1467,7 +1513,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1467 1513
1468 EstablishAppearance(userid, modelProfile.PrincipalID); 1514 EstablishAppearance(userid, modelProfile.PrincipalID);
1469 1515
1470 m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", 1516 m_log.DebugFormat("[RADMIN]: Finished setting appearance for avatar {0}, using model {1}",
1471 userid, model); 1517 userid, model);
1472 } 1518 }
1473 1519
@@ -1479,7 +1525,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1479 1525
1480 private void EstablishAppearance(UUID destination, UUID source) 1526 private void EstablishAppearance(UUID destination, UUID source)
1481 { 1527 {
1482 m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", destination, source); 1528 m_log.DebugFormat("[RADMIN]: Initializing inventory for {0} from {1}", destination, source);
1483 Scene scene = m_application.SceneManager.CurrentOrFirstScene; 1529 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
1484 1530
1485 // If the model has no associated appearance we're done. 1531 // If the model has no associated appearance we're done.
@@ -1501,7 +1547,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1501 } 1547 }
1502 catch (Exception e) 1548 catch (Exception e)
1503 { 1549 {
1504 m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", 1550 m_log.WarnFormat("[RADMIN]: Error transferring appearance for {0} : {1}",
1505 destination, e.Message); 1551 destination, e.Message);
1506 } 1552 }
1507 1553
@@ -1532,7 +1578,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1532 } 1578 }
1533 catch (Exception e) 1579 catch (Exception e)
1534 { 1580 {
1535 m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", 1581 m_log.WarnFormat("[RADMIN]: Error transferring appearance for {0} : {1}",
1536 destination, e.Message); 1582 destination, e.Message);
1537 } 1583 }
1538 1584
@@ -1567,7 +1613,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1567 destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; 1613 destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
1568 destinationFolder.Version = 1; 1614 destinationFolder.Version = 1;
1569 inventoryService.AddFolder(destinationFolder); // store base record 1615 inventoryService.AddFolder(destinationFolder); // store base record
1570 m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source); 1616 m_log.ErrorFormat("[RADMIN]: Created folder for destination {0}", source);
1571 } 1617 }
1572 1618
1573 // Wearables 1619 // Wearables
@@ -1587,6 +1633,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1587 { 1633 {
1588 InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); 1634 InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
1589 destinationItem.Name = item.Name; 1635 destinationItem.Name = item.Name;
1636 destinationItem.Owner = destination;
1590 destinationItem.Description = item.Description; 1637 destinationItem.Description = item.Description;
1591 destinationItem.InvType = item.InvType; 1638 destinationItem.InvType = item.InvType;
1592 destinationItem.CreatorId = item.CreatorId; 1639 destinationItem.CreatorId = item.CreatorId;
@@ -1606,6 +1653,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1606 destinationItem.Flags = item.Flags; 1653 destinationItem.Flags = item.Flags;
1607 destinationItem.CreationDate = item.CreationDate; 1654 destinationItem.CreationDate = item.CreationDate;
1608 destinationItem.Folder = destinationFolder.ID; 1655 destinationItem.Folder = destinationFolder.ID;
1656 ApplyNextOwnerPermissions(destinationItem);
1609 1657
1610 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); 1658 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1611 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); 1659 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
@@ -1640,6 +1688,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1640 { 1688 {
1641 InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); 1689 InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
1642 destinationItem.Name = item.Name; 1690 destinationItem.Name = item.Name;
1691 destinationItem.Owner = destination;
1643 destinationItem.Description = item.Description; 1692 destinationItem.Description = item.Description;
1644 destinationItem.InvType = item.InvType; 1693 destinationItem.InvType = item.InvType;
1645 destinationItem.CreatorId = item.CreatorId; 1694 destinationItem.CreatorId = item.CreatorId;
@@ -1659,6 +1708,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1659 destinationItem.Flags = item.Flags; 1708 destinationItem.Flags = item.Flags;
1660 destinationItem.CreationDate = item.CreationDate; 1709 destinationItem.CreationDate = item.CreationDate;
1661 destinationItem.Folder = destinationFolder.ID; 1710 destinationItem.Folder = destinationFolder.ID;
1711 ApplyNextOwnerPermissions(destinationItem);
1662 1712
1663 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); 1713 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1664 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); 1714 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
@@ -1716,13 +1766,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1716 { 1766 {
1717 destinationFolder = new InventoryFolderBase(); 1767 destinationFolder = new InventoryFolderBase();
1718 destinationFolder.ID = UUID.Random(); 1768 destinationFolder.ID = UUID.Random();
1719 destinationFolder.Name = assetType.ToString(); 1769 if (assetType == AssetType.Clothing) {
1770 destinationFolder.Name = "Clothing";
1771 } else {
1772 destinationFolder.Name = "Body Parts";
1773 }
1720 destinationFolder.Owner = destination; 1774 destinationFolder.Owner = destination;
1721 destinationFolder.Type = (short)assetType; 1775 destinationFolder.Type = (short)assetType;
1722 destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; 1776 destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
1723 destinationFolder.Version = 1; 1777 destinationFolder.Version = 1;
1724 inventoryService.AddFolder(destinationFolder); // store base record 1778 inventoryService.AddFolder(destinationFolder); // store base record
1725 m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source); 1779 m_log.ErrorFormat("[RADMIN]: Created folder for destination {0}", source);
1726 } 1780 }
1727 1781
1728 InventoryFolderBase extraFolder; 1782 InventoryFolderBase extraFolder;
@@ -1740,7 +1794,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1740 extraFolder.ParentID = destinationFolder.ID; 1794 extraFolder.ParentID = destinationFolder.ID;
1741 inventoryService.AddFolder(extraFolder); 1795 inventoryService.AddFolder(extraFolder);
1742 1796
1743 m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID); 1797 m_log.DebugFormat("[RADMIN]: Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID);
1744 1798
1745 List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items; 1799 List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items;
1746 1800
@@ -1748,6 +1802,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1748 { 1802 {
1749 InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); 1803 InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
1750 destinationItem.Name = item.Name; 1804 destinationItem.Name = item.Name;
1805 destinationItem.Owner = destination;
1751 destinationItem.Description = item.Description; 1806 destinationItem.Description = item.Description;
1752 destinationItem.InvType = item.InvType; 1807 destinationItem.InvType = item.InvType;
1753 destinationItem.CreatorId = item.CreatorId; 1808 destinationItem.CreatorId = item.CreatorId;
@@ -1767,6 +1822,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1767 destinationItem.Flags = item.Flags; 1822 destinationItem.Flags = item.Flags;
1768 destinationItem.CreationDate = item.CreationDate; 1823 destinationItem.CreationDate = item.CreationDate;
1769 destinationItem.Folder = extraFolder.ID; 1824 destinationItem.Folder = extraFolder.ID;
1825 ApplyNextOwnerPermissions(destinationItem);
1770 1826
1771 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); 1827 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1772 inventoryMap.Add(item.ID, destinationItem.ID); 1828 inventoryMap.Add(item.ID, destinationItem.ID);
@@ -1784,6 +1840,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1784 } 1840 }
1785 1841
1786 /// <summary> 1842 /// <summary>
1843 /// Apply next owner permissions.
1844 /// </summary>
1845
1846 private void ApplyNextOwnerPermissions(InventoryItemBase item)
1847 {
1848 if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
1849 {
1850 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
1851 item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
1852 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
1853 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
1854 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
1855 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
1856 }
1857 item.CurrentPermissions &= item.NextPermissions;
1858 item.BasePermissions &= item.NextPermissions;
1859 item.EveryOnePermissions &= item.NextPermissions;
1860 // item.OwnerChanged = true;
1861 // item.PermsMask = 0;
1862 // item.PermsGranter = UUID.Zero;
1863 }
1864
1865 /// <summary>
1787 /// This method is called if a given model avatar name can not be found. If the external 1866 /// This method is called if a given model avatar name can not be found. If the external
1788 /// file has already been loaded once, then control returns immediately. If not, then it 1867 /// file has already been loaded once, then control returns immediately. If not, then it
1789 /// looks for a default appearance file. This file contains XML definitions of zero or more named 1868 /// looks for a default appearance file. This file contains XML definitions of zero or more named
@@ -1792,7 +1871,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1792 /// indicate which outfit is the default, and this outfit will be automatically worn. The 1871 /// indicate which outfit is the default, and this outfit will be automatically worn. The
1793 /// other outfits are provided to allow "real" avatars a way to easily change their outfits. 1872 /// other outfits are provided to allow "real" avatars a way to easily change their outfits.
1794 /// </summary> 1873 /// </summary>
1795
1796 private bool CreateDefaultAvatars() 1874 private bool CreateDefaultAvatars()
1797 { 1875 {
1798 // Only load once 1876 // Only load once
@@ -1801,7 +1879,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1801 return false; 1879 return false;
1802 } 1880 }
1803 1881
1804 m_log.DebugFormat("[RADMIN] Creating default avatar entries"); 1882 m_log.DebugFormat("[RADMIN]: Creating default avatar entries");
1805 1883
1806 m_defaultAvatarsLoaded = true; 1884 m_defaultAvatarsLoaded = true;
1807 1885
@@ -1857,7 +1935,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1857 1935
1858 foreach (XmlElement avatar in avatars) 1936 foreach (XmlElement avatar in avatars)
1859 { 1937 {
1860 m_log.DebugFormat("[RADMIN] Loading appearance for {0}, gender = {1}", 1938 m_log.DebugFormat("[RADMIN]: Loading appearance for {0}, gender = {1}",
1861 GetStringAttribute(avatar,"name","?"), GetStringAttribute(avatar,"gender","?")); 1939 GetStringAttribute(avatar,"name","?"), GetStringAttribute(avatar,"gender","?"));
1862 1940
1863 // Create the user identified by the avatar entry 1941 // Create the user identified by the avatar entry
@@ -1879,7 +1957,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1879 account = CreateUser(scopeID, names[0], names[1], password, email); 1957 account = CreateUser(scopeID, names[0], names[1], password, email);
1880 if (null == account) 1958 if (null == account)
1881 { 1959 {
1882 m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", names[0], names[1]); 1960 m_log.ErrorFormat("[RADMIN]: Avatar {0} {1} was not created", names[0], names[1]);
1883 return false; 1961 return false;
1884 } 1962 }
1885 } 1963 }
@@ -1897,12 +1975,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1897 1975
1898 ID = account.PrincipalID; 1976 ID = account.PrincipalID;
1899 1977
1900 m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); 1978 m_log.DebugFormat("[RADMIN]: User {0}[{1}] created or retrieved", name, ID);
1901 include = true; 1979 include = true;
1902 } 1980 }
1903 catch (Exception e) 1981 catch (Exception e)
1904 { 1982 {
1905 m_log.DebugFormat("[RADMIN] Error creating user {0} : {1}", name, e.Message); 1983 m_log.DebugFormat("[RADMIN]: Error creating user {0} : {1}", name, e.Message);
1906 include = false; 1984 include = false;
1907 } 1985 }
1908 1986
@@ -1942,7 +2020,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1942 clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID; 2020 clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID;
1943 clothingFolder.Version = 1; 2021 clothingFolder.Version = 1;
1944 inventoryService.AddFolder(clothingFolder); // store base record 2022 inventoryService.AddFolder(clothingFolder); // store base record
1945 m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID); 2023 m_log.ErrorFormat("[RADMIN]: Created clothing folder for {0}/{1}", name, ID);
1946 } 2024 }
1947 2025
1948 // OK, now we have an inventory for the user, read in the outfits from the 2026 // OK, now we have an inventory for the user, read in the outfits from the
@@ -1955,7 +2033,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1955 2033
1956 foreach (XmlElement outfit in outfits) 2034 foreach (XmlElement outfit in outfits)
1957 { 2035 {
1958 m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}", 2036 m_log.DebugFormat("[RADMIN]: Loading outfit {0} for {1}",
1959 GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?")); 2037 GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?"));
1960 2038
1961 outfitName = GetStringAttribute(outfit,"name",""); 2039 outfitName = GetStringAttribute(outfit,"name","");
@@ -1979,7 +2057,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1979 // Otherwise, we must create the folder. 2057 // Otherwise, we must create the folder.
1980 if (extraFolder == null) 2058 if (extraFolder == null)
1981 { 2059 {
1982 m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", outfitName, name); 2060 m_log.DebugFormat("[RADMIN]: Creating outfit folder {0} for {1}", outfitName, name);
1983 extraFolder = new InventoryFolderBase(); 2061 extraFolder = new InventoryFolderBase();
1984 extraFolder.ID = UUID.Random(); 2062 extraFolder.ID = UUID.Random();
1985 extraFolder.Name = outfitName; 2063 extraFolder.Name = outfitName;
@@ -1988,7 +2066,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1988 extraFolder.Version = 1; 2066 extraFolder.Version = 1;
1989 extraFolder.ParentID = clothingFolder.ID; 2067 extraFolder.ParentID = clothingFolder.ID;
1990 inventoryService.AddFolder(extraFolder); 2068 inventoryService.AddFolder(extraFolder);
1991 m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", extraFolder.ID, clothingFolder.ID); 2069 m_log.DebugFormat("[RADMIN]: Adding outfile folder {0} to folder {1}", extraFolder.ID, clothingFolder.ID);
1992 } 2070 }
1993 2071
1994 // Now get the pieces that make up the outfit 2072 // Now get the pieces that make up the outfit
@@ -2003,7 +2081,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2003 switch (child.Name) 2081 switch (child.Name)
2004 { 2082 {
2005 case "Permissions" : 2083 case "Permissions" :
2006 m_log.DebugFormat("[RADMIN] Permissions specified"); 2084 m_log.DebugFormat("[RADMIN]: Permissions specified");
2007 perms = child; 2085 perms = child;
2008 break; 2086 break;
2009 case "Asset" : 2087 case "Asset" :
@@ -2053,7 +2131,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2053 inventoryItem.Folder = extraFolder.ID; // Parent folder 2131 inventoryItem.Folder = extraFolder.ID; // Parent folder
2054 2132
2055 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem); 2133 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem);
2056 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); 2134 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
2057 } 2135 }
2058 2136
2059 // Attach item, if attachpoint is specified 2137 // Attach item, if attachpoint is specified
@@ -2061,7 +2139,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2061 if (attachpoint != 0) 2139 if (attachpoint != 0)
2062 { 2140 {
2063 avatarAppearance.SetAttachment(attachpoint, inventoryItem.ID, inventoryItem.AssetID); 2141 avatarAppearance.SetAttachment(attachpoint, inventoryItem.ID, inventoryItem.AssetID);
2064 m_log.DebugFormat("[RADMIN] Attached {0}", inventoryItem.ID); 2142 m_log.DebugFormat("[RADMIN]: Attached {0}", inventoryItem.ID);
2065 } 2143 }
2066 2144
2067 // Record whether or not the item is to be initially worn 2145 // Record whether or not the item is to be initially worn
@@ -2074,32 +2152,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2074 } 2152 }
2075 catch (Exception e) 2153 catch (Exception e)
2076 { 2154 {
2077 m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", inventoryItem.ID, e.Message); 2155 m_log.WarnFormat("[RADMIN]: Error wearing item {0} : {1}", inventoryItem.ID, e.Message);
2078 } 2156 }
2079 } // foreach item in outfit 2157 } // foreach item in outfit
2080 m_log.DebugFormat("[RADMIN] Outfit {0} load completed", outfitName); 2158 m_log.DebugFormat("[RADMIN]: Outfit {0} load completed", outfitName);
2081 } // foreach outfit 2159 } // foreach outfit
2082 m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); 2160 m_log.DebugFormat("[RADMIN]: Inventory update complete for {0}", name);
2083 scene.AvatarService.SetAppearance(ID, avatarAppearance); 2161 scene.AvatarService.SetAppearance(ID, avatarAppearance);
2084 } 2162 }
2085 catch (Exception e) 2163 catch (Exception e)
2086 { 2164 {
2087 m_log.WarnFormat("[RADMIN] Inventory processing incomplete for user {0} : {1}", 2165 m_log.WarnFormat("[RADMIN]: Inventory processing incomplete for user {0} : {1}",
2088 name, e.Message); 2166 name, e.Message);
2089 } 2167 }
2090 } // End of include 2168 } // End of include
2091 } 2169 }
2092 m_log.DebugFormat("[RADMIN] Default avatar loading complete"); 2170 m_log.DebugFormat("[RADMIN]: Default avatar loading complete");
2093 } 2171 }
2094 else 2172 else
2095 { 2173 {
2096 m_log.DebugFormat("[RADMIN] No default avatar information available"); 2174 m_log.DebugFormat("[RADMIN]: No default avatar information available");
2097 return false; 2175 return false;
2098 } 2176 }
2099 } 2177 }
2100 catch (Exception e) 2178 catch (Exception e)
2101 { 2179 {
2102 m_log.WarnFormat("[RADMIN] Exception whilst loading default avatars ; {0}", e.Message); 2180 m_log.WarnFormat("[RADMIN]: Exception whilst loading default avatars ; {0}", e.Message);
2103 return false; 2181 return false;
2104 } 2182 }
2105 2183
@@ -2194,8 +2272,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2194 } 2272 }
2195 catch (Exception e) 2273 catch (Exception e)
2196 { 2274 {
2197 m_log.InfoFormat("[RADMIN] LoadOAR: {0}", e.Message); 2275 m_log.ErrorFormat("[RADMIN]: LoadOAR: {0} {1}", e.Message, e.StackTrace);
2198 m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString());
2199 2276
2200 responseData["loaded"] = false; 2277 responseData["loaded"] = false;
2201 responseData["error"] = e.Message; 2278 responseData["error"] = e.Message;
@@ -2300,8 +2377,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2300 } 2377 }
2301 catch (Exception e) 2378 catch (Exception e)
2302 { 2379 {
2303 m_log.InfoFormat("[RADMIN] SaveOAR: {0}", e.Message); 2380 m_log.ErrorFormat("[RADMIN]: SaveOAR: {0} {1}", e.Message, e.StackTrace);
2304 m_log.DebugFormat("[RADMIN] SaveOAR: {0}", e.ToString());
2305 2381
2306 responseData["saved"] = false; 2382 responseData["saved"] = false;
2307 responseData["error"] = e.Message; 2383 responseData["error"] = e.Message;
@@ -2315,7 +2391,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2315 2391
2316 private void RemoteAdminOarSaveCompleted(Guid uuid, string name) 2392 private void RemoteAdminOarSaveCompleted(Guid uuid, string name)
2317 { 2393 {
2318 m_log.DebugFormat("[RADMIN] File processing complete for {0}", name); 2394 m_log.DebugFormat("[RADMIN]: File processing complete for {0}", name);
2319 lock (m_saveOarLock) Monitor.Pulse(m_saveOarLock); 2395 lock (m_saveOarLock) Monitor.Pulse(m_saveOarLock);
2320 } 2396 }
2321 2397
@@ -2353,14 +2429,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2353 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2429 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2354 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) 2430 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2355 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2431 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2356 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2432 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
2357 } 2433 }
2358 else if (requestData.Contains("region_name")) 2434 else if (requestData.Contains("region_name"))
2359 { 2435 {
2360 string region_name = (string) requestData["region_name"]; 2436 string region_name = (string) requestData["region_name"];
2361 if (!m_application.SceneManager.TrySetCurrentScene(region_name)) 2437 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2362 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2438 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2363 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2439 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
2364 } 2440 }
2365 else throw new Exception("neither region_name nor region_uuid given"); 2441 else throw new Exception("neither region_name nor region_uuid given");
2366 2442
@@ -2391,8 +2467,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2391 } 2467 }
2392 catch (Exception e) 2468 catch (Exception e)
2393 { 2469 {
2394 m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message); 2470 m_log.ErrorFormat("[RADMIN] LoadXml: {0} {1}", e.Message, e.StackTrace);
2395 m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString());
2396 2471
2397 responseData["loaded"] = false; 2472 responseData["loaded"] = false;
2398 responseData["switched"] = false; 2473 responseData["switched"] = false;
@@ -2438,14 +2513,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2438 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2513 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2439 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) 2514 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2440 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2515 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2441 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2516 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
2442 } 2517 }
2443 else if (requestData.Contains("region_name")) 2518 else if (requestData.Contains("region_name"))
2444 { 2519 {
2445 string region_name = (string) requestData["region_name"]; 2520 string region_name = (string) requestData["region_name"];
2446 if (!m_application.SceneManager.TrySetCurrentScene(region_name)) 2521 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2447 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2522 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2448 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2523 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
2449 } 2524 }
2450 else throw new Exception("neither region_name nor region_uuid given"); 2525 else throw new Exception("neither region_name nor region_uuid given");
2451 2526
@@ -2477,8 +2552,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2477 } 2552 }
2478 catch (Exception e) 2553 catch (Exception e)
2479 { 2554 {
2480 m_log.InfoFormat("[RADMIN] SaveXml: {0}", e.Message); 2555 m_log.ErrorFormat("[RADMIN]: SaveXml: {0} {1}", e.Message, e.StackTrace);
2481 m_log.DebugFormat("[RADMIN] SaveXml: {0}", e.ToString());
2482 2556
2483 responseData["saved"] = false; 2557 responseData["saved"] = false;
2484 responseData["switched"] = false; 2558 responseData["switched"] = false;
@@ -2517,14 +2591,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2517 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2591 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2518 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) 2592 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2519 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2593 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2520 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2594 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
2521 } 2595 }
2522 else if (requestData.Contains("region_name")) 2596 else if (requestData.Contains("region_name"))
2523 { 2597 {
2524 string region_name = (string) requestData["region_name"]; 2598 string region_name = (string) requestData["region_name"];
2525 if (!m_application.SceneManager.TrySetCurrentScene(region_name)) 2599 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2526 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2600 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2527 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2601 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
2528 } 2602 }
2529 else throw new Exception("neither region_name nor region_uuid given"); 2603 else throw new Exception("neither region_name nor region_uuid given");
2530 2604
@@ -2536,7 +2610,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2536 } 2610 }
2537 catch (Exception e) 2611 catch (Exception e)
2538 { 2612 {
2539 m_log.InfoFormat("[RADMIN] RegionQuery: {0}", e.Message); 2613 m_log.InfoFormat("[RADMIN]: RegionQuery: {0}", e.Message);
2540 2614
2541 responseData["success"] = false; 2615 responseData["success"] = false;
2542 responseData["error"] = e.Message; 2616 responseData["error"] = e.Message;
@@ -2577,7 +2651,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2577 } 2651 }
2578 catch (Exception e) 2652 catch (Exception e)
2579 { 2653 {
2580 m_log.InfoFormat("[RADMIN] ConsoleCommand: {0}", e.Message); 2654 m_log.InfoFormat("[RADMIN]: ConsoleCommand: {0}", e.Message);
2581 2655
2582 responseData["success"] = false; 2656 responseData["success"] = false;
2583 responseData["error"] = e.Message; 2657 responseData["error"] = e.Message;
@@ -2614,14 +2688,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2614 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2688 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2615 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) 2689 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2616 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2690 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2617 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2691 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
2618 } 2692 }
2619 else if (requestData.Contains("region_name")) 2693 else if (requestData.Contains("region_name"))
2620 { 2694 {
2621 string region_name = (string) requestData["region_name"]; 2695 string region_name = (string) requestData["region_name"];
2622 if (!m_application.SceneManager.TrySetCurrentScene(region_name)) 2696 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2623 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2697 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2624 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2698 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
2625 } 2699 }
2626 else throw new Exception("neither region_name nor region_uuid given"); 2700 else throw new Exception("neither region_name nor region_uuid given");
2627 2701
@@ -2632,7 +2706,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2632 } 2706 }
2633 catch (Exception e) 2707 catch (Exception e)
2634 { 2708 {
2635 m_log.InfoFormat("[RADMIN] Access List Clear Request: {0}", e.Message); 2709 m_log.ErrorFormat("[RADMIN]: Access List Clear Request: {0} {1}", e.Message, e.StackTrace);
2636 2710
2637 responseData["success"] = false; 2711 responseData["success"] = false;
2638 responseData["error"] = e.Message; 2712 responseData["error"] = e.Message;
@@ -2671,14 +2745,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2671 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2745 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2672 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) 2746 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2673 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2747 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2674 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2748 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
2675 } 2749 }
2676 else if (requestData.Contains("region_name")) 2750 else if (requestData.Contains("region_name"))
2677 { 2751 {
2678 string region_name = (string) requestData["region_name"]; 2752 string region_name = (string) requestData["region_name"];
2679 if (!m_application.SceneManager.TrySetCurrentScene(region_name)) 2753 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2680 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2754 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2681 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2755 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
2682 } 2756 }
2683 else throw new Exception("neither region_name nor region_uuid given"); 2757 else throw new Exception("neither region_name nor region_uuid given");
2684 2758
@@ -2698,7 +2772,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2698 if (account != null) 2772 if (account != null)
2699 { 2773 {
2700 uuids.Add(account.PrincipalID); 2774 uuids.Add(account.PrincipalID);
2701 m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, scene.RegionInfo.RegionName); 2775 m_log.DebugFormat("[RADMIN]: adding \"{0}\" to ACL for \"{1}\"", name, scene.RegionInfo.RegionName);
2702 } 2776 }
2703 } 2777 }
2704 List<UUID> accessControlList = new List<UUID>(scene.RegionInfo.EstateSettings.EstateAccess); 2778 List<UUID> accessControlList = new List<UUID>(scene.RegionInfo.EstateSettings.EstateAccess);
@@ -2719,7 +2793,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2719 } 2793 }
2720 catch (Exception e) 2794 catch (Exception e)
2721 { 2795 {
2722 m_log.InfoFormat("[RADMIN] Access List Add Request: {0}", e.Message); 2796 m_log.ErrorFormat("[RADMIN]: Access List Add Request: {0} {1}", e.Message, e.StackTrace);
2723 2797
2724 responseData["success"] = false; 2798 responseData["success"] = false;
2725 responseData["error"] = e.Message; 2799 responseData["error"] = e.Message;
@@ -2758,14 +2832,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2758 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2832 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2759 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) 2833 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2760 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2834 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2761 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2835 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
2762 } 2836 }
2763 else if (requestData.Contains("region_name")) 2837 else if (requestData.Contains("region_name"))
2764 { 2838 {
2765 string region_name = (string) requestData["region_name"]; 2839 string region_name = (string) requestData["region_name"];
2766 if (!m_application.SceneManager.TrySetCurrentScene(region_name)) 2840 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2767 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2841 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2768 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2842 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
2769 } 2843 }
2770 else throw new Exception("neither region_name nor region_uuid given"); 2844 else throw new Exception("neither region_name nor region_uuid given");
2771 2845
@@ -2806,7 +2880,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2806 } 2880 }
2807 catch (Exception e) 2881 catch (Exception e)
2808 { 2882 {
2809 m_log.InfoFormat("[RADMIN] Access List Remove Request: {0}", e.Message); 2883 m_log.ErrorFormat("[RADMIN]: Access List Remove Request: {0} {1}", e.Message, e.StackTrace);
2810 2884
2811 responseData["success"] = false; 2885 responseData["success"] = false;
2812 responseData["error"] = e.Message; 2886 responseData["error"] = e.Message;
@@ -2845,14 +2919,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2845 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2919 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2846 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) 2920 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2847 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2921 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2848 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2922 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
2849 } 2923 }
2850 else if (requestData.Contains("region_name")) 2924 else if (requestData.Contains("region_name"))
2851 { 2925 {
2852 string region_name = (string) requestData["region_name"]; 2926 string region_name = (string) requestData["region_name"];
2853 if (!m_application.SceneManager.TrySetCurrentScene(region_name)) 2927 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2854 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2928 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2855 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2929 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
2856 } 2930 }
2857 else throw new Exception("neither region_name nor region_uuid given"); 2931 else throw new Exception("neither region_name nor region_uuid given");
2858 2932
@@ -2874,7 +2948,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2874 } 2948 }
2875 catch (Exception e) 2949 catch (Exception e)
2876 { 2950 {
2877 m_log.InfoFormat("[RADMIN] Acces List List: {0}", e.Message); 2951 m_log.ErrorFormat("[RADMIN]: Access List List: {0} {1}", e.Message, e.StackTrace);
2878 2952
2879 responseData["success"] = false; 2953 responseData["success"] = false;
2880 responseData["error"] = e.Message; 2954 responseData["error"] = e.Message;
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 64cd014..9d70f63 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -222,8 +222,8 @@ namespace OpenSim.Framework
222 m_log.InfoFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", 222 m_log.InfoFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing",
223 reqnum,url,method,tickdiff,tickdata); 223 reqnum,url,method,tickdiff,tickdata);
224 } 224 }
225 225
226 m_log.WarnFormat("[WEB UTIL] <{0}> osd request failed: {1}",reqnum,errorMessage); 226 m_log.WarnFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
227 return ErrorResponseMap(errorMessage); 227 return ErrorResponseMap(errorMessage);
228 } 228 }
229 229
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 01170aa..f3d2f26 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -471,16 +471,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
471 if (m_creatorIdForAssetId.ContainsKey(assetId)) 471 if (m_creatorIdForAssetId.ContainsKey(assetId))
472 { 472 {
473 string xmlData = Utils.BytesToString(data); 473 string xmlData = Utils.BytesToString(data);
474 SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); 474 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
475 foreach (SceneObjectPart sop in sog.Parts) 475
476 CoalescedSceneObjects coa = null;
477 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
478 {
479// m_log.DebugFormat(
480// "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
481
482 sceneObjects.AddRange(coa.Objects);
483 }
484 else
476 { 485 {
477 if (sop.CreatorData == null || sop.CreatorData == "") 486 sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData));
478 {
479 sop.CreatorID = m_creatorIdForAssetId[assetId];
480 }
481 } 487 }
482 488
483 data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)); 489 foreach (SceneObjectGroup sog in sceneObjects)
490 foreach (SceneObjectPart sop in sog.Parts)
491 if (sop.CreatorData == null || sop.CreatorData == "")
492 sop.CreatorID = m_creatorIdForAssetId[assetId];
493
494 if (coa != null)
495 data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa));
496 else
497 data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0]));
484 } 498 }
485 } 499 }
486 500
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
index e5127a0..5ba08ee 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
@@ -68,17 +68,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
68 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), 68 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
69 FirstName = "Mr", 69 FirstName = "Mr",
70 LastName = "Tiddles" }; 70 LastName = "Tiddles" };
71
71 protected UserAccount m_uaLL1 72 protected UserAccount m_uaLL1
72 = new UserAccount { 73 = new UserAccount {
73 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), 74 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
74 FirstName = "Lord", 75 FirstName = "Lord",
75 LastName = "Lucan" }; 76 LastName = "Lucan" };
77
76 protected UserAccount m_uaLL2 78 protected UserAccount m_uaLL2
77 = new UserAccount { 79 = new UserAccount {
78 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), 80 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"),
79 FirstName = "Lord", 81 FirstName = "Lord",
80 LastName = "Lucan" }; 82 LastName = "Lucan" };
83
81 protected string m_item1Name = "Ray Gun Item"; 84 protected string m_item1Name = "Ray Gun Item";
85 protected string m_coaItemName = "Coalesced Item";
82 86
83 [SetUp] 87 [SetUp]
84 public virtual void SetUp() 88 public virtual void SetUp()
@@ -97,38 +101,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
97// log4net.Config.XmlConfigurator.Configure(); 101// log4net.Config.XmlConfigurator.Configure();
98 102
99 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 103 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
100 Scene scene = SceneSetupHelpers.SetupScene("Inventory"); 104 Scene scene = SceneSetupHelpers.SetupScene();
101 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 105 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
102 106
103 UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); 107 UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
104 108
105 MemoryStream archiveWriteStream = new MemoryStream(); 109 MemoryStream archiveWriteStream = new MemoryStream();
106 110
107 // Create asset 111 // Create scene object asset
108 SceneObjectGroup object1; 112 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
109 SceneObjectPart part1; 113 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50);
110 {
111 string partName = "Ray Gun Object";
112 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
113 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
114 Vector3 groupPosition = new Vector3(10, 20, 30);
115 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
116 Vector3 offsetPosition = new Vector3(5, 10, 15);
117
118 part1
119 = new SceneObjectPart(
120 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
121 part1.Name = partName;
122
123 object1 = new SceneObjectGroup(part1);
124 scene.AddNewSceneObject(object1, false);
125 }
126 114
127 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 115 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
128 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); 116 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
129 scene.AssetService.Store(asset1); 117 scene.AssetService.Store(asset1);
130 118
131 // Create item 119 // Create scene object item
132 InventoryItemBase item1 = new InventoryItemBase(); 120 InventoryItemBase item1 = new InventoryItemBase();
133 item1.Name = m_item1Name; 121 item1.Name = m_item1Name;
134 item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); 122 item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020");
@@ -139,8 +127,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
139 item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; 127 item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
140 scene.AddInventoryItem(item1); 128 scene.AddInventoryItem(item1);
141 129
130 // Create coalesced objects asset
131 SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120);
132 cobj1.AbsolutePosition = new Vector3(15, 30, 45);
133
134 SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140);
135 cobj2.AbsolutePosition = new Vector3(25, 50, 75);
136
137 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2);
138
139 AssetBase coaAsset = AssetHelpers.CreateAsset(0x160, coa);
140 scene.AssetService.Store(coaAsset);
141
142 // Create coalesced objects inventory item
143 InventoryItemBase coaItem = new InventoryItemBase();
144 coaItem.Name = m_coaItemName;
145 coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180");
146 coaItem.AssetID = coaAsset.FullID;
147 coaItem.GroupID = UUID.Random();
148 coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID;
149 coaItem.Owner = m_uaLL1.PrincipalID;
150 coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
151 scene.AddInventoryItem(coaItem);
152
142 archiverModule.ArchiveInventory( 153 archiverModule.ArchiveInventory(
143 Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, m_item1Name, "hampshire", archiveWriteStream); 154 Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream);
144 155
145 m_iarStreamBytes = archiveWriteStream.ToArray(); 156 m_iarStreamBytes = archiveWriteStream.ToArray();
146 } 157 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 7f156f8..d03f6da 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -62,9 +62,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
62 SerialiserModule serialiserModule = new SerialiserModule(); 62 SerialiserModule serialiserModule = new SerialiserModule();
63 m_archiverModule = new InventoryArchiverModule(); 63 m_archiverModule = new InventoryArchiverModule();
64 64
65 m_scene = SceneSetupHelpers.SetupScene("Inventory"); 65 m_scene = SceneSetupHelpers.SetupScene();
66 SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); 66 SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
67 } 67 }
68
69 [Test]
70 public void TestLoadCoalesecedItem()
71 {
72 TestHelper.InMethod();
73// log4net.Config.XmlConfigurator.Configure();
74
75 UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password");
76 m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream);
77
78 InventoryItemBase coaItem
79 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName);
80
81 Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1");
82
83 string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID);
84
85 CoalescedSceneObjects coa;
86 bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa);
87
88 Assert.That(readResult, Is.True);
89 Assert.That(coa.Count, Is.EqualTo(2));
90
91 List<SceneObjectGroup> coaObjects = coa.Objects;
92 Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120")));
93 Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45)));
94
95 Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140")));
96 Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75)));
97 }
68 98
69 /// <summary> 99 /// <summary>
70 /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive 100 /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive
@@ -84,24 +114,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
84 UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); 114 UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
85 115
86 // Create asset 116 // Create asset
87 SceneObjectGroup object1; 117 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
88 SceneObjectPart part1; 118 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
89 {
90 string partName = "My Little Dog Object";
91 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
92 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
93 Vector3 groupPosition = new Vector3(10, 20, 30);
94 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
95 Vector3 offsetPosition = new Vector3(5, 10, 15);
96
97 part1
98 = new SceneObjectPart(
99 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
100 part1.Name = partName;
101
102 object1 = new SceneObjectGroup(part1);
103 m_scene.AddNewSceneObject(object1, false);
104 }
105 119
106 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 120 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
107 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); 121 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs
index 0e8f647..c7dae52 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
63 63
64 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 64 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
65 65
66 Scene scene = SceneSetupHelpers.SetupScene("Inventory"); 66 Scene scene = SceneSetupHelpers.SetupScene();
67 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 67 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
68 68
69 // Create user 69 // Create user
@@ -180,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
180 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 180 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
181 181
182 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 182 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
183 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 183 Scene scene = SceneSetupHelpers.SetupScene();
184 184
185 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 185 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
186 186
@@ -223,7 +223,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
223 223
224 SerialiserModule serialiserModule = new SerialiserModule(); 224 SerialiserModule serialiserModule = new SerialiserModule();
225 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 225 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
226 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 226 Scene scene = SceneSetupHelpers.SetupScene();
227 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 227 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
228 228
229 UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password"); 229 UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password");
@@ -248,7 +248,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
248 248
249 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 249 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
250 250
251 Scene scene = SceneSetupHelpers.SetupScene("Inventory"); 251 Scene scene = SceneSetupHelpers.SetupScene();
252 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 252 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
253 253
254 // Create user 254 // Create user
@@ -327,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
327 TestHelper.InMethod(); 327 TestHelper.InMethod();
328// log4net.Config.XmlConfigurator.Configure(); 328// log4net.Config.XmlConfigurator.Configure();
329 329
330 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 330 Scene scene = SceneSetupHelpers.SetupScene();
331 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); 331 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
332 332
333 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); 333 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
@@ -394,7 +394,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
394 TestHelper.InMethod(); 394 TestHelper.InMethod();
395 //log4net.Config.XmlConfigurator.Configure(); 395 //log4net.Config.XmlConfigurator.Configure();
396 396
397 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 397 Scene scene = SceneSetupHelpers.SetupScene();
398 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); 398 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
399 399
400 string folder1ExistingName = "a"; 400 string folder1ExistingName = "a";
@@ -445,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
445 TestHelper.InMethod(); 445 TestHelper.InMethod();
446// log4net.Config.XmlConfigurator.Configure(); 446// log4net.Config.XmlConfigurator.Configure();
447 447
448 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 448 Scene scene = SceneSetupHelpers.SetupScene();
449 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); 449 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
450 450
451 string folder1ExistingName = "a"; 451 string folder1ExistingName = "a";
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 4565d10..8c99983 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -129,35 +129,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
129 } 129 }
130 130
131 /// 131 ///
132 /// DeleteToInventory 132 /// Used in DeleteToInventory
133 /// 133 ///
134 public override UUID DeleteToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) 134 protected override void ExportAsset(UUID agentID, UUID assetID)
135 { 135 {
136 UUID ret = UUID.Zero;
137
138 // HACK: Only works for lists of length one.
139 // Intermediate version, just to make things compile
140 foreach (SceneObjectGroup g in objectGroups)
141 ret = DeleteToInventory(action, folderID, g, remoteClient);
142
143 return ret;
144 }
145
146 // DO NOT OVERRIDE THE BASE METHOD
147 public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
148 SceneObjectGroup objectGroup, IClientAPI remoteClient)
149 {
150 UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient);
151
152 if (!assetID.Equals(UUID.Zero)) 136 if (!assetID.Equals(UUID.Zero))
153 { 137 UploadInventoryItem(agentID, assetID, "", 0);
154 if (remoteClient != null)
155 UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
156 }
157 else 138 else
158 m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); 139 m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
159
160 return assetID;
161 } 140 }
162 141
163 /// 142 ///
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index c0946f4..a716326 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -274,238 +274,278 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
274 foreach (SceneObjectGroup objectGroup in objlist) 274 foreach (SceneObjectGroup objectGroup in objlist)
275 objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; 275 objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
276 276
277 // Get the user info of the item destination 277 InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID);
278 // 278 if (item == null)
279 UUID userID = UUID.Zero; 279 return UUID.Zero;
280 280
281 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || 281 // Can't know creator is the same, so null it in inventory
282 action == DeRezAction.SaveToExistingUserInventoryItem) 282 if (objlist.Count > 1)
283 { 283 {
284 // Take or take copy require a taker 284 item.CreatorId = UUID.Zero.ToString();
285 // Saving changes requires a local user 285 item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems;
286 //
287 if (remoteClient == null)
288 return UUID.Zero;
289
290 userID = remoteClient.AgentId;
291 } 286 }
292 else 287 else
293 { 288 {
294 // All returns / deletes go to the object owner 289 item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
295 // 290 item.SaleType = objlist[0].RootPart.ObjectSaleType;
296 userID = objlist[0].RootPart.OwnerID; 291 item.SalePrice = objlist[0].RootPart.SalePrice;
297 } 292 }
298 293
299 if (userID == UUID.Zero) // Can't proceed 294 AssetBase asset = CreateAsset(
300 { 295 objlist[0].GetPartName(objlist[0].RootPart.LocalId),
301 return UUID.Zero; 296 objlist[0].GetPartDescription(objlist[0].RootPart.LocalId),
302 } 297 (sbyte)AssetType.Object,
303 298 Utils.StringToBytes(itemXml),
304 // If we're returning someone's item, it goes back to the 299 objlist[0].OwnerID.ToString());
305 // owner's Lost And Found folder. 300 m_Scene.AssetService.Store(asset);
306 // Delete is treated like return in this case
307 // Deleting your own items makes them go to trash
308 //
309 301
310 InventoryFolderBase folder = null; 302 item.AssetID = asset.FullID;
311 InventoryItemBase item = null; 303 assetID = asset.FullID;
312 304
313 if (DeRezAction.SaveToExistingUserInventoryItem == action) 305 if (DeRezAction.SaveToExistingUserInventoryItem == action)
314 { 306 {
315 item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); 307 m_Scene.InventoryService.UpdateItem(item);
316 item = m_Scene.InventoryService.GetItem(item);
317
318 //item = userInfo.RootFolder.FindItem(
319 // objectGroup.RootPart.FromUserInventoryItemID);
320
321 if (null == item)
322 {
323 m_log.DebugFormat(
324 "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
325 objlist[0].Name, objlist[0].UUID);
326 return UUID.Zero;
327 }
328 } 308 }
329 else 309 else
330 { 310 {
331 // Folder magic 311 AddPermissions(item, objlist[0], objlist, remoteClient);
332 //
333 if (action == DeRezAction.Delete)
334 {
335 // Deleting someone else's item
336 //
337 if (remoteClient == null ||
338 objlist[0].OwnerID != remoteClient.AgentId)
339 {
340 312
341 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); 313 item.CreationDate = Util.UnixTimeSinceEpoch();
342 } 314 item.Description = asset.Description;
343 else 315 item.Name = asset.Name;
344 { 316 item.AssetType = asset.Type;
345 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
346 }
347 }
348 else if (action == DeRezAction.Return)
349 {
350 317
351 // Dump to lost + found unconditionally 318 m_Scene.AddInventoryItem(item);
352 //
353 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
354 }
355 319
356 if (folderID == UUID.Zero && folder == null) 320 if (remoteClient != null && item.Owner == remoteClient.AgentId)
357 { 321 {
358 if (action == DeRezAction.Delete) 322 remoteClient.SendInventoryItemCreateUpdate(item, 0);
359 {
360 // Deletes go to trash by default
361 //
362 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
363 }
364 else
365 {
366 if (remoteClient == null ||
367 objlist[0].OwnerID != remoteClient.AgentId)
368 {
369 // Taking copy of another person's item. Take to
370 // Objects folder.
371 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object);
372 }
373 else
374 {
375 // Catch all. Use lost & found
376 //
377
378 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
379 }
380 }
381 } 323 }
382 324 else
383 // Override and put into where it came from, if it came
384 // from anywhere in inventory
385 //
386 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
387 { 325 {
388 if (objlist[0].RootPart.FromFolderID != UUID.Zero) 326 ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner);
327 if (notifyUser != null)
389 { 328 {
390 InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); 329 notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
391 folder = m_Scene.InventoryService.GetFolder(f);
392 } 330 }
393 } 331 }
332 }
394 333
395 if (folder == null) // None of the above 334 // This is a hook to do some per-asset post-processing for subclasses that need that
396 { 335 ExportAsset(remoteClient.AgentId, assetID);
397 folder = new InventoryFolderBase(folderID); 336 }
337
338 return assetID;
339 }
398 340
399 if (folder == null) // Nowhere to put it 341 protected virtual void ExportAsset(UUID agentID, UUID assetID)
400 { 342 {
401 return UUID.Zero; 343 // nothing to do here
402 } 344 }
403 }
404 345
405 item = new InventoryItemBase(); 346 /// <summary>
406 // Can't know creator is the same, so null it in inventory 347 /// Add relevant permissions for an object to the item.
407 if (objlist.Count > 1) 348 /// </summary>
408 item.CreatorId = UUID.Zero.ToString(); 349 /// <param name="item"></param>
409 else 350 /// <param name="so"></param>
410 item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); 351 /// <param name="objsForEffectivePermissions"></param>
411 item.ID = UUID.Random(); 352 /// <param name="remoteClient"></param>
412 item.InvType = (int)InventoryType.Object; 353 /// <returns></returns>
413 item.Folder = folder.ID; 354 protected InventoryItemBase AddPermissions(
414 item.Owner = userID; 355 InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions,
415 if (objlist.Count > 1) 356 IClientAPI remoteClient)
357 {
358 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7;
359 foreach (SceneObjectGroup grp in objsForEffectivePermissions)
360 effectivePerms &= grp.GetEffectivePermissions();
361 effectivePerms |= (uint)PermissionMask.Move;
362
363 if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
364 {
365 uint perms = effectivePerms;
366 uint nextPerms = (perms & 7) << 13;
367 if ((nextPerms & (uint)PermissionMask.Copy) == 0)
368 perms &= ~(uint)PermissionMask.Copy;
369 if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
370 perms &= ~(uint)PermissionMask.Transfer;
371 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
372 perms &= ~(uint)PermissionMask.Modify;
373
374 item.BasePermissions = perms & so.RootPart.NextOwnerMask;
375 item.CurrentPermissions = item.BasePermissions;
376 item.NextPermissions = perms & so.RootPart.NextOwnerMask;
377 item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
378 item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
379
380 // Magic number badness. Maybe this deserves an enum.
381 // bit 4 (16) is the "Slam" bit, it means treat as passed
382 // and apply next owner perms on rez
383 item.CurrentPermissions |= 16; // Slam!
384 }
385 else
386 {
387 item.BasePermissions = effectivePerms;
388 item.CurrentPermissions = effectivePerms;
389 item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms;
390 item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms;
391 item.GroupPermissions = so.RootPart.GroupMask & effectivePerms;
392
393 item.CurrentPermissions &=
394 ((uint)PermissionMask.Copy |
395 (uint)PermissionMask.Transfer |
396 (uint)PermissionMask.Modify |
397 (uint)PermissionMask.Move |
398 7); // Preserve folded permissions
399 }
400
401 return item;
402 }
403
404 /// <summary>
405 /// Create an item using details for the given scene object.
406 /// </summary>
407 /// <param name="action"></param>
408 /// <param name="remoteClient"></param>
409 /// <param name="so"></param>
410 /// <param name="folderID"></param>
411 /// <returns></returns>
412 protected InventoryItemBase CreateItemForObject(
413 DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID)
414 {
415 // Get the user info of the item destination
416 //
417 UUID userID = UUID.Zero;
418
419 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy ||
420 action == DeRezAction.SaveToExistingUserInventoryItem)
421 {
422 // Take or take copy require a taker
423 // Saving changes requires a local user
424 //
425 if (remoteClient == null)
426 return null;
427
428 userID = remoteClient.AgentId;
429 }
430 else
431 {
432 // All returns / deletes go to the object owner
433 //
434 userID = so.RootPart.OwnerID;
435 }
436
437 if (userID == UUID.Zero) // Can't proceed
438 {
439 return null;
440 }
441
442 // If we're returning someone's item, it goes back to the
443 // owner's Lost And Found folder.
444 // Delete is treated like return in this case
445 // Deleting your own items makes them go to trash
446 //
447
448 InventoryFolderBase folder = null;
449 InventoryItemBase item = null;
450
451 if (DeRezAction.SaveToExistingUserInventoryItem == action)
452 {
453 item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID);
454 item = m_Scene.InventoryService.GetItem(item);
455
456 //item = userInfo.RootFolder.FindItem(
457 // objectGroup.RootPart.FromUserInventoryItemID);
458
459 if (null == item)
460 {
461 m_log.DebugFormat(
462 "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
463 so.Name, so.UUID);
464
465 return null;
466 }
467 }
468 else
469 {
470 // Folder magic
471 //
472 if (action == DeRezAction.Delete)
473 {
474 // Deleting someone else's item
475 //
476 if (remoteClient == null ||
477 so.OwnerID != remoteClient.AgentId)
416 { 478 {
417 item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; 479 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
418 } 480 }
419 else 481 else
420 { 482 {
421 item.SaleType = objlist[0].RootPart.ObjectSaleType; 483 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
422 item.SalePrice = objlist[0].RootPart.SalePrice;
423 } 484 }
424 } 485 }
425 486 else if (action == DeRezAction.Return)
426 AssetBase asset = CreateAsset(
427 objlist[0].GetPartName(objlist[0].RootPart.LocalId),
428 objlist[0].GetPartDescription(objlist[0].RootPart.LocalId),
429 (sbyte)AssetType.Object,
430 Utils.StringToBytes(itemXml),
431 objlist[0].OwnerID.ToString());
432 m_Scene.AssetService.Store(asset);
433 assetID = asset.FullID;
434
435 if (DeRezAction.SaveToExistingUserInventoryItem == action)
436 { 487 {
437 item.AssetID = asset.FullID; 488 // Dump to lost + found unconditionally
438 m_Scene.InventoryService.UpdateItem(item); 489 //
490 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
439 } 491 }
440 else
441 {
442 item.AssetID = asset.FullID;
443 492
444 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; 493 if (folderID == UUID.Zero && folder == null)
445 foreach (SceneObjectGroup grp in objlist) 494 {
446 effectivePerms &= grp.GetEffectivePermissions(); 495 if (action == DeRezAction.Delete)
447 effectivePerms |= (uint)PermissionMask.Move;
448
449 if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
450 { 496 {
451 uint perms = effectivePerms; 497 // Deletes go to trash by default
452 uint nextPerms = (perms & 7) << 13; 498 //
453 if ((nextPerms & (uint)PermissionMask.Copy) == 0) 499 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
454 perms &= ~(uint)PermissionMask.Copy;
455 if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
456 perms &= ~(uint)PermissionMask.Transfer;
457 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
458 perms &= ~(uint)PermissionMask.Modify;
459
460 item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask;
461 item.CurrentPermissions = item.BasePermissions;
462 item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask;
463 item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask;
464 item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask;
465
466 // Magic number badness. Maybe this deserves an enum.
467 // bit 4 (16) is the "Slam" bit, it means treat as passed
468 // and apply next owner perms on rez
469 item.CurrentPermissions |= 16; // Slam!
470 } 500 }
471 else 501 else
472 { 502 {
473 item.BasePermissions = effectivePerms; 503 if (remoteClient == null || so.OwnerID != remoteClient.AgentId)
474 item.CurrentPermissions = effectivePerms; 504 {
475 item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; 505 // Taking copy of another person's item. Take to
476 item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; 506 // Objects folder.
477 item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; 507 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object);
478 508 }
479 item.CurrentPermissions &= 509 else
480 ((uint)PermissionMask.Copy | 510 {
481 (uint)PermissionMask.Transfer | 511 // Catch all. Use lost & found
482 (uint)PermissionMask.Modify | 512 //
483 (uint)PermissionMask.Move |
484 7); // Preserve folded permissions
485 }
486
487 item.CreationDate = Util.UnixTimeSinceEpoch();
488 item.Description = asset.Description;
489 item.Name = asset.Name;
490 item.AssetType = asset.Type;
491 513
492 m_Scene.AddInventoryItem(item); 514 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
515 }
516 }
517 }
493 518
494 if (remoteClient != null && item.Owner == remoteClient.AgentId) 519 // Override and put into where it came from, if it came
520 // from anywhere in inventory
521 //
522 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
523 {
524 if (so.RootPart.FromFolderID != UUID.Zero)
495 { 525 {
496 remoteClient.SendInventoryItemCreateUpdate(item, 0); 526 InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID);
527 folder = m_Scene.InventoryService.GetFolder(f);
497 } 528 }
498 else 529 }
530
531 if (folder == null) // None of the above
532 {
533 folder = new InventoryFolderBase(folderID);
534
535 if (folder == null) // Nowhere to put it
499 { 536 {
500 ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); 537 return null;
501 if (notifyUser != null)
502 {
503 notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
504 }
505 } 538 }
506 } 539 }
507 } 540
508 return assetID; 541 item = new InventoryItemBase();
542 item.ID = UUID.Random();
543 item.InvType = (int)InventoryType.Object;
544 item.Folder = folder.ID;
545 item.Owner = userID;
546 }
547
548 return item;
509 } 549 }
510 550
511 /// <summary> 551 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
index c76a30a..8d53cf1 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
66 config.AddConfig("Modules"); 66 config.AddConfig("Modules");
67 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); 67 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
68 68
69 m_scene = SceneSetupHelpers.SetupScene("Inventory"); 69 m_scene = SceneSetupHelpers.SetupScene();
70 SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam); 70 SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam);
71 71
72 // Create user 72 // Create user
@@ -87,41 +87,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
87// log4net.Config.XmlConfigurator.Configure(); 87// log4net.Config.XmlConfigurator.Configure();
88 88
89 // Create asset 89 // Create asset
90 SceneObjectGroup object1; 90 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20);
91 { 91 object1.AbsolutePosition = new Vector3(15, 30, 45);
92 string partName = "Object1"; 92
93 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); 93 SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40);
94 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); 94 object2.AbsolutePosition = new Vector3(25, 50, 75);
95 Vector3 groupPosition = new Vector3(10, 20, 30);
96 Quaternion rotationOffset = Quaternion.Identity;
97 Vector3 offsetPosition = new Vector3(5, 10, 15);
98
99 SceneObjectPart part1
100 = new SceneObjectPart(
101 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
102 part1.Scale = new Vector3(1, 1, 1);
103 part1.Name = partName;
104
105 object1 = new SceneObjectGroup(part1);
106 }
107
108 SceneObjectGroup object2;
109 {
110 string partName = "Object2";
111 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
112 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
113 Vector3 groupPosition = new Vector3(20, 40, 60);
114 Quaternion rotationOffset = Quaternion.Identity;
115 Vector3 offsetPosition = new Vector3(5, 10, 15);
116
117 SceneObjectPart part1
118 = new SceneObjectPart(
119 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
120 part1.Scale = new Vector3(1, 1, 1);
121 part1.Name = partName;
122
123 object2 = new SceneObjectGroup(part1);
124 }
125 95
126 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); 96 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);
127 97
@@ -173,23 +143,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
173// log4net.Config.XmlConfigurator.Configure(); 143// log4net.Config.XmlConfigurator.Configure();
174 144
175 // Create asset 145 // Create asset
176 SceneObjectGroup object1; 146 SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40);
177 SceneObjectPart part1;
178 {
179 string partName = "My Little Dog Object";
180 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
181 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
182 Vector3 groupPosition = new Vector3(10, 20, 30);
183 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
184 Vector3 offsetPosition = new Vector3(5, 10, 15);
185
186 part1
187 = new SceneObjectPart(
188 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
189 part1.Name = partName;
190
191 object1 = new SceneObjectGroup(part1);
192 }
193 147
194 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 148 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
195 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); 149 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index 1b3419d..51d1d59 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -195,6 +195,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
195 195
196 public byte[] GetData(string id) 196 public byte[] GetData(string id)
197 { 197 {
198// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Requesting data for asset {0}", id);
199
198 AssetBase asset = m_Cache.Get(id); 200 AssetBase asset = m_Cache.Get(id);
199 201
200 if (asset != null) 202 if (asset != null)
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index dafaa0c..a866fd9 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
237 public void Init() 237 public void Init()
238 { 238 {
239 m_serialiserModule = new SerialiserModule(); 239 m_serialiserModule = new SerialiserModule();
240 m_scene = SceneSetupHelpers.SetupScene(""); 240 m_scene = SceneSetupHelpers.SetupScene();
241 SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); 241 SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule);
242 } 242 }
243 243
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 30563d4..19a9506 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -296,11 +296,14 @@ namespace OpenSim.Region.Framework.Scenes
296 { 296 {
297 Vector3 val = value; 297 Vector3 val = value;
298 298
299 if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) 299 if (Scene != null)
300 || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
301 && !IsAttachmentCheckFull() && (!m_scene.LoadingPrims))
302 { 300 {
303 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 301 if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
302 || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
303 && !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
304 {
305 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
306 }
304 } 307 }
305 308
306 if (RootPart.GetStatusSandbox()) 309 if (RootPart.GetStatusSandbox())
@@ -308,8 +311,11 @@ namespace OpenSim.Region.Framework.Scenes
308 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) 311 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
309 { 312 {
310 RootPart.ScriptSetPhysicsStatus(false); 313 RootPart.ScriptSetPhysicsStatus(false);
311 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), 314
312 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); 315 if (Scene != null)
316 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
317 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
318
313 return; 319 return;
314 } 320 }
315 } 321 }
@@ -326,7 +332,8 @@ namespace OpenSim.Region.Framework.Scenes
326 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 332 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
327 //} 333 //}
328 334
329 m_scene.EventManager.TriggerParcelPrimCountTainted(); 335 if (Scene != null)
336 Scene.EventManager.TriggerParcelPrimCountTainted();
330 } 337 }
331 } 338 }
332 339
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
index a0e120a..babcb54 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -55,11 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
55 /// <param name="coa"></param> 55 /// <param name="coa"></param>
56 /// <returns></returns> 56 /// <returns></returns>
57 public static string ToXml(CoalescedSceneObjects coa) 57 public static string ToXml(CoalescedSceneObjects coa)
58 { 58 {
59 // TODO: Should probably return an empty xml serialization rather than a blank string
60 if (!coa.HasObjects)
61 return "";
62
63 using (StringWriter sw = new StringWriter()) 59 using (StringWriter sw = new StringWriter())
64 { 60 {
65 using (XmlTextWriter writer = new XmlTextWriter(sw)) 61 using (XmlTextWriter writer = new XmlTextWriter(sw))
@@ -105,10 +101,49 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
105 101
106 string output = sw.ToString(); 102 string output = sw.ToString();
107 103
108// m_log.Debug(output); 104// Console.WriteLine(output);
109 105
110 return output; 106 return output;
111 } 107 }
112 } 108 }
109
110 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa)
111 {
112// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
113
114 coa = null;
115
116 using (StringReader sr = new StringReader(xml))
117 {
118 using (XmlTextReader reader = new XmlTextReader(sr))
119 {
120 reader.Read();
121 if (reader.Name != "CoalescedObject")
122 {
123// m_log.DebugFormat(
124// "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false",
125// reader.Name);
126
127 return false;
128 }
129
130 coa = new CoalescedSceneObjects(UUID.Zero);
131 reader.Read();
132
133 while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject")
134 {
135 if (reader.Name == "SceneObjectGroup")
136 {
137 string soXml = reader.ReadOuterXml();
138 coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml));
139 }
140 }
141
142 reader.ReadEndElement(); // CoalescedObject
143 }
144 }
145
146 return true;
147 }
113 } 148 }
114} \ No newline at end of file 149} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
index 8588f7f..dd28416 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
@@ -117,11 +117,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
117 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); 117 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
118 118
119 119
120 Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, "grid"); 120 Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
121 SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); 121 SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
122 sceneB.RegisterRegionWithGrid(); 122 sceneB.RegisterRegionWithGrid();
123 123
124 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, "grid"); 124 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000);
125 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); 125 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
126 sceneA.RegisterRegionWithGrid(); 126 sceneA.RegisterRegionWithGrid();
127 127
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 8138bcc..2aef4b0 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Tests
101 TestHelper.InMethod(); 101 TestHelper.InMethod();
102// log4net.Config.XmlConfigurator.Configure(); 102// log4net.Config.XmlConfigurator.Configure();
103 103
104 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 104 Scene scene = SceneSetupHelpers.SetupScene();
105 UserAccount user1 = CreateUser(scene); 105 UserAccount user1 = CreateUser(scene);
106 SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); 106 SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
107 SceneObjectPart sop1 = sog1.RootPart; 107 SceneObjectPart sop1 = sog1.RootPart;
@@ -127,7 +127,7 @@ namespace OpenSim.Region.Framework.Tests
127 TestHelper.InMethod(); 127 TestHelper.InMethod();
128// log4net.Config.XmlConfigurator.Configure(); 128// log4net.Config.XmlConfigurator.Configure();
129 129
130 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 130 Scene scene = SceneSetupHelpers.SetupScene();
131 UserAccount user1 = CreateUser(scene); 131 UserAccount user1 = CreateUser(scene);
132 SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); 132 SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
133 SceneObjectPart sop1 = sog1.RootPart; 133 SceneObjectPart sop1 = sog1.RootPart;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 6b70865..dbf9e0f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -47,7 +47,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
47 [SetUp] 47 [SetUp]
48 public void Init() 48 public void Init()
49 { 49 {
50 m_assetService = new MockAssetService(); 50 // FIXME: We don't need a full scene here - it would be enough to set up the asset service.
51 Scene scene = SceneSetupHelpers.SetupScene();
52 m_assetService = scene.AssetService;
51 m_uuidGatherer = new UuidGatherer(m_assetService); 53 m_uuidGatherer = new UuidGatherer(m_assetService);
52 } 54 }
53 55
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index a81af43..e1f90b6 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -89,6 +89,8 @@ namespace OpenSim.Services.AssetService
89 89
90 public virtual AssetBase Get(string id) 90 public virtual AssetBase Get(string id)
91 { 91 {
92// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
93
92 UUID assetID; 94 UUID assetID;
93 95
94 if (!UUID.TryParse(id, out assetID)) 96 if (!UUID.TryParse(id, out assetID))
@@ -107,6 +109,8 @@ namespace OpenSim.Services.AssetService
107 109
108 public virtual AssetMetadata GetMetadata(string id) 110 public virtual AssetMetadata GetMetadata(string id)
109 { 111 {
112// m_log.DebugFormat("[ASSET SERVICE]: Get asset metadata for {0}", id);
113
110 UUID assetID; 114 UUID assetID;
111 115
112 if (!UUID.TryParse(id, out assetID)) 116 if (!UUID.TryParse(id, out assetID))
@@ -121,6 +125,8 @@ namespace OpenSim.Services.AssetService
121 125
122 public virtual byte[] GetData(string id) 126 public virtual byte[] GetData(string id)
123 { 127 {
128// m_log.DebugFormat("[ASSET SERVICE]: Get asset data for {0}", id);
129
124 UUID assetID; 130 UUID assetID;
125 131
126 if (!UUID.TryParse(id, out assetID)) 132 if (!UUID.TryParse(id, out assetID))
@@ -150,7 +156,9 @@ namespace OpenSim.Services.AssetService
150 156
151 public virtual string Store(AssetBase asset) 157 public virtual string Store(AssetBase asset)
152 { 158 {
153 //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); 159// m_log.DebugFormat(
160// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length);
161
154 m_Database.StoreAsset(asset); 162 m_Database.StoreAsset(asset);
155 163
156 return asset.ID; 164 return asset.ID;
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs
index 3be6815..1ac1cec 100644
--- a/OpenSim/Services/Interfaces/IAssetService.cs
+++ b/OpenSim/Services/Interfaces/IAssetService.cs
@@ -48,6 +48,11 @@ namespace OpenSim.Services.Interfaces
48 /// <returns></returns> 48 /// <returns></returns>
49 AssetMetadata GetMetadata(string id); 49 AssetMetadata GetMetadata(string id);
50 50
51 /// <summary>
52 /// Get an asset's data, ignoring the metadata.
53 /// </summary>
54 /// <param name="id"></param>
55 /// <returns>null if there is no such asset</returns>
51 byte[] GetData(string id); 56 byte[] GetData(string id);
52 57
53 /// <summary> 58 /// <summary>
diff --git a/OpenSim/Tests/Common/Mock/MockAssetService.cs b/OpenSim/Tests/Common/Mock/MockAssetService.cs
deleted file mode 100644
index 4118308..0000000
--- a/OpenSim/Tests/Common/Mock/MockAssetService.cs
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Data;
35using OpenSim.Services.Interfaces;
36using Nini.Config;
37
38namespace OpenSim.Tests.Common.Mock
39{
40 public class MockAssetService : IAssetService
41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>();
45
46 public MockAssetService() {}
47
48 /// <summary>
49 /// This constructor is required if the asset service is being created reflectively (which is the case in some
50 /// tests).
51 /// </summary>
52 /// <param name="config"></param>
53 public MockAssetService(IConfigSource config) {}
54
55 public AssetBase Get(string id)
56 {
57 m_log.DebugFormat("[MOCK ASSET SERVICE]: Getting asset with id {0}", id);
58
59 AssetBase asset;
60 if (Assets.ContainsKey(id))
61 asset = Assets[id];
62 else
63 asset = null;
64
65 return asset;
66 }
67
68 public AssetBase GetCached(string id)
69 {
70 return Get(id);
71 }
72
73 public AssetMetadata GetMetadata(string id)
74 {
75 throw new System.NotImplementedException();
76 }
77
78 public byte[] GetData(string id)
79 {
80 throw new System.NotImplementedException();
81 }
82
83 public bool Get(string id, object sender, AssetRetrieved handler)
84 {
85 handler(id, sender, Get(id));
86
87 return true;
88 }
89
90 public string Store(AssetBase asset)
91 {
92 m_log.DebugFormat("[MOCK ASSET SERVICE]: Storing asset {0}", asset.ID);
93
94 Assets[asset.ID] = asset;
95
96 return asset.ID;
97 }
98
99 public bool UpdateContent(string id, byte[] data)
100 {
101 throw new System.NotImplementedException();
102 }
103
104 public bool Delete(string id)
105 {
106 throw new System.NotImplementedException();
107 }
108 }
109} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/MockInventoryService.cs b/OpenSim/Tests/Common/Mock/MockInventoryService.cs
deleted file mode 100644
index 4ac1078..0000000
--- a/OpenSim/Tests/Common/Mock/MockInventoryService.cs
+++ /dev/null
@@ -1,186 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Framework;
32using OpenMetaverse;
33using OpenSim.Services.Interfaces;
34using Nini.Config;
35
36namespace OpenSim.Tests.Common.Mock
37{
38 public class MockInventoryService : IInventoryService
39 {
40 public MockInventoryService() {}
41
42 public MockInventoryService(IConfigSource config) {}
43
44 /// <summary>
45 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
46 /// </summary>
47 /// <param name="userId"></param>
48 /// <returns></returns>
49 public bool CreateUserInventory(UUID userId)
50 {
51 return false;
52 }
53
54 /// <summary>
55 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
56 /// </summary>
57 /// <param name="userId"></param>
58 /// <returns></returns>
59 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
60 {
61 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
62 InventoryFolderBase folder = new InventoryFolderBase();
63 folder.ID = UUID.Random();
64 folder.Owner = userId;
65 folders.Add(folder);
66 return folders;
67 }
68
69 public InventoryFolderBase GetRootFolder(UUID userID)
70 {
71 return new InventoryFolderBase();
72 }
73
74 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
75 {
76 return null;
77 }
78
79 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
80 {
81 return null;
82 }
83
84 /// <summary>
85 /// Returns a list of all the active gestures in a user's inventory.
86 /// </summary>
87 /// <param name="userId">
88 /// The <see cref="UUID"/> of the user
89 /// </param>
90 /// <returns>
91 /// A flat list of the gesture items.
92 /// </returns>
93 public List<InventoryItemBase> GetActiveGestures(UUID userId)
94 {
95 return null;
96 }
97
98 public InventoryCollection GetUserInventory(UUID userID)
99 {
100 return null;
101 }
102
103 public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback)
104 {
105 }
106
107 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
108 {
109 return null;
110 }
111
112 public bool AddFolder(InventoryFolderBase folder)
113 {
114 return false;
115 }
116
117 public bool UpdateFolder(InventoryFolderBase folder)
118 {
119 return false;
120 }
121
122 public bool MoveFolder(InventoryFolderBase folder)
123 {
124 return false;
125 }
126
127 public bool DeleteFolders(UUID ownerID, List<UUID> ids)
128 {
129 return false;
130 }
131
132 public bool PurgeFolder(InventoryFolderBase folder)
133 {
134 return false;
135 }
136
137 public bool AddItem(InventoryItemBase item)
138 {
139 return true;
140 }
141
142 public bool UpdateItem(InventoryItemBase item)
143 {
144 return false;
145 }
146
147 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
148 {
149 return false;
150 }
151
152 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
153 {
154 return false;
155 }
156
157 public InventoryItemBase GetItem(InventoryItemBase item)
158 {
159 return null;
160 }
161
162 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
163 {
164 return null;
165 }
166
167 public bool HasInventoryForUser(UUID userID)
168 {
169 return false;
170 }
171
172 public InventoryFolderBase RequestRootFolder(UUID userID)
173 {
174 InventoryFolderBase root = new InventoryFolderBase();
175 root.ID = UUID.Random();
176 root.Owner = userID;
177 root.ParentID = UUID.Zero;
178 return root;
179 }
180
181 public int GetAssetPermissions(UUID userID, UUID assetID)
182 {
183 return 1;
184 }
185 }
186} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index af66d7f..d572249 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -30,6 +30,7 @@ using OpenMetaverse;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Scenes.Serialization; 32using OpenSim.Region.Framework.Scenes.Serialization;
33using OpenSim.Services.Interfaces;
33 34
34namespace OpenSim.Tests.Common 35namespace OpenSim.Tests.Common
35{ 36{
@@ -55,7 +56,7 @@ namespace OpenSim.Tests.Common
55 AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); 56 AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
56 scene.AssetService.Store(asset); 57 scene.AssetService.Store(asset);
57 return asset; 58 return asset;
58 } 59 }
59 60
60 /// <summary> 61 /// <summary>
61 /// Create an asset from the given scene object. 62 /// Create an asset from the given scene object.
@@ -75,6 +76,20 @@ namespace OpenSim.Tests.Common
75 /// <summary> 76 /// <summary>
76 /// Create an asset from the given scene object. 77 /// Create an asset from the given scene object.
77 /// </summary> 78 /// </summary>
79 /// <param name="assetUuidTailZ">
80 /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
81 /// will be used.
82 /// </param>
83 /// <param name="coa"></param>
84 /// <returns></returns>
85 public static AssetBase CreateAsset(int assetUuidTail, CoalescedSceneObjects coa)
86 {
87 return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), coa);
88 }
89
90 /// <summary>
91 /// Create an asset from the given scene object.
92 /// </summary>
78 /// <param name="assetUuid"></param> 93 /// <param name="assetUuid"></param>
79 /// <param name="coa"></param> 94 /// <param name="coa"></param>
80 /// <returns></returns> 95 /// <returns></returns>
@@ -85,7 +100,7 @@ namespace OpenSim.Tests.Common
85 AssetType.Object, 100 AssetType.Object,
86 Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)), 101 Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)),
87 coa.CreatorId); 102 coa.CreatorId);
88 } 103 }
89 104
90 /// <summary> 105 /// <summary>
91 /// Create an asset from the given data. 106 /// Create an asset from the given data.
@@ -104,5 +119,11 @@ namespace OpenSim.Tests.Common
104 asset.Data = data; 119 asset.Data = data;
105 return asset; 120 return asset;
106 } 121 }
122
123 public static string ReadAssetAsString(IAssetService assetService, UUID uuid)
124 {
125 byte[] assetData = assetService.GetData(uuid.ToString());
126 return Encoding.ASCII.GetString(assetData);
127 }
107 } 128 }
108} 129}
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 709dd78..99517d2 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -66,32 +66,7 @@ namespace OpenSim.Tests.Common.Setup
66 /// <returns></returns> 66 /// <returns></returns>
67 public static TestScene SetupScene() 67 public static TestScene SetupScene()
68 { 68 {
69 return SetupScene(""); 69 return SetupScene("Unit test region", UUID.Random(), 1000, 1000);
70 }
71
72 /// <summary>
73 /// Set up a test scene
74 /// </summary>
75 ///
76 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
77 /// <returns></returns>
78 public static TestScene SetupScene(String realServices)
79 {
80 return SetupScene("Unit test region", UUID.Random(), 1000, 1000, realServices);
81 }
82
83 /// <summary>
84 /// Set up a test scene
85 /// </summary>
86 /// <param name="name">Name of the region</param>
87 /// <param name="id">ID of the region</param>
88 /// <param name="x">X co-ordinate of the region</param>
89 /// <param name="y">Y co-ordinate of the region</param>
90 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
91 /// <returns></returns>
92 public static TestScene SetupScene(string name, UUID id, uint x, uint y)
93 {
94 return SetupScene(name, id, x, y, "");
95 } 70 }
96 71
97 /// <summary> 72 /// <summary>
@@ -103,10 +78,8 @@ namespace OpenSim.Tests.Common.Setup
103 /// <param name="x">X co-ordinate of the region</param> 78 /// <param name="x">X co-ordinate of the region</param>
104 /// <param name="y">Y co-ordinate of the region</param> 79 /// <param name="y">Y co-ordinate of the region</param>
105 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> 80 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
106 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
107 /// <returns></returns> 81 /// <returns></returns>
108 public static TestScene SetupScene( 82 public static TestScene SetupScene(string name, UUID id, uint x, uint y)
109 string name, UUID id, uint x, uint y, String realServices)
110 { 83 {
111 Console.WriteLine("Setting up test scene {0}", name); 84 Console.WriteLine("Setting up test scene {0}", name);
112 85
@@ -130,15 +103,11 @@ namespace OpenSim.Tests.Common.Setup
130 IRegionModule godsModule = new GodsModule(); 103 IRegionModule godsModule = new GodsModule();
131 godsModule.Initialise(testScene, new IniConfigSource()); 104 godsModule.Initialise(testScene, new IniConfigSource());
132 testScene.AddModule(godsModule.Name, godsModule); 105 testScene.AddModule(godsModule.Name, godsModule);
133 realServices = realServices.ToLower();
134
135 LocalAssetServicesConnector assetService = StartAssetService(testScene, realServices.Contains("asset"));
136
137 // For now, always started a 'real' authentication service
138 StartAuthenticationService(testScene, true);
139 106
140 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory")); 107 LocalAssetServicesConnector assetService = StartAssetService(testScene);
141 StartGridService(testScene, true); 108 StartAuthenticationService(testScene);
109 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene);
110 StartGridService(testScene);
142 LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); 111 LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
143 LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); 112 LocalPresenceServicesConnector presenceService = StartPresenceService(testScene);
144 113
@@ -164,18 +133,17 @@ namespace OpenSim.Tests.Common.Setup
164 return testScene; 133 return testScene;
165 } 134 }
166 135
167 private static LocalAssetServicesConnector StartAssetService(Scene testScene, bool real) 136 private static LocalAssetServicesConnector StartAssetService(Scene testScene)
168 { 137 {
169 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); 138 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
170 IConfigSource config = new IniConfigSource(); 139 IConfigSource config = new IniConfigSource();
171 config.AddConfig("Modules"); 140
141 config.AddConfig("Modules");
142 config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
172 config.AddConfig("AssetService"); 143 config.AddConfig("AssetService");
173 config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); 144 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
174 if (real)
175 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
176 else
177 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
178 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 145 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
146
179 assetService.Initialise(config); 147 assetService.Initialise(config);
180 assetService.AddRegion(testScene); 148 assetService.AddRegion(testScene);
181 assetService.RegionLoaded(testScene); 149 assetService.RegionLoaded(testScene);
@@ -184,20 +152,18 @@ namespace OpenSim.Tests.Common.Setup
184 return assetService; 152 return assetService;
185 } 153 }
186 154
187 private static void StartAuthenticationService(Scene testScene, bool real) 155 private static void StartAuthenticationService(Scene testScene)
188 { 156 {
189 ISharedRegionModule service = new LocalAuthenticationServicesConnector(); 157 ISharedRegionModule service = new LocalAuthenticationServicesConnector();
190 IConfigSource config = new IniConfigSource(); 158 IConfigSource config = new IniConfigSource();
159
191 config.AddConfig("Modules"); 160 config.AddConfig("Modules");
192 config.AddConfig("AuthenticationService"); 161 config.AddConfig("AuthenticationService");
193 config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); 162 config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector");
194 if (real) 163 config.Configs["AuthenticationService"].Set(
195 config.Configs["AuthenticationService"].Set( 164 "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
196 "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
197 else
198 config.Configs["AuthenticationService"].Set(
199 "LocalServiceModule", "OpenSim.Tests.Common.dll:MockAuthenticationService");
200 config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 165 config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
166
201 service.Initialise(config); 167 service.Initialise(config);
202 service.AddRegion(testScene); 168 service.AddRegion(testScene);
203 service.RegionLoaded(testScene); 169 service.RegionLoaded(testScene);
@@ -205,24 +171,17 @@ namespace OpenSim.Tests.Common.Setup
205 //m_authenticationService = service; 171 //m_authenticationService = service;
206 } 172 }
207 173
208 private static LocalInventoryServicesConnector StartInventoryService(Scene testScene, bool real) 174 private static LocalInventoryServicesConnector StartInventoryService(Scene testScene)
209 { 175 {
210 LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); 176 LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector();
211 IConfigSource config = new IniConfigSource(); 177
178 IConfigSource config = new IniConfigSource();
212 config.AddConfig("Modules"); 179 config.AddConfig("Modules");
213 config.AddConfig("InventoryService"); 180 config.AddConfig("InventoryService");
214 config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); 181 config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
215 182 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
216 if (real)
217 {
218 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
219 }
220 else
221 {
222 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService");
223 }
224
225 config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 183 config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
184
226 inventoryService.Initialise(config); 185 inventoryService.Initialise(config);
227 inventoryService.AddRegion(testScene); 186 inventoryService.AddRegion(testScene);
228 inventoryService.RegionLoaded(testScene); 187 inventoryService.RegionLoaded(testScene);
@@ -231,24 +190,19 @@ namespace OpenSim.Tests.Common.Setup
231 return inventoryService; 190 return inventoryService;
232 } 191 }
233 192
234 private static LocalGridServicesConnector StartGridService(Scene testScene, bool real) 193 private static LocalGridServicesConnector StartGridService(Scene testScene)
235 { 194 {
236 IConfigSource config = new IniConfigSource(); 195 IConfigSource config = new IniConfigSource();
237 config.AddConfig("Modules"); 196 config.AddConfig("Modules");
238 config.AddConfig("GridService"); 197 config.AddConfig("GridService");
239 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); 198 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
240 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); 199 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
241 if (real) 200 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
242 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
243 201
244 LocalGridServicesConnector gridService = new LocalGridServicesConnector(); 202 LocalGridServicesConnector gridService = new LocalGridServicesConnector();
245 gridService.Initialise(config); 203 gridService.Initialise(config);
246
247 //else
248 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
249 gridService.AddRegion(testScene); 204 gridService.AddRegion(testScene);
250 gridService.RegionLoaded(testScene); 205 gridService.RegionLoaded(testScene);
251 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
252 206
253 return gridService; 207 return gridService;
254 } 208 }
@@ -472,10 +426,10 @@ namespace OpenSim.Tests.Common.Setup
472 /// <param name="ownerId"></param> 426 /// <param name="ownerId"></param>
473 /// <returns></returns> 427 /// <returns></returns>
474 public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) 428 public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId)
475 { 429 {
476 return new SceneObjectPart( 430 return new SceneObjectPart(
477 ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 431 ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
478 { Name = name, UUID = id }; 432 { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) };
479 } 433 }
480 434
481 /// <summary> 435 /// <summary>