From 863195612bdef56165f2b4354bab280c371618b9 Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Thu, 27 Sep 2007 14:57:43 +0000
Subject: Reverting back to 2017 since 2018 were causing Linux breakage;
reopening Tleiades patch 444 and 445.
---
OpenSim/Framework/Communications/CAPSService.cs | 1 +
.../Communications/Cache/CachedUserInfo.cs | 14 +-
.../Communications/Cache/InventoryFolder.cs | 12 +-
.../Communications/Cache/UserProfileCache.cs | 32 +--
.../Framework/Communications/IInventoryServices.cs | 16 +-
.../Communications/InventoryServiceBase.cs | 255 +++++----------------
OpenSim/Framework/Communications/LoginResponse.cs | 48 ++--
OpenSim/Framework/Communications/LoginService.cs | 134 ++++++-----
OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 58 +++--
OpenSim/Framework/Data.MySQL/MySQLManager.cs | 58 ++---
.../Framework/Data.SQLite/SQLiteInventoryStore.cs | 71 +++---
OpenSim/Framework/Data/InventoryData.cs | 33 +--
.../General/Configuration/InventoryConfig.cs | 67 ------
.../Framework/General/Configuration/UserConfig.cs | 11 -
.../Framework/General/Types/NetworkServersInfo.cs | 5 +-
OpenSim/Framework/General/Types/UUID.cs | 4 +-
OpenSim/Grid/InventoryServer/InventoryManager.cs | 131 ++++-------
OpenSim/Grid/InventoryServer/InventoryService.cs | 136 -----------
OpenSim/Grid/InventoryServer/Main.cs | 113 ++-------
OpenSim/Grid/UserServer/Main.cs | 11 +-
OpenSim/Grid/UserServer/UserLoginService.cs | 39 ++--
.../ClientStack/ClientView.ProcessPackets.cs | 5 +-
OpenSim/Region/ClientStack/ClientView.cs | 1 +
.../Communications/Local/CommunicationsLocal.cs | 2 +-
.../Communications/Local/LocalInventoryService.cs | 3 +-
.../Communications/Local/LocalLoginService.cs | 51 ++++-
.../Communications/Local/LocalUserServices.cs | 5 +-
.../Communications/OGS1/CommunicationsOGS1.cs | 2 +-
.../Region/Communications/OGS1/OGS1GridServices.cs | 20 +-
.../Communications/OGS1/OGS1InventoryService.cs | 69 +-----
OpenSim/Region/Environment/Modules/ChatModule.cs | 4 +-
OpenSim/Region/Environment/Scenes/ScenePresence.cs | 6 +-
32 files changed, 425 insertions(+), 992 deletions(-)
delete mode 100644 OpenSim/Framework/General/Configuration/InventoryConfig.cs
delete mode 100644 OpenSim/Grid/InventoryServer/InventoryService.cs
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Communications/CAPSService.cs b/OpenSim/Framework/Communications/CAPSService.cs
index 40d8d37..a8eac26 100644
--- a/OpenSim/Framework/Communications/CAPSService.cs
+++ b/OpenSim/Framework/Communications/CAPSService.cs
@@ -8,6 +8,7 @@ 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;
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 9e8c239..99dc45a 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -38,7 +38,7 @@ using OpenSim.Framework.Utilities;
namespace OpenSim.Framework.Communications.Caches
{
- public class CachedUserInfo : MarshalByRefObject
+ public class CachedUserInfo
{
private CommunicationsManager m_parentCommsManager;
// Fields
@@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications.Caches
}
// Methods
- public void FolderReceive(LLUUID userID, InventoryFolderBase folderInfo)
+ public void FolderReceive(LLUUID userID, InventoryFolder folderInfo)
{
if (userID == this.UserProfile.UUID)
{
@@ -59,19 +59,19 @@ namespace OpenSim.Framework.Communications.Caches
{
if (folderInfo.parentID == LLUUID.Zero)
{
- this.RootFolder = new InventoryFolder(folderInfo);
+ this.RootFolder = folderInfo;
}
}
else if (this.RootFolder.folderID == folderInfo.parentID)
{
- this.RootFolder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo));
+ this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
}
else
{
InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID);
if (folder != null)
{
- folder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo));
+ folder.SubFolders.Add(folderInfo.folderID, folderInfo);
}
}
}
@@ -131,7 +131,3 @@ namespace OpenSim.Framework.Communications.Caches
}
-
-
-
-
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
index a212614..885cffc 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
@@ -35,9 +35,6 @@ 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
{
@@ -63,7 +60,7 @@ namespace OpenSim.Framework.Communications.Caches
}
// Methods
- public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type, InventoryCategory category)
+ public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
{
InventoryFolder subFold = new InventoryFolder();
subFold.name = folderName;
@@ -71,12 +68,7 @@ namespace OpenSim.Framework.Communications.Caches
subFold.type = (short) type;
subFold.parentID = this.folderID;
subFold.agentID = this.agentID;
- 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);
-
+ this.SubFolders.Add(subFold.folderID, subFold);
return subFold;
}
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
index 3dadf9c..390b938 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
@@ -35,11 +35,10 @@ 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 : MarshalByRefObject
+ public class UserProfileCache
{
// Fields
private CommunicationsManager m_parent;
@@ -104,7 +103,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, InventoryCategory.User);
+ InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
if (createdFolder != null)
{
this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
@@ -115,7 +114,7 @@ namespace OpenSim.Framework.Communications.Caches
InventoryFolder folder = info.RootFolder.HasSubFolder(parentID);
if (folder != null)
{
- folder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User);
+ folder.CreateNewSubFolder(folderID, folderName, folderType);
}
}
}
@@ -125,21 +124,16 @@ namespace OpenSim.Framework.Communications.Caches
public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
{
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];
@@ -159,23 +153,9 @@ namespace OpenSim.Framework.Communications.Caches
}
}
}
- else
- {
- //nope, inventory wasn't cached, so go to the inventory server and ask for the inventory
- m_parent.InventoryService.RequestInventoryForUser(remoteClient.AgentId, ReceiveFolderInfo, ReceiveItemInfo);
- }
}
}
- public void ReceiveFolderInfo(LLUUID userID, InventoryFolderBase folderInfo)
- {
- }
-
- public void ReceiveItemInfo(LLUUID userID, InventoryItemBase itemInfo)
- {
- }
-
-
public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
{
if (ownerID == libraryRoot.agentID)
@@ -201,7 +181,7 @@ namespace OpenSim.Framework.Communications.Caches
///
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);
}
///
@@ -241,7 +221,3 @@ namespace OpenSim.Framework.Communications.Caches
}
}
-
-
-
-
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index 7b2948f..80c2e64 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -1,31 +1,29 @@
using System;
-using System.Text;
using System.Collections.Generic;
-
-using libsecondlife;
+using System.Text;
using OpenSim.Framework.Data;
+using libsecondlife;
using OpenSim.Framework.Communications.Caches;
+using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Framework.Communications
{
- public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderBase folderInfo);
+ public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo);
public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
public interface IInventoryServices
{
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
- void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
+ void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
- void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user);
- void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder);
+ void CreateNewUserInventory(LLUUID user);
///
/// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
///
///
///
- List RequestFirstLevelFolders(LLUUID folderID);
- List RequestFolderItems(LLUUID folderID);
+ List RequestFirstLevelFolders(LLUUID userID);
}
}
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 6283b60..da7a0ce 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -1,9 +1,4 @@
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;
@@ -11,20 +6,21 @@ 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 : MarshalByRefObject, IInventoryServices
+ public abstract class InventoryServiceBase : IInventoryServices
{
- protected IInventoryData _databasePlugin;
+ protected Dictionary m_plugins = new Dictionary();
+ //protected IAssetServer m_assetServer;
public InventoryServiceBase()
{
+ //m_assetServer = assetServer;
}
///
- /// Adds a new inventory data server plugin
+ /// Adds a new user server plugin - plugins will be requested in the order they were loaded.
///
/// The filename to the user server plugin DLL
public void AddPlugin(string FileName)
@@ -45,13 +41,8 @@ namespace OpenSim.Framework.Communications
IInventoryData plug =
(IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise();
- this._databasePlugin = plug;
-
- //TODO! find a better place to create inventory skeletons
- loadInventoryFromXmlFile(InventoryCategory.Library, "Inventory_Library.xml");
- loadInventoryFromXmlFile(InventoryCategory.Default, "Inventory_Default.xml");
+ this.m_plugins.Add(plug.getName(), plug);
MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface");
- break;
}
}
}
@@ -63,20 +54,20 @@ namespace OpenSim.Framework.Communications
///
///
///
- public List RequestFirstLevelFolders(LLUUID folderID)
+ public List RequestFirstLevelFolders(LLUUID userID)
{
- InventoryFolderBase root = _databasePlugin.getInventoryFolder(folderID);
-
- List folders = new List();
- if (root != null)
+ List inventoryList = new List();
+ foreach (KeyValuePair plugin in m_plugins)
{
- folders.Add(root);
-
- List subFolders = _databasePlugin.getInventoryFolders(root.folderID);
- foreach (InventoryFolderBase f in subFolders)
- folders.Add(f);
+ InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID);
+ if (rootFolder != null)
+ {
+ inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID);
+ inventoryList.Insert(0, rootFolder);
+ return inventoryList;
+ }
}
- return folders;
+ return inventoryList;
}
///
@@ -84,7 +75,11 @@ namespace OpenSim.Framework.Communications
///
public InventoryFolderBase RequestUsersRoot(LLUUID userID)
{
- return _databasePlugin.getInventoryFolder(userID); // the id of the root folder, is the user id
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ return plugin.Value.getUserRootFolder(userID);
+ }
+ return null;
}
///
@@ -94,27 +89,47 @@ namespace OpenSim.Framework.Communications
///
public List RequestSubFolders(LLUUID parentFolderID)
{
- return _databasePlugin.getInventoryFolders(parentFolderID);
+ List inventoryList = new List();
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ return plugin.Value.getInventoryFolders(parentFolderID);
+ }
+ return inventoryList;
}
public List RequestFolderItems(LLUUID folderID)
{
- return _databasePlugin.getInventoryInFolder(folderID);
+ List itemsList = new List();
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ itemsList = plugin.Value.getInventoryInFolder(folderID);
+ return itemsList;
+ }
+ return itemsList;
}
public void AddFolder(InventoryFolderBase folder)
{
- _databasePlugin.addInventoryFolder(folder);
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ plugin.Value.addInventoryFolder(folder);
+ }
}
public void AddItem(InventoryItemBase item)
{
- _databasePlugin.addInventoryItem(item);
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ plugin.Value.addInventoryItem(item);
+ }
}
public void deleteItem(InventoryItemBase item)
{
- _databasePlugin.deleteInventoryItem(item);
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ plugin.Value.deleteInventoryItem(item);
+ }
}
///
@@ -129,53 +144,11 @@ namespace OpenSim.Framework.Communications
}
}
- public void CreateNewUserInventory(LLUUID defaultFolders, LLUUID user)
+ public void CreateNewUserInventory(LLUUID user)
{
- try
- {
- // Get Default folder set from the database
- //TODO! We need to get the whole hierachy and not just one level down
- List 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());
- }
+ UsersInventory inven = new UsersInventory();
+ inven.CreateNewInventorySet(user);
+ this.AddNewInventorySet(inven);
}
public class UsersInventory
@@ -193,11 +166,10 @@ namespace OpenSim.Framework.Communications
InventoryFolderBase folder = new InventoryFolderBase();
folder.parentID = LLUUID.Zero;
folder.agentID = user;
- folder.folderID = user; // id of root folder is the same as the agent id
+ folder.folderID = LLUUID.Random();
folder.name = "My Inventory";
folder.type = 8;
folder.version = 1;
- folder.category = InventoryCategory.User;
Folders.Add(folder.folderID, folder);
LLUUID rootFolder = folder.folderID;
@@ -209,7 +181,6 @@ 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();
@@ -219,7 +190,6 @@ 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();
@@ -229,130 +199,13 @@ 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 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, InventoryFolderBase folder);
+ public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs
index b4280e7..b5a4184 100644
--- a/OpenSim/Framework/Communications/LoginResponse.cs
+++ b/OpenSim/Framework/Communications/LoginResponse.cs
@@ -26,10 +26,9 @@ namespace OpenSim.Framework.UserManagement
private ArrayList classifiedCategories;
private ArrayList inventoryRoot;
private ArrayList initialOutfit;
- private ArrayList inventorySkeleton;
+ private ArrayList agentInventory;
private ArrayList inventoryLibraryOwner;
- private ArrayList inventoryLibraryRoot;
- private ArrayList inventoryLibrarySkeleton;
+ private ArrayList inventoryLibrary;
private UserInfo userProfile;
@@ -87,13 +86,11 @@ namespace OpenSim.Framework.UserManagement
this.defaultXmlRpcResponse = new XmlRpcResponse();
this.userProfile = new UserInfo();
-
- this.initialOutfit = new ArrayList();
this.inventoryRoot = new ArrayList();
- this.inventorySkeleton = new ArrayList();
- this.inventoryLibrarySkeleton = new ArrayList();
+ this.initialOutfit = new ArrayList();
+ this.agentInventory = new ArrayList();
+ this.inventoryLibrary = new ArrayList();
this.inventoryLibraryOwner = new ArrayList();
- this.inventoryLibraryRoot = new ArrayList();
this.xmlRpcResponse = new XmlRpcResponse();
this.defaultXmlRpcResponse = new XmlRpcResponse();
@@ -240,15 +237,12 @@ namespace OpenSim.Framework.UserManagement
responseData["classified_categories"] = this.classifiedCategories;
responseData["ui-config"] = this.uiConfig;
- responseData["inventory-skeleton"] = this.inventorySkeleton;
- responseData["inventory-skel-lib"] = this.inventoryLibrarySkeleton;
+ responseData["inventory-skeleton"] = this.agentInventory;
+ responseData["inventory-skel-lib"] = this.inventoryLibrary;
responseData["inventory-root"] = this.inventoryRoot;
- responseData["inventory-lib-owner"] = this.inventoryLibraryOwner;
- responseData["inventory-lib-root"] = this.inventoryLibraryRoot;
-
responseData["gestures"] = new ArrayList(); // todo
+ responseData["inventory-lib-owner"] = this.inventoryLibraryOwner;
responseData["initial-outfit"] = this.initialOutfit;
-
responseData["start_location"] = this.startLocation;
responseData["seed_capability"] = this.seedCapability;
responseData["home"] = this.home;
@@ -602,23 +596,23 @@ namespace OpenSim.Framework.UserManagement
{
get
{
- return this.inventorySkeleton;
+ return this.agentInventory;
}
set
{
- this.inventorySkeleton = value;
+ this.agentInventory = value;
}
}
- public ArrayList InventoryLibrarySkeleton
+ public ArrayList InventoryLibrary
{
get
{
- return this.inventoryLibrarySkeleton;
+ return this.inventoryLibrary;
}
set
{
- this.inventoryLibrarySkeleton = value;
+ this.inventoryLibrary = value;
}
}
@@ -634,18 +628,6 @@ namespace OpenSim.Framework.UserManagement
}
}
- public ArrayList InventoryLibraryRoot
- {
- get
- {
- return this.inventoryLibraryRoot;
- }
- set
- {
- this.inventoryLibraryRoot = value;
- }
- }
-
public string Home
{
get
@@ -683,7 +665,3 @@ namespace OpenSim.Framework.UserManagement
}
}
-
-
-
-
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 4e6aa80..8e7cf80 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -8,10 +8,11 @@ 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 OpenSim.Framework.Configuration;
+using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder;
namespace OpenSim.Framework.UserManagement
{
@@ -19,12 +20,10 @@ 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, IInventoryServices inventoryServer, string welcomeMess)
+ public LoginService(UserManagerBase userManager, string welcomeMess)
{
m_userManager = userManager;
- m_inventoryServer = inventoryServer;
if (welcomeMess != "")
{
m_welcomeMessage = welcomeMess;
@@ -38,6 +37,7 @@ namespace OpenSim.Framework.UserManagement
/// The response to send
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
{
+
System.Console.WriteLine("Attempting login now...");
XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0];
@@ -85,41 +85,15 @@ namespace OpenSim.Framework.UserManagement
{
LLUUID agentID = userProfile.UUID;
- LLUUID libraryFolderID;
- LLUUID personalFolderID;
-
- 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);
+ // Inventory Library Section
+ InventoryData inventData = this.CreateInventoryData(agentID);
+ ArrayList AgentInventoryArray = inventData.InventoryArray;
- // 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);
+ Hashtable InventoryRootHash = new Hashtable();
+ InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated();
+ ArrayList InventoryRoot = new ArrayList();
+ InventoryRoot.Add(InventoryRootHash);
+ userProfile.rootInventoryFolderID = inventData.RootFolderID;
// Circuit Code
uint circode = (uint)(Util.RandomClass.Next());
@@ -129,6 +103,10 @@ 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
@@ -234,30 +212,76 @@ namespace OpenSim.Framework.UserManagement
}
///
- /// Create a structure of the generic inventory structure of a specified folder
+ ///
+ ///
+ ///
+ protected virtual ArrayList GetInventoryLibrary()
+ {
+ //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";
+ ArrayList temp = new ArrayList();
+ 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;
+ }
+
+ ///
+ ///
///
///
- protected virtual ArrayList GetInventorySkeleton(LLUUID folderID)
+ 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;
+ }
- List folders = m_inventoryServer.RequestFirstLevelFolders(folderID);
+ protected virtual InventoryData CreateInventoryData(LLUUID userID)
+ {
+ AgentInventory userInventory = new AgentInventory();
+ userInventory.CreateRootFolder(userID, false);
- ArrayList temp = new ArrayList();
- foreach (InventoryFolderBase ifb in folders)
+ ArrayList AgentInventoryArray = new ArrayList();
+ Hashtable TempHash;
+ foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
{
- 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"] = (Int32)ifb.type;
- TempHash["version"] = (Int32)ifb.version+1;
- temp.Add(TempHash);
+ TempHash = new Hashtable();
+ TempHash["name"] = InvFolder.FolderName;
+ TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
+ TempHash["version"] = (Int32)InvFolder.Version;
+ TempHash["type_default"] = (Int32)InvFolder.DefaultType;
+ TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
+ AgentInventoryArray.Add(TempHash);
}
- return temp;
+ return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
+ }
+
+ public class InventoryData
+ {
+ public ArrayList InventoryArray = null;
+ public LLUUID RootFolderID = LLUUID.Zero;
+
+ public InventoryData(ArrayList invList, LLUUID rootID)
+ {
+ InventoryArray = invList;
+ RootFolderID = rootID;
+ }
}
}
}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index 8a7e869..5009d9e 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -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 OR category = 0)", param);
+ IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
IDataReader reader = result.ExecuteReader();
List items = database.readInventoryFolders(reader);
@@ -152,6 +152,40 @@ namespace OpenSim.Framework.Data.MySQL
}
///
+ /// Returns the users inventory root folder.
+ ///
+ ///
+ ///
+ public InventoryFolderBase getUserRootFolder(LLUUID user)
+ {
+ try
+ {
+ lock (database)
+ {
+ Dictionary param = new Dictionary();
+ 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 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;
+ }
+ }
+
+ ///
/// Returns a list of folders in a users inventory contained within the specified folder
///
/// The folder to search
@@ -314,27 +348,5 @@ 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());
- }
- }
-
}
}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index e55606e..5037f98 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// The database connection object
///
- MySqlConnection dbcon;
+ IDbConnection dbcon;
///
/// Connection string for ADO.net
///
@@ -115,11 +115,10 @@ namespace OpenSim.Framework.Data.MySQL
{
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
dbcommand.CommandText = sql;
- if(parameters != null)
- foreach (KeyValuePair param in parameters)
- {
- dbcommand.Parameters.Add(param.Key, param.Value);
- }
+ foreach (KeyValuePair param in parameters)
+ {
+ dbcommand.Parameters.Add(param.Key, param.Value);
+ }
return (IDbCommand)dbcommand;
}
@@ -150,11 +149,10 @@ namespace OpenSim.Framework.Data.MySQL
{
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
dbcommand.CommandText = sql;
- if(parameters != null)
- foreach (KeyValuePair param in parameters)
- {
- dbcommand.Parameters.Add(param.Key, param.Value);
- }
+ foreach (KeyValuePair param in parameters)
+ {
+ dbcommand.Parameters.Add(param.Key, param.Value);
+ }
return (IDbCommand)dbcommand;
}
@@ -372,8 +370,6 @@ 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);
}
@@ -513,32 +509,24 @@ namespace OpenSim.Framework.Data.MySQL
/// Success?
public bool insertFolder(InventoryFolderBase folder)
{
- 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;
-
-
+ string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
+ sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)";
+
+ Dictionary parameters = new Dictionary();
+ parameters["?folderID"] = folder.folderID.ToStringHyphenated();
+ parameters["?agentID"] = folder.agentID.ToStringHyphenated();
+ parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated();
+ parameters["?folderName"] = folder.name;
+
bool returnval = false;
try
{
- if (dbcmd.ExecuteNonQuery() == 1)
+ IDbCommand result = Query(sql, parameters);
+
+ if (result.ExecuteNonQuery() == 1)
returnval = true;
+
+ result.Dispose();
}
catch (Exception e)
{
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index eb0ba04..d3d752f 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -61,11 +61,10 @@ namespace OpenSim.Framework.Data.SQLite
MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Items Definitions");
ds.AcceptChanges();
-
return;
}
- public InventoryItemBase buildItem(DataRow row)
+ public InventoryItemBase BuildItem(DataRow row)
{
InventoryItemBase item = new InventoryItemBase();
item.inventoryID = new LLUUID((string)row["UUID"]);
@@ -183,7 +182,7 @@ namespace OpenSim.Framework.Data.SQLite
DataRow[] rows = inventoryItemTable.Select(selectExp);
foreach (DataRow row in rows)
{
- retval.Add(buildItem(row));
+ retval.Add(BuildItem(row));
}
return retval;
@@ -196,16 +195,43 @@ namespace OpenSim.Framework.Data.SQLite
/// A list of folder objects
public List getUserRootFolders(LLUUID user)
{
+ return null;
+ }
+
+ ///
+ /// Returns the users inventory root folder.
+ ///
+ /// The UUID of the user who is having inventory being returned
+ /// Root inventory folder
+ public InventoryFolderBase getUserRootFolder(LLUUID user)
+ {
List folders = new List();
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
-
- string selectExp = "parentID = '" + LLUUID.Zero.ToString() + "' AND (agentID = '" + user.ToString() + "' OR category = 0)";
+ string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'";
DataRow[] rows = inventoryFolderTable.Select(selectExp);
foreach (DataRow row in rows)
{
folders.Add(this.buildFolder(row));
}
- return folders;
+
+ if (folders.Count == 1)
+ {
+ //we found the root
+ //System.Console.WriteLine("found root inventory folder");
+ return folders[0];
+ }
+ else if (folders.Count > 1)
+ {
+ //err shouldn't be more than one root
+ //System.Console.WriteLine("found more than one root inventory folder");
+ }
+ else if (folders.Count == 0)
+ {
+ // no root?
+ //System.Console.WriteLine("couldn't find root inventory folder");
+ }
+
+ return null;
}
///
@@ -234,11 +260,7 @@ namespace OpenSim.Framework.Data.SQLite
/// A class containing item information
public InventoryItemBase getInventoryItem(LLUUID item)
{
- DataRow row = ds.Tables["inventoryitems"].Rows.Find(item);
- if (row != null)
- return this.buildItem(row);
- else
- return null;
+ return null;
}
///
@@ -248,14 +270,7 @@ namespace OpenSim.Framework.Data.SQLite
/// A class containing folder information
public InventoryFolderBase getInventoryFolder(LLUUID folder)
{
- 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;
+ return null;
}
///
@@ -293,11 +308,6 @@ namespace OpenSim.Framework.Data.SQLite
this.invItemsDa.Update(ds, "inventoryitems");
}
- //TODO! Implement SQLite deleteInventoryCategory
- public void deleteInventoryCategory(InventoryCategory inventoryCategory)
- {
- }
-
///
/// Adds a new folder specified by folder
///
@@ -316,11 +326,6 @@ namespace OpenSim.Framework.Data.SQLite
this.addFolder(folder);
}
- //TODO! implement CreateNewUserInventory
- public void CreateNewUserInventory(LLUUID user)
- {
- throw new Exception("Function not implemented");
- }
/***********************************************************************
*
@@ -345,7 +350,6 @@ namespace OpenSim.Framework.Data.SQLite
createCol(inv, "parentFolderID", typeof(System.String));
createCol(inv, "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));
@@ -369,7 +373,6 @@ 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;
@@ -412,7 +415,6 @@ 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;
}
@@ -424,7 +426,6 @@ namespace OpenSim.Framework.Data.SQLite
row["parentID"] = folder.parentID;
row["type"] = folder.type;
row["version"] = folder.version;
- row["category"] = folder.category;
}
@@ -643,7 +644,3 @@ namespace OpenSim.Framework.Data.SQLite
}
}
-
-
-
-
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs
index dc857d8..2df26e1 100644
--- a/OpenSim/Framework/Data/InventoryData.cs
+++ b/OpenSim/Framework/Data/InventoryData.cs
@@ -25,19 +25,15 @@
* 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 };
///
/// Inventory Item - contains all the properties associated with an individual inventory piece.
///
- public class InventoryItemBase : MarshalByRefObject
+ public class InventoryItemBase
{
///
/// A UUID containing the ID for the inventory item itself
@@ -70,12 +66,10 @@ namespace OpenSim.Framework.Data
///
/// The name of the inventory item (must be less than 64 characters)
///
- [XmlElement(ElementName="name")]
public string inventoryName;
///
/// The description of the inventory item (must be less than 64 characters)
///
- [XmlElement(ElementName = "description")]
public string inventoryDescription;
///
/// A mask containing the permissions for the next owner (cannot be enforced)
@@ -98,7 +92,7 @@ namespace OpenSim.Framework.Data
///
/// A Class for folders which contain users inventory
///
- public class InventoryFolderBase : MarshalByRefObject
+ public class InventoryFolderBase
{
///
/// The name of the folder (64 characters or less)
@@ -124,10 +118,6 @@ namespace OpenSim.Framework.Data
///
///
public ushort version;
- ///
- /// Inventory category, Library, Default, System
- ///
- public InventoryCategory category;
}
///
@@ -172,6 +162,13 @@ namespace OpenSim.Framework.Data
List getUserRootFolders(LLUUID user);
///
+ /// Returns the users inventory root folder.
+ ///
+ /// The UUID of the user who is having inventory being returned
+ /// Root inventory folder
+ InventoryFolderBase getUserRootFolder(LLUUID user);
+
+ ///
/// Returns a list of inventory folders contained in the folder 'parentID'
///
/// The folder to get subfolders for
@@ -221,17 +218,5 @@ namespace OpenSim.Framework.Data
///
/// The inventory folder
void updateInventoryFolder(InventoryFolderBase folder);
-
- ///
- /// Delete a complete inventory category
- ///
- /// What folder category shout be deleted
- void deleteInventoryCategory(InventoryCategory inventoryCategory);
-
- ///
- /// Setup the initial folderset of a user
- ///
- ///
- //void CreateNewUserInventory(LLUUID user);
}
}
diff --git a/OpenSim/Framework/General/Configuration/InventoryConfig.cs b/OpenSim/Framework/General/Configuration/InventoryConfig.cs
deleted file mode 100644
index d84609b..0000000
--- a/OpenSim/Framework/General/Configuration/InventoryConfig.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenSim.Framework.Configuration
-{
- ///
- /// UserConfig -- For User Server Configuration
- ///
- 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;
- }
- }
-}
diff --git a/OpenSim/Framework/General/Configuration/UserConfig.cs b/OpenSim/Framework/General/Configuration/UserConfig.cs
index 16a7de4..776b911 100644
--- a/OpenSim/Framework/General/Configuration/UserConfig.cs
+++ b/OpenSim/Framework/General/Configuration/UserConfig.cs
@@ -18,9 +18,6 @@ namespace OpenSim.Framework.Configuration
public uint HttpPort = 8002;
- public int InventoryServerPort;
- public string InventoryServerName;
-
private ConfigurationMember configMember;
public UserConfig(string description, string filename)
@@ -40,8 +37,6 @@ namespace OpenSim.Framework.Configuration
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", "8002", false);
- configMember.addConfigurationOption("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)
@@ -64,12 +59,6 @@ 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;
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
index cf194fc..b65488a 100644
--- a/OpenSim/Framework/General/Types/NetworkServersInfo.cs
+++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
@@ -49,8 +49,6 @@ namespace OpenSim.Framework.Types
public int HttpListenerPort = 9000;
public int RemotingListenerPort = 8895;
- public int InventoryServerPort;
- public string InventoryServerName = "";
public NetworkServersInfo()
{
@@ -88,8 +86,7 @@ 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");
+
}
}
}
diff --git a/OpenSim/Framework/General/Types/UUID.cs b/OpenSim/Framework/General/Types/UUID.cs
index feae4ae..9e9654d 100644
--- a/OpenSim/Framework/General/Types/UUID.cs
+++ b/OpenSim/Framework/General/Types/UUID.cs
@@ -91,12 +91,12 @@ namespace OpenSim.Framework.Types
public void Combine(UUID other)
{
- LLUUID.Combine(llUUID, other.GetLLUUID());
+ llUUID.Combine(other.GetLLUUID());
}
public void Combine(LLUUID other)
{
- LLUUID.Combine(llUUID, other);
+ llUUID.Combine(other);
}
public override bool Equals(Object other)
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs
index a46f359..016b8bb 100644
--- a/OpenSim/Grid/InventoryServer/InventoryManager.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs
@@ -26,34 +26,37 @@
*
*/
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 OpenSim.Framework.Console;
+using Nwc.XmlRpc;
+using OpenSim.Framework.Sims;
+using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities;
-using OpenSim.Framework.Data;
-using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
-namespace OpenSim.Grid.InventoryServer
+using System.Security.Cryptography;
+
+namespace OpenGridServices.InventoryServer
{
- class InventoryManager : IInventoryData
+ class InventoryManager
{
- IInventoryData _databasePlugin;
+ Dictionary _plugins = new Dictionary();
///
/// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
///
/// The filename to the inventory server plugin DLL
- public void AddDatabasePlugin(string FileName)
+ public void AddPlugin(string FileName)
{
- MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Attempting to load " + FileName);
+ OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName);
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
- MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
+ OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (!pluginType.IsAbstract)
@@ -64,9 +67,8 @@ namespace OpenSim.Grid.InventoryServer
{
IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise();
- _databasePlugin = plug;
- MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Added IInventoryData Interface");
- break;
+ this._plugins.Add(plug.getName(), plug);
+ OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface");
}
typeInterface = null;
@@ -78,87 +80,46 @@ namespace OpenSim.Grid.InventoryServer
public List getRootFolders(LLUUID user)
{
+ foreach (KeyValuePair 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;
}
- #region IInventoryData Members
-
-
- public List getInventoryInFolder(LLUUID folderID)
- {
- return _databasePlugin.getInventoryInFolder(folderID);
- }
-
- public List getUserRootFolders(LLUUID user)
- {
- return _databasePlugin.getUserRootFolders(user);
- }
-
- public List 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)
+ public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
{
- _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.");
- }
+ XmlRpcResponse response = new XmlRpcResponse();
+ Hashtable requestData = (Hashtable)request.Params[0];
- public void addInventoryFolder(InventoryFolderBase folder)
- {
- _databasePlugin.addInventoryFolder(folder);
- }
+ Hashtable responseData = new Hashtable();
- 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.");
- }
+ // Stuff happens here
- public void Close()
- {
- throw new Exception("The method or operation is not implemented.");
- }
+ if (requestData.ContainsKey("Access-type"))
+ {
+ if (requestData["access-type"] == "rootfolders")
+ {
+// responseData["rootfolders"] =
+ }
+ }
+ else
+ {
+ responseData["error"] = "No access-type specified.";
+ }
- 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.");
- }
+ // Stuff stops happening here
- public void deleteInventoryCategory(InventoryCategory inventoryCategory)
- {
- _databasePlugin.deleteInventoryCategory(inventoryCategory);
+ response.Value = responseData;
+ return response;
}
-
- #endregion
}
}
diff --git a/OpenSim/Grid/InventoryServer/InventoryService.cs b/OpenSim/Grid/InventoryServer/InventoryService.cs
deleted file mode 100644
index cbc0558..0000000
--- a/OpenSim/Grid/InventoryServer/InventoryService.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-using System;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Channels.Tcp;
-using System.Runtime.Serialization.Formatters;
-using System.Collections;
-using System.Collections.Generic;
-
-
-using libsecondlife;
-using OpenSim.Framework.Data;
-using OpenSim.Framework.Communications;
-using OpenSim.Framework.Configuration;
-using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
-
-namespace OpenSim.Grid.InventoryServer
-{
- class InventoryServiceSingleton : OpenSim.Framework.Communications.InventoryServiceBase
- {
- static InventoryManager _inventoryManager;
-
- static public InventoryManager InventoryManager
- {
- set { _inventoryManager = value; }
- get { return _inventoryManager; }
- }
-
-#region Singleton Pattern
- static InventoryServiceSingleton instance=null;
-
- InventoryServiceSingleton()
- {
- }
-
- public static InventoryServiceSingleton Instance
- {
- get
- {
- if (instance==null)
- {
- instance = new InventoryServiceSingleton();
- }
- return instance;
- }
- }
-#endregion
-
-#region IInventoryServices Members
-
- public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
- {
- List 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 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 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;
- }
-
- }
-}
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 392c741..97addb0 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -31,130 +31,49 @@ 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 OpenSim.Grid.InventoryServer
+namespace OpenGridServices.InventoryServer
{
-
- public class OpenInventory_Main : conscmd_callback
+ public class OpenInventory_Main : BaseServer, conscmd_callback
{
+ ConsoleBase m_console;
+ InventoryManager m_inventoryManager;
- public const string MainLogName = "INVENTORY";
-
- private InventoryConfig m_config;
- LogBase m_console;
- InventoryManager m_inventoryManager; ///connection the database backend
- InventoryService m_inventoryService; ///Remoting interface, where messages arrive
- [STAThread]
public static void Main(string[] args)
{
- 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()
{
-
- 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();
- }
+ m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
+ MainConsole.Instance = m_console;
}
public void Startup()
{
- 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
+ MainConsole.Instance.Notice("Initialising inventory manager...");
m_inventoryManager = new InventoryManager();
- m_inventoryManager.AddDatabasePlugin(m_config.DatabaseProvider);
-
- m_inventoryService = new InventoryService(m_inventoryManager, m_config);
- // Dig out the embedded version number of this assembly
- Assembly assembly = Assembly.GetExecutingAssembly();
- string serverExeName = assembly.ManifestModule.Name;
- Version serverExeVersion = AssemblyName.GetAssemblyName(serverExeName).Version;
+ MainConsole.Instance.Notice("Starting HTTP server");
+ BaseHttpServer httpServer = new BaseHttpServer(8004);
- 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 , load library inventory, shared between all users");
- m_console.Notice("load default , load template inventory, used when creating a new user inventory");
- m_console.Notice("load user , load inventory for a specific users, warning this will reset the contents of the inventory");
- break;
- }
+ httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest);
+ //httpServer.AddRestHandler("GET","/rootfolders/",Rest
}
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;
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 28635dd..c2822b6 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -36,8 +36,6 @@ 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
{
@@ -50,8 +48,6 @@ namespace OpenSim.Grid.UserServer
public UserManager m_userManager;
public UserLoginService m_loginService;
- public IInventoryServices m_inventoryService;
-
LogBase m_console;
[STAThread]
@@ -94,11 +90,7 @@ namespace OpenSim.Grid.UserServer
m_userManager._config = Cfg;
m_userManager.AddPlugin(Cfg.DatabaseProvider);
- // 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);
+ m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg);
MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process");
BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort);
@@ -111,7 +103,6 @@ namespace OpenSim.Grid.UserServer
httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod ));
httpServer.Start();
-
m_console.Status("SERVER", "Userserver 0.3 - Startup complete");
}
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index f0140a5..95192e3 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -6,7 +6,6 @@ using OpenSim.Framework.Data;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration;
-using OpenSim.Framework.Communications;
namespace OpenSim.Grid.UserServer
{
@@ -14,8 +13,8 @@ namespace OpenSim.Grid.UserServer
{
public UserConfig m_config;
- public UserLoginService(UserManagerBase userManager, IInventoryServices inventoryServer, UserConfig config, string welcomeMess)
- : base(userManager, inventoryServer, welcomeMess)
+ public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess)
+ : base(userManager, welcomeMess)
{
m_config = config;
}
@@ -72,29 +71,25 @@ namespace OpenSim.Grid.UserServer
theUser.currentAgent.currentHandle = SimInfo.regionHandle;
System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
- // Send
- try
- {
- XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
- XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
+ // Send
+ try
+ {
+ XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
+ XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
}
catch( WebException e )
- {
- switch( e.Status )
- {
- case WebExceptionStatus.Timeout:
- //TODO: Send him to nearby or default region instead
- break;
-
- default:
- throw;
- }
+ {
+ switch( e.Status )
+ {
+ case WebExceptionStatus.Timeout:
+ //TODO: Send him to nearby or default region instead
+ break;
+
+ default:
+ throw;
+ }
}
}
}
}
-
-
-
-
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index b35a9d3..e526f73 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -30,6 +30,7 @@ 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;
@@ -352,7 +353,7 @@ namespace OpenSim.Region.ClientStack
// Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
if (OnAssetUploadRequest != null)
{
- OnAssetUploadRequest(this, LLUUID.Combine(request.AssetBlock.TransactionID, this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
+ OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
}
break;
case PacketType.RequestXfer:
@@ -417,7 +418,7 @@ namespace OpenSim.Region.ClientStack
{
if (update.InventoryData[i].TransactionID != LLUUID.Zero)
{
- OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, LLUUID.Combine(update.InventoryData[i].TransactionID, this.SecureSessionID), update.InventoryData[i].ItemID);
+ OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, update.InventoryData[i].TransactionID.Combine(this.SecureSessionID), update.InventoryData[i].ItemID);
}
}
}
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index ecf78cb..2489739 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -37,6 +37,7 @@ 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;
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index 7e08297..a00b35f 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Region.Communications.Local
}
else
{
- this.m_inventoryService.CreateNewUserInventory(LLUUID.Zero, userProf.UUID);
+ this.m_inventoryService.CreateNewUserInventory(userProf.UUID);
Console.WriteLine("Created new inventory set for " + firstName + " " + lastName);
return userProf.UUID;
}
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index 5bd3277..53f6ffa 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -3,7 +3,6 @@ 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
{
@@ -50,7 +49,7 @@ namespace OpenSim.Region.Communications.Local
}
}
- public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
+ public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{
this.AddFolder(folder);
}
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 95fdf5a..ab8e397 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -7,6 +7,7 @@ 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
{
@@ -24,7 +25,7 @@ namespace OpenSim.Region.Communications.Local
public event LoginToRegionEvent OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
- : base(userManager, parent.InventoryService, welcomeMess)
+ : base(userManager, welcomeMess)
{
m_Parent = parent;
this.serversInfo = serversInfo;
@@ -52,7 +53,7 @@ namespace OpenSim.Region.Communications.Local
profile = this.m_userManager.GetUserProfile(firstname, lastname);
if (profile != null)
{
- m_Parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID);
+ m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
}
return profile;
@@ -122,5 +123,51 @@ namespace OpenSim.Region.Communications.Local
}
}
+
+ protected override InventoryData CreateInventoryData(LLUUID userID)
+ {
+ List 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);
+ }
+ }
}
}
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index 61b8633..3bc4301 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -1,5 +1,4 @@
using System;
-using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
using OpenSim.Framework.Types;
@@ -49,10 +48,10 @@ namespace OpenSim.Region.Communications.Local
}
else
{
- m_parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID);
+ m_parent.InventoryService.CreateNewUserInventory(profile.UUID);
}
return profile;
}
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
index 1aa6498..96f1933 100644
--- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
+++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
@@ -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);
}
}
}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 0b78c83..1b4b54c 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -5,7 +5,6 @@ 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;
@@ -303,23 +302,8 @@ namespace OpenSim.Region.Communications.OGS1
///
private void StartRemoting()
{
- // 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);
- }
+ TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort);
+ ChannelServices.RegisterChannel(ch, true);
WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton);
RemotingConfiguration.RegisterWellKnownServiceType(wellType);
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 2ec4d10..45188c1 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -1,15 +1,8 @@
-using System;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Channels.Tcp;
-using System.Runtime.Serialization.Formatters;
-using System.Collections;
using System.Collections.Generic;
-
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
-using OpenSim.Framework.Types;
+using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.OGS1
@@ -17,83 +10,43 @@ namespace OpenSim.Region.Communications.OGS1
public class OGS1InventoryService : IInventoryServices
{
- IUserServices _userServices;
- IInventoryServices _inventoryServices;
-
- public OGS1InventoryService(NetworkServersInfo networkConfig, IUserServices userServices) :
- this(networkConfig.InventoryServerName, networkConfig.InventoryServerPort, userServices)
- {
- }
-
- public OGS1InventoryService(string serverName, int serverPort, IUserServices userServices)
+ public OGS1InventoryService()
{
- _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, InventoryFolderBase folder)
+ public void AddNewInventoryFolder(LLUUID userID, InventoryFolder 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 List RequestFirstLevelFolders(LLUUID folderID)
- {
- return _inventoryServices.RequestFirstLevelFolders(folderID);
+
}
- public List RequestFolderItems(LLUUID folderID)
+ public void CreateNewUserInventory(LLUUID user)
{
- return _inventoryServices.RequestFolderItems(folderID);
+
}
- public void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder)
+ public List RequestFirstLevelFolders(LLUUID userID)
{
- _inventoryServices.GetRootFoldersForUser(user, out libraryFolder, out personalFolder);
+ return new List();
}
- public void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user)
- {
- throw new Exception("method not implemented");
- }
#endregion
}
}
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index d76ffe3..1c7b806 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules
avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
if (avatar != null)
{
- dis = (int)LLVector3.Mag(avatar.AbsolutePosition-fromPos);
+ dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
}
switch (type)
@@ -211,4 +211,4 @@ namespace OpenSim.Region.Environment.Modules
}
}
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 5b6fe46..e6b8364 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -561,7 +561,7 @@ namespace OpenSim.Region.Environment.Scenes
}
/// check for physics-related movement
- else if (LLVector3.Dist(lastPhysPos,AbsolutePosition) > 0.02)
+ else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
{
SendTerseUpdateToAllClients();
m_updateCount = 0;
@@ -748,7 +748,7 @@ namespace OpenSim.Region.Environment.Scenes
protected void CheckForSignificantMovement()
{
- if (LLVector3.Dist(AbsolutePosition, posLastSignificantMove) > 2.0)
+ if (Helpers.VecDist(AbsolutePosition, posLastSignificantMove) > 2.0)
{
posLastSignificantMove = AbsolutePosition;
if (OnSignificantClientMovement != null)
@@ -919,4 +919,4 @@ namespace OpenSim.Region.Environment.Scenes
RemoveFromPhysicalScene();
}
}
-}
+}
\ No newline at end of file
--
cgit v1.1