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.
afrisby
MW 2007-08-14 13:54:46 +00:00
parent 7b2663a41e
commit a228b5984e
14 changed files with 663 additions and 30 deletions

View File

@ -44,6 +44,21 @@ namespace OpenSim.Framework.Communications.Caches
public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>();
public InventoryFolder(InventoryFolderBase folderbase)
{
this.agentID = folderbase.agentID;
this.folderID = folderbase.folderID;
this.name = folderbase.name;
this.parentID = folderbase.parentID;
this.type = folderbase.type;
this.version = folderbase.version;
}
public InventoryFolder()
{
}
// Methods
public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
{

View File

@ -168,18 +168,18 @@ namespace OpenSim.Framework.Communications.Caches
/// <param name="userID"></param>
private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
{
// this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
//this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
//for now we manually create the root folder,
// but should be requesting all inventory from inventory server.
InventoryFolder folderInfo = new InventoryFolder();
/* InventoryFolder folderInfo = new InventoryFolder();
folderInfo.agentID = userID;
folderInfo.folderID = userInfo.UserProfile.rootInventoryFolderID;
folderInfo.name = "My Inventory";
folderInfo.parentID = LLUUID.Zero;
folderInfo.type = 8;
folderInfo.version = 1;
userInfo.FolderReceive(userID, folderInfo);
userInfo.FolderReceive(userID, folderInfo);*/
}
/// <summary>

View File

@ -0,0 +1,401 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Console;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using libsecondlife;
using System.Data;
using System.Data.SqlTypes;
using Mono.Data.SqliteClient;
namespace OpenSim.Framework.Data.SQLite
{
public class SQLiteInventoryStore : IInventoryData
{
private const string invItemsSelect = "select * from inventoryitems";
private const string invFoldersSelect = "select * from inventoryfolders";
private DataSet ds;
private SqliteDataAdapter invItemsDa;
private SqliteDataAdapter invFoldersDa;
/// <summary>
/// Initialises the interface
/// </summary>
public void Initialise()
{
Initialise("inventoryStore.db", "inventoryDatabase");
}
public void Initialise(string dbfile, string dbname)
{
string connectionString = "URI=file:" + dbfile + ",version=3";
MainLog.Instance.Verbose("Inventory", "Sqlite - connecting: " + dbfile);
SqliteConnection conn = new SqliteConnection(connectionString);
SqliteCommand itemsSelectCmd = new SqliteCommand(invItemsSelect, conn);
invItemsDa = new SqliteDataAdapter(itemsSelectCmd);
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
SqliteCommand foldersSelectCmd = new SqliteCommand(invFoldersSelect, conn);
invFoldersDa = new SqliteDataAdapter(foldersSelectCmd);
ds = new DataSet();
invItemsDa.Fill(ds, "inventoryitems");
invFoldersDa.Fill(ds, "inventoryfolders");
ds.AcceptChanges();
DataTable itemsTable = ds.Tables["inventoryitems"];
itemsTable.PrimaryKey = new DataColumn[] { itemsTable.Columns["UUID"] };
setupItemsCommands(invItemsDa, conn);
// shapeDa.FillSchema(ds, SchemaType.Source, "ShapeSchema");
DataTable folderTable = ds.Tables["inventoryfolders"];
folderTable.PrimaryKey = new DataColumn[] { folderTable.Columns["UUID"] };
setupFoldersCommands(invFoldersDa, conn);
return;
}
private SqliteParameter createSqliteParameter(string name, DbType type)
{
SqliteParameter param = new SqliteParameter();
param.ParameterName = ":" + name;
param.DbType = type;
param.SourceColumn = name;
param.SourceVersion = DataRowVersion.Current;
return param;
}
private Dictionary<string, DbType> createInventoryItemsDataDefs()
{
Dictionary<string, DbType> data = new Dictionary<string, DbType>();
data.Add("UUID", DbType.String); //inventoryID
data.Add("assetID", DbType.String);
data.Add("assetType", DbType.Int32);
data.Add("invType", DbType.Int32);
data.Add("parentFolderID", DbType.String);
data.Add("avatarID", DbType.String);
data.Add("creatorsID", DbType.String);
data.Add("inventoryName", DbType.String);
data.Add("inventoryDescription", DbType.String);
// permissions
data.Add("inventoryNextPermissions", DbType.Int32);
data.Add("inventoryCurrentPermissions", DbType.Int32);
data.Add("inventoryBasePermissions", DbType.Int32);
data.Add("inventoryEveryOnePermissions", DbType.Int32);
return data;
}
private Dictionary<string, DbType> createShapeDataDefs()
{
Dictionary<string, DbType> data = new Dictionary<string, DbType>();
data.Add("UUID", DbType.String); //folderID
// shape is an enum
data.Add("name", DbType.String);
// vectors
data.Add("agentID", DbType.String);
data.Add("parentID", DbType.String);
data.Add("type", DbType.Int32);
data.Add("version", DbType.Int32);
return data;
}
private SqliteCommand createInsertCommand(string table, Dictionary<string, DbType> defs)
{
/**
* This is subtle enough to deserve some commentary.
* Instead of doing *lots* and *lots of hardcoded strings
* for database definitions we'll use the fact that
* realistically all insert statements look like "insert
* into A(b, c) values(:b, :c) on the parameterized query
* front. If we just have a list of b, c, etc... we can
* generate these strings instead of typing them out.
*/
string[] cols = new string[defs.Keys.Count];
defs.Keys.CopyTo(cols, 0);
string sql = "insert into " + table + "(";
sql += String.Join(", ", cols);
// important, the first ':' needs to be here, the rest get added in the join
sql += ") values (:";
sql += String.Join(", :", cols);
sql += ")";
SqliteCommand cmd = new SqliteCommand(sql);
// this provides the binding for all our parameters, so
// much less code than it used to be
foreach (KeyValuePair<string, DbType> kvp in defs)
{
cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value));
}
return cmd;
}
private SqliteCommand createUpdateCommand(string table, string pk, Dictionary<string, DbType> defs)
{
string sql = "update " + table + " set ";
string subsql = "";
foreach (string key in defs.Keys)
{
if (subsql.Length > 0)
{ // a map function would rock so much here
subsql += ", ";
}
subsql += key + "= :" + key;
}
sql += subsql;
sql += " where " + pk;
SqliteCommand cmd = new SqliteCommand(sql);
// this provides the binding for all our parameters, so
// much less code than it used to be
foreach (KeyValuePair<string, DbType> kvp in defs)
{
cmd.Parameters.Add(createSqliteParameter(kvp.Key, kvp.Value));
}
return cmd;
}
private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
{
Dictionary<string, DbType> invDataDefs = createInventoryItemsDataDefs();
da.InsertCommand = createInsertCommand("inventoryitems", invDataDefs);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("inventoryitems", "UUID=:UUID", invDataDefs);
da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID");
delete.Parameters.Add(createSqliteParameter("UUID", DbType.String));
delete.Connection = conn;
da.DeleteCommand = delete;
}
private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn)
{
Dictionary<string, DbType> shapeDataDefs = createShapeDataDefs();
da.InsertCommand = createInsertCommand("inventoryfolders", shapeDataDefs);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("inventoryfolders", "UUID=:UUID", shapeDataDefs);
da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID");
delete.Parameters.Add(createSqliteParameter("UUID", DbType.String));
delete.Connection = conn;
da.DeleteCommand = delete;
}
private InventoryFolderBase buildFolder(DataRow row)
{
InventoryFolderBase folder = new InventoryFolderBase();
folder.folderID = new LLUUID((string)row["UUID"]);
folder.name = (string)row["name"];
folder.agentID = new LLUUID((string)row["agentID"]);
folder.parentID = new LLUUID((string)row["parentID"]);
folder.type = Convert.ToInt16(row["type"]);
folder.version = Convert.ToUInt16(row["version"]);
return folder;
}
private void fillFolderRow(DataRow row, InventoryFolderBase folder)
{
row["UUID"] = folder.folderID;
row["name"] = folder.name;
row["agentID"] = folder.agentID;
row["parentID"] = folder.parentID;
row["type"] = folder.type;
row["version"] = folder.version;
}
private void addFolder(InventoryFolderBase folder)
{
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.folderID);
if (inventoryRow == null)
{
inventoryRow = inventoryFolderTable.NewRow();
fillFolderRow(inventoryRow, folder);
inventoryFolderTable.Rows.Add(inventoryRow);
}
else
{
fillFolderRow(inventoryRow, folder);
}
this.invFoldersDa.Update(ds, "inventoryfolders");
}
public void Shutdown()
{
// TODO: DataSet commit
}
/// <summary>
/// Closes the interface
/// </summary>
public void Close()
{
}
/// <summary>
/// The plugin being loaded
/// </summary>
/// <returns>A string containing the plugin name</returns>
public string getName()
{
return "SQLite Inventory Data Interface";
}
/// <summary>
/// The plugins version
/// </summary>
/// <returns>A string containing the plugin version</returns>
public string getVersion()
{
return "0.1";
}
/// <summary>
/// Returns a list of inventory items contained within the specified folder
/// </summary>
/// <param name="folderID">The UUID of the target folder</param>
/// <returns>A List of InventoryItemBase items</returns>
public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
{
return null;
}
/// <summary>
/// Returns a list of the root folders within a users inventory
/// </summary>
/// <param name="user">The user whos inventory is to be searched</param>
/// <returns>A list of folder objects</returns>
public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
{
return null;
}
/// <summary>
/// Returns the users inventory root folder.
/// </summary>
/// <param name="user">The UUID of the user who is having inventory being returned</param>
/// <returns>Root inventory folder</returns>
public InventoryFolderBase getUserRootFolder(LLUUID user)
{
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
string selectExp = "agentID = '"+ user.ToString()+"' AND parentID = '"+ LLUUID.Zero.ToString()+"'";
DataRow[] rows = inventoryFolderTable.Select(selectExp);
foreach (DataRow row in rows)
{
folders.Add(this.buildFolder(row));
}
if (folders.Count == 1)
{
//we found the root
//System.Console.WriteLine("found root inventory folder");
return folders[0];
}
else if (folders.Count > 1)
{
//err shouldn't be more than one root
//System.Console.WriteLine("found more than one root inventory folder");
}
else if (folders.Count == 0)
{
// no root?
//System.Console.WriteLine("couldn't find root inventory folder");
}
return null;
}
/// <summary>
/// Returns a list of inventory folders contained in the folder 'parentID'
/// </summary>
/// <param name="parentID">The folder to get subfolders for</param>
/// <returns>A list of inventory folders</returns>
public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
{
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
string selectExp = "parentID = '" + parentID.ToString() + "'";
DataRow[] rows = inventoryFolderTable.Select(selectExp);
foreach (DataRow row in rows)
{
folders.Add(this.buildFolder(row));
}
// System.Console.WriteLine("found " + folders.Count + " inventory folders");
return folders;
}
/// <summary>
/// Returns an inventory item by its UUID
/// </summary>
/// <param name="item">The UUID of the item to be returned</param>
/// <returns>A class containing item information</returns>
public InventoryItemBase getInventoryItem(LLUUID item)
{
return null;
}
/// <summary>
/// Returns a specified inventory folder by its UUID
/// </summary>
/// <param name="folder">The UUID of the folder to be returned</param>
/// <returns>A class containing folder information</returns>
public InventoryFolderBase getInventoryFolder(LLUUID folder)
{
return null;
}
/// <summary>
/// Creates a new inventory item based on item
/// </summary>
/// <param name="item">The item to be created</param>
public void addInventoryItem(InventoryItemBase item)
{
}
/// <summary>
/// Updates an inventory item with item (updates based on ID)
/// </summary>
/// <param name="item">The updated item</param>
public void updateInventoryItem(InventoryItemBase item)
{
}
/// <summary>
/// Adds a new folder specified by folder
/// </summary>
/// <param name="folder">The inventory folder</param>
public void addInventoryFolder(InventoryFolderBase folder)
{
this.addFolder(folder);
}
/// <summary>
/// Updates a folder based on its ID with folder
/// </summary>
/// <param name="folder">The inventory folder</param>
public void updateInventoryFolder(InventoryFolderBase folder)
{
this.addFolder(folder);
}
}
}

