Reverting back to 2017 since 2018 were causing Linux breakage; reopening Tleiades patch 444 and 445.

afrisby
lbsa71 2007-09-27 14:57:43 +00:00
parent a6f3fa2fbe
commit 863195612b
37 changed files with 424 additions and 1154 deletions

View File

@ -8,6 +8,7 @@ using Nwc.XmlRpc;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;

View File

@ -38,7 +38,7 @@ using OpenSim.Framework.Utilities;
namespace OpenSim.Framework.Communications.Caches namespace OpenSim.Framework.Communications.Caches
{ {
public class CachedUserInfo : MarshalByRefObject public class CachedUserInfo
{ {
private CommunicationsManager m_parentCommsManager; private CommunicationsManager m_parentCommsManager;
// Fields // Fields
@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications.Caches
} }
// Methods // Methods
public void FolderReceive(LLUUID userID, InventoryFolderBase folderInfo) public void FolderReceive(LLUUID userID, InventoryFolder folderInfo)
{ {
if (userID == this.UserProfile.UUID) if (userID == this.UserProfile.UUID)
{ {
@ -59,19 +59,19 @@ namespace OpenSim.Framework.Communications.Caches
{ {
if (folderInfo.parentID == LLUUID.Zero) if (folderInfo.parentID == LLUUID.Zero)
{ {
this.RootFolder = new InventoryFolder(folderInfo); this.RootFolder = folderInfo;
} }
} }
else if (this.RootFolder.folderID == folderInfo.parentID) else if (this.RootFolder.folderID == folderInfo.parentID)
{ {
this.RootFolder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo)); this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
} }
else else
{ {
InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID); InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID);
if (folder != null) if (folder != null)
{ {
folder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo)); folder.SubFolders.Add(folderInfo.folderID, folderInfo);
} }
} }
} }
@ -131,7 +131,3 @@ namespace OpenSim.Framework.Communications.Caches
} }

View File

@ -35,9 +35,6 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Console;
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Framework.Communications.Caches namespace OpenSim.Framework.Communications.Caches
{ {
@ -63,7 +60,7 @@ namespace OpenSim.Framework.Communications.Caches
} }
// Methods // Methods
public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type, InventoryCategory category) public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
{ {
InventoryFolder subFold = new InventoryFolder(); InventoryFolder subFold = new InventoryFolder();
subFold.name = folderName; subFold.name = folderName;
@ -71,12 +68,7 @@ namespace OpenSim.Framework.Communications.Caches
subFold.type = (short) type; subFold.type = (short) type;
subFold.parentID = this.folderID; subFold.parentID = this.folderID;
subFold.agentID = this.agentID; subFold.agentID = this.agentID;
subFold.category = category; this.SubFolders.Add(subFold.folderID, subFold);
if (!SubFolders.ContainsKey(subFold.folderID))
this.SubFolders.Add(subFold.folderID, subFold);
else
MainLog.Instance.Warn("INVENTORYCACHE", "Attempt to create a duplicate folder {0} {1}", folderName, folderID);
return subFold; return subFold;
} }

View File

@ -35,11 +35,10 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Framework.Communications.Caches namespace OpenSim.Framework.Communications.Caches
{ {
public class UserProfileCache : MarshalByRefObject public class UserProfileCache
{ {
// Fields // Fields
private CommunicationsManager m_parent; private CommunicationsManager m_parent;
@ -104,7 +103,7 @@ namespace OpenSim.Framework.Communications.Caches
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
if (info.RootFolder.folderID == parentID) if (info.RootFolder.folderID == parentID)
{ {
InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User); InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
if (createdFolder != null) if (createdFolder != null)
{ {
this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
@ -115,7 +114,7 @@ namespace OpenSim.Framework.Communications.Caches
InventoryFolder folder = info.RootFolder.HasSubFolder(parentID); InventoryFolder folder = info.RootFolder.HasSubFolder(parentID);
if (folder != null) if (folder != null)
{ {
folder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User); folder.CreateNewSubFolder(folderID, folderName, folderType);
} }
} }
} }
@ -125,21 +124,16 @@ namespace OpenSim.Framework.Communications.Caches
public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
{ {
InventoryFolder fold = null; InventoryFolder fold = null;
if (folderID == libraryRoot.folderID ) if (folderID == libraryRoot.folderID )
{ {
// we are looking for the root of the shared inventory
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems());
} }
else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) else if (( fold = libraryRoot.HasSubFolder(folderID)) != null)
{ {
// we are looking for a sub folder of the shared inventory
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems());
} }
else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) else if (this.UserProfiles.ContainsKey(remoteClient.AgentId))
{ {
//if we get here, we are looking the inventory of an agent in this sim
//now we need to see if we already have the inventory cached
if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) if (this.UserProfiles[remoteClient.AgentId].RootFolder != null)
{ {
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
@ -159,23 +153,9 @@ namespace OpenSim.Framework.Communications.Caches
} }
} }
} }
else
{
//nope, inventory wasn't cached, so go to the inventory server and ask for the inventory
m_parent.InventoryService.RequestInventoryForUser(remoteClient.AgentId, ReceiveFolderInfo, ReceiveItemInfo);
}
} }
} }
public void ReceiveFolderInfo(LLUUID userID, InventoryFolderBase folderInfo)
{
}
public void ReceiveItemInfo(LLUUID userID, InventoryItemBase itemInfo)
{
}
public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID) public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
{ {
if (ownerID == libraryRoot.agentID) if (ownerID == libraryRoot.agentID)
@ -201,7 +181,7 @@ namespace OpenSim.Framework.Communications.Caches
/// <param name="userID"></param> /// <param name="userID"></param>
private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
{ {
this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
} }
/// <summary> /// <summary>
@ -241,7 +221,3 @@ namespace OpenSim.Framework.Communications.Caches
} }
} }

View File

@ -1,31 +1,29 @@
using System; using System;
using System.Text;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using libsecondlife;
using OpenSim.Framework.Communications.Caches; using OpenSim.Framework.Communications.Caches;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderBase folderInfo); public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo);
public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
public interface IInventoryServices public interface IInventoryServices
{ {
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user); void CreateNewUserInventory(LLUUID user);
void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder);
/// <summary> /// <summary>
/// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree) /// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns></returns> /// <returns></returns>
List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID); List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID);
List<InventoryItemBase> RequestFolderItems(LLUUID folderID);
} }
} }

View File

