diff options
author | Adam Frisby | 2007-06-05 20:22:10 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-05 20:22:10 +0000 |
commit | 65268a51ca094cd4510f5e30d0f15602bff1e4ee (patch) | |
tree | 7871474d60e03cc64c4033e2b46f983a5e362bbc /OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs | |
parent | * Fixed OGS build (diff) | |
download | opensim-SC_OLD-65268a51ca094cd4510f5e30d0f15602bff1e4ee.zip opensim-SC_OLD-65268a51ca094cd4510f5e30d0f15602bff1e4ee.tar.gz opensim-SC_OLD-65268a51ca094cd4510f5e30d0f15602bff1e4ee.tar.bz2 opensim-SC_OLD-65268a51ca094cd4510f5e30d0f15602bff1e4ee.tar.xz |
* Weird didnt commit inventory before
Diffstat (limited to '')
-rw-r--r-- | OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs b/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs new file mode 100644 index 0000000..a16d3d2 --- /dev/null +++ b/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs | |||
@@ -0,0 +1,98 @@ | |||
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.Verbose( "Invenstorage: Attempting to load " + FileName); | ||
30 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
31 | |||
32 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "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.Verbose( "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.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); | ||
65 | } | ||
66 | } | ||
67 | return null; | ||
68 | } | ||
69 | |||
70 | public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) | ||
71 | { | ||
72 | XmlRpcResponse response = new XmlRpcResponse(); | ||
73 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
74 | |||
75 | Hashtable responseData = new Hashtable(); | ||
76 | |||
77 | // Stuff happens here | ||
78 | |||
79 | if (requestData.ContainsKey("Access-type")) | ||
80 | { | ||
81 | if (requestData["access-type"] == "rootfolders") | ||
82 | { | ||
83 | // responseData["rootfolders"] = | ||
84 | } | ||
85 | } | ||
86 | else | ||
87 | { | ||
88 | responseData["error"] = "No access-type specified."; | ||
89 | } | ||
90 | |||
91 | |||
92 | // Stuff stops happening here | ||
93 | |||
94 | response.Value = responseData; | ||
95 | return response; | ||
96 | } | ||
97 | } | ||
98 | } | ||