aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-11 20:37:26 +0000
committerJustin Clarke Casey2008-04-11 20:37:26 +0000
commitb3f783ae056fd2e8921336a1d459d91c7df97ce3 (patch)
tree0cb69554ade962cdb1db4e853e1da564c1e2f4a9 /OpenSim
parent* Minor refactoring in OGS1InventoryService (diff)
downloadopensim-SC_OLD-b3f783ae056fd2e8921336a1d459d91c7df97ce3.zip
opensim-SC_OLD-b3f783ae056fd2e8921336a1d459d91c7df97ce3.tar.gz
opensim-SC_OLD-b3f783ae056fd2e8921336a1d459d91c7df97ce3.tar.bz2
opensim-SC_OLD-b3f783ae056fd2e8921336a1d459d91c7df97ce3.tar.xz
* Reduce publicly exposed fields on InventoryCollection, which was causing duplicate sets of inventory data to be sent over the grid
* Won't actually fix anything, since we were handling the problem anyway * Also add more doc, fix up debugging messages, etc
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/InventoryCollection.cs45
-rw-r--r--OpenSim/Framework/Servers/RestObjectPosterResponse.cs11
-rw-r--r--OpenSim/Grid/InventoryServer/GridInventoryService.cs59
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs10
4 files changed, 48 insertions, 77 deletions
diff --git a/OpenSim/Framework/InventoryCollection.cs b/OpenSim/Framework/InventoryCollection.cs
index e76e1a9..abccf49 100644
--- a/OpenSim/Framework/InventoryCollection.cs
+++ b/OpenSim/Framework/InventoryCollection.cs
@@ -37,47 +37,8 @@ namespace OpenSim.Framework
37 /// </summary> 37 /// </summary>
38 public class InventoryCollection 38 public class InventoryCollection
39 { 39 {
40 public List<InventoryFolderBase> _folders; 40 public List<InventoryFolderBase> Folders;
41 public List<InventoryItemBase> _allItems; 41 public List<InventoryItemBase> Items;
42 public LLUUID _userID; 42 public LLUUID UserID;
43
44 public List<InventoryFolderBase> Folders {
45 get {
46 return _folders;
47 }
48 set {
49 _folders = value;
50 }
51 }
52
53 public List<InventoryItemBase> AllItems {
54 get {
55 return _allItems;
56 }
57 set {
58 _allItems = value;
59 }
60 }
61
62 public LLUUID UserID {
63 get {
64 return _userID;
65 }
66 set {
67 _userID = value;
68 }
69 }
70
71 public InventoryCollection()
72 {
73 _folders = new List<InventoryFolderBase>();
74 _allItems = new List<InventoryItemBase>();
75 }
76
77 public InventoryCollection(List<InventoryFolderBase> folders, List<InventoryItemBase> allItems)
78 {
79 _folders = folders;
80 _allItems = allItems;
81 }
82 } 43 }
83} 44}
diff --git a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
index 1d99a80..1410afd 100644
--- a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
+++ b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
@@ -41,6 +41,9 @@ namespace OpenSim.Framework.Servers
41 /// </summary> 41 /// </summary>
42 public class RestObjectPosterResponse<TResponse> 42 public class RestObjectPosterResponse<TResponse>
43 { 43 {
44// private static readonly log4net.ILog m_log
45// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46
44 public ReturnResponse<TResponse> ResponseCallback; 47 public ReturnResponse<TResponse> ResponseCallback;
45 48
46 public void BeginPostObject<TRequest>(string requestUrl, TRequest obj) 49 public void BeginPostObject<TRequest>(string requestUrl, TRequest obj)
@@ -83,7 +86,13 @@ namespace OpenSim.Framework.Servers
83 { 86 {
84 TResponse deserial; 87 TResponse deserial;
85 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); 88 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
86 deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream()); 89 Stream stream = resp.GetResponseStream();
90
91 // This is currently a bad debug stanza since it gobbles us the response...
92// StreamReader reader = new StreamReader(stream);
93// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd());
94
95 deserial = (TResponse) deserializer.Deserialize(stream);
87 96
88 if (deserial != null && ResponseCallback != null) 97 if (deserial != null && ResponseCallback != null)
89 { 98 {
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
index 72d43d4..8a45bad 100644
--- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs
+++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
@@ -37,9 +37,13 @@ using OpenSim.Framework.Console;
37 37
38namespace OpenSim.Grid.InventoryServer 38namespace OpenSim.Grid.InventoryServer
39{ 39{
40 /// <summary>
41 /// Used on a grid server to satisfy external inventory requests
42 /// </summary>
40 public class GridInventoryService : InventoryServiceBase 43 public class GridInventoryService : InventoryServiceBase
41 { 44 {
42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly log4net.ILog m_log
46 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43 47
44 public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback) 48 public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback)
45 { 49 {
@@ -110,7 +114,7 @@ namespace OpenSim.Grid.InventoryServer
110 114
111 LLUUID userID = new LLUUID(rawUserID); 115 LLUUID userID = new LLUUID(rawUserID);
112 116
113 m_log.InfoFormat("[AGENT INVENTORY]: Processing request for inventory of {0}", userID); 117 m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID);
114 118
115 InventoryCollection invCollection = new InventoryCollection(); 119 InventoryCollection invCollection = new InventoryCollection();
116 120
@@ -118,7 +122,7 @@ namespace OpenSim.Grid.InventoryServer
118 122
119 if (null == allFolders) 123 if (null == allFolders)
120 { 124 {
121 m_log.WarnFormat("[AGENT INVENTORY]: No inventory found for user {0}", rawUserID); 125 m_log.WarnFormat("[GRID AGENT INVENTORY]: No inventory found for user {0}", rawUserID);
122 126
123 return invCollection; 127 return invCollection;
124 } 128 }
@@ -135,23 +139,23 @@ namespace OpenSim.Grid.InventoryServer
135 } 139 }
136 } 140 }
137 141
138 invCollection.AllItems = allItems;
139 invCollection.Folders = allFolders;
140 invCollection.UserID = userID; 142 invCollection.UserID = userID;
143 invCollection.Folders = allFolders;
144 invCollection.Items = allItems;
141 145
142// foreach (InventoryFolderBase folder in folders) 146// foreach (InventoryFolderBase folder in invCollection.Folders)
143// { 147// {
144// m_log.DebugFormat( 148// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
145// "[AGENT INVENTORY]: Sending back folder {0}, {1}",
146// folder.name, folder.folderID);
147// } 149// }
148// 150//
149// foreach (InventoryItemBase item in allItems) 151// foreach (InventoryItemBase item in invCollection.Items)
150// { 152// {
151// m_log.DebugFormat( 153// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
152// "[AGENT INVENTORY]: Sending back item {0}, {1}, folder {2}",
153// item.inventoryName, item.inventoryID, item.parentFolderID);
154// } 154// }
155
156 m_log.InfoFormat(
157 "[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items",
158 invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
155 159
156 return invCollection; 160 return invCollection;
157 } 161 }
@@ -176,8 +180,7 @@ namespace OpenSim.Grid.InventoryServer
176 { 180 {
177 LLUUID userID = new LLUUID(rawUserID); 181 LLUUID userID = new LLUUID(rawUserID);
178 182
179 m_log.Info( 183 m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID);
180 "[AGENT INVENTORY]: Creating new set of inventory folders for " + userID.ToString());
181 184
182 CreateNewUserInventory(userID); 185 CreateNewUserInventory(userID);
183 return true; 186 return true;
@@ -202,10 +205,7 @@ namespace OpenSim.Grid.InventoryServer
202 public bool AddInventoryFolder(InventoryFolderBase folder) 205 public bool AddInventoryFolder(InventoryFolderBase folder)
203 { 206 {
204 // Right now, this actions act more like an update/insert combination than a simple create. 207 // Right now, this actions act more like an update/insert combination than a simple create.
205 m_log.Info( 208 m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating folder {0} {1} in folder {2}", folder.Name, folder.ID, folder.ParentID);
206 "[AGENT INVENTORY]: " +
207 "Updating in " + folder.ParentID.ToString()
208 + ", folder " + folder.Name);
209 209
210 AddNewInventoryFolder(folder.Owner, folder); 210 AddNewInventoryFolder(folder.Owner, folder);
211 return true; 211 return true;
@@ -213,10 +213,7 @@ namespace OpenSim.Grid.InventoryServer
213 213
214 public bool MoveInventoryFolder(InventoryFolderBase folder) 214 public bool MoveInventoryFolder(InventoryFolderBase folder)
215 { 215 {
216 m_log.Info( 216 m_log.InfoFormat("[GRID AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
217 "[AGENT INVENTORY]: " +
218 "Moving folder " + folder.ID
219 + " to " + folder.ParentID.ToString());
220 217
221 MoveExistingInventoryFolder(folder); 218 MoveExistingInventoryFolder(folder);
222 return true; 219 return true;
@@ -225,10 +222,7 @@ namespace OpenSim.Grid.InventoryServer
225 public bool AddInventoryItem(InventoryItemBase item) 222 public bool AddInventoryItem(InventoryItemBase item)
226 { 223 {
227 // Right now, this actions act more like an update/insert combination than a simple create. 224 // Right now, this actions act more like an update/insert combination than a simple create.
228 m_log.Info( 225 m_log.InfoFormat("[GRID AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
229 "[AGENT INVENTORY]: " +
230 "Updating in " + item.Folder.ToString()
231 + ", item " + item.Name);
232 226
233 AddNewInventoryItem(item.Owner, item); 227 AddNewInventoryItem(item.Owner, item);
234 return true; 228 return true;
@@ -236,15 +230,16 @@ namespace OpenSim.Grid.InventoryServer
236 230
237 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 231 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
238 { 232 {
239 // extra spaces to align with other inventory messages 233 m_log.InfoFormat("[GRID AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
240 m_log.Info(
241 "[AGENT INVENTORY]: " +
242 "Deleting in " + item.Folder.ToString()
243 + ", item " + item.Name);
244 234
245 DeleteItem(item); 235 DeleteItem(item);
246 } 236 }
247 237
238 /// <summary>
239 /// FIXME: Get DeleteInventoryItem to return a bool
240 /// </summary>
241 /// <param name="item"></param>
242 /// <returns></returns>
248 public bool DeleteInvItem(InventoryItemBase item) 243 public bool DeleteInvItem(InventoryItemBase item)
249 { 244 {
250 DeleteInventoryItem(item.Owner, item); 245 DeleteInventoryItem(item.Owner, item);
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 41ca4fb..fbe905c 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.OGS1
94 { 94 {
95 m_log.InfoFormat("[OGS1 INVENTORY SERVICE]: " + 95 m_log.InfoFormat("[OGS1 INVENTORY SERVICE]: " +
96 "Received inventory response for user {0} containing {1} folders and {2} items", 96 "Received inventory response for user {0} containing {1} folders and {2} items",
97 userID, response.Folders.Count, response.AllItems.Count); 97 userID, response.Folders.Count, response.Items.Count);
98 98
99 InventoryFolderImpl rootFolder = null; 99 InventoryFolderImpl rootFolder = null;
100 InventoryRequest request = m_RequestingInventory[userID]; 100 InventoryRequest request = m_RequestingInventory[userID];
@@ -108,6 +108,8 @@ namespace OpenSim.Region.Communications.OGS1
108 { 108 {
109 rootFolder = new InventoryFolderImpl(folder); 109 rootFolder = new InventoryFolderImpl(folder);
110 folders.Add(rootFolder); 110 folders.Add(rootFolder);
111
112 break;
111 } 113 }
112 } 114 }
113 115
@@ -121,11 +123,15 @@ namespace OpenSim.Region.Communications.OGS1
121 } 123 }
122 } 124 }
123 125
124 foreach (InventoryItemBase item in response.AllItems) 126 foreach (InventoryItemBase item in response.Items)
125 { 127 {
126 items.Add(item); 128 items.Add(item);
127 } 129 }
128 } 130 }
131 else
132 {
133 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID);
134 }
129 135
130 request.Callback(userID, folders, items); 136 request.Callback(userID, folders, items);
131 137