* Tleiades grid mode inventory (#444) - thanx Tleiades!
* updated to rev 1413 on libsecondlife.dll and libsecondlife.dll.config (#423)afrisby
parent
569ba9eb9a
commit
8143c597fc
|
@ -8,7 +8,6 @@ using Nwc.XmlRpc;
|
|||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Data;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ using OpenSim.Framework.Utilities;
|
|||
|
||||
namespace OpenSim.Framework.Communications.Caches
|
||||
{
|
||||
public class CachedUserInfo
|
||||
public class CachedUserInfo : MarshalByRefObject
|
||||
{
|
||||
private CommunicationsManager m_parentCommsManager;
|
||||
// Fields
|
||||
|
@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
}
|
||||
|
||||
// Methods
|
||||
public void FolderReceive(LLUUID userID, InventoryFolder folderInfo)
|
||||
public void FolderReceive(LLUUID userID, InventoryFolderBase folderInfo)
|
||||
{
|
||||
if (userID == this.UserProfile.UUID)
|
||||
{
|
||||
|
@ -59,19 +59,19 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
{
|
||||
if (folderInfo.parentID == LLUUID.Zero)
|
||||
{
|
||||
this.RootFolder = folderInfo;
|
||||
this.RootFolder = new InventoryFolder(folderInfo);
|
||||
}
|
||||
}
|
||||
else if (this.RootFolder.folderID == folderInfo.parentID)
|
||||
{
|
||||
this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
|
||||
this.RootFolder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID);
|
||||
if (folder != null)
|
||||
{
|
||||
folder.SubFolders.Add(folderInfo.folderID, folderInfo);
|
||||
folder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,3 +131,7 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ using OpenSim.Framework.Interfaces;
|
|||
using OpenSim.Framework.Data;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
|
||||
|
||||
namespace OpenSim.Framework.Communications.Caches
|
||||
{
|
||||
|
@ -60,7 +63,7 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
}
|
||||
|
||||
// Methods
|
||||
public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
|
||||
public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type, InventoryCategory category)
|
||||
{
|
||||
InventoryFolder subFold = new InventoryFolder();
|
||||
subFold.name = folderName;
|
||||
|
@ -68,7 +71,12 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
subFold.type = (short) type;
|
||||
subFold.parentID = this.folderID;
|
||||
subFold.agentID = this.agentID;
|
||||
this.SubFolders.Add(subFold.folderID, subFold);
|
||||
subFold.category = category;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,11 @@ using OpenSim.Framework.Interfaces;
|
|||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Data;
|
||||
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
|
||||
|
||||
namespace OpenSim.Framework.Communications.Caches
|
||||
{
|
||||
public class UserProfileCache
|
||||
public class UserProfileCache : MarshalByRefObject
|
||||
{
|
||||
// Fields
|
||||
private CommunicationsManager m_parent;
|
||||
|
@ -103,7 +104,7 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
|
||||
if (info.RootFolder.folderID == parentID)
|
||||
{
|
||||
InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
|
||||
InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User);
|
||||
if (createdFolder != null)
|
||||
{
|
||||
this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
|
||||
|
@ -114,7 +115,7 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
InventoryFolder folder = info.RootFolder.HasSubFolder(parentID);
|
||||
if (folder != null)
|
||||
{
|
||||
folder.CreateNewSubFolder(folderID, folderName, folderType);
|
||||
folder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,16 +125,21 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
|
||||
{
|
||||
InventoryFolder fold = null;
|
||||
|
||||
if (folderID == libraryRoot.folderID )
|
||||
{
|
||||
// we are looking for the root of the shared inventory
|
||||
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems());
|
||||
}
|
||||
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());
|
||||
}
|
||||
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)
|
||||
{
|
||||
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
|
||||
|
@ -153,9 +159,23 @@ 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)
|
||||
{
|
||||
if (ownerID == libraryRoot.agentID)
|
||||
|
@ -181,7 +201,7 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
/// <param name="userID"></param>
|
||||
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>
|
||||
|
@ -221,3 +241,7 @@ namespace OpenSim.Framework.Communications.Caches
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,29 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Framework.Data;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Data;
|
||||
using OpenSim.Framework.Communications.Caches;
|
||||
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
{
|
||||
public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo);
|
||||
public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderBase folderInfo);
|
||||
public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
|
||||
|
||||
public interface IInventoryServices
|
||||
{
|
||||
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
|
||||
void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
|
||||
void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||
void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||
void CreateNewUserInventory(LLUUID user);
|
||||
void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user);
|
||||
void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns></returns>
|
||||
List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID);
|
||||
List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID);
|
||||
List<InventoryItemBase> RequestFolderItems(LLUUID folderID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using libsecondlife;
|
||||
|
@ -6,21 +11,20 @@ using OpenSim.Framework.Communications;
|
|||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Data;
|
||||
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
|
||||
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
{
|
||||
public abstract class InventoryServiceBase : IInventoryServices
|
||||
public abstract class InventoryServiceBase : MarshalByRefObject, IInventoryServices
|
||||
{
|
||||
protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>();
|
||||
//protected IAssetServer m_assetServer;
|
||||
protected IInventoryData _databasePlugin;
|
||||
|
||||
public InventoryServiceBase()
|
||||
{
|
||||
//m_assetServer = assetServer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new user server plugin - plugins will be requested in the order they were loaded.
|
||||
/// Adds a new inventory data server plugin
|
||||
/// </summary>
|
||||
/// <param name="FileName">The filename to the user server plugin DLL</param>
|
||||
public void AddPlugin(string FileName)
|
||||
|
@ -41,8 +45,13 @@ namespace OpenSim.Framework.Communications
|
|||
IInventoryData plug =
|
||||
(IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
plug.Initialise();
|
||||
this.m_plugins.Add(plug.getName(), plug);
|
||||
this._databasePlugin = 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");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,20 +63,20 @@ namespace OpenSim.Framework.Communications
|
|||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns></returns>
|
||||
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
|
||||
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID)
|
||||
{
|
||||
List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
|
||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||
InventoryFolderBase root = _databasePlugin.getInventoryFolder(folderID);
|
||||
|
||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||
if (root != null)
|
||||
{
|
||||
InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID);
|
||||
if (rootFolder != null)
|
||||
{
|
||||
inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID);
|
||||
inventoryList.Insert(0, rootFolder);
|
||||
return inventoryList;
|
||||
}
|
||||
folders.Add(root);
|
||||
|
||||
List<InventoryFolderBase> subFolders = _databasePlugin.getInventoryFolders(root.folderID);
|
||||
foreach (InventoryFolderBase f in subFolders)
|
||||
folders.Add(f);
|
||||
}
|
||||
return inventoryList;
|
||||
return folders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -75,11 +84,7 @@ namespace OpenSim.Framework.Communications
|
|||
/// </summary>
|
||||
public InventoryFolderBase RequestUsersRoot(LLUUID userID)
|
||||
{
|
||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||
{
|
||||
return plugin.Value.getUserRootFolder(userID);
|
||||
}
|
||||
return null;
|
||||
return _databasePlugin.getInventoryFolder(userID); // the id of the root folder, is the user id
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -89,47 +94,27 @@ namespace OpenSim.Framework.Communications
|
|||
/// <returns></returns>
|
||||
public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID)
|
||||
{
|
||||
List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
|
||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||
{
|
||||
return plugin.Value.getInventoryFolders(parentFolderID);
|
||||
}
|
||||
return inventoryList;
|
||||
return _databasePlugin.getInventoryFolders(parentFolderID);
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> RequestFolderItems(LLUUID folderID)
|
||||
{
|
||||
List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
|
||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||
{
|
||||
itemsList = plugin.Value.getInventoryInFolder(folderID);
|
||||
return itemsList;
|
||||
}
|
||||
return itemsList;
|
||||
return _databasePlugin.getInventoryInFolder(folderID);
|
||||
}
|
||||
|
||||
public void AddFolder(InventoryFolderBase folder)
|
||||
{
|
||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||
{
|
||||
plugin.Value.addInventoryFolder(folder);
|
||||
}
|
||||
_databasePlugin.addInventoryFolder(folder);
|
||||
}
|
||||
|
||||
public void AddItem(InventoryItemBase item)
|
||||
{
|
||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||
{
|
||||
plugin.Value.addInventoryItem(item);
|
||||
}
|
||||
_databasePlugin.addInventoryItem(item);
|
||||
}
|
||||
|
||||
public void deleteItem(InventoryItemBase item)
|
||||
{
|
||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||
{
|
||||
plugin.Value.deleteInventoryItem(item);
|
||||
}
|
||||
_databasePlugin.deleteInventoryItem(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -144,11 +129,53 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
}
|
||||
|
||||
public void CreateNewUserInventory(LLUUID user)
|
||||
public void CreateNewUserInventory(LLUUID defaultFolders, LLUUID user)
|
||||
{
|
||||
UsersInventory inven = new UsersInventory();
|
||||
inven.CreateNewInventorySet(user);
|
||||
this.AddNewInventorySet(inven);
|
||||
try
|
||||
{
|
||||
// Get Default folder set from the database
|
||||
//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
|
||||
|
@ -166,10 +193,11 @@ namespace OpenSim.Framework.Communications
|
|||
InventoryFolderBase folder = new InventoryFolderBase();
|
||||
folder.parentID = LLUUID.Zero;
|
||||
folder.agentID = user;
|
||||
folder.folderID = LLUUID.Random();
|
||||
folder.folderID = user; // id of root folder is the same as the agent id
|
||||
folder.name = "My Inventory";
|
||||
folder.type = 8;
|
||||
folder.version = 1;
|
||||
folder.category = InventoryCategory.User;
|
||||
Folders.Add(folder.folderID, folder);
|
||||
|
||||
LLUUID rootFolder = folder.folderID;
|
||||
|
@ -181,6 +209,7 @@ namespace OpenSim.Framework.Communications
|
|||
folder.name = "Textures";
|
||||
folder.type = 0;
|
||||
folder.version = 1;
|
||||
folder.category = InventoryCategory.User;
|
||||
Folders.Add(folder.folderID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
|
@ -190,6 +219,7 @@ namespace OpenSim.Framework.Communications
|
|||
folder.name = "Objects";
|
||||
folder.type = 6;
|
||||
folder.version = 1;
|
||||
folder.category = InventoryCategory.User;
|
||||
Folders.Add(folder.folderID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
|
@ -199,12 +229,129 @@ namespace OpenSim.Framework.Communications
|
|||
folder.name = "Clothes";
|
||||
folder.type = 5;
|
||||
folder.version = 1;
|
||||
folder.category = InventoryCategory.User;
|
||||
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 AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
|
||||
public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||
}
|
||||
|
|
|
@ -26,9 +26,10 @@ namespace OpenSim.Framework.UserManagement
|
|||
private ArrayList classifiedCategories;
|
||||
private ArrayList inventoryRoot;
|
||||
private ArrayList initialOutfit;
|
||||
private ArrayList agentInventory;
|
||||
private ArrayList inventorySkeleton;
|
||||
private ArrayList inventoryLibraryOwner;
|
||||
private ArrayList inventoryLibrary;
|
||||
private ArrayList inventoryLibraryRoot;
|
||||
private ArrayList inventoryLibrarySkeleton;
|
||||
|
||||
private UserInfo userProfile;
|
||||
|
||||
|
@ -86,11 +87,13 @@ namespace OpenSim.Framework.UserManagement
|
|||
|
||||
this.defaultXmlRpcResponse = new XmlRpcResponse();
|
||||
this.userProfile = new UserInfo();
|
||||
this.inventoryRoot = new ArrayList();
|
||||
|
||||
this.initialOutfit = new ArrayList();
|
||||
this.agentInventory = new ArrayList();
|
||||
this.inventoryLibrary = new ArrayList();
|
||||
this.inventoryRoot = new ArrayList();
|
||||
this.inventorySkeleton = new ArrayList();
|
||||
this.inventoryLibrarySkeleton = new ArrayList();
|
||||
this.inventoryLibraryOwner = new ArrayList();
|
||||
this.inventoryLibraryRoot = new ArrayList();
|
||||
|
||||
this.xmlRpcResponse = new XmlRpcResponse();
|
||||
this.defaultXmlRpcResponse = new XmlRpcResponse();
|
||||
|
@ -237,12 +240,15 @@ namespace OpenSim.Framework.UserManagement
|
|||
responseData["classified_categories"] = this.classifiedCategories;
|
||||
responseData["ui-config"] = this.uiConfig;
|
||||
|
||||
responseData["inventory-skeleton"] = this.agentInventory;
|
||||
responseData["inventory-skel-lib"] = this.inventoryLibrary;
|
||||
responseData["inventory-skeleton"] = this.inventorySkeleton;
|
||||
responseData["inventory-skel-lib"] = this.inventoryLibrarySkeleton;
|
||||
responseData["inventory-root"] = this.inventoryRoot;
|
||||
responseData["gestures"] = new ArrayList(); // todo
|
||||
responseData["inventory-lib-owner"] = this.inventoryLibraryOwner;
|
||||
responseData["inventory-lib-root"] = this.inventoryLibraryRoot;
|
||||
|
||||
responseData["gestures"] = new ArrayList(); // todo
|
||||
responseData["initial-outfit"] = this.initialOutfit;
|
||||
|
||||
responseData["start_location"] = this.startLocation;
|
||||
responseData["seed_capability"] = this.seedCapability;
|
||||
responseData["home"] = this.home;
|
||||
|
@ -596,23 +602,23 @@ namespace OpenSim.Framework.UserManagement
|
|||
{
|
||||
get
|
||||
{
|
||||
return this.agentInventory;
|
||||
return this.inventorySkeleton;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.agentInventory = value;
|
||||
this.inventorySkeleton = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList InventoryLibrary
|
||||
public ArrayList InventoryLibrarySkeleton
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inventoryLibrary;
|
||||
return this.inventoryLibrarySkeleton;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.inventoryLibrary = value;
|
||||
this.inventoryLibrarySkeleton = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -628,6 +634,18 @@ namespace OpenSim.Framework.UserManagement
|
|||
}
|
||||
}
|
||||
|
||||
public ArrayList InventoryLibraryRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inventoryLibraryRoot;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.inventoryLibraryRoot = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Home
|
||||
{
|
||||
get
|
||||
|
@ -665,3 +683,7 @@ namespace OpenSim.Framework.UserManagement
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,11 +8,10 @@ using Nwc.XmlRpc;
|
|||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Data;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.Utilities;
|
||||
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Configuration;
|
||||
using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder;
|
||||
|
||||
|
||||
namespace OpenSim.Framework.UserManagement
|
||||
{
|
||||
|
@ -20,10 +19,12 @@ namespace OpenSim.Framework.UserManagement
|
|||
{
|
||||
protected string m_welcomeMessage = "Welcome to OpenSim";
|
||||
protected UserManagerBase m_userManager = null;
|
||||
protected IInventoryServices m_inventoryServer = null;
|
||||
|
||||
public LoginService(UserManagerBase userManager, string welcomeMess)
|
||||
public LoginService(UserManagerBase userManager, IInventoryServices inventoryServer, string welcomeMess)
|
||||
{
|
||||
m_userManager = userManager;
|
||||
m_inventoryServer = inventoryServer;
|
||||
if (welcomeMess != "")
|
||||
{
|
||||
m_welcomeMessage = welcomeMess;
|
||||
|
@ -37,7 +38,6 @@ namespace OpenSim.Framework.UserManagement
|
|||
/// <returns>The response to send</returns>
|
||||
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
|
||||
{
|
||||
|
||||
System.Console.WriteLine("Attempting login now...");
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
@ -85,15 +85,41 @@ namespace OpenSim.Framework.UserManagement
|
|||
{
|
||||
LLUUID agentID = userProfile.UUID;
|
||||
|
||||
// Inventory Library Section
|
||||
InventoryData inventData = this.CreateInventoryData(agentID);
|
||||
ArrayList AgentInventoryArray = inventData.InventoryArray;
|
||||
LLUUID libraryFolderID;
|
||||
LLUUID personalFolderID;
|
||||
|
||||
Hashtable InventoryRootHash = new Hashtable();
|
||||
InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated();
|
||||
ArrayList InventoryRoot = new ArrayList();
|
||||
InventoryRoot.Add(InventoryRootHash);
|
||||
userProfile.rootInventoryFolderID = inventData.RootFolderID;
|
||||
m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID);
|
||||
if (personalFolderID == LLUUID.Zero)
|
||||
{
|
||||
m_inventoryServer.CreateNewUserInventory(libraryFolderID, agentID);
|
||||
m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID);
|
||||
}
|
||||
|
||||
// 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
|
||||
uint circode = (uint)(Util.RandomClass.Next());
|
||||
|
@ -103,10 +129,6 @@ namespace OpenSim.Framework.UserManagement
|
|||
logResponse.AgentID = agentID.ToStringHyphenated();
|
||||
logResponse.SessionID = userProfile.currentAgent.sessionID.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.RegionX = 0; //overwritten
|
||||
//logResponse.RegionY = 0; //overwritten
|
||||
|
@ -212,76 +234,30 @@ namespace OpenSim.Framework.UserManagement
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Create a structure of the generic inventory structure of a specified folder
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected virtual ArrayList GetInventoryLibrary()
|
||||
protected virtual ArrayList GetInventorySkeleton(LLUUID folderID)
|
||||
{
|
||||
//return new ArrayList();
|
||||
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";
|
||||
|
||||
List<InventoryFolderBase> folders = m_inventoryServer.RequestFirstLevelFolders(folderID);
|
||||
|
||||
ArrayList temp = new ArrayList();
|
||||
temp.Add(TempHash);
|
||||
foreach (InventoryFolderBase ifb in folders)
|
||||
{
|
||||
LLUUID tempFolderID = ifb.folderID;
|
||||
LLUUID tempParentID = ifb.parentID;
|
||||
|
||||
Hashtable TempHash = new Hashtable();
|
||||
TempHash["folder_id"] = tempFolderID.ToStringHyphenated();
|
||||
TempHash["name"] = ifb.name;
|
||||
TempHash["parent_id"] = tempParentID.ToStringHyphenated();
|
||||
TempHash["type_default"] = ifb.type;
|
||||
TempHash["version"] = ifb.version+1;
|
||||
temp.Add(TempHash);
|
||||
}
|
||||
|
||||
TempHash = new Hashtable();
|
||||
TempHash["name"] = "Texture Library";
|
||||
TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000";
|
||||
TempHash["version"] = 1;
|
||||
TempHash["type_default"] = -1;
|
||||
TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001";
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
param["?uuid"] = user.ToStringHyphenated();
|
||||
param["?zero"] = LLUUID.Zero.ToStringHyphenated();
|
||||
|
||||
IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
|
||||
IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND (agentID = ?uuid OR category = 0)", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
List<InventoryFolderBase> items = database.readInventoryFolders(reader);
|
||||
|
@ -151,40 +151,6 @@ 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>
|
||||
/// Returns a list of folders in a users inventory contained within the specified folder
|
||||
/// </summary>
|
||||
|
@ -348,5 +314,27 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// <summary>
|
||||
/// The database connection object
|
||||
/// </summary>
|
||||
IDbConnection dbcon;
|
||||
MySqlConnection dbcon;
|
||||
/// <summary>
|
||||
/// Connection string for ADO.net
|
||||
/// </summary>
|
||||
|
@ -115,10 +115,11 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
{
|
||||
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
|
||||
dbcommand.CommandText = sql;
|
||||
foreach (KeyValuePair<string, string> param in parameters)
|
||||
{
|
||||
dbcommand.Parameters.Add(param.Key, param.Value);
|
||||
}
|
||||
if(parameters != null)
|
||||
foreach (KeyValuePair<string, string> param in parameters)
|
||||
{
|
||||
dbcommand.Parameters.Add(param.Key, param.Value);
|
||||
}
|
||||
|
||||
return (IDbCommand)dbcommand;
|
||||
}
|
||||
|
@ -149,10 +150,11 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
{
|
||||
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
|
||||
dbcommand.CommandText = sql;
|
||||
foreach (KeyValuePair<string, string> param in parameters)
|
||||
{
|
||||
dbcommand.Parameters.Add(param.Key, param.Value);
|
||||
}
|
||||
if(parameters != null)
|
||||
foreach (KeyValuePair<string, string> param in parameters)
|
||||
{
|
||||
dbcommand.Parameters.Add(param.Key, param.Value);
|
||||
}
|
||||
|
||||
return (IDbCommand)dbcommand;
|
||||
}
|
||||
|
@ -370,6 +372,8 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
folder.parentID = new LLUUID((string)reader["parentFolderID"]);
|
||||
folder.folderID = new LLUUID((string)reader["folderID"]);
|
||||
folder.name = (string)reader["folderName"];
|
||||
folder.category = (InventoryCategory)((Int16)reader["category"]);
|
||||
folder.type = (Int16)reader["folderType"];
|
||||
|
||||
rows.Add(folder);
|
||||
}
|
||||
|
@ -509,24 +513,32 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// <returns>Success?</returns>
|
||||
public bool insertFolder(InventoryFolderBase folder)
|
||||
{
|
||||
string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
|
||||
sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)";
|
||||
string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, category, folderType) VALUES ";
|
||||
sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?category, ?folderType)";
|
||||
|
||||
MySqlCommand dbcmd = dbcon.CreateCommand();
|
||||
dbcmd.CommandText = sql;
|
||||
|
||||
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;
|
||||
|
||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||
parameters["?folderID"] = folder.folderID.ToStringHyphenated();
|
||||
parameters["?agentID"] = folder.agentID.ToStringHyphenated();
|
||||
parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated();
|
||||
parameters["?folderName"] = folder.name;
|
||||
|
||||
bool returnval = false;
|
||||
try
|
||||
{
|
||||
IDbCommand result = Query(sql, parameters);
|
||||
|
||||
if (result.ExecuteNonQuery() == 1)
|
||||
if (dbcmd.ExecuteNonQuery() == 1)
|
||||
returnval = true;
|
||||
|
||||
result.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Items Definitions");
|
||||
|
||||
ds.AcceptChanges();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -194,44 +195,17 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// <param name="user">The user whos inventory is to be searched</param>
|
||||
/// <returns>A list of folder objects</returns>
|
||||
public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the users inventory root folder.
|
||||
/// </summary>
|
||||
/// <param name="user">The UUID of the user who is having inventory being returned</param>
|
||||
/// <returns>Root inventory folder</returns>
|
||||
public InventoryFolderBase getUserRootFolder(LLUUID user)
|
||||
{
|
||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||
string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'";
|
||||
|
||||
string selectExp = "parentID = '" + LLUUID.Zero.ToString() + "' AND (agentID = '" + user.ToString() + "' OR category = 0)";
|
||||
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
||||
foreach (DataRow row in rows)
|
||||
{
|
||||
folders.Add(this.buildFolder(row));
|
||||
}
|
||||
|
||||
if (folders.Count == 1)
|
||||
{
|
||||
//we found the root
|
||||
//System.Console.WriteLine("found root inventory folder");
|
||||
return folders[0];
|
||||
}
|
||||
else if (folders.Count > 1)
|
||||
{
|
||||
//err shouldn't be more than one root
|
||||
//System.Console.WriteLine("found more than one root inventory folder");
|
||||
}
|
||||
else if (folders.Count == 0)
|
||||
{
|
||||
// no root?
|
||||
//System.Console.WriteLine("couldn't find root inventory folder");
|
||||
}
|
||||
|
||||
return null;
|
||||
return folders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -270,7 +244,14 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// <returns>A class containing folder information</returns>
|
||||
public InventoryFolderBase getInventoryFolder(LLUUID folder)
|
||||
{
|
||||
return null;
|
||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||
string selectExp = "UUID = '" + folder.ToString() + "'";
|
||||
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
||||
|
||||
if (rows.Length == 1)
|
||||
return this.buildFolder(rows[0]);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -308,6 +289,11 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
this.invItemsDa.Update(ds, "inventoryitems");
|
||||
}
|
||||
|
||||
//TODO! Implement SQLite deleteInventoryCategory
|
||||
public void deleteInventoryCategory(InventoryCategory inventoryCategory)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new folder specified by folder
|
||||
/// </summary>
|
||||
|
@ -326,6 +312,11 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
this.addFolder(folder);
|
||||
}
|
||||
|
||||
//TODO! implement CreateNewUserInventory
|
||||
public void CreateNewUserInventory(LLUUID user)
|
||||
{
|
||||
throw new Exception("Function not implemented");
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
|
@ -350,6 +341,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
createCol(inv, "parentFolderID", typeof(System.String));
|
||||
createCol(inv, "avatarID", typeof(System.String));
|
||||
createCol(inv, "creatorsID", typeof(System.String));
|
||||
createCol(inv, "category", typeof(System.Byte));
|
||||
|
||||
createCol(inv, "inventoryName", typeof(System.String));
|
||||
createCol(inv, "inventoryDescription", typeof(System.String));
|
||||
|
@ -373,6 +365,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
createCol(fol, "parentID", typeof(System.String));
|
||||
createCol(fol, "type", typeof(System.Int32));
|
||||
createCol(fol, "version", typeof(System.Int32));
|
||||
createCol(fol, "category", typeof(System.Byte));
|
||||
|
||||
fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] };
|
||||
return fol;
|
||||
|
@ -415,6 +408,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
folder.parentID = new LLUUID((string)row["parentID"]);
|
||||
folder.type = Convert.ToInt16(row["type"]);
|
||||
folder.version = Convert.ToUInt16(row["version"]);
|
||||
folder.category = (InventoryCategory)Convert.ToByte(row["category"]);
|
||||
return folder;
|
||||
}
|
||||
|
||||
|
@ -426,6 +420,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
row["parentID"] = folder.parentID;
|
||||
row["type"] = folder.type;
|
||||
row["version"] = folder.version;
|
||||
row["category"] = folder.category;
|
||||
}
|
||||
|
||||
|
||||
|
@ -644,3 +639,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,15 +25,19 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
|
||||
public enum InventoryCategory : byte { Library, Default, User };
|
||||
/// <summary>
|
||||
/// Inventory Item - contains all the properties associated with an individual inventory piece.
|
||||
/// </summary>
|
||||
public class InventoryItemBase
|
||||
public class InventoryItemBase : MarshalByRefObject
|
||||
{
|
||||
/// <summary>
|
||||
/// A UUID containing the ID for the inventory item itself
|
||||
|
@ -66,10 +70,12 @@ namespace OpenSim.Framework.Data
|
|||
/// <summary>
|
||||
/// The name of the inventory item (must be less than 64 characters)
|
||||
/// </summary>
|
||||
[XmlElement(ElementName="name")]
|
||||
public string inventoryName;
|
||||
/// <summary>
|
||||
/// The description of the inventory item (must be less than 64 characters)
|
||||
/// </summary>
|
||||
[XmlElement(ElementName = "description")]
|
||||
public string inventoryDescription;
|
||||
/// <summary>
|
||||
/// A mask containing the permissions for the next owner (cannot be enforced)
|
||||
|
@ -92,7 +98,7 @@ namespace OpenSim.Framework.Data
|
|||
/// <summary>
|
||||
/// A Class for folders which contain users inventory
|
||||
/// </summary>
|
||||
public class InventoryFolderBase
|
||||
public class InventoryFolderBase : MarshalByRefObject
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the folder (64 characters or less)
|
||||
|
@ -118,6 +124,10 @@ namespace OpenSim.Framework.Data
|
|||
///
|
||||
/// </summary>
|
||||
public ushort version;
|
||||
/// <summary>
|
||||
/// Inventory category, Library, Default, System
|
||||
/// </summary>
|
||||
public InventoryCategory category;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -161,13 +171,6 @@ namespace OpenSim.Framework.Data
|
|||
/// <returns>A list of folder objects</returns>
|
||||
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>
|
||||
/// Returns a list of inventory folders contained in the folder 'parentID'
|
||||
/// </summary>
|
||||
|
@ -218,5 +221,17 @@ namespace OpenSim.Framework.Data
|
|||
/// </summary>
|
||||
/// <param name="folder">The inventory folder</param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,9 @@ namespace OpenSim.Framework.Configuration
|
|||
|
||||
public uint HttpPort = 8002;
|
||||
|
||||
public int InventoryServerPort;
|
||||
public string InventoryServerName;
|
||||
|
||||
private ConfigurationMember configMember;
|
||||
|
||||
public UserConfig(string description, string filename)
|
||||
|
@ -37,6 +40,8 @@ namespace OpenSim.Framework.Configuration
|
|||
|
||||
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)
|
||||
|
@ -59,6 +64,12 @@ namespace OpenSim.Framework.Configuration
|
|||
this.DatabaseProvider = (string)configuration_result;
|
||||
break;
|
||||
|
||||
case "inventory_server_port":
|
||||
this.InventoryServerPort = (int)configuration_result;
|
||||
break;
|
||||
case "inventory_server_name":
|
||||
this.InventoryServerName = (string)configuration_result;
|
||||
break;
|
||||
case "http_port":
|
||||
HttpPort = (uint)configuration_result;
|
||||
break;
|
||||
|
|
|
@ -49,6 +49,8 @@ namespace OpenSim.Framework.Types
|
|||
public int HttpListenerPort = 9000;
|
||||
public int RemotingListenerPort = 8895;
|
||||
|
||||
public int InventoryServerPort;
|
||||
public string InventoryServerName = "";
|
||||
|
||||
public NetworkServersInfo()
|
||||
{
|
||||
|
@ -86,7 +88,8 @@ namespace OpenSim.Framework.Types
|
|||
UserSendKey = config.Configs["Network"].GetString("user_send_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");
|
||||
|
||||
InventoryServerPort = config.Configs["Network"].GetInt("inventory_server_port", 8004);
|
||||
InventoryServerName = config.Configs["Network"].GetString("inventory_server_name", "127.0.0.1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,12 +91,12 @@ namespace OpenSim.Framework.Types
|
|||
|
||||
public void Combine(UUID other)
|
||||
{
|
||||
llUUID.Combine(other.GetLLUUID());
|
||||
LLUUID.Combine(llUUID, other.GetLLUUID());
|
||||
}
|
||||
|
||||
public void Combine(LLUUID other)
|
||||
{
|
||||
llUUID.Combine(other);
|
||||
LLUUID.Combine(llUUID, other);
|
||||
}
|
||||
|
||||
public override bool Equals(Object other)
|
||||
|
|
|
@ -26,37 +26,34 @@
|
|||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenGrid.Framework.Data;
|
||||
using libsecondlife;
|
||||
using System.Reflection;
|
||||
|
||||
using System.Xml;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenSim.Framework.Sims;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Data;
|
||||
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
|
||||
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace OpenGridServices.InventoryServer
|
||||
namespace OpenSim.Grid.InventoryServer
|
||||
{
|
||||
class InventoryManager
|
||||
class InventoryManager : IInventoryData
|
||||
{
|
||||
Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>();
|
||||
IInventoryData _databasePlugin;
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
|
||||
/// </summary>
|
||||
/// <param name="FileName">The filename to the inventory server plugin DLL</param>
|
||||
public void AddPlugin(string FileName)
|
||||
public void AddDatabasePlugin(string FileName)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName);
|
||||
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Attempting to load " + FileName);
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||
|
||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
|
||||
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
|
@ -67,8 +64,9 @@ namespace OpenGridServices.InventoryServer
|
|||
{
|
||||
IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
plug.Initialise();
|
||||
this._plugins.Add(plug.getName(), plug);
|
||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface");
|
||||
_databasePlugin = plug;
|
||||
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Added IInventoryData Interface");
|
||||
break;
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
|
@ -80,46 +78,87 @@ namespace OpenGridServices.InventoryServer
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
|
||||
#region IInventoryData Members
|
||||
|
||||
|
||||
public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
// Stuff happens here
|
||||
|
||||
if (requestData.ContainsKey("Access-type"))
|
||||
{
|
||||
if (requestData["access-type"] == "rootfolders")
|
||||
{
|
||||
// responseData["rootfolders"] =
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
responseData["error"] = "No access-type specified.";
|
||||
}
|
||||
|
||||
|
||||
// Stuff stops happening here
|
||||
|
||||
response.Value = responseData;
|
||||
return response;
|
||||
return _databasePlugin.getInventoryInFolder(folderID);
|
||||
}
|
||||
|
||||
public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
|
||||
{
|
||||
return _databasePlugin.getUserRootFolders(user);
|
||||
}
|
||||
|
||||
public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
|
||||
{
|
||||
return _databasePlugin.getInventoryFolders(parentID);
|
||||
}
|
||||
|
||||
public InventoryItemBase getInventoryItem(LLUUID item)
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
|
||||
public InventoryFolderBase getInventoryFolder(LLUUID folder)
|
||||
{
|
||||
return _databasePlugin.getInventoryFolder(folder);
|
||||
}
|
||||
|
||||
public void addInventoryItem(InventoryItemBase item)
|
||||
{
|
||||
_databasePlugin.addInventoryItem(item);
|
||||
}
|
||||
|
||||
public void updateInventoryItem(InventoryItemBase item)
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -31,49 +31,130 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.User;
|
||||
using OpenSim.Framework.Sims;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Servers;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Configuration;
|
||||
using OpenSim.Framework.Data;
|
||||
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
|
||||
|
||||
namespace OpenGridServices.InventoryServer
|
||||
namespace OpenSim.Grid.InventoryServer
|
||||
{
|
||||
public class OpenInventory_Main : BaseServer, conscmd_callback
|
||||
{
|
||||
ConsoleBase m_console;
|
||||
InventoryManager m_inventoryManager;
|
||||
|
||||
public class OpenInventory_Main : conscmd_callback
|
||||
{
|
||||
|
||||
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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
|
||||
MainConsole.Instance = m_console;
|
||||
|
||||
if (!Directory.Exists(Util.logDir()))
|
||||
{
|
||||
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()
|
||||
{
|
||||
MainConsole.Instance.Notice("Initialising inventory manager...");
|
||||
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "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.AddDatabasePlugin(m_config.DatabaseProvider);
|
||||
|
||||
MainConsole.Instance.Notice("Starting HTTP server");
|
||||
BaseHttpServer httpServer = new BaseHttpServer(8004);
|
||||
m_inventoryService = new InventoryService(m_inventoryManager, m_config);
|
||||
|
||||
httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest);
|
||||
//httpServer.AddRestHandler("GET","/rootfolders/",Rest
|
||||
// Dig out the embedded version number of this assembly
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
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)
|
||||
{
|
||||
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":
|
||||
MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Shutting down inventory server");
|
||||
m_console.Close();
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
|
|
|
@ -36,6 +36,8 @@ using OpenSim.Framework.Interfaces;
|
|||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Configuration;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Communications.OGS1;
|
||||
|
||||
namespace OpenSim.Grid.UserServer
|
||||
{
|
||||
|
@ -48,6 +50,8 @@ namespace OpenSim.Grid.UserServer
|
|||
public UserManager m_userManager;
|
||||
public UserLoginService m_loginService;
|
||||
|
||||
public IInventoryServices m_inventoryService;
|
||||
|
||||
LogBase m_console;
|
||||
|
||||
[STAThread]
|
||||
|
@ -90,7 +94,11 @@ namespace OpenSim.Grid.UserServer
|
|||
m_userManager._config = Cfg;
|
||||
m_userManager.AddPlugin(Cfg.DatabaseProvider);
|
||||
|
||||
m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg);
|
||||
// prepare connection to the inventory server
|
||||
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");
|
||||
BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort);
|
||||
|
@ -103,6 +111,7 @@ namespace OpenSim.Grid.UserServer
|
|||
httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod ));
|
||||
|
||||
httpServer.Start();
|
||||
|
||||
m_console.Status("SERVER", "Userserver 0.3 - Startup complete");
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ using OpenSim.Framework.Data;
|
|||
using OpenSim.Framework.UserManagement;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Configuration;
|
||||
using OpenSim.Framework.Communications;
|
||||
|
||||
namespace OpenSim.Grid.UserServer
|
||||
{
|
||||
|
@ -13,8 +14,8 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
public UserConfig m_config;
|
||||
|
||||
public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess)
|
||||
: base(userManager, welcomeMess)
|
||||
public UserLoginService(UserManagerBase userManager, IInventoryServices inventoryServer, UserConfig config, string welcomeMess)
|
||||
: base(userManager, inventoryServer, welcomeMess)
|
||||
{
|
||||
m_config = config;
|
||||
}
|
||||
|
@ -93,3 +94,7 @@ namespace OpenSim.Grid.UserServer
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
|
@ -353,7 +352,7 @@ namespace OpenSim.Region.ClientStack
|
|||
// Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
|
||||
if (OnAssetUploadRequest != null)
|
||||
{
|
||||
OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
|
||||
OnAssetUploadRequest(this, LLUUID.Combine(request.AssetBlock.TransactionID, this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
|
||||
}
|
||||
break;
|
||||
case PacketType.RequestXfer:
|
||||
|
@ -418,7 +417,7 @@ namespace OpenSim.Region.ClientStack
|
|||
{
|
||||
if (update.InventoryData[i].TransactionID != LLUUID.Zero)
|
||||
{
|
||||
OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, update.InventoryData[i].TransactionID.Combine(this.SecureSessionID), update.InventoryData[i].ItemID);
|
||||
OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, LLUUID.Combine(update.InventoryData[i].TransactionID, this.SecureSessionID), update.InventoryData[i].ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace OpenSim.Region.Communications.Local
|
|||
}
|
||||
else
|
||||
{
|
||||
this.m_inventoryService.CreateNewUserInventory(userProf.UUID);
|
||||
this.m_inventoryService.CreateNewUserInventory(LLUUID.Zero, userProf.UUID);
|
||||
Console.WriteLine("Created new inventory set for " + firstName + " " + lastName);
|
||||
return userProf.UUID;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using libsecondlife;
|
|||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Data;
|
||||
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
|
||||
using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
|
||||
|
||||
namespace OpenSim.Region.Communications.Local
|
||||
{
|
||||
|
@ -49,7 +50,7 @@ namespace OpenSim.Region.Communications.Local
|
|||
}
|
||||
}
|
||||
|
||||
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
|
||||
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||
{
|
||||
this.AddFolder(folder);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ using OpenSim.Framework.Data;
|
|||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Framework.UserManagement;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Inventory;
|
||||
|
||||
namespace OpenSim.Region.Communications.Local
|
||||
{
|
||||
|
@ -25,7 +24,7 @@ namespace OpenSim.Region.Communications.Local
|
|||
public event LoginToRegionEvent OnLoginToRegion;
|
||||
|
||||
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
|
||||
: base(userManager, welcomeMess)
|
||||
: base(userManager, parent.InventoryService, welcomeMess)
|
||||
{
|
||||
m_Parent = parent;
|
||||
this.serversInfo = serversInfo;
|
||||
|
@ -53,7 +52,7 @@ namespace OpenSim.Region.Communications.Local
|
|||
profile = this.m_userManager.GetUserProfile(firstname, lastname);
|
||||
if (profile != null)
|
||||
{
|
||||
m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
|
||||
m_Parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID);
|
||||
}
|
||||
|
||||
return profile;
|
||||
|
@ -123,51 +122,5 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Data;
|
||||
using OpenSim.Framework.Types;
|
||||
|
@ -48,7 +49,7 @@ namespace OpenSim.Region.Communications.Local
|
|||
}
|
||||
else
|
||||
{
|
||||
m_parent.InventoryService.CreateNewUserInventory(profile.UUID);
|
||||
m_parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID);
|
||||
}
|
||||
|
||||
return profile;
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
m_gridService = gridInterComms;
|
||||
m_interRegion = gridInterComms;
|
||||
|
||||
m_inventoryService = new OGS1InventoryService();
|
||||
m_userService = new OGS1UserServices(this);
|
||||
m_inventoryService = new OGS1InventoryService(serversInfo, m_userService);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Net;
|
|||
using System.Runtime.Remoting;
|
||||
using System.Runtime.Remoting.Channels;
|
||||
using System.Runtime.Remoting.Channels.Tcp;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using libsecondlife;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenSim.Framework;
|
||||
|
@ -302,8 +303,23 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
/// </summary>
|
||||
private void StartRemoting()
|
||||
{
|
||||
TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort);
|
||||
ChannelServices.RegisterChannel(ch, true);
|
||||
// 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["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);
|
||||
RemotingConfiguration.RegisterWellKnownServiceType(wellType);
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
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.Communications;
|
||||
using OpenSim.Framework.Data;
|
||||
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
|
||||
using OpenSim.Framework.Types;
|
||||
|
||||
|
||||
namespace OpenSim.Region.Communications.OGS1
|
||||
|
@ -10,43 +17,83 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
public class OGS1InventoryService : IInventoryServices
|
||||
{
|
||||
|
||||
public OGS1InventoryService()
|
||||
{
|
||||
IUserServices _userServices;
|
||||
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
|
||||
|
||||
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
|
||||
{
|
||||
|
||||
_inventoryServices.RequestInventoryForUser(userID, folderCallBack, itemCallBack);
|
||||
}
|
||||
|
||||
public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
|
||||
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||
{
|
||||
|
||||
_inventoryServices.AddNewInventoryFolder(userID, folder);
|
||||
}
|
||||
|
||||
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||
{
|
||||
|
||||
_inventoryServices.AddNewInventoryItem(userID, item);
|
||||
}
|
||||
|
||||
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||
{
|
||||
|
||||
_inventoryServices.DeleteInventoryItem(userID, item);
|
||||
}
|
||||
|
||||
public void CreateNewUserInventory(LLUUID user)
|
||||
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID folderID)
|
||||
{
|
||||
|
||||
return _inventoryServices.RequestFirstLevelFolders(folderID);
|
||||
}
|
||||
|
||||
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
|
||||
public List<InventoryItemBase> RequestFolderItems(LLUUID folderID)
|
||||
{
|
||||
return new List<InventoryFolderBase>();
|
||||
return _inventoryServices.RequestFolderItems(folderID);
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules
|
|||
avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
|
||||
if (avatar != null)
|
||||
{
|
||||
dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
|
||||
dis = (int)LLVector3.Mag(avatar.AbsolutePosition-fromPos);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
|
|
|
@ -561,7 +561,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
/// check for physics-related movement
|
||||
else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
|
||||
else if (LLVector3.Dist(lastPhysPos,AbsolutePosition) > 0.02)
|
||||
{
|
||||
SendTerseUpdateToAllClients();
|
||||
m_updateCount = 0;
|
||||
|
@ -748,7 +748,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
protected void CheckForSignificantMovement()
|
||||
{
|
||||
if (Helpers.VecDist(AbsolutePosition, posLastSignificantMove) > 2.0)
|
||||
if (LLVector3.Dist(AbsolutePosition, posLastSignificantMove) > 2.0)
|
||||
{
|
||||
posLastSignificantMove = AbsolutePosition;
|
||||
if (OnSignificantClientMovement != null)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[Startup]
|
||||
gridmode = false
|
||||
gridmode = true
|
||||
physics = basicphysics
|
||||
; Prim Storage
|
||||
; if you would like to use sqlite uncomment the following line (and
|
||||
|
@ -28,13 +28,13 @@ default_location_y = 1000
|
|||
http_listener_port = 9000
|
||||
remoting_listener_port = 8895
|
||||
|
||||
grid_server_url = "http://127.0.0.1:8001"
|
||||
grid_send_key = "null"
|
||||
grid_recv_key = "null"
|
||||
grid_server_url = "http://osgrid.org:8001/"
|
||||
grid_send_key = "1234"
|
||||
grid_recv_key = "1234"
|
||||
|
||||
user_server_url = "http://127.0.0.1:8002"
|
||||
user_send_key = "null"
|
||||
user_recv_key = "null"
|
||||
user_server_url = "http://osgrid.org:8002/"
|
||||
user_send_key = "1234"
|
||||
user_recv_key = "1234"
|
||||
|
||||
asset_server_url = "http://127.0.0.1:8003"
|
||||
asset_server_url = "http://osgrid.org:8003/"
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
<configuration>
|
||||
<dllmap os="osx" dll="openjpeg-libsl.dll" target="libopenjpeg-libsl-2.1.2.0.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-libsl.dll" target="./libopenjpeg-libsl-2.1.2.0-x86_64.so" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-libsl.dll" target="./libopenjpeg-libsl-2.1.2.0.so" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-libsl.dll" target="libopenjpeg-libsl-2.1.2.0-x86_64.so" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-libsl.dll" target="libopenjpeg-libsl-2.1.2.0.so" />
|
||||
</configuration>
|
||||
|
|
36
prebuild.xml
36
prebuild.xml
|
@ -823,6 +823,38 @@
|
|||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<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.Servers"/>
|
||||
<Reference name="libsecondlife.dll"/>
|
||||
|
@ -981,3 +1013,7 @@
|
|||
</Prebuild>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ CREATE TABLE `inventoryfolders` (
|
|||
`agentID` varchar(36) default NULL,
|
||||
`parentFolderID` varchar(36) default NULL,
|
||||
`folderName` varchar(64) default NULL,
|
||||
`category` TINYINT NOT NULL,
|
||||
`folderType` TINYINT NOT NULL,
|
||||
PRIMARY KEY (`folderID`),
|
||||
KEY `owner` (`agentID`),
|
||||
KEY `parent` (`parentFolderID`)
|
||||
|
|
Loading…
Reference in New Issue