diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | 305 |
1 files changed, 305 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs new file mode 100644 index 0000000..ac9e792 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -0,0 +1,305 @@ | |||
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 System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Statistics; | ||
35 | |||
36 | using OpenSim.Services.Connectors; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
43 | { | ||
44 | public class RemoteXInventoryServicesConnector : ISharedRegionModule, IInventoryService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private bool m_Enabled = false; | ||
50 | private bool m_Initialized = false; | ||
51 | private Scene m_Scene; | ||
52 | private XInventoryServicesConnector m_RemoteConnector; | ||
53 | |||
54 | public Type ReplaceableInterface | ||
55 | { | ||
56 | get { return null; } | ||
57 | } | ||
58 | |||
59 | public string Name | ||
60 | { | ||
61 | get { return "RemoteXInventoryServicesConnector"; } | ||
62 | } | ||
63 | |||
64 | public RemoteXInventoryServicesConnector() | ||
65 | { | ||
66 | } | ||
67 | |||
68 | public RemoteXInventoryServicesConnector(string url) | ||
69 | { | ||
70 | m_RemoteConnector = new XInventoryServicesConnector(url); | ||
71 | } | ||
72 | |||
73 | public RemoteXInventoryServicesConnector(IConfigSource source) | ||
74 | { | ||
75 | Init(source); | ||
76 | } | ||
77 | |||
78 | protected void Init(IConfigSource source) | ||
79 | { | ||
80 | m_RemoteConnector = new XInventoryServicesConnector(source); | ||
81 | } | ||
82 | |||
83 | |||
84 | #region ISharedRegionModule | ||
85 | |||
86 | public void Initialise(IConfigSource source) | ||
87 | { | ||
88 | IConfig moduleConfig = source.Configs["Modules"]; | ||
89 | if (moduleConfig != null) | ||
90 | { | ||
91 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
92 | if (name == Name) | ||
93 | { | ||
94 | Init(source); | ||
95 | m_Enabled = true; | ||
96 | |||
97 | m_log.Info("[XINVENTORY CONNECTOR]: Remote XInventory enabled"); | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public void PostInitialise() | ||
103 | { | ||
104 | } | ||
105 | |||
106 | public void Close() | ||
107 | { | ||
108 | } | ||
109 | |||
110 | public void AddRegion(Scene scene) | ||
111 | { | ||
112 | m_Scene = scene; | ||
113 | //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); | ||
114 | |||
115 | if (!m_Enabled) | ||
116 | return; | ||
117 | |||
118 | if (!m_Initialized) | ||
119 | { | ||
120 | m_Initialized = true; | ||
121 | } | ||
122 | |||
123 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
124 | } | ||
125 | |||
126 | public void RemoveRegion(Scene scene) | ||
127 | { | ||
128 | if (!m_Enabled) | ||
129 | return; | ||
130 | |||
131 | } | ||
132 | |||
133 | public void RegionLoaded(Scene scene) | ||
134 | { | ||
135 | if (!m_Enabled) | ||
136 | return; | ||
137 | |||
138 | m_log.InfoFormat("[XINVENTORY CONNECTOR]: Enabled remote XInventory for region {0}", scene.RegionInfo.RegionName); | ||
139 | |||
140 | } | ||
141 | |||
142 | #endregion ISharedRegionModule | ||
143 | |||
144 | #region IInventoryService | ||
145 | |||
146 | public bool CreateUserInventory(UUID user) | ||
147 | { | ||
148 | return false; | ||
149 | } | ||
150 | |||
151 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
152 | { | ||
153 | return new List<InventoryFolderBase>(); | ||
154 | } | ||
155 | |||
156 | public InventoryCollection GetUserInventory(UUID userID) | ||
157 | { | ||
158 | return null; | ||
159 | } | ||
160 | |||
161 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
162 | { | ||
163 | } | ||
164 | |||
165 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
166 | { | ||
167 | return m_RemoteConnector.GetRootFolder(userID); | ||
168 | } | ||
169 | |||
170 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
171 | { | ||
172 | return m_RemoteConnector.GetFolderForType(userID, type); | ||
173 | } | ||
174 | |||
175 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
176 | { | ||
177 | return m_RemoteConnector.GetSystemFolders(userID); | ||
178 | } | ||
179 | |||
180 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
181 | { | ||
182 | return m_RemoteConnector.GetFolderContent(userID, folderID); | ||
183 | } | ||
184 | |||
185 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
186 | { | ||
187 | return m_RemoteConnector.GetFolderItems(userID, folderID); | ||
188 | } | ||
189 | |||
190 | public bool AddFolder(InventoryFolderBase folder) | ||
191 | { | ||
192 | if (folder == null) | ||
193 | return false; | ||
194 | |||
195 | return m_RemoteConnector.AddFolder(folder); | ||
196 | } | ||
197 | |||
198 | public bool UpdateFolder(InventoryFolderBase folder) | ||
199 | { | ||
200 | if (folder == null) | ||
201 | return false; | ||
202 | |||
203 | return m_RemoteConnector.UpdateFolder(folder); | ||
204 | } | ||
205 | |||
206 | public bool MoveFolder(InventoryFolderBase folder) | ||
207 | { | ||
208 | if (folder == null) | ||
209 | return false; | ||
210 | |||
211 | return m_RemoteConnector.MoveFolder(folder); | ||
212 | } | ||
213 | |||
214 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
215 | { | ||
216 | if (folderIDs == null) | ||
217 | return false; | ||
218 | if (folderIDs.Count == 0) | ||
219 | return false; | ||
220 | |||
221 | return m_RemoteConnector.DeleteFolders(ownerID, folderIDs); | ||
222 | } | ||
223 | |||
224 | |||
225 | public bool PurgeFolder(InventoryFolderBase folder) | ||
226 | { | ||
227 | if (folder == null) | ||
228 | return false; | ||
229 | |||
230 | return m_RemoteConnector.PurgeFolder(folder); | ||
231 | } | ||
232 | |||
233 | public bool AddItem(InventoryItemBase item) | ||
234 | { | ||
235 | if (item == null) | ||
236 | return false; | ||
237 | |||
238 | return m_RemoteConnector.AddItem(item); | ||
239 | } | ||
240 | |||
241 | public bool UpdateItem(InventoryItemBase item) | ||
242 | { | ||
243 | if (item == null) | ||
244 | return false; | ||
245 | |||
246 | return m_RemoteConnector.UpdateItem(item); | ||
247 | } | ||
248 | |||
249 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
250 | { | ||
251 | if (items == null) | ||
252 | return false; | ||
253 | |||
254 | return m_RemoteConnector.MoveItems(ownerID, items); | ||
255 | } | ||
256 | |||
257 | |||
258 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
259 | { | ||
260 | if (itemIDs == null) | ||
261 | return false; | ||
262 | if (itemIDs.Count == 0) | ||
263 | return true; | ||
264 | |||
265 | return m_RemoteConnector.DeleteItems(ownerID, itemIDs); | ||
266 | } | ||
267 | |||
268 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
269 | { | ||
270 | if (item == null) | ||
271 | return null; | ||
272 | |||
273 | return m_RemoteConnector.GetItem(item); | ||
274 | } | ||
275 | |||
276 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
277 | { | ||
278 | m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); | ||
279 | if (folder == null) | ||
280 | return null; | ||
281 | |||
282 | return m_RemoteConnector.GetFolder(folder); | ||
283 | } | ||
284 | |||
285 | public bool HasInventoryForUser(UUID userID) | ||
286 | { | ||
287 | return false; | ||
288 | } | ||
289 | |||
290 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
291 | { | ||
292 | return new List<InventoryItemBase>(); | ||
293 | } | ||
294 | |||
295 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
296 | { | ||
297 | return m_RemoteConnector.GetAssetPermissions(userID, assetID); | ||
298 | } | ||
299 | |||
300 | |||
301 | #endregion | ||
302 | |||
303 | |||
304 | } | ||
305 | } | ||