aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices.InventoryServer/InventoryManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenGridServices.InventoryServer/InventoryManager.cs97
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 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using OpenGrid.Framework.Data;
6using libsecondlife;
7using System.Reflection;
8
9using System.Xml;
10using Nwc.XmlRpc;
11using OpenSim.Framework.Sims;
12using OpenSim.Framework.Inventory;
13using OpenSim.Framework.Utilities;
14
15using System.Security.Cryptography;
16
17namespace 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}