@ -1,9 +1,4 @@
using System; using System;
using System.Text;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using libsecondlife; using libsecondlife;
@ -11,20 +6,21 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
public abstract class InventoryServiceBase : MarshalByRefObject, IInventoryServices public abstract class InventoryServiceBase : IInventoryServices
{ {
protected IInventoryData _databasePlugin; protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>();
//protected IAssetServer m_assetServer;
public InventoryServiceBase() public InventoryServiceBase()
{ {
//m_assetServer = assetServer;
} }
/// <summary> /// <summary>
/// Adds a new inventory data server plugin /// Adds a new user server plugin - plugins will be requested in the order they were loaded.
/// </summary> /// </summary>
/// <param name="FileName">The filename to the user server plugin DLL</param> /// <param name="FileName">The filename to the user server plugin DLL</param>
public void AddPlugin(string FileName) public void AddPlugin(string FileName)
@ -45,13 +41,8 @@ namespace OpenSim.Framework.Communications
IInventoryData plug = IInventoryData plug =
(IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(); plug.Initialise();
this._databasePlugin = plug; this.m_plugins.Add(plug.getName(), plug);
//TODO! find a better place to create inventory skeletons
loadInventoryFromXmlFile(InventoryCategory.Library, "Inventory_Library.xml");
loadInventoryFromXmlFile(InventoryCategory.Default, "Inventory_Default.xml");
MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface"); MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface");
break;
} }
} }
} }
@ -63,20 +54,20 @@ namespace OpenSim.Framework.Communications
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns></returns> /// <returns></returns>
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID) public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
{ {
InventoryFolderBase root = _databasePlugin.getInventoryFolder(folderID); List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
if (root != null)
{ {
folders.Add(root); InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID);
if (rootFolder != null)
List<InventoryFolderBase> subFolders = _databasePlugin.getInventoryFolders(root.folderID); {
foreach (InventoryFolderBase f in subFolders) inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID);
folders.Add(f); inventoryList.Insert(0, rootFolder);
return inventoryList;
}
} }
return folders; return inventoryList;
} }
/// <summary> /// <summary>
@ -84,7 +75,11 @@ namespace OpenSim.Framework.Communications
/// </summary> /// </summary>
public InventoryFolderBase RequestUsersRoot(LLUUID userID) public InventoryFolderBase RequestUsersRoot(LLUUID userID)
{ {
return _databasePlugin.getInventoryFolder(userID); // the id of the root folder, is the user id foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{
return plugin.Value.getUserRootFolder(userID);
}
return null;
} }
/// <summary> /// <summary>
@ -94,27 +89,47 @@ namespace OpenSim.Framework.Communications
/// <returns></returns> /// <returns></returns>
public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID)
{ {
return _databasePlugin.getInventoryFolders(parentFolderID); List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{
return plugin.Value.getInventoryFolders(parentFolderID);
}
return inventoryList;
} }
public List<InventoryItemBase> RequestFolderItems(LLUUID folderID) public List<InventoryItemBase> RequestFolderItems(LLUUID folderID)
{ {
return _databasePlugin.getInventoryInFolder(folderID); List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{
itemsList = plugin.Value.getInventoryInFolder(folderID);
return itemsList;
}
return itemsList;
} }
public void AddFolder(InventoryFolderBase folder) public void AddFolder(InventoryFolderBase folder)
{ {
_databasePlugin.addInventoryFolder(folder); foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{
plugin.Value.addInventoryFolder(folder);
}
} }
public void AddItem(InventoryItemBase item) public void AddItem(InventoryItemBase item)
{ {
_databasePlugin.addInventoryItem(item); foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{
plugin.Value.addInventoryItem(item);
}
} }
public void deleteItem(InventoryItemBase item) public void deleteItem(InventoryItemBase item)
{ {
_databasePlugin.deleteInventoryItem(item); foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{
plugin.Value.deleteInventoryItem(item);
}
} }
/// <summary> /// <summary>
@ -129,53 +144,11 @@ namespace OpenSim.Framework.Communications
} }
} }
public void CreateNewUserInventory(LLUUID defaultFolders, LLUUID user) public void CreateNewUserInventory(LLUUID user)
{ {
try UsersInventory inven = new UsersInventory();
{ inven.CreateNewInventorySet(user);
// Get Default folder set from the database this.AddNewInventorySet(inven);
//TODO! We need to get the whole hierachy and not just one level down
List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(LLUUID.Parse("00000112-000f-0000-0000-000100bba000"));
// create an index list, where each of the elements has the index of its parent in the hierachy
// this algorithm is pretty shoddy O(n^2), but it is only executed once per user.
int[] parentIdx = new int[folders.Count];
for (int i = 0; i < folders.Count; i++)
parentIdx[i] = -1;
for (int i = 0; i < folders.Count; i++)
for (int j = 0; j < folders.Count; j++)
if (folders[i].folderID == folders[j].parentID)
parentIdx[j] = i;
//assign a new owerid and a new to the folders
foreach (InventoryFolderBase ifb in folders)
{
if (ifb.parentID == LLUUID.Zero)
ifb.folderID = user;
else
ifb.folderID = LLUUID.Random();
ifb.agentID = user;
ifb.category = InventoryCategory.User;
}
// correct the parent id
for (int i = 0; i < folders.Count; i++)
{
if (folders[i].parentID != LLUUID.Zero)
folders[i].parentID = folders[parentIdx[i]].folderID; // root folder id is the same as the user id
}
// the list is structurally sound, using new folder id's, so save it
foreach (InventoryFolderBase ifb in folders)
_databasePlugin.addInventoryFolder(ifb);
}
catch (Exception e)
{
MainLog.Instance.Error(e.ToString());
}
} }
public class UsersInventory public class UsersInventory
@ -193,11 +166,10 @@ namespace OpenSim.Framework.Communications
InventoryFolderBase folder = new InventoryFolderBase(); InventoryFolderBase folder = new InventoryFolderBase();
folder.parentID = LLUUID.Zero; folder.parentID = LLUUID.Zero;
folder.agentID = user; folder.agentID = user;
folder.folderID = user; // id of root folder is the same as the agent id folder.folderID = LLUUID.Random();
folder.name = "My Inventory"; folder.name = "My Inventory";
folder.type = 8; folder.type = 8;
folder.version = 1; folder.version = 1;
folder.category = InventoryCategory.User;
Folders.Add(folder.folderID, folder); Folders.Add(folder.folderID, folder);
LLUUID rootFolder = folder.folderID; LLUUID rootFolder = folder.folderID;
@ -209,7 +181,6 @@ namespace OpenSim.Framework.Communications
folder.name = "Textures"; folder.name = "Textures";
folder.type = 0; folder.type = 0;
folder.version = 1; folder.version = 1;
folder.category = InventoryCategory.User;
Folders.Add(folder.folderID, folder); Folders.Add(folder.folderID, folder);
folder = new InventoryFolderBase(); folder = new InventoryFolderBase();
@ -219,7 +190,6 @@ namespace OpenSim.Framework.Communications
folder.name = "Objects"; folder.name = "Objects";
folder.type = 6; folder.type = 6;
folder.version = 1; folder.version = 1;
folder.category = InventoryCategory.User;
Folders.Add(folder.folderID, folder); Folders.Add(folder.folderID, folder);
folder = new InventoryFolderBase(); folder = new InventoryFolderBase();
@ -229,130 +199,13 @@ namespace OpenSim.Framework.Communications
folder.name = "Clothes"; folder.name = "Clothes";
folder.type = 5; folder.type = 5;
folder.version = 1; folder.version = 1;
folder.category = InventoryCategory.User;
Folders.Add(folder.folderID, folder); Folders.Add(folder.folderID, folder);
} }
} }
public void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder)
{
List<InventoryFolderBase> folders = _databasePlugin.getUserRootFolders(user);
libraryFolder = LLUUID.Zero;
personalFolder = LLUUID.Zero;
for (int i = 0; i < folders.Count; i++)
{
if (folders[i].category == InventoryCategory.Library)
libraryFolder = folders[i].folderID;
else if (folders[i].category == InventoryCategory.User)
personalFolder = folders[i].folderID;
}
}
/*
* Dot net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder
* class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize
* into this simpler class, and then use that.
*/
[XmlRoot(ElementName = "inventory", IsNullable = true)]
public class SerializedInventory
{
[XmlRoot(ElementName = "folder", IsNullable = true)]
public class SerializedFolder : InventoryFolderBase
{
[XmlArray(ElementName = "folders", IsNullable = true)]
[XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializedFolder))]
public ArrayList SubFolders;
[XmlArray(ElementName = "items", IsNullable = true)]
[XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof(InventoryItemBase))]
public ArrayList Items;
}
[XmlElement(ElementName = "folder", IsNullable = true)]
public SerializedFolder root;
}
public void uploadInventory(SerializedInventory.SerializedFolder folder)
{
foreach (InventoryItemBase iib in folder.Items)
{
// assign default values, if they haven't assigned
iib.avatarID = folder.agentID;
if (iib.assetID == LLUUID.Zero)
iib.assetID = LLUUID.Random();
if (iib.creatorsID == LLUUID.Zero)
iib.creatorsID = folder.agentID;
if (iib.inventoryID == LLUUID.Zero)
iib.inventoryID = LLUUID.Random();
if (iib.inventoryName == null || iib.inventoryName.Length == 0)
iib.inventoryName = "new item";
iib.parentFolderID = folder.folderID;
_databasePlugin.addInventoryItem(iib);
}
foreach (SerializedInventory.SerializedFolder sf in folder.SubFolders)
{
// assign default values, if they haven't assigned
sf.agentID = folder.agentID;
sf.category = folder.category;
if (sf.folderID == LLUUID.Zero)
sf.folderID = LLUUID.Random();
if (sf.name == null || sf.name.Length == 0)
sf.name = "new folder";
sf.parentID = folder.folderID;
_databasePlugin.addInventoryFolder(sf);
uploadInventory(sf);
}
}
public void loadInventoryFromXmlFile(InventoryCategory inventoryCategory, string fileName)
{
_databasePlugin.deleteInventoryCategory(inventoryCategory);
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
XmlReader reader = new XmlTextReader(fs);
XmlSerializer x = new XmlSerializer(typeof(SerializedInventory));
SerializedInventory inventory = (SerializedInventory)x.Deserialize(reader);
// the library and default inventories has no owner, so we use a random guid.
if (inventory.root.category == InventoryCategory.Library || inventory.root.category == InventoryCategory.Default)
{
if (inventory.root.folderID != LLUUID.Zero)
inventory.root.agentID = inventory.root.folderID;
else
inventory.root.agentID = LLUUID.Random();
}
else if (inventory.root.category == InventoryCategory.User)
{
if (inventory.root.agentID == LLUUID.Zero)
inventory.root.agentID = LLUUID.Random();
}
inventory.root.folderID = inventory.root.agentID; // the root folder always has the same id as the owning agent
inventory.root.parentID = LLUUID.Zero;
inventory.root.version = 0;
inventory.root.category = inventoryCategory;
_databasePlugin.addInventoryFolder(inventory.root);
uploadInventory(inventory.root);
}
protected void saveInventoryToXmlFile(SerializedInventory inventory, string fileName)
{
FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
XmlTextWriter writer = new XmlTextWriter(fs, Encoding.UTF8);
writer.Formatting = Formatting.Indented;
XmlSerializer x = new XmlSerializer(typeof(SerializedInventory));
x.Serialize(writer, inventory);
}
public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
} }
} }

View File