View File

@ -12,11 +12,11 @@ namespace OpenSim.Framework.InventoryServiceBase
public class InventoryServiceBase
{
protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>();
protected IAssetServer m_assetServer;
//protected IAssetServer m_assetServer;
public InventoryServiceBase(IAssetServer assetServer)
public InventoryServiceBase()
{
m_assetServer = assetServer;
//m_assetServer = assetServer;
}
/// <summary>
@ -25,7 +25,7 @@ namespace OpenSim.Framework.InventoryServiceBase
/// <param name="FileName">The filename to the user server plugin DLL</param>
public void AddPlugin(string FileName)
{
MainLog.Instance.Verbose("Inventorytorage: Attempting to load " + FileName);
MainLog.Instance.Verbose("Inventory", "Inventorystorage: Attempting to load " + FileName);
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
foreach (Type pluginType in pluginAssembly.GetTypes())
@ -108,13 +108,31 @@ namespace OpenSim.Framework.InventoryServiceBase
return itemsList;
}
public void AddFolder(InventoryFolderBase folder)
{
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{
plugin.Value.addInventoryFolder(folder);
}
}
/// <summary>
///
/// </summary>
/// <param name="inventory"></param>
public void AddNewInventorySet(UsersInventory inventory)
{
foreach (InventoryFolderBase folder in inventory.Folders.Values)
{
this.AddFolder(folder);
}
}
public void CreateNewUserInventory(LLUUID user)
{
UsersInventory inven = new UsersInventory();
inven.CreateNewInventorySet(user);
this.AddNewInventorySet(inven);
}
public class UsersInventory
@ -127,9 +145,45 @@ namespace OpenSim.Framework.InventoryServiceBase
}
protected virtual void CreateNewInventorySet()
public virtual void CreateNewInventorySet(LLUUID user)
{
InventoryFolderBase folder = new InventoryFolderBase();
folder.parentID = LLUUID.Zero;
folder.agentID = user;
folder.folderID = LLUUID.Random();
folder.name = "My Inventory";
folder.type = 8;
folder.version = 1;
Folders.Add(folder.folderID, folder);
LLUUID rootFolder = folder.folderID;
folder = new InventoryFolderBase();
folder.parentID = rootFolder;
folder.agentID = user;
folder.folderID = LLUUID.Random();
folder.name = "Textures";
folder.type = 0;
folder.version = 1;
Folders.Add(folder.folderID, folder);
folder = new InventoryFolderBase();
folder.parentID = rootFolder;
folder.agentID = user;
folder.folderID = LLUUID.Random();
folder.name = "Objects";
folder.type = 6;
folder.version = 1;
Folders.Add(folder.folderID, folder);
folder = new InventoryFolderBase();
folder.parentID = rootFolder;
folder.agentID = user;
folder.folderID = LLUUID.Random();
folder.name = "Clothes";
folder.type = 5;
folder.version = 1;
Folders.Add(folder.folderID, folder);
}
}
}

