aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs98
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 @@
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.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}