@ -26,10 +26,9 @@ namespace OpenSim.Framework.UserManagement
private ArrayList classifiedCategories; private ArrayList classifiedCategories;
private ArrayList inventoryRoot; private ArrayList inventoryRoot;
private ArrayList initialOutfit; private ArrayList initialOutfit;
private ArrayList inventorySkeleton; private ArrayList agentInventory;
private ArrayList inventoryLibraryOwner; private ArrayList inventoryLibraryOwner;
private ArrayList inventoryLibraryRoot; private ArrayList inventoryLibrary;
private ArrayList inventoryLibrarySkeleton;
private UserInfo userProfile; private UserInfo userProfile;
@ -87,13 +86,11 @@ namespace OpenSim.Framework.UserManagement
this.defaultXmlRpcResponse = new XmlRpcResponse(); this.defaultXmlRpcResponse = new XmlRpcResponse();
this.userProfile = new UserInfo(); this.userProfile = new UserInfo();
this.initialOutfit = new ArrayList();
this.inventoryRoot = new ArrayList(); this.inventoryRoot = new ArrayList();
this.inventorySkeleton = new ArrayList(); this.initialOutfit = new ArrayList();
this.inventoryLibrarySkeleton = new ArrayList(); this.agentInventory = new ArrayList();
this.inventoryLibrary = new ArrayList();
this.inventoryLibraryOwner = new ArrayList(); this.inventoryLibraryOwner = new ArrayList();
this.inventoryLibraryRoot = new ArrayList();
this.xmlRpcResponse = new XmlRpcResponse(); this.xmlRpcResponse = new XmlRpcResponse();
this.defaultXmlRpcResponse = new XmlRpcResponse(); this.defaultXmlRpcResponse = new XmlRpcResponse();
@ -240,15 +237,12 @@ namespace OpenSim.Framework.UserManagement
responseData["classified_categories"] = this.classifiedCategories; responseData["classified_categories"] = this.classifiedCategories;
responseData["ui-config"] = this.uiConfig; responseData["ui-config"] = this.uiConfig;
responseData["inventory-skeleton"] = this.inventorySkeleton; responseData["inventory-skeleton"] = this.agentInventory;
responseData["inventory-skel-lib"] = this.inventoryLibrarySkeleton; responseData["inventory-skel-lib"] = this.inventoryLibrary;
responseData["inventory-root"] = this.inventoryRoot; responseData["inventory-root"] = this.inventoryRoot;
responseData["inventory-lib-owner"] = this.inventoryLibraryOwner;
responseData["inventory-lib-root"] = this.inventoryLibraryRoot;
responseData["gestures"] = new ArrayList(); // todo responseData["gestures"] = new ArrayList(); // todo
responseData["inventory-lib-owner"] = this.inventoryLibraryOwner;
responseData["initial-outfit"] = this.initialOutfit; responseData["initial-outfit"] = this.initialOutfit;
responseData["start_location"] = this.startLocation; responseData["start_location"] = this.startLocation;
responseData["seed_capability"] = this.seedCapability; responseData["seed_capability"] = this.seedCapability;
responseData["home"] = this.home; responseData["home"] = this.home;
@ -602,23 +596,23 @@ namespace OpenSim.Framework.UserManagement
{ {
get get
{ {
return this.inventorySkeleton; return this.agentInventory;
} }
set set
{ {
this.inventorySkeleton = value; this.agentInventory = value;
} }
} }
public ArrayList InventoryLibrarySkeleton public ArrayList InventoryLibrary
{ {
get get
{ {
return this.inventoryLibrarySkeleton; return this.inventoryLibrary;
} }
set set
{ {
this.inventoryLibrarySkeleton = value; this.inventoryLibrary = value;
} }
} }
@ -634,18 +628,6 @@ namespace OpenSim.Framework.UserManagement
} }
} }
public ArrayList InventoryLibraryRoot
{
get
{
return this.inventoryLibraryRoot;
}
set
{
this.inventoryLibraryRoot = value;
}
}
public string Home public string Home
{ {
get get
@ -683,7 +665,3 @@ namespace OpenSim.Framework.UserManagement
} }
} }

View File

