aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications
diff options
context:
space:
mode:
authorMW2007-12-01 18:49:17 +0000
committerMW2007-12-01 18:49:17 +0000
commit5df851761aa796cba70a3b6d8b36d119502c1de2 (patch)
tree4cab0f2d6ea32a6cfb280d74583d8ffce7331c26 /OpenSim/Region/Communications
parentAttempt to fix mantis issue # 65, seems like it is a race condition between t... (diff)
downloadopensim-SC_OLD-5df851761aa796cba70a3b6d8b36d119502c1de2.zip
opensim-SC_OLD-5df851761aa796cba70a3b6d8b36d119502c1de2.tar.gz
opensim-SC_OLD-5df851761aa796cba70a3b6d8b36d119502c1de2.tar.bz2
opensim-SC_OLD-5df851761aa796cba70a3b6d8b36d119502c1de2.tar.xz
Initial working Grid Inventory server. Only been tested on a very small grid, so likely to have problems on a larger grid with more people?
To use , both the user server and Inventory server need to be running this latest revision. (older regions should be able to still be used, just the user won't have inventory on them). Also and HERE IS THE BIG BREAK ISSUE, currently, so that the initial inventory details for a user are added to the inventory db , you need to recreate the accounts using the user server "create user" feature. It should be quite easy to manual populate the inventory database instead but I someone else will need to look into that) Also I've only tested using SQLite as the database provider, there is a Mysql inventory provider but I don't know if it works (SQLite is set as default, so you will need to change it in the inventory server config.xml)
Diffstat (limited to 'OpenSim/Region/Communications')
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs4
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs110
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs3
3 files changed, 100 insertions, 17 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index c38e922..40e6601 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Communications.Local
76 } 76 }
77 } 77 }
78 78
79 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) 79 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
80 { 80 {
81 AddFolder(folder); 81 AddFolder(folder);
82 } 82 }
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Communications.Local
88 88
89 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 89 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
90 { 90 {
91 deleteItem(item); 91 DeleteItem(item);
92 } 92 }
93 } 93 }
94} \ No newline at end of file 94} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 7597e79..934a814 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -25,9 +25,11 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using libsecondlife; 30using libsecondlife;
30using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Servers;
31using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
32using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
33 35
@@ -36,6 +38,7 @@ namespace OpenSim.Region.Communications.OGS1
36 public class OGS1InventoryService : IInventoryServices 38 public class OGS1InventoryService : IInventoryServices
37 { 39 {
38 private string _inventoryServerUrl; 40 private string _inventoryServerUrl;
41 private Dictionary<LLUUID, InventoryRequest> m_RequestingInventory = new Dictionary<LLUUID, InventoryRequest>();
39 42
40 public OGS1InventoryService(string inventoryServerUrl) 43 public OGS1InventoryService(string inventoryServerUrl)
41 { 44 {
@@ -47,31 +50,96 @@ namespace OpenSim.Region.Communications.OGS1
47 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, 50 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
48 InventoryItemInfo itemCallBack) 51 InventoryItemInfo itemCallBack)
49 { 52 {
50 //TODO! Uncomment when all is done 53
51 //SerializableInventory userInventory = null; 54 if (!m_RequestingInventory.ContainsKey(userID))
52 55 {
53 //RestClient inventoryServer = new RestClient(_inventoryServerUrl); 56 InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack);
54 //inventoryServer.AddResourcePath("inventory"); 57 m_RequestingInventory.Add(userID, request);
55 //inventoryServer.AddResourcePath("user"); 58 RequestInventory(userID);
56 //inventoryServer.AddResourcePath(userID.ToStringHyphenated()); 59 }
57
58 //using (Stream userInventoryStream = inventoryServer.Request())
59 //{
60 // XmlSerializer x = new XmlSerializer(typeof(SerializableInventory));
61 // userInventory = (SerializableInventory)x.Deserialize(userInventoryStream);
62 //}
63 } 60 }
64 61
65 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) 62 private void RequestInventory(LLUUID userID)
66 { 63 {
64 try
65 {
66 RestObjectPosterResponse<InventoryCollection> requester = new RestObjectPosterResponse<InventoryCollection>();
67 requester.ReturnResponseVal = InventoryResponse;
68 requester.BeginPostObject<LLUUID>(_inventoryServerUrl + "/GetInventory/", userID);
69 }
70 catch (Exception)
71 {
72 }
73 }
74
75 private void InventoryResponse(InventoryCollection response)
76 {
77 LLUUID userID = response.UserID;
78 if (m_RequestingInventory.ContainsKey(userID))
79 {
80
81 InventoryFolderImpl rootFolder = null;
82 InventoryRequest request = m_RequestingInventory[userID];
83 foreach (InventoryFolderBase folder in response.Folders)
84 {
85 if (folder.parentID == LLUUID.Zero)
86 {
87 InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
88 rootFolder = newfolder;
89 request.FolderCallBack(userID, newfolder);
90 }
91 }
92
93 if (rootFolder != null)
94 {
95 foreach (InventoryFolderBase folder in response.Folders)
96 {
97 if (folder.folderID != rootFolder.folderID)
98 {
99 InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
100 request.FolderCallBack(userID, newfolder);
101 }
102 }
103
104 foreach (InventoryItemBase item in response.AllItems)
105 {
106 request.ItemCallBack(userID, item);
107 }
108 }
109 }
110 }
111
112 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
113 {
114 try
115 {
116 RestObjectPoster.BeginPostObject<InventoryFolderBase>(_inventoryServerUrl + "/NewFolder/", folder);
117 }
118 catch (Exception)
119 {
120 }
67 } 121 }
68 122
69 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) 123 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
70 { 124 {
125 try
126 {
127 RestObjectPoster.BeginPostObject<InventoryItemBase>(_inventoryServerUrl + "/NewItem/", item);
128 }
129 catch (Exception)
130 {
131 }
71 } 132 }
72 133
73 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 134 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
74 { 135 {
136 try
137 {
138 RestObjectPoster.BeginPostObject<InventoryItemBase>(_inventoryServerUrl + "/DeleteItem/", item);
139 }
140 catch (Exception)
141 {
142 }
75 } 143 }
76 144
77 public void CreateNewUserInventory(LLUUID user) 145 public void CreateNewUserInventory(LLUUID user)
@@ -84,5 +152,19 @@ namespace OpenSim.Region.Communications.OGS1
84 } 152 }
85 153
86 #endregion 154 #endregion
155
156 public class InventoryRequest
157 {
158 public LLUUID UserID;
159 public InventoryFolderInfo FolderCallBack;
160 public InventoryItemInfo ItemCallBack;
161
162 public InventoryRequest(LLUUID userId, InventoryFolderInfo folderCall, InventoryItemInfo itemCall)
163 {
164 UserID = userId;
165 FolderCallBack = folderCall;
166 ItemCallBack = itemCall;
167 }
168 }
87 } 169 }
88} \ No newline at end of file 170} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 96380f7..9e1206b 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -162,9 +162,10 @@ namespace OpenSim.Region.Communications.OGS1
162 return data; 162 return data;
163 } 163 }
164 164
165 public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) 165 public LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
166 { 166 {
167 throw new Exception("The method or operation is not implemented."); 167 throw new Exception("The method or operation is not implemented.");
168 return LLUUID.Zero;
168 } 169 }
169 } 170 }
170} \ No newline at end of file 171} \ No newline at end of file