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