@ -8,10 +8,11 @@ using Nwc.XmlRpc;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Configuration;
using OpenSim.Framework.Configuration;
using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder;
namespace OpenSim.Framework.UserManagement namespace OpenSim.Framework.UserManagement
{ {
@ -19,12 +20,10 @@ namespace OpenSim.Framework.UserManagement
{ {
protected string m_welcomeMessage = "Welcome to OpenSim"; protected string m_welcomeMessage = "Welcome to OpenSim";
protected UserManagerBase m_userManager = null; protected UserManagerBase m_userManager = null;
protected IInventoryServices m_inventoryServer = null;
public LoginService(UserManagerBase userManager, IInventoryServices inventoryServer, string welcomeMess) public LoginService(UserManagerBase userManager, string welcomeMess)
{ {
m_userManager = userManager; m_userManager = userManager;
m_inventoryServer = inventoryServer;
if (welcomeMess != "") if (welcomeMess != "")
{ {
m_welcomeMessage = welcomeMess; m_welcomeMessage = welcomeMess;
@ -38,6 +37,7 @@ namespace OpenSim.Framework.UserManagement
/// <returns>The response to send</returns> /// <returns>The response to send</returns>
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
{ {
System.Console.WriteLine("Attempting login now..."); System.Console.WriteLine("Attempting login now...");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
@ -85,41 +85,15 @@ namespace OpenSim.Framework.UserManagement
{ {
LLUUID agentID = userProfile.UUID; LLUUID agentID = userProfile.UUID;
LLUUID libraryFolderID; // Inventory Library Section
LLUUID personalFolderID; InventoryData inventData = this.CreateInventoryData(agentID);
ArrayList AgentInventoryArray = inventData.InventoryArray;
m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID); Hashtable InventoryRootHash = new Hashtable();
if (personalFolderID == LLUUID.Zero) InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated();
{ ArrayList InventoryRoot = new ArrayList();
m_inventoryServer.CreateNewUserInventory(libraryFolderID, agentID); InventoryRoot.Add(InventoryRootHash);
m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID); userProfile.rootInventoryFolderID = inventData.RootFolderID;
}
// The option "inventory-lib-owner" requires that we return the id of the
// owner of the library inventory.
Hashtable dynamicStruct = new Hashtable();
dynamicStruct["agent_id"] = libraryFolderID.ToStringHyphenated();
logResponse.InventoryLibraryOwner.Add(dynamicStruct);
// The option "inventory-lib-root" requires that we return the id of the
// root folder of the library inventory.
dynamicStruct = new Hashtable();
dynamicStruct["folder_id"] = libraryFolderID.ToStringHyphenated();
logResponse.InventoryLibraryRoot.Add(dynamicStruct);
// The option "inventory-root" requires that we return the id of the
// root folder of the users inventory.
dynamicStruct = new Hashtable();
dynamicStruct["folder_id"] = personalFolderID.ToStringHyphenated();
logResponse.InventoryRoot.Add(dynamicStruct);
// The option "inventory-skeleton" requires that we return the structure of the
// users folder hierachy
logResponse.InventorySkeleton = GetInventorySkeleton(personalFolderID);
// The option "inventory-skel-lib" requires that we return the structure of the
// library folder hierachy
logResponse.InventoryLibrarySkeleton = GetInventorySkeleton(libraryFolderID);
// Circuit Code // Circuit Code
uint circode = (uint)(Util.RandomClass.Next()); uint circode = (uint)(Util.RandomClass.Next());
@ -129,6 +103,10 @@ namespace OpenSim.Framework.UserManagement
logResponse.AgentID = agentID.ToStringHyphenated(); logResponse.AgentID = agentID.ToStringHyphenated();
logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated();
logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
logResponse.InventoryRoot = InventoryRoot;
logResponse.InventorySkeleton = AgentInventoryArray;
logResponse.InventoryLibrary = this.GetInventoryLibrary();
logResponse.InventoryLibraryOwner = this.GetLibraryOwner();
logResponse.CircuitCode = (Int32)circode; logResponse.CircuitCode = (Int32)circode;
//logResponse.RegionX = 0; //overwritten //logResponse.RegionX = 0; //overwritten
//logResponse.RegionY = 0; //overwritten //logResponse.RegionY = 0; //overwritten
@ -234,30 +212,76 @@ namespace OpenSim.Framework.UserManagement
} }
/// <summary> /// <summary>
/// Create a structure of the generic inventory structure of a specified folder ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected virtual ArrayList GetInventorySkeleton(LLUUID folderID) protected virtual ArrayList GetInventoryLibrary()
{ {
//return new ArrayList();
List<InventoryFolderBase> folders = m_inventoryServer.RequestFirstLevelFolders(folderID); Hashtable TempHash = new Hashtable();
TempHash["name"] = "OpenSim Library";
TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated();
TempHash["version"] = 1;
TempHash["type_default"] = -1;
TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
ArrayList temp = new ArrayList(); ArrayList temp = new ArrayList();
foreach (InventoryFolderBase ifb in folders) temp.Add(TempHash);
{
LLUUID tempFolderID = ifb.folderID;
LLUUID tempParentID = ifb.parentID;
Hashtable TempHash = new Hashtable(); TempHash = new Hashtable();
TempHash["folder_id"] = tempFolderID.ToStringHyphenated(); TempHash["name"] = "Texture Library";
TempHash["name"] = ifb.name; TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000";
TempHash["parent_id"] = tempParentID.ToStringHyphenated(); TempHash["version"] = 1;
TempHash["type_default"] = (Int32)ifb.type; TempHash["type_default"] = -1;
TempHash["version"] = (Int32)ifb.version+1; TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001";
temp.Add(TempHash); temp.Add(TempHash);
return temp;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
protected virtual ArrayList GetLibraryOwner()
{
//for now create random inventory library owner
Hashtable TempHash = new Hashtable();
TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000";
ArrayList inventoryLibOwner = new ArrayList();
inventoryLibOwner.Add(TempHash);
return inventoryLibOwner;
}
protected virtual InventoryData CreateInventoryData(LLUUID userID)
{
AgentInventory userInventory = new AgentInventory();
userInventory.CreateRootFolder(userID, false);
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (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 temp; 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

@ -132,7 +132,7 @@ namespace OpenSim.Framework.Data.MySQL
param["?uuid"] = user.ToStringHyphenated(); param["?uuid"] = user.ToStringHyphenated();
param["?zero"] = LLUUID.Zero.ToStringHyphenated(); param["?zero"] = LLUUID.Zero.ToStringHyphenated();
IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND (agentID = ?uuid OR category = 0)", param); IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
IDataReader reader = result.ExecuteReader(); IDataReader reader = result.ExecuteReader();
List<InventoryFolderBase> items = database.readInventoryFolders(reader); List<InventoryFolderBase> items = database.readInventoryFolders(reader);
@ -151,6 +151,40 @@ namespace OpenSim.Framework.Data.MySQL
} }
} }
/// <summary>
/// Returns the users inventory root folder.
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
public InventoryFolderBase getUserRootFolder(LLUUID user)
{
try
{
lock (database)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["?uuid"] = user.ToStringHyphenated();
param["?zero"] = LLUUID.Zero.ToStringHyphenated();
IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
IDataReader reader = result.ExecuteReader();
List<InventoryFolderBase> items = database.readInventoryFolders(reader);
InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one).
reader.Close();
result.Dispose();
return rootFolder;
}
}
catch (Exception e)
{
database.Reconnect();
Console.WriteLine(e.ToString());
return null;
}
}
/// <summary> /// <summary>
/// Returns a list of folders in a users inventory contained within the specified folder /// Returns a list of folders in a users inventory contained within the specified folder
/// </summary> /// </summary>
@ -314,27 +348,5 @@ namespace OpenSim.Framework.Data.MySQL
{ {
addInventoryFolder(folder); addInventoryFolder(folder);
} }
public void deleteInventoryCategory(InventoryCategory inventoryCategory)
{
try
{
lock (database) {
IDbCommand cmd = database.Query(string.Format("DELETE FROM inventoryitems WHERE parentFolderID IN (SELECT folderId FROM inventoryfolders WHERE category={0})", (byte)inventoryCategory), null);
cmd.ExecuteNonQuery();
cmd = database.Query(string.Format("DELETE FROM inventoryfolders WHERE category={0}", (byte)inventoryCategory), null);
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
database.Reconnect();
Console.WriteLine(e.ToString());
}
}
} }
} }

View File

@ -41,7 +41,7 @@ namespace OpenSim.Framework.Data.MySQL
/// <summary> /// <summary>
/// The database connection object /// The database connection object
/// </summary> /// </summary>
MySqlConnection dbcon; IDbConnection dbcon;
/// <summary> /// <summary>
/// Connection string for ADO.net /// Connection string for ADO.net
/// </summary> /// </summary>
@ -115,11 +115,10 @@ namespace OpenSim.Framework.Data.MySQL
{ {
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
dbcommand.CommandText = sql; dbcommand.CommandText = sql;
if(parameters != null) foreach (KeyValuePair<string, string> param in parameters)
foreach (KeyValuePair<string, string> param in parameters) {
{ dbcommand.Parameters.Add(param.Key, param.Value);
dbcommand.Parameters.Add(param.Key, param.Value); }
}
return (IDbCommand)dbcommand; return (IDbCommand)dbcommand;
} }
@ -150,11 +149,10 @@ namespace OpenSim.Framework.Data.MySQL
{ {
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
dbcommand.CommandText = sql; dbcommand.CommandText = sql;
if(parameters != null) foreach (KeyValuePair<string, string> param in parameters)
foreach (KeyValuePair<string, string> param in parameters) {
{ dbcommand.Parameters.Add(param.Key, param.Value);
dbcommand.Parameters.Add(param.Key, param.Value); }
}
return (IDbCommand)dbcommand; return (IDbCommand)dbcommand;
} }
@ -372,8 +370,6 @@ namespace OpenSim.Framework.Data.MySQL
folder.parentID = new LLUUID((string)reader["parentFolderID"]); folder.parentID = new LLUUID((string)reader["parentFolderID"]);
folder.folderID = new LLUUID((string)reader["folderID"]); folder.folderID = new LLUUID((string)reader["folderID"]);
folder.name = (string)reader["folderName"]; folder.name = (string)reader["folderName"];
folder.category = (InventoryCategory)((Int16)reader["category"]);
folder.type = (Int16)reader["folderType"];
rows.Add(folder); rows.Add(folder);
} }
@ -513,32 +509,24 @@ namespace OpenSim.Framework.Data.MySQL
/// <returns>Success?</returns> /// <returns>Success?</returns>
public bool insertFolder(InventoryFolderBase folder) public bool insertFolder(InventoryFolderBase folder)
{ {
string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, category, folderType) VALUES "; string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?category, ?folderType)"; sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)";
MySqlCommand dbcmd = dbcon.CreateCommand(); Dictionary<string, string> parameters = new Dictionary<string, string>();
dbcmd.CommandText = sql; parameters["?folderID"] = folder.folderID.ToStringHyphenated();
parameters["?agentID"] = folder.agentID.ToStringHyphenated();
parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated();
parameters["?folderName"] = folder.name;
LLUUID tmpID = folder.folderID;
dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated()));
dbcmd.Parameters.Add(new MySqlParameter("?folderID", tmpID.ToStringHyphenated()));
tmpID = folder.agentID;
dbcmd.Parameters.Add(new MySqlParameter("?agentID", tmpID.ToStringHyphenated()));
tmpID = folder.parentID;
dbcmd.Parameters.Add(new MySqlParameter("?parentFolderID", tmpID.ToStringHyphenated()));
dbcmd.Parameters.Add(new MySqlParameter("?folderName", folder.name));
MySqlParameter p = dbcmd.Parameters.Add(new MySqlParameter("?category", MySqlDbType.Byte));
p.Value = (byte)folder.category;
p = dbcmd.Parameters.Add(new MySqlParameter("?folderType", MySqlDbType.Byte));
p.Value = (byte)folder.type;
bool returnval = false; bool returnval = false;
try try
{ {
if (dbcmd.ExecuteNonQuery() == 1) IDbCommand result = Query(sql, parameters);
if (result.ExecuteNonQuery() == 1)
returnval = true; returnval = true;
result.Dispose();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -61,11 +61,10 @@ namespace OpenSim.Framework.Data.SQLite
MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Items Definitions"); MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Items Definitions");
ds.AcceptChanges(); ds.AcceptChanges();
return; return;
} }
public InventoryItemBase buildItem(DataRow row) public InventoryItemBase BuildItem(DataRow row)
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.inventoryID = new LLUUID((string)row["UUID"]); item.inventoryID = new LLUUID((string)row["UUID"]);
@ -183,7 +182,7 @@ namespace OpenSim.Framework.Data.SQLite
DataRow[] rows = inventoryItemTable.Select(selectExp); DataRow[] rows = inventoryItemTable.Select(selectExp);
foreach (DataRow row in rows) foreach (DataRow row in rows)
{ {
retval.Add(buildItem(row)); retval.Add(BuildItem(row));
} }
return retval; return retval;
@ -195,17 +194,44 @@ namespace OpenSim.Framework.Data.SQLite
/// <param name="user">The user whos inventory is to be searched</param> /// <param name="user">The user whos inventory is to be searched</param>
/// <returns>A list of folder objects</returns> /// <returns>A list of folder objects</returns>
public List<InventoryFolderBase> getUserRootFolders(LLUUID user) 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>(); List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'";
string selectExp = "parentID = '" + LLUUID.Zero.ToString() + "' AND (agentID = '" + user.ToString() + "' OR category = 0)";
DataRow[] rows = inventoryFolderTable.Select(selectExp); DataRow[] rows = inventoryFolderTable.Select(selectExp);
foreach (DataRow row in rows) foreach (DataRow row in rows)
{ {
folders.Add(this.buildFolder(row)); folders.Add(this.buildFolder(row));
} }
return folders;
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> /// <summary>
@ -234,11 +260,7 @@ namespace OpenSim.Framework.Data.SQLite
/// <returns>A class containing item information</returns> /// <returns>A class containing item information</returns>
public InventoryItemBase getInventoryItem(LLUUID item) public InventoryItemBase getInventoryItem(LLUUID item)
{ {
DataRow row = ds.Tables["inventoryitems"].Rows.Find(item); return null;
if (row != null)
return this.buildItem(row);
else
return null;
} }
/// <summary> /// <summary>
@ -248,14 +270,7 @@ namespace OpenSim.Framework.Data.SQLite
/// <returns>A class containing folder information</returns> /// <returns>A class containing folder information</returns>
public InventoryFolderBase getInventoryFolder(LLUUID folder) public InventoryFolderBase getInventoryFolder(LLUUID folder)
{ {
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; return null;
string selectExp = "UUID = '" + folder.ToString() + "'";
DataRow[] rows = inventoryFolderTable.Select(selectExp);
if (rows.Length == 1)
return this.buildFolder(rows[0]);
else
return null;
} }
/// <summary> /// <summary>
@ -293,11 +308,6 @@ namespace OpenSim.Framework.Data.SQLite
this.invItemsDa.Update(ds, "inventoryitems"); this.invItemsDa.Update(ds, "inventoryitems");
} }
//TODO! Implement SQLite deleteInventoryCategory
public void deleteInventoryCategory(InventoryCategory inventoryCategory)
{
}
/// <summary> /// <summary>
/// Adds a new folder specified by folder /// Adds a new folder specified by folder
/// </summary> /// </summary>
@ -316,11 +326,6 @@ namespace OpenSim.Framework.Data.SQLite
this.addFolder(folder); this.addFolder(folder);
} }
//TODO! implement CreateNewUserInventory
public void CreateNewUserInventory(LLUUID user)
{
throw new Exception("Function not implemented");
}
/*********************************************************************** /***********************************************************************
* *
@ -345,7 +350,6 @@ namespace OpenSim.Framework.Data.SQLite
createCol(inv, "parentFolderID", typeof(System.String)); createCol(inv, "parentFolderID", typeof(System.String));
createCol(inv, "avatarID", typeof(System.String)); createCol(inv, "avatarID", typeof(System.String));
createCol(inv, "creatorsID", typeof(System.String)); createCol(inv, "creatorsID", typeof(System.String));
createCol(inv, "category", typeof(System.Byte));
createCol(inv, "inventoryName", typeof(System.String)); createCol(inv, "inventoryName", typeof(System.String));
createCol(inv, "inventoryDescription", typeof(System.String)); createCol(inv, "inventoryDescription", typeof(System.String));
@ -369,7 +373,6 @@ namespace OpenSim.Framework.Data.SQLite
createCol(fol, "parentID", typeof(System.String)); createCol(fol, "parentID", typeof(System.String));
createCol(fol, "type", typeof(System.Int32)); createCol(fol, "type", typeof(System.Int32));
createCol(fol, "version", typeof(System.Int32)); createCol(fol, "version", typeof(System.Int32));
createCol(fol, "category", typeof(System.Byte));
fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] }; fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] };
return fol; return fol;
@ -412,7 +415,6 @@ namespace OpenSim.Framework.Data.SQLite
folder.parentID = new LLUUID((string)row["parentID"]); folder.parentID = new LLUUID((string)row["parentID"]);
folder.type = Convert.ToInt16(row["type"]); folder.type = Convert.ToInt16(row["type"]);
folder.version = Convert.ToUInt16(row["version"]); folder.version = Convert.ToUInt16(row["version"]);
folder.category = (InventoryCategory)Convert.ToByte(row["category"]);
return folder; return folder;
} }
@ -424,7 +426,6 @@ namespace OpenSim.Framework.Data.SQLite
row["parentID"] = folder.parentID; row["parentID"] = folder.parentID;
row["type"] = folder.type; row["type"] = folder.type;
row["version"] = folder.version; row["version"] = folder.version;
row["category"] = folder.category;
} }
@ -643,7 +644,3 @@ namespace OpenSim.Framework.Data.SQLite
} }
} }

View File

@ -25,19 +25,15 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
using System.Xml.Serialization;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
namespace OpenSim.Framework.Data namespace OpenSim.Framework.Data
{ {
public enum InventoryCategory : byte { Library, Default, User };
/// <summary> /// <summary>
/// Inventory Item - contains all the properties associated with an individual inventory piece. /// Inventory Item - contains all the properties associated with an individual inventory piece.
/// </summary> /// </summary>
public class InventoryItemBase : MarshalByRefObject public class InventoryItemBase
{ {
/// <summary> /// <summary>
/// A UUID containing the ID for the inventory item itself /// A UUID containing the ID for the inventory item itself
@ -70,12 +66,10 @@ namespace OpenSim.Framework.Data
/// <summary> /// <summary>
/// The name of the inventory item (must be less than 64 characters) /// The name of the inventory item (must be less than 64 characters)
/// </summary> /// </summary>
[XmlElement(ElementName="name")]
public string inventoryName; public string inventoryName;
/// <summary> /// <summary>
/// The description of the inventory item (must be less than 64 characters) /// The description of the inventory item (must be less than 64 characters)
/// </summary> /// </summary>
[XmlElement(ElementName = "description")]
public string inventoryDescription; public string inventoryDescription;
/// <summary> /// <summary>
/// A mask containing the permissions for the next owner (cannot be enforced) /// A mask containing the permissions for the next owner (cannot be enforced)
@ -98,7 +92,7 @@ namespace OpenSim.Framework.Data
/// <summary> /// <summary>
/// A Class for folders which contain users inventory /// A Class for folders which contain users inventory
/// </summary> /// </summary>
public class InventoryFolderBase : MarshalByRefObject public class InventoryFolderBase
{ {
/// <summary> /// <summary>
/// The name of the folder (64 characters or less) /// The name of the folder (64 characters or less)
@ -124,10 +118,6 @@ namespace OpenSim.Framework.Data
/// ///
/// </summary> /// </summary>
public ushort version; public ushort version;
/// <summary>
/// Inventory category, Library, Default, System
/// </summary>
public InventoryCategory category;
} }
/// <summary> /// <summary>
@ -171,6 +161,13 @@ namespace OpenSim.Framework.Data
/// <returns>A list of folder objects</returns> /// <returns>A list of folder objects</returns>
List<InventoryFolderBase> getUserRootFolders(LLUUID user); List<InventoryFolderBase> getUserRootFolders(LLUUID user);
/// <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>
InventoryFolderBase getUserRootFolder(LLUUID user);
/// <summary> /// <summary>
/// Returns a list of inventory folders contained in the folder 'parentID' /// Returns a list of inventory folders contained in the folder 'parentID'
/// </summary> /// </summary>
@ -221,17 +218,5 @@ namespace OpenSim.Framework.Data
/// </summary> /// </summary>
/// <param name="folder">The inventory folder</param> /// <param name="folder">The inventory folder</param>
void updateInventoryFolder(InventoryFolderBase folder); void updateInventoryFolder(InventoryFolderBase folder);
/// <summary>
/// Delete a complete inventory category
/// </summary>
/// <param name="inventoryCategory">What folder category shout be deleted</param>
void deleteInventoryCategory(InventoryCategory inventoryCategory);
/// <summary>
/// Setup the initial folderset of a user
/// </summary>
/// <param name="user"></param>
//void CreateNewUserInventory(LLUUID user);
} }
} }

View File

@ -1,67 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.Configuration
{
/// <summary>
/// UserConfig -- For User Server Configuration
/// </summary>
public class InventoryConfig
{
public string DefaultStartupMsg = "";
public string UserServerURL = "";
public string UserSendKey = "";
public string UserRecvKey = "";
public string DatabaseProvider = "";
public int RemotingPort = 8004;
private ConfigurationMember configMember;
public InventoryConfig(string description, string filename)
{
configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration);
configMember.performConfigurationRetrieve();
}
public void loadConfigurationOptions()
{
configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false);
configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:8002/", false);
configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false);
configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false);
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
configMember.addConfigurationOption("remoting_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Remoting Listener port", "8004", false);
}
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
{
switch (configuration_key)
{
case "default_startup_message":
this.DefaultStartupMsg = (string)configuration_result;
break;
case "default_user_server":
this.UserServerURL = (string)configuration_result;
break;
case "user_send_key":
this.UserSendKey = (string)configuration_result;
break;
case "user_recv_key":
this.UserRecvKey = (string)configuration_result;
break;
case "database_provider":
this.DatabaseProvider = (string)configuration_result;
break;
case "remoting_port":
RemotingPort = (int)configuration_result;
break;
}
return true;
}
}
}

View File

@ -18,9 +18,6 @@ namespace OpenSim.Framework.Configuration
public uint HttpPort = 8002; public uint HttpPort = 8002;
public int InventoryServerPort;
public string InventoryServerName;
private ConfigurationMember configMember; private ConfigurationMember configMember;
public UserConfig(string description, string filename) public UserConfig(string description, string filename)
@ -40,8 +37,6 @@ namespace OpenSim.Framework.Configuration
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", "8002", false); configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", "8002", false);
configMember.addConfigurationOption("inventory_server_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Portnumber inventory is listening on", "8004", false);
configMember.addConfigurationOption("inventory_server_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DNS name of the inventory server", "127.0.0.1", false);
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -64,12 +59,6 @@ namespace OpenSim.Framework.Configuration
this.DatabaseProvider = (string)configuration_result; this.DatabaseProvider = (string)configuration_result;
break; break;
case "inventory_server_port":
this.InventoryServerPort = (int)configuration_result;
break;
case "inventory_server_name":
this.InventoryServerName = (string)configuration_result;
break;
case "http_port": case "http_port":
HttpPort = (uint)configuration_result; HttpPort = (uint)configuration_result;
break; break;

View File

@ -49,8 +49,6 @@ namespace OpenSim.Framework.Types
public int HttpListenerPort = 9000; public int HttpListenerPort = 9000;
public int RemotingListenerPort = 8895; public int RemotingListenerPort = 8895;
public int InventoryServerPort;
public string InventoryServerName = "";
public NetworkServersInfo() public NetworkServersInfo()
{ {
@ -88,8 +86,7 @@ namespace OpenSim.Framework.Types
UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); UserSendKey = config.Configs["Network"].GetString("user_send_key", "null");
UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null");
AssetURL = config.Configs["Network"].GetString("asset_server_url", "http://127.0.0.1:8003"); AssetURL = config.Configs["Network"].GetString("asset_server_url", "http://127.0.0.1:8003");
InventoryServerPort = config.Configs["Network"].GetInt("inventory_server_port", 8004);
InventoryServerName = config.Configs["Network"].GetString("inventory_server_name", "127.0.0.1");
} }
} }
} }

View File

@ -91,12 +91,12 @@ namespace OpenSim.Framework.Types
public void Combine(UUID other) public void Combine(UUID other)
{ {
LLUUID.Combine(llUUID, other.GetLLUUID()); llUUID.Combine(other.GetLLUUID());
} }
public void Combine(LLUUID other) public void Combine(LLUUID other)
{ {
LLUUID.Combine(llUUID, other); llUUID.Combine(other);
} }
public override bool Equals(Object other) public override bool Equals(Object other)

View File

@ -26,34 +26,37 @@
* *
*/ */
using System; using System;
using System.Text;
using System.Reflection;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using OpenGrid.Framework.Data;
using libsecondlife; using libsecondlife;
using System.Reflection;
using System.Xml; using System.Xml;
using OpenSim.Framework.Console; using Nwc.XmlRpc;
using OpenSim.Framework.Sims;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Data;
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Grid.InventoryServer using System.Security.Cryptography;
namespace OpenGridServices.InventoryServer
{ {
class InventoryManager : IInventoryData class InventoryManager
{ {
IInventoryData _databasePlugin; Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>();
/// <summary> /// <summary>
/// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
/// </summary> /// </summary>
/// <param name="FileName">The filename to the inventory server plugin DLL</param> /// <param name="FileName">The filename to the inventory server plugin DLL</param>
public void AddDatabasePlugin(string FileName) public void AddPlugin(string FileName)
{ {
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Attempting to load " + FileName); OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName);
Assembly pluginAssembly = Assembly.LoadFrom(FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName);
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
foreach (Type pluginType in pluginAssembly.GetTypes()) foreach (Type pluginType in pluginAssembly.GetTypes())
{ {
if (!pluginType.IsAbstract) if (!pluginType.IsAbstract)
@ -64,9 +67,8 @@ namespace OpenSim.Grid.InventoryServer
{ {
IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(); plug.Initialise();
_databasePlugin = plug; this._plugins.Add(plug.getName(), plug);
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Added IInventoryData Interface"); OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface");
break;
} }
typeInterface = null; typeInterface = null;
@ -78,87 +80,46 @@ namespace OpenSim.Grid.InventoryServer
public List<InventoryFolderBase> getRootFolders(LLUUID user) public List<InventoryFolderBase> getRootFolders(LLUUID user)
{ {
foreach (KeyValuePair<string, IInventoryData> kvp in _plugins)
{
try
{
return kvp.Value.getUserRootFolders(user);
}
catch (Exception e)
{
OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")");
}
}
return null; return null;
} }
#region IInventoryData Members public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
{ {
return _databasePlugin.getInventoryInFolder(folderID); XmlRpcResponse response = new XmlRpcResponse();
} Hashtable requestData = (Hashtable)request.Params[0];
public List<InventoryFolderBase> getUserRootFolders(LLUUID user) Hashtable responseData = new Hashtable();
{
return _databasePlugin.getUserRootFolders(user);
}
public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) // Stuff happens here
{
return _databasePlugin.getInventoryFolders(parentID);
}
public InventoryItemBase getInventoryItem(LLUUID item) if (requestData.ContainsKey("Access-type"))
{ {
throw new Exception("The method or operation is not implemented."); if (requestData["access-type"] == "rootfolders")
} {
// responseData["rootfolders"] =
}
}
else
{
responseData["error"] = "No access-type specified.";
}
public InventoryFolderBase getInventoryFolder(LLUUID folder)
{
return _databasePlugin.getInventoryFolder(folder);
}
public void addInventoryItem(InventoryItemBase item) // Stuff stops happening here
{
_databasePlugin.addInventoryItem(item);
}
public void updateInventoryItem(InventoryItemBase item) response.Value = responseData;
{ return response;
throw new Exception("The method or operation is not implemented.");
} }
public void deleteInventoryItem(InventoryItemBase item)
{
throw new Exception("The method or operation is not implemented.");
}
public void addInventoryFolder(InventoryFolderBase folder)
{
_databasePlugin.addInventoryFolder(folder);
}
public void updateInventoryFolder(InventoryFolderBase folder)
{
throw new Exception("The method or operation is not implemented.");
}
public void Initialise()
{
throw new Exception("The method or operation is not implemented.");
}
public void Close()
{
throw new Exception("The method or operation is not implemented.");
}
public string getName()
{
throw new Exception("The method or operation is not implemented.");
}
public string getVersion()
{
throw new Exception("The method or operation is not implemented.");
}
public void deleteInventoryCategory(InventoryCategory inventoryCategory)
{
_databasePlugin.deleteInventoryCategory(inventoryCategory);
}
#endregion
} }
} }

View File

@ -1,136 +0,0 @@
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Serialization.Formatters;
using System.Collections;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Data;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Configuration;
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Grid.InventoryServer
{
class InventoryServiceSingleton : OpenSim.Framework.Communications.InventoryServiceBase
{
static InventoryManager _inventoryManager;
static public InventoryManager InventoryManager
{
set { _inventoryManager = value; }
get { return _inventoryManager; }
}
#region Singleton Pattern
static InventoryServiceSingleton instance=null;
InventoryServiceSingleton()
{
}
public static InventoryServiceSingleton Instance
{
get
{
if (instance==null)
{
instance = new InventoryServiceSingleton();
}
return instance;
}
}
#endregion
#region IInventoryServices Members
public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{
List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
InventoryFolderBase rootFolder = null;
//need to make sure we send root folder first
foreach (InventoryFolderBase folder in folders)
{
if (folder.parentID == libsecondlife.LLUUID.Zero)
{
rootFolder = folder;
folderCallBack(userID, folder);
}
}
if (rootFolder != null)
{
foreach (InventoryFolderBase folder in folders)
{
if (folder.folderID != rootFolder.folderID)
{
folderCallBack(userID, folder);
List<InventoryItemBase> items = this.RequestFolderItems(folder.folderID);
foreach (InventoryItemBase item in items)
{
itemCallBack(userID, item);
}
}
}
}
}
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
_inventoryManager.addInventoryFolder(folder);
}
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
throw new Exception("Not implemented exception");
}
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
throw new Exception("Not implemented exception");
}
public List<InventoryItemBase> RequestFolderItems(LLUUID folderID)
{
return _inventoryManager.getInventoryInFolder(folderID);
}
#endregion
}
class InventoryService
{
InventoryServiceSingleton _inventoryServiceMethods;
public InventoryService(InventoryManager inventoryManager, InventoryConfig cfg)
{
// we only need to register the tcp channel once, and we don't know which other modules use remoting
if (ChannelServices.GetChannel("tcp") == null)
{
// Creating a custom formatter for a TcpChannel sink chain.
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
IDictionary props = new Hashtable();
props["port"] = cfg.RemotingPort;
props["typeFilterLevel"] = TypeFilterLevel.Full;
// Pass the properties for the port setting and the server provider in the server chain argument. (Client remains null here.)
ChannelServices.RegisterChannel(new TcpChannel(props, null, serverProvider), true);
}
// Register the object
RemotingConfiguration.RegisterWellKnownServiceType(typeof(InventoryServiceSingleton), "Inventory", WellKnownObjectMode.Singleton);
_inventoryServiceMethods = InventoryServiceSingleton.Instance;
InventoryServiceSingleton.InventoryManager = inventoryManager;
}
}
}

