diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs | 286 |
1 files changed, 0 insertions, 286 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs deleted file mode 100644 index 750f1cb..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs +++ /dev/null | |||
@@ -1,286 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | |||
31 | using System; | ||
32 | using System.Collections.Generic; | ||
33 | using System.Reflection; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Data; | ||
36 | using OpenSim.Server.Base; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | |||
43 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | ||
44 | { | ||
45 | public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService | ||
46 | { | ||
47 | private static readonly ILog m_log = | ||
48 | LogManager.GetLogger( | ||
49 | MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private IInventoryService m_InventoryService; | ||
52 | |||
53 | private bool m_Enabled = false; | ||
54 | private bool m_Initialized = false; | ||
55 | |||
56 | public string Name | ||
57 | { | ||
58 | get { return "LocalInventoryServicesConnector"; } | ||
59 | } | ||
60 | |||
61 | public void Initialise(IConfigSource source) | ||
62 | { | ||
63 | IConfig moduleConfig = source.Configs["Modules"]; | ||
64 | if (moduleConfig != null) | ||
65 | { | ||
66 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
67 | if (name == Name) | ||
68 | { | ||
69 | IConfig inventoryConfig = source.Configs["InventoryService"]; | ||
70 | if (inventoryConfig == null) | ||
71 | { | ||
72 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
73 | return; | ||
74 | } | ||
75 | |||
76 | string serviceDll = inventoryConfig.GetString("LocalServiceModule", String.Empty); | ||
77 | |||
78 | if (serviceDll == String.Empty) | ||
79 | { | ||
80 | m_log.Error("[INVENTORY CONNECTOR]: No LocalServiceModule named in section InventoryService"); | ||
81 | return; | ||
82 | } | ||
83 | |||
84 | Object[] args = new Object[] { source }; | ||
85 | m_log.DebugFormat("[INVENTORY CONNECTOR]: Service dll = {0}", serviceDll); | ||
86 | |||
87 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(serviceDll, args); | ||
88 | |||
89 | if (m_InventoryService == null) | ||
90 | { | ||
91 | m_log.Error("[INVENTORY CONNECTOR]: Can't load inventory service"); | ||
92 | //return; | ||
93 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
94 | } | ||
95 | |||
96 | //List<IInventoryDataPlugin> plugins | ||
97 | // = DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>( | ||
98 | // configSettings.StandaloneInventoryPlugin, | ||
99 | // configSettings.StandaloneInventorySource); | ||
100 | |||
101 | //foreach (IInventoryDataPlugin plugin in plugins) | ||
102 | //{ | ||
103 | // // Using the OSP wrapper plugin for database plugins should be made configurable at some point | ||
104 | // m_InventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this)); | ||
105 | //} | ||
106 | |||
107 | m_Enabled = true; | ||
108 | m_log.Info("[INVENTORY CONNECTOR]: Local inventory connector enabled"); | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | public void PostInitialise() | ||
114 | { | ||
115 | } | ||
116 | |||
117 | public void Close() | ||
118 | { | ||
119 | } | ||
120 | |||
121 | public void AddRegion(Scene scene) | ||
122 | { | ||
123 | if (!m_Enabled) | ||
124 | return; | ||
125 | |||
126 | if (!m_Initialized) | ||
127 | { | ||
128 | // ugh! | ||
129 | scene.CommsManager.UserProfileCacheService.SetInventoryService(this); | ||
130 | scene.CommsManager.UserService.SetInventoryService(this); | ||
131 | m_Initialized = true; | ||
132 | } | ||
133 | |||
134 | // m_log.DebugFormat( | ||
135 | // "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); | ||
136 | |||
137 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
138 | } | ||
139 | |||
140 | public void RemoveRegion(Scene scene) | ||
141 | { | ||
142 | } | ||
143 | |||
144 | public void RegionLoaded(Scene scene) | ||
145 | { | ||
146 | if (!m_Enabled) | ||
147 | return; | ||
148 | |||
149 | m_log.InfoFormat( | ||
150 | "[INVENTORY CONNECTOR]: Enabled local invnetory for region {0}", scene.RegionInfo.RegionName); | ||
151 | } | ||
152 | |||
153 | #region IInventoryService | ||
154 | |||
155 | public bool CreateUserInventory(UUID user) | ||
156 | { | ||
157 | return m_InventoryService.CreateUserInventory(user); | ||
158 | } | ||
159 | |||
160 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
161 | { | ||
162 | return m_InventoryService.GetInventorySkeleton(userId); | ||
163 | } | ||
164 | |||
165 | public InventoryCollection GetUserInventory(UUID id) | ||
166 | { | ||
167 | return m_InventoryService.GetUserInventory(id); | ||
168 | } | ||
169 | |||
170 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
171 | { | ||
172 | m_InventoryService.GetUserInventory(userID, callback); | ||
173 | } | ||
174 | |||
175 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
176 | { | ||
177 | return m_InventoryService.GetFolderItems(userID, folderID); | ||
178 | } | ||
179 | |||
180 | /// <summary> | ||
181 | /// Add a new folder to the user's inventory | ||
182 | /// </summary> | ||
183 | /// <param name="folder"></param> | ||
184 | /// <returns>true if the folder was successfully added</returns> | ||
185 | public bool AddFolder(InventoryFolderBase folder) | ||
186 | { | ||
187 | return m_InventoryService.AddFolder(folder); | ||
188 | } | ||
189 | |||
190 | /// <summary> | ||
191 | /// Update a folder in the user's inventory | ||
192 | /// </summary> | ||
193 | /// <param name="folder"></param> | ||
194 | /// <returns>true if the folder was successfully updated</returns> | ||
195 | public bool UpdateFolder(InventoryFolderBase folder) | ||
196 | { | ||
197 | return m_InventoryService.UpdateFolder(folder); | ||
198 | } | ||
199 | |||
200 | /// <summary> | ||
201 | /// Move an inventory folder to a new location | ||
202 | /// </summary> | ||
203 | /// <param name="folder">A folder containing the details of the new location</param> | ||
204 | /// <returns>true if the folder was successfully moved</returns> | ||
205 | public bool MoveFolder(InventoryFolderBase folder) | ||
206 | { | ||
207 | return m_InventoryService.MoveFolder(folder); | ||
208 | } | ||
209 | |||
210 | /// <summary> | ||
211 | /// Purge an inventory folder of all its items and subfolders. | ||
212 | /// </summary> | ||
213 | /// <param name="folder"></param> | ||
214 | /// <returns>true if the folder was successfully purged</returns> | ||
215 | public bool PurgeFolder(InventoryFolderBase folder) | ||
216 | { | ||
217 | return m_InventoryService.PurgeFolder(folder); | ||
218 | } | ||
219 | |||
220 | /// <summary> | ||
221 | /// Add a new item to the user's inventory | ||
222 | /// </summary> | ||
223 | /// <param name="item"></param> | ||
224 | /// <returns>true if the item was successfully added</returns> | ||
225 | public bool AddItem(InventoryItemBase item) | ||
226 | { | ||
227 | return m_InventoryService.AddItem(item); | ||
228 | } | ||
229 | |||
230 | /// <summary> | ||
231 | /// Update an item in the user's inventory | ||
232 | /// </summary> | ||
233 | /// <param name="item"></param> | ||
234 | /// <returns>true if the item was successfully updated</returns> | ||
235 | public bool UpdateItem(InventoryItemBase item) | ||
236 | { | ||
237 | return m_InventoryService.UpdateItem(item); | ||
238 | } | ||
239 | |||
240 | /// <summary> | ||
241 | /// Delete an item from the user's inventory | ||
242 | /// </summary> | ||
243 | /// <param name="item"></param> | ||
244 | /// <returns>true if the item was successfully deleted</returns> | ||
245 | public bool DeleteItem(InventoryItemBase item) | ||
246 | { | ||
247 | return m_InventoryService.DeleteItem(item); | ||
248 | } | ||
249 | |||
250 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
251 | { | ||
252 | return m_InventoryService.QueryItem(item); | ||
253 | } | ||
254 | |||
255 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
256 | { | ||
257 | return m_InventoryService.QueryFolder(folder); | ||
258 | } | ||
259 | |||
260 | /// <summary> | ||
261 | /// Does the given user have an inventory structure? | ||
262 | /// </summary> | ||
263 | /// <param name="userID"></param> | ||
264 | /// <returns></returns> | ||
265 | public bool HasInventoryForUser(UUID userID) | ||
266 | { | ||
267 | return m_InventoryService.HasInventoryForUser(userID); | ||
268 | } | ||
269 | |||
270 | /// <summary> | ||
271 | /// Retrieve the root inventory folder for the given user. | ||
272 | /// </summary> | ||
273 | /// <param name="userID"></param> | ||
274 | /// <returns>null if no root folder was found</returns> | ||
275 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
276 | { | ||
277 | return m_InventoryService.RequestRootFolder(userID); | ||
278 | } | ||
279 | |||
280 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
281 | { | ||
282 | return m_InventoryService.GetActiveGestures(userId); | ||
283 | } | ||
284 | #endregion IInventoryService | ||
285 | } | ||
286 | } | ||