diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/InventoryService/HGInventoryService.cs | 302 | ||||
-rw-r--r-- | OpenSim/Services/InventoryService/InventoryService.cs | 2 | ||||
-rw-r--r-- | OpenSim/Services/InventoryService/LibraryService.cs (renamed from OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs) | 62 | ||||
-rw-r--r-- | OpenSim/Services/InventoryService/XInventoryService.cs | 62 |
4 files changed, 382 insertions, 46 deletions
diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs new file mode 100644 index 0000000..061effe --- /dev/null +++ b/OpenSim/Services/InventoryService/HGInventoryService.cs | |||
@@ -0,0 +1,302 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using System.Reflection; | ||
34 | using OpenSim.Services.Base; | ||
35 | using OpenSim.Services.Interfaces; | ||
36 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | ||
38 | |||
39 | namespace OpenSim.Services.InventoryService | ||
40 | { | ||
41 | public class HGInventoryService : XInventoryService, IInventoryService | ||
42 | { | ||
43 | private static readonly ILog m_log = | ||
44 | LogManager.GetLogger( | ||
45 | MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | protected IXInventoryData m_Database; | ||
48 | |||
49 | public HGInventoryService(IConfigSource config) | ||
50 | : base(config) | ||
51 | { | ||
52 | string dllName = String.Empty; | ||
53 | string connString = String.Empty; | ||
54 | //string realm = "Inventory"; // OSG version doesn't use this | ||
55 | |||
56 | // | ||
57 | // Try reading the [DatabaseService] section, if it exists | ||
58 | // | ||
59 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
60 | if (dbConfig != null) | ||
61 | { | ||
62 | if (dllName == String.Empty) | ||
63 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
64 | if (connString == String.Empty) | ||
65 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
66 | } | ||
67 | |||
68 | // | ||
69 | // Try reading the [InventoryService] section, if it exists | ||
70 | // | ||
71 | IConfig authConfig = config.Configs["InventoryService"]; | ||
72 | if (authConfig != null) | ||
73 | { | ||
74 | dllName = authConfig.GetString("StorageProvider", dllName); | ||
75 | connString = authConfig.GetString("ConnectionString", connString); | ||
76 | // realm = authConfig.GetString("Realm", realm); | ||
77 | } | ||
78 | |||
79 | // | ||
80 | // We tried, but this doesn't exist. We can't proceed. | ||
81 | // | ||
82 | if (dllName == String.Empty) | ||
83 | throw new Exception("No StorageProvider configured"); | ||
84 | |||
85 | m_Database = LoadPlugin<IXInventoryData>(dllName, | ||
86 | new Object[] {connString, String.Empty}); | ||
87 | if (m_Database == null) | ||
88 | throw new Exception("Could not find a storage interface in the given module"); | ||
89 | |||
90 | m_log.Debug("[HG INVENTORY SERVICE]: Starting..."); | ||
91 | } | ||
92 | |||
93 | public override bool CreateUserInventory(UUID principalID) | ||
94 | { | ||
95 | // NOGO | ||
96 | return false; | ||
97 | } | ||
98 | |||
99 | |||
100 | public override List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) | ||
101 | { | ||
102 | // NOGO for this inventory service | ||
103 | return new List<InventoryFolderBase>(); | ||
104 | } | ||
105 | |||
106 | public override InventoryFolderBase GetRootFolder(UUID principalID) | ||
107 | { | ||
108 | // Warp! Root folder for travelers | ||
109 | XInventoryFolder[] folders = m_Database.GetFolders( | ||
110 | new string[] { "agentID", "folderName"}, | ||
111 | new string[] { principalID.ToString(), "Suitcase" }); | ||
112 | |||
113 | if (folders.Length > 0) | ||
114 | return ConvertToOpenSim(folders[0]); | ||
115 | |||
116 | // make one | ||
117 | XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "Suitcase"); | ||
118 | return ConvertToOpenSim(suitcase); | ||
119 | } | ||
120 | |||
121 | //private bool CreateSystemFolders(UUID principalID, XInventoryFolder suitcase) | ||
122 | //{ | ||
123 | |||
124 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Animation, "Animations"); | ||
125 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Bodypart, "Body Parts"); | ||
126 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.CallingCard, "Calling Cards"); | ||
127 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Clothing, "Clothing"); | ||
128 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Gesture, "Gestures"); | ||
129 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Landmark, "Landmarks"); | ||
130 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.LostAndFoundFolder, "Lost And Found"); | ||
131 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Notecard, "Notecards"); | ||
132 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Object, "Objects"); | ||
133 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.SnapshotFolder, "Photo Album"); | ||
134 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.LSLText, "Scripts"); | ||
135 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Sound, "Sounds"); | ||
136 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Texture, "Textures"); | ||
137 | // CreateFolder(principalID, suitcase.folderID, (int)AssetType.TrashFolder, "Trash"); | ||
138 | |||
139 | // return true; | ||
140 | //} | ||
141 | |||
142 | |||
143 | public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | ||
144 | { | ||
145 | return GetRootFolder(principalID); | ||
146 | } | ||
147 | |||
148 | // | ||
149 | // Use the inherited methods | ||
150 | // | ||
151 | //public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) | ||
152 | //{ | ||
153 | //} | ||
154 | |||
155 | //public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) | ||
156 | //{ | ||
157 | //} | ||
158 | |||
159 | //public override bool AddFolder(InventoryFolderBase folder) | ||
160 | //{ | ||
161 | // // Check if it's under the Suitcase folder | ||
162 | // List<InventoryFolderBase> skel = base.GetInventorySkeleton(folder.Owner); | ||
163 | // InventoryFolderBase suitcase = GetRootFolder(folder.Owner); | ||
164 | // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID); | ||
165 | |||
166 | // foreach (InventoryFolderBase f in suitDescendents) | ||
167 | // if (folder.ParentID == f.ID) | ||
168 | // { | ||
169 | // XInventoryFolder xFolder = ConvertFromOpenSim(folder); | ||
170 | // return m_Database.StoreFolder(xFolder); | ||
171 | // } | ||
172 | // return false; | ||
173 | //} | ||
174 | |||
175 | private List<InventoryFolderBase> GetDescendents(List<InventoryFolderBase> lst, UUID root) | ||
176 | { | ||
177 | List<InventoryFolderBase> direct = lst.FindAll(delegate(InventoryFolderBase f) { return f.ParentID == root; }); | ||
178 | if (direct == null) | ||
179 | return new List<InventoryFolderBase>(); | ||
180 | |||
181 | List<InventoryFolderBase> indirect = new List<InventoryFolderBase>(); | ||
182 | foreach (InventoryFolderBase f in direct) | ||
183 | indirect.AddRange(GetDescendents(lst, f.ID)); | ||
184 | |||
185 | direct.AddRange(indirect); | ||
186 | return direct; | ||
187 | } | ||
188 | |||
189 | // Use inherited method | ||
190 | //public bool UpdateFolder(InventoryFolderBase folder) | ||
191 | //{ | ||
192 | //} | ||
193 | |||
194 | //public override bool MoveFolder(InventoryFolderBase folder) | ||
195 | //{ | ||
196 | // XInventoryFolder[] x = m_Database.GetFolders( | ||
197 | // new string[] { "folderID" }, | ||
198 | // new string[] { folder.ID.ToString() }); | ||
199 | |||
200 | // if (x.Length == 0) | ||
201 | // return false; | ||
202 | |||
203 | // // Check if it's under the Suitcase folder | ||
204 | // List<InventoryFolderBase> skel = base.GetInventorySkeleton(folder.Owner); | ||
205 | // InventoryFolderBase suitcase = GetRootFolder(folder.Owner); | ||
206 | // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID); | ||
207 | |||
208 | // foreach (InventoryFolderBase f in suitDescendents) | ||
209 | // if (folder.ParentID == f.ID) | ||
210 | // { | ||
211 | // x[0].parentFolderID = folder.ParentID; | ||
212 | // return m_Database.StoreFolder(x[0]); | ||
213 | // } | ||
214 | |||
215 | // return false; | ||
216 | //} | ||
217 | |||
218 | public override bool DeleteFolders(UUID principalID, List<UUID> folderIDs) | ||
219 | { | ||
220 | // NOGO | ||
221 | return false; | ||
222 | } | ||
223 | |||
224 | public override bool PurgeFolder(InventoryFolderBase folder) | ||
225 | { | ||
226 | // NOGO | ||
227 | return false; | ||
228 | } | ||
229 | |||
230 | // Unfortunately we need to use the inherited method because of how DeRez works. | ||
231 | // The viewer sends the folderID hard-wired in the derez message | ||
232 | //public override bool AddItem(InventoryItemBase item) | ||
233 | //{ | ||
234 | // // Check if it's under the Suitcase folder | ||
235 | // List<InventoryFolderBase> skel = base.GetInventorySkeleton(item.Owner); | ||
236 | // InventoryFolderBase suitcase = GetRootFolder(item.Owner); | ||
237 | // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID); | ||
238 | |||
239 | // foreach (InventoryFolderBase f in suitDescendents) | ||
240 | // if (item.Folder == f.ID) | ||
241 | // return m_Database.StoreItem(ConvertFromOpenSim(item)); | ||
242 | |||
243 | // return false; | ||
244 | //} | ||
245 | |||
246 | //public override bool UpdateItem(InventoryItemBase item) | ||
247 | //{ | ||
248 | // // Check if it's under the Suitcase folder | ||
249 | // List<InventoryFolderBase> skel = base.GetInventorySkeleton(item.Owner); | ||
250 | // InventoryFolderBase suitcase = GetRootFolder(item.Owner); | ||
251 | // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID); | ||
252 | |||
253 | // foreach (InventoryFolderBase f in suitDescendents) | ||
254 | // if (item.Folder == f.ID) | ||
255 | // return m_Database.StoreItem(ConvertFromOpenSim(item)); | ||
256 | |||
257 | // return false; | ||
258 | //} | ||
259 | |||
260 | //public override bool MoveItems(UUID principalID, List<InventoryItemBase> items) | ||
261 | //{ | ||
262 | // // Principal is b0rked. *sigh* | ||
263 | // // | ||
264 | // // Let's assume they all have the same principal | ||
265 | // // Check if it's under the Suitcase folder | ||
266 | // List<InventoryFolderBase> skel = base.GetInventorySkeleton(items[0].Owner); | ||
267 | // InventoryFolderBase suitcase = GetRootFolder(items[0].Owner); | ||
268 | // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID); | ||
269 | |||
270 | // foreach (InventoryItemBase i in items) | ||
271 | // { | ||
272 | // foreach (InventoryFolderBase f in suitDescendents) | ||
273 | // if (i.Folder == f.ID) | ||
274 | // m_Database.MoveItem(i.ID.ToString(), i.Folder.ToString()); | ||
275 | // } | ||
276 | |||
277 | // return true; | ||
278 | //} | ||
279 | |||
280 | // Let these pass. Use inherited methods. | ||
281 | //public bool DeleteItems(UUID principalID, List<UUID> itemIDs) | ||
282 | //{ | ||
283 | //} | ||
284 | |||
285 | //public InventoryItemBase GetItem(InventoryItemBase item) | ||
286 | //{ | ||
287 | //} | ||
288 | |||
289 | //public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
290 | //{ | ||
291 | //} | ||
292 | |||
293 | //public List<InventoryItemBase> GetActiveGestures(UUID principalID) | ||
294 | //{ | ||
295 | //} | ||
296 | |||
297 | //public int GetAssetPermissions(UUID principalID, UUID assetID) | ||
298 | //{ | ||
299 | //} | ||
300 | |||
301 | } | ||
302 | } | ||
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 95007f1..0d6577e 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -66,6 +66,7 @@ namespace OpenSim.Services.InventoryService | |||
66 | // Agent has no inventory structure yet. | 66 | // Agent has no inventory structure yet. |
67 | if (null == rootFolder) | 67 | if (null == rootFolder) |
68 | { | 68 | { |
69 | m_log.DebugFormat("[INVENTORY SERVICE]: No root folder"); | ||
69 | return null; | 70 | return null; |
70 | } | 71 | } |
71 | 72 | ||
@@ -298,6 +299,7 @@ namespace OpenSim.Services.InventoryService | |||
298 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | 299 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) |
299 | folders[(AssetType)folder.Type] = folder; | 300 | folders[(AssetType)folder.Type] = folder; |
300 | } | 301 | } |
302 | m_log.DebugFormat("[INVENTORY SERVICE]: Got {0} system folders for {1}", folders.Count, userID); | ||
301 | return folders; | 303 | return folders; |
302 | } | 304 | } |
303 | } | 305 | } |
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Services/InventoryService/LibraryService.cs index 74ba0a5..383f311 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Services/InventoryService/LibraryService.cs | |||
@@ -30,20 +30,32 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Xml; | 32 | using System.Xml; |
33 | |||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Services.Base; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | |||
33 | using log4net; | 38 | using log4net; |
34 | using Nini.Config; | 39 | using Nini.Config; |
35 | using OpenMetaverse; | 40 | using OpenMetaverse; |
36 | 41 | ||
37 | namespace OpenSim.Framework.Communications.Cache | 42 | namespace OpenSim.Services.InventoryService |
38 | { | 43 | { |
39 | /// <summary> | 44 | /// <summary> |
40 | /// Basically a hack to give us a Inventory library while we don't have a inventory server | 45 | /// Basically a hack to give us a Inventory library while we don't have a inventory server |
41 | /// once the server is fully implemented then should read the data from that | 46 | /// once the server is fully implemented then should read the data from that |
42 | /// </summary> | 47 | /// </summary> |
43 | public class LibraryRootFolder : InventoryFolderImpl | 48 | public class LibraryService : ServiceBase, ILibraryService |
44 | { | 49 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 51 | ||
52 | private InventoryFolderImpl m_LibraryRootFolder; | ||
53 | |||
54 | public InventoryFolderImpl LibraryRootFolder | ||
55 | { | ||
56 | get { return m_LibraryRootFolder; } | ||
57 | } | ||
58 | |||
47 | private UUID libOwner = new UUID("11111111-1111-0000-0000-000100bba000"); | 59 | private UUID libOwner = new UUID("11111111-1111-0000-0000-000100bba000"); |
48 | 60 | ||
49 | /// <summary> | 61 | /// <summary> |
@@ -52,17 +64,31 @@ namespace OpenSim.Framework.Communications.Cache | |||
52 | /// </summary> | 64 | /// </summary> |
53 | protected Dictionary<UUID, InventoryFolderImpl> libraryFolders | 65 | protected Dictionary<UUID, InventoryFolderImpl> libraryFolders |
54 | = new Dictionary<UUID, InventoryFolderImpl>(); | 66 | = new Dictionary<UUID, InventoryFolderImpl>(); |
55 | 67 | ||
56 | public LibraryRootFolder(string pLibrariesLocation) | 68 | public LibraryService(IConfigSource config) |
69 | : base(config) | ||
57 | { | 70 | { |
58 | Owner = libOwner; | 71 | string pLibrariesLocation = Path.Combine("inventory", "Libraries.xml"); |
59 | ID = new UUID("00000112-000f-0000-0000-000100bba000"); | 72 | string pLibName = "OpenSim Library"; |
60 | Name = "OpenSim Library"; | 73 | |
61 | ParentID = UUID.Zero; | 74 | IConfig libConfig = config.Configs["LibraryService"]; |
62 | Type = (short) 8; | 75 | if (libConfig != null) |
63 | Version = (ushort) 1; | 76 | { |
77 | pLibrariesLocation = libConfig.GetString("DefaultLibrary", pLibrariesLocation); | ||
78 | pLibName = libConfig.GetString("LibraryName", pLibName); | ||
79 | } | ||
80 | |||
81 | m_log.Debug("[LIBRARY]: Starting library service..."); | ||
82 | |||
83 | m_LibraryRootFolder = new InventoryFolderImpl(); | ||
84 | m_LibraryRootFolder.Owner = libOwner; | ||
85 | m_LibraryRootFolder.ID = new UUID("00000112-000f-0000-0000-000100bba000"); | ||
86 | m_LibraryRootFolder.Name = pLibName; | ||
87 | m_LibraryRootFolder.ParentID = UUID.Zero; | ||
88 | m_LibraryRootFolder.Type = (short)8; | ||
89 | m_LibraryRootFolder.Version = (ushort)1; | ||
64 | 90 | ||
65 | libraryFolders.Add(ID, this); | 91 | libraryFolders.Add(m_LibraryRootFolder.ID, m_LibraryRootFolder); |
66 | 92 | ||
67 | LoadLibraries(pLibrariesLocation); | 93 | LoadLibraries(pLibrariesLocation); |
68 | } | 94 | } |
@@ -126,9 +152,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
126 | { | 152 | { |
127 | InventoryFolderImpl folderInfo = new InventoryFolderImpl(); | 153 | InventoryFolderImpl folderInfo = new InventoryFolderImpl(); |
128 | 154 | ||
129 | folderInfo.ID = new UUID(config.GetString("folderID", ID.ToString())); | 155 | folderInfo.ID = new UUID(config.GetString("folderID", m_LibraryRootFolder.ID.ToString())); |
130 | folderInfo.Name = config.GetString("name", "unknown"); | 156 | folderInfo.Name = config.GetString("name", "unknown"); |
131 | folderInfo.ParentID = new UUID(config.GetString("parentFolderID", ID.ToString())); | 157 | folderInfo.ParentID = new UUID(config.GetString("parentFolderID", m_LibraryRootFolder.ID.ToString())); |
132 | folderInfo.Type = (short)config.GetInt("type", 8); | 158 | folderInfo.Type = (short)config.GetInt("type", 8); |
133 | 159 | ||
134 | folderInfo.Owner = libOwner; | 160 | folderInfo.Owner = libOwner; |
@@ -160,9 +186,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
160 | InventoryItemBase item = new InventoryItemBase(); | 186 | InventoryItemBase item = new InventoryItemBase(); |
161 | item.Owner = libOwner; | 187 | item.Owner = libOwner; |
162 | item.CreatorId = libOwner.ToString(); | 188 | item.CreatorId = libOwner.ToString(); |
163 | item.ID = new UUID(config.GetString("inventoryID", ID.ToString())); | 189 | item.ID = new UUID(config.GetString("inventoryID", m_LibraryRootFolder.ID.ToString())); |
164 | item.AssetID = new UUID(config.GetString("assetID", item.ID.ToString())); | 190 | item.AssetID = new UUID(config.GetString("assetID", item.ID.ToString())); |
165 | item.Folder = new UUID(config.GetString("folderID", ID.ToString())); | 191 | item.Folder = new UUID(config.GetString("folderID", m_LibraryRootFolder.ID.ToString())); |
166 | item.Name = config.GetString("name", String.Empty); | 192 | item.Name = config.GetString("name", String.Empty); |
167 | item.Description = config.GetString("description", item.Name); | 193 | item.Description = config.GetString("description", item.Name); |
168 | item.InvType = config.GetInt("inventoryType", 0); | 194 | item.InvType = config.GetInt("inventoryType", 0); |
@@ -230,11 +256,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
230 | /// methods in the superclass | 256 | /// methods in the superclass |
231 | /// </summary> | 257 | /// </summary> |
232 | /// <returns></returns> | 258 | /// <returns></returns> |
233 | public Dictionary<UUID, InventoryFolderImpl> RequestSelfAndDescendentFolders() | 259 | public Dictionary<UUID, InventoryFolderImpl> GetAllFolders() |
234 | { | 260 | { |
235 | Dictionary<UUID, InventoryFolderImpl> fs = new Dictionary<UUID, InventoryFolderImpl>(); | 261 | Dictionary<UUID, InventoryFolderImpl> fs = new Dictionary<UUID, InventoryFolderImpl>(); |
236 | fs.Add(ID, this); | 262 | fs.Add(m_LibraryRootFolder.ID, m_LibraryRootFolder); |
237 | List<InventoryFolderImpl> fis = TraverseFolder(this); | 263 | List<InventoryFolderImpl> fis = TraverseFolder(m_LibraryRootFolder); |
238 | foreach (InventoryFolderImpl f in fis) | 264 | foreach (InventoryFolderImpl f in fis) |
239 | { | 265 | { |
240 | fs.Add(f.ID, f); | 266 | fs.Add(f.ID, f); |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 2c79c77..bbd37d1 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -87,7 +87,7 @@ namespace OpenSim.Services.InventoryService | |||
87 | throw new Exception("Could not find a storage interface in the given module"); | 87 | throw new Exception("Could not find a storage interface in the given module"); |
88 | } | 88 | } |
89 | 89 | ||
90 | public bool CreateUserInventory(UUID principalID) | 90 | public virtual bool CreateUserInventory(UUID principalID) |
91 | { | 91 | { |
92 | // This is braindeaad. We can't ever communicate that we fixed | 92 | // This is braindeaad. We can't ever communicate that we fixed |
93 | // an existing inventory. Well, just return root folder status, | 93 | // an existing inventory. Well, just return root folder status, |
@@ -99,7 +99,7 @@ namespace OpenSim.Services.InventoryService | |||
99 | 99 | ||
100 | if (rootFolder == null) | 100 | if (rootFolder == null) |
101 | { | 101 | { |
102 | rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "My Inventory")); | 102 | rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)AssetType.RootFolder, "My Inventory")); |
103 | result = true; | 103 | result = true; |
104 | } | 104 | } |
105 | 105 | ||
@@ -137,7 +137,7 @@ namespace OpenSim.Services.InventoryService | |||
137 | return result; | 137 | return result; |
138 | } | 138 | } |
139 | 139 | ||
140 | private XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name) | 140 | protected XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name) |
141 | { | 141 | { |
142 | XInventoryFolder newFolder = new XInventoryFolder(); | 142 | XInventoryFolder newFolder = new XInventoryFolder(); |
143 | 143 | ||
@@ -153,7 +153,7 @@ namespace OpenSim.Services.InventoryService | |||
153 | return newFolder; | 153 | return newFolder; |
154 | } | 154 | } |
155 | 155 | ||
156 | private XInventoryFolder[] GetSystemFolders(UUID principalID) | 156 | protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID) |
157 | { | 157 | { |
158 | XInventoryFolder[] allFolders = m_Database.GetFolders( | 158 | XInventoryFolder[] allFolders = m_Database.GetFolders( |
159 | new string[] { "agentID" }, | 159 | new string[] { "agentID" }, |
@@ -171,7 +171,7 @@ namespace OpenSim.Services.InventoryService | |||
171 | return sysFolders; | 171 | return sysFolders; |
172 | } | 172 | } |
173 | 173 | ||
174 | public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) | 174 | public virtual List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) |
175 | { | 175 | { |
176 | XInventoryFolder[] allFolders = m_Database.GetFolders( | 176 | XInventoryFolder[] allFolders = m_Database.GetFolders( |
177 | new string[] { "agentID" }, | 177 | new string[] { "agentID" }, |
@@ -191,7 +191,7 @@ namespace OpenSim.Services.InventoryService | |||
191 | return folders; | 191 | return folders; |
192 | } | 192 | } |
193 | 193 | ||
194 | public InventoryFolderBase GetRootFolder(UUID principalID) | 194 | public virtual InventoryFolderBase GetRootFolder(UUID principalID) |
195 | { | 195 | { |
196 | XInventoryFolder[] folders = m_Database.GetFolders( | 196 | XInventoryFolder[] folders = m_Database.GetFolders( |
197 | new string[] { "agentID", "parentFolderID"}, | 197 | new string[] { "agentID", "parentFolderID"}, |
@@ -203,7 +203,7 @@ namespace OpenSim.Services.InventoryService | |||
203 | return ConvertToOpenSim(folders[0]); | 203 | return ConvertToOpenSim(folders[0]); |
204 | } | 204 | } |
205 | 205 | ||
206 | public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 206 | public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) |
207 | { | 207 | { |
208 | XInventoryFolder[] folders = m_Database.GetFolders( | 208 | XInventoryFolder[] folders = m_Database.GetFolders( |
209 | new string[] { "agentID", "type"}, | 209 | new string[] { "agentID", "type"}, |
@@ -215,7 +215,7 @@ namespace OpenSim.Services.InventoryService | |||
215 | return ConvertToOpenSim(folders[0]); | 215 | return ConvertToOpenSim(folders[0]); |
216 | } | 216 | } |
217 | 217 | ||
218 | public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) | 218 | public virtual InventoryCollection GetFolderContent(UUID principalID, UUID folderID) |
219 | { | 219 | { |
220 | // This method doesn't receive a valud principal id from the | 220 | // This method doesn't receive a valud principal id from the |
221 | // connector. So we disregard the principal and look | 221 | // connector. So we disregard the principal and look |
@@ -250,7 +250,7 @@ namespace OpenSim.Services.InventoryService | |||
250 | return inventory; | 250 | return inventory; |
251 | } | 251 | } |
252 | 252 | ||
253 | public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) | 253 | public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) |
254 | { | 254 | { |
255 | // Since we probably don't get a valid principal here, either ... | 255 | // Since we probably don't get a valid principal here, either ... |
256 | // | 256 | // |
@@ -266,18 +266,18 @@ namespace OpenSim.Services.InventoryService | |||
266 | return invItems; | 266 | return invItems; |
267 | } | 267 | } |
268 | 268 | ||
269 | public bool AddFolder(InventoryFolderBase folder) | 269 | public virtual bool AddFolder(InventoryFolderBase folder) |
270 | { | 270 | { |
271 | XInventoryFolder xFolder = ConvertFromOpenSim(folder); | 271 | XInventoryFolder xFolder = ConvertFromOpenSim(folder); |
272 | return m_Database.StoreFolder(xFolder); | 272 | return m_Database.StoreFolder(xFolder); |
273 | } | 273 | } |
274 | 274 | ||
275 | public bool UpdateFolder(InventoryFolderBase folder) | 275 | public virtual bool UpdateFolder(InventoryFolderBase folder) |
276 | { | 276 | { |
277 | return AddFolder(folder); | 277 | return AddFolder(folder); |
278 | } | 278 | } |
279 | 279 | ||
280 | public bool MoveFolder(InventoryFolderBase folder) | 280 | public virtual bool MoveFolder(InventoryFolderBase folder) |
281 | { | 281 | { |
282 | XInventoryFolder[] x = m_Database.GetFolders( | 282 | XInventoryFolder[] x = m_Database.GetFolders( |
283 | new string[] { "folderID" }, | 283 | new string[] { "folderID" }, |
@@ -293,7 +293,7 @@ namespace OpenSim.Services.InventoryService | |||
293 | 293 | ||
294 | // We don't check the principal's ID here | 294 | // We don't check the principal's ID here |
295 | // | 295 | // |
296 | public bool DeleteFolders(UUID principalID, List<UUID> folderIDs) | 296 | public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs) |
297 | { | 297 | { |
298 | // Ignore principal ID, it's bogus at connector level | 298 | // Ignore principal ID, it's bogus at connector level |
299 | // | 299 | // |
@@ -308,7 +308,7 @@ namespace OpenSim.Services.InventoryService | |||
308 | return true; | 308 | return true; |
309 | } | 309 | } |
310 | 310 | ||
311 | public bool PurgeFolder(InventoryFolderBase folder) | 311 | public virtual bool PurgeFolder(InventoryFolderBase folder) |
312 | { | 312 | { |
313 | XInventoryFolder[] subFolders = m_Database.GetFolders( | 313 | XInventoryFolder[] subFolders = m_Database.GetFolders( |
314 | new string[] { "parentFolderID" }, | 314 | new string[] { "parentFolderID" }, |
@@ -325,17 +325,17 @@ namespace OpenSim.Services.InventoryService | |||
325 | return true; | 325 | return true; |
326 | } | 326 | } |
327 | 327 | ||
328 | public bool AddItem(InventoryItemBase item) | 328 | public virtual bool AddItem(InventoryItemBase item) |
329 | { | 329 | { |
330 | return m_Database.StoreItem(ConvertFromOpenSim(item)); | 330 | return m_Database.StoreItem(ConvertFromOpenSim(item)); |
331 | } | 331 | } |
332 | 332 | ||
333 | public bool UpdateItem(InventoryItemBase item) | 333 | public virtual bool UpdateItem(InventoryItemBase item) |
334 | { | 334 | { |
335 | return m_Database.StoreItem(ConvertFromOpenSim(item)); | 335 | return m_Database.StoreItem(ConvertFromOpenSim(item)); |
336 | } | 336 | } |
337 | 337 | ||
338 | public bool MoveItems(UUID principalID, List<InventoryItemBase> items) | 338 | public virtual bool MoveItems(UUID principalID, List<InventoryItemBase> items) |
339 | { | 339 | { |
340 | // Principal is b0rked. *sigh* | 340 | // Principal is b0rked. *sigh* |
341 | // | 341 | // |
@@ -347,7 +347,7 @@ namespace OpenSim.Services.InventoryService | |||
347 | return true; | 347 | return true; |
348 | } | 348 | } |
349 | 349 | ||
350 | public bool DeleteItems(UUID principalID, List<UUID> itemIDs) | 350 | public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs) |
351 | { | 351 | { |
352 | // Just use the ID... *facepalms* | 352 | // Just use the ID... *facepalms* |
353 | // | 353 | // |
@@ -357,7 +357,7 @@ namespace OpenSim.Services.InventoryService | |||
357 | return true; | 357 | return true; |
358 | } | 358 | } |
359 | 359 | ||
360 | public InventoryItemBase GetItem(InventoryItemBase item) | 360 | public virtual InventoryItemBase GetItem(InventoryItemBase item) |
361 | { | 361 | { |
362 | XInventoryItem[] items = m_Database.GetItems( | 362 | XInventoryItem[] items = m_Database.GetItems( |
363 | new string[] { "inventoryID" }, | 363 | new string[] { "inventoryID" }, |
@@ -369,7 +369,7 @@ namespace OpenSim.Services.InventoryService | |||
369 | return ConvertToOpenSim(items[0]); | 369 | return ConvertToOpenSim(items[0]); |
370 | } | 370 | } |
371 | 371 | ||
372 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 372 | public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) |
373 | { | 373 | { |
374 | XInventoryFolder[] folders = m_Database.GetFolders( | 374 | XInventoryFolder[] folders = m_Database.GetFolders( |
375 | new string[] { "folderID"}, | 375 | new string[] { "folderID"}, |
@@ -381,7 +381,7 @@ namespace OpenSim.Services.InventoryService | |||
381 | return ConvertToOpenSim(folders[0]); | 381 | return ConvertToOpenSim(folders[0]); |
382 | } | 382 | } |
383 | 383 | ||
384 | public List<InventoryItemBase> GetActiveGestures(UUID principalID) | 384 | public virtual List<InventoryItemBase> GetActiveGestures(UUID principalID) |
385 | { | 385 | { |
386 | XInventoryItem[] items = m_Database.GetActiveGestures(principalID); | 386 | XInventoryItem[] items = m_Database.GetActiveGestures(principalID); |
387 | 387 | ||
@@ -396,7 +396,7 @@ namespace OpenSim.Services.InventoryService | |||
396 | return ret; | 396 | return ret; |
397 | } | 397 | } |
398 | 398 | ||
399 | public int GetAssetPermissions(UUID principalID, UUID assetID) | 399 | public virtual int GetAssetPermissions(UUID principalID, UUID assetID) |
400 | { | 400 | { |
401 | return m_Database.GetAssetPermissions(principalID, assetID); | 401 | return m_Database.GetAssetPermissions(principalID, assetID); |
402 | } | 402 | } |
@@ -421,7 +421,7 @@ namespace OpenSim.Services.InventoryService | |||
421 | 421 | ||
422 | // CM Helpers | 422 | // CM Helpers |
423 | // | 423 | // |
424 | private InventoryFolderBase ConvertToOpenSim(XInventoryFolder folder) | 424 | protected InventoryFolderBase ConvertToOpenSim(XInventoryFolder folder) |
425 | { | 425 | { |
426 | InventoryFolderBase newFolder = new InventoryFolderBase(); | 426 | InventoryFolderBase newFolder = new InventoryFolderBase(); |
427 | 427 | ||
@@ -435,7 +435,7 @@ namespace OpenSim.Services.InventoryService | |||
435 | return newFolder; | 435 | return newFolder; |
436 | } | 436 | } |
437 | 437 | ||
438 | private XInventoryFolder ConvertFromOpenSim(InventoryFolderBase folder) | 438 | protected XInventoryFolder ConvertFromOpenSim(InventoryFolderBase folder) |
439 | { | 439 | { |
440 | XInventoryFolder newFolder = new XInventoryFolder(); | 440 | XInventoryFolder newFolder = new XInventoryFolder(); |
441 | 441 | ||
@@ -449,7 +449,7 @@ namespace OpenSim.Services.InventoryService | |||
449 | return newFolder; | 449 | return newFolder; |
450 | } | 450 | } |
451 | 451 | ||
452 | private InventoryItemBase ConvertToOpenSim(XInventoryItem item) | 452 | protected InventoryItemBase ConvertToOpenSim(XInventoryItem item) |
453 | { | 453 | { |
454 | InventoryItemBase newItem = new InventoryItemBase(); | 454 | InventoryItemBase newItem = new InventoryItemBase(); |
455 | 455 | ||
@@ -468,7 +468,10 @@ namespace OpenSim.Services.InventoryService | |||
468 | newItem.EveryOnePermissions = (uint)item.inventoryEveryOnePermissions; | 468 | newItem.EveryOnePermissions = (uint)item.inventoryEveryOnePermissions; |
469 | newItem.GroupPermissions = (uint)item.inventoryGroupPermissions; | 469 | newItem.GroupPermissions = (uint)item.inventoryGroupPermissions; |
470 | newItem.GroupID = item.groupID; | 470 | newItem.GroupID = item.groupID; |
471 | newItem.GroupOwned = item.groupOwned; | 471 | if (item.groupOwned == 0) |
472 | newItem.GroupOwned = false; | ||
473 | else | ||
474 | newItem.GroupOwned = true; | ||
472 | newItem.SalePrice = item.salePrice; | 475 | newItem.SalePrice = item.salePrice; |
473 | newItem.SaleType = (byte)item.saleType; | 476 | newItem.SaleType = (byte)item.saleType; |
474 | newItem.Flags = (uint)item.flags; | 477 | newItem.Flags = (uint)item.flags; |
@@ -477,7 +480,7 @@ namespace OpenSim.Services.InventoryService | |||
477 | return newItem; | 480 | return newItem; |
478 | } | 481 | } |
479 | 482 | ||
480 | private XInventoryItem ConvertFromOpenSim(InventoryItemBase item) | 483 | protected XInventoryItem ConvertFromOpenSim(InventoryItemBase item) |
481 | { | 484 | { |
482 | XInventoryItem newItem = new XInventoryItem(); | 485 | XInventoryItem newItem = new XInventoryItem(); |
483 | 486 | ||
@@ -496,7 +499,10 @@ namespace OpenSim.Services.InventoryService | |||
496 | newItem.inventoryEveryOnePermissions = (int)item.EveryOnePermissions; | 499 | newItem.inventoryEveryOnePermissions = (int)item.EveryOnePermissions; |
497 | newItem.inventoryGroupPermissions = (int)item.GroupPermissions; | 500 | newItem.inventoryGroupPermissions = (int)item.GroupPermissions; |
498 | newItem.groupID = item.GroupID; | 501 | newItem.groupID = item.GroupID; |
499 | newItem.groupOwned = item.GroupOwned; | 502 | if (item.GroupOwned) |
503 | newItem.groupOwned = 1; | ||
504 | else | ||
505 | newItem.groupOwned = 0; | ||
500 | newItem.salePrice = item.SalePrice; | 506 | newItem.salePrice = item.SalePrice; |
501 | newItem.saleType = (int)item.SaleType; | 507 | newItem.saleType = (int)item.SaleType; |
502 | newItem.flags = (int)item.Flags; | 508 | newItem.flags = (int)item.Flags; |