View File

@ -31,130 +31,49 @@ using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Xml;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.User;
using OpenSim.Framework.Sims;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Servers;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration;
using OpenSim.Framework.Data;
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Grid.InventoryServer namespace OpenGridServices.InventoryServer
{ {
public class OpenInventory_Main : BaseServer, conscmd_callback
public class OpenInventory_Main : conscmd_callback
{ {
ConsoleBase m_console;
InventoryManager m_inventoryManager;
public const string MainLogName = "INVENTORY";
private InventoryConfig m_config;
LogBase m_console;
InventoryManager m_inventoryManager; ///connection the database backend
InventoryService m_inventoryService; ///Remoting interface, where messages arrive
[STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
Console.WriteLine("Launching InventoryServer...");
OpenInventory_Main inventoryServer = new OpenInventory_Main();
inventoryServer.Startup();
// inventoryServer.RunCmd("load", new string[] { "library", "inventory_library.xml" });
// inventoryServer.RunCmd("load", new string[] { "default", "inventory_default.xml" });
inventoryServer.Work();
} }
public OpenInventory_Main() public OpenInventory_Main()
{ {
m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
if (!Directory.Exists(Util.logDir())) MainConsole.Instance = m_console;
{
Directory.CreateDirectory(Util.logDir());
}
m_console = new LogBase(Path.Combine(Util.logDir(), "opensim-inventory-console.log"), "OpenInventory", this, false);
MainLog.Instance = m_console;
}
private void Work()
{
m_console.Notice(OpenInventory_Main.MainLogName, "Enter help for a list of commands\n");
while (true)
{
m_console.MainLogPrompt();
}
} }
public void Startup() public void Startup()
{ {
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Initialising inventory manager..."); MainConsole.Instance.Notice("Initialising inventory manager...");
m_config = new InventoryConfig(OpenInventory_Main.MainLogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
// instantiate the manager, responsible for doing the actual storage
m_inventoryManager = new InventoryManager(); m_inventoryManager = new InventoryManager();
m_inventoryManager.AddDatabasePlugin(m_config.DatabaseProvider);
m_inventoryService = new InventoryService(m_inventoryManager, m_config); MainConsole.Instance.Notice("Starting HTTP server");
BaseHttpServer httpServer = new BaseHttpServer(8004);
// Dig out the embedded version number of this assembly httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest);
Assembly assembly = Assembly.GetExecutingAssembly(); //httpServer.AddRestHandler("GET","/rootfolders/",Rest
string serverExeName = assembly.ManifestModule.Name;
Version serverExeVersion = AssemblyName.GetAssemblyName(serverExeName).Version;
m_console.Status(OpenInventory_Main.MainLogName, "Inventoryserver {0}.{1}.{2}.{3} - Startup complete", serverExeVersion.Major, serverExeVersion.Minor, serverExeVersion.Revision, serverExeVersion.Build);
}
public void Load(string[] cmdparams)
{
string cmd = cmdparams[0];
string fileName = cmdparams[1];
if (cmdparams.Length != 2)
{
cmd = "help";
}
switch (cmd)
{
case "library":
InventoryServiceSingleton.Instance.loadInventoryFromXmlFile(InventoryCategory.Library, fileName);
break;
case "default":
InventoryServiceSingleton.Instance.loadInventoryFromXmlFile(InventoryCategory.Default, fileName);
break;
case "user":
InventoryServiceSingleton.Instance.loadInventoryFromXmlFile(InventoryCategory.User, fileName);
break;
case "help":
m_console.Notice("load library <filename>, load library inventory, shared between all users");
m_console.Notice("load default <filename>, load template inventory, used when creating a new user inventory");
m_console.Notice("load user <first> <last>, load inventory for a specific users, warning this will reset the contents of the inventory");
break;
}
} }
public void RunCmd(string cmd, string[] cmdparams) public void RunCmd(string cmd, string[] cmdparams)
{ {
switch (cmd) switch (cmd)
{ {
case "help":
m_console.Notice("load - load verious inventories, use \"load help\", to see a list of commands");
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
m_console.Notice("quit - shutdown the grid (USE CAUTION!)");
break;
case "load":
Load(cmdparams);
break;
case "quit":
case "shutdown": case "shutdown":
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Shutting down inventory server");
m_console.Close(); m_console.Close();
Environment.Exit(0); Environment.Exit(0);
break; break;

View File

@ -36,8 +36,6 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration; using OpenSim.Framework.Configuration;
using OpenSim.Framework.Communications;
using OpenSim.Region.Communications.OGS1;
namespace OpenSim.Grid.UserServer namespace OpenSim.Grid.UserServer
{ {
@ -50,8 +48,6 @@ namespace OpenSim.Grid.UserServer
public UserManager m_userManager; public UserManager m_userManager;
public UserLoginService m_loginService; public UserLoginService m_loginService;
public IInventoryServices m_inventoryService;
LogBase m_console; LogBase m_console;
[STAThread] [STAThread]
@ -94,11 +90,7 @@ namespace OpenSim.Grid.UserServer
m_userManager._config = Cfg; m_userManager._config = Cfg;
m_userManager.AddPlugin(Cfg.DatabaseProvider); m_userManager.AddPlugin(Cfg.DatabaseProvider);
// prepare connection to the inventory server m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg);
m_inventoryService = new OGS1InventoryService(Cfg.InventoryServerName, Cfg.InventoryServerPort, null);
m_loginService = new UserLoginService(m_userManager, m_inventoryService, Cfg, Cfg.DefaultStartupMsg);
MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process");
BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort); BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort);
@ -111,7 +103,6 @@ namespace OpenSim.Grid.UserServer
httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod ));
httpServer.Start(); httpServer.Start();
m_console.Status("SERVER", "Userserver 0.3 - Startup complete"); m_console.Status("SERVER", "Userserver 0.3 - Startup complete");
} }

View File

@ -6,7 +6,6 @@ using OpenSim.Framework.Data;
using OpenSim.Framework.UserManagement; using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration; using OpenSim.Framework.Configuration;
using OpenSim.Framework.Communications;
namespace OpenSim.Grid.UserServer namespace OpenSim.Grid.UserServer
{ {
@ -14,8 +13,8 @@ namespace OpenSim.Grid.UserServer
{ {
public UserConfig m_config; public UserConfig m_config;
public UserLoginService(UserManagerBase userManager, IInventoryServices inventoryServer, UserConfig config, string welcomeMess) public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess)
: base(userManager, inventoryServer, welcomeMess) : base(userManager, welcomeMess)
{ {
m_config = config; m_config = config;
} }
@ -72,29 +71,25 @@ namespace OpenSim.Grid.UserServer
theUser.currentAgent.currentHandle = SimInfo.regionHandle; theUser.currentAgent.currentHandle = SimInfo.regionHandle;
System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
// Send // Send
try try
{ {
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
} }
catch( WebException e ) catch( WebException e )
{ {
switch( e.Status ) switch( e.Status )
{ {
case WebExceptionStatus.Timeout: case WebExceptionStatus.Timeout:
//TODO: Send him to nearby or default region instead //TODO: Send him to nearby or default region instead
break; break;
default: default:
throw; throw;
} }
} }
} }
} }
} }

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
@ -352,7 +353,7 @@ namespace OpenSim.Region.ClientStack
// Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated()); // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
if (OnAssetUploadRequest != null) if (OnAssetUploadRequest != null)
{ {
OnAssetUploadRequest(this, LLUUID.Combine(request.AssetBlock.TransactionID, this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
} }
break; break;
case PacketType.RequestXfer: case PacketType.RequestXfer:
@ -417,7 +418,7 @@ namespace OpenSim.Region.ClientStack
{ {
if (update.InventoryData[i].TransactionID != LLUUID.Zero) if (update.InventoryData[i].TransactionID != LLUUID.Zero)
{ {
OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, LLUUID.Combine(update.InventoryData[i].TransactionID, this.SecureSessionID), update.InventoryData[i].ItemID); OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, update.InventoryData[i].TransactionID.Combine(this.SecureSessionID), update.InventoryData[i].ItemID);
} }
} }
} }

