diff options
author | diva | 2009-06-08 03:09:24 +0000 |
---|---|---|
committer | diva | 2009-06-08 03:09:24 +0000 |
commit | 16d50032741925c34176da0cca153e7b7de6e325 (patch) | |
tree | a6dca99e7ce2537dbe45a2c759fd6941890f92dd /OpenSim/Services | |
parent | First draft of inventory service connectors, and service implementation. No h... (diff) | |
download | opensim-SC-16d50032741925c34176da0cca153e7b7de6e325.zip opensim-SC-16d50032741925c34176da0cca153e7b7de6e325.tar.gz opensim-SC-16d50032741925c34176da0cca153e7b7de6e325.tar.bz2 opensim-SC-16d50032741925c34176da0cca153e7b7de6e325.tar.xz |
Added more functions to IInventoryService. Unsure about whether all of these are really necessary.
Diffstat (limited to 'OpenSim/Services')
-rw-r--r-- | OpenSim/Services/Interfaces/IInventoryService.cs | 35 | ||||
-rw-r--r-- | OpenSim/Services/InventoryService/InventoryService.cs | 73 |
2 files changed, 102 insertions, 6 deletions
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index 9fe419f..8757744 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs | |||
@@ -41,6 +41,27 @@ namespace OpenSim.Services.Interfaces | |||
41 | public interface IInventoryService | 41 | public interface IInventoryService |
42 | { | 42 | { |
43 | /// <summary> | 43 | /// <summary> |
44 | /// Create the entire inventory for a given user | ||
45 | /// </summary> | ||
46 | /// <param name="user"></param> | ||
47 | /// <returns></returns> | ||
48 | bool CreateUserInventory(UUID user); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Gets the skeleton of the inventory -- folders only | ||
52 | /// </summary> | ||
53 | /// <param name="userId"></param> | ||
54 | /// <returns></returns> | ||
55 | List<InventoryFolderBase> GetInventorySkeleton(UUID userId); | ||
56 | |||
57 | /// <summary> | ||
58 | /// Synchronous inventory fetch. | ||
59 | /// </summary> | ||
60 | /// <param name="userID"></param> | ||
61 | /// <returns></returns> | ||
62 | InventoryCollection GetUserInventory(UUID userID); | ||
63 | |||
64 | /// <summary> | ||
44 | /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the | 65 | /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the |
45 | /// inventory has been received | 66 | /// inventory has been received |
46 | /// </summary> | 67 | /// </summary> |
@@ -49,6 +70,13 @@ namespace OpenSim.Services.Interfaces | |||
49 | void GetUserInventory(UUID userID, InventoryReceiptCallback callback); | 70 | void GetUserInventory(UUID userID, InventoryReceiptCallback callback); |
50 | 71 | ||
51 | /// <summary> | 72 | /// <summary> |
73 | /// Gets the items inside a folder | ||
74 | /// </summary> | ||
75 | /// <param name="folderID"></param> | ||
76 | /// <returns></returns> | ||
77 | List<InventoryItemBase> GetFolderItems(UUID folderID); | ||
78 | |||
79 | /// <summary> | ||
52 | /// Add a new folder to the user's inventory | 80 | /// Add a new folder to the user's inventory |
53 | /// </summary> | 81 | /// </summary> |
54 | /// <param name="folder"></param> | 82 | /// <param name="folder"></param> |
@@ -114,5 +142,12 @@ namespace OpenSim.Services.Interfaces | |||
114 | /// <param name="userID"></param> | 142 | /// <param name="userID"></param> |
115 | /// <returns>null if no root folder was found</returns> | 143 | /// <returns>null if no root folder was found</returns> |
116 | InventoryFolderBase RequestRootFolder(UUID userID); | 144 | InventoryFolderBase RequestRootFolder(UUID userID); |
145 | |||
146 | /// <summary> | ||
147 | /// Get the active gestures of the agent. | ||
148 | /// </summary> | ||
149 | /// <param name="userId"></param> | ||
150 | /// <returns></returns> | ||
151 | List<InventoryItemBase> GetActiveGestures(UUID userId); | ||
117 | } | 152 | } |
118 | } | 153 | } |
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index b4e2549..f2a7b41 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -85,7 +85,6 @@ namespace OpenSim.Services.InventoryService | |||
85 | return userFolders; | 85 | return userFolders; |
86 | } | 86 | } |
87 | 87 | ||
88 | // See IInventoryServices | ||
89 | public virtual bool HasInventoryForUser(UUID userID) | 88 | public virtual bool HasInventoryForUser(UUID userID) |
90 | { | 89 | { |
91 | return false; | 90 | return false; |
@@ -107,7 +106,7 @@ namespace OpenSim.Services.InventoryService | |||
107 | } | 106 | } |
108 | 107 | ||
109 | // See IInventoryServices | 108 | // See IInventoryServices |
110 | public bool CreateNewUserInventory(UUID user) | 109 | public bool CreateUserInventory(UUID user) |
111 | { | 110 | { |
112 | InventoryFolderBase existingRootFolder = RequestRootFolder(user); | 111 | InventoryFolderBase existingRootFolder = RequestRootFolder(user); |
113 | 112 | ||
@@ -131,6 +130,68 @@ namespace OpenSim.Services.InventoryService | |||
131 | } | 130 | } |
132 | 131 | ||
133 | // See IInventoryServices | 132 | // See IInventoryServices |
133 | |||
134 | /// <summary> | ||
135 | /// Return a user's entire inventory synchronously | ||
136 | /// </summary> | ||
137 | /// <param name="rawUserID"></param> | ||
138 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> | ||
139 | public InventoryCollection GetUserInventory(UUID userID) | ||
140 | { | ||
141 | m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Processing request for inventory of {0}", userID); | ||
142 | |||
143 | // Uncomment me to simulate a slow responding inventory server | ||
144 | //Thread.Sleep(16000); | ||
145 | |||
146 | InventoryCollection invCollection = new InventoryCollection(); | ||
147 | |||
148 | List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID); | ||
149 | |||
150 | if (null == allFolders) | ||
151 | { | ||
152 | m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: No inventory found for user {0}", userID); | ||
153 | |||
154 | return invCollection; | ||
155 | } | ||
156 | |||
157 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); | ||
158 | |||
159 | foreach (InventoryFolderBase folder in allFolders) | ||
160 | { | ||
161 | List<InventoryItemBase> items = GetFolderItems(folder.ID); | ||
162 | |||
163 | if (items != null) | ||
164 | { | ||
165 | allItems.InsertRange(0, items); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | invCollection.UserID = userID; | ||
170 | invCollection.Folders = allFolders; | ||
171 | invCollection.Items = allItems; | ||
172 | |||
173 | // foreach (InventoryFolderBase folder in invCollection.Folders) | ||
174 | // { | ||
175 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); | ||
176 | // } | ||
177 | // | ||
178 | // foreach (InventoryItemBase item in invCollection.Items) | ||
179 | // { | ||
180 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); | ||
181 | // } | ||
182 | |||
183 | m_log.InfoFormat( | ||
184 | "[LOCAL INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items", | ||
185 | invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); | ||
186 | |||
187 | return invCollection; | ||
188 | } | ||
189 | |||
190 | /// <summary> | ||
191 | /// Asynchronous inventory fetch. | ||
192 | /// </summary> | ||
193 | /// <param name="userID"></param> | ||
194 | /// <param name="callback"></param> | ||
134 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 195 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
135 | { | 196 | { |
136 | m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); | 197 | m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); |
@@ -152,7 +213,7 @@ namespace OpenSim.Services.InventoryService | |||
152 | { | 213 | { |
153 | rootFolder = new InventoryFolderImpl(folder); | 214 | rootFolder = new InventoryFolderImpl(folder); |
154 | folders.Add(rootFolder); | 215 | folders.Add(rootFolder); |
155 | items.AddRange(RequestFolderItems(rootFolder.ID)); | 216 | items.AddRange(GetFolderItems(rootFolder.ID)); |
156 | break; // Only 1 root folder per user | 217 | break; // Only 1 root folder per user |
157 | } | 218 | } |
158 | } | 219 | } |
@@ -164,7 +225,7 @@ namespace OpenSim.Services.InventoryService | |||
164 | if (folder.ID != rootFolder.ID) | 225 | if (folder.ID != rootFolder.ID) |
165 | { | 226 | { |
166 | folders.Add(new InventoryFolderImpl(folder)); | 227 | folders.Add(new InventoryFolderImpl(folder)); |
167 | items.AddRange(RequestFolderItems(folder.ID)); | 228 | items.AddRange(GetFolderItems(folder.ID)); |
168 | } | 229 | } |
169 | } | 230 | } |
170 | } | 231 | } |
@@ -208,7 +269,7 @@ namespace OpenSim.Services.InventoryService | |||
208 | return inventoryList; | 269 | return inventoryList; |
209 | } | 270 | } |
210 | 271 | ||
211 | public List<InventoryItemBase> RequestFolderItems(UUID folderID) | 272 | public List<InventoryItemBase> GetFolderItems(UUID folderID) |
212 | { | 273 | { |
213 | List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); | 274 | List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); |
214 | 275 | ||
@@ -360,7 +421,7 @@ namespace OpenSim.Services.InventoryService | |||
360 | } | 421 | } |
361 | } | 422 | } |
362 | 423 | ||
363 | List<InventoryItemBase> items = RequestFolderItems(folder.ID); | 424 | List<InventoryItemBase> items = GetFolderItems(folder.ID); |
364 | 425 | ||
365 | foreach (InventoryItemBase item in items) | 426 | foreach (InventoryItemBase item in items) |
366 | { | 427 | { |