aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2010-04-29 23:33:26 +0100
committerMelanie2010-04-29 23:33:26 +0100
commit08ebcdb0b8122b687fb27d21076d0d01941ed8e2 (patch)
tree311775c3fc4db3ccb3f6b12376a69b0d08aede89 /OpenSim/Region
parentMerge branch 'careminster' into careminster-presence-refactor (diff)
parentStarted redoing HGInventoryBroker for XInventory and with multi-protocol in m... (diff)
downloadopensim-SC_OLD-08ebcdb0b8122b687fb27d21076d0d01941ed8e2.zip
opensim-SC_OLD-08ebcdb0b8122b687fb27d21076d0d01941ed8e2.tar.gz
opensim-SC_OLD-08ebcdb0b8122b687fb27d21076d0d01941ed8e2.tar.bz2
opensim-SC_OLD-08ebcdb0b8122b687fb27d21076d0d01941ed8e2.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs589
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs51
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs7
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs11
8 files changed, 661 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 312db38..23d5b3c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
149 149
150 if (m_FriendsService == null) 150 if (m_FriendsService == null)
151 { 151 {
152 m_log.Error("[FRIENDS]: No Connector defined in section Friends, or filed to load, cannot continue"); 152 m_log.Error("[FRIENDS]: No Connector defined in section Friends, or failed to load, cannot continue");
153 throw new Exception("Connector load error"); 153 throw new Exception("Connector load error");
154 } 154 }
155 155
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index aaa318c..0a5ff3f 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -45,6 +45,7 @@
45 <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> 45 <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" />
46 <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> 46 <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" />
47 <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" /> 47 <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" />
48 <RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" />
48 <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> 49 <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" />
49 <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> 50 <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" />
50 <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> 51 <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" />
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs
new file mode 100644
index 0000000..22aac02
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs
@@ -0,0 +1,589 @@
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 Nini.Config;
30using System;
31using System.Collections.Generic;
32using System.Reflection;
33using OpenSim.Framework;
34
35using OpenSim.Server.Base;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces;
39using OpenSim.Services.Connectors;
40using OpenMetaverse;
41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
43{
44 public class HGInventoryBroker2 : BaseInventoryConnector, INonSharedRegionModule, IInventoryService
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 private static bool m_Initialized = false;
51 private static bool m_Enabled = false;
52
53 private static IInventoryService m_LocalGridInventoryService;
54 private static ISessionAuthInventoryService m_HGService; // obsolete
55 private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>();
56
57
58 private Scene m_Scene;
59 private IUserAccountService m_UserAccountService;
60
61 public Type ReplaceableInterface
62 {
63 get { return null; }
64 }
65
66 public string Name
67 {
68 get { return "HGInventoryBroker2"; }
69 }
70
71 public void Initialise(IConfigSource source)
72 {
73 if (!m_Initialized)
74 {
75 IConfig moduleConfig = source.Configs["Modules"];
76 if (moduleConfig != null)
77 {
78 string name = moduleConfig.GetString("InventoryServices", "");
79 if (name == Name)
80 {
81 IConfig inventoryConfig = source.Configs["InventoryService"];
82 if (inventoryConfig == null)
83 {
84 m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
85 return;
86 }
87
88 string localDll = inventoryConfig.GetString("LocalGridInventoryService",
89 String.Empty);
90 string HGDll = inventoryConfig.GetString("HypergridInventoryService",
91 String.Empty);
92
93 if (localDll == String.Empty)
94 {
95 m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
96 //return;
97 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
98 }
99
100 if (HGDll == String.Empty)
101 {
102 m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService");
103 //return;
104 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
105 }
106
107 Object[] args = new Object[] { source };
108 m_LocalGridInventoryService =
109 ServerUtils.LoadPlugin<IInventoryService>(localDll,
110 args);
111
112 m_HGService =
113 ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll,
114 args);
115
116 if (m_LocalGridInventoryService == null)
117 {
118 m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service");
119 return;
120 }
121 if (m_HGService == null)
122 {
123 m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service");
124 return;
125 }
126
127 Init(source);
128
129 m_Enabled = true;
130 m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled");
131 }
132 }
133 m_Initialized = true;
134 }
135 }
136
137 public void PostInitialise()
138 {
139 }
140
141 public void Close()
142 {
143 }
144
145 public void AddRegion(Scene scene)
146 {
147 if (!m_Enabled)
148 return;
149
150 m_Scene = scene;
151 m_UserAccountService = m_Scene.UserAccountService;
152
153 scene.RegisterModuleInterface<IInventoryService>(this);
154 m_cache.AddRegion(scene);
155 }
156
157 public void RemoveRegion(Scene scene)
158 {
159 if (!m_Enabled)
160 return;
161
162 m_cache.RemoveRegion(scene);
163 }
164
165 public void RegionLoaded(Scene scene)
166 {
167 if (!m_Enabled)
168 return;
169
170 m_log.InfoFormat("[HG INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName);
171
172 }
173
174
175 #region IInventoryService
176
177 public override bool CreateUserInventory(UUID userID)
178 {
179 return m_LocalGridInventoryService.CreateUserInventory(userID);
180 }
181
182 public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
183 {
184 return m_LocalGridInventoryService.GetInventorySkeleton(userId);
185 }
186
187 public override InventoryCollection GetUserInventory(UUID userID)
188 {
189 return null;
190 }
191
192 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
193 {
194 }
195
196 // Inherited. See base
197 //public override InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
198 //{
199 // if (IsLocalGridUser(userID))
200 // return m_GridService.GetFolderForType(userID, type);
201 // else
202 // {
203 // UUID sessionID = GetSessionID(userID);
204 // string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
205 // // !!!!!!
206 // return null;
207 // //return m_HGService.GetFolderForType(uri, sessionID, type);
208 // }
209 //}
210
211 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
212 {
213 m_log.Debug("[HGInventory]: GetFolderContent " + folderID);
214 string url = string.Empty;
215
216 string invURL = m_cache.GetInventoryServiceURL(userID);
217
218 if (invURL == null) // not there, forward to local inventory connector to resolve
219 return m_LocalGridInventoryService.GetFolderContent(userID, folderID);
220
221 IInventoryService connector = GetConnector(url);
222 return connector.GetFolderContent(userID, folderID);
223
224 //if (StringToUrlAndUserID(id, out url, out userID))
225 //{
226 // ISessionAuthInventoryService connector = GetConnector(url);
227 // return connector.GetFolderContent(userID, folderID, sessionID);
228 //}
229
230 //return null;
231
232 //////////
233
234 //string uri = string.Empty;
235 //if (!IsForeignUser(userID, out uri))
236 // return m_GridService.GetFolderContent(userID, folderID);
237 //else
238 //{
239 // UUID sessionID = GetSessionID(userID);
240 // uri = uri + "/" + userID.ToString();
241 // return m_HGService.GetFolderContent(uri, folderID, sessionID);
242 //}
243 }
244
245 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
246 {
247 string uri = string.Empty;
248 if (!IsForeignUser(userID, out uri))
249 {
250 // This is not pretty, but it will have to do for now
251 if (m_LocalGridInventoryService is BaseInventoryConnector)
252 {
253 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to RemoteInventoryServiceConnector module");
254 return ((BaseInventoryConnector)m_LocalGridInventoryService).GetSystemFolders(userID);
255 }
256 else
257 {
258 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to GetSystemFoldersLocal");
259 return GetSystemFoldersLocal(userID);
260 }
261 }
262 else
263 {
264 UUID sessionID = GetSessionID(userID);
265 uri = uri + "/" + userID.ToString();
266 return m_HGService.GetSystemFolders(uri, sessionID);
267 }
268 }
269
270 private Dictionary<AssetType, InventoryFolderBase> GetSystemFoldersLocal(UUID userID)
271 {
272 InventoryFolderBase root = m_LocalGridInventoryService.GetRootFolder(userID);
273 if (root != null)
274 {
275 InventoryCollection content = m_LocalGridInventoryService.GetFolderContent(userID, root.ID);
276 if (content != null)
277 {
278 Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>();
279 foreach (InventoryFolderBase folder in content.Folders)
280 {
281 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scanning folder type {0}", (AssetType)folder.Type);
282 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
283 folders[(AssetType)folder.Type] = folder;
284 }
285 // Put the root folder there, as type Folder
286 folders[AssetType.Folder] = root;
287 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count);
288 return folders;
289 }
290 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID);
291
292 }
293
294 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder not found for {0}", userID);
295
296 return new Dictionary<AssetType, InventoryFolderBase>();
297 }
298
299 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
300 {
301 string uri = string.Empty;
302 if (!IsForeignUser(userID, out uri))
303 return m_LocalGridInventoryService.GetFolderItems(userID, folderID);
304 else
305 {
306 UUID sessionID = GetSessionID(userID);
307 uri = uri + "/" + userID.ToString();
308 return m_HGService.GetFolderItems(uri, folderID, sessionID);
309 }
310 }
311
312 public override bool AddFolder(InventoryFolderBase folder)
313 {
314 if (folder == null)
315 return false;
316
317 string uri = string.Empty;
318 if (!IsForeignUser(folder.Owner, out uri))
319 return m_LocalGridInventoryService.AddFolder(folder);
320 else
321 {
322 UUID sessionID = GetSessionID(folder.Owner);
323 uri = uri + "/" + folder.Owner.ToString();
324 return m_HGService.AddFolder(uri, folder, sessionID);
325 }
326 }
327
328 public override bool UpdateFolder(InventoryFolderBase folder)
329 {
330 if (folder == null)
331 return false;
332
333 string uri = string.Empty;
334 if (!IsForeignUser(folder.Owner, out uri))
335 return m_LocalGridInventoryService.UpdateFolder(folder);
336 else
337 {
338 UUID sessionID = GetSessionID(folder.Owner);
339 uri = uri + "/" + folder.Owner.ToString();
340 return m_HGService.UpdateFolder(uri, folder, sessionID);
341 }
342 }
343
344 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
345 {
346 if (folderIDs == null)
347 return false;
348 if (folderIDs.Count == 0)
349 return false;
350
351 string uri = string.Empty;
352 if (!IsForeignUser(ownerID, out uri))
353 return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs);
354 else
355 {
356 UUID sessionID = GetSessionID(ownerID);
357 uri = uri + "/" + ownerID.ToString();
358 return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
359 }
360 }
361
362 public override bool MoveFolder(InventoryFolderBase folder)
363 {
364 if (folder == null)
365 return false;
366
367 string uri = string.Empty;
368 if (!IsForeignUser(folder.Owner, out uri))
369 return m_LocalGridInventoryService.MoveFolder(folder);
370 else
371 {
372 UUID sessionID = GetSessionID(folder.Owner);
373 uri = uri + "/" + folder.Owner.ToString();
374 return m_HGService.MoveFolder(uri, folder, sessionID);
375 }
376 }
377
378 public override bool PurgeFolder(InventoryFolderBase folder)
379 {
380 if (folder == null)
381 return false;
382
383 string uri = string.Empty;
384 if (!IsForeignUser(folder.Owner, out uri))
385 return m_LocalGridInventoryService.PurgeFolder(folder);
386 else
387 {
388 UUID sessionID = GetSessionID(folder.Owner);
389 uri = uri + "/" + folder.Owner.ToString();
390 return m_HGService.PurgeFolder(uri, folder, sessionID);
391 }
392 }
393
394 // public bool AddItem(InventoryItemBase item) inherited
395 // Uses AddItemPlain
396
397 protected override bool AddItemPlain(InventoryItemBase item)
398 {
399 if (item == null)
400 return false;
401
402 string uri = string.Empty;
403 if (!IsForeignUser(item.Owner, out uri))
404 {
405 return m_LocalGridInventoryService.AddItem(item);
406 }
407 else
408 {
409 UUID sessionID = GetSessionID(item.Owner);
410 uri = uri + "/" + item.Owner.ToString();
411 return m_HGService.AddItem(uri, item, sessionID);
412 }
413 }
414
415 public override bool UpdateItem(InventoryItemBase item)
416 {
417 if (item == null)
418 return false;
419
420 string uri = string.Empty;
421 if (!IsForeignUser(item.Owner, out uri))
422 return m_LocalGridInventoryService.UpdateItem(item);
423 else
424 {
425 UUID sessionID = GetSessionID(item.Owner);
426 uri = uri + "/" + item.Owner.ToString();
427 return m_HGService.UpdateItem(uri, item, sessionID);
428 }
429 }
430
431 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
432 {
433 if (items == null)
434 return false;
435 if (items.Count == 0)
436 return true;
437
438 string uri = string.Empty;
439 if (!IsForeignUser(ownerID, out uri))
440 return m_LocalGridInventoryService.MoveItems(ownerID, items);
441 else
442 {
443 UUID sessionID = GetSessionID(ownerID);
444 uri = uri + "/" + ownerID.ToString();
445 return m_HGService.MoveItems(uri, items, sessionID);
446 }
447 }
448
449 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
450 {
451 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
452
453 if (itemIDs == null)
454 return false;
455 if (itemIDs.Count == 0)
456 return true;
457
458 string uri = string.Empty;
459 if (!IsForeignUser(ownerID, out uri))
460 return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs);
461 else
462 {
463 UUID sessionID = GetSessionID(ownerID);
464 uri = uri + "/" + ownerID.ToString();
465 return m_HGService.DeleteItems(uri, itemIDs, sessionID);
466 }
467 }
468
469 public override InventoryItemBase GetItem(InventoryItemBase item)
470 {
471 if (item == null)
472 return null;
473 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner);
474 string uri = string.Empty;
475 if (!IsForeignUser(item.Owner, out uri))
476 return m_LocalGridInventoryService.GetItem(item);
477 else
478 {
479 UUID sessionID = GetSessionID(item.Owner);
480 uri = uri + "/" + item.Owner.ToString();
481 return m_HGService.QueryItem(uri, item, sessionID);
482 }
483 }
484
485 public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
486 {
487 if (folder == null)
488 return null;
489
490 string uri = string.Empty;
491 if (!IsForeignUser(folder.Owner, out uri))
492 return m_LocalGridInventoryService.GetFolder(folder);
493 else
494 {
495 UUID sessionID = GetSessionID(folder.Owner);
496 uri = uri + "/" + folder.Owner.ToString();
497 return m_HGService.QueryFolder(uri, folder, sessionID);
498 }
499 }
500
501 public override bool HasInventoryForUser(UUID userID)
502 {
503 return false;
504 }
505
506 public override List<InventoryItemBase> GetActiveGestures(UUID userId)
507 {
508 return new List<InventoryItemBase>();
509 }
510
511 public override int GetAssetPermissions(UUID userID, UUID assetID)
512 {
513 string uri = string.Empty;
514 if (!IsForeignUser(userID, out uri))
515 return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID);
516 else
517 {
518 UUID sessionID = GetSessionID(userID);
519 uri = uri + "/" + userID.ToString();
520 return m_HGService.GetAssetPermissions(uri, assetID, sessionID);
521 }
522 }
523
524 #endregion
525
526 private IInventoryService GetConnector(string url)
527 {
528 IInventoryService connector = null;
529 lock (m_connectors)
530 {
531 if (m_connectors.ContainsKey(url))
532 {
533 connector = m_connectors[url];
534 }
535 else
536 {
537 // We're instantiating this class explicitly, but this won't
538 // work in general, because the remote grid may be running
539 // an inventory server that has a different protocol.
540 // Eventually we will want a piece of protocol asking
541 // the remote server about its kind. Definitely cool thing to do!
542 connector = new RemoteXInventoryServicesConnector(url);
543 m_connectors.Add(url, connector);
544 }
545 }
546 return connector;
547 }
548
549
550 private UUID GetSessionID(UUID userID)
551 {
552 ScenePresence sp = null;
553 if (m_Scene.TryGetScenePresence(userID, out sp))
554 {
555 return sp.ControllingClient.SessionId;
556 }
557
558 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scene presence for {0} not found", userID);
559 return UUID.Zero;
560 }
561
562 private bool IsForeignUser(UUID userID, out string inventoryURL)
563 {
564 inventoryURL = string.Empty;
565 UserAccount account = null;
566 if (m_Scene.UserAccountService != null)
567 account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
568
569 if (account == null) // foreign user
570 {
571 ScenePresence sp = null;
572 m_Scene.TryGetScenePresence(userID, out sp);
573 if (sp != null)
574 {
575 AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
576 if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
577 {
578 inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
579 inventoryURL = inventoryURL.Trim(new char[] { '/' });
580 return true;
581 }
582 }
583 }
584 return false;
585 }
586
587
588 }
589}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index 5e06580..9c6e1cd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -51,6 +51,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
51 // The cache proper 51 // The cache proper
52 protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; 52 protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache;
53 53
54 // A cache of userIDs --> ServiceURLs, for HGBroker only
55 protected Dictionary<UUID, string> m_InventoryURLs;
56
54 public virtual void Init(IConfigSource source, BaseInventoryConnector connector) 57 public virtual void Init(IConfigSource source, BaseInventoryConnector connector)
55 { 58 {
56 m_Scenes = new List<Scene>(); 59 m_Scenes = new List<Scene>();
@@ -89,8 +92,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
89 92
90 // If not, go get them and place them in the cache 93 // If not, go get them and place them in the cache
91 Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); 94 Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID);
95 CacheInventoryServiceURL(presence.Scene, presence.UUID);
96
92 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", 97 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
93 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); 98 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
99
94 } 100 }
95 101
96 void OnClientClosed(UUID clientID, Scene scene) 102 void OnClientClosed(UUID clientID, Scene scene)
@@ -113,6 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
113 "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", 119 "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders",
114 scene.RegionInfo.RegionName, clientID); 120 scene.RegionInfo.RegionName, clientID);
115 DropCachedSystemFolders(clientID); 121 DropCachedSystemFolders(clientID);
122 DropInventoryServiceURL(clientID);
116 } 123 }
117 } 124 }
118 125
@@ -174,5 +181,49 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
174 181
175 return null; 182 return null;
176 } 183 }
184
185 /// <summary>
186 /// Gets the user's inventory URL from its serviceURLs, if the user is foreign,
187 /// and sticks it in the cache
188 /// </summary>
189 /// <param name="userID"></param>
190 private void CacheInventoryServiceURL(Scene scene, UUID userID)
191 {
192 if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null)
193 {
194 // The user does not have a local account; let's cache its service URL
195 string inventoryURL = string.Empty;
196 ScenePresence sp = null;
197 scene.TryGetScenePresence(userID, out sp);
198 if (sp != null)
199 {
200 AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
201 if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
202 {
203 inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
204 if (inventoryURL != null && inventoryURL != string.Empty)
205 {
206 inventoryURL = inventoryURL.Trim(new char[] { '/' });
207 m_InventoryURLs.Add(userID, inventoryURL);
208 }
209 }
210 }
211 }
212 }
213
214 private void DropInventoryServiceURL(UUID userID)
215 {
216 lock (m_InventoryURLs)
217 if (m_InventoryURLs.ContainsKey(userID))
218 m_InventoryURLs.Remove(userID);
219 }
220
221 public string GetInventoryServiceURL(UUID userID)
222 {
223 if (m_InventoryURLs.ContainsKey(userID))
224 return m_InventoryURLs[userID];
225
226 return null;
227 }
177 } 228 }
178} 229}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index fb353c2..96d0c1c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -65,6 +65,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
65 { 65 {
66 } 66 }
67 67
68 public RemoteXInventoryServicesConnector(string url)
69 {
70 m_RemoteConnector = new XInventoryServicesConnector(url);
71 }
72
68 public RemoteXInventoryServicesConnector(IConfigSource source) 73 public RemoteXInventoryServicesConnector(IConfigSource source)
69 { 74 {
70 Init(source); 75 Init(source);
@@ -183,6 +188,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
183 188
184 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) 189 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
185 { 190 {
191 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolderContent {0}", folderID);
186 try 192 try
187 { 193 {
188 return m_RemoteConnector.GetFolderContent(userID, folderID); 194 return m_RemoteConnector.GetFolderContent(userID, folderID);
@@ -295,6 +301,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
295 301
296 public override InventoryFolderBase GetFolder(InventoryFolderBase folder) 302 public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
297 { 303 {
304 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
298 if (folder == null) 305 if (folder == null)
299 return null; 306 return null;
300 307
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs
index 5fac189..16cd7e4 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs
@@ -39,6 +39,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
39 { 39 {
40 int Type { get; } 40 int Type { get; }
41 UUID AssetID { get; } 41 UUID AssetID { get; }
42 T RetreiveAsset<T>() where T : Asset, new(); 42 T RetrieveAsset<T>() where T : Asset, new();
43 } 43 }
44} 44}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs
index 5bf29d7..bf85cbc 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs
@@ -39,11 +39,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
39 public class InventoryItem : IInventoryItem 39 public class InventoryItem : IInventoryItem
40 { 40 {
41 TaskInventoryItem m_privateItem; 41 TaskInventoryItem m_privateItem;
42 Scene m_rootSceene; 42 Scene m_rootScene;
43 43
44 public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) 44 public InventoryItem(Scene rootScene, TaskInventoryItem internalItem)
45 { 45 {
46 m_rootSceene = rootScene; 46 m_rootScene = rootScene;
47 m_privateItem = internalItem; 47 m_privateItem = internalItem;
48 } 48 }
49 49
@@ -82,9 +82,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
82 public UUID AssetID { get { return m_privateItem.AssetID; } } 82 public UUID AssetID { get { return m_privateItem.AssetID; } }
83 83
84 // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. 84 // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM.
85 public T RetreiveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() 85 public T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new()
86 { 86 {
87 AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString()); 87 AssetBase a = m_rootScene.AssetService.Get(AssetID.ToString());
88 T result = new T(); 88 T result = new T();
89 89
90 if ((sbyte)result.AssetType != a.Type) 90 if ((sbyte)result.AssetType != a.Type)
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index d8c0ba5..f719683 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -261,13 +261,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
261 // } 261 // }
262 //} 262 //}
263 263
264 public object GetCompilerOutput(UUID assetID) 264 public string GetCompilerOutput(string assetID)
265 { 265 {
266 return Path.Combine(ScriptEnginesPath, Path.Combine( 266 return Path.Combine(ScriptEnginesPath, Path.Combine(
267 m_scriptEngine.World.RegionInfo.RegionID.ToString(), 267 m_scriptEngine.World.RegionInfo.RegionID.ToString(),
268 FilePrefix + "_compiled_" + assetID + ".dll")); 268 FilePrefix + "_compiled_" + assetID + ".dll"));
269 } 269 }
270 270
271 public string GetCompilerOutput(UUID assetID)
272 {
273 return GetCompilerOutput(assetID.ToString());
274 }
275
271 /// <summary> 276 /// <summary>
272 /// Converts script from LSL to CS and calls CompileFromCSText 277 /// Converts script from LSL to CS and calls CompileFromCSText
273 /// </summary> 278 /// </summary>
@@ -279,9 +284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
279 linemap = null; 284 linemap = null;
280 m_warnings.Clear(); 285 m_warnings.Clear();
281 286
282 assembly = Path.Combine(ScriptEnginesPath, Path.Combine( 287 assembly = GetCompilerOutput(asset);
283 m_scriptEngine.World.RegionInfo.RegionID.ToString(),
284 FilePrefix + "_compiled_" + asset + ".dll"));
285 288
286 if (!Directory.Exists(ScriptEnginesPath)) 289 if (!Directory.Exists(ScriptEnginesPath))
287 { 290 {