View File

@ -89,14 +89,14 @@ namespace OpenSim.Framework.UserManagement
LLUUID agentID = userProfile.UUID;
// Inventory Library Section
AgentInventory userInventory = this.GetUsersInventory(agentID);
ArrayList AgentInventoryArray = this.CreateInventoryArray(userInventory);
InventoryData inventData = this.CreateInventoryData(agentID);
ArrayList AgentInventoryArray = inventData.InventoryArray;
Hashtable InventoryRootHash = new Hashtable();
InventoryRootHash["folder_id"] = userInventory.InventoryRoot.FolderID.ToStringHyphenated();
InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated();
ArrayList InventoryRoot = new ArrayList();
InventoryRoot.Add(InventoryRootHash);
userProfile.rootInventoryFolderID = userInventory.InventoryRoot.FolderID;
userProfile.rootInventoryFolderID = inventData.RootFolderID;
// Circuit Code
uint circode = (uint)(Util.RandomClass.Next());
@ -253,16 +253,11 @@ namespace OpenSim.Framework.UserManagement
return inventoryLibOwner;
}
protected virtual AgentInventory GetUsersInventory(LLUUID agentID)
protected virtual InventoryData CreateInventoryData(LLUUID userID)
{
AgentInventory userInventory = new AgentInventory();
userInventory.CreateRootFolder(agentID, false);
userInventory.CreateRootFolder(userID, false);
return userInventory;
}
protected virtual ArrayList CreateInventoryArray(AgentInventory userInventory)
{
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
@ -275,7 +270,20 @@ namespace OpenSim.Framework.UserManagement
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash);
}
return AgentInventoryArray;
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
}
public class InventoryData
{
public ArrayList InventoryArray = null;
public LLUUID RootFolderID = LLUUID.Zero;
public InventoryData(ArrayList invList, LLUUID rootID)
{
InventoryArray = invList;
RootFolderID = rootID;
}
}
}
}

