aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2010-04-27 03:49:25 +0100
committerMelanie2010-04-27 03:49:25 +0100
commita92ca3c2c95cfe31b2dc7d8cc49a4ce01d9a38d8 (patch)
tree1f572d5e1e4599d1d7e5dabf0aff2a7ac011c987 /OpenSim/Region
parentAllow a client to pass a scope id to log into in the login XML / LLSD (diff)
parentRemoteXInventoryServiceConnector, the plugin region module. Not active in def... (diff)
downloadopensim-SC_OLD-a92ca3c2c95cfe31b2dc7d8cc49a4ce01d9a38d8.zip
opensim-SC_OLD-a92ca3c2c95cfe31b2dc7d8cc49a4ce01d9a38d8.tar.gz
opensim-SC_OLD-a92ca3c2c95cfe31b2dc7d8cc49a4ce01d9a38d8.tar.bz2
opensim-SC_OLD-a92ca3c2c95cfe31b2dc7d8cc49a4ce01d9a38d8.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs324
1 files changed, 324 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..fb353c2
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -0,0 +1,324 @@
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
28using log4net;
29using System;
30using System.Collections.Generic;
31using System.Reflection;
32using Nini.Config;
33using OpenSim.Framework;
34using OpenSim.Framework.Statistics;
35
36using OpenSim.Services.Connectors;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces;
40using OpenMetaverse;
41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
43{
44 public class RemoteXInventoryServicesConnector : BaseInventoryConnector, 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(IConfigSource source)
69 {
70 Init(source);
71 }
72
73 protected override void Init(IConfigSource source)
74 {
75 m_RemoteConnector = new XInventoryServicesConnector(source);
76 base.Init(source);
77 }
78
79
80 #region ISharedRegionModule
81
82 public void Initialise(IConfigSource source)
83 {
84 IConfig moduleConfig = source.Configs["Modules"];
85 if (moduleConfig != null)
86 {
87 string name = moduleConfig.GetString("InventoryServices", "");
88 if (name == Name)
89 {
90 Init(source);
91 m_Enabled = true;
92
93 m_log.Info("[XINVENTORY CONNECTOR]: Remote XInventory enabled");
94 }
95 }
96 }
97
98 public void PostInitialise()
99 {
100 }
101
102 public void Close()
103 {
104 }
105
106 public void AddRegion(Scene scene)
107 {
108 m_Scene = scene;
109 //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName);
110
111 if (!m_Enabled)
112 return;
113
114 if (!m_Initialized)
115 {
116 m_Initialized = true;
117 }
118
119 scene.RegisterModuleInterface<IInventoryService>(this);
120 m_cache.AddRegion(scene);
121 }
122
123 public void RemoveRegion(Scene scene)
124 {
125 if (!m_Enabled)
126 return;
127
128 m_cache.RemoveRegion(scene);
129 }
130
131 public void RegionLoaded(Scene scene)
132 {
133 if (!m_Enabled)
134 return;
135
136 m_log.InfoFormat("[XINVENTORY CONNECTOR]: Enabled remote XInventory for region {0}", scene.RegionInfo.RegionName);
137
138 }
139
140 #endregion ISharedRegionModule
141
142 #region IInventoryService
143
144 public override bool CreateUserInventory(UUID user)
145 {
146 return false;
147 }
148
149 public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
150 {
151 return new List<InventoryFolderBase>();
152 }
153
154 public override InventoryCollection GetUserInventory(UUID userID)
155 {
156 return null;
157 }
158
159 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
160 {
161 try
162 {
163 m_RemoteConnector.GetUserInventory(userID, callback);
164 }
165 catch (Exception e)
166 {
167 if (StatsManager.SimExtraStats != null)
168 StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure();
169
170 m_log.ErrorFormat("[XINVENTORY CONNECTOR]: Request inventory operation failed, {0} {1}",
171 e.Source, e.Message);
172 }
173
174 }
175
176 // inherited. See base class
177 // public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
178
179 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
180 {
181 return m_RemoteConnector.GetSystemFolders(userID);
182 }
183
184 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
185 {
186 try
187 {
188 return m_RemoteConnector.GetFolderContent(userID, folderID);
189 }
190 catch (Exception e)
191 {
192 m_log.ErrorFormat("[XINVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1}",
193 e.Source, e.Message);
194 }
195 InventoryCollection nullCollection = new InventoryCollection();
196 nullCollection.Folders = new List<InventoryFolderBase>();
197 nullCollection.Items = new List<InventoryItemBase>();
198 nullCollection.UserID = userID;
199 return nullCollection;
200 }
201
202 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
203 {
204 return m_RemoteConnector.GetFolderItems(userID, folderID);
205 }
206
207 public override bool AddFolder(InventoryFolderBase folder)
208 {
209 if (folder == null)
210 return false;
211
212 return m_RemoteConnector.AddFolder(folder);
213 }
214
215 public override bool UpdateFolder(InventoryFolderBase folder)
216 {
217 if (folder == null)
218 return false;
219
220 return m_RemoteConnector.UpdateFolder(folder);
221 }
222
223 public override bool MoveFolder(InventoryFolderBase folder)
224 {
225 if (folder == null)
226 return false;
227
228 return m_RemoteConnector.MoveFolder(folder);
229 }
230
231 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
232 {
233 if (folderIDs == null)
234 return false;
235 if (folderIDs.Count == 0)
236 return false;
237
238 return m_RemoteConnector.DeleteFolders(ownerID, folderIDs);
239 }
240
241
242 public override bool PurgeFolder(InventoryFolderBase folder)
243 {
244 if (folder == null)
245 return false;
246
247 return m_RemoteConnector.PurgeFolder(folder);
248 }
249
250 // public bool AddItem(InventoryItemBase item) inherited
251 // Uses AddItemPlain
252
253 protected override bool AddItemPlain(InventoryItemBase item)
254 {
255 if (item == null)
256 return false;
257
258 return m_RemoteConnector.AddItem(item);
259 }
260
261 public override bool UpdateItem(InventoryItemBase item)
262 {
263 if (item == null)
264 return false;
265
266 return m_RemoteConnector.UpdateItem(item);
267 }
268
269 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
270 {
271 if (items == null)
272 return false;
273
274 return m_RemoteConnector.MoveItems(ownerID, items);
275 }
276
277
278 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
279 {
280 if (itemIDs == null)
281 return false;
282 if (itemIDs.Count == 0)
283 return true;
284
285 return m_RemoteConnector.DeleteItems(ownerID, itemIDs);
286 }
287
288 public override InventoryItemBase GetItem(InventoryItemBase item)
289 {
290 if (item == null)
291 return null;
292
293 return m_RemoteConnector.GetItem(item);
294 }
295
296 public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
297 {
298 if (folder == null)
299 return null;
300
301 return m_RemoteConnector.GetFolder(folder);
302 }
303
304 public override bool HasInventoryForUser(UUID userID)
305 {
306 return false;
307 }
308
309 public override List<InventoryItemBase> GetActiveGestures(UUID userId)
310 {
311 return new List<InventoryItemBase>();
312 }
313
314 public override int GetAssetPermissions(UUID userID, UUID assetID)
315 {
316 return m_RemoteConnector.GetAssetPermissions(userID, assetID);
317 }
318
319
320 #endregion
321
322
323 }
324}