View File

@ -37,6 +37,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;

View File

@ -107,7 +107,7 @@ namespace OpenSim.Region.Communications.Local
} }
else else
{ {
this.m_inventoryService.CreateNewUserInventory(LLUUID.Zero, userProf.UUID); this.m_inventoryService.CreateNewUserInventory(userProf.UUID);
Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); Console.WriteLine("Created new inventory set for " + firstName + " " + lastName);
return userProf.UUID; return userProf.UUID;
} }

View File

@ -3,7 +3,6 @@ using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Region.Communications.Local namespace OpenSim.Region.Communications.Local
{ {
@ -50,7 +49,7 @@ namespace OpenSim.Region.Communications.Local
} }
} }
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{ {
this.AddFolder(folder); this.AddFolder(folder);
} }

View File

@ -7,6 +7,7 @@ using OpenSim.Framework.Data;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement; using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Inventory;
namespace OpenSim.Region.Communications.Local namespace OpenSim.Region.Communications.Local
{ {
@ -24,7 +25,7 @@ namespace OpenSim.Region.Communications.Local
public event LoginToRegionEvent OnLoginToRegion; public event LoginToRegionEvent OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
: base(userManager, parent.InventoryService, welcomeMess) : base(userManager, welcomeMess)
{ {
m_Parent = parent; m_Parent = parent;
this.serversInfo = serversInfo; this.serversInfo = serversInfo;
@ -52,7 +53,7 @@ namespace OpenSim.Region.Communications.Local
profile = this.m_userManager.GetUserProfile(firstname, lastname); profile = this.m_userManager.GetUserProfile(firstname, lastname);
if (profile != null) if (profile != null)
{ {
m_Parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID); m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
} }
return profile; return profile;
@ -122,5 +123,51 @@ namespace OpenSim.Region.Communications.Local
} }
} }
protected override InventoryData CreateInventoryData(LLUUID userID)
{
List<InventoryFolderBase> folders = m_Parent.InventoryService.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

@ -1,5 +1,4 @@
using System; using System;
using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
@ -49,10 +48,10 @@ namespace OpenSim.Region.Communications.Local
} }
else else
{ {
m_parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID); m_parent.InventoryService.CreateNewUserInventory(profile.UUID);
} }
return profile; return profile;
} }
} }
} }

View File

@ -14,8 +14,8 @@ namespace OpenSim.Region.Communications.OGS1
m_gridService = gridInterComms; m_gridService = gridInterComms;
m_interRegion = gridInterComms; m_interRegion = gridInterComms;
m_inventoryService = new OGS1InventoryService();
m_userService = new OGS1UserServices(this); m_userService = new OGS1UserServices(this);
m_inventoryService = new OGS1InventoryService(serversInfo, m_userService);
} }
} }
} }

View File

@ -5,7 +5,6 @@ using System.Net;
using System.Runtime.Remoting; using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp; using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Serialization.Formatters;
using libsecondlife; using libsecondlife;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework; using OpenSim.Framework;
@ -303,23 +302,8 @@ namespace OpenSim.Region.Communications.OGS1
/// </summary> /// </summary>
private void StartRemoting() private void StartRemoting()
{ {
// we only need to register the tcp channel once, and we don't know which other modules use remoting TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort);
if (ChannelServices.GetChannel("tcp") == null) ChannelServices.RegisterChannel(ch, true);
{
// Creating a custom formatter for a TcpChannel sink chain.
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = this.serversInfo.RemotingListenerPort;
props["typeFilterLevel"] = TypeFilterLevel.Full;
TcpChannel ch = new TcpChannel(props, clientProvider, serverProvider);
ChannelServices.RegisterChannel(ch, true);
}
WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton);
RemotingConfiguration.RegisterWellKnownServiceType(wellType); RemotingConfiguration.RegisterWellKnownServiceType(wellType);

View File

@ -1,15 +1,8 @@
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Serialization.Formatters;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using OpenSim.Framework.Types; using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
@ -17,83 +10,43 @@ namespace OpenSim.Region.Communications.OGS1
public class OGS1InventoryService : IInventoryServices public class OGS1InventoryService : IInventoryServices
{ {
IUserServices _userServices; public OGS1InventoryService()
IInventoryServices _inventoryServices;
public OGS1InventoryService(NetworkServersInfo networkConfig, IUserServices userServices) :
this(networkConfig.InventoryServerName, networkConfig.InventoryServerPort, userServices)
{
}
public OGS1InventoryService(string serverName, int serverPort, IUserServices userServices)
{ {
_userServices = userServices;
// we only need to register the tcp channel once, and we don't know which other modules use remoting
if (ChannelServices.GetChannel("tcp") == null)
{
// Creating a custom formatter for a TcpChannel sink chain.
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["typeFilterLevel"] = TypeFilterLevel.Full;
// Pass the properties for the port setting and the server provider in the server chain argument. (Client remains null here.)
TcpChannel chan = new TcpChannel(props, clientProvider, serverProvider);
ChannelServices.RegisterChannel(chan, true);
}
string remotingUrl = string.Format("tcp://{0}:{1}/Inventory", serverName, serverPort);
_inventoryServices = (IInventoryServices)Activator.GetObject(typeof(IInventoryServices), remotingUrl);
} }
#region IInventoryServices Members #region IInventoryServices Members
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{ {
_inventoryServices.RequestInventoryForUser(userID, folderCallBack, itemCallBack);
} }
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{ {
_inventoryServices.AddNewInventoryFolder(userID, folder);
} }
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
_inventoryServices.AddNewInventoryItem(userID, item);
} }
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
_inventoryServices.DeleteInventoryItem(userID, item);
} }
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID) public void CreateNewUserInventory(LLUUID user)
{ {
return _inventoryServices.RequestFirstLevelFolders(folderID);
} }
public List<InventoryItemBase> RequestFolderItems(LLUUID folderID) public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
{ {
return _inventoryServices.RequestFolderItems(folderID); return new List<InventoryFolderBase>();
} }
public void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder)
{
_inventoryServices.GetRootFoldersForUser(user, out libraryFolder, out personalFolder);
}
public void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user)
{
throw new Exception("method not implemented");
}
#endregion #endregion
} }
} }

