aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetInventoryServer/Utils.cs
diff options
context:
space:
mode:
authorMike Mazur2009-03-05 08:29:52 +0000
committerMike Mazur2009-03-05 08:29:52 +0000
commit367606227774c4551a8929b2b42f8d014efff318 (patch)
treef4d9bfe81c36c62a1c62bef29f95835aa61ffa0f /OpenSim/Grid/AssetInventoryServer/Utils.cs
parentA couple cosmetic changes in inventory storage plugin. (diff)
downloadopensim-SC_OLD-367606227774c4551a8929b2b42f8d014efff318.zip
opensim-SC_OLD-367606227774c4551a8929b2b42f8d014efff318.tar.gz
opensim-SC_OLD-367606227774c4551a8929b2b42f8d014efff318.tar.bz2
opensim-SC_OLD-367606227774c4551a8929b2b42f8d014efff318.tar.xz
Use Inventory{Item,Folder}Base in AssetInventoryServer.
Also the first inventory storage methods are implemented.
Diffstat (limited to 'OpenSim/Grid/AssetInventoryServer/Utils.cs')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Utils.cs49
1 files changed, 25 insertions, 24 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Utils.cs b/OpenSim/Grid/AssetInventoryServer/Utils.cs
index cc59051..58b0c67 100644
--- a/OpenSim/Grid/AssetInventoryServer/Utils.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Utils.cs
@@ -30,6 +30,7 @@ using System.Globalization;
30using System.Xml; 30using System.Xml;
31using System.Xml.Serialization; 31using System.Xml.Serialization;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework;
33using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
34 35
35namespace OpenSim.Grid.AssetInventoryServer 36namespace OpenSim.Grid.AssetInventoryServer
@@ -278,9 +279,9 @@ namespace OpenSim.Grid.AssetInventoryServer
278 return ReadObject_InventoryCollection(true, true); 279 return ReadObject_InventoryCollection(true, true);
279 } 280 }
280 281
281 public InventoryFolder ReadObject_InventoryFolder(bool isNullable, bool checkType) 282 public InventoryFolderWithChildren ReadObject_InventoryFolder(bool isNullable, bool checkType)
282 { 283 {
283 InventoryFolder ob = null; 284 InventoryFolderWithChildren ob = null;
284 if (isNullable && ReadNull()) return null; 285 if (isNullable && ReadNull()) return null;
285 286
286 if (checkType) 287 if (checkType)
@@ -292,7 +293,7 @@ namespace OpenSim.Grid.AssetInventoryServer
292 throw CreateUnknownTypeException(t); 293 throw CreateUnknownTypeException(t);
293 } 294 }
294 295
295 ob = (InventoryFolder)Activator.CreateInstance(typeof(InventoryFolder), true); 296 ob = (InventoryFolderWithChildren)Activator.CreateInstance(typeof(InventoryFolderWithChildren), true);
296 297
297 Reader.MoveToElement(); 298 Reader.MoveToElement();
298 299
@@ -373,9 +374,9 @@ namespace OpenSim.Grid.AssetInventoryServer
373 return ob; 374 return ob;
374 } 375 }
375 376
376 public InventoryItem ReadObject_InventoryItem(bool isNullable, bool checkType) 377 public InventoryItemBase ReadObject_InventoryItem(bool isNullable, bool checkType)
377 { 378 {
378 InventoryItem ob = null; 379 InventoryItemBase ob = null;
379 if (isNullable && ReadNull()) return null; 380 if (isNullable && ReadNull()) return null;
380 381
381 if (checkType) 382 if (checkType)
@@ -387,7 +388,7 @@ namespace OpenSim.Grid.AssetInventoryServer
387 throw CreateUnknownTypeException(t); 388 throw CreateUnknownTypeException(t);
388 } 389 }
389 390
390 ob = (InventoryItem)Activator.CreateInstance(typeof(InventoryItem), true); 391 ob = (InventoryItemBase)Activator.CreateInstance(typeof(InventoryItemBase), true);
391 392
392 Reader.MoveToElement(); 393 Reader.MoveToElement();
393 394
@@ -585,11 +586,11 @@ namespace OpenSim.Grid.AssetInventoryServer
585 Reader.Skip(); 586 Reader.Skip();
586 if (ob.@Folders == null) 587 if (ob.@Folders == null)
587 { 588 {
588 ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); 589 ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren>();
589 } 590 }
590 if (ob.@Items == null) 591 if (ob.@Items == null)
591 { 592 {
592 ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); 593 ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItemBase>();
593 } 594 }
594 return ob; 595 return ob;
595 } 596 }
@@ -610,10 +611,10 @@ namespace OpenSim.Grid.AssetInventoryServer
610 } 611 }
611 else if (Reader.LocalName == "Items" && Reader.NamespaceURI == "" && !b44) 612 else if (Reader.LocalName == "Items" && Reader.NamespaceURI == "" && !b44)
612 { 613 {
613 System.Collections.Generic.Dictionary<UUID, InventoryItem> o46 = ob.@Items; 614 System.Collections.Generic.Dictionary<UUID, InventoryItemBase> o46 = ob.@Items;
614 if (((object)o46) == null) 615 if (((object)o46) == null)
615 { 616 {
616 o46 = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); 617 o46 = new System.Collections.Generic.Dictionary<UUID, InventoryItemBase>();
617 ob.@Items = o46; 618 ob.@Items = o46;
618 } 619 }
619 if (Reader.IsEmptyElement) 620 if (Reader.IsEmptyElement)
@@ -634,7 +635,7 @@ namespace OpenSim.Grid.AssetInventoryServer
634 { 635 {
635 if (((object)o46) == null) 636 if (((object)o46) == null)
636 throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryItemBase>"); 637 throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryItemBase>");
637 InventoryItem item = ReadObject_InventoryItem(true, true); 638 InventoryItemBase item = ReadObject_InventoryItem(true, true);
638 o46.Add(item.ID, item); 639 o46.Add(item.ID, item);
639 n47++; 640 n47++;
640 } 641 }
@@ -650,10 +651,10 @@ namespace OpenSim.Grid.AssetInventoryServer
650 } 651 }
651 else if (Reader.LocalName == "Folders" && Reader.NamespaceURI == "" && !b43) 652 else if (Reader.LocalName == "Folders" && Reader.NamespaceURI == "" && !b43)
652 { 653 {
653 System.Collections.Generic.Dictionary<UUID, InventoryFolder> o48 = ob.@Folders; 654 System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren> o48 = ob.@Folders;
654 if (((object)o48) == null) 655 if (((object)o48) == null)
655 { 656 {
656 o48 = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); 657 o48 = new System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren>();
657 ob.@Folders = o48; 658 ob.@Folders = o48;
658 } 659 }
659 if (Reader.IsEmptyElement) 660 if (Reader.IsEmptyElement)
@@ -674,7 +675,7 @@ namespace OpenSim.Grid.AssetInventoryServer
674 { 675 {
675 if (((object)o48) == null) 676 if (((object)o48) == null)
676 throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryFolderBase>"); 677 throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryFolderBase>");
677 InventoryFolder folder = ReadObject_InventoryFolder(true, true); 678 InventoryFolderWithChildren folder = ReadObject_InventoryFolder(true, true);
678 o48.Add(folder.ID, folder); 679 o48.Add(folder.ID, folder);
679 n49++; 680 n49++;
680 } 681 }
@@ -700,11 +701,11 @@ namespace OpenSim.Grid.AssetInventoryServer
700 } 701 }
701 if (ob.@Folders == null) 702 if (ob.@Folders == null)
702 { 703 {
703 ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); 704 ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren>();
704 } 705 }
705 if (ob.@Items == null) 706 if (ob.@Items == null)
706 { 707 {
707 ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); 708 ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItemBase>();
708 } 709 }
709 710
710 ReadEndElement(); 711 ReadEndElement();
@@ -793,7 +794,7 @@ namespace OpenSim.Grid.AssetInventoryServer
793 public void WriteRoot_InventoryFolder(object o) 794 public void WriteRoot_InventoryFolder(object o)
794 { 795 {
795 WriteStartDocument(); 796 WriteStartDocument();
796 InventoryFolder ob = (InventoryFolder)o; 797 InventoryFolderWithChildren ob = (InventoryFolderWithChildren)o;
797 TopLevelElement(); 798 TopLevelElement();
798 WriteObject_InventoryFolder(ob, "InventoryFolderBase", "", true, false, true); 799 WriteObject_InventoryFolder(ob, "InventoryFolderBase", "", true, false, true);
799 } 800 }
@@ -801,7 +802,7 @@ namespace OpenSim.Grid.AssetInventoryServer
801 public void WriteRoot_InventoryItem(object o) 802 public void WriteRoot_InventoryItem(object o)
802 { 803 {
803 WriteStartDocument(); 804 WriteStartDocument();
804 InventoryItem ob = (InventoryItem)o; 805 InventoryItemBase ob = (InventoryItemBase)o;
805 TopLevelElement(); 806 TopLevelElement();
806 WriteObject_InventoryItem(ob, "InventoryItemBase", "", true, false, true); 807 WriteObject_InventoryItem(ob, "InventoryItemBase", "", true, false, true);
807 } 808 }
@@ -814,7 +815,7 @@ namespace OpenSim.Grid.AssetInventoryServer
814 WriteObject_InventoryCollection(ob, "InventoryCollection", "", true, false, true); 815 WriteObject_InventoryCollection(ob, "InventoryCollection", "", true, false, true);
815 } 816 }
816 817
817 void WriteObject_InventoryFolder(InventoryFolder ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) 818 void WriteObject_InventoryFolder(InventoryFolderWithChildren ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
818 { 819 {
819 if (((object)ob) == null) 820 if (((object)ob) == null)
820 { 821 {
@@ -824,7 +825,7 @@ namespace OpenSim.Grid.AssetInventoryServer
824 } 825 }
825 826
826 System.Type type = ob.GetType(); 827 System.Type type = ob.GetType();
827 if (type == typeof(InventoryFolder)) 828 if (type == typeof(InventoryFolderWithChildren))
828 { } 829 { }
829 else 830 else
830 { 831 {
@@ -847,7 +848,7 @@ namespace OpenSim.Grid.AssetInventoryServer
847 if (writeWrappingElem) WriteEndElement(ob); 848 if (writeWrappingElem) WriteEndElement(ob);
848 } 849 }
849 850
850 void WriteObject_InventoryItem(InventoryItem ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) 851 void WriteObject_InventoryItem(InventoryItemBase ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
851 { 852 {
852 if (((object)ob) == null) 853 if (((object)ob) == null)
853 { 854 {
@@ -857,7 +858,7 @@ namespace OpenSim.Grid.AssetInventoryServer
857 } 858 }
858 859
859 System.Type type = ob.GetType(); 860 System.Type type = ob.GetType();
860 if (type == typeof(InventoryItem)) 861 if (type == typeof(InventoryItemBase))
861 { } 862 { }
862 else 863 else
863 { 864 {
@@ -921,7 +922,7 @@ namespace OpenSim.Grid.AssetInventoryServer
921 if (ob.@Folders != null) 922 if (ob.@Folders != null)
922 { 923 {
923 WriteStartElement("Folders", "", ob.@Folders); 924 WriteStartElement("Folders", "", ob.@Folders);
924 foreach (InventoryFolder folder in ob.Folders.Values) 925 foreach (InventoryFolderWithChildren folder in ob.Folders.Values)
925 { 926 {
926 WriteObject_InventoryFolder(folder, "InventoryFolderBase", "", true, false, true); 927 WriteObject_InventoryFolder(folder, "InventoryFolderBase", "", true, false, true);
927 } 928 }
@@ -930,7 +931,7 @@ namespace OpenSim.Grid.AssetInventoryServer
930 if (ob.@Items != null) 931 if (ob.@Items != null)
931 { 932 {
932 WriteStartElement("Items", "", ob.@Items); 933 WriteStartElement("Items", "", ob.@Items);
933 foreach (InventoryItem item in ob.Items.Values) 934 foreach (InventoryItemBase item in ob.Items.Values)
934 { 935 {
935 WriteObject_InventoryItem(item, "InventoryItemBase", "", true, false, true); 936 WriteObject_InventoryItem(item, "InventoryItemBase", "", true, false, true);
936 } 937 }