diff options
author | MW | 2008-06-28 15:13:17 +0000 |
---|---|---|
committer | MW | 2008-06-28 15:13:17 +0000 |
commit | 86defd0a69d53df6d352b7d4b9a5b9d6621c19e8 (patch) | |
tree | 111e3144f54437d74650704d0a299451ed1a0e7a /OpenSim/Framework/Communications | |
parent | Remove one warning. We are now down to 16 warnings in (diff) | |
download | opensim-SC-86defd0a69d53df6d352b7d4b9a5b9d6621c19e8.zip opensim-SC-86defd0a69d53df6d352b7d4b9a5b9d6621c19e8.tar.gz opensim-SC-86defd0a69d53df6d352b7d4b9a5b9d6621c19e8.tar.bz2 opensim-SC-86defd0a69d53df6d352b7d4b9a5b9d6621c19e8.tar.xz |
plumbing for multiple inventory servers. Mostly done on the region server side.
TODO next is to make the login server read/write a users inventory from the correct server (the inventory url set in a userprofile)
On the region side, although not tested with multiple servers it should work if that inventory url was set, and the inventory servers urls have been added to the CommunicationsManager, using CommunicationsManager.AddInventoryService(string hostUrl)
Diffstat (limited to 'OpenSim/Framework/Communications')
7 files changed, 198 insertions, 35 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 3127bd6..524f314 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -87,6 +87,24 @@ namespace OpenSim.Framework.Communications.Cache | |||
87 | private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders | 87 | private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders |
88 | = new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); | 88 | = new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); |
89 | 89 | ||
90 | private string m_inventoryHost | ||
91 | { | ||
92 | get | ||
93 | { | ||
94 | if (m_userProfile != null) | ||
95 | { | ||
96 | if (m_userProfile.UserInventoryURI != String.Empty) | ||
97 | { | ||
98 | Uri uri = new Uri(m_userProfile.UserInventoryURI); | ||
99 | return uri.Host; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | return ""; | ||
104 | } | ||
105 | |||
106 | } | ||
107 | |||
90 | /// <summary> | 108 | /// <summary> |
91 | /// Constructor | 109 | /// Constructor |
92 | /// </summary> | 110 | /// </summary> |
@@ -325,9 +343,15 @@ namespace OpenSim.Framework.Communications.Cache | |||
325 | createdBaseFolder.Type = createdFolder.Type; | 343 | createdBaseFolder.Type = createdFolder.Type; |
326 | createdBaseFolder.Version = createdFolder.Version; | 344 | createdBaseFolder.Version = createdFolder.Version; |
327 | 345 | ||
328 | m_commsManager.InventoryService.AddFolder(createdBaseFolder); | 346 | IInventoryServices invService = GetInventoryService(); |
347 | if (invService != null) | ||
348 | { | ||
349 | //m_commsManager.InventoryService | ||
350 | invService.AddFolder(createdBaseFolder); | ||
351 | return true; | ||
352 | } | ||
329 | 353 | ||
330 | return true; | 354 | return false; |
331 | } | 355 | } |
332 | else | 356 | else |
333 | { | 357 | { |
@@ -379,14 +403,19 @@ namespace OpenSim.Framework.Communications.Cache | |||
379 | baseFolder.Type = (short) type; | 403 | baseFolder.Type = (short) type; |
380 | baseFolder.Version = RootFolder.Version; | 404 | baseFolder.Version = RootFolder.Version; |
381 | 405 | ||
382 | m_commsManager.InventoryService.UpdateFolder(baseFolder); | 406 | IInventoryServices invService = GetInventoryService(); |
383 | 407 | if (invService != null) | |
384 | InventoryFolderImpl folder=RootFolder.FindFolder(folderID); | 408 | { |
385 | if(folder != null) | 409 | //m_commsManager.InventoryService. |
386 | { | 410 | invService.UpdateFolder(baseFolder); |
387 | folder.Name = name; | 411 | |
388 | folder.ParentID = parentID; | 412 | InventoryFolderImpl folder = RootFolder.FindFolder(folderID); |
389 | } | 413 | if (folder != null) |
414 | { | ||
415 | folder.Name = name; | ||
416 | folder.ParentID = parentID; | ||
417 | } | ||
418 | } | ||
390 | } | 419 | } |
391 | else | 420 | else |
392 | { | 421 | { |
@@ -421,13 +450,24 @@ namespace OpenSim.Framework.Communications.Cache | |||
421 | baseFolder.ID = folderID; | 450 | baseFolder.ID = folderID; |
422 | baseFolder.ParentID = parentID; | 451 | baseFolder.ParentID = parentID; |
423 | 452 | ||
424 | m_commsManager.InventoryService.MoveFolder(baseFolder); | 453 | IInventoryServices invService = GetInventoryService(); |
425 | 454 | if (invService != null) | |
426 | InventoryFolderImpl folder=RootFolder.FindFolder(folderID); | 455 | { |
427 | if(folder != null) | 456 | // m_commsManager.InventoryService |
428 | folder.ParentID = parentID; | 457 | invService.MoveFolder(baseFolder); |
429 | 458 | ||
430 | return true; | 459 | InventoryFolderImpl folder = RootFolder.FindFolder(folderID); |
460 | if (folder != null) | ||
461 | { | ||
462 | folder.ParentID = parentID; | ||
463 | } | ||
464 | |||
465 | return true; | ||
466 | } | ||
467 | else | ||
468 | { | ||
469 | return false; | ||
470 | } | ||
431 | } | 471 | } |
432 | else | 472 | else |
433 | { | 473 | { |
@@ -468,11 +508,16 @@ namespace OpenSim.Framework.Communications.Cache | |||
468 | purgedBaseFolder.Type = purgedFolder.Type; | 508 | purgedBaseFolder.Type = purgedFolder.Type; |
469 | purgedBaseFolder.Version = purgedFolder.Version; | 509 | purgedBaseFolder.Version = purgedFolder.Version; |
470 | 510 | ||
471 | m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder); | 511 | IInventoryServices invService = GetInventoryService(); |
512 | if (invService != null) | ||
513 | { | ||
514 | //m_commsManager.InventoryService | ||
515 | invService.PurgeFolder(purgedBaseFolder); | ||
472 | 516 | ||
473 | purgedFolder.Purge(); | 517 | purgedFolder.Purge(); |
474 | 518 | ||
475 | return true; | 519 | return true; |
520 | } | ||
476 | } | 521 | } |
477 | } | 522 | } |
478 | else | 523 | else |
@@ -505,7 +550,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
505 | item.Folder=RootFolder.ID; | 550 | item.Folder=RootFolder.ID; |
506 | } | 551 | } |
507 | ItemReceive(item); | 552 | ItemReceive(item); |
508 | m_commsManager.InventoryService.AddItem(item); | 553 | |
554 | IInventoryServices invService = GetInventoryService(); | ||
555 | if (invService != null) | ||
556 | { | ||
557 | //m_commsManager.InventoryService | ||
558 | invService.AddItem(item); | ||
559 | } | ||
509 | } | 560 | } |
510 | else | 561 | else |
511 | { | 562 | { |
@@ -525,7 +576,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
525 | { | 576 | { |
526 | if (HasInventory) | 577 | if (HasInventory) |
527 | { | 578 | { |
528 | m_commsManager.InventoryService.UpdateItem(item); | 579 | IInventoryServices invService = GetInventoryService(); |
580 | if (invService != null) | ||
581 | { | ||
582 | //m_commsManager.InventoryService | ||
583 | invService.UpdateItem(item); | ||
584 | } | ||
529 | } | 585 | } |
530 | else | 586 | else |
531 | { | 587 | { |
@@ -564,7 +620,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
564 | 620 | ||
565 | if (RootFolder.DeleteItem(item.ID)) | 621 | if (RootFolder.DeleteItem(item.ID)) |
566 | { | 622 | { |
567 | return m_commsManager.InventoryService.DeleteItem(item); | 623 | IInventoryServices invService = GetInventoryService(); |
624 | if (invService != null) | ||
625 | { | ||
626 | //return m_commsManager.InventoryService | ||
627 | return invService.DeleteItem(item); | ||
628 | } | ||
629 | |||
630 | return false; | ||
568 | } | 631 | } |
569 | } | 632 | } |
570 | else | 633 | else |
@@ -641,6 +704,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
641 | } | 704 | } |
642 | return null; | 705 | return null; |
643 | } | 706 | } |
707 | |||
708 | public IInventoryServices GetInventoryService() | ||
709 | { | ||
710 | IInventoryServices invService; | ||
711 | m_commsManager.TryGetInventoryService(m_inventoryHost, out invService); | ||
712 | return invService; | ||
713 | } | ||
644 | } | 714 | } |
645 | 715 | ||
646 | /// <summary> | 716 | /// <summary> |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index fe61406..37451ab 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -119,7 +119,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
119 | CachedUserInfo userInfo = GetUserDetails(userID); | 119 | CachedUserInfo userInfo = GetUserDetails(userID); |
120 | if (userInfo != null) | 120 | if (userInfo != null) |
121 | { | 121 | { |
122 | m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive); | 122 | //m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive); |
123 | IInventoryServices invService = userInfo.GetInventoryService(); | ||
124 | if (invService != null) | ||
125 | { | ||
126 | invService.RequestInventoryForUser(userID, userInfo.InventoryReceive); | ||
127 | } | ||
123 | } | 128 | } |
124 | else | 129 | else |
125 | { | 130 | { |
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 5de0c71..0410f0e 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -55,12 +55,6 @@ namespace OpenSim.Framework.Communications | |||
55 | get { return m_gridService; } | 55 | get { return m_gridService; } |
56 | } | 56 | } |
57 | 57 | ||
58 | protected IInventoryServices m_inventoryService; | ||
59 | |||
60 | public IInventoryServices InventoryService | ||
61 | { | ||
62 | get { return m_inventoryService; } | ||
63 | } | ||
64 | 58 | ||
65 | protected IInterRegionCommunications m_interRegion; | 59 | protected IInterRegionCommunications m_interRegion; |
66 | 60 | ||
@@ -106,6 +100,70 @@ namespace OpenSim.Framework.Communications | |||
106 | // m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile); | 100 | // m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile); |
107 | } | 101 | } |
108 | 102 | ||
103 | #region Inventory | ||
104 | protected string m_defaultInventoryHost = "default"; | ||
105 | |||
106 | protected List<IInventoryServices> m_inventoryServices = new List<IInventoryServices>(); | ||
107 | // protected IInventoryServices m_inventoryService; | ||
108 | |||
109 | public IInventoryServices InventoryService | ||
110 | { | ||
111 | get | ||
112 | { | ||
113 | if (m_inventoryServices.Count > 0) | ||
114 | { | ||
115 | // return m_inventoryServices[0]; | ||
116 | IInventoryServices invService; | ||
117 | if (TryGetInventoryService(m_defaultInventoryHost, out invService)) | ||
118 | { | ||
119 | return invService; | ||
120 | } | ||
121 | |||
122 | } | ||
123 | |||
124 | return null; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | public bool TryGetInventoryService(string host, out IInventoryServices inventoryService) | ||
129 | { | ||
130 | if ((host == string.Empty) | (host == "default")) | ||
131 | { | ||
132 | host = m_defaultInventoryHost; | ||
133 | } | ||
134 | |||
135 | |||
136 | lock (m_inventoryServices) | ||
137 | { | ||
138 | foreach (IInventoryServices service in m_inventoryServices) | ||
139 | { | ||
140 | if (service.Host == host) | ||
141 | { | ||
142 | inventoryService = service; | ||
143 | return true; | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | |||
148 | inventoryService = null; | ||
149 | return false; | ||
150 | } | ||
151 | |||
152 | public virtual void AddInventoryService(string hostUrl) | ||
153 | { | ||
154 | |||
155 | } | ||
156 | |||
157 | public virtual void AddInventoryService(IInventoryServices service) | ||
158 | { | ||
159 | lock (m_inventoryServices) | ||
160 | { | ||
161 | m_inventoryServices.Add(service); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | #endregion | ||
166 | |||
109 | public void doCreate(string[] cmmdParams) | 167 | public void doCreate(string[] cmmdParams) |
110 | { | 168 | { |
111 | switch (cmmdParams[0]) | 169 | switch (cmmdParams[0]) |
@@ -167,7 +225,7 @@ namespace OpenSim.Framework.Communications | |||
167 | } | 225 | } |
168 | else | 226 | else |
169 | { | 227 | { |
170 | m_inventoryService.CreateNewUserInventory(userProf.ID); | 228 | InventoryService.CreateNewUserInventory(userProf.ID); |
171 | m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName); | 229 | m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName); |
172 | return userProf.ID; | 230 | return userProf.ID; |
173 | } | 231 | } |
diff --git a/OpenSim/Framework/Communications/IAvatarService.cs b/OpenSim/Framework/Communications/IAvatarService.cs new file mode 100644 index 0000000..fdac53f --- /dev/null +++ b/OpenSim/Framework/Communications/IAvatarService.cs | |||
@@ -0,0 +1,21 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Communications | ||
7 | { | ||
8 | public interface IAvatarService | ||
9 | { | ||
10 | /// Get's the User Appearance | ||
11 | AvatarAppearance GetUserAppearance(LLUUID user); | ||
12 | |||
13 | void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); | ||
14 | |||
15 | void AddAttachment(LLUUID user, LLUUID attach); | ||
16 | |||
17 | void RemoveAttachment(LLUUID user, LLUUID attach); | ||
18 | |||
19 | List<LLUUID> GetAttachments(LLUUID user); | ||
20 | } | ||
21 | } | ||
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 8dc09bc..3929a4e 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs | |||
@@ -42,6 +42,10 @@ namespace OpenSim.Framework.Communications | |||
42 | /// </summary> | 42 | /// </summary> |
43 | public interface IInventoryServices | 43 | public interface IInventoryServices |
44 | { | 44 | { |
45 | string Host | ||
46 | { | ||
47 | get; | ||
48 | } | ||
45 | /// <summary> | 49 | /// <summary> |
46 | /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the | 50 | /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the |
47 | /// inventory has been received | 51 | /// inventory has been received |
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs index a7f19e7..f8ef358 100644 --- a/OpenSim/Framework/Communications/IUserService.cs +++ b/OpenSim/Framework/Communications/IUserService.cs | |||
@@ -112,16 +112,16 @@ namespace OpenSim.Framework.Communications | |||
112 | List<FriendListItem> GetUserFriendList(LLUUID friendlistowner); | 112 | List<FriendListItem> GetUserFriendList(LLUUID friendlistowner); |
113 | 113 | ||
114 | /// <summary> | 114 | /// <summary> |
115 | /// Get's the User Appearance | ||
116 | AvatarAppearance GetUserAppearance(LLUUID user); | ||
117 | |||
118 | /// <summary> | ||
119 | /// Updates the current region the User is in | 115 | /// Updates the current region the User is in |
120 | /// </summary> | 116 | /// </summary> |
121 | /// <param name="avatarid">User Region the Avatar is IN</param> | 117 | /// <param name="avatarid">User Region the Avatar is IN</param> |
122 | /// <param name="retionuuid">User Region the Avatar is IN</param> | 118 | /// <param name="retionuuid">User Region the Avatar is IN</param> |
123 | void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle); | 119 | void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle); |
124 | 120 | ||
121 | /// <summary> | ||
122 | /// Get's the User Appearance | ||
123 | AvatarAppearance GetUserAppearance(LLUUID user); | ||
124 | |||
125 | void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); | 125 | void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); |
126 | 126 | ||
127 | void AddAttachment(LLUUID user, LLUUID attach); | 127 | void AddAttachment(LLUUID user, LLUUID attach); |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 89ccf93..d26a3bb 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -81,6 +81,11 @@ namespace OpenSim.Framework.Communications | |||
81 | 81 | ||
82 | #region IInventoryServices methods | 82 | #region IInventoryServices methods |
83 | 83 | ||
84 | public string Host | ||
85 | { | ||
86 | get { return "default"; } | ||
87 | } | ||
88 | |||
84 | // See IInventoryServices | 89 | // See IInventoryServices |
85 | public List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId) | 90 | public List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId) |
86 | { | 91 | { |