aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDr Scofield2008-10-30 15:26:23 +0000
committerDr Scofield2008-10-30 15:26:23 +0000
commit3a6037b4212818e53743b62e6a8ec5f7ac93e86d (patch)
tree2dcf2b24f0e692c8f0ddccf328d0eca9ec1e9974
parentFrom: Alan Webb (alan_webb@us.ibm.com) (diff)
downloadopensim-SC_OLD-3a6037b4212818e53743b62e6a8ec5f7ac93e86d.zip
opensim-SC_OLD-3a6037b4212818e53743b62e6a8ec5f7ac93e86d.tar.gz
opensim-SC_OLD-3a6037b4212818e53743b62e6a8ec5f7ac93e86d.tar.bz2
opensim-SC_OLD-3a6037b4212818e53743b62e6a8ec5f7ac93e86d.tar.xz
From: Alan Webb (alan_webb@us.ibm.com)
Cleanups in REST inventory and asset services.
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs8
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs22
2 files changed, 18 insertions, 12 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
index 2af26f2..bb76c1f 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
@@ -254,6 +254,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
254 bool modified = false; 254 bool modified = false;
255 bool created = false; 255 bool created = false;
256 256
257 AssetBase asset = null;
258
257 Rest.Log.DebugFormat("{0} REST Asset handler, Method = <{1}> ENTRY", MsgId, rdata.method); 259 Rest.Log.DebugFormat("{0} REST Asset handler, Method = <{1}> ENTRY", MsgId, rdata.method);
258 260
259 if (rdata.Parameters.Length == 1) 261 if (rdata.Parameters.Length == 1)
@@ -269,7 +271,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
269 } 271 }
270 272
271 UUID uuid = new UUID(rdata.Parameters[0]); 273 UUID uuid = new UUID(rdata.Parameters[0]);
272 AssetBase asset = Rest.AssetServices.GetAsset(uuid, false); 274 asset = Rest.AssetServices.GetAsset(uuid, false);
273 275
274 modified = (asset != null); 276 modified = (asset != null);
275 created = !modified; 277 created = !modified;
@@ -300,12 +302,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
300 302
301 if (created) 303 if (created)
302 { 304 {
305 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID));
303 rdata.Complete(Rest.HttpStatusCodeCreated); 306 rdata.Complete(Rest.HttpStatusCodeCreated);
304 } 307 }
305 else 308 else
306 { 309 {
307 if (modified) 310 if (modified)
308 { 311 {
312 rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID));
309 rdata.Complete(Rest.HttpStatusCodeOK); 313 rdata.Complete(Rest.HttpStatusCodeOK);
310 } 314 }
311 else 315 else
@@ -365,12 +369,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
365 369
366 if (created) 370 if (created)
367 { 371 {
372 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID));
368 rdata.Complete(Rest.HttpStatusCodeCreated); 373 rdata.Complete(Rest.HttpStatusCodeCreated);
369 } 374 }
370 else 375 else
371 { 376 {
372 if (modified) 377 if (modified)
373 { 378 {
379 rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID));
374 rdata.Complete(Rest.HttpStatusCodeOK); 380 rdata.Complete(Rest.HttpStatusCodeOK);
375 } 381 }
376 else 382 else
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index db7d1bd..a62a208 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -498,7 +498,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
498 Rest.AssetServices.AddAsset(asset); 498 Rest.AssetServices.AddAsset(asset);
499 499
500 created = true; 500 created = true;
501 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1}<p>", 501 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>",
502 asset.Name, asset.ID)); 502 asset.Name, asset.ID));
503 503
504 if (Rest.DEBUG && Rest.DumpAsset) 504 if (Rest.DEBUG && Rest.DumpAsset)
@@ -556,7 +556,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
556 Rest.InventoryServices.MoveFolder(folder); 556 Rest.InventoryServices.MoveFolder(folder);
557 557
558 modified = true; 558 modified = true;
559 rdata.appendStatus(String.Format("<p> Created folder {0}, UUID {1}<p>", 559 rdata.appendStatus(String.Format("<p> Created folder {0}, UUID {1} <p>",
560 folder.Name, folder.ID)); 560 folder.Name, folder.ID));
561 } 561 }
562 else 562 else
@@ -565,7 +565,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
565 Rest.InventoryServices.AddFolder(folder); 565 Rest.InventoryServices.AddFolder(folder);
566 566
567 created = true; 567 created = true;
568 rdata.appendStatus(String.Format("<p> Modified folder {0}, UUID {1}<p>", 568 rdata.appendStatus(String.Format("<p> Modified folder {0}, UUID {1} <p>",
569 folder.Name, folder.ID)); 569 folder.Name, folder.ID));
570 } 570 }
571 } 571 }
@@ -604,7 +604,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
604 MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name); 604 MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name);
605 Rest.InventoryServices.UpdateItem(item); 605 Rest.InventoryServices.UpdateItem(item);
606 modified = true; 606 modified = true;
607 rdata.appendStatus(String.Format("<p> Modified item {0}, UUID {1}<p>", item.Name, item.ID)); 607 rdata.appendStatus(String.Format("<p> Modified item {0}, UUID {1} <p>", item.Name, item.ID));
608 } 608 }
609 else 609 else
610 { 610 {
@@ -612,7 +612,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
612 MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name); 612 MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name);
613 Rest.InventoryServices.AddItem(item); 613 Rest.InventoryServices.AddItem(item);
614 created = true; 614 created = true;
615 rdata.appendStatus(String.Format("<p> Created item {2}, UUID {3}<p>", item.Name, item.ID)); 615 rdata.appendStatus(String.Format("<p> Created item {0}, UUID {1} <p>", item.Name, item.ID));
616 } 616 }
617 } 617 }
618 618
@@ -705,7 +705,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
705 Rest.AssetServices.AddAsset(asset); 705 Rest.AssetServices.AddAsset(asset);
706 706
707 created = true; 707 created = true;
708 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1}<p>", asset.Name, asset.ID)); 708 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.ID));
709 709
710 if (Rest.DEBUG && Rest.DumpAsset) 710 if (Rest.DEBUG && Rest.DumpAsset)
711 { 711 {
@@ -824,13 +824,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
824 824
825 foreach (InventoryFolderBase f in entity.Folders) 825 foreach (InventoryFolderBase f in entity.Folders)
826 { 826 {
827 rdata.appendStatus(String.Format("<p>Moving folder {0} UUID {1}<p>", f.Name, f.ID)); 827 rdata.appendStatus(String.Format("<p>Moving folder {0} UUID {1} <p>", f.Name, f.ID));
828 Rest.InventoryServices.MoveFolder(f); 828 Rest.InventoryServices.MoveFolder(f);
829 } 829 }
830 830
831 foreach (InventoryItemBase it in entity.Items) 831 foreach (InventoryItemBase it in entity.Items)
832 { 832 {
833 rdata.appendStatus(String.Format("<p>Storing item {0} UUID {1}<p>", it.Name, it.ID)); 833 rdata.appendStatus(String.Format("<p>Storing item {0} UUID {1} <p>", it.Name, it.ID));
834 Rest.InventoryServices.AddItem(it); 834 Rest.InventoryServices.AddItem(it);
835 } 835 }
836 } 836 }
@@ -881,7 +881,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
881 881
882 Rest.InventoryServices.AddItem(xml); 882 Rest.InventoryServices.AddItem(xml);
883 883
884 rdata.appendStatus(String.Format("<p>Storing item {0} UUID {1}<p>", xml.Name, xml.ID)); 884 rdata.appendStatus(String.Format("<p>Storing item {0} UUID {1} <p>", xml.Name, xml.ID));
885 } 885 }
886 886
887 if (created) 887 if (created)
@@ -941,7 +941,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
941 Rest.InventoryServices.MoveFolder(folder); 941 Rest.InventoryServices.MoveFolder(folder);
942 Rest.InventoryServices.PurgeFolder(TrashCan); 942 Rest.InventoryServices.PurgeFolder(TrashCan);
943 943
944 rdata.appendStatus(String.Format("<p>Deleted folder {0} UUID {1}<p>", folder.Name, folder.ID)); 944 rdata.appendStatus(String.Format("<p>Deleted folder {0} UUID {1} <p>", folder.Name, folder.ID));
945 } 945 }
946 946
947 // Deleting items is much more straight forward. 947 // Deleting items is much more straight forward.
@@ -952,7 +952,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
952 Rest.Log.DebugFormat("{0} {1}: Item {2} will be deleted", 952 Rest.Log.DebugFormat("{0} {1}: Item {2} will be deleted",
953 MsgId, rdata.method, rdata.path); 953 MsgId, rdata.method, rdata.path);
954 Rest.InventoryServices.DeleteItem(item); 954 Rest.InventoryServices.DeleteItem(item);
955 rdata.appendStatus(String.Format("<p>Deleted item {0} UUID {1}<p>", item.Name, item.ID)); 955 rdata.appendStatus(String.Format("<p>Deleted item {0} UUID {1} <p>", item.Name, item.ID));
956 } 956 }
957 957
958 rdata.Complete(); 958 rdata.Complete();