diff options
author | Adam Frisby | 2007-06-01 20:21:00 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-01 20:21:00 +0000 |
commit | aba0f0774c32abf3dfbe837585354aaea9ebcede (patch) | |
tree | 5f5d11602ada5a369b06f46ecf77c9d6ede4b7d4 /OpenGridServices.InventoryServer/InventoryManager.cs | |
parent | * MySQL Inventory data interfaces written - can now write an inventory server... (diff) | |
download | opensim-SC-aba0f0774c32abf3dfbe837585354aaea9ebcede.zip opensim-SC-aba0f0774c32abf3dfbe837585354aaea9ebcede.tar.gz opensim-SC-aba0f0774c32abf3dfbe837585354aaea9ebcede.tar.bz2 opensim-SC-aba0f0774c32abf3dfbe837585354aaea9ebcede.tar.xz |
* Zomg inventory server (incomplete shell)
Diffstat (limited to '')
-rw-r--r-- | OpenGridServices.InventoryServer/InventoryManager.cs | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/OpenGridServices.InventoryServer/InventoryManager.cs b/OpenGridServices.InventoryServer/InventoryManager.cs new file mode 100644 index 0000000..01fd825 --- /dev/null +++ b/OpenGridServices.InventoryServer/InventoryManager.cs | |||
@@ -0,0 +1,97 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using OpenGrid.Framework.Data; | ||
6 | using libsecondlife; | ||
7 | using System.Reflection; | ||
8 | |||
9 | using System.Xml; | ||
10 | using Nwc.XmlRpc; | ||
11 | using OpenSim.Framework.Sims; | ||
12 | using OpenSim.Framework.Inventory; | ||
13 | using OpenSim.Framework.Utilities; | ||
14 | |||
15 | using System.Security.Cryptography; | ||
16 | |||
17 | namespace OpenGridServices.InventoryServer | ||
18 | { | ||
19 | class InventoryManager | ||
20 | { | ||
21 | Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>(); | ||
22 | |||
23 | /// <summary> | ||
24 | /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. | ||
25 | /// </summary> | ||
26 | /// <param name="FileName">The filename to the inventory server plugin DLL</param> | ||
27 | public void AddPlugin(string FileName) | ||
28 | { | ||
29 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Attempting to load " + FileName); | ||
30 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
31 | |||
32 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | ||
33 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
34 | { | ||
35 | if (!pluginType.IsAbstract) | ||
36 | { | ||
37 | Type typeInterface = pluginType.GetInterface("IInventoryData", true); | ||
38 | |||
39 | if (typeInterface != null) | ||
40 | { | ||
41 | IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
42 | plug.Initialise(); | ||
43 | this._plugins.Add(plug.getName(), plug); | ||
44 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Added IUserData Interface"); | ||
45 | } | ||
46 | |||
47 | typeInterface = null; | ||
48 | } | ||
49 | } | ||
50 | |||
51 | pluginAssembly = null; | ||
52 | } | ||
53 | |||
54 | public List<InventoryFolderBase> getRootFolders(LLUUID user) | ||
55 | { | ||
56 | foreach (KeyValuePair<string, IInventoryData> kvp in _plugins) | ||
57 | { | ||
58 | try | ||
59 | { | ||
60 | return kvp.Value.getUserRootFolders(user); | ||
61 | } | ||
62 | catch (Exception e) | ||
63 | { | ||
64 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) | ||
70 | { | ||
71 | XmlRpcResponse response = new XmlRpcResponse(); | ||
72 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
73 | |||
74 | Hashtable responseData = new Hashtable(); | ||
75 | |||
76 | // Stuff happens here | ||
77 | |||
78 | if (requestData.ContainsKey("Access-type")) | ||
79 | { | ||
80 | if (requestData["access-type"] == "rootfolders") | ||
81 | { | ||
82 | // responseData["rootfolders"] = | ||
83 | } | ||
84 | } | ||
85 | else | ||
86 | { | ||
87 | responseData["error"] = "No access-type specified."; | ||
88 | } | ||
89 | |||
90 | |||
91 | // Stuff stops happening here | ||
92 | |||
93 | response.Value = responseData; | ||
94 | return response; | ||
95 | } | ||
96 | } | ||
97 | } | ||