aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/InventoryServer/InventoryManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/InventoryServer/InventoryManager.cs')
-rw-r--r--OpenSim/Grid/InventoryServer/InventoryManager.cs131
1 files changed, 46 insertions, 85 deletions
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs
index a46f359..016b8bb 100644
--- a/OpenSim/Grid/InventoryServer/InventoryManager.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs
@@ -26,34 +26,37 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Text;
30using System.Reflection;
31using System.Collections; 29using System.Collections;
32using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using OpenGrid.Framework.Data;
33using libsecondlife; 33using libsecondlife;
34using System.Reflection;
34 35
35using System.Xml; 36using System.Xml;
36using OpenSim.Framework.Console; 37using Nwc.XmlRpc;
38using OpenSim.Framework.Sims;
39using OpenSim.Framework.Inventory;
37using OpenSim.Framework.Utilities; 40using OpenSim.Framework.Utilities;
38using OpenSim.Framework.Data;
39using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
40 41
41namespace OpenSim.Grid.InventoryServer 42using System.Security.Cryptography;
43
44namespace OpenGridServices.InventoryServer
42{ 45{
43 class InventoryManager : IInventoryData 46 class InventoryManager
44 { 47 {
45 IInventoryData _databasePlugin; 48 Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>();
46 49
47 /// <summary> 50 /// <summary>
48 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. 51 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
49 /// </summary> 52 /// </summary>
50 /// <param name="FileName">The filename to the inventory server plugin DLL</param> 53 /// <param name="FileName">The filename to the inventory server plugin DLL</param>
51 public void AddDatabasePlugin(string FileName) 54 public void AddPlugin(string FileName)
52 { 55 {
53 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Attempting to load " + FileName); 56 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName);
54 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 57 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
55 58
56 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 59 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
57 foreach (Type pluginType in pluginAssembly.GetTypes()) 60 foreach (Type pluginType in pluginAssembly.GetTypes())
58 { 61 {
59 if (!pluginType.IsAbstract) 62 if (!pluginType.IsAbstract)
@@ -64,9 +67,8 @@ namespace OpenSim.Grid.InventoryServer
64 { 67 {
65 IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
66 plug.Initialise(); 69 plug.Initialise();
67 _databasePlugin = plug; 70 this._plugins.Add(plug.getName(), plug);
68 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Invenstorage: Added IInventoryData Interface"); 71 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface");
69 break;
70 } 72 }
71 73
72 typeInterface = null; 74 typeInterface = null;
@@ -78,87 +80,46 @@ namespace OpenSim.Grid.InventoryServer
78 80
79 public List<InventoryFolderBase> getRootFolders(LLUUID user) 81 public List<InventoryFolderBase> getRootFolders(LLUUID user)
80 { 82 {
83 foreach (KeyValuePair<string, IInventoryData> kvp in _plugins)
84 {
85 try
86 {
87 return kvp.Value.getUserRootFolders(user);
88 }
89 catch (Exception e)
90 {
91 OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")");
92 }
93 }
81 return null; 94 return null;
82 } 95 }
83 96
84 #region IInventoryData Members 97 public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
85
86
87 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
88 {
89 return _databasePlugin.getInventoryInFolder(folderID);
90 }
91
92 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
93 {
94 return _databasePlugin.getUserRootFolders(user);
95 }
96
97 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
98 {
99 return _databasePlugin.getInventoryFolders(parentID);
100 }
101
102 public InventoryItemBase getInventoryItem(LLUUID item)
103 {
104 throw new Exception("The method or operation is not implemented.");
105 }
106
107 public InventoryFolderBase getInventoryFolder(LLUUID folder)
108 {
109 return _databasePlugin.getInventoryFolder(folder);
110 }
111
112 public void addInventoryItem(InventoryItemBase item)
113 { 98 {
114 _databasePlugin.addInventoryItem(item); 99 XmlRpcResponse response = new XmlRpcResponse();
115 } 100 Hashtable requestData = (Hashtable)request.Params[0];
116
117 public void updateInventoryItem(InventoryItemBase item)
118 {
119 throw new Exception("The method or operation is not implemented.");
120 }
121
122 public void deleteInventoryItem(InventoryItemBase item)
123 {
124 throw new Exception("The method or operation is not implemented.");
125 }
126 101
127 public void addInventoryFolder(InventoryFolderBase folder) 102 Hashtable responseData = new Hashtable();
128 {
129 _databasePlugin.addInventoryFolder(folder);
130 }
131 103
132 public void updateInventoryFolder(InventoryFolderBase folder) 104 // Stuff happens here
133 {
134 throw new Exception("The method or operation is not implemented.");
135 }
136
137 public void Initialise()
138 {
139 throw new Exception("The method or operation is not implemented.");
140 }
141 105
142 public void Close() 106 if (requestData.ContainsKey("Access-type"))
143 { 107 {
144 throw new Exception("The method or operation is not implemented."); 108 if (requestData["access-type"] == "rootfolders")
145 } 109 {
110// responseData["rootfolders"] =
111 }
112 }
113 else
114 {
115 responseData["error"] = "No access-type specified.";
116 }
146 117
147 public string getName()
148 {
149 throw new Exception("The method or operation is not implemented.");
150 }
151 118
152 public string getVersion() 119 // Stuff stops happening here
153 {
154 throw new Exception("The method or operation is not implemented.");
155 }
156 120
157 public void deleteInventoryCategory(InventoryCategory inventoryCategory) 121 response.Value = responseData;
158 { 122 return response;
159 _databasePlugin.deleteInventoryCategory(inventoryCategory);
160 } 123 }
161
162 #endregion
163 } 124 }
164} 125}