Step one on the long march towards grid based inventory. Introduction of an InevntoryServer
parent
a8c42a5829
commit
6a8d8f54e8
|
@ -0,0 +1,67 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
/// <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 static uint DefaultHttpPort = 8004;
|
||||||
|
|
||||||
|
public int HttpPort = 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:" + UserConfig.DefaultHttpPort.ToString(), 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("http_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Http Listener port", DefaultHttpPort.ToString(), 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 "http_port":
|
||||||
|
HttpPort = (int)configuration_result;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,6 +25,9 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
|
@ -242,4 +245,29 @@ namespace OpenSim.Framework
|
||||||
/// <param name="folder">The id of the folder</param>
|
/// <param name="folder">The id of the folder</param>
|
||||||
void deleteInventoryFolder(LLUUID folder);
|
void deleteInventoryFolder(LLUUID folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* .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 SerializableInventory
|
||||||
|
{
|
||||||
|
[XmlRoot(ElementName = "folder", IsNullable = true)]
|
||||||
|
public class SerializableFolder : InventoryFolderBase
|
||||||
|
{
|
||||||
|
[XmlArray(ElementName = "folders", IsNullable = true)]
|
||||||
|
[XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializableFolder))]
|
||||||
|
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 SerializableFolder root;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -43,6 +43,8 @@ namespace OpenSim.Framework
|
||||||
public string UserRecvKey = "";
|
public string UserRecvKey = "";
|
||||||
public bool isSandbox;
|
public bool isSandbox;
|
||||||
|
|
||||||
|
public string InventoryURL = "";
|
||||||
|
|
||||||
public static int DefaultHttpListenerPort = 9000;
|
public static int DefaultHttpListenerPort = 9000;
|
||||||
public int HttpListenerPort = DefaultHttpListenerPort;
|
public int HttpListenerPort = DefaultHttpListenerPort;
|
||||||
|
|
||||||
|
@ -91,6 +93,8 @@ namespace OpenSim.Framework
|
||||||
UserSendKey = config.Configs["Network"].GetString("user_send_key", "null");
|
UserSendKey = config.Configs["Network"].GetString("user_send_key", "null");
|
||||||
UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null");
|
UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null");
|
||||||
AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL);
|
AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL);
|
||||||
|
InventoryURL = config.Configs["Network"].GetString("inventory_server_url",
|
||||||
|
"http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,37 +26,36 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Reflection;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using OpenGrid.Framework.Data;
|
|
||||||
using libsecondlife;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Nwc.XmlRpc;
|
using System.Xml.Serialization;
|
||||||
using OpenSim.Framework.Sims;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Inventory;
|
|
||||||
using OpenSim.Framework.Utilities;
|
|
||||||
|
|
||||||
using System.Security.Cryptography;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Framework.Servers;
|
||||||
|
|
||||||
namespace OpenGridServices.InventoryServer
|
namespace OpenSim.Grid.InventoryServer
|
||||||
{
|
{
|
||||||
class InventoryManager
|
|
||||||
|
public class InventoryManager
|
||||||
{
|
{
|
||||||
Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>();
|
IInventoryData _databasePlugin;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
|
/// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="FileName">The filename to the inventory server plugin DLL</param>
|
/// <param name="FileName">The filename to the inventory server plugin DLL</param>
|
||||||
public void AddPlugin(string FileName)
|
public void AddDatabasePlugin(string FileName)
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName);
|
MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Attempting to load " + FileName);
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||||
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
|
MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
{
|
{
|
||||||
if (!pluginType.IsAbstract)
|
if (!pluginType.IsAbstract)
|
||||||
|
@ -67,8 +66,9 @@ namespace OpenGridServices.InventoryServer
|
||||||
{
|
{
|
||||||
IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
plug.Initialise();
|
plug.Initialise();
|
||||||
this._plugins.Add(plug.getName(), plug);
|
_databasePlugin = plug;
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface");
|
MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Added IInventoryData Interface");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
typeInterface = null;
|
typeInterface = null;
|
||||||
|
@ -78,48 +78,132 @@ namespace OpenGridServices.InventoryServer
|
||||||
pluginAssembly = null;
|
pluginAssembly = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryFolderBase> getRootFolders(LLUUID user)
|
protected static SerializableInventory loadInventoryFromXmlFile(string fileName)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, IInventoryData> kvp in _plugins)
|
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
|
||||||
{
|
XmlReader reader = new XmlTextReader(fs);
|
||||||
try
|
XmlSerializer x = new XmlSerializer(typeof(SerializableInventory));
|
||||||
{
|
SerializableInventory inventory = (SerializableInventory)x.Deserialize(reader);
|
||||||
return kvp.Value.getUserRootFolders(user);
|
fs.Close();
|
||||||
}
|
fs.Dispose();
|
||||||
catch (Exception e)
|
return inventory;
|
||||||
{
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
|
protected static void saveInventoryToStream(SerializableInventory inventory, Stream s)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlTextWriter writer = new XmlTextWriter(s, Encoding.UTF8);
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
writer.Formatting = Formatting.Indented;
|
||||||
|
XmlSerializer x = new XmlSerializer(typeof(SerializableInventory));
|
||||||
Hashtable responseData = new Hashtable();
|
x.Serialize(writer, inventory);
|
||||||
|
|
||||||
// Stuff happens here
|
|
||||||
|
|
||||||
if (requestData.ContainsKey("Access-type"))
|
|
||||||
{
|
|
||||||
if (requestData["access-type"] == "rootfolders")
|
|
||||||
{
|
|
||||||
// responseData["rootfolders"] =
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static bool fixupFolder(SerializableInventory.SerializableFolder f, SerializableInventory.SerializableFolder parent)
|
||||||
|
{
|
||||||
|
bool modified = false;
|
||||||
|
|
||||||
|
// ensure we have a valid folder id
|
||||||
|
if (f.folderID == LLUUID.Zero)
|
||||||
|
{
|
||||||
|
f.folderID = LLUUID.Random();
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ensure we have valid agent id
|
||||||
|
if (f.agentID == LLUUID.Zero)
|
||||||
|
{
|
||||||
|
if (parent != null)
|
||||||
|
f.agentID = parent.agentID;
|
||||||
else
|
else
|
||||||
|
f.agentID = f.folderID;
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f.parentID == LLUUID.Zero && parent != null)
|
||||||
{
|
{
|
||||||
responseData["error"] = "No access-type specified.";
|
f.parentID = parent.folderID;
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Stuff stops happening here
|
foreach (SerializableInventory.SerializableFolder child in f.SubFolders)
|
||||||
|
{
|
||||||
|
modified |= fixupFolder(child, f);
|
||||||
|
}
|
||||||
|
|
||||||
response.Value = responseData;
|
return modified;
|
||||||
return response;
|
}
|
||||||
|
|
||||||
|
protected static bool fixupInventory(SerializableInventory inventory)
|
||||||
|
{
|
||||||
|
return fixupFolder(inventory.root, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetInventory : BaseStreamHandler
|
||||||
|
{
|
||||||
|
private SerializableInventory _inventory;
|
||||||
|
private InventoryManager _manager;
|
||||||
|
public GetInventory(InventoryManager manager)
|
||||||
|
: base("GET", "/inventory")
|
||||||
|
{
|
||||||
|
_manager = manager;
|
||||||
|
|
||||||
|
_inventory = loadInventoryFromXmlFile("Inventory_Library.xml");
|
||||||
|
if (fixupInventory(_inventory))
|
||||||
|
{
|
||||||
|
FileStream fs = new FileStream("Inventory_Library.xml", FileMode.Truncate, FileAccess.Write);
|
||||||
|
saveInventoryToStream(_inventory, fs);
|
||||||
|
fs.Flush();
|
||||||
|
fs.Close();
|
||||||
|
MainLog.Instance.Debug(OpenInventory_Main.LogName, "Modified");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateDefaultInventory(LLUUID userID)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] GetUserInventory(LLUUID userID)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Notice(OpenInventory_Main.LogName, "Getting Inventory for user {0}", userID.ToStringHyphenated());
|
||||||
|
byte[] result = new byte[] { };
|
||||||
|
|
||||||
|
InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID);
|
||||||
|
if (fb == null)
|
||||||
|
{
|
||||||
|
MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new", userID.ToStringHyphenated());
|
||||||
|
CreateDefaultInventory(userID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
override public byte[] Handle(string path, Stream request)
|
||||||
|
{
|
||||||
|
byte[] result = new byte[] { };
|
||||||
|
|
||||||
|
string[] parms = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (parms.Length >= 1)
|
||||||
|
{
|
||||||
|
if (string.Compare(parms[1], "library", true) == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
MemoryStream ms = new MemoryStream();
|
||||||
|
saveInventoryToStream(_inventory, ms);
|
||||||
|
|
||||||
|
result = ms.GetBuffer();
|
||||||
|
Array.Resize<byte>(ref result, (int)ms.Length);
|
||||||
|
}
|
||||||
|
else if (string.Compare(parms[1], "user", true) == 0)
|
||||||
|
{
|
||||||
|
if (parms.Length >= 2)
|
||||||
|
{
|
||||||
|
result = GetUserInventory(new LLUUID(parms[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -31,48 +31,71 @@ using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.User;
|
|
||||||
using OpenSim.Framework.Sims;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Inventory;
|
|
||||||
using OpenSim.Framework.Interfaces;
|
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Utilities;
|
|
||||||
|
|
||||||
namespace OpenGridServices.InventoryServer
|
using InventoryManager = OpenSim.Grid.InventoryServer.InventoryManager;
|
||||||
|
|
||||||
|
namespace OpenSim.Grid.InventoryServer
|
||||||
{
|
{
|
||||||
public class OpenInventory_Main : BaseServer, conscmd_callback
|
public class OpenInventory_Main : conscmd_callback
|
||||||
{
|
{
|
||||||
ConsoleBase m_console;
|
LogBase m_console;
|
||||||
InventoryManager m_inventoryManager;
|
InventoryManager m_inventoryManager;
|
||||||
|
InventoryConfig m_config;
|
||||||
|
|
||||||
|
public const string LogName = "INVENTORY";
|
||||||
|
|
||||||
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
OpenInventory_Main theServer = new OpenInventory_Main();
|
||||||
|
theServer.Startup();
|
||||||
|
|
||||||
|
theServer.Work();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenInventory_Main()
|
public OpenInventory_Main()
|
||||||
{
|
{
|
||||||
m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
|
m_console = new LogBase("opengrid-inventory-console.log", LogName, this, true);
|
||||||
MainConsole.Instance = m_console;
|
MainLog.Instance = m_console;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Startup()
|
public void Startup()
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Notice("Initialising inventory manager...");
|
MainLog.Instance.Notice("Initialising inventory manager...");
|
||||||
|
m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
|
||||||
|
|
||||||
m_inventoryManager = new InventoryManager();
|
m_inventoryManager = new InventoryManager();
|
||||||
|
m_inventoryManager.AddDatabasePlugin(m_config.DatabaseProvider);
|
||||||
|
MainLog.Instance.Notice(LogName, "Starting HTTP server ...");
|
||||||
|
BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort);
|
||||||
|
|
||||||
MainConsole.Instance.Notice("Starting HTTP server");
|
httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager));
|
||||||
BaseHttpServer httpServer = new BaseHttpServer(8004);
|
|
||||||
|
|
||||||
httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest);
|
httpServer.Start();
|
||||||
//httpServer.AddRestHandler("GET","/rootfolders/",Rest
|
MainLog.Instance.Notice(LogName, "Started HTTP server");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Work()
|
||||||
|
{
|
||||||
|
m_console.Notice("Enter help for a list of commands\n");
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
m_console.MainLogPrompt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunCmd(string cmd, string[] cmdparams)
|
public void RunCmd(string cmd, string[] cmdparams)
|
||||||
{
|
{
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
|
case "quit":
|
||||||
case "shutdown":
|
case "shutdown":
|
||||||
m_console.Close();
|
m_console.Close();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
|
|
|
@ -175,6 +175,7 @@ namespace OpenSim
|
||||||
config.Set("user_send_key", "null");
|
config.Set("user_send_key", "null");
|
||||||
config.Set("user_recv_key", "null");
|
config.Set("user_recv_key", "null");
|
||||||
config.Set("asset_server_url", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString());
|
config.Set("asset_server_url", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString());
|
||||||
|
config.Set("inventory_server_url", "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
m_gridService = gridInterComms;
|
m_gridService = gridInterComms;
|
||||||
m_interRegion = gridInterComms;
|
m_interRegion = gridInterComms;
|
||||||
|
|
||||||
m_inventoryService = new OGS1InventoryService();
|
m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL);
|
||||||
m_userService = new OGS1UserServices(this);
|
m_userService = new OGS1UserServices(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml.Serialization;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -36,8 +38,11 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
{
|
{
|
||||||
public class OGS1InventoryService : IInventoryServices
|
public class OGS1InventoryService : IInventoryServices
|
||||||
{
|
{
|
||||||
public OGS1InventoryService()
|
string _inventoryServerUrl;
|
||||||
|
|
||||||
|
public OGS1InventoryService(string inventoryServerUrl)
|
||||||
{
|
{
|
||||||
|
_inventoryServerUrl = inventoryServerUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IInventoryServices Members
|
#region IInventoryServices Members
|
||||||
|
@ -45,6 +50,19 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
|
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
|
||||||
InventoryItemInfo itemCallBack)
|
InventoryItemInfo itemCallBack)
|
||||||
{
|
{
|
||||||
|
//TODO! Uncomment when all is done
|
||||||
|
//SerializableInventory userInventory = null;
|
||||||
|
|
||||||
|
//RestClient inventoryServer = new RestClient(_inventoryServerUrl);
|
||||||
|
//inventoryServer.AddResourcePath("inventory");
|
||||||
|
//inventoryServer.AddResourcePath("user");
|
||||||
|
//inventoryServer.AddResourcePath(userID.ToStringHyphenated());
|
||||||
|
|
||||||
|
//using (Stream userInventoryStream = inventoryServer.Request())
|
||||||
|
//{
|
||||||
|
// XmlSerializer x = new XmlSerializer(typeof(SerializableInventory));
|
||||||
|
// userInventory = (SerializableInventory)x.Deserialize(userInventoryStream);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder)
|
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder)
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<inventory>
|
||||||
|
<folder>
|
||||||
|
<name>My Inventory</name>
|
||||||
|
<folderID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<type>9</type>
|
||||||
|
<folders>
|
||||||
|
<folder>
|
||||||
|
<name>Animations</name>
|
||||||
|
<type>20</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Body Parts</name>
|
||||||
|
<type>13</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Clothing</name>
|
||||||
|
<type>5</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Gestures</name>
|
||||||
|
<type>21</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Landmarks</name>
|
||||||
|
<type>3</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Lost And Found</name>
|
||||||
|
<type>16</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Notecards</name>
|
||||||
|
<type>7</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Objects</name>
|
||||||
|
<type>6</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Photo Album</name>
|
||||||
|
<type>15</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Scripts</name>
|
||||||
|
<type>10</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Sounds</name>
|
||||||
|
<type>1</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Textures</name>
|
||||||
|
<type>0</type>
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Trash</name>
|
||||||
|
<type>14</type>
|
||||||
|
</folder>
|
||||||
|
</folders>
|
||||||
|
</folder>
|
||||||
|
</inventory>
|
|
@ -0,0 +1,144 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<inventory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<folder>
|
||||||
|
<name>Library</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000000-0000-0000-0000-000000000000" />
|
||||||
|
<folderID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<type>9</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders>
|
||||||
|
<folder>
|
||||||
|
<name>Animations</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="d052e0a1-0bf7-4f2a-8982-472df8e4d226" />
|
||||||
|
<type>20</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Body Parts</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="52abdfa6-d50f-4743-b7db-b37f97857941" />
|
||||||
|
<type>13</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Clothing</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="5820e65c-eaa9-4404-a2bc-4c63fec47c83" />
|
||||||
|
<type>5</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Gestures</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="530e1f34-14fa-4129-a373-e4ee65249b78" />
|
||||||
|
<type>21</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Landmarks</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="a1419cef-d7d7-476e-a088-165c747532a2" />
|
||||||
|
<type>3</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Lost And Found</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="62c88a03-838c-4822-b912-10e4a9b831c5" />
|
||||||
|
<type>3</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Notecards</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="b61598ea-2312-49f9-9b1c-5214ba55facc" />
|
||||||
|
<type>7</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Objects</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="ff757447-ea4d-4769-8751-e3bb13cd570d" />
|
||||||
|
<type>6</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Photo Album</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="d6cadddd-68e1-4fc3-bd24-319cd593fdc0" />
|
||||||
|
<type>15</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Scripts</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="f0e2c3dc-3f44-4730-8b33-6a911994fea1" />
|
||||||
|
<type>10</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Sounds</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="b8815d3c-52b0-447c-adea-3a1a442dbb2b" />
|
||||||
|
<type>1</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Textures</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="23e487c5-43af-4fe6-b211-75cfc91845a6" />
|
||||||
|
<type>0</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
<folder>
|
||||||
|
<name>Accessories</name>
|
||||||
|
<agentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<parentID UUID="00000112-000f-0000-0000-000100bba000" />
|
||||||
|
<folderID UUID="b4024e1c-9b1d-426e-a70e-55ae0078dc0b" />
|
||||||
|
<type>8</type>
|
||||||
|
<version>0</version>
|
||||||
|
<folders />
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
</folders>
|
||||||
|
<items />
|
||||||
|
</folder>
|
||||||
|
</inventory>
|
29
prebuild.xml
29
prebuild.xml
|
@ -846,6 +846,34 @@
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</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="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"/>
|
||||||
|
|
||||||
|
<Files>
|
||||||
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
</Files>
|
||||||
|
</Project>
|
||||||
|
|
||||||
<Project name="OpenSim.Region.ScriptEngine.Common" path="OpenSim/Region/ScriptEngine/Common" type="Library">
|
<Project name="OpenSim.Region.ScriptEngine.Common" path="OpenSim/Region/ScriptEngine/Common" type="Library">
|
||||||
<Configuration name="Debug">
|
<Configuration name="Debug">
|
||||||
<Options>
|
<Options>
|
||||||
|
@ -1054,3 +1082,4 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue