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