aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs300
1 files changed, 116 insertions, 184 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index 61c3ac4..0c107d5 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -23,7 +23,6 @@
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */ 26 */
28 27
29using System; 28using System;
@@ -42,10 +41,8 @@ using Nini.Config;
42 41
43namespace OpenSim.ApplicationPlugins.Rest.Inventory 42namespace OpenSim.ApplicationPlugins.Rest.Inventory
44{ 43{
45
46 public class RestInventoryServices : IRest 44 public class RestInventoryServices : IRest
47 { 45 {
48
49 private bool enabled = false; 46 private bool enabled = false;
50 private string qPrefix = "inventory"; 47 private string qPrefix = "inventory";
51 48
@@ -56,11 +53,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
56 53
57 public RestInventoryServices() 54 public RestInventoryServices()
58 { 55 {
59
60 Rest.Log.InfoFormat("{0} Inventory services initializing", MsgId); 56 Rest.Log.InfoFormat("{0} Inventory services initializing", MsgId);
61 Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); 57 Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version);
62 58
63 // If a relative path was specified for the handler's domain, 59 // If a relative path was specified for the handler's domain,
64 // add the standard prefix to make it absolute, e.g. /admin 60 // add the standard prefix to make it absolute, e.g. /admin
65 61
66 if (!qPrefix.StartsWith(Rest.UrlPathSeparator)) 62 if (!qPrefix.StartsWith(Rest.UrlPathSeparator))
@@ -77,7 +73,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
77 enabled = true; 73 enabled = true;
78 74
79 Rest.Log.InfoFormat("{0} Inventory services initialization complete", MsgId); 75 Rest.Log.InfoFormat("{0} Inventory services initialization complete", MsgId);
80
81 } 76 }
82 77
83 /// <summary> 78 /// <summary>
@@ -91,7 +86,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
91 86
92 /// <summary> 87 /// <summary>
93 /// Called by the plug-in to halt REST processing. Local processing is 88 /// Called by the plug-in to halt REST processing. Local processing is
94 /// disabled, and control blocks until all current processing has 89 /// disabled, and control blocks until all current processing has
95 /// completed. No new processing will be started 90 /// completed. No new processing will be started
96 /// </summary> 91 /// </summary>
97 92
@@ -134,7 +129,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
134 129
135 private void DoInventory(RequestData hdata) 130 private void DoInventory(RequestData hdata)
136 { 131 {
137
138 InventoryRequestData rdata = (InventoryRequestData) hdata; 132 InventoryRequestData rdata = (InventoryRequestData) hdata;
139 133
140 Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId); 134 Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId);
@@ -146,7 +140,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
146 return; 140 return;
147 } 141 }
148 142
149 // Now that we know this is a serious attempt to 143 // Now that we know this is a serious attempt to
150 // access inventory data, we should find out who 144 // access inventory data, we should find out who
151 // is asking, and make sure they are authorized 145 // is asking, and make sure they are authorized
152 // to do so. We need to validate the caller's 146 // to do so. We need to validate the caller's
@@ -157,9 +151,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
157 // With the present HTTP server we can't use the 151 // With the present HTTP server we can't use the
158 // builtin authentication mechanisms because they 152 // builtin authentication mechanisms because they
159 // would be enforced for all in-bound requests. 153 // would be enforced for all in-bound requests.
160 // Instead we look at the headers ourselves and 154 // Instead we look at the headers ourselves and
161 // handle authentication directly. 155 // handle authentication directly.
162 156
163 try 157 try
164 { 158 {
165 if (!rdata.IsAuthenticated) 159 if (!rdata.IsAuthenticated)
@@ -197,7 +191,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
197 /// 191 ///
198 /// Indicating that this is an inventory request for 192 /// Indicating that this is an inventory request for
199 /// an avatar named Arthur Dent. This is ALl that is 193 /// an avatar named Arthur Dent. This is ALl that is
200 /// required to designate a GET for an entire 194 /// required to designate a GET for an entire
201 /// inventory. 195 /// inventory.
202 /// </remarks> 196 /// </remarks>
203 197
@@ -238,7 +232,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
238 232
239 if (rdata.userProfile != null) 233 if (rdata.userProfile != null)
240 { 234 {
241 Rest.Log.DebugFormat("{0} Profile obtained for agent {1} {2}", 235 Rest.Log.DebugFormat("{0} Profile obtained for agent {1} {2}",
242 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 236 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
243 } 237 }
244 else 238 else
@@ -260,18 +254,18 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
260 // response is not recieved in a timely fashion. 254 // response is not recieved in a timely fashion.
261 255
262 rdata.uuid = rdata.userProfile.ID; 256 rdata.uuid = rdata.userProfile.ID;
263 257
264 if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid)) 258 if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid))
265 { 259 {
266 260
267 rdata.root = Rest.InventoryServices.RequestRootFolder(rdata.uuid); 261 rdata.root = Rest.InventoryServices.RequestRootFolder(rdata.uuid);
268 262
269 Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}", 263 Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}",
270 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 264 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
271 265
272 Rest.InventoryServices.RequestInventoryForUser(rdata.uuid, rdata.GetUserInventory); 266 Rest.InventoryServices.RequestInventoryForUser(rdata.uuid, rdata.GetUserInventory);
273 267
274 Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}", 268 Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}",
275 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 269 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
276 270
277 lock (rdata) 271 lock (rdata)
@@ -284,15 +278,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
284 278
285 if (rdata.root == null) 279 if (rdata.root == null)
286 { 280 {
287 Rest.Log.DebugFormat("{0} Inventory is not available [1] for agent {1} {2}", 281 Rest.Log.DebugFormat("{0} Inventory is not available [1] for agent {1} {2}",
288 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 282 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
289 rdata.Fail(Rest.HttpStatusCodeServerError,Rest.HttpStatusDescServerError+": inventory retrieval failed"); 283 rdata.Fail(Rest.HttpStatusCodeServerError,Rest.HttpStatusDescServerError+": inventory retrieval failed");
290 } 284 }
291
292 } 285 }
293 else 286 else
294 { 287 {
295 Rest.Log.DebugFormat("{0} Inventory is not available for agent [3] {1} {2}", 288 Rest.Log.DebugFormat("{0} Inventory is not available for agent [3] {1} {2}",
296 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 289 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
297 rdata.Fail(Rest.HttpStatusCodeNotFound,Rest.HttpStatusDescNotFound+": no inventory for user"); 290 rdata.Fail(Rest.HttpStatusCodeNotFound,Rest.HttpStatusDescNotFound+": no inventory for user");
298 } 291 }
@@ -302,7 +295,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
302 295
303 switch (rdata.method) 296 switch (rdata.method)
304 { 297 {
305
306 case Rest.HEAD : // Do the processing, set the status code, suppress entity 298 case Rest.HEAD : // Do the processing, set the status code, suppress entity
307 DoGet(rdata); 299 DoGet(rdata);
308 rdata.buffer = null; 300 rdata.buffer = null;
@@ -325,13 +317,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
325 break; 317 break;
326 318
327 default : 319 default :
328 Rest.Log.DebugFormat("{0} Method {1} not supported for {2}", 320 Rest.Log.DebugFormat("{0} Method {1} not supported for {2}",
329 MsgId, rdata.method, rdata.path); 321 MsgId, rdata.method, rdata.path);
330 rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, 322 rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
331 Rest.HttpStatusDescMethodNotAllowed+": "+rdata.method+" not supported"); 323 Rest.HttpStatusDescMethodNotAllowed+": "+rdata.method+" not supported");
332 break; 324 break;
333 } 325 }
334
335 } 326 }
336 327
337 #endregion Interface 328 #endregion Interface
@@ -346,12 +337,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
346 337
347 private void DoGet(InventoryRequestData rdata) 338 private void DoGet(InventoryRequestData rdata)
348 { 339 {
349
350 rdata.initXmlWriter(); 340 rdata.initXmlWriter();
351 341
352 rdata.writer.WriteStartElement(String.Empty,"Inventory",String.Empty); 342 rdata.writer.WriteStartElement(String.Empty,"Inventory",String.Empty);
353 343
354 // If there was only one parameter, then the entire 344 // If there was only one parameter, then the entire
355 // inventory is being requested. 345 // inventory is being requested.
356 346
357 if (rdata.parameters.Length == 1) 347 if (rdata.parameters.Length == 1)
@@ -361,7 +351,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
361 351
362 // If there are additional parameters, then these represent 352 // If there are additional parameters, then these represent
363 // a path relative to the root of the inventory. This path 353 // a path relative to the root of the inventory. This path
364 // must be traversed before we format the sub-tree thus 354 // must be traversed before we format the sub-tree thus
365 // identified. 355 // identified.
366 356
367 else 357 else
@@ -373,9 +363,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
373 363
374 rdata.Complete(); 364 rdata.Complete();
375 rdata.Respond("Inventory " + rdata.method + ": Normal completion"); 365 rdata.Respond("Inventory " + rdata.method + ": Normal completion");
376
377 } 366 }
378 367
379 /// <summary> 368 /// <summary>
380 /// In the case of the inventory, and probably in general, 369 /// In the case of the inventory, and probably in general,
381 /// the distinction between PUT and POST is not always 370 /// the distinction between PUT and POST is not always
@@ -389,29 +378,28 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
389 /// The best way to exaplain the distinction is to 378 /// The best way to exaplain the distinction is to
390 /// consider the relationship between the URI and the 379 /// consider the relationship between the URI and the
391 /// entity in question. For POST, the URI identifies the 380 /// entity in question. For POST, the URI identifies the
392 /// entity to be modified or replaced. 381 /// entity to be modified or replaced.
393 /// If the operation is PUT,then the URI describes the 382 /// If the operation is PUT,then the URI describes the
394 /// context into which the new entity will be added. 383 /// context into which the new entity will be added.
395 /// 384 ///
396 /// As an example, suppose the URI contains: 385 /// As an example, suppose the URI contains:
397 /// /admin/inventory/Clothing 386 /// /admin/inventory/Clothing
398 /// 387 ///
399 /// A POST request will result in some modification of 388 /// A POST request will result in some modification of
400 /// the folder or item named "Clothing". Whereas a PUT 389 /// the folder or item named "Clothing". Whereas a PUT
401 /// request will add some new information into the 390 /// request will add some new information into the
402 /// content identified by Clothing. It follows from this 391 /// content identified by Clothing. It follows from this
403 /// that for PUT, the element identified by the URI must 392 /// that for PUT, the element identified by the URI must
404 /// be a folder. 393 /// be a folder.
405 /// </summary> 394 /// </summary>
406 395
407 /// <summary> 396 /// <summary>
408 /// PUT adds new information to the inventory in the 397 /// PUT adds new information to the inventory in the
409 /// context identified by the URI. 398 /// context identified by the URI.
410 /// </summary> 399 /// </summary>
411 400
412 private void DoPut(InventoryRequestData rdata) 401 private void DoPut(InventoryRequestData rdata)
413 { 402 {
414
415 // Resolve the context node specified in the URI. Entity 403 // Resolve the context node specified in the URI. Entity
416 // data will be ADDED beneath this node. 404 // data will be ADDED beneath this node.
417 405
@@ -419,11 +407,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
419 407
420 // Processing depends upon the type of inventory node 408 // Processing depends upon the type of inventory node
421 // identified in the URI. This is the CONTEXT for the 409 // identified in the URI. This is the CONTEXT for the
422 // change. We either got a context or we threw an 410 // change. We either got a context or we threw an
423 // exception. 411 // exception.
424 412
425 // It follows that we can only add information if the URI 413 // It follows that we can only add information if the URI
426 // has identified a folder. So only a type of folder is supported 414 // has identified a folder. So only a type of folder is supported
427 // in this case. 415 // in this case.
428 416
429 if (typeof(InventoryFolderBase) == InventoryNode.GetType() || 417 if (typeof(InventoryFolderBase) == InventoryNode.GetType() ||
@@ -448,12 +436,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
448 XmlInventoryCollection entity = ReconstituteEntity(rdata); 436 XmlInventoryCollection entity = ReconstituteEntity(rdata);
449 437
450 // Inlined assets can be included in entity. These must be incorporated into 438 // Inlined assets can be included in entity. These must be incorporated into
451 // the asset database before we attempt to update the inventory. If anything 439 // the asset database before we attempt to update the inventory. If anything
452 // fails, return a failure to requestor. 440 // fails, return a failure to requestor.
453 441
454 if (entity.Assets.Count > 0) 442 if (entity.Assets.Count > 0)
455 { 443 {
456
457 Rest.Log.DebugFormat("{0} Adding {1} assets to server", 444 Rest.Log.DebugFormat("{0} Adding {1} assets to server",
458 MsgId, entity.Assets.Count); 445 MsgId, entity.Assets.Count);
459 446
@@ -467,9 +454,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
467 { 454 {
468 Rest.Dump(asset.Data); 455 Rest.Dump(asset.Data);
469 } 456 }
470
471 } 457 }
472
473 } 458 }
474 459
475 // Modify the context using the collection of folders and items 460 // Modify the context using the collection of folders and items
@@ -477,7 +462,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
477 462
478 foreach (InventoryFolderBase folder in entity.Folders) 463 foreach (InventoryFolderBase folder in entity.Folders)
479 { 464 {
480
481 InventoryFolderBase found; 465 InventoryFolderBase found;
482 466
483 // If the parentID is zero, then this folder is going 467 // If the parentID is zero, then this folder is going
@@ -519,7 +503,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
519 Rest.Log.DebugFormat("{0} Adding new folder", MsgId); 503 Rest.Log.DebugFormat("{0} Adding new folder", MsgId);
520 Rest.InventoryServices.AddFolder(folder); 504 Rest.InventoryServices.AddFolder(folder);
521 } 505 }
522
523 } 506 }
524 507
525 // Now we repeat a similar process for the items included 508 // Now we repeat a similar process for the items included
@@ -527,7 +510,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
527 510
528 foreach (InventoryItemBase item in entity.Items) 511 foreach (InventoryItemBase item in entity.Items)
529 { 512 {
530
531 InventoryItemBase found = null; 513 InventoryItemBase found = null;
532 514
533 // If the parentID is zero, then this is going 515 // If the parentID is zero, then this is going
@@ -538,7 +520,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
538 item.Folder = context.ID; 520 item.Folder = context.ID;
539 } 521 }
540 522
541 // Determine whether this is a new item or a 523 // Determine whether this is a new item or a
542 // replacement definition. 524 // replacement definition.
543 525
544 foreach (InventoryItemBase xi in rdata.items) 526 foreach (InventoryItemBase xi in rdata.items)
@@ -563,9 +545,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
563 MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name); 545 MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name);
564 Rest.InventoryServices.AddItem(item); 546 Rest.InventoryServices.AddItem(item);
565 } 547 }
566
567 } 548 }
568
569 } 549 }
570 else 550 else
571 { 551 {
@@ -577,34 +557,32 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
577 557
578 rdata.Complete(); 558 rdata.Complete();
579 rdata.Respond("Inventory " + rdata.method + ": Normal completion"); 559 rdata.Respond("Inventory " + rdata.method + ": Normal completion");
580
581 } 560 }
582 561
583 /// <summary> 562 /// <summary>
584 /// POST updates the URI-identified element in the inventory. This 563 /// POST updates the URI-identified element in the inventory. This
585 /// is actually far more flexible than it might at first sound. For 564 /// is actually far more flexible than it might at first sound. For
586 /// POST the URI serves two purposes: 565 /// POST the URI serves two purposes:
587 /// [1] It identifies the user whose inventory is to be 566 /// [1] It identifies the user whose inventory is to be
588 /// processed. 567 /// processed.
589 /// [2] It optionally specifies a subtree of the inventory 568 /// [2] It optionally specifies a subtree of the inventory
590 /// that is to be used to resolve any relative subtree 569 /// that is to be used to resolve any relative subtree
591 /// specifications in the entity. If nothing is specified 570 /// specifications in the entity. If nothing is specified
592 /// then the whole inventory is implied. 571 /// then the whole inventory is implied.
593 /// Please note that the subtree specified by the URI is only relevant 572 /// Please note that the subtree specified by the URI is only relevant
594 /// to an entity containing a URI relative specification, i.e. one or 573 /// to an entity containing a URI relative specification, i.e. one or
595 /// more elements do not specify parent folder information. These 574 /// more elements do not specify parent folder information. These
596 /// elements will be implicitly referenced within the context identified 575 /// elements will be implicitly referenced within the context identified
597 /// by the URI. 576 /// by the URI.
598 /// If an element in the entity specifies an explicit parent folder, then 577 /// If an element in the entity specifies an explicit parent folder, then
599 /// that parent is effective, regardless of any value specified in the 578 /// that parent is effective, regardless of any value specified in the
600 /// URI. If the parent does not exist, then the element, and any dependent 579 /// URI. If the parent does not exist, then the element, and any dependent
601 /// elements, are ignored. This case is actually detected and handled 580 /// elements, are ignored. This case is actually detected and handled
602 /// during the reconstitution process. 581 /// during the reconstitution process.
603 /// </summary> 582 /// </summary>
604 583
605 private void DoPost(InventoryRequestData rdata) 584 private void DoPost(InventoryRequestData rdata)
606 { 585 {
607
608 int count = 0; 586 int count = 0;
609 587
610 // Resolve the inventory node that is to be modified. 588 // Resolve the inventory node that is to be modified.
@@ -612,8 +590,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
612 Object InventoryNode = getInventoryNode(rdata, rdata.root, 1); 590 Object InventoryNode = getInventoryNode(rdata, rdata.root, 1);
613 591
614 // As long as we have a node, then we have something 592 // As long as we have a node, then we have something
615 // meaningful to do, unlike PUT. So we reconstitute the 593 // meaningful to do, unlike PUT. So we reconstitute the
616 // subtree before doing anything else. Note that we 594 // subtree before doing anything else. Note that we
617 // etiher got a valid node or we threw an exception. 595 // etiher got a valid node or we threw an exception.
618 596
619 XmlInventoryCollection entity = ReconstituteEntity(rdata); 597 XmlInventoryCollection entity = ReconstituteEntity(rdata);
@@ -639,7 +617,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
639 { 617 {
640 Rest.Dump(asset.Data); 618 Rest.Dump(asset.Data);
641 } 619 }
642
643 } 620 }
644 } 621 }
645 622
@@ -648,15 +625,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
648 /// </summary> 625 /// </summary>
649 /// <remarks> 626 /// <remarks>
650 /// The root node in the entity will replace the node identified 627 /// The root node in the entity will replace the node identified
651 /// by the URI. This means the parent will remain the same, but 628 /// by the URI. This means the parent will remain the same, but
652 /// any or all attributes associated with the named element 629 /// any or all attributes associated with the named element
653 /// will change. 630 /// will change.
654 /// 631 ///
655 /// If the inventory collection contains an element with a zero 632 /// If the inventory collection contains an element with a zero
656 /// parent ID, then this is taken to be the replacement for the 633 /// parent ID, then this is taken to be the replacement for the
657 /// named node. The collection MAY also specify an explicit 634 /// named node. The collection MAY also specify an explicit
658 /// parent ID, in this case it MAY identify the same parent as 635 /// parent ID, in this case it MAY identify the same parent as
659 /// the current node, or it MAY specify a different parent, 636 /// the current node, or it MAY specify a different parent,
660 /// indicating that the folder is being moved in addition to any 637 /// indicating that the folder is being moved in addition to any
661 /// other modifications being made. 638 /// other modifications being made.
662 /// </remarks> 639 /// </remarks>
@@ -664,10 +641,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
664 if (typeof(InventoryFolderBase) == InventoryNode.GetType() || 641 if (typeof(InventoryFolderBase) == InventoryNode.GetType() ||
665 typeof(InventoryFolderImpl) == InventoryNode.GetType()) 642 typeof(InventoryFolderImpl) == InventoryNode.GetType())
666 { 643 {
667
668 InventoryFolderBase uri = (InventoryFolderBase) InventoryNode; 644 InventoryFolderBase uri = (InventoryFolderBase) InventoryNode;
669 InventoryFolderBase xml = null; 645 InventoryFolderBase xml = null;
670 646
671 // Scan the set of folders in the entity collection for an 647 // Scan the set of folders in the entity collection for an
672 // entry that matches the context folder. It is assumed that 648 // entry that matches the context folder. It is assumed that
673 // the only reliable indicator of this is a zero UUID ( using 649 // the only reliable indicator of this is a zero UUID ( using
@@ -676,7 +652,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
676 // ambiguity in this case because this is POST and we are 652 // ambiguity in this case because this is POST and we are
677 // supposed to be modifying a specific node. 653 // supposed to be modifying a specific node.
678 // We assign any element IDs required as an economy; we don't 654 // We assign any element IDs required as an economy; we don't
679 // want to iterate over the fodler set again if it can be 655 // want to iterate over the fodler set again if it can be
680 // helped. 656 // helped.
681 657
682 foreach (InventoryFolderBase folder in entity.Folders) 658 foreach (InventoryFolderBase folder in entity.Folders)
@@ -701,29 +677,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
701 { 677 {
702 Rest.Log.DebugFormat("{0} {1}: Request for <{2}> is ambiguous", 678 Rest.Log.DebugFormat("{0} {1}: Request for <{2}> is ambiguous",
703 MsgId, rdata.method, rdata.path); 679 MsgId, rdata.method, rdata.path);
704 rdata.Fail(Rest.HttpStatusCodeBadRequest, 680 rdata.Fail(Rest.HttpStatusCodeBadRequest,
705 Rest.HttpStatusDescBadRequest+": context is ambiguous"); 681 Rest.HttpStatusDescBadRequest+": context is ambiguous");
706 } 682 }
707 683
708 // Exactly one entry means we ARE replacing the node 684 // Exactly one entry means we ARE replacing the node
709 // identified by the URI. So we delete the old folder 685 // identified by the URI. So we delete the old folder
710 // by moving it to the trash and then purging it. 686 // by moving it to the trash and then purging it.
711 // We then add all of the folders and items we 687 // We then add all of the folders and items we
712 // included in the entity. The subtree has been 688 // included in the entity. The subtree has been
713 // modified. 689 // modified.
714 690
715 if (count == 1) 691 if (count == 1)
716 { 692 {
717
718 InventoryFolderBase TrashCan = GetTrashCan(rdata); 693 InventoryFolderBase TrashCan = GetTrashCan(rdata);
719 694
720 uri.ParentID = TrashCan.ID; 695 uri.ParentID = TrashCan.ID;
721 Rest.InventoryServices.MoveFolder(uri); 696 Rest.InventoryServices.MoveFolder(uri);
722 Rest.InventoryServices.PurgeFolder(TrashCan); 697 Rest.InventoryServices.PurgeFolder(TrashCan);
723
724 } 698 }
725 699
726 // Now, regardelss of what they represent, we 700 // Now, regardelss of what they represent, we
727 // integrate all of the elements in the entity. 701 // integrate all of the elements in the entity.
728 702
729 foreach (InventoryFolderBase f in entity.Folders) 703 foreach (InventoryFolderBase f in entity.Folders)
@@ -735,7 +709,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
735 { 709 {
736 Rest.InventoryServices.AddItem(it); 710 Rest.InventoryServices.AddItem(it);
737 } 711 }
738
739 } 712 }
740 713
741 /// <summary> 714 /// <summary>
@@ -748,7 +721,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
748 721
749 else 722 else
750 { 723 {
751
752 InventoryItemBase uri = (InventoryItemBase) InventoryNode; 724 InventoryItemBase uri = (InventoryItemBase) InventoryNode;
753 InventoryItemBase xml = null; 725 InventoryItemBase xml = null;
754 726
@@ -756,7 +728,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
756 { 728 {
757 Rest.Log.DebugFormat("{0} {1}: Request should not contain any folders <{2}>", 729 Rest.Log.DebugFormat("{0} {1}: Request should not contain any folders <{2}>",
758 MsgId, rdata.method, rdata.path); 730 MsgId, rdata.method, rdata.path);
759 rdata.Fail(Rest.HttpStatusCodeBadRequest, 731 rdata.Fail(Rest.HttpStatusCodeBadRequest,
760 Rest.HttpStatusDescBadRequest+": folder is not allowed"); 732 Rest.HttpStatusDescBadRequest+": folder is not allowed");
761 } 733 }
762 734
@@ -764,12 +736,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
764 { 736 {
765 Rest.Log.DebugFormat("{0} {1}: Entity contains too many items <{2}>", 737 Rest.Log.DebugFormat("{0} {1}: Entity contains too many items <{2}>",
766 MsgId, rdata.method, rdata.path); 738 MsgId, rdata.method, rdata.path);
767 rdata.Fail(Rest.HttpStatusCodeBadRequest, 739 rdata.Fail(Rest.HttpStatusCodeBadRequest,
768 Rest.HttpStatusDescBadRequest+": too may items"); 740 Rest.HttpStatusDescBadRequest+": too may items");
769 } 741 }
770 742
771 xml = entity.Items[0]; 743 xml = entity.Items[0];
772 744
773 if (xml.ID == LLUUID.Zero) 745 if (xml.ID == LLUUID.Zero)
774 { 746 {
775 xml.ID = LLUUID.Random(); 747 xml.ID = LLUUID.Random();
@@ -786,12 +758,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
786 // Add the new item to the inventory 758 // Add the new item to the inventory
787 759
788 Rest.InventoryServices.AddItem(xml); 760 Rest.InventoryServices.AddItem(xml);
789
790 } 761 }
791 762
792 rdata.Complete(); 763 rdata.Complete();
793 rdata.Respond("Inventory " + rdata.method + ": Normal completion"); 764 rdata.Respond("Inventory " + rdata.method + ": Normal completion");
794
795 } 765 }
796 766
797 /// <summary> 767 /// <summary>
@@ -804,7 +774,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
804 /// 774 ///
805 /// Folders are deleted by moving them to another folder and then 775 /// Folders are deleted by moving them to another folder and then
806 /// purging that folder. We'll do that by creating a temporary 776 /// purging that folder. We'll do that by creating a temporary
807 /// sub-folder in the TrashCan and purging that folder's 777 /// sub-folder in the TrashCan and purging that folder's
808 /// contents. If we can't can it, we don't delete it... 778 /// contents. If we can't can it, we don't delete it...
809 /// So, if no trashcan is available, the request does nothing. 779 /// So, if no trashcan is available, the request does nothing.
810 /// Items are summarily deleted. 780 /// Items are summarily deleted.
@@ -816,13 +786,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
816 786
817 private void DoDelete(InventoryRequestData rdata) 787 private void DoDelete(InventoryRequestData rdata)
818 { 788 {
819
820 Object InventoryNode = getInventoryNode(rdata, rdata.root, 1); 789 Object InventoryNode = getInventoryNode(rdata, rdata.root, 1);
821 790
822 if (typeof(InventoryFolderBase) == InventoryNode.GetType() || 791 if (typeof(InventoryFolderBase) == InventoryNode.GetType() ||
823 typeof(InventoryFolderImpl) == InventoryNode.GetType()) 792 typeof(InventoryFolderImpl) == InventoryNode.GetType())
824 { 793 {
825
826 InventoryFolderBase TrashCan = GetTrashCan(rdata); 794 InventoryFolderBase TrashCan = GetTrashCan(rdata);
827 795
828 InventoryFolderBase folder = (InventoryFolderBase) InventoryNode; 796 InventoryFolderBase folder = (InventoryFolderBase) InventoryNode;
@@ -831,7 +799,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
831 folder.ParentID = TrashCan.ID; 799 folder.ParentID = TrashCan.ID;
832 Rest.InventoryServices.MoveFolder(folder); 800 Rest.InventoryServices.MoveFolder(folder);
833 Rest.InventoryServices.PurgeFolder(TrashCan); 801 Rest.InventoryServices.PurgeFolder(TrashCan);
834
835 } 802 }
836 803
837 // Deleting items is much more straight forward. 804 // Deleting items is much more straight forward.
@@ -846,18 +813,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
846 813
847 rdata.Complete(); 814 rdata.Complete();
848 rdata.Respond("Inventory " + rdata.method + ": Normal completion"); 815 rdata.Respond("Inventory " + rdata.method + ": Normal completion");
849
850 } 816 }
851 817
852#endregion method-specific processing 818 #endregion method-specific processing
853 819
854 /// <summary> 820 /// <summary>
855 /// This method is called to obtain the OpenSim inventory object identified 821 /// This method is called to obtain the OpenSim inventory object identified
856 /// by the supplied URI. This may be either an Item or a Folder, so a suitably 822 /// by the supplied URI. This may be either an Item or a Folder, so a suitably
857 /// ambiguous return type is employed (Object). This method recurses as 823 /// ambiguous return type is employed (Object). This method recurses as
858 /// necessary to process the designated hierarchy. 824 /// necessary to process the designated hierarchy.
859 /// 825 ///
860 /// If we reach the end of the URI then we return the contextural folder to 826 /// If we reach the end of the URI then we return the contextural folder to
861 /// our caller. 827 /// our caller.
862 /// 828 ///
863 /// If we are not yet at the end of the URI we attempt to find a child folder 829 /// If we are not yet at the end of the URI we attempt to find a child folder
@@ -869,8 +835,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
869 /// Otherwise we fail the request on the ground of an invalid URI. 835 /// Otherwise we fail the request on the ground of an invalid URI.
870 /// 836 ///
871 /// <note> 837 /// <note>
872 /// This mechanism cannot detect the case where duplicate subtrees satisfy a 838 /// This mechanism cannot detect the case where duplicate subtrees satisfy a
873 /// request. In such a case the 1st element gets processed. If this is a 839 /// request. In such a case the 1st element gets processed. If this is a
874 /// problem, then UUID should be used to identify the end-node. This is basic 840 /// problem, then UUID should be used to identify the end-node. This is basic
875 /// premise of normal inventory processing. The name is an informational, and 841 /// premise of normal inventory processing. The name is an informational, and
876 /// not a defining, attribute. 842 /// not a defining, attribute.
@@ -880,7 +846,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
880 846
881 private Object getInventoryNode(InventoryRequestData rdata, InventoryFolderBase folder, int pi) 847 private Object getInventoryNode(InventoryRequestData rdata, InventoryFolderBase folder, int pi)
882 { 848 {
883
884 Rest.Log.DebugFormat("{0} Searching folder {1} {2} [{3}]", MsgId, folder.ID, folder.Name, pi); 849 Rest.Log.DebugFormat("{0} Searching folder {1} {2} [{3}]", MsgId, folder.ID, folder.Name, pi);
885 850
886 // We have just run off the end of the parameter sequence 851 // We have just run off the end of the parameter sequence
@@ -894,17 +859,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
894 // get us there. 859 // get us there.
895 860
896 if (rdata.folders != null) 861 if (rdata.folders != null)
862 {
897 foreach (InventoryFolderBase f in rdata.folders) 863 foreach (InventoryFolderBase f in rdata.folders)
898 { 864 {
899 // Look for the present node in the directory list 865 // Look for the present node in the directory list
900 if (f.ParentID == folder.ID && 866 if (f.ParentID == folder.ID &&
901 (f.Name == rdata.parameters[pi] || 867 (f.Name == rdata.parameters[pi] ||
902 f.ID.ToString() == rdata.parameters[pi])) 868 f.ID.ToString() == rdata.parameters[pi]))
903 { 869 {
904 return getInventoryNode(rdata, f, pi+1); 870 return getInventoryNode(rdata, f, pi+1);
905 } 871 }
906 } 872 }
907 873 }
874
908 // No folders that match. Perhaps this parameter identifies an item? If 875 // No folders that match. Perhaps this parameter identifies an item? If
909 // it does, then it MUST also be the last name in the sequence. 876 // it does, then it MUST also be the last name in the sequence.
910 877
@@ -916,7 +883,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
916 InventoryItemBase li = null; 883 InventoryItemBase li = null;
917 foreach (InventoryItemBase i in rdata.items) 884 foreach (InventoryItemBase i in rdata.items)
918 { 885 {
919 if (i.Folder == folder.ID && 886 if (i.Folder == folder.ID &&
920 (i.Name == rdata.parameters[pi] || 887 (i.Name == rdata.parameters[pi] ||
921 i.ID.ToString() == rdata.parameters[pi])) 888 i.ID.ToString() == rdata.parameters[pi]))
922 { 889 {
@@ -944,11 +911,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
944 rdata.Fail(Rest.HttpStatusCodeNotFound, Rest.HttpStatusDescNotFound+": resource "+rdata.path+" not found"); 911 rdata.Fail(Rest.HttpStatusCodeNotFound, Rest.HttpStatusDescNotFound+": resource "+rdata.path+" not found");
945 912
946 return null; /* Never reached */ 913 return null; /* Never reached */
947
948 } 914 }
949 915
950 /// <summary> 916 /// <summary>
951 /// This routine traverse the inventory's structure until the end-point identified 917 /// This routine traverse the inventory's structure until the end-point identified
952 /// in the URI is reached, the remainder of the inventory (if any) is then formatted 918 /// in the URI is reached, the remainder of the inventory (if any) is then formatted
953 /// and returned to the requestor. 919 /// and returned to the requestor.
954 /// 920 ///
@@ -961,14 +927,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
961 927
962 private void traverseInventory(InventoryRequestData rdata, InventoryFolderBase folder, int pi) 928 private void traverseInventory(InventoryRequestData rdata, InventoryFolderBase folder, int pi)
963 { 929 {
964
965 Rest.Log.DebugFormat("{0} Folder : {1} {2} [{3}]", MsgId, folder.ID, folder.Name, pi); 930 Rest.Log.DebugFormat("{0} Folder : {1} {2} [{3}]", MsgId, folder.ID, folder.Name, pi);
966 931
967 if (rdata.folders != null) 932 if (rdata.folders != null)
968 { 933 {
969 foreach (InventoryFolderBase f in rdata.folders) 934 foreach (InventoryFolderBase f in rdata.folders)
970 { 935 {
971 if (f.ParentID == folder.ID && 936 if (f.ParentID == folder.ID &&
972 (f.Name == rdata.parameters[pi] || 937 (f.Name == rdata.parameters[pi] ||
973 f.ID.ToString() == rdata.parameters[pi])) 938 f.ID.ToString() == rdata.parameters[pi]))
974 { 939 {
@@ -991,13 +956,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
991 { 956 {
992 foreach (InventoryItemBase i in rdata.items) 957 foreach (InventoryItemBase i in rdata.items)
993 { 958 {
994 if (i.Folder == folder.ID && 959 if (i.Folder == folder.ID &&
995 (i.Name == rdata.parameters[pi] || 960 (i.Name == rdata.parameters[pi] ||
996 i.ID.ToString() == rdata.parameters[pi])) 961 i.ID.ToString() == rdata.parameters[pi]))
997 { 962 {
998 // Fetching an Item has a special significance. In this 963 // Fetching an Item has a special significance. In this
999 // case we also want to fetch the associated asset. 964 // case we also want to fetch the associated asset.
1000 // To make it interesting, we'll d this via redirection. 965 // To make it interesting, we'll d this via redirection.
1001 string asseturl = "http://" + rdata.hostname + ":" + rdata.port + 966 string asseturl = "http://" + rdata.hostname + ":" + rdata.port +
1002 "/admin/assets" + Rest.UrlPathSeparator + i.AssetID.ToString(); 967 "/admin/assets" + Rest.UrlPathSeparator + i.AssetID.ToString();
1003 rdata.Redirect(asseturl,Rest.PERMANENT); 968 rdata.Redirect(asseturl,Rest.PERMANENT);
@@ -1007,10 +972,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1007 } 972 }
1008 } 973 }
1009 974
1010 Rest.Log.DebugFormat("{0} Inventory does not contain item/folder: <{1}>", 975 Rest.Log.DebugFormat("{0} Inventory does not contain item/folder: <{1}>",
1011 MsgId, rdata.path); 976 MsgId, rdata.path);
1012 rdata.Fail(Rest.HttpStatusCodeNotFound,Rest.HttpStatusDescNotFound+": no such item/folder"); 977 rdata.Fail(Rest.HttpStatusCodeNotFound,Rest.HttpStatusDescNotFound+": no such item/folder");
1013
1014 } 978 }
1015 979
1016 /// <summary> 980 /// <summary>
@@ -1023,7 +987,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1023 987
1024 private void formatInventory(InventoryRequestData rdata, InventoryFolderBase folder, string indent) 988 private void formatInventory(InventoryRequestData rdata, InventoryFolderBase folder, string indent)
1025 { 989 {
1026
1027 if (Rest.DEBUG) 990 if (Rest.DEBUG)
1028 { 991 {
1029 Rest.Log.DebugFormat("{0} Folder : {1} {2} {3}", MsgId, folder.ID, indent, folder.Name); 992 Rest.Log.DebugFormat("{0} Folder : {1} {2} {3}", MsgId, folder.ID, indent, folder.Name);
@@ -1064,7 +1027,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1064 // End folder item 1027 // End folder item
1065 1028
1066 rdata.writer.WriteEndElement(); 1029 rdata.writer.WriteEndElement();
1067
1068 } 1030 }
1069 1031
1070 /// <summary> 1032 /// <summary>
@@ -1073,7 +1035,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1073 1035
1074 private void formatItem(InventoryRequestData rdata, InventoryItemBase i, string indent) 1036 private void formatItem(InventoryRequestData rdata, InventoryItemBase i, string indent)
1075 { 1037 {
1076
1077 Rest.Log.DebugFormat("{0} Item : {1} {2} {3}", MsgId, i.ID, indent, i.Name); 1038 Rest.Log.DebugFormat("{0} Item : {1} {2} {3}", MsgId, i.ID, indent, i.Name);
1078 1039
1079 rdata.writer.WriteStartElement(String.Empty,"Item",String.Empty); 1040 rdata.writer.WriteStartElement(String.Empty,"Item",String.Empty);
@@ -1102,11 +1063,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1102 rdata.writer.WriteElementString("Asset",i.AssetID.ToString()); 1063 rdata.writer.WriteElementString("Asset",i.AssetID.ToString());
1103 1064
1104 rdata.writer.WriteEndElement(); 1065 rdata.writer.WriteEndElement();
1105
1106 } 1066 }
1107 1067
1108 /// <summary> 1068 /// <summary>
1109 /// This method creates a "trashcan" folder to support folder and item 1069 /// This method creates a "trashcan" folder to support folder and item
1110 /// deletions by this interface. The xisting trash folder is found and 1070 /// deletions by this interface. The xisting trash folder is found and
1111 /// this folder is created within it. It is called "tmp" to indicate to 1071 /// this folder is created within it. It is called "tmp" to indicate to
1112 /// the client that it is OK to delete this folder. The REST interface 1072 /// the client that it is OK to delete this folder. The REST interface
@@ -1117,7 +1077,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1117 1077
1118 private InventoryFolderBase GetTrashCan(InventoryRequestData rdata) 1078 private InventoryFolderBase GetTrashCan(InventoryRequestData rdata)
1119 { 1079 {
1120
1121 InventoryFolderBase TrashCan = null; 1080 InventoryFolderBase TrashCan = null;
1122 1081
1123 foreach (InventoryFolderBase f in rdata.folders) 1082 foreach (InventoryFolderBase f in rdata.folders)
@@ -1144,16 +1103,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1144 } 1103 }
1145 } 1104 }
1146 } 1105 }
1147 1106
1148 if (TrashCan == null) 1107 if (TrashCan == null)
1149 { 1108 {
1150 Rest.Log.DebugFormat("{0} No Trash Can available", MsgId); 1109 Rest.Log.DebugFormat("{0} No Trash Can available", MsgId);
1151 rdata.Fail(Rest.HttpStatusCodeServerError, 1110 rdata.Fail(Rest.HttpStatusCodeServerError,
1152 Rest.HttpStatusDescServerError+": unable to create trash can"); 1111 Rest.HttpStatusDescServerError+": unable to create trash can");
1153 } 1112 }
1154 1113
1155 return TrashCan; 1114 return TrashCan;
1156
1157 } 1115 }
1158 1116
1159 /// <summary> 1117 /// <summary>
@@ -1163,11 +1121,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1163 1121
1164 private bool FolderHasChanged(InventoryFolderBase newf, InventoryFolderBase oldf) 1122 private bool FolderHasChanged(InventoryFolderBase newf, InventoryFolderBase oldf)
1165 { 1123 {
1166 return ( newf.Name != oldf.Name 1124 return (newf.Name != oldf.Name
1167 || newf.ParentID != oldf.ParentID 1125 || newf.ParentID != oldf.ParentID
1168 || newf.Owner != oldf.Owner 1126 || newf.Owner != oldf.Owner
1169 || newf.Type != oldf.Type 1127 || newf.Type != oldf.Type
1170 || newf.Version != oldf.Version 1128 || newf.Version != oldf.Version
1171 ); 1129 );
1172 } 1130 }
1173 1131
@@ -1178,24 +1136,24 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1178 1136
1179 private bool ItemHasChanged(InventoryItemBase newf, InventoryItemBase oldf) 1137 private bool ItemHasChanged(InventoryItemBase newf, InventoryItemBase oldf)
1180 { 1138 {
1181 return ( newf.Name != oldf.Name 1139 return (newf.Name != oldf.Name
1182 || newf.Folder != oldf.Description 1140 || newf.Folder != oldf.Description
1183 || newf.Description != oldf.Description 1141 || newf.Description != oldf.Description
1184 || newf.Owner != oldf.Owner 1142 || newf.Owner != oldf.Owner
1185 || newf.Creator != oldf.Creator 1143 || newf.Creator != oldf.Creator
1186 || newf.AssetID != oldf.AssetID 1144 || newf.AssetID != oldf.AssetID
1187 || newf.GroupID != oldf.GroupID 1145 || newf.GroupID != oldf.GroupID
1188 || newf.GroupOwned != oldf.GroupOwned 1146 || newf.GroupOwned != oldf.GroupOwned
1189 || newf.InvType != oldf.InvType 1147 || newf.InvType != oldf.InvType
1190 || newf.AssetType != oldf.AssetType 1148 || newf.AssetType != oldf.AssetType
1191 ); 1149 );
1192 } 1150 }
1193 1151
1194 /// <summary> 1152 /// <summary>
1195 /// This method is called by PUT and POST to create an XmlInventoryCollection 1153 /// This method is called by PUT and POST to create an XmlInventoryCollection
1196 /// instance that reflects the content of the entity supplied on the request. 1154 /// instance that reflects the content of the entity supplied on the request.
1197 /// Any elements in the completed collection whose UUID is zero, are 1155 /// Any elements in the completed collection whose UUID is zero, are
1198 /// considered to be located relative to the end-point identified int he 1156 /// considered to be located relative to the end-point identified int he
1199 /// URI. In this way, an entire sub-tree can be conveyed in a single REST 1157 /// URI. In this way, an entire sub-tree can be conveyed in a single REST
1200 /// PUT or POST request. 1158 /// PUT or POST request.
1201 /// 1159 ///
@@ -1203,26 +1161,24 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1203 /// has an entity, it is more completely initialized. thus, if no entity was 1161 /// has an entity, it is more completely initialized. thus, if no entity was
1204 /// provided the collection is valid, but empty. 1162 /// provided the collection is valid, but empty.
1205 /// 1163 ///
1206 /// The entity is then scanned and each tag is processed to produce the 1164 /// The entity is then scanned and each tag is processed to produce the
1207 /// appropriate inventory elements. At the end f the scan, teh XmlInventoryCollection 1165 /// appropriate inventory elements. At the end f the scan, teh XmlInventoryCollection
1208 /// will reflect the subtree described by the entity. 1166 /// will reflect the subtree described by the entity.
1209 /// 1167 ///
1210 /// This is a very flexible mechanism, the entity may contain arbitrary, 1168 /// This is a very flexible mechanism, the entity may contain arbitrary,
1211 /// discontiguous tree fragments, or may contain single element. The caller is 1169 /// discontiguous tree fragments, or may contain single element. The caller is
1212 /// responsible for integrating this collection (and ensuring that any 1170 /// responsible for integrating this collection (and ensuring that any
1213 /// missing parent IDs are resolved). 1171 /// missing parent IDs are resolved).
1214 /// </summary> 1172 /// </summary>
1215 1173
1216 internal XmlInventoryCollection ReconstituteEntity(InventoryRequestData rdata) 1174 internal XmlInventoryCollection ReconstituteEntity(InventoryRequestData rdata)
1217 { 1175 {
1218
1219 Rest.Log.DebugFormat("{0} Reconstituting entity", MsgId); 1176 Rest.Log.DebugFormat("{0} Reconstituting entity", MsgId);
1220 1177
1221 XmlInventoryCollection ic = new XmlInventoryCollection(); 1178 XmlInventoryCollection ic = new XmlInventoryCollection();
1222 1179
1223 if (rdata.request.HasEntityBody) 1180 if (rdata.request.HasEntityBody)
1224 { 1181 {
1225
1226 Rest.Log.DebugFormat("{0} Entity present", MsgId); 1182 Rest.Log.DebugFormat("{0} Entity present", MsgId);
1227 1183
1228 ic.init(rdata); 1184 ic.init(rdata);
@@ -1318,7 +1274,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1318 Rest.Log.WarnFormat("{0} Unexpected XML parsing error: {1}", MsgId, e.Message); 1274 Rest.Log.WarnFormat("{0} Unexpected XML parsing error: {1}", MsgId, e.Message);
1319 throw e; 1275 throw e;
1320 } 1276 }
1321
1322 } 1277 }
1323 else 1278 else
1324 { 1279 {
@@ -1334,14 +1289,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1334 } 1289 }
1335 1290
1336 return ic; 1291 return ic;
1337
1338 } 1292 }
1339 1293
1340 /// <summary> 1294 /// <summary>
1341 /// This method creates an inventory Folder from the 1295 /// This method creates an inventory Folder from the
1342 /// information supplied in the request's entity. 1296 /// information supplied in the request's entity.
1343 /// A folder instance is created and initialized to reflect 1297 /// A folder instance is created and initialized to reflect
1344 /// default values. These values are then overridden 1298 /// default values. These values are then overridden
1345 /// by information supplied in the entity. 1299 /// by information supplied in the entity.
1346 /// If context was not explicitly provided, then the 1300 /// If context was not explicitly provided, then the
1347 /// appropriate ID values are determined. 1301 /// appropriate ID values are determined.
@@ -1349,7 +1303,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1349 1303
1350 private void CollectFolder(XmlInventoryCollection ic) 1304 private void CollectFolder(XmlInventoryCollection ic)
1351 { 1305 {
1352
1353 Rest.Log.DebugFormat("{0} Interpret folder element", MsgId); 1306 Rest.Log.DebugFormat("{0} Interpret folder element", MsgId);
1354 1307
1355 InventoryFolderBase result = new InventoryFolderBase(); 1308 InventoryFolderBase result = new InventoryFolderBase();
@@ -1389,7 +1342,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1389 result.Version = UInt16.Parse(ic.xml.Value); 1342 result.Version = UInt16.Parse(ic.xml.Value);
1390 break; 1343 break;
1391 default : 1344 default :
1392 Rest.Log.DebugFormat("{0} Folder: unrecognized attribute: {1}:{2}", 1345 Rest.Log.DebugFormat("{0} Folder: unrecognized attribute: {1}:{2}",
1393 MsgId, ic.xml.Name, ic.xml.Value); 1346 MsgId, ic.xml.Name, ic.xml.Value);
1394 ic.Fail(Rest.HttpStatusCodeBadRequest, 1347 ic.Fail(Rest.HttpStatusCodeBadRequest,
1395 Rest.HttpStatusDescBadRequest+": unrecognized attribute"); 1348 Rest.HttpStatusDescBadRequest+": unrecognized attribute");
@@ -1411,7 +1364,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1411 } 1364 }
1412 else 1365 else
1413 { 1366 {
1414
1415 bool found = false; 1367 bool found = false;
1416 1368
1417 foreach (InventoryFolderBase parent in ic.rdata.folders) 1369 foreach (InventoryFolderBase parent in ic.rdata.folders)
@@ -1425,7 +1377,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1425 1377
1426 if (!found) 1378 if (!found)
1427 { 1379 {
1428 Rest.Log.ErrorFormat("{0} Invalid parent ID ({1}) in folder {2}", 1380 Rest.Log.ErrorFormat("{0} Invalid parent ID ({1}) in folder {2}",
1429 MsgId, ic.Item.Folder, result.ID); 1381 MsgId, ic.Item.Folder, result.ID);
1430 ic.Fail(Rest.HttpStatusCodeBadRequest, 1382 ic.Fail(Rest.HttpStatusCodeBadRequest,
1431 Rest.HttpStatusDescBadRequest+": invalid parent"); 1383 Rest.HttpStatusDescBadRequest+": invalid parent");
@@ -1445,15 +1397,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1445 // obsolete as a consequence. 1397 // obsolete as a consequence.
1446 1398
1447 ic.Push(result); 1399 ic.Push(result);
1448
1449 } 1400 }
1450 1401
1451 /// <summary> 1402 /// <summary>
1452 /// This method is called to handle the construction of an Item 1403 /// This method is called to handle the construction of an Item
1453 /// instance from the supplied request entity. It is called 1404 /// instance from the supplied request entity. It is called
1454 /// whenever an Item start tag is detected. 1405 /// whenever an Item start tag is detected.
1455 /// An instance of an Item is created and initialized to default 1406 /// An instance of an Item is created and initialized to default
1456 /// values. These values are then overridden from values supplied 1407 /// values. These values are then overridden from values supplied
1457 /// as attributes to the Item element. 1408 /// as attributes to the Item element.
1458 /// This item is then stored in the XmlInventoryCollection and 1409 /// This item is then stored in the XmlInventoryCollection and
1459 /// will be verified by Validate. 1410 /// will be verified by Validate.
@@ -1463,7 +1414,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1463 1414
1464 private void CollectItem(XmlInventoryCollection ic) 1415 private void CollectItem(XmlInventoryCollection ic)
1465 { 1416 {
1466
1467 Rest.Log.DebugFormat("{0} Interpret item element", MsgId); 1417 Rest.Log.DebugFormat("{0} Interpret item element", MsgId);
1468 1418
1469 InventoryItemBase result = new InventoryItemBase(); 1419 InventoryItemBase result = new InventoryItemBase();
@@ -1484,7 +1434,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1484 { 1434 {
1485 for (int i = 0; i < ic.xml.AttributeCount; i++) 1435 for (int i = 0; i < ic.xml.AttributeCount; i++)
1486 { 1436 {
1487
1488 ic.xml.MoveToAttribute(i); 1437 ic.xml.MoveToAttribute(i);
1489 1438
1490 switch (ic.xml.Name) 1439 switch (ic.xml.Name)
@@ -1533,37 +1482,36 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1533 break; 1482 break;
1534 1483
1535 default : 1484 default :
1536 Rest.Log.DebugFormat("{0} Item: Unrecognized attribute: {1}:{2}", 1485 Rest.Log.DebugFormat("{0} Item: Unrecognized attribute: {1}:{2}",
1537 MsgId, ic.xml.Name, ic.xml.Value); 1486 MsgId, ic.xml.Name, ic.xml.Value);
1538 ic.Fail(Rest.HttpStatusCodeBadRequest, 1487 ic.Fail(Rest.HttpStatusCodeBadRequest,
1539 Rest.HttpStatusDescBadRequest+": unrecognized attribute"); 1488 Rest.HttpStatusDescBadRequest+": unrecognized attribute");
1540 break; 1489 break;
1541 } 1490 }
1542 } 1491 }
1543 } 1492 }
1544 1493
1545 ic.xml.MoveToElement(); 1494 ic.xml.MoveToElement();
1546 1495
1547 ic.Push(result); 1496 ic.Push(result);
1548
1549 } 1497 }
1550 1498
1551 /// <summary> 1499 /// <summary>
1552 /// This method assembles an asset instance from the 1500 /// This method assembles an asset instance from the
1553 /// information supplied in the request's entity. It is 1501 /// information supplied in the request's entity. It is
1554 /// called as a result of detecting a start tag for a 1502 /// called as a result of detecting a start tag for a
1555 /// type of Asset. 1503 /// type of Asset.
1556 /// The information is collected locally, and an asset 1504 /// The information is collected locally, and an asset
1557 /// instance is created only if the basic XML parsing 1505 /// instance is created only if the basic XML parsing
1558 /// completes successfully. 1506 /// completes successfully.
1559 /// Default values for all parts of the asset are 1507 /// Default values for all parts of the asset are
1560 /// established before overriding them from the supplied 1508 /// established before overriding them from the supplied
1561 /// XML. 1509 /// XML.
1562 /// If an asset has inline=true as an attribute, then 1510 /// If an asset has inline=true as an attribute, then
1563 /// the element contains the data representing the 1511 /// the element contains the data representing the
1564 /// asset. This is saved as the data component. 1512 /// asset. This is saved as the data component.
1565 /// inline=false means that the element's payload is 1513 /// inline=false means that the element's payload is
1566 /// simply the UUID of the asset referenced by the 1514 /// simply the UUID of the asset referenced by the
1567 /// item being constructed. 1515 /// item being constructed.
1568 /// An asset, if created is stored in the 1516 /// An asset, if created is stored in the
1569 /// XmlInventoryCollection 1517 /// XmlInventoryCollection
@@ -1624,7 +1572,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1624 break; 1572 break;
1625 1573
1626 default : 1574 default :
1627 Rest.Log.DebugFormat("{0} Asset: Unrecognized attribute: {1}:{2}", 1575 Rest.Log.DebugFormat("{0} Asset: Unrecognized attribute: {1}:{2}",
1628 MsgId, ic.xml.Name, ic.xml.Value); 1576 MsgId, ic.xml.Name, ic.xml.Value);
1629 ic.Fail(Rest.HttpStatusCodeBadRequest, 1577 ic.Fail(Rest.HttpStatusCodeBadRequest,
1630 Rest.HttpStatusDescBadRequest); 1578 Rest.HttpStatusDescBadRequest);
@@ -1637,7 +1585,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1637 1585
1638 // If this is a reference to an existing asset, just store the 1586 // If this is a reference to an existing asset, just store the
1639 // asset ID into the item. 1587 // asset ID into the item.
1640 1588
1641 if (!inline) 1589 if (!inline)
1642 { 1590 {
1643 if (ic.Item != null) 1591 if (ic.Item != null)
@@ -1653,13 +1601,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1653 } 1601 }
1654 } 1602 }
1655 1603
1656 // Otherwise, generate an asset ID, store that into the item, and 1604 // Otherwise, generate an asset ID, store that into the item, and
1657 // create an entry in the asset list for the inlined asset. But 1605 // create an entry in the asset list for the inlined asset. But
1658 // only if the size is non-zero. 1606 // only if the size is non-zero.
1659 1607
1660 else 1608 else
1661 { 1609 {
1662
1663 string b64string = null; 1610 string b64string = null;
1664 1611
1665 // Generate a UUID of none were given, and generally none should 1612 // Generate a UUID of none were given, and generally none should
@@ -1672,17 +1619,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1672 1619
1673 // Create AssetBase entity to hold the inlined asset 1620 // Create AssetBase entity to hold the inlined asset
1674 1621
1675 asset = new AssetBase(uuid, name); 1622 asset = new AssetBase(uuid, name);
1676 1623
1677 asset.Description = desc; 1624 asset.Description = desc;
1678 asset.Type = type; // type == 0 == texture 1625 asset.Type = type; // type == 0 == texture
1679 asset.Local = local; 1626 asset.Local = local;
1680 asset.Temporary = temp; 1627 asset.Temporary = temp;
1681 1628
1682 b64string = ic.xml.ReadElementContentAsString(); 1629 b64string = ic.xml.ReadElementContentAsString();
1683 1630
1684 Rest.Log.DebugFormat("{0} Data length is {1}", MsgId, b64string.Length); 1631 Rest.Log.DebugFormat("{0} Data length is {1}", MsgId, b64string.Length);
1685 Rest.Log.DebugFormat("{0} Data content starts with: \n\t<{1}>", MsgId, 1632 Rest.Log.DebugFormat("{0} Data content starts with: \n\t<{1}>", MsgId,
1686 b64string.Substring(0, b64string.Length > 132 ? 132 : b64string.Length)); 1633 b64string.Substring(0, b64string.Length > 132 ? 132 : b64string.Length));
1687 1634
1688 asset.Data = Convert.FromBase64String(b64string); 1635 asset.Data = Convert.FromBase64String(b64string);
@@ -1701,22 +1648,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1701 { 1648 {
1702 ic.Item.AssetID = uuid; 1649 ic.Item.AssetID = uuid;
1703 } 1650 }
1704
1705 } 1651 }
1706 1652
1707 ic.Push(asset); 1653 ic.Push(asset);
1708
1709 } 1654 }
1710 1655
1711 /// <summary> 1656 /// <summary>
1712 /// Store any permissions information provided by the request. 1657 /// Store any permissions information provided by the request.
1713 /// This overrides the default permissions set when the 1658 /// This overrides the default permissions set when the
1714 /// XmlInventoryCollection object was created. 1659 /// XmlInventoryCollection object was created.
1715 /// </summary> 1660 /// </summary>
1716 1661
1717 private void CollectPermissions(XmlInventoryCollection ic) 1662 private void CollectPermissions(XmlInventoryCollection ic)
1718 { 1663 {
1719
1720 if (ic.xml.HasAttributes) 1664 if (ic.xml.HasAttributes)
1721 { 1665 {
1722 for (int i = 0; i < ic.xml.AttributeCount; i++) 1666 for (int i = 0; i < ic.xml.AttributeCount; i++)
@@ -1747,7 +1691,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1747 } 1691 }
1748 1692
1749 ic.xml.MoveToElement(); 1693 ic.xml.MoveToElement();
1750
1751 } 1694 }
1752 1695
1753 /// <summary> 1696 /// <summary>
@@ -1762,7 +1705,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1762 1705
1763 private void Validate(XmlInventoryCollection ic) 1706 private void Validate(XmlInventoryCollection ic)
1764 { 1707 {
1765
1766 // There really should be an item present if we've 1708 // There really should be an item present if we've
1767 // called validate. So fail if there is not. 1709 // called validate. So fail if there is not.
1768 1710
@@ -1772,7 +1714,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1772 ic.Fail(Rest.HttpStatusCodeBadRequest, 1714 ic.Fail(Rest.HttpStatusCodeBadRequest,
1773 Rest.HttpStatusDescBadRequest+": request parse error"); 1715 Rest.HttpStatusDescBadRequest+": request parse error");
1774 } 1716 }
1775 1717
1776 // Every item is required to have a name (via REST anyway) 1718 // Every item is required to have a name (via REST anyway)
1777 1719
1778 if (ic.Item.Name == String.Empty) 1720 if (ic.Item.Name == String.Empty)
@@ -1781,19 +1723,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1781 ic.Fail(Rest.HttpStatusCodeBadRequest, 1723 ic.Fail(Rest.HttpStatusCodeBadRequest,
1782 Rest.HttpStatusDescBadRequest+": item name required"); 1724 Rest.HttpStatusDescBadRequest+": item name required");
1783 } 1725 }
1784 1726
1785 // An item MUST have an asset ID. AssetID should never be zero 1727 // An item MUST have an asset ID. AssetID should never be zero
1786 // here. It should always get set from the information stored 1728 // here. It should always get set from the information stored
1787 // when the Asset element was processed. 1729 // when the Asset element was processed.
1788 1730
1789 if (ic.Item.AssetID == LLUUID.Zero) 1731 if (ic.Item.AssetID == LLUUID.Zero)
1790 { 1732 {
1791
1792 Rest.Log.ErrorFormat("{0} Unable to complete request", MsgId); 1733 Rest.Log.ErrorFormat("{0} Unable to complete request", MsgId);
1793 Rest.Log.InfoFormat("{0} Asset information is missing", MsgId); 1734 Rest.Log.InfoFormat("{0} Asset information is missing", MsgId);
1794 ic.Fail(Rest.HttpStatusCodeBadRequest, 1735 ic.Fail(Rest.HttpStatusCodeBadRequest,
1795 Rest.HttpStatusDescBadRequest+": asset information required"); 1736 Rest.HttpStatusDescBadRequest+": asset information required");
1796
1797 } 1737 }
1798 1738
1799 // If the item is new, then assign it an ID 1739 // If the item is new, then assign it an ID
@@ -1806,19 +1746,18 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1806 // If the context is being implied, obtain the current 1746 // If the context is being implied, obtain the current
1807 // folder item's ID. If it was specified explicitly, make 1747 // folder item's ID. If it was specified explicitly, make
1808 // sure that theparent folder exists. 1748 // sure that theparent folder exists.
1809 1749
1810 if (ic.Item.Folder == LLUUID.Zero) 1750 if (ic.Item.Folder == LLUUID.Zero)
1811 { 1751 {
1812 ic.Item.Folder = ic.Parent(); 1752 ic.Item.Folder = ic.Parent();
1813 } 1753 }
1814 else 1754 else
1815 { 1755 {
1816
1817 bool found = false; 1756 bool found = false;
1818 1757
1819 foreach (InventoryFolderBase parent in ic.rdata.folders) 1758 foreach (InventoryFolderBase parent in ic.rdata.folders)
1820 { 1759 {
1821 if ( parent.ID == ic.Item.Folder ) 1760 if (parent.ID == ic.Item.Folder)
1822 { 1761 {
1823 found = true; 1762 found = true;
1824 break; 1763 break;
@@ -1827,12 +1766,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1827 1766
1828 if (!found) 1767 if (!found)
1829 { 1768 {
1830 Rest.Log.ErrorFormat("{0} Invalid parent ID ({1}) in item {2}", 1769 Rest.Log.ErrorFormat("{0} Invalid parent ID ({1}) in item {2}",
1831 MsgId, ic.Item.Folder, ic.Item.ID); 1770 MsgId, ic.Item.Folder, ic.Item.ID);
1832 ic.Fail(Rest.HttpStatusCodeBadRequest, 1771 ic.Fail(Rest.HttpStatusCodeBadRequest,
1833 Rest.HttpStatusDescBadRequest+": parent information required"); 1772 Rest.HttpStatusDescBadRequest+": parent information required");
1834 } 1773 }
1835
1836 } 1774 }
1837 1775
1838 // If this is an inline asset being constructed in the context 1776 // If this is an inline asset being constructed in the context
@@ -1854,13 +1792,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1854 ic.Item.NextPermissions = ic.NextPermissions; 1792 ic.Item.NextPermissions = ic.NextPermissions;
1855 1793
1856 // If no type was specified for this item, we can attempt to 1794 // If no type was specified for this item, we can attempt to
1857 // infer something from the file type maybe. This is NOT as 1795 // infer something from the file type maybe. This is NOT as
1858 // good as having type be specified in the XML. 1796 // good as having type be specified in the XML.
1859 1797
1860 if (ic.Item.AssetType == (int) AssetType.Unknown || 1798 if (ic.Item.AssetType == (int) AssetType.Unknown ||
1861 ic.Item.InvType == (int) AssetType.Unknown) 1799 ic.Item.InvType == (int) AssetType.Unknown)
1862 { 1800 {
1863
1864 Rest.Log.DebugFormat("{0} Attempting to infer item type", MsgId); 1801 Rest.Log.DebugFormat("{0} Attempting to infer item type", MsgId);
1865 1802
1866 string[] parts = ic.Item.Name.Split(Rest.CA_PERIOD); 1803 string[] parts = ic.Item.Name.Split(Rest.CA_PERIOD);
@@ -1880,7 +1817,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1880 1817
1881 if (parts.Length > 1) 1818 if (parts.Length > 1)
1882 { 1819 {
1883 Rest.Log.DebugFormat("{0} File type is {1}", 1820 Rest.Log.DebugFormat("{0} File type is {1}",
1884 MsgId, parts[parts.Length - 1]); 1821 MsgId, parts[parts.Length - 1]);
1885 switch (parts[parts.Length - 1]) 1822 switch (parts[parts.Length - 1])
1886 { 1823 {
@@ -1888,7 +1825,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1888 case "jpeg-2000" : 1825 case "jpeg-2000" :
1889 case "jpg2000" : 1826 case "jpg2000" :
1890 case "jpg-2000" : 1827 case "jpg-2000" :
1891 Rest.Log.DebugFormat("{0} Type {1} inferred", 1828 Rest.Log.DebugFormat("{0} Type {1} inferred",
1892 MsgId, parts[parts.Length-1]); 1829 MsgId, parts[parts.Length-1]);
1893 if (ic.Item.AssetType == (int) AssetType.Unknown) 1830 if (ic.Item.AssetType == (int) AssetType.Unknown)
1894 ic.Item.AssetType = (int) AssetType.ImageJPEG; 1831 ic.Item.AssetType = (int) AssetType.ImageJPEG;
@@ -1897,7 +1834,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1897 break; 1834 break;
1898 case "jpg" : 1835 case "jpg" :
1899 case "jpeg" : 1836 case "jpeg" :
1900 Rest.Log.DebugFormat("{0} Type {1} inferred", 1837 Rest.Log.DebugFormat("{0} Type {1} inferred",
1901 MsgId, parts[parts.Length - 1]); 1838 MsgId, parts[parts.Length - 1]);
1902 if (ic.Item.AssetType == (int) AssetType.Unknown) 1839 if (ic.Item.AssetType == (int) AssetType.Unknown)
1903 ic.Item.AssetType = (int) AssetType.ImageJPEG; 1840 ic.Item.AssetType = (int) AssetType.ImageJPEG;
@@ -1938,16 +1875,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1938 temp = OpenJPEGNet.LoadTGAClass.LoadTGA(tgadata); 1875 temp = OpenJPEGNet.LoadTGAClass.LoadTGA(tgadata);
1939 ic.Asset.Data = OpenJPEGNet.OpenJPEG.EncodeFromImage(temp, true); 1876 ic.Asset.Data = OpenJPEGNet.OpenJPEG.EncodeFromImage(temp, true);
1940 } 1877 }
1941
1942 ic.reset();
1943 1878
1879 ic.reset();
1944 } 1880 }
1945 1881
1946 #region Inventory RequestData extension 1882 #region Inventory RequestData extension
1947 1883
1948 internal class InventoryRequestData : RequestData 1884 internal class InventoryRequestData : RequestData
1949 { 1885 {
1950
1951 /// <summary> 1886 /// <summary>
1952 /// These are the inventory specific request/response state 1887 /// These are the inventory specific request/response state
1953 /// extensions. 1888 /// extensions.
@@ -1965,7 +1900,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1965 } 1900 }
1966 1901
1967 /// <summary> 1902 /// <summary>
1968 /// This is the callback method required by inventory services. The 1903 /// This is the callback method required by inventory services. The
1969 /// requestor issues an inventory request and then blocks until this 1904 /// requestor issues an inventory request and then blocks until this
1970 /// method signals the monitor. 1905 /// method signals the monitor.
1971 /// </summary> 1906 /// </summary>
@@ -1981,7 +1916,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1981 Monitor.Pulse(this); 1916 Monitor.Pulse(this);
1982 } 1917 }
1983 } 1918 }
1984
1985 } 1919 }
1986 1920
1987 #endregion Inventory RequestData extension 1921 #endregion Inventory RequestData extension
@@ -1994,7 +1928,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1994 1928
1995 internal class XmlInventoryCollection : InventoryCollection 1929 internal class XmlInventoryCollection : InventoryCollection
1996 { 1930 {
1997
1998 internal InventoryRequestData rdata; 1931 internal InventoryRequestData rdata;
1999 private Stack<InventoryFolderBase> stk; 1932 private Stack<InventoryFolderBase> stk;
2000 1933
@@ -2087,7 +2020,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2087 { 2020 {
2088 rdata.Fail(code, desc); 2021 rdata.Fail(code, desc);
2089 } 2022 }
2090
2091 } 2023 }
2092 } 2024 }
2093} 2025}