View File

@ -155,7 +155,7 @@ namespace OpenSim
}
// Load all script engines found
OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader();
//OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader();
for (int i = 0; i < configFiles.Length; i++)
{
@ -184,10 +184,6 @@ namespace OpenSim
{
this.m_udpServers[i].ServerListener();
}
}
private static void CreateDefaultRegionInfoXml(string fileName)

View File

@ -32,23 +32,32 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Console;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Data;
namespace OpenSim.Region.Communications.Local
{
public class CommunicationsLocal : CommunicationsManager
{
public LocalBackEndServices InstanceServices = new LocalBackEndServices();
public LocalBackEndServices InstanceServices;
public LocalUserServices UserServices;
public LocalLoginService LoginServices;
public LocalInventoryService InvenServices;
public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage )
: base(serversInfo, httpServer, assetCache)
{
InvenServices = new LocalInventoryService();
InvenServices.AddPlugin("OpenSim.Framework.Data.SQLite.dll");
InventoryServer = InvenServices;
UserServices = new LocalUserServices(this, serversInfo);
UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll");
UserServer = UserServices;
InstanceServices = new LocalBackEndServices();
GridServer = InstanceServices;
InterRegion = InstanceServices;
LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate);
httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod);
}
@ -78,6 +87,12 @@ namespace OpenSim.Region.Communications.Local
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
this.UserServices.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
UserProfileData userProf = this.UserServer.GetUserProfile(tempfirstname, templastname);
if (userProf != null)
{
this.InvenServices.CreateNewUserInventory(userProf.UUID);
Console.WriteLine("created new inventory set for " + tempfirstname + " " + templastname);
}
break;
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.InventoryServiceBase;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.Local
{
public class LocalInventoryService : InventoryServiceBase , IInventoryServices
{
public LocalInventoryService()
{
}
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{
List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
InventoryFolder rootFolder = null;
//need to make sure we send root folder first
foreach (InventoryFolderBase folder in folders)
{
if (folder.parentID == libsecondlife.LLUUID.Zero)
{
InventoryFolder newfolder = new InventoryFolder(folder);
rootFolder = newfolder;
folderCallBack(userID, newfolder);
}
}
if (rootFolder != null)
{
foreach (InventoryFolderBase folder in folders)
{
if (folder.folderID != rootFolder.folderID)
{
InventoryFolder newfolder = new InventoryFolder(folder);
folderCallBack(userID, newfolder);
}
}
}
}
}
}