View File

@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules
avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
if (avatar != null) if (avatar != null)
{ {
dis = (int)LLVector3.Mag(avatar.AbsolutePosition-fromPos); dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
} }
switch (type) switch (type)
@ -211,4 +211,4 @@ namespace OpenSim.Region.Environment.Modules
} }
} }
} }
} }

View File

@ -561,7 +561,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// check for physics-related movement /// check for physics-related movement
else if (LLVector3.Dist(lastPhysPos,AbsolutePosition) > 0.02) else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
{ {
SendTerseUpdateToAllClients(); SendTerseUpdateToAllClients();
m_updateCount = 0; m_updateCount = 0;
@ -748,7 +748,7 @@ namespace OpenSim.Region.Environment.Scenes
protected void CheckForSignificantMovement() protected void CheckForSignificantMovement()
{ {
if (LLVector3.Dist(AbsolutePosition, posLastSignificantMove) > 2.0) if (Helpers.VecDist(AbsolutePosition, posLastSignificantMove) > 2.0)
{ {
posLastSignificantMove = AbsolutePosition; posLastSignificantMove = AbsolutePosition;
if (OnSignificantClientMovement != null) if (OnSignificantClientMovement != null)
@ -919,4 +919,4 @@ namespace OpenSim.Region.Environment.Scenes
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
} }
} }
} }

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<inventory>
<folder>
<name>My Inventory</name>
<folderID UUID="00000112-000f-0000-0000-000100bba000" />
<type>9</type>
<folders>
<folder>
<name>Animations</name>
<type>20</type>
</folder>
<folder>
<name>Body Parts</name>
<type>13</type>
</folder>
<folder>
<name>Clothing</name>
<type>5</type>
</folder>
<folder>
<name>Gestures</name>
<type>21</type>
</folder>
<folder>
<name>Landmarks</name>
<type>3</type>
</folder>
<folder>
<name>Lost And Found</name>
<type>16</type>
</folder>
<folder>
<name>Notecards</name>
<type>7</type>
</folder>
<folder>
<name>Objects</name>
<type>6</type>
</folder>
<folder>
<name>Photo Album</name>
<type>15</type>
</folder>
<folder>
<name>Scripts</name>
<type>10</type>
</folder>
<folder>
<name>Sounds</name>
<type>1</type>
</folder>
<folder>
<name>Textures</name>
<type>0</type>
</folder>
<folder>
<name>Trash</name>
<type>14</type>
</folder>
</folders>
</folder>
</inventory>

View File

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<inventory>
<folder>
<name>Library</name>
<folderid UUID="00000112-000f-0000-0000-000100bba000" />
<type>9</type>
<folders>
<folder>
<name>Animations</name>
<type>20</type>
</folder>
<folder>
<name>Body Parts</name>
<type>13</type>
</folder>
<folder>
<name>Clothing</name>
<type>5</type>
</folder>
<folder>
<name>Gestures</name>
<type>21</type>
</folder>
<folder>
<name>Landmarks</name>
<type>3</type>
</folder>
<folder>
<name>Lost And Found</name>
<type>3</type>
</folder>
<folder>
<name>Notecards</name>
<type>7</type>
</folder>
<folder>
<name>Objects</name>
<type>6</type>
</folder>
<folder>
<name>Photo Album</name>
<type>15</type>
</folder>
<folder>
<name>Scripts</name>
<type>10</type>
</folder>
<folder>
<name>Sounds</name>
<type>1</type>
</folder>
<folder>
<name>Textures</name>
<type>0</type>
</folder>
<folder>
<name>Accessories</name>
<type>8</type>
</folder>
</folders>
</folder>
</inventory>

Binary file not shown.

View File

@ -823,38 +823,6 @@
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Region.Communications.OGS1"/>
<Reference name="OpenSim.Framework.Data"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Db4objects.Db4o.dll"/>
<Reference name="XMLRPC.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenSim.Grid.InventoryServer" path="OpenSim/Grid/InventoryServer" type="Exe">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/>
<Reference name="System.Data" localCopy="false"/>
<Reference name="System.Xml" localCopy="false"/>
<Reference name="System.Runtime.Remoting" localCopy="false"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Data"/> <Reference name="OpenSim.Framework.Data"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="libsecondlife.dll"/> <Reference name="libsecondlife.dll"/>
@ -1013,7 +981,3 @@
</Prebuild> </Prebuild>

View File

@ -3,8 +3,6 @@ CREATE TABLE `inventoryfolders` (
`agentID` varchar(36) default NULL, `agentID` varchar(36) default NULL,
`parentFolderID` varchar(36) default NULL, `parentFolderID` varchar(36) default NULL,
`folderName` varchar(64) default NULL, `folderName` varchar(64) default NULL,
`category` TINYINT NOT NULL,
`folderType` TINYINT NOT NULL,
PRIMARY KEY (`folderID`), PRIMARY KEY (`folderID`),
KEY `owner` (`agentID`), KEY `owner` (`agentID`),
KEY `parent` (`parentFolderID`) KEY `parent` (`parentFolderID`)