diff --git a/OpenGridServices.InventoryServer/InventoryManager.cs b/OpenGridServices.InventoryServer/InventoryManager.cs new file mode 100644 index 0000000000..01fd825beb --- /dev/null +++ b/OpenGridServices.InventoryServer/InventoryManager.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using OpenGrid.Framework.Data; +using libsecondlife; +using System.Reflection; + +using System.Xml; +using Nwc.XmlRpc; +using OpenSim.Framework.Sims; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Utilities; + +using System.Security.Cryptography; + +namespace OpenGridServices.InventoryServer +{ + class InventoryManager + { + 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 AddPlugin(string FileName) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Attempting to load " + FileName); + Assembly pluginAssembly = Assembly.LoadFrom(FileName); + + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IInventoryData", true); + + if (typeInterface != null) + { + IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug.Initialise(); + this._plugins.Add(plug.getName(), plug); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Added IUserData Interface"); + } + + typeInterface = null; + } + } + + pluginAssembly = null; + } + + public List getRootFolders(LLUUID user) + { + foreach (KeyValuePair kvp in _plugins) + { + try + { + return kvp.Value.getUserRootFolders(user); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); + } + } + } + + public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + + Hashtable responseData = new Hashtable(); + + // Stuff happens here + + if (requestData.ContainsKey("Access-type")) + { + if (requestData["access-type"] == "rootfolders") + { +// responseData["rootfolders"] = + } + } + else + { + responseData["error"] = "No access-type specified."; + } + + + // Stuff stops happening here + + response.Value = responseData; + return response; + } + } +} diff --git a/OpenGridServices.InventoryServer/Main.cs b/OpenGridServices.InventoryServer/Main.cs new file mode 100644 index 0000000000..14b6f85949 --- /dev/null +++ b/OpenGridServices.InventoryServer/Main.cs @@ -0,0 +1,60 @@ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using System.IO; +using System.Text; +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; + +namespace OpenGridServices.InventoryServer +{ + public class OpenInventory_Main : BaseServer, conscmd_callback + { + ConsoleBase m_console; + InventoryManager m_inventoryManager; + + public static void Main(string[] args) + { + } + + public OpenInventory_Main() + { + m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false); + MainConsole.Instance = m_console; + } + + public void Startup() + { + MainConsole.Instance.WriteLine("Initialising inventory manager..."); + m_inventoryManager = new InventoryManager(); + + MainConsole.Instance.WriteLine("Starting HTTP server"); + BaseHttpServer httpServer = new BaseHttpServer(8004); + + //httpServer.AddRestHandler("GET","/rootfolders/",Rest + } + + public void RunCmd(string cmd, string[] cmdparams) + { + switch (cmd) + { + case "shutdown": + m_console.Close(); + Environment.Exit(0); + break; + } + } + + public void Show(string ShowWhat) + { + } + } +} diff --git a/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj b/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj new file mode 100644 index 0000000000..4cfab2f55f --- /dev/null +++ b/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj @@ -0,0 +1,78 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {596B9D58-F27D-430B-99D2-4C1B95F74A76} + Exe + Properties + OpenGridServices.InventoryServer + OpenGridServices.InventoryServer + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\bin\libsecondlife.dll + + + False + ..\bin\OpenSim.Framework.dll + + + False + ..\bin\OpenSim.Framework.Console.dll + + + False + ..\bin\OpenSim.Servers.dll + + + + + + False + ..\bin\XMLRPC.dll + + + + + + + + + + {62CDF671-0000-0000-0000-000000000000} + OpenGrid.Framework.Data + + + {7924FD35-0000-0000-0000-000000000000} + OpenGrid.Framework.Manager + + + + + \ No newline at end of file diff --git a/OpenGridServices.InventoryServer/Properties/AssemblyInfo.cs b/OpenGridServices.InventoryServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..ba8dc8b17d --- /dev/null +++ b/OpenGridServices.InventoryServer/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenGridServices.InventoryServer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenGridServices.InventoryServer")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d410d983-9489-46db-ac77-a7470291c01d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]