View File

@ -1,10 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Inventory;
namespace OpenSim.Region.Communications.Local
{
@ -109,5 +112,51 @@ namespace OpenSim.Region.Communications.Local
}
}
protected override InventoryData CreateInventoryData(LLUUID userID)
{
List<InventoryFolderBase> folders = this.m_Parent.InvenServices.RequestFirstLevelFolders(userID);
if (folders.Count > 0)
{
LLUUID rootID = LLUUID.Zero;
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders)
{
if (InvFolder.parentID == LLUUID.Zero)
{
rootID = InvFolder.folderID;
}
TempHash = new Hashtable();
TempHash["name"] = InvFolder.name;
TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.version;
TempHash["type_default"] = (Int32)InvFolder.type;
TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, rootID);
}
else
{
AgentInventory userInventory = new AgentInventory();
userInventory.CreateRootFolder(userID, false);
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
{
TempHash = new Hashtable();
TempHash["name"] = InvFolder.FolderName;
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.DefaultType;
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
}
}
}
}

View File

@ -1020,7 +1020,8 @@ namespace OpenSim.Region.Environment.Scenes
public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine)
{
ScriptEngines.Add(ScriptEngine);
ScriptEngine.InitializeEngine(this); }
ScriptEngine.InitializeEngine(this);
}
#endregion
public LLUUID ConvertLocalIDToFullID(uint localID)
@ -1037,8 +1038,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
return null;
return LLUUID.Zero;
}
}
}

View File

@ -467,7 +467,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
addPrim(prim, obj.UUID);
}
MainLog.Instance.Verbose("Attempting to do database update....");
// MainLog.Instance.Verbose("Attempting to do database update....");
primDa.Update(ds, "prims");
shapeDa.Update(ds, "primshapes");
// MainLog.Instance.Verbose("Dump of prims:", ds.GetXml());

BIN
bin/inventoryStore.db Normal file

Binary file not shown.

View File

@ -514,6 +514,7 @@
<Reference name="OpenSim.Framework.Console"/>
<Reference name="libsecondlife.dll"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.InventoryServiceBase"/>
<Reference name="XMLRPC.dll"/>
<Files>
@ -810,7 +811,10 @@
<Reference name="System.Data"/>
<Reference name="System.Data.SQLite.dll"/>
<Reference name="OpenSim.Framework.Data"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Mono.Data.SqliteClient"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>

View File

@ -0,0 +1,40 @@
--
-- Database schema for inventory storage
--
--
-- Some type mappings
-- LLUID => char(36) (in ascii hex format)
-- uint => integer
-- string => varchar(256) until such time as we know we need bigger
create table inventoryitems (
UUID char(36) primary key, -- inventoryid
assetID char(36),
assetType integer,
invType integer,
parentFolderID char(36),
avatarID char(36),
creatorsID char(36),
inventoryName varchar(256),
inventoryDescription varchar(256),
-- permissions
inventoryNextPermissions integer,
inventoryCurrentPermissions integer,
inventoryBasePermissions integer,
inventoryEveryOnePermissions integer
);
create index inventoryitems_parent on inventoryitems(parentFolderID);
create index inventoryitems_ownerid on inventoryitems(avatarID);
create index inventoryitems_assetid on inventoryitems(assetID);
create table inventoryfolders (
-- The same UUID as prim, just to keep them easily linked
UUID varchar(36) primary key not null, --folderid
name varchar(256),
agentID char(36),
parentID char(36),
type integer,
version integer
);