aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-12-11 20:58:11 +0000
committerJustin Clarke Casey2008-12-11 20:58:11 +0000
commit80e267dcfec335c5402922c4eb5587df9603f94d (patch)
tree0e81c20ec152e48dd52ed551a727d491d326bc95 /OpenSim
parentmake a couple of other config default to make the example ini to give us (diff)
downloadopensim-SC-80e267dcfec335c5402922c4eb5587df9603f94d.zip
opensim-SC-80e267dcfec335c5402922c4eb5587df9603f94d.tar.gz
opensim-SC-80e267dcfec335c5402922c4eb5587df9603f94d.tar.bz2
opensim-SC-80e267dcfec335c5402922c4eb5587df9603f94d.tar.xz
* refactor: Stop exposing InventoryFolderImpl.SubFolders publicly
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs45
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs93
-rw-r--r--OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs2
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs10
5 files changed, 91 insertions, 63 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index d3e715f..d597aad 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -161,29 +161,27 @@ namespace OpenSim.Framework.Communications.Cache
161 List<InventoryFolderImpl> resolvedFolders = new List<InventoryFolderImpl>(); // Folders we've resolved with this invocation 161 List<InventoryFolderImpl> resolvedFolders = new List<InventoryFolderImpl>(); // Folders we've resolved with this invocation
162 foreach (InventoryFolderImpl folder in receivedFolderDictionary[parentFolder.ID]) 162 foreach (InventoryFolderImpl folder in receivedFolderDictionary[parentFolder.ID])
163 { 163 {
164 lock (parentFolder.SubFolders) 164 if (parentFolder.ContainsChildFolder(folder.ID))
165 { 165 {
166 if (parentFolder.SubFolders.ContainsKey(folder.ID)) 166 m_log.WarnFormat(
167 "[INVENTORY CACHE]: Received folder {0} {1} from inventory service which has already been received",
168 folder.Name, folder.ID);
169 }
170 else
171 {
172 if (resolvedFolderDictionary.ContainsKey(folder.ID))
167 { 173 {
168 m_log.WarnFormat( 174 m_log.WarnFormat(
169 "[INVENTORY CACHE]: Received folder {0} {1} from inventory service which has already been received", 175 "[INVENTORY CACHE]: Received folder {0} {1} from inventory service has already been received but with different parent",
170 folder.Name, folder.ID); 176 folder.Name, folder.ID);
171 } 177 }
172 else 178 else
173 { 179 {
174 if ( resolvedFolderDictionary.ContainsKey( folder.ID ) ) { 180 resolvedFolders.Add(folder);
175 m_log.WarnFormat( 181 resolvedFolderDictionary[folder.ID] = folder;
176 "[INVENTORY CACHE]: Received folder {0} {1} from inventory service has already been received but with different parent", 182 parentFolder.AddChildFolder(folder);
177 folder.Name, folder.ID); 183 }
178 } 184 }
179 else
180 {
181 resolvedFolders.Add(folder);
182 resolvedFolderDictionary[folder.ID] = folder;
183 parentFolder.SubFolders.Add(folder.ID, folder);
184 }
185 }
186 } // lock (parentFolder.SubFolders)
187 } // foreach (folder in pendingCategorizationFolders[parentFolder.ID]) 185 } // foreach (folder in pendingCategorizationFolders[parentFolder.ID])
188 186
189 receivedFolderDictionary.Remove(parentFolder.ID); 187 receivedFolderDictionary.Remove(parentFolder.ID);
@@ -738,20 +736,17 @@ namespace OpenSim.Framework.Communications.Cache
738 } 736 }
739 } 737 }
740 738
739 /// <summary>
740 /// Find an appropriate folder for the given asset type
741 /// </summary>
742 /// <param name="type"></param>
743 /// <returns>null if no appropriate folder exists</returns>
741 public InventoryFolderImpl FindFolderForType(int type) 744 public InventoryFolderImpl FindFolderForType(int type)
742 { 745 {
743 if (RootFolder == null) 746 if (RootFolder == null)
744 return null; 747 return null;
745 748
746 lock (RootFolder.SubFolders) 749 return RootFolder.FindFolderForType(type);
747 {
748 foreach (InventoryFolderImpl f in RootFolder.SubFolders.Values)
749 {
750 if (f.Type == type)
751 return f;
752 }
753 }
754 return null;
755 } 750 }
756 } 751 }
757 752
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
index 933d40a..4c629f4 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Communications.Cache
48 /// <summary> 48 /// <summary>
49 /// Child folders that are contained in this folder 49 /// Child folders that are contained in this folder
50 /// </summary> 50 /// </summary>
51 public Dictionary<UUID, InventoryFolderImpl> SubFolders = new Dictionary<UUID, InventoryFolderImpl>(); 51 protected Dictionary<UUID, InventoryFolderImpl> m_childFolders = new Dictionary<UUID, InventoryFolderImpl>();
52 52
53 // Constructors 53 // Constructors
54 public InventoryFolderImpl(InventoryFolderBase folderbase) 54 public InventoryFolderImpl(InventoryFolderBase folderbase)
@@ -74,9 +74,9 @@ namespace OpenSim.Framework.Communications.Cache
74 /// <returns>The newly created subfolder. Returns null if the folder already exists</returns> 74 /// <returns>The newly created subfolder. Returns null if the folder already exists</returns>
75 public InventoryFolderImpl CreateChildFolder(UUID folderID, string folderName, ushort type) 75 public InventoryFolderImpl CreateChildFolder(UUID folderID, string folderName, ushort type)
76 { 76 {
77 lock (SubFolders) 77 lock (m_childFolders)
78 { 78 {
79 if (!SubFolders.ContainsKey(folderID)) 79 if (!m_childFolders.ContainsKey(folderID))
80 { 80 {
81 InventoryFolderImpl subFold = new InventoryFolderImpl(); 81 InventoryFolderImpl subFold = new InventoryFolderImpl();
82 subFold.Name = folderName; 82 subFold.Name = folderName;
@@ -84,7 +84,7 @@ namespace OpenSim.Framework.Communications.Cache
84 subFold.Type = (short) type; 84 subFold.Type = (short) type;
85 subFold.ParentID = this.ID; 85 subFold.ParentID = this.ID;
86 subFold.Owner = Owner; 86 subFold.Owner = Owner;
87 SubFolders.Add(subFold.ID, subFold); 87 m_childFolders.Add(subFold.ID, subFold);
88 88
89 return subFold; 89 return subFold;
90 } 90 }
@@ -99,14 +99,24 @@ namespace OpenSim.Framework.Communications.Cache
99 /// <param name="folder"></param> 99 /// <param name="folder"></param>
100 public void AddChildFolder(InventoryFolderImpl folder) 100 public void AddChildFolder(InventoryFolderImpl folder)
101 { 101 {
102 lock (SubFolders) 102 lock (m_childFolders)
103 { 103 {
104 folder.ParentID = ID; 104 folder.ParentID = ID;
105 SubFolders[folder.ID] = folder; 105 m_childFolders[folder.ID] = folder;
106 } 106 }
107 } 107 }
108 108
109 /// <summary> 109 /// <summary>
110 /// Does this folder contain the given child folder?
111 /// </summary>
112 /// <param name="folderID"></param>
113 /// <returns></returns>
114 public bool ContainsChildFolder(UUID folderID)
115 {
116 return m_childFolders.ContainsKey(folderID);
117 }
118
119 /// <summary>
110 /// Get a child folder 120 /// Get a child folder
111 /// </summary> 121 /// </summary>
112 /// <param name="folderID"></param> 122 /// <param name="folderID"></param>
@@ -115,9 +125,9 @@ namespace OpenSim.Framework.Communications.Cache
115 { 125 {
116 InventoryFolderImpl folder = null; 126 InventoryFolderImpl folder = null;
117 127
118 lock (SubFolders) 128 lock (m_childFolders)
119 { 129 {
120 SubFolders.TryGetValue(folderID, out folder); 130 m_childFolders.TryGetValue(folderID, out folder);
121 } 131 }
122 132
123 return folder; 133 return folder;
@@ -134,12 +144,12 @@ namespace OpenSim.Framework.Communications.Cache
134 { 144 {
135 InventoryFolderImpl removedFolder = null; 145 InventoryFolderImpl removedFolder = null;
136 146
137 lock (SubFolders) 147 lock (m_childFolders)
138 { 148 {
139 if (SubFolders.ContainsKey(folderID)) 149 if (m_childFolders.ContainsKey(folderID))
140 { 150 {
141 removedFolder = SubFolders[folderID]; 151 removedFolder = m_childFolders[folderID];
142 SubFolders.Remove(folderID); 152 m_childFolders.Remove(folderID);
143 } 153 }
144 } 154 }
145 155
@@ -151,12 +161,12 @@ namespace OpenSim.Framework.Communications.Cache
151 /// </summary> 161 /// </summary>
152 public void Purge() 162 public void Purge()
153 { 163 {
154 foreach (InventoryFolderImpl folder in SubFolders.Values) 164 foreach (InventoryFolderImpl folder in m_childFolders.Values)
155 { 165 {
156 folder.Purge(); 166 folder.Purge();
157 } 167 }
158 168
159 SubFolders.Clear(); 169 m_childFolders.Clear();
160 Items.Clear(); 170 Items.Clear();
161 } 171 }
162 172
@@ -175,9 +185,9 @@ namespace OpenSim.Framework.Communications.Cache
175 } 185 }
176 } 186 }
177 187
178 lock (SubFolders) 188 lock (m_childFolders)
179 { 189 {
180 foreach (InventoryFolderImpl folder in SubFolders.Values) 190 foreach (InventoryFolderImpl folder in m_childFolders.Values)
181 { 191 {
182 InventoryItemBase item = folder.FindItem(itemID); 192 InventoryItemBase item = folder.FindItem(itemID);
183 193
@@ -202,9 +212,9 @@ namespace OpenSim.Framework.Communications.Cache
202 } 212 }
203 } 213 }
204 214
205 lock (SubFolders) 215 lock (m_childFolders)
206 { 216 {
207 foreach (InventoryFolderImpl folder in SubFolders.Values) 217 foreach (InventoryFolderImpl folder in m_childFolders.Values)
208 { 218 {
209 InventoryItemBase item = folder.FindAsset(assetID); 219 InventoryItemBase item = folder.FindAsset(assetID);
210 220
@@ -236,9 +246,9 @@ namespace OpenSim.Framework.Communications.Cache
236 } 246 }
237 } 247 }
238 248
239 lock (SubFolders) 249 lock (m_childFolders)
240 { 250 {
241 foreach (InventoryFolderImpl folder in SubFolders.Values) 251 foreach (InventoryFolderImpl folder in m_childFolders.Values)
242 { 252 {
243 found = folder.DeleteItem(itemID); 253 found = folder.DeleteItem(itemID);
244 254
@@ -262,9 +272,9 @@ namespace OpenSim.Framework.Communications.Cache
262 if (folderID == ID) 272 if (folderID == ID)
263 return this; 273 return this;
264 274
265 lock (SubFolders) 275 lock (m_childFolders)
266 { 276 {
267 foreach (InventoryFolderImpl folder in SubFolders.Values) 277 foreach (InventoryFolderImpl folder in m_childFolders.Values)
268 { 278 {
269 InventoryFolderImpl returnFolder = folder.FindFolder(folderID); 279 InventoryFolderImpl returnFolder = folder.FindFolder(folderID);
270 280
@@ -274,7 +284,26 @@ namespace OpenSim.Framework.Communications.Cache
274 } 284 }
275 285
276 return null; 286 return null;
277 } 287 }
288
289 /// <summary>
290 /// Look through all child subfolders for a folder marked as one for a particular asset type, and return it.
291 /// </summary>
292 /// <param name="type"></param>
293 /// <returns>Returns null if no such folder is found</returns>
294 public InventoryFolderImpl FindFolderForType(int type)
295 {
296 lock (m_childFolders)
297 {
298 foreach (InventoryFolderImpl f in m_childFolders.Values)
299 {
300 if (f.Type == type)
301 return f;
302 }
303 }
304
305 return null;
306 }
278 307
279 /// <summary> 308 /// <summary>
280 /// Find a folder given a PATH_DELIMITOR delimited path starting from this folder 309 /// Find a folder given a PATH_DELIMITOR delimited path starting from this folder
@@ -297,9 +326,9 @@ namespace OpenSim.Framework.Communications.Cache
297 326
298 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); 327 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
299 328
300 lock (SubFolders) 329 lock (m_childFolders)
301 { 330 {
302 foreach (InventoryFolderImpl folder in SubFolders.Values) 331 foreach (InventoryFolderImpl folder in m_childFolders.Values)
303 { 332 {
304 if (folder.Name == components[0]) 333 if (folder.Name == components[0])
305 if (components.Length > 1) 334 if (components.Length > 1)
@@ -344,9 +373,9 @@ namespace OpenSim.Framework.Communications.Cache
344 } 373 }
345 else 374 else
346 { 375 {
347 lock (SubFolders) 376 lock (m_childFolders)
348 { 377 {
349 foreach (InventoryFolderImpl folder in SubFolders.Values) 378 foreach (InventoryFolderImpl folder in m_childFolders.Values)
350 { 379 {
351 if (folder.Name == components[0]) 380 if (folder.Name == components[0])
352 return folder.FindItemByPath(components[1]); 381 return folder.FindItemByPath(components[1]);
@@ -385,9 +414,9 @@ namespace OpenSim.Framework.Communications.Cache
385 { 414 {
386 List<InventoryFolderBase> folderList = new List<InventoryFolderBase>(); 415 List<InventoryFolderBase> folderList = new List<InventoryFolderBase>();
387 416
388 lock (SubFolders) 417 lock (m_childFolders)
389 { 418 {
390 foreach (InventoryFolderBase folder in SubFolders.Values) 419 foreach (InventoryFolderBase folder in m_childFolders.Values)
391 { 420 {
392 folderList.Add(folder); 421 folderList.Add(folder);
393 } 422 }
@@ -400,9 +429,9 @@ namespace OpenSim.Framework.Communications.Cache
400 { 429 {
401 List<InventoryFolderImpl> folderList = new List<InventoryFolderImpl>(); 430 List<InventoryFolderImpl> folderList = new List<InventoryFolderImpl>();
402 431
403 lock (SubFolders) 432 lock (m_childFolders)
404 { 433 {
405 foreach (InventoryFolderImpl folder in SubFolders.Values) 434 foreach (InventoryFolderImpl folder in m_childFolders.Values)
406 { 435 {
407 folderList.Add(folder); 436 folderList.Add(folder);
408 } 437 }
@@ -421,7 +450,7 @@ namespace OpenSim.Framework.Communications.Cache
421 { 450 {
422 int total = Items.Count; 451 int total = Items.Count;
423 452
424 foreach (InventoryFolderImpl folder in SubFolders.Values) 453 foreach (InventoryFolderImpl folder in m_childFolders.Values)
425 { 454 {
426 total = total + folder.TotalCount; 455 total = total + folder.TotalCount;
427 } 456 }
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
index 437e5e4..cf3490b 100644
--- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
@@ -142,7 +142,7 @@ namespace OpenSim.Framework.Communications.Cache
142 InventoryFolderImpl parentFolder = libraryFolders[folderInfo.ParentID]; 142 InventoryFolderImpl parentFolder = libraryFolders[folderInfo.ParentID];
143 143
144 libraryFolders.Add(folderInfo.ID, folderInfo); 144 libraryFolders.Add(folderInfo.ID, folderInfo);
145 parentFolder.SubFolders.Add(folderInfo.ID, folderInfo); 145 parentFolder.AddChildFolder(folderInfo);
146 146
147// m_log.InfoFormat("[LIBRARY INVENTORY]: Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID); 147// m_log.InfoFormat("[LIBRARY INVENTORY]: Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID);
148 } 148 }
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index f209fd4..9c07734 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -106,11 +106,11 @@ namespace OpenSim.Framework.Communications.Tests
106 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); 106 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
107 107
108 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); 108 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010");
109 Assert.That(userInfo.RootFolder.SubFolders.ContainsKey(folderId), Is.False); 109 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False);
110 110
111 userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID); 111 userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID);
112 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); 112 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null);
113 Assert.That(userInfo.RootFolder.SubFolders.ContainsKey(folderId), Is.True); 113 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
114 } 114 }
115 115
116 /// <summary> 116 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 335f247..2546a26 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1884,10 +1884,14 @@ namespace OpenSim.Region.Environment.Scenes
1884 { 1884 {
1885 if (!grp.HasGroupChanged) 1885 if (!grp.HasGroupChanged)
1886 { 1886 {
1887 m_log.InfoFormat("[ATTACHMENT] Save request for {0} which is unchanged", grp.UUID.ToString()); 1887 m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID);
1888 return; 1888 return;
1889 } 1889 }
1890 m_log.InfoFormat("[ATTACHMENT] Updating asset for attachment {0}, attachpoint {1}", grp.UUID.ToString(), grp.GetAttachmentPoint()); 1890
1891 m_log.InfoFormat(
1892 "[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}",
1893 grp.UUID, grp.GetAttachmentPoint());
1894
1891 string sceneObjectXml = objectGroup.ToXmlString(); 1895 string sceneObjectXml = objectGroup.ToXmlString();
1892 1896
1893 CachedUserInfo userInfo = 1897 CachedUserInfo userInfo =
@@ -1917,7 +1921,7 @@ namespace OpenSim.Region.Environment.Scenes
1917 } 1921 }
1918 else 1922 else
1919 { 1923 {
1920 foreach (InventoryFolderImpl subfld in fld.SubFolders.Values) 1924 foreach (InventoryFolderImpl subfld in fld.RequestListOfFolderImpls())
1921 { 1925 {
1922 searchfolders.Enqueue(subfld); 1926 searchfolders.Enqueue(subfld);
1923 } 1927 }