diff options
author | diva | 2009-06-10 13:18:32 +0000 |
---|---|---|
committer | diva | 2009-06-10 13:18:32 +0000 |
commit | 0f367bd7bbc5d22d4834e1eb0f1671381485143e (patch) | |
tree | eeb4290f1146601f8fd97dc164e0a7f247a2fafb /OpenSim | |
parent | From: Alan Webb <alan_webb@us.ibm.com> (diff) | |
download | opensim-SC_OLD-0f367bd7bbc5d22d4834e1eb0f1671381485143e.zip opensim-SC_OLD-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.gz opensim-SC_OLD-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.bz2 opensim-SC_OLD-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.xz |
Heart surgery no.2: the inventory service hooks.
Several improvements in the connectors themselves.
Several improvements in configurations.
Needed to add a hack in IUserService and UserManagerBase, to be removed when that service is refactored.
Diffstat (limited to '')
24 files changed, 599 insertions, 359 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 189bd29..f768516 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -1290,15 +1290,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1290 | 1290 | ||
1291 | UICallback sic = new UICallback(); | 1291 | UICallback sic = new UICallback(); |
1292 | UICallback dic = new UICallback(); | 1292 | UICallback dic = new UICallback(); |
1293 | IInventoryServices iserv = m_app.CommunicationsManager.InventoryService; | 1293 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; |
1294 | 1294 | ||
1295 | try | 1295 | try |
1296 | { | 1296 | { |
1297 | 1297 | ||
1298 | Dictionary<UUID,UUID> imap = new Dictionary<UUID,UUID>(); | 1298 | Dictionary<UUID,UUID> imap = new Dictionary<UUID,UUID>(); |
1299 | 1299 | ||
1300 | iserv.RequestInventoryForUser(dest, dic.callback); | 1300 | iserv.GetUserInventory(dest, dic.callback); |
1301 | iserv.RequestInventoryForUser(srca, sic.callback); | 1301 | iserv.GetUserInventory(srca, sic.callback); |
1302 | 1302 | ||
1303 | dic.GetInventory(); | 1303 | dic.GetInventory(); |
1304 | sic.GetInventory(); | 1304 | sic.GetInventory(); |
@@ -1436,8 +1436,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1436 | bool select = false; | 1436 | bool select = false; |
1437 | 1437 | ||
1438 | UICallback uic; | 1438 | UICallback uic; |
1439 | IInventoryServices iserv = m_app.CommunicationsManager.InventoryService; | 1439 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; |
1440 | IAssetService aserv = m_app.SceneManager.CurrentOrFirstScene.AssetService; | 1440 | IAssetService aserv = m_app.SceneManager.CurrentOrFirstScene.AssetService; |
1441 | 1441 | ||
1442 | doc.LoadXml(File.ReadAllText(dafn)); | 1442 | doc.LoadXml(File.ReadAllText(dafn)); |
1443 | 1443 | ||
@@ -1511,7 +1511,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1511 | { | 1511 | { |
1512 | uic = new UICallback(); | 1512 | uic = new UICallback(); |
1513 | // Request the inventory | 1513 | // Request the inventory |
1514 | iserv.RequestInventoryForUser(ID, uic.callback); | 1514 | iserv.GetUserInventory(ID, uic.callback); |
1515 | 1515 | ||
1516 | // While the inventory is being fetched, setup for appearance processing | 1516 | // While the inventory is being fetched, setup for appearance processing |
1517 | if ((mava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(ID)) == null) | 1517 | if ((mava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(ID)) == null) |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs index 961537c..1e3539f 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs | |||
@@ -97,9 +97,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
97 | get { return main.CommunicationsManager; } | 97 | get { return main.CommunicationsManager; } |
98 | } | 98 | } |
99 | 99 | ||
100 | internal static IInventoryServices InventoryServices | 100 | internal static IInventoryService InventoryServices |
101 | { | 101 | { |
102 | get { return Comms.InventoryService; } | 102 | get { return main.SceneManager.CurrentOrFirstScene.InventoryService; } |
103 | } | 103 | } |
104 | 104 | ||
105 | internal static IUserService UserServices | 105 | internal static IUserService UserServices |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 695784b..a1cd116 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs | |||
@@ -270,7 +270,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
270 | Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}", | 270 | Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}", |
271 | MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); | 271 | MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); |
272 | 272 | ||
273 | Rest.InventoryServices.RequestInventoryForUser(rdata.uuid, rdata.GetUserInventory); | 273 | Rest.InventoryServices.GetUserInventory(rdata.uuid, rdata.GetUserInventory); |
274 | 274 | ||
275 | Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}", | 275 | Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}", |
276 | MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); | 276 | MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); |
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 5181bdaea..10aff42 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Services.Interfaces; | ||
33 | 34 | ||
34 | namespace OpenSim.Framework.Communications.Cache | 35 | namespace OpenSim.Framework.Communications.Cache |
35 | { | 36 | { |
@@ -62,7 +63,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
62 | /// <summary> | 63 | /// <summary> |
63 | /// The comms manager holds references to services (user, grid, inventory, etc.) | 64 | /// The comms manager holds references to services (user, grid, inventory, etc.) |
64 | /// </summary> | 65 | /// </summary> |
65 | private readonly CommunicationsManager m_commsManager; | 66 | private readonly IInventoryService m_InventoryService; |
66 | 67 | ||
67 | public UserProfileData UserProfile { get { return m_userProfile; } } | 68 | public UserProfileData UserProfile { get { return m_userProfile; } } |
68 | private UserProfileData m_userProfile; | 69 | private UserProfileData m_userProfile; |
@@ -96,10 +97,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
96 | /// </summary> | 97 | /// </summary> |
97 | /// <param name="commsManager"></param> | 98 | /// <param name="commsManager"></param> |
98 | /// <param name="userProfile"></param> | 99 | /// <param name="userProfile"></param> |
99 | public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile) | 100 | public CachedUserInfo(IInventoryService invService, UserProfileData userProfile) |
100 | { | 101 | { |
101 | m_commsManager = commsManager; | ||
102 | m_userProfile = userProfile; | 102 | m_userProfile = userProfile; |
103 | m_InventoryService = invService; | ||
103 | } | 104 | } |
104 | 105 | ||
105 | /// <summary> | 106 | /// <summary> |
@@ -213,15 +214,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
213 | /// asynchronously otherwise. | 214 | /// asynchronously otherwise. |
214 | public void FetchInventory() | 215 | public void FetchInventory() |
215 | { | 216 | { |
216 | if (m_commsManager.SecureInventoryService != null) | 217 | m_InventoryService.GetUserInventory(UserProfile.ID, InventoryReceive); |
217 | { | ||
218 | m_commsManager.SecureInventoryService.RequestInventoryForUser( | ||
219 | UserProfile.ID, SessionID, InventoryReceive); | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | m_commsManager.InventoryService.RequestInventoryForUser(UserProfile.ID, InventoryReceive); | ||
224 | } | ||
225 | } | 218 | } |
226 | 219 | ||
227 | /// <summary> | 220 | /// <summary> |
@@ -383,14 +376,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
383 | createdBaseFolder.Type = createdFolder.Type; | 376 | createdBaseFolder.Type = createdFolder.Type; |
384 | createdBaseFolder.Version = createdFolder.Version; | 377 | createdBaseFolder.Version = createdFolder.Version; |
385 | 378 | ||
386 | if (m_commsManager.SecureInventoryService != null) | 379 | m_InventoryService.AddFolder(createdBaseFolder); |
387 | { | 380 | |
388 | m_commsManager.SecureInventoryService.AddFolder(createdBaseFolder, m_session_id); | ||
389 | } | ||
390 | else | ||
391 | { | ||
392 | m_commsManager.InventoryService.AddFolder(createdBaseFolder); | ||
393 | } | ||
394 | return true; | 381 | return true; |
395 | } | 382 | } |
396 | else | 383 | else |
@@ -449,14 +436,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
449 | baseFolder.Type = (short)type; | 436 | baseFolder.Type = (short)type; |
450 | baseFolder.Version = RootFolder.Version; | 437 | baseFolder.Version = RootFolder.Version; |
451 | 438 | ||
452 | if (m_commsManager.SecureInventoryService != null) | 439 | m_InventoryService.UpdateFolder(baseFolder); |
453 | { | ||
454 | m_commsManager.SecureInventoryService.UpdateFolder(baseFolder, m_session_id); | ||
455 | } | ||
456 | else | ||
457 | { | ||
458 | m_commsManager.InventoryService.UpdateFolder(baseFolder); | ||
459 | } | ||
460 | 440 | ||
461 | folder.Name = name; | 441 | folder.Name = name; |
462 | folder.Type = (short)type; | 442 | folder.Type = (short)type; |
@@ -498,14 +478,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
498 | baseFolder.ID = folderID; | 478 | baseFolder.ID = folderID; |
499 | baseFolder.ParentID = parentID; | 479 | baseFolder.ParentID = parentID; |
500 | 480 | ||
501 | if (m_commsManager.SecureInventoryService != null) | 481 | m_InventoryService.MoveFolder(baseFolder); |
502 | { | ||
503 | m_commsManager.SecureInventoryService.MoveFolder(baseFolder, m_session_id); | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | m_commsManager.InventoryService.MoveFolder(baseFolder); | ||
508 | } | ||
509 | 482 | ||
510 | InventoryFolderImpl folder = RootFolder.FindFolder(folderID); | 483 | InventoryFolderImpl folder = RootFolder.FindFolder(folderID); |
511 | InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID); | 484 | InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID); |
@@ -568,14 +541,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
568 | purgedBaseFolder.Type = purgedFolder.Type; | 541 | purgedBaseFolder.Type = purgedFolder.Type; |
569 | purgedBaseFolder.Version = purgedFolder.Version; | 542 | purgedBaseFolder.Version = purgedFolder.Version; |
570 | 543 | ||
571 | if (m_commsManager.SecureInventoryService != null) | 544 | m_InventoryService.PurgeFolder(purgedBaseFolder); |
572 | { | ||
573 | m_commsManager.SecureInventoryService.PurgeFolder(purgedBaseFolder, m_session_id); | ||
574 | } | ||
575 | else | ||
576 | { | ||
577 | m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder); | ||
578 | } | ||
579 | 545 | ||
580 | purgedFolder.Purge(); | 546 | purgedFolder.Purge(); |
581 | 547 | ||
@@ -615,14 +581,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
615 | } | 581 | } |
616 | ItemReceive(item, null); | 582 | ItemReceive(item, null); |
617 | 583 | ||
618 | if (m_commsManager.SecureInventoryService != null) | 584 | m_InventoryService.AddItem(item); |
619 | { | ||
620 | m_commsManager.SecureInventoryService.AddItem(item, m_session_id); | ||
621 | } | ||
622 | else | ||
623 | { | ||
624 | m_commsManager.InventoryService.AddItem(item); | ||
625 | } | ||
626 | } | 585 | } |
627 | else | 586 | else |
628 | { | 587 | { |
@@ -642,14 +601,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
642 | { | 601 | { |
643 | if (m_hasReceivedInventory) | 602 | if (m_hasReceivedInventory) |
644 | { | 603 | { |
645 | if (m_commsManager.SecureInventoryService != null) | 604 | m_InventoryService.UpdateItem(item); |
646 | { | ||
647 | m_commsManager.SecureInventoryService.UpdateItem(item, m_session_id); | ||
648 | } | ||
649 | else | ||
650 | { | ||
651 | m_commsManager.InventoryService.UpdateItem(item); | ||
652 | } | ||
653 | } | 605 | } |
654 | else | 606 | else |
655 | { | 607 | { |
@@ -688,14 +640,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
688 | 640 | ||
689 | if (RootFolder.DeleteItem(item.ID)) | 641 | if (RootFolder.DeleteItem(item.ID)) |
690 | { | 642 | { |
691 | if (m_commsManager.SecureInventoryService != null) | 643 | return m_InventoryService.DeleteItem(item); |
692 | { | ||
693 | return m_commsManager.SecureInventoryService.DeleteItem(item, m_session_id); | ||
694 | } | ||
695 | else | ||
696 | { | ||
697 | return m_commsManager.InventoryService.DeleteItem(item); | ||
698 | } | ||
699 | } | 644 | } |
700 | } | 645 | } |
701 | else | 646 | else |
@@ -789,14 +734,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
789 | 734 | ||
790 | InventoryItemBase itemInfo = null; | 735 | InventoryItemBase itemInfo = null; |
791 | 736 | ||
792 | if (m_commsManager.SecureInventoryService != null) | 737 | itemInfo = m_InventoryService.QueryItem(item); |
793 | { | ||
794 | itemInfo = m_commsManager.SecureInventoryService.QueryItem(item, m_session_id); | ||
795 | } | ||
796 | else | ||
797 | { | ||
798 | itemInfo = m_commsManager.InventoryService.QueryItem(item); | ||
799 | } | ||
800 | 738 | ||
801 | if (itemInfo != null) | 739 | if (itemInfo != null) |
802 | { | 740 | { |
@@ -833,14 +771,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
833 | 771 | ||
834 | InventoryFolderBase folderInfo = null; | 772 | InventoryFolderBase folderInfo = null; |
835 | 773 | ||
836 | if (m_commsManager.SecureInventoryService != null) | 774 | folderInfo = m_InventoryService.QueryFolder(folder); |
837 | { | ||
838 | folderInfo = m_commsManager.SecureInventoryService.QueryFolder(folder, m_session_id); | ||
839 | } | ||
840 | else | ||
841 | { | ||
842 | folderInfo = m_commsManager.InventoryService.QueryFolder(folder); | ||
843 | } | ||
844 | 775 | ||
845 | if (folderInfo != null) | 776 | if (folderInfo != null) |
846 | { | 777 | { |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index b7f209c..c9f5236 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -29,6 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Services.Interfaces; | ||
32 | 33 | ||
33 | namespace OpenSim.Framework.Communications.Cache | 34 | namespace OpenSim.Framework.Communications.Cache |
34 | { | 35 | { |
@@ -66,6 +67,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
66 | /// </summary> | 67 | /// </summary> |
67 | public readonly InventoryFolderImpl LibraryRoot; | 68 | public readonly InventoryFolderImpl LibraryRoot; |
68 | 69 | ||
70 | private IInventoryService m_InventoryService; | ||
71 | |||
69 | /// <summary> | 72 | /// <summary> |
70 | /// Constructor | 73 | /// Constructor |
71 | /// </summary> | 74 | /// </summary> |
@@ -77,6 +80,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
77 | LibraryRoot = libraryRootFolder; | 80 | LibraryRoot = libraryRootFolder; |
78 | } | 81 | } |
79 | 82 | ||
83 | public void SetInventoryService(IInventoryService invService) | ||
84 | { | ||
85 | m_InventoryService = invService; | ||
86 | } | ||
87 | |||
80 | /// <summary> | 88 | /// <summary> |
81 | /// A new user has moved into a region in this instance so retrieve their profile from the user service. | 89 | /// A new user has moved into a region in this instance so retrieve their profile from the user service. |
82 | /// </summary> | 90 | /// </summary> |
@@ -200,7 +208,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
200 | /// <param name="userProfile"></param> | 208 | /// <param name="userProfile"></param> |
201 | protected CachedUserInfo AddToCaches(UserProfileData userProfile) | 209 | protected CachedUserInfo AddToCaches(UserProfileData userProfile) |
202 | { | 210 | { |
203 | CachedUserInfo createdUserInfo = new CachedUserInfo(m_commsManager, userProfile); | 211 | CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile); |
204 | 212 | ||
205 | lock (m_userProfilesById) | 213 | lock (m_userProfilesById) |
206 | { | 214 | { |
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs index c076ac4..725225d 100644 --- a/OpenSim/Framework/Communications/IUserService.cs +++ b/OpenSim/Framework/Communications/IUserService.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Services.Interfaces; | ||
31 | 32 | ||
32 | namespace OpenSim.Framework.Communications | 33 | namespace OpenSim.Framework.Communications |
33 | { | 34 | { |
@@ -135,5 +136,10 @@ namespace OpenSim.Framework.Communications | |||
135 | // This probably shouldn't be here, it belongs to IAuthentication | 136 | // This probably shouldn't be here, it belongs to IAuthentication |
136 | // But since Scenes only have IUserService references, I'm placing it here for now. | 137 | // But since Scenes only have IUserService references, I'm placing it here for now. |
137 | bool VerifySession(UUID userID, UUID sessionID); | 138 | bool VerifySession(UUID userID, UUID sessionID); |
139 | |||
140 | |||
141 | // Temporary Hack until we move everything to the new service model | ||
142 | void SetInventoryService(IInventoryService invService); | ||
143 | |||
138 | } | 144 | } |
139 | } | 145 | } |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs index f30d28b..ac0dc6d 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs | |||
@@ -33,6 +33,7 @@ using NUnit.Framework.SyntaxHelpers; | |||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Services.Interfaces; | ||
36 | using OpenSim.Tests.Common.Mock; | 37 | using OpenSim.Tests.Common.Mock; |
37 | 38 | ||
38 | namespace OpenSim.Framework.Communications.Tests | 39 | namespace OpenSim.Framework.Communications.Tests |
@@ -143,6 +144,11 @@ namespace OpenSim.Framework.Communications.Tests | |||
143 | { | 144 | { |
144 | return true; | 145 | return true; |
145 | } | 146 | } |
147 | |||
148 | public void SetInventoryService(IInventoryService inv) | ||
149 | { | ||
150 | throw new NotImplementedException(); | ||
151 | } | ||
146 | } | 152 | } |
147 | } | 153 | } |
148 | } | 154 | } |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index c3aaa4b..898239d 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -37,6 +37,7 @@ using OpenMetaverse.StructuredData; | |||
37 | using OpenSim.Data; | 37 | using OpenSim.Data; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Statistics; | 39 | using OpenSim.Framework.Statistics; |
40 | using OpenSim.Services.Interfaces; | ||
40 | 41 | ||
41 | namespace OpenSim.Framework.Communications | 42 | namespace OpenSim.Framework.Communications |
42 | { | 43 | { |
@@ -54,6 +55,7 @@ namespace OpenSim.Framework.Communications | |||
54 | private List<IUserDataPlugin> m_plugins = new List<IUserDataPlugin>(); | 55 | private List<IUserDataPlugin> m_plugins = new List<IUserDataPlugin>(); |
55 | 56 | ||
56 | protected CommunicationsManager m_commsManager; | 57 | protected CommunicationsManager m_commsManager; |
58 | protected IInventoryService m_InventoryService; | ||
57 | 59 | ||
58 | /// <summary> | 60 | /// <summary> |
59 | /// Constructor | 61 | /// Constructor |
@@ -64,6 +66,11 @@ namespace OpenSim.Framework.Communications | |||
64 | m_commsManager = commsManager; | 66 | m_commsManager = commsManager; |
65 | } | 67 | } |
66 | 68 | ||
69 | public virtual void SetInventoryService(IInventoryService invService) | ||
70 | { | ||
71 | m_InventoryService = invService; | ||
72 | } | ||
73 | |||
67 | /// <summary> | 74 | /// <summary> |
68 | /// Add a new user data plugin - plugins will be requested in the order they were added. | 75 | /// Add a new user data plugin - plugins will be requested in the order they were added. |
69 | /// </summary> | 76 | /// </summary> |
@@ -676,7 +683,24 @@ namespace OpenSim.Framework.Communications | |||
676 | } | 683 | } |
677 | else | 684 | else |
678 | { | 685 | { |
679 | m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID); | 686 | // |
687 | // WARNING: This is a horrible hack | ||
688 | // The purpose here is to avoid touching the user server at this point. | ||
689 | // There are dragons there that I can't deal with right now. | ||
690 | // diva 06/09/09 | ||
691 | // | ||
692 | if (m_InventoryService != null) | ||
693 | { | ||
694 | // local service (standalone) | ||
695 | m_log.Debug("[USERSTORAGE]: using IInventoryService to create user's inventory"); | ||
696 | m_InventoryService.CreateUserInventory(userProf.ID); | ||
697 | } | ||
698 | else | ||
699 | { | ||
700 | // used by the user server | ||
701 | m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); | ||
702 | m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID); | ||
703 | } | ||
680 | 704 | ||
681 | return userProf.ID; | 705 | return userProf.ID; |
682 | } | 706 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs index fd831bf..7352e2d 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework.Communications.Cache; | |||
35 | using OpenSim.Framework.Communications.Clients; | 35 | using OpenSim.Framework.Communications.Clients; |
36 | using OpenSim.Region.Communications.OGS1; | 36 | using OpenSim.Region.Communications.OGS1; |
37 | using OpenSim.Region.Communications.Local; | 37 | using OpenSim.Region.Communications.Local; |
38 | using OpenSim.Services.Interfaces; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.Communications.Hypergrid | 40 | namespace OpenSim.Region.Communications.Hypergrid |
40 | { | 41 | { |
@@ -63,6 +64,12 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
63 | m_localUserServices = local; | 64 | m_localUserServices = local; |
64 | } | 65 | } |
65 | 66 | ||
67 | public override void SetInventoryService(IInventoryService invService) | ||
68 | { | ||
69 | base.SetInventoryService(invService); | ||
70 | m_localUserServices.SetInventoryService(invService); | ||
71 | } | ||
72 | |||
66 | public override UUID AddUser( | 73 | public override UUID AddUser( |
67 | string firstName, string lastName, string password, string email, uint regX, uint regY, UUID uuid) | 74 | string firstName, string lastName, string password, string email, uint regX, uint regY, UUID uuid) |
68 | { | 75 | { |
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs deleted file mode 100644 index 6149822..0000000 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs +++ /dev/null | |||
@@ -1,167 +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 System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Data; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Communications; | ||
38 | using OpenSim.Framework.Communications.Cache; | ||
39 | using OpenSim.Framework.Communications.Services; | ||
40 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | ||
41 | using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; | ||
42 | using OpenSim.Framework.Servers; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | ||
44 | using OpenSim.Region.Framework.Interfaces; | ||
45 | using OpenSim.Region.Framework.Scenes; | ||
46 | using OpenSim.Region.CoreModules.ServiceConnectors.Interregion; | ||
47 | |||
48 | using OpenMetaverse.StructuredData; | ||
49 | |||
50 | namespace OpenSim.Region.CoreModules.Hypergrid | ||
51 | { | ||
52 | public class HGStandaloneInventoryModule : IRegionModule | ||
53 | { | ||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | private static bool initialized = false; | ||
56 | private static bool enabled = false; | ||
57 | private static bool safemode = false; | ||
58 | |||
59 | private bool m_doLookup = false; | ||
60 | Scene m_scene; | ||
61 | HGInventoryService m_inventoryService; | ||
62 | InventoryServiceBase m_inventoryBase; | ||
63 | |||
64 | public bool DoLookup | ||
65 | { | ||
66 | get { return m_doLookup; } | ||
67 | set { m_doLookup = value; } | ||
68 | } | ||
69 | |||
70 | #region IRegionModule interface | ||
71 | |||
72 | public void Initialise(Scene scene, IConfigSource config) | ||
73 | { | ||
74 | if (!initialized) | ||
75 | { | ||
76 | initialized = true; | ||
77 | m_scene = scene; | ||
78 | |||
79 | // This module is only on for standalones | ||
80 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); | ||
81 | if (config.Configs["Hypergrid"] != null) | ||
82 | safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | public void PostInitialise() | ||
87 | { | ||
88 | if (enabled) | ||
89 | { | ||
90 | m_log.Info("[HGStandaloneInvModule]: Starting..."); | ||
91 | //m_inventoryService = new InventoryService(m_scene); | ||
92 | m_inventoryBase = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; | ||
93 | |||
94 | m_inventoryService = new HGInventoryService(m_inventoryBase, m_scene.AssetService, | ||
95 | (UserManagerBase)m_scene.CommsManager.UserAdminService, m_scene.CommsManager.HttpServer, | ||
96 | m_scene.CommsManager.NetworkServersInfo.InventoryURL); | ||
97 | |||
98 | AddHttpHandlers(m_scene.CommsManager.HttpServer); | ||
99 | m_inventoryService.AddHttpHandlers(); | ||
100 | } | ||
101 | } | ||
102 | |||
103 | public void Close() | ||
104 | { | ||
105 | } | ||
106 | |||
107 | public string Name | ||
108 | { | ||
109 | get { return "HGStandaloneInventoryModule"; } | ||
110 | } | ||
111 | |||
112 | public bool IsSharedModule | ||
113 | { | ||
114 | get { return true; } | ||
115 | } | ||
116 | |||
117 | #endregion | ||
118 | |||
119 | public virtual void AddHttpHandlers(IHttpServer httpServer) | ||
120 | { | ||
121 | if (!safemode) | ||
122 | { | ||
123 | httpServer.AddStreamHandler( | ||
124 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( | ||
125 | "POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession)); | ||
126 | httpServer.AddStreamHandler( | ||
127 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | ||
128 | "POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession)); | ||
129 | httpServer.AddStreamHandler( | ||
130 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
131 | "POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession)); | ||
132 | |||
133 | httpServer.AddStreamHandler( | ||
134 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
135 | "POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession)); | ||
136 | |||
137 | httpServer.AddStreamHandler( | ||
138 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
139 | "POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession)); | ||
140 | } | ||
141 | |||
142 | httpServer.AddStreamHandler( | ||
143 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
144 | "POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession)); | ||
145 | |||
146 | httpServer.AddStreamHandler( | ||
147 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | ||
148 | "POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession)); | ||
149 | |||
150 | |||
151 | } | ||
152 | |||
153 | /// <summary> | ||
154 | /// Check that the source of an inventory request for a particular agent is a current session belonging to | ||
155 | /// that agent. | ||
156 | /// </summary> | ||
157 | /// <param name="session_id"></param> | ||
158 | /// <param name="avatar_id"></param> | ||
159 | /// <returns></returns> | ||
160 | public bool CheckAuthSession(string session_id, string avatar_id) | ||
161 | { | ||
162 | return true; | ||
163 | } | ||
164 | |||
165 | } | ||
166 | |||
167 | } | ||
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 9969ebe..10e2ec2 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -18,8 +18,11 @@ | |||
18 | <RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.RemoteAssetServicesConnector" /> | 18 | <RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.RemoteAssetServicesConnector" /> |
19 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.HGAssetBroker" /> | 19 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.HGAssetBroker" /> |
20 | <RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" /> | 20 | <RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" /> |
21 | <RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" /> | 21 | <RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" /> |
22 | <RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/> | 22 | <RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/> |
23 | <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Inventory.LocalInventoryServicesConnector" /> | ||
24 | <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Inventory.RemoteInventoryServicesConnector" /> | ||
25 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Inventory.HGInventoryBroker" /> | ||
23 | <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" /> | 26 | <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" /> |
24 | <RegionModule id="Chat" type="OpenSim.Region.CoreModules.Avatar.Chat.ChatModule" /> | 27 | <RegionModule id="Chat" type="OpenSim.Region.CoreModules.Avatar.Chat.ChatModule" /> |
25 | </Extension> | 28 | </Extension> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs index 3a0011f..03b4873 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs | |||
@@ -84,13 +84,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
84 | if (localDll == String.Empty) | 84 | if (localDll == String.Empty) |
85 | { | 85 | { |
86 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); | 86 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); |
87 | return; | 87 | //return; |
88 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
88 | } | 89 | } |
89 | 90 | ||
90 | if (HGDll == String.Empty) | 91 | if (HGDll == String.Empty) |
91 | { | 92 | { |
92 | m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); | 93 | m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); |
93 | return; | 94 | //return; |
95 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
94 | } | 96 | } |
95 | 97 | ||
96 | Object[] args = new Object[] { source }; | 98 | Object[] args = new Object[] { source }; |
@@ -116,7 +118,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
116 | m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty); | 118 | m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty); |
117 | 119 | ||
118 | m_Enabled = true; | 120 | m_Enabled = true; |
119 | m_log.Info("[HG INVENTORY CONNECTOR]: HG asset broker enabled"); | 121 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); |
120 | } | 122 | } |
121 | } | 123 | } |
122 | } | 124 | } |
@@ -139,6 +141,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
139 | m_Scene = scene; | 141 | m_Scene = scene; |
140 | // HACK for now. Ugh! | 142 | // HACK for now. Ugh! |
141 | m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService; | 143 | m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService; |
144 | // ugh! | ||
145 | m_UserProfileService.SetInventoryService(this); | ||
146 | scene.CommsManager.UserService.SetInventoryService(this); | ||
147 | |||
148 | m_Initialized = true; | ||
142 | } | 149 | } |
143 | 150 | ||
144 | scene.RegisterModuleInterface<IInventoryService>(this); | 151 | scene.RegisterModuleInterface<IInventoryService>(this); |
@@ -153,7 +160,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
153 | if (!m_Enabled) | 160 | if (!m_Enabled) |
154 | return; | 161 | return; |
155 | 162 | ||
156 | m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled remote inventory for region {0}", scene.RegionInfo.RegionName); | 163 | m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName); |
157 | 164 | ||
158 | } | 165 | } |
159 | 166 | ||
@@ -161,10 +168,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
161 | 168 | ||
162 | public bool CreateUserInventory(UUID userID) | 169 | public bool CreateUserInventory(UUID userID) |
163 | { | 170 | { |
164 | if (IsLocalGridUser(userID)) | 171 | return m_GridService.CreateUserInventory(userID); |
165 | return m_GridService.CreateUserInventory(userID); | ||
166 | else | ||
167 | return false; | ||
168 | } | 172 | } |
169 | 173 | ||
170 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 174 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) |
@@ -187,7 +191,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
187 | else | 191 | else |
188 | { | 192 | { |
189 | UUID sessionID = GetSessionID(userID); | 193 | UUID sessionID = GetSessionID(userID); |
190 | string uri = "http://" + GetUserInventoryURI(userID) + "/" + userID.ToString(); | 194 | string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); |
191 | m_HGService.GetUserInventory(uri, sessionID, callback); | 195 | m_HGService.GetUserInventory(uri, sessionID, callback); |
192 | } | 196 | } |
193 | } | 197 | } |
@@ -207,7 +211,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
207 | else | 211 | else |
208 | { | 212 | { |
209 | UUID sessionID = GetSessionID(folder.Owner); | 213 | UUID sessionID = GetSessionID(folder.Owner); |
210 | string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | 214 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); |
211 | return m_HGService.AddFolder(uri, folder, sessionID); | 215 | return m_HGService.AddFolder(uri, folder, sessionID); |
212 | } | 216 | } |
213 | } | 217 | } |
@@ -222,7 +226,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
222 | else | 226 | else |
223 | { | 227 | { |
224 | UUID sessionID = GetSessionID(folder.Owner); | 228 | UUID sessionID = GetSessionID(folder.Owner); |
225 | string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | 229 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); |
226 | return m_HGService.UpdateFolder(uri, folder, sessionID); | 230 | return m_HGService.UpdateFolder(uri, folder, sessionID); |
227 | } | 231 | } |
228 | } | 232 | } |
@@ -237,7 +241,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
237 | else | 241 | else |
238 | { | 242 | { |
239 | UUID sessionID = GetSessionID(folder.Owner); | 243 | UUID sessionID = GetSessionID(folder.Owner); |
240 | string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | 244 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); |
241 | return m_HGService.MoveFolder(uri, folder, sessionID); | 245 | return m_HGService.MoveFolder(uri, folder, sessionID); |
242 | } | 246 | } |
243 | } | 247 | } |
@@ -252,7 +256,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
252 | else | 256 | else |
253 | { | 257 | { |
254 | UUID sessionID = GetSessionID(folder.Owner); | 258 | UUID sessionID = GetSessionID(folder.Owner); |
255 | string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | 259 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); |
256 | return m_HGService.PurgeFolder(uri, folder, sessionID); | 260 | return m_HGService.PurgeFolder(uri, folder, sessionID); |
257 | } | 261 | } |
258 | } | 262 | } |
@@ -267,7 +271,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
267 | else | 271 | else |
268 | { | 272 | { |
269 | UUID sessionID = GetSessionID(item.Owner); | 273 | UUID sessionID = GetSessionID(item.Owner); |
270 | string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); | 274 | string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); |
271 | return m_HGService.AddItem(uri, item, sessionID); | 275 | return m_HGService.AddItem(uri, item, sessionID); |
272 | } | 276 | } |
273 | } | 277 | } |
@@ -282,7 +286,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
282 | else | 286 | else |
283 | { | 287 | { |
284 | UUID sessionID = GetSessionID(item.Owner); | 288 | UUID sessionID = GetSessionID(item.Owner); |
285 | string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); | 289 | string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); |
286 | return m_HGService.UpdateItem(uri, item, sessionID); | 290 | return m_HGService.UpdateItem(uri, item, sessionID); |
287 | } | 291 | } |
288 | } | 292 | } |
@@ -297,7 +301,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
297 | else | 301 | else |
298 | { | 302 | { |
299 | UUID sessionID = GetSessionID(item.Owner); | 303 | UUID sessionID = GetSessionID(item.Owner); |
300 | string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); | 304 | string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); |
301 | return m_HGService.DeleteItem(uri, item, sessionID); | 305 | return m_HGService.DeleteItem(uri, item, sessionID); |
302 | } | 306 | } |
303 | } | 307 | } |
@@ -312,7 +316,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
312 | else | 316 | else |
313 | { | 317 | { |
314 | UUID sessionID = GetSessionID(item.Owner); | 318 | UUID sessionID = GetSessionID(item.Owner); |
315 | string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); | 319 | string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); |
316 | return m_HGService.QueryItem(uri, item, sessionID); | 320 | return m_HGService.QueryItem(uri, item, sessionID); |
317 | } | 321 | } |
318 | } | 322 | } |
@@ -327,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
327 | else | 331 | else |
328 | { | 332 | { |
329 | UUID sessionID = GetSessionID(folder.Owner); | 333 | UUID sessionID = GetSessionID(folder.Owner); |
330 | string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | 334 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); |
331 | return m_HGService.QueryFolder(uri, folder, sessionID); | 335 | return m_HGService.QueryFolder(uri, folder, sessionID); |
332 | } | 336 | } |
333 | } | 337 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs index 6b72e9b..ce64d4d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | |||
30 | using System; | 31 | using System; |
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
32 | using System.Reflection; | 33 | using System.Reflection; |
@@ -38,10 +39,10 @@ using OpenSim.Region.Framework.Scenes; | |||
38 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
39 | using OpenMetaverse; | 40 | using OpenMetaverse; |
40 | 41 | ||
42 | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory |
42 | { | 44 | { |
43 | public class LocalInventoryServicesConnector : | 45 | public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService |
44 | ISharedRegionModule, IInventoryService | ||
45 | { | 46 | { |
46 | private static readonly ILog m_log = | 47 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 48 | LogManager.GetLogger( |
@@ -50,6 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
50 | private IInventoryService m_InventoryService; | 51 | private IInventoryService m_InventoryService; |
51 | 52 | ||
52 | private bool m_Enabled = false; | 53 | private bool m_Enabled = false; |
54 | private bool m_Initialized = false; | ||
53 | 55 | ||
54 | public string Name | 56 | public string Name |
55 | { | 57 | { |
@@ -64,15 +66,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
64 | string name = moduleConfig.GetString("InventoryServices", ""); | 66 | string name = moduleConfig.GetString("InventoryServices", ""); |
65 | if (name == Name) | 67 | if (name == Name) |
66 | { | 68 | { |
67 | IConfig assetConfig = source.Configs["InventoryService"]; | 69 | IConfig inventoryConfig = source.Configs["InventoryService"]; |
68 | if (assetConfig == null) | 70 | if (inventoryConfig == null) |
69 | { | 71 | { |
70 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | 72 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); |
71 | return; | 73 | return; |
72 | } | 74 | } |
73 | 75 | ||
74 | string serviceDll = assetConfig.GetString("LocalServiceModule", | 76 | string serviceDll = inventoryConfig.GetString("LocalServiceModule", String.Empty); |
75 | String.Empty); | ||
76 | 77 | ||
77 | if (serviceDll == String.Empty) | 78 | if (serviceDll == String.Empty) |
78 | { | 79 | { |
@@ -81,14 +82,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
81 | } | 82 | } |
82 | 83 | ||
83 | Object[] args = new Object[] { source }; | 84 | Object[] args = new Object[] { source }; |
84 | m_InventoryService = | 85 | m_log.DebugFormat("[INVENTORY CONNECTOR]: Service dll = {0}", serviceDll); |
85 | ServerUtils.LoadPlugin<IInventoryService>(serviceDll, | 86 | |
86 | args); | 87 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(serviceDll, args); |
87 | 88 | ||
88 | if (m_InventoryService == null) | 89 | if (m_InventoryService == null) |
89 | { | 90 | { |
90 | m_log.Error("[INVENTORY CONNECTOR]: Can't load asset service"); | 91 | m_log.Error("[INVENTORY CONNECTOR]: Can't load inventory service"); |
91 | return; | 92 | //return; |
93 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
92 | } | 94 | } |
93 | 95 | ||
94 | //List<IInventoryDataPlugin> plugins | 96 | //List<IInventoryDataPlugin> plugins |
@@ -121,7 +123,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
121 | if (!m_Enabled) | 123 | if (!m_Enabled) |
122 | return; | 124 | return; |
123 | 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 | |||
124 | scene.RegisterModuleInterface<IInventoryService>(this); | 134 | scene.RegisterModuleInterface<IInventoryService>(this); |
135 | |||
125 | } | 136 | } |
126 | 137 | ||
127 | public void RemoveRegion(Scene scene) | 138 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs index b695fce..cd13c3d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs | |||
@@ -40,12 +40,10 @@ using OpenMetaverse; | |||
40 | 40 | ||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory |
42 | { | 42 | { |
43 | public class RemoteInventoryServicesConnector : | 43 | public class RemoteInventoryServicesConnector : ISharedRegionModule, IInventoryService |
44 | ISharedRegionModule, IInventoryService | ||
45 | { | 44 | { |
46 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | 47 | ||
50 | private bool m_Enabled = false; | 48 | private bool m_Enabled = false; |
51 | private bool m_Initialized = false; | 49 | private bool m_Initialized = false; |
@@ -57,6 +55,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
57 | get { return "RemoteInventoryServicesConnector"; } | 55 | get { return "RemoteInventoryServicesConnector"; } |
58 | } | 56 | } |
59 | 57 | ||
58 | public RemoteInventoryServicesConnector() | ||
59 | { | ||
60 | } | ||
61 | |||
60 | public RemoteInventoryServicesConnector(IConfigSource source) | 62 | public RemoteInventoryServicesConnector(IConfigSource source) |
61 | { | 63 | { |
62 | Init(source); | 64 | Init(source); |
@@ -100,7 +102,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | |||
100 | return; | 102 | return; |
101 | 103 | ||
102 | if (!m_Initialized) | 104 | if (!m_Initialized) |
105 | { | ||
103 | m_Scene = scene; | 106 | m_Scene = scene; |
107 | // ugh! | ||
108 | scene.CommsManager.UserProfileCacheService.SetInventoryService(this); | ||
109 | scene.CommsManager.UserService.SetInventoryService(this); | ||
110 | m_Initialized = true; | ||
111 | } | ||
104 | 112 | ||
105 | scene.RegisterModuleInterface<IInventoryService>(this); | 113 | scene.RegisterModuleInterface<IInventoryService>(this); |
106 | } | 114 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d18af46..5349d87 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -146,6 +146,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | protected IInventoryService m_InventoryService = null; | ||
150 | |||
151 | public IInventoryService InventoryService | ||
152 | { | ||
153 | get | ||
154 | { | ||
155 | if (m_InventoryService == null) | ||
156 | { | ||
157 | m_InventoryService = RequestModuleInterface<IInventoryService>(); | ||
158 | |||
159 | if (m_InventoryService == null) | ||
160 | { | ||
161 | throw new Exception("No IInventoryService available."); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | return m_InventoryService; | ||
166 | } | ||
167 | } | ||
168 | |||
149 | protected IXMLRPC m_xmlrpcModule; | 169 | protected IXMLRPC m_xmlrpcModule; |
150 | protected IWorldComm m_worldCommModule; | 170 | protected IWorldComm m_worldCommModule; |
151 | protected IAvatarFactory m_AvatarFactory; | 171 | protected IAvatarFactory m_AvatarFactory; |
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 1bdaf6f..8d76ffe 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -128,13 +128,20 @@ namespace OpenSim.Server.Base | |||
128 | pluginType.ToString() != | 128 | pluginType.ToString() != |
129 | pluginType.Namespace + "." + className) | 129 | pluginType.Namespace + "." + className) |
130 | continue; | 130 | continue; |
131 | |||
132 | Type typeInterface = | 131 | Type typeInterface = |
133 | pluginType.GetInterface(interfaceName, true); | 132 | pluginType.GetInterface(interfaceName, true); |
134 | if (typeInterface != null) | 133 | if (typeInterface != null) |
135 | { | 134 | { |
136 | T plug = (T)Activator.CreateInstance(pluginType, | 135 | T plug = null; |
137 | args); | 136 | try |
137 | { | ||
138 | plug = (T)Activator.CreateInstance(pluginType, | ||
139 | args); | ||
140 | } | ||
141 | catch (Exception e) | ||
142 | { | ||
143 | m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); | ||
144 | } | ||
138 | 145 | ||
139 | return plug; | 146 | return plug; |
140 | } | 147 | } |
diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index d5faffb..c42d469 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs | |||
@@ -42,18 +42,34 @@ namespace OpenSim.Services.AssetService | |||
42 | 42 | ||
43 | public AssetServiceBase(IConfigSource config) : base(config) | 43 | public AssetServiceBase(IConfigSource config) : base(config) |
44 | { | 44 | { |
45 | IConfig assetConfig = config.Configs["AssetService"]; | 45 | string dllName = String.Empty; |
46 | if (assetConfig == null) | 46 | string connString = String.Empty; |
47 | throw new Exception("No AssetService configuration"); | ||
48 | 47 | ||
49 | string dllName = assetConfig.GetString("StorageProvider", | 48 | // |
50 | String.Empty); | 49 | // Try reading the [DatabaseService] section first, if it exists |
50 | // | ||
51 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
52 | if (dbConfig != null) | ||
53 | { | ||
54 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
55 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
56 | } | ||
51 | 57 | ||
52 | if (dllName == String.Empty) | 58 | // |
53 | throw new Exception("No StorageProvider configured"); | 59 | // Try reading the more specific [AssetService] section, if it exists |
60 | // | ||
61 | IConfig assetConfig = config.Configs["AssetService"]; | ||
62 | if (assetConfig != null) | ||
63 | { | ||
64 | dllName = assetConfig.GetString("StorageProvider", dllName); | ||
65 | connString = assetConfig.GetString("ConnectionString", connString); | ||
66 | } | ||
54 | 67 | ||
55 | string connString = assetConfig.GetString("ConnectionString", | 68 | // |
56 | String.Empty); | 69 | // We tried, but this doesn't exist. We can't proceed. |
70 | // | ||
71 | if (dllName.Equals(String.Empty)) | ||
72 | throw new Exception("No StorageProvider configured"); | ||
57 | 73 | ||
58 | m_Database = LoadPlugin<IAssetDataPlugin>(dllName); | 74 | m_Database = LoadPlugin<IAssetDataPlugin>(dllName); |
59 | if (m_Database == null) | 75 | if (m_Database == null) |
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index 34478ae..093ce92 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Services.Connectors | |||
67 | IConfig inventoryConfig = source.Configs["InventoryService"]; | 67 | IConfig inventoryConfig = source.Configs["InventoryService"]; |
68 | if (inventoryConfig == null) | 68 | if (inventoryConfig == null) |
69 | { | 69 | { |
70 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpanSim.ini"); | 70 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); |
71 | throw new Exception("Inventory connector init error"); | 71 | throw new Exception("Inventory connector init error"); |
72 | } | 72 | } |
73 | 73 | ||
@@ -77,7 +77,7 @@ namespace OpenSim.Services.Connectors | |||
77 | if (serviceURI == String.Empty) | 77 | if (serviceURI == String.Empty) |
78 | { | 78 | { |
79 | m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); | 79 | m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); |
80 | throw new Exception("Inventory connector init error"); | 80 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); |
81 | } | 81 | } |
82 | m_ServerURI = serviceURI.TrimEnd('/'); | 82 | m_ServerURI = serviceURI.TrimEnd('/'); |
83 | } | 83 | } |
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs new file mode 100644 index 0000000..3264f41 --- /dev/null +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs | |||
@@ -0,0 +1,170 @@ | |||
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.IO; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Servers.HttpServer; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenMetaverse; | ||
38 | |||
39 | namespace OpenSim.Services.Connectors | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// This connector is temporary. It's used by the user server, before that server is refactored. | ||
43 | /// </summary> | ||
44 | public class QuickAndDirtyInventoryServiceConnector : IInventoryService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private string m_ServerURI = String.Empty; | ||
51 | |||
52 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>(); | ||
53 | |||
54 | public QuickAndDirtyInventoryServiceConnector() | ||
55 | { | ||
56 | } | ||
57 | |||
58 | public QuickAndDirtyInventoryServiceConnector(string serverURI) | ||
59 | { | ||
60 | m_ServerURI = serverURI.TrimEnd('/'); | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
65 | /// </summary> | ||
66 | /// <param name="userId"></param> | ||
67 | /// <returns></returns> | ||
68 | public bool CreateUserInventory(UUID userId) | ||
69 | { | ||
70 | return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( | ||
71 | "POST", m_ServerURI + "CreateInventory/", userId.Guid); | ||
72 | } | ||
73 | |||
74 | /// <summary> | ||
75 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
76 | /// </summary> | ||
77 | /// <param name="userId"></param> | ||
78 | /// <returns></returns> | ||
79 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
80 | { | ||
81 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( | ||
82 | "POST", m_ServerURI + "RootFolders/", userId.Guid); | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Returns a list of all the active gestures in a user's inventory. | ||
87 | /// </summary> | ||
88 | /// <param name="userId"> | ||
89 | /// The <see cref="UUID"/> of the user | ||
90 | /// </param> | ||
91 | /// <returns> | ||
92 | /// A flat list of the gesture items. | ||
93 | /// </returns> | ||
94 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
95 | { | ||
96 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>( | ||
97 | "POST", m_ServerURI + "ActiveGestures/", userId.Guid); | ||
98 | } | ||
99 | |||
100 | public InventoryCollection GetUserInventory(UUID userID) | ||
101 | { | ||
102 | return null; | ||
103 | } | ||
104 | |||
105 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
106 | { | ||
107 | } | ||
108 | |||
109 | public List<InventoryItemBase> GetFolderItems(UUID folderID) | ||
110 | { | ||
111 | return null; | ||
112 | } | ||
113 | |||
114 | public bool AddFolder(InventoryFolderBase folder) | ||
115 | { | ||
116 | return false; | ||
117 | } | ||
118 | |||
119 | public bool UpdateFolder(InventoryFolderBase folder) | ||
120 | { | ||
121 | return false; | ||
122 | } | ||
123 | |||
124 | public bool MoveFolder(InventoryFolderBase folder) | ||
125 | { | ||
126 | return false; | ||
127 | } | ||
128 | |||
129 | public bool PurgeFolder(InventoryFolderBase folder) | ||
130 | { | ||
131 | return false; | ||
132 | } | ||
133 | |||
134 | public bool AddItem(InventoryItemBase item) | ||
135 | { | ||
136 | return false; | ||
137 | } | ||
138 | |||
139 | public bool UpdateItem(InventoryItemBase item) | ||
140 | { | ||
141 | return false; | ||
142 | } | ||
143 | |||
144 | public bool DeleteItem(InventoryItemBase item) | ||
145 | { | ||
146 | return false; | ||
147 | } | ||
148 | |||
149 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
150 | { | ||
151 | return null; | ||
152 | } | ||
153 | |||
154 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
155 | { | ||
156 | return null; | ||
157 | } | ||
158 | |||
159 | public bool HasInventoryForUser(UUID userID) | ||
160 | { | ||
161 | return false; | ||
162 | } | ||
163 | |||
164 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
165 | { | ||
166 | return null; | ||
167 | } | ||
168 | |||
169 | } | ||
170 | } | ||
diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs index e5e40c6..0db80d0 100644 --- a/OpenSim/Services/InventoryService/HGInventoryService.cs +++ b/OpenSim/Services/InventoryService/HGInventoryService.cs | |||
@@ -109,6 +109,7 @@ namespace OpenSim.Services.InventoryService | |||
109 | 109 | ||
110 | public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback) | 110 | public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback) |
111 | { | 111 | { |
112 | m_log.Debug("[HGInventory]: GetUserInventory " + id); | ||
112 | string url = string.Empty; | 113 | string url = string.Empty; |
113 | string userID = string.Empty; | 114 | string userID = string.Empty; |
114 | 115 | ||
@@ -120,57 +121,120 @@ namespace OpenSim.Services.InventoryService | |||
120 | 121 | ||
121 | } | 122 | } |
122 | 123 | ||
123 | public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID) | 124 | public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID) |
124 | { | 125 | { |
125 | // TODO | 126 | string url = string.Empty; |
127 | string userID = string.Empty; | ||
128 | |||
129 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
130 | { | ||
131 | ISessionAuthInventoryService connector = GetConnector(url); | ||
132 | return connector.AddFolder(userID, folder, sessionID); | ||
133 | } | ||
126 | return false; | 134 | return false; |
127 | } | 135 | } |
128 | 136 | ||
129 | public bool UpdateFolder(string userID, InventoryFolderBase folder, UUID sessionID) | 137 | public bool UpdateFolder(string id, InventoryFolderBase folder, UUID sessionID) |
130 | { | 138 | { |
131 | // TODO | 139 | string url = string.Empty; |
140 | string userID = string.Empty; | ||
141 | |||
142 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
143 | { | ||
144 | ISessionAuthInventoryService connector = GetConnector(url); | ||
145 | return connector.UpdateFolder(userID, folder, sessionID); | ||
146 | } | ||
132 | return false; | 147 | return false; |
133 | } | 148 | } |
134 | 149 | ||
135 | public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) | 150 | public bool MoveFolder(string id, InventoryFolderBase folder, UUID sessionID) |
136 | { | 151 | { |
137 | // TODO | 152 | string url = string.Empty; |
153 | string userID = string.Empty; | ||
154 | |||
155 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
156 | { | ||
157 | ISessionAuthInventoryService connector = GetConnector(url); | ||
158 | return connector.MoveFolder(userID, folder, sessionID); | ||
159 | } | ||
138 | return false; | 160 | return false; |
139 | } | 161 | } |
140 | 162 | ||
141 | public bool PurgeFolder(string userID, InventoryFolderBase folder, UUID sessionID) | 163 | public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) |
142 | { | 164 | { |
143 | // TODO | 165 | string url = string.Empty; |
166 | string userID = string.Empty; | ||
167 | |||
168 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
169 | { | ||
170 | ISessionAuthInventoryService connector = GetConnector(url); | ||
171 | return connector.PurgeFolder(userID, folder, sessionID); | ||
172 | } | ||
144 | return false; | 173 | return false; |
145 | } | 174 | } |
146 | 175 | ||
147 | public bool AddItem(string userID, InventoryItemBase item, UUID sessionID) | 176 | public bool AddItem(string id, InventoryItemBase item, UUID sessionID) |
148 | { | 177 | { |
149 | // TODO | 178 | string url = string.Empty; |
179 | string userID = string.Empty; | ||
180 | |||
181 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
182 | { | ||
183 | ISessionAuthInventoryService connector = GetConnector(url); | ||
184 | return connector.AddItem(userID, item, sessionID); | ||
185 | } | ||
150 | return false; | 186 | return false; |
151 | } | 187 | } |
152 | 188 | ||
153 | public bool UpdateItem(string userID, InventoryItemBase item, UUID sessionID) | 189 | public bool UpdateItem(string id, InventoryItemBase item, UUID sessionID) |
154 | { | 190 | { |
155 | // TODO | 191 | string url = string.Empty; |
192 | string userID = string.Empty; | ||
193 | |||
194 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
195 | { | ||
196 | ISessionAuthInventoryService connector = GetConnector(url); | ||
197 | return connector.UpdateItem(userID, item, sessionID); | ||
198 | } | ||
156 | return false; | 199 | return false; |
157 | } | 200 | } |
158 | 201 | ||
159 | public bool DeleteItem(string userID, InventoryItemBase item, UUID sessionID) | 202 | public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID) |
160 | { | 203 | { |
161 | // TODO | 204 | string url = string.Empty; |
205 | string userID = string.Empty; | ||
206 | |||
207 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
208 | { | ||
209 | ISessionAuthInventoryService connector = GetConnector(url); | ||
210 | return connector.UpdateItem(userID, item, sessionID); | ||
211 | } | ||
162 | return false; | 212 | return false; |
163 | } | 213 | } |
164 | 214 | ||
165 | public InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID sessionID) | 215 | public InventoryItemBase QueryItem(string id, InventoryItemBase item, UUID sessionID) |
166 | { | 216 | { |
167 | // TODO | 217 | string url = string.Empty; |
218 | string userID = string.Empty; | ||
219 | |||
220 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
221 | { | ||
222 | ISessionAuthInventoryService connector = GetConnector(url); | ||
223 | return connector.QueryItem(userID, item, sessionID); | ||
224 | } | ||
168 | return null; | 225 | return null; |
169 | } | 226 | } |
170 | 227 | ||
171 | public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID) | 228 | public InventoryFolderBase QueryFolder(string id, InventoryFolderBase folder, UUID sessionID) |
172 | { | 229 | { |
173 | // TODO | 230 | string url = string.Empty; |
231 | string userID = string.Empty; | ||
232 | |||
233 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
234 | { | ||
235 | ISessionAuthInventoryService connector = GetConnector(url); | ||
236 | return connector.QueryFolder(userID, folder, sessionID); | ||
237 | } | ||
174 | return null; | 238 | return null; |
175 | } | 239 | } |
176 | 240 | ||
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index f2a7b41..9dbd591 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Services.InventoryService | |||
46 | 46 | ||
47 | public InventoryService(IConfigSource config) : base(config) | 47 | public InventoryService(IConfigSource config) : base(config) |
48 | { | 48 | { |
49 | m_log.Debug("[INVENTORY SERVICE]: Initialized."); | ||
49 | } | 50 | } |
50 | 51 | ||
51 | #region IInventoryServices methods | 52 | #region IInventoryServices methods |
@@ -57,7 +58,7 @@ namespace OpenSim.Services.InventoryService | |||
57 | 58 | ||
58 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 59 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) |
59 | { | 60 | { |
60 | // m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); | 61 | m_log.DebugFormat("[INVENTORY SERVICE]: Getting inventory skeleton for {0}", userId); |
61 | 62 | ||
62 | InventoryFolderBase rootFolder = RequestRootFolder(userId); | 63 | InventoryFolderBase rootFolder = RequestRootFolder(userId); |
63 | 64 | ||
@@ -79,7 +80,7 @@ namespace OpenSim.Services.InventoryService | |||
79 | 80 | ||
80 | // foreach (InventoryFolderBase folder in userFolders) | 81 | // foreach (InventoryFolderBase folder in userFolders) |
81 | // { | 82 | // { |
82 | // m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID); | 83 | // m_log.DebugFormat("[INVENTORY SERVICE]: Got folder {0} {1}", folder.name, folder.folderID); |
83 | // } | 84 | // } |
84 | 85 | ||
85 | return userFolders; | 86 | return userFolders; |
@@ -113,7 +114,7 @@ namespace OpenSim.Services.InventoryService | |||
113 | if (null != existingRootFolder) | 114 | if (null != existingRootFolder) |
114 | { | 115 | { |
115 | m_log.WarnFormat( | 116 | m_log.WarnFormat( |
116 | "[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have " | 117 | "[INVENTORY SERVICE]: Did not create a new inventory for user {0} since they already have " |
117 | + "a root inventory folder with id {1}", | 118 | + "a root inventory folder with id {1}", |
118 | user, existingRootFolder.ID); | 119 | user, existingRootFolder.ID); |
119 | } | 120 | } |
@@ -138,7 +139,7 @@ namespace OpenSim.Services.InventoryService | |||
138 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> | 139 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> |
139 | public InventoryCollection GetUserInventory(UUID userID) | 140 | public InventoryCollection GetUserInventory(UUID userID) |
140 | { | 141 | { |
141 | m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Processing request for inventory of {0}", userID); | 142 | m_log.InfoFormat("[INVENTORY SERVICE]: Processing request for inventory of {0}", userID); |
142 | 143 | ||
143 | // Uncomment me to simulate a slow responding inventory server | 144 | // Uncomment me to simulate a slow responding inventory server |
144 | //Thread.Sleep(16000); | 145 | //Thread.Sleep(16000); |
@@ -149,7 +150,7 @@ namespace OpenSim.Services.InventoryService | |||
149 | 150 | ||
150 | if (null == allFolders) | 151 | if (null == allFolders) |
151 | { | 152 | { |
152 | m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: No inventory found for user {0}", userID); | 153 | m_log.WarnFormat("[INVENTORY SERVICE]: No inventory found for user {0}", userID); |
153 | 154 | ||
154 | return invCollection; | 155 | return invCollection; |
155 | } | 156 | } |
@@ -172,16 +173,16 @@ namespace OpenSim.Services.InventoryService | |||
172 | 173 | ||
173 | // foreach (InventoryFolderBase folder in invCollection.Folders) | 174 | // foreach (InventoryFolderBase folder in invCollection.Folders) |
174 | // { | 175 | // { |
175 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); | 176 | // m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back folder {0} {1}", folder.Name, folder.ID); |
176 | // } | 177 | // } |
177 | // | 178 | // |
178 | // foreach (InventoryItemBase item in invCollection.Items) | 179 | // foreach (InventoryItemBase item in invCollection.Items) |
179 | // { | 180 | // { |
180 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); | 181 | // m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); |
181 | // } | 182 | // } |
182 | 183 | ||
183 | m_log.InfoFormat( | 184 | m_log.InfoFormat( |
184 | "[LOCAL INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items", | 185 | "[INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items", |
185 | invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); | 186 | invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); |
186 | 187 | ||
187 | return invCollection; | 188 | return invCollection; |
@@ -194,7 +195,7 @@ namespace OpenSim.Services.InventoryService | |||
194 | /// <param name="callback"></param> | 195 | /// <param name="callback"></param> |
195 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 196 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
196 | { | 197 | { |
197 | m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); | 198 | m_log.InfoFormat("[INVENTORY SERVICE]: Requesting inventory for user {0}", userID); |
198 | 199 | ||
199 | List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | 200 | List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); |
200 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 201 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
@@ -231,15 +232,15 @@ namespace OpenSim.Services.InventoryService | |||
231 | } | 232 | } |
232 | 233 | ||
233 | m_log.InfoFormat( | 234 | m_log.InfoFormat( |
234 | "[LOCAL INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items", | 235 | "[INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items", |
235 | userID, folders.Count, items.Count); | 236 | userID, folders.Count, items.Count); |
236 | } | 237 | } |
237 | else | 238 | else |
238 | { | 239 | { |
239 | m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: User {0} inventory not available", userID); | 240 | m_log.WarnFormat("[INVENTORY SERVICE]: User {0} inventory not available", userID); |
240 | } | 241 | } |
241 | 242 | ||
242 | callback(folders, items); | 243 | callback.BeginInvoke(folders, items, null, null); |
243 | } | 244 | } |
244 | 245 | ||
245 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | 246 | public List<InventoryItemBase> GetActiveGestures(UUID userId) |
@@ -287,7 +288,7 @@ namespace OpenSim.Services.InventoryService | |||
287 | public virtual bool AddFolder(InventoryFolderBase folder) | 288 | public virtual bool AddFolder(InventoryFolderBase folder) |
288 | { | 289 | { |
289 | m_log.DebugFormat( | 290 | m_log.DebugFormat( |
290 | "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); | 291 | "[INVENTORY SERVICE]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); |
291 | 292 | ||
292 | foreach (IInventoryDataPlugin plugin in m_plugins) | 293 | foreach (IInventoryDataPlugin plugin in m_plugins) |
293 | { | 294 | { |
@@ -302,7 +303,7 @@ namespace OpenSim.Services.InventoryService | |||
302 | public virtual bool UpdateFolder(InventoryFolderBase folder) | 303 | public virtual bool UpdateFolder(InventoryFolderBase folder) |
303 | { | 304 | { |
304 | m_log.DebugFormat( | 305 | m_log.DebugFormat( |
305 | "[AGENT INVENTORY]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); | 306 | "[INVENTORY SERVICE]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); |
306 | 307 | ||
307 | foreach (IInventoryDataPlugin plugin in m_plugins) | 308 | foreach (IInventoryDataPlugin plugin in m_plugins) |
308 | { | 309 | { |
@@ -317,7 +318,7 @@ namespace OpenSim.Services.InventoryService | |||
317 | public virtual bool MoveFolder(InventoryFolderBase folder) | 318 | public virtual bool MoveFolder(InventoryFolderBase folder) |
318 | { | 319 | { |
319 | m_log.DebugFormat( | 320 | m_log.DebugFormat( |
320 | "[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); | 321 | "[INVENTORY SERVICE]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); |
321 | 322 | ||
322 | foreach (IInventoryDataPlugin plugin in m_plugins) | 323 | foreach (IInventoryDataPlugin plugin in m_plugins) |
323 | { | 324 | { |
@@ -332,7 +333,7 @@ namespace OpenSim.Services.InventoryService | |||
332 | public virtual bool AddItem(InventoryItemBase item) | 333 | public virtual bool AddItem(InventoryItemBase item) |
333 | { | 334 | { |
334 | m_log.DebugFormat( | 335 | m_log.DebugFormat( |
335 | "[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); | 336 | "[INVENTORY SERVICE]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); |
336 | 337 | ||
337 | foreach (IInventoryDataPlugin plugin in m_plugins) | 338 | foreach (IInventoryDataPlugin plugin in m_plugins) |
338 | { | 339 | { |
@@ -347,7 +348,7 @@ namespace OpenSim.Services.InventoryService | |||
347 | public virtual bool UpdateItem(InventoryItemBase item) | 348 | public virtual bool UpdateItem(InventoryItemBase item) |
348 | { | 349 | { |
349 | m_log.InfoFormat( | 350 | m_log.InfoFormat( |
350 | "[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); | 351 | "[INVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); |
351 | 352 | ||
352 | foreach (IInventoryDataPlugin plugin in m_plugins) | 353 | foreach (IInventoryDataPlugin plugin in m_plugins) |
353 | { | 354 | { |
@@ -362,7 +363,7 @@ namespace OpenSim.Services.InventoryService | |||
362 | public virtual bool DeleteItem(InventoryItemBase item) | 363 | public virtual bool DeleteItem(InventoryItemBase item) |
363 | { | 364 | { |
364 | m_log.InfoFormat( | 365 | m_log.InfoFormat( |
365 | "[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); | 366 | "[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); |
366 | 367 | ||
367 | foreach (IInventoryDataPlugin plugin in m_plugins) | 368 | foreach (IInventoryDataPlugin plugin in m_plugins) |
368 | { | 369 | { |
@@ -407,13 +408,13 @@ namespace OpenSim.Services.InventoryService | |||
407 | public virtual bool PurgeFolder(InventoryFolderBase folder) | 408 | public virtual bool PurgeFolder(InventoryFolderBase folder) |
408 | { | 409 | { |
409 | m_log.DebugFormat( | 410 | m_log.DebugFormat( |
410 | "[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); | 411 | "[INVENTORY SERVICE]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); |
411 | 412 | ||
412 | List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID); | 413 | List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID); |
413 | 414 | ||
414 | foreach (InventoryFolderBase subFolder in subFolders) | 415 | foreach (InventoryFolderBase subFolder in subFolders) |
415 | { | 416 | { |
416 | // m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); | 417 | // m_log.DebugFormat("[INVENTORY SERVICE]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); |
417 | 418 | ||
418 | foreach (IInventoryDataPlugin plugin in m_plugins) | 419 | foreach (IInventoryDataPlugin plugin in m_plugins) |
419 | { | 420 | { |
diff --git a/OpenSim/Services/InventoryService/InventoryServiceBase.cs b/OpenSim/Services/InventoryService/InventoryServiceBase.cs index 179d541..4526c34 100644 --- a/OpenSim/Services/InventoryService/InventoryServiceBase.cs +++ b/OpenSim/Services/InventoryService/InventoryServiceBase.cs | |||
@@ -44,19 +44,37 @@ namespace OpenSim.Services.InventoryService | |||
44 | 44 | ||
45 | public InventoryServiceBase(IConfigSource config) : base(config) | 45 | public InventoryServiceBase(IConfigSource config) : base(config) |
46 | { | 46 | { |
47 | IConfig assetConfig = config.Configs["InventoryService"]; | 47 | string dllName = String.Empty; |
48 | if (assetConfig == null) | 48 | string connString = String.Empty; |
49 | |||
50 | // | ||
51 | // Try reading the [DatabaseService] section first, if it exists | ||
52 | // | ||
53 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
54 | if (dbConfig != null) | ||
55 | { | ||
56 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
57 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
58 | } | ||
59 | else | ||
60 | Console.WriteLine("------ dbConfig = null!"); | ||
61 | |||
62 | // | ||
63 | // Try reading the more specific [InventoryService] section, if it exists | ||
64 | // | ||
65 | IConfig inventoryConfig = config.Configs["InventoryService"]; | ||
66 | if (inventoryConfig != null) | ||
67 | { | ||
68 | dllName = inventoryConfig.GetString("StorageProvider", dllName); | ||
69 | connString = inventoryConfig.GetString("ConnectionString", connString); | ||
70 | } | ||
71 | |||
72 | // | ||
73 | // We tried, but this doesn't exist. We can't proceed. | ||
74 | // | ||
75 | if (dllName.Equals(String.Empty)) | ||
49 | throw new Exception("No InventoryService configuration"); | 76 | throw new Exception("No InventoryService configuration"); |
50 | 77 | ||
51 | string dllName = assetConfig.GetString("StorageProvider", | ||
52 | String.Empty); | ||
53 | |||
54 | if (dllName == String.Empty) | ||
55 | throw new Exception("No StorageProvider configured"); | ||
56 | |||
57 | string connString = assetConfig.GetString("ConnectionString", | ||
58 | String.Empty); | ||
59 | |||
60 | m_Database = LoadPlugin<IInventoryDataPlugin>(dllName); | 78 | m_Database = LoadPlugin<IInventoryDataPlugin>(dllName); |
61 | if (m_Database == null) | 79 | if (m_Database == null) |
62 | throw new Exception("Could not find a storage interface in the given module"); | 80 | throw new Exception("Could not find a storage interface in the given module"); |
diff --git a/OpenSim/SimulatorServices/RegionInventoryService.cs b/OpenSim/SimulatorServices/RegionInventoryService.cs new file mode 100644 index 0000000..8422a92 --- /dev/null +++ b/OpenSim/SimulatorServices/RegionInventoryService.cs | |||
@@ -0,0 +1,102 @@ | |||
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 System; | ||
29 | using System.Reflection; | ||
30 | using System.Collections.Generic; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Server.Base; | ||
38 | using OpenSim.Server.Handlers.Base; | ||
39 | |||
40 | namespace OpenSim.SimulatorServices | ||
41 | { | ||
42 | public class RegionInventoryService : ISharedRegionModule | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | private static bool enabled = false; | ||
46 | |||
47 | private IConfigSource m_Config; | ||
48 | bool m_Registered = false; | ||
49 | |||
50 | #region IRegionModule interface | ||
51 | |||
52 | public void Initialise(IConfigSource config) | ||
53 | { | ||
54 | // This module is only on for standalones in hypergrid mode | ||
55 | enabled = (!config.Configs["Startup"].GetBoolean("gridmode", true)) && | ||
56 | config.Configs["Startup"].GetBoolean("hypergrid", true); | ||
57 | m_log.DebugFormat("[RegionInventoryService]: enabled? {0}", enabled); | ||
58 | m_Config = config; | ||
59 | } | ||
60 | |||
61 | public void PostInitialise() | ||
62 | { | ||
63 | } | ||
64 | |||
65 | public void Close() | ||
66 | { | ||
67 | } | ||
68 | |||
69 | public string Name | ||
70 | { | ||
71 | get { return "RegionInventoryService"; } | ||
72 | } | ||
73 | |||
74 | public void AddRegion(Scene scene) | ||
75 | { | ||
76 | if (!enabled) | ||
77 | return; | ||
78 | |||
79 | if (!m_Registered) | ||
80 | { | ||
81 | m_Registered = true; | ||
82 | |||
83 | m_log.Info("[RegionInventoryService]: Starting..."); | ||
84 | |||
85 | Object[] args = new Object[] { m_Config, scene.CommsManager.HttpServer }; | ||
86 | |||
87 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:InventoryServiceInConnector", args); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | public void RemoveRegion(Scene scene) | ||
92 | { | ||
93 | } | ||
94 | |||
95 | public void RegionLoaded(Scene scene) | ||
96 | { | ||
97 | } | ||
98 | |||
99 | #endregion | ||
100 | |||
101 | } | ||
102 | } | ||
diff --git a/OpenSim/SimulatorServices/Resources/SimulatorServices.addin.xml b/OpenSim/SimulatorServices/Resources/SimulatorServices.addin.xml index 05f143d..77d7d70 100644 --- a/OpenSim/SimulatorServices/Resources/SimulatorServices.addin.xml +++ b/OpenSim/SimulatorServices/Resources/SimulatorServices.addin.xml | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | <Extension path = "/OpenSim/RegionModules"> | 10 | <Extension path = "/OpenSim/RegionModules"> |
11 | <RegionModule id="RegionAssetService" type="OpenSim.SimulatorServices.RegionAssetService" /> | 11 | <RegionModule id="RegionAssetService" type="OpenSim.SimulatorServices.RegionAssetService" /> |
12 | <RegionModule id="RegionInventoryService" type="OpenSim.SimulatorServices.RegionInventoryService" /> | ||
12 | </Extension> | 13 | </Extension> |
13 | 14 | ||
14 | </Addin> | 15 | </Addin> |