aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-08-14 13:54:46 +0000
committerMW2007-08-14 13:54:46 +0000
commita228b5984e6523456871f2f8e51aa086050acbf2 (patch)
treeb79888d4aa588c08fbb78bfcc78df3f47d7b5bea /OpenSim
parentDisabled ScriptEngine until I add error handling tomorrow (diff)
downloadopensim-SC-a228b5984e6523456871f2f8e51aa086050acbf2.zip
opensim-SC-a228b5984e6523456871f2f8e51aa086050acbf2.tar.gz
opensim-SC-a228b5984e6523456871f2f8e51aa086050acbf2.tar.bz2
opensim-SC-a228b5984e6523456871f2f8e51aa086050acbf2.tar.xz
Start of Inventory service, currently only (partially) functional in standalone mode and using sqlite).
In standalone mode, if you have account authenticate turned on (setting in opensim.ini) then when you create a new account, a set of inventory is created for that account and stored in database (currently only a set of empty folders). Then during login the database is search for that set and sent to the client in the login response. More functions will be added soon, like creating new folders (and a bit later items) from the client inventory window.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolder.cs15
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCache.cs6
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs401
-rw-r--r--OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs66
-rw-r--r--OpenSim/Framework/UserManager/LoginService.cs32
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs6
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs17
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs51
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs49
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs2
11 files changed, 620 insertions, 31 deletions
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
index 300a6e3..6b0e2b4 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
@@ -44,6 +44,21 @@ namespace OpenSim.Framework.Communications.Caches
44 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); 44 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
45 public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>(); 45 public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>();
46 46
47 public InventoryFolder(InventoryFolderBase folderbase)
48 {
49 this.agentID = folderbase.agentID;
50 this.folderID = folderbase.folderID;
51 this.name = folderbase.name;
52 this.parentID = folderbase.parentID;
53 this.type = folderbase.type;
54 this.version = folderbase.version;
55 }
56
57 public InventoryFolder()
58 {
59
60 }
61
47 // Methods 62 // Methods
48 public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) 63 public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
49 { 64 {
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
index 2f3691c..2271550 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
@@ -168,18 +168,18 @@ namespace OpenSim.Framework.Communications.Caches
168 /// <param name="userID"></param> 168 /// <param name="userID"></param>
169 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) 169 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
170 { 170 {
171 // this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); 171 //this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
172 172
173 //for now we manually create the root folder, 173 //for now we manually create the root folder,
174 // but should be requesting all inventory from inventory server. 174 // but should be requesting all inventory from inventory server.
175 InventoryFolder folderInfo = new InventoryFolder(); 175 /* InventoryFolder folderInfo = new InventoryFolder();
176 folderInfo.agentID = userID; 176 folderInfo.agentID = userID;
177 folderInfo.folderID = userInfo.UserProfile.rootInventoryFolderID; 177 folderInfo.folderID = userInfo.UserProfile.rootInventoryFolderID;
178 folderInfo.name = "My Inventory"; 178 folderInfo.name = "My Inventory";
179 folderInfo.parentID = LLUUID.Zero; 179 folderInfo.parentID = LLUUID.Zero;
180 folderInfo.type = 8; 180 folderInfo.type = 8;
181 folderInfo.version = 1; 181 folderInfo.version = 1;
182 userInfo.FolderReceive(userID, folderInfo); 182 userInfo.FolderReceive(userID, folderInfo);*/
183 } 183 }
184 184
185 /// <summary> 185 /// <summary>
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
new file mode 100644
index 0000000..811a355
--- /dev/null
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -0,0 +1,401 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using OpenSim.Framework.Console;
6using OpenSim.Framework.Types;
7using OpenSim.Framework.Utilities;
8using libsecondlife;
9
10using System.Data;
11using System.Data.SqlTypes;
12
13using Mono.Data.SqliteClient;
14
15namespace OpenSim.Framework.Data.SQLite
16{
17
18 public class SQLiteInventoryStore : IInventoryData
19 {
20 private const string invItemsSelect = "select * from inventoryitems";
21 private const string invFoldersSelect = "select * from inventoryfolders";
22
23 private DataSet ds;
24 private SqliteDataAdapter invItemsDa;
25 private SqliteDataAdapter invFoldersDa;
26
27 /// <summary>
28 /// Initialises the interface
29 /// </summary>
30 public void Initialise()
31 {
32 Initialise("inventoryStore.db", "inventoryDatabase");
33 }
34
35 public void Initialise(string dbfile, string dbname)
36 {
37 string connectionString = "URI=file:" + dbfile + ",version=3";
38
39 MainLog.Instance.Verbose("Inventory", "Sqlite - connecting: " + dbfile);
40 SqliteConnection conn = new SqliteConnection(connectionString);
41
42 SqliteCommand itemsSelectCmd = new SqliteCommand(invItemsSelect, conn);
43 invItemsDa = new SqliteDataAdapter(itemsSelectCmd);
44 // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
45
46 SqliteCommand foldersSelectCmd = new SqliteCommand(invFoldersSelect, conn);
47 invFoldersDa = new SqliteDataAdapter(foldersSelectCmd);
48
49 ds = new DataSet();
50
51 invItemsDa.Fill(ds, "inventoryitems");
52 invFoldersDa.Fill(ds, "inventoryfolders");
53 ds.AcceptChanges();
54
55 DataTable itemsTable = ds.Tables["inventoryitems"];
56 itemsTable.PrimaryKey = new DataColumn[] { itemsTable.Columns["UUID"] };
57 setupItemsCommands(invItemsDa, conn);
58
59 // shapeDa.FillSchema(ds, SchemaType.Source, "ShapeSchema");
60 DataTable folderTable = ds.Tables["inventoryfolders"];
61 folderTable.PrimaryKey = new DataColumn[] { folderTable.Columns["UUID"] };
62 setupFoldersCommands(invFoldersDa, conn);
63 return;
64 }
65
66 private SqliteParameter createSqliteParameter(string name, DbType type)
67 {
68 SqliteParameter param = new SqliteParameter();
69 param.ParameterName = ":" + name;
70 param.DbType = type;
71 param.SourceColumn = name;
72 param.SourceVersion = DataRowVersion.Current;
73 return param;
74 }
75
76 private Dictionary<string, DbType> createInventoryItemsDataDefs()
77 {
78 Dictionary<string, DbType> data = new Dictionary<string, DbType>();
79 data.Add("UUID", DbType.String); //inventoryID
80 data.Add("assetID", DbType.String);
81 data.Add("assetType", DbType.Int32);
82 data.Add("invType", DbType.Int32);
83 data.Add("parentFolderID", DbType.String);
84 data.Add("avatarID", DbType.String);
85 data.Add("creatorsID", DbType.String);
86
87 data.Add("inventoryName", DbType.String);
88 data.Add("inventoryDescription", DbType.String);
89 // permissions
90 data.Add("inventoryNextPermissions", DbType.Int32);
91 data.Add("inventoryCurrentPermissions", DbType.Int32);
92 data.Add("inventoryBasePermissions", DbType.Int32);
93 data.Add("inventoryEveryOnePermissions", DbType.Int32);
94
95 return data;
96 }
97
98 private Dictionary<string, DbType> createShapeDataDefs()
99 {
100 Dictionary<string, DbType> data = new Dictionary<string, DbType>();
101 data.Add("UUID", DbType.String); //folderID
102 // shape is an enum
103 data.Add("name", DbType.String);
104 // vectors
105 data.Add("agentID", DbType.String);
106 data.Add("parentID", DbType.String);
107 data.Add("type", DbType.Int32);
108 data.Add("version", DbType.Int32);
109 return data;
110 }
111
112 private SqliteCommand createInsertCommand(string table, Dictionary<string, DbType> defs)
113 {
114 /**
115 * This is subtle enough to deserve some commentary.
116 * Instead of doing *lots* and *lots of hardcoded strings
117 * for database definitions we'll use the fact that
118 * realistically all insert statements look like "insert
119 * into A(b, c) values(:b, :c) on the parameterized query
120 * front. If we just have a list of b, c, etc... we can
121 * generate these strings instead of typing them out.
122 */
123 string[] cols = new string[defs.Keys.Count];
124 defs.Keys.CopyTo(cols, 0);
125
126 string sql = "insert into " + table + "(";
127 sql += String.Join(", ", cols);
128 // important, the first ':' needs to be here, the rest get added in the join
129 sql += ") values (:";
130 sql += String.Join(", :", cols);
131 sql += ")";
132 SqliteCommand cmd = new SqliteCommand(sql);
133
134 // this provides the binding for all our parameters, so
135 // much less code than it used to be
136 foreach (KeyValuePair<string, DbType> kvp in defs)
137 {
138 cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value));
139 }
140 return cmd;
141 }
142
143 private SqliteCommand createUpdateCommand(string table, string pk, Dictionary<string, DbType> defs)
144 {
145 string sql = "update " + table + " set ";
146 string subsql = "";
147 foreach (string key in defs.Keys)
148 {
149 if (subsql.Length > 0)
150 { // a map function would rock so much here
151 subsql += ", ";
152 }
153 subsql += key + "= :" + key;
154 }
155 sql += subsql;
156 sql += " where " + pk;
157 SqliteCommand cmd = new SqliteCommand(sql);
158
159 // this provides the binding for all our parameters, so
160 // much less code than it used to be
161 foreach (KeyValuePair<string, DbType> kvp in defs)
162 {
163 cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value));
164 }
165 return cmd;
166 }
167
168 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
169 {
170 Dictionary<string, DbType> invDataDefs = createInventoryItemsDataDefs();
171
172 da.InsertCommand = createInsertCommand("inventoryitems", invDataDefs);
173 da.InsertCommand.Connection = conn;
174
175 da.UpdateCommand = createUpdateCommand("inventoryitems", "UUID=:UUID", invDataDefs);
176 da.UpdateCommand.Connection = conn;
177
178 SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID");
179 delete.Parameters.Add(createSqliteParameter("UUID", DbType.String));
180 delete.Connection = conn;
181 da.DeleteCommand = delete;
182 }
183
184 private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn)
185 {
186 Dictionary<string, DbType> shapeDataDefs = createShapeDataDefs();
187
188 da.InsertCommand = createInsertCommand("inventoryfolders", shapeDataDefs);
189 da.InsertCommand.Connection = conn;
190
191 da.UpdateCommand = createUpdateCommand("inventoryfolders", "UUID=:UUID", shapeDataDefs);
192 da.UpdateCommand.Connection = conn;
193
194 SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID");
195 delete.Parameters.Add(createSqliteParameter("UUID", DbType.String));
196 delete.Connection = conn;
197 da.DeleteCommand = delete;
198 }
199
200 private InventoryFolderBase buildFolder(DataRow row)
201 {
202 InventoryFolderBase folder = new InventoryFolderBase();
203 folder.folderID = new LLUUID((string)row["UUID"]);
204 folder.name = (string)row["name"];
205 folder.agentID = new LLUUID((string)row["agentID"]);
206 folder.parentID = new LLUUID((string)row["parentID"]);
207 folder.type = Convert.ToInt16(row["type"]);
208 folder.version = Convert.ToUInt16(row["version"]);
209 return folder;
210 }
211
212 private void fillFolderRow(DataRow row, InventoryFolderBase folder)
213 {
214 row["UUID"] = folder.folderID;
215 row["name"] = folder.name;
216 row["agentID"] = folder.agentID;
217 row["parentID"] = folder.parentID;
218 row["type"] = folder.type;
219 row["version"] = folder.version;
220 }
221
222 private void addFolder(InventoryFolderBase folder)
223 {
224 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
225
226 DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.folderID);
227 if (inventoryRow == null)
228 {
229 inventoryRow = inventoryFolderTable.NewRow();
230 fillFolderRow(inventoryRow, folder);
231 inventoryFolderTable.Rows.Add(inventoryRow);
232 }
233 else
234 {
235 fillFolderRow(inventoryRow, folder);
236 }
237
238 this.invFoldersDa.Update(ds, "inventoryfolders");
239 }
240
241 public void Shutdown()
242 {
243 // TODO: DataSet commit
244 }
245
246 /// <summary>
247 /// Closes the interface
248 /// </summary>
249 public void Close()
250 {
251 }
252
253 /// <summary>
254 /// The plugin being loaded
255 /// </summary>
256 /// <returns>A string containing the plugin name</returns>
257 public string getName()
258 {
259 return "SQLite Inventory Data Interface";
260 }
261
262 /// <summary>
263 /// The plugins version
264 /// </summary>
265 /// <returns>A string containing the plugin version</returns>
266 public string getVersion()
267 {
268 return "0.1";
269 }
270
271 /// <summary>
272 /// Returns a list of inventory items contained within the specified folder
273 /// </summary>
274 /// <param name="folderID">The UUID of the target folder</param>
275 /// <returns>A List of InventoryItemBase items</returns>
276 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
277 {
278 return null;
279 }
280
281 /// <summary>
282 /// Returns a list of the root folders within a users inventory
283 /// </summary>
284 /// <param name="user">The user whos inventory is to be searched</param>
285 /// <returns>A list of folder objects</returns>
286 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
287 {
288 return null;
289 }
290
291 /// <summary>
292 /// Returns the users inventory root folder.
293 /// </summary>
294 /// <param name="user">The UUID of the user who is having inventory being returned</param>
295 /// <returns>Root inventory folder</returns>
296 public InventoryFolderBase getUserRootFolder(LLUUID user)
297 {
298 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
299 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
300 string selectExp = "agentID = '"+ user.ToString()+"' AND parentID = '"+ LLUUID.Zero.ToString()+"'";
301 DataRow[] rows = inventoryFolderTable.Select(selectExp);
302 foreach (DataRow row in rows)
303 {
304 folders.Add(this.buildFolder(row));
305 }
306
307 if (folders.Count == 1)
308 {
309 //we found the root
310 //System.Console.WriteLine("found root inventory folder");
311 return folders[0];
312 }
313 else if (folders.Count > 1)
314 {
315 //err shouldn't be more than one root
316 //System.Console.WriteLine("found more than one root inventory folder");
317 }
318 else if (folders.Count == 0)
319 {
320 // no root?
321 //System.Console.WriteLine("couldn't find root inventory folder");
322 }
323
324 return null;
325 }
326
327 /// <summary>
328 /// Returns a list of inventory folders contained in the folder 'parentID'
329 /// </summary>
330 /// <param name="parentID">The folder to get subfolders for</param>
331 /// <returns>A list of inventory folders</returns>
332 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
333 {
334 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
335 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
336 string selectExp = "parentID = '" + parentID.ToString() + "'";
337 DataRow[] rows = inventoryFolderTable.Select(selectExp);
338 foreach (DataRow row in rows)
339 {
340 folders.Add(this.buildFolder(row));
341 }
342 // System.Console.WriteLine("found " + folders.Count + " inventory folders");
343 return folders;
344 }
345
346 /// <summary>
347 /// Returns an inventory item by its UUID
348 /// </summary>
349 /// <param name="item">The UUID of the item to be returned</param>
350 /// <returns>A class containing item information</returns>
351 public InventoryItemBase getInventoryItem(LLUUID item)
352 {
353 return null;
354 }
355
356 /// <summary>
357 /// Returns a specified inventory folder by its UUID
358 /// </summary>
359 /// <param name="folder">The UUID of the folder to be returned</param>
360 /// <returns>A class containing folder information</returns>
361 public InventoryFolderBase getInventoryFolder(LLUUID folder)
362 {
363 return null;
364 }
365
366 /// <summary>
367 /// Creates a new inventory item based on item
368 /// </summary>
369 /// <param name="item">The item to be created</param>
370 public void addInventoryItem(InventoryItemBase item)
371 {
372 }
373
374 /// <summary>
375 /// Updates an inventory item with item (updates based on ID)
376 /// </summary>
377 /// <param name="item">The updated item</param>
378 public void updateInventoryItem(InventoryItemBase item)
379 {
380 }
381
382 /// <summary>
383 /// Adds a new folder specified by folder
384 /// </summary>
385 /// <param name="folder">The inventory folder</param>
386 public void addInventoryFolder(InventoryFolderBase folder)
387 {
388 this.addFolder(folder);
389 }
390
391 /// <summary>
392 /// Updates a folder based on its ID with folder
393 /// </summary>
394 /// <param name="folder">The inventory folder</param>
395 public void updateInventoryFolder(InventoryFolderBase folder)
396 {
397 this.addFolder(folder);
398 }
399 }
400}
401
diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
index f2e6128..10da633 100644
--- a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
+++ b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
@@ -12,11 +12,11 @@ namespace OpenSim.Framework.InventoryServiceBase
12 public class InventoryServiceBase 12 public class InventoryServiceBase
13 { 13 {
14 protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>(); 14 protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>();
15 protected IAssetServer m_assetServer; 15 //protected IAssetServer m_assetServer;
16 16
17 public InventoryServiceBase(IAssetServer assetServer) 17 public InventoryServiceBase()
18 { 18 {
19 m_assetServer = assetServer; 19 //m_assetServer = assetServer;
20 } 20 }
21 21
22 /// <summary> 22 /// <summary>
@@ -25,7 +25,7 @@ namespace OpenSim.Framework.InventoryServiceBase
25 /// <param name="FileName">The filename to the user server plugin DLL</param> 25 /// <param name="FileName">The filename to the user server plugin DLL</param>
26 public void AddPlugin(string FileName) 26 public void AddPlugin(string FileName)
27 { 27 {
28 MainLog.Instance.Verbose("Inventorytorage: Attempting to load " + FileName); 28 MainLog.Instance.Verbose("Inventory", "Inventorystorage: Attempting to load " + FileName);
29 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 29 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
30 30
31 foreach (Type pluginType in pluginAssembly.GetTypes()) 31 foreach (Type pluginType in pluginAssembly.GetTypes())
@@ -108,13 +108,31 @@ namespace OpenSim.Framework.InventoryServiceBase
108 return itemsList; 108 return itemsList;
109 } 109 }
110 110
111 public void AddFolder(InventoryFolderBase folder)
112 {
113 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
114 {
115 plugin.Value.addInventoryFolder(folder);
116 }
117 }
118
111 /// <summary> 119 /// <summary>
112 /// 120 ///
113 /// </summary> 121 /// </summary>
114 /// <param name="inventory"></param> 122 /// <param name="inventory"></param>
115 public void AddNewInventorySet(UsersInventory inventory) 123 public void AddNewInventorySet(UsersInventory inventory)
116 { 124 {
125 foreach (InventoryFolderBase folder in inventory.Folders.Values)
126 {
127 this.AddFolder(folder);
128 }
129 }
117 130
131 public void CreateNewUserInventory(LLUUID user)
132 {
133 UsersInventory inven = new UsersInventory();
134 inven.CreateNewInventorySet(user);
135 this.AddNewInventorySet(inven);
118 } 136 }
119 137
120 public class UsersInventory 138 public class UsersInventory
@@ -127,9 +145,45 @@ namespace OpenSim.Framework.InventoryServiceBase
127 145
128 } 146 }
129 147
130 protected virtual void CreateNewInventorySet() 148 public virtual void CreateNewInventorySet(LLUUID user)
131 { 149 {
132 150 InventoryFolderBase folder = new InventoryFolderBase();
151 folder.parentID = LLUUID.Zero;
152 folder.agentID = user;
153 folder.folderID = LLUUID.Random();
154 folder.name = "My Inventory";
155 folder.type = 8;
156 folder.version = 1;
157 Folders.Add(folder.folderID, folder);
158
159 LLUUID rootFolder = folder.folderID;
160
161 folder = new InventoryFolderBase();
162 folder.parentID = rootFolder;
163 folder.agentID = user;
164 folder.folderID = LLUUID.Random();
165 folder.name = "Textures";
166 folder.type = 0;
167 folder.version = 1;
168 Folders.Add(folder.folderID, folder);
169
170 folder = new InventoryFolderBase();
171 folder.parentID = rootFolder;
172 folder.agentID = user;
173 folder.folderID = LLUUID.Random();
174 folder.name = "Objects";
175 folder.type = 6;
176 folder.version = 1;
177 Folders.Add(folder.folderID, folder);
178
179 folder = new InventoryFolderBase();
180 folder.parentID = rootFolder;
181 folder.agentID = user;
182 folder.folderID = LLUUID.Random();
183 folder.name = "Clothes";
184 folder.type = 5;
185 folder.version = 1;
186 Folders.Add(folder.folderID, folder);
133 } 187 }
134 } 188 }
135 } 189 }
diff --git a/OpenSim/Framework/UserManager/LoginService.cs b/OpenSim/Framework/UserManager/LoginService.cs
index a26a0c4..b75c4fb 100644
--- a/OpenSim/Framework/UserManager/LoginService.cs
+++ b/OpenSim/Framework/UserManager/LoginService.cs
@@ -89,14 +89,14 @@ namespace OpenSim.Framework.UserManagement
89 LLUUID agentID = userProfile.UUID; 89 LLUUID agentID = userProfile.UUID;
90 90
91 // Inventory Library Section 91 // Inventory Library Section
92 AgentInventory userInventory = this.GetUsersInventory(agentID); 92 InventoryData inventData = this.CreateInventoryData(agentID);
93 ArrayList AgentInventoryArray = this.CreateInventoryArray(userInventory); 93 ArrayList AgentInventoryArray = inventData.InventoryArray;
94 94
95 Hashtable InventoryRootHash = new Hashtable(); 95 Hashtable InventoryRootHash = new Hashtable();
96 InventoryRootHash["folder_id"] = userInventory.InventoryRoot.FolderID.ToStringHyphenated(); 96 InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated();
97 ArrayList InventoryRoot = new ArrayList(); 97 ArrayList InventoryRoot = new ArrayList();
98 InventoryRoot.Add(InventoryRootHash); 98 InventoryRoot.Add(InventoryRootHash);
99 userProfile.rootInventoryFolderID = userInventory.InventoryRoot.FolderID; 99 userProfile.rootInventoryFolderID = inventData.RootFolderID;
100 100
101 // Circuit Code 101 // Circuit Code
102 uint circode = (uint)(Util.RandomClass.Next()); 102 uint circode = (uint)(Util.RandomClass.Next());
@@ -253,16 +253,11 @@ namespace OpenSim.Framework.UserManagement
253 return inventoryLibOwner; 253 return inventoryLibOwner;
254 } 254 }
255 255
256 protected virtual AgentInventory GetUsersInventory(LLUUID agentID) 256 protected virtual InventoryData CreateInventoryData(LLUUID userID)
257 { 257 {
258 AgentInventory userInventory = new AgentInventory(); 258 AgentInventory userInventory = new AgentInventory();
259 userInventory.CreateRootFolder(agentID, false); 259 userInventory.CreateRootFolder(userID, false);
260 260
261 return userInventory;
262 }
263
264 protected virtual ArrayList CreateInventoryArray(AgentInventory userInventory)
265 {
266 ArrayList AgentInventoryArray = new ArrayList(); 261 ArrayList AgentInventoryArray = new ArrayList();
267 Hashtable TempHash; 262 Hashtable TempHash;
268 foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) 263 foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
@@ -275,7 +270,20 @@ namespace OpenSim.Framework.UserManagement
275 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 270 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
276 AgentInventoryArray.Add(TempHash); 271 AgentInventoryArray.Add(TempHash);
277 } 272 }
278 return AgentInventoryArray; 273
274 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
275 }
276
277 public class InventoryData
278 {
279 public ArrayList InventoryArray = null;
280 public LLUUID RootFolderID = LLUUID.Zero;
281
282 public InventoryData(ArrayList invList, LLUUID rootID)
283 {
284 InventoryArray = invList;
285 RootFolderID = rootID;
286 }
279 } 287 }
280 } 288 }
281} 289}
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index cd53728..4b95e02 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -155,7 +155,7 @@ namespace OpenSim
155 } 155 }
156 156
157 // Load all script engines found 157 // Load all script engines found
158 OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader(); 158 //OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader();
159 159
160 for (int i = 0; i < configFiles.Length; i++) 160 for (int i = 0; i < configFiles.Length; i++)
161 { 161 {
@@ -184,10 +184,6 @@ namespace OpenSim
184 { 184 {
185 this.m_udpServers[i].ServerListener(); 185 this.m_udpServers[i].ServerListener();
186 } 186 }
187
188
189
190
191 } 187 }
192 188
193 private static void CreateDefaultRegionInfoXml(string fileName) 189 private static void CreateDefaultRegionInfoXml(string fileName)
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index 3ad33f4..e2a953c 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -32,23 +32,32 @@ using OpenSim.Framework.Servers;
32using OpenSim.Framework.Communications.Caches; 32using OpenSim.Framework.Communications.Caches;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Framework.Utilities; 34using OpenSim.Framework.Utilities;
35using OpenSim.Framework.Data;
35 36
36namespace OpenSim.Region.Communications.Local 37namespace OpenSim.Region.Communications.Local
37{ 38{
38 public class CommunicationsLocal : CommunicationsManager 39 public class CommunicationsLocal : CommunicationsManager
39 { 40 {
40 public LocalBackEndServices InstanceServices = new LocalBackEndServices(); 41 public LocalBackEndServices InstanceServices;
41 public LocalUserServices UserServices; 42 public LocalUserServices UserServices;
42 public LocalLoginService LoginServices; 43 public LocalLoginService LoginServices;
44 public LocalInventoryService InvenServices;
43 45
44 public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage ) 46 public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage )
45 : base(serversInfo, httpServer, assetCache) 47 : base(serversInfo, httpServer, assetCache)
46 { 48 {
49 InvenServices = new LocalInventoryService();
50 InvenServices.AddPlugin("OpenSim.Framework.Data.SQLite.dll");
51 InventoryServer = InvenServices;
52
47 UserServices = new LocalUserServices(this, serversInfo); 53 UserServices = new LocalUserServices(this, serversInfo);
48 UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); 54 UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll");
49 UserServer = UserServices; 55 UserServer = UserServices;
56
57 InstanceServices = new LocalBackEndServices();
50 GridServer = InstanceServices; 58 GridServer = InstanceServices;
51 InterRegion = InstanceServices; 59 InterRegion = InstanceServices;
60
52 LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate); 61 LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate);
53 httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod); 62 httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod);
54 } 63 }
@@ -78,6 +87,12 @@ namespace OpenSim.Region.Communications.Local
78 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); 87 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
79 88
80 this.UserServices.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 89 this.UserServices.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
90 UserProfileData userProf = this.UserServer.GetUserProfile(tempfirstname, templastname);
91 if (userProf != null)
92 {
93 this.InvenServices.CreateNewUserInventory(userProf.UUID);
94 Console.WriteLine("created new inventory set for " + tempfirstname + " " + templastname);
95 }
81 break; 96 break;
82 } 97 }
83 } 98 }
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
new file mode 100644
index 0000000..35c2c8c
--- /dev/null
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -0,0 +1,51 @@
1using System;
2using System.Collections.Generic;
3using libsecondlife;
4using OpenSim.Framework.Communications;
5using OpenSim.Framework.Data;
6using OpenSim.Framework.Types;
7using OpenSim.Framework.UserManagement;
8using OpenSim.Framework.Utilities;
9using OpenSim.Framework.InventoryServiceBase;
10using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
11
12namespace OpenSim.Region.Communications.Local
13{
14 public class LocalInventoryService : InventoryServiceBase , IInventoryServices
15 {
16
17 public LocalInventoryService()
18 {
19
20 }
21
22 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
23 {
24 List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
25 InventoryFolder rootFolder = null;
26
27 //need to make sure we send root folder first
28 foreach (InventoryFolderBase folder in folders)
29 {
30 if (folder.parentID == libsecondlife.LLUUID.Zero)
31 {
32 InventoryFolder newfolder = new InventoryFolder(folder);
33 rootFolder = newfolder;
34 folderCallBack(userID, newfolder);
35 }
36 }
37
38 if (rootFolder != null)
39 {
40 foreach (InventoryFolderBase folder in folders)
41 {
42 if (folder.folderID != rootFolder.folderID)
43 {
44 InventoryFolder newfolder = new InventoryFolder(folder);
45 folderCallBack(userID, newfolder);
46 }
47 }
48 }
49 }
50 }
51}
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 19a1e8c..661fbbe 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -1,10 +1,13 @@
1using System; 1using System;
2using System.Collections;
3using System.Collections.Generic;
2using libsecondlife; 4using libsecondlife;
3using OpenSim.Framework.Communications; 5using OpenSim.Framework.Communications;
4using OpenSim.Framework.Data; 6using OpenSim.Framework.Data;
5using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
6using OpenSim.Framework.UserManagement; 8using OpenSim.Framework.UserManagement;
7using OpenSim.Framework.Utilities; 9using OpenSim.Framework.Utilities;
10using OpenSim.Framework.Inventory;
8 11
9namespace OpenSim.Region.Communications.Local 12namespace OpenSim.Region.Communications.Local
10{ 13{
@@ -109,5 +112,51 @@ namespace OpenSim.Region.Communications.Local
109 } 112 }
110 113
111 } 114 }
115
116 protected override InventoryData CreateInventoryData(LLUUID userID)
117 {
118 List<InventoryFolderBase> folders = this.m_Parent.InvenServices.RequestFirstLevelFolders(userID);
119 if (folders.Count > 0)
120 {
121 LLUUID rootID = LLUUID.Zero;
122 ArrayList AgentInventoryArray = new ArrayList();
123 Hashtable TempHash;
124 foreach (InventoryFolderBase InvFolder in folders)
125 {
126 if (InvFolder.parentID == LLUUID.Zero)
127 {
128 rootID = InvFolder.folderID;
129 }
130 TempHash = new Hashtable();
131 TempHash["name"] = InvFolder.name;
132 TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
133 TempHash["version"] = (Int32)InvFolder.version;
134 TempHash["type_default"] = (Int32)InvFolder.type;
135 TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
136 AgentInventoryArray.Add(TempHash);
137 }
138 return new InventoryData(AgentInventoryArray, rootID);
139 }
140 else
141 {
142 AgentInventory userInventory = new AgentInventory();
143 userInventory.CreateRootFolder(userID, false);
144
145 ArrayList AgentInventoryArray = new ArrayList();
146 Hashtable TempHash;
147 foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
148 {
149 TempHash = new Hashtable();
150 TempHash["name"] = InvFolder.FolderName;
151 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
152 TempHash["version"] = (Int32)InvFolder.Version;
153 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
154 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
155 AgentInventoryArray.Add(TempHash);
156 }
157
158 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
159 }
160 }
112 } 161 }
113} 162}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index b423e0a..f24def2 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1020,7 +1020,8 @@ namespace OpenSim.Region.Environment.Scenes
1020 public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine) 1020 public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine)
1021 { 1021 {
1022 ScriptEngines.Add(ScriptEngine); 1022 ScriptEngines.Add(ScriptEngine);
1023 ScriptEngine.InitializeEngine(this); } 1023 ScriptEngine.InitializeEngine(this);
1024 }
1024 #endregion 1025 #endregion
1025 1026
1026 public LLUUID ConvertLocalIDToFullID(uint localID) 1027 public LLUUID ConvertLocalIDToFullID(uint localID)
@@ -1037,8 +1038,7 @@ namespace OpenSim.Region.Environment.Scenes
1037 } 1038 }
1038 } 1039 }
1039 } 1040 }
1040 1041 return LLUUID.Zero;
1041 return null;
1042 } 1042 }
1043 } 1043 }
1044} 1044}
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index bd6658c..dede5ea 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -467,7 +467,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
467 addPrim(prim, obj.UUID); 467 addPrim(prim, obj.UUID);
468 } 468 }
469 469
470 MainLog.Instance.Verbose("Attempting to do database update...."); 470 // MainLog.Instance.Verbose("Attempting to do database update....");
471 primDa.Update(ds, "prims"); 471 primDa.Update(ds, "prims");
472 shapeDa.Update(ds, "primshapes"); 472 shapeDa.Update(ds, "primshapes");
473 // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); 473 // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml());