diff options
author | MW | 2007-12-01 18:49:17 +0000 |
---|---|---|
committer | MW | 2007-12-01 18:49:17 +0000 |
commit | 5df851761aa796cba70a3b6d8b36d119502c1de2 (patch) | |
tree | 4cab0f2d6ea32a6cfb280d74583d8ffce7331c26 /OpenSim/Framework | |
parent | Attempt to fix mantis issue # 65, seems like it is a race condition between t... (diff) | |
download | opensim-SC-5df851761aa796cba70a3b6d8b36d119502c1de2.zip opensim-SC-5df851761aa796cba70a3b6d8b36d119502c1de2.tar.gz opensim-SC-5df851761aa796cba70a3b6d8b36d119502c1de2.tar.bz2 opensim-SC-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/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/IInventoryServices.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/InventoryServiceBase.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/IUserService.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/InventoryConfig.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/InventoryItemBase.cs | 19 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/RestObjectPoster.cs | 92 | ||||
-rw-r--r-- | OpenSim/Framework/UserConfig.cs | 10 |
8 files changed, 129 insertions, 6 deletions
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index fc301c2..96bb7b3 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Framework.Communications | |||
39 | public interface IInventoryServices | 39 | public interface IInventoryServices |
40 | { | 40 | { |
41 | void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); | 41 | void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); |
42 | void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder); | 42 | void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); |
43 | void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); | 43 | void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); |
44 | void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); | 44 | void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); |
45 | void CreateNewUserInventory(LLUUID user); | 45 | void CreateNewUserInventory(LLUUID user); |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index effe132..091d829 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -150,7 +150,7 @@ namespace OpenSim.Framework.Communications | |||
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | public void deleteItem(InventoryItemBase item) | 153 | public void DeleteItem(InventoryItemBase item) |
154 | { | 154 | { |
155 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 155 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) |
156 | { | 156 | { |
@@ -231,7 +231,7 @@ namespace OpenSim.Framework.Communications | |||
231 | public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, | 231 | public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, |
232 | InventoryItemInfo itemCallBack); | 232 | InventoryItemInfo itemCallBack); |
233 | 233 | ||
234 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder); | 234 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); |
235 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); | 235 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); |
236 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); | 236 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); |
237 | } | 237 | } |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index f1f2c2b..119f8a5 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -366,7 +366,7 @@ namespace OpenSim.Framework.UserManagement | |||
366 | /// | 366 | /// |
367 | /// </summary> | 367 | /// </summary> |
368 | /// <param name="user"></param> | 368 | /// <param name="user"></param> |
369 | public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) | 369 | public LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) |
370 | { | 370 | { |
371 | UserProfileData user = new UserProfileData(); | 371 | UserProfileData user = new UserProfileData(); |
372 | user.homeLocation = new LLVector3(128, 128, 100); | 372 | user.homeLocation = new LLVector3(128, 128, 100); |
@@ -391,6 +391,8 @@ namespace OpenSim.Framework.UserManagement | |||
391 | MainLog.Instance.Verbose("Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); | 391 | MainLog.Instance.Verbose("Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); |
392 | } | 392 | } |
393 | } | 393 | } |
394 | |||
395 | return user.UUID; | ||
394 | } | 396 | } |
395 | 397 | ||
396 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName); | 398 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName); |
diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs index d7857a4..67028a5 100644 --- a/OpenSim/Framework/IUserService.cs +++ b/OpenSim/Framework/IUserService.cs | |||
@@ -46,6 +46,6 @@ namespace OpenSim.Framework | |||
46 | /// | 46 | /// |
47 | /// </summary> | 47 | /// </summary> |
48 | /// <param name="user"></param> | 48 | /// <param name="user"></param> |
49 | void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); | 49 | LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); |
50 | } | 50 | } |
51 | } \ No newline at end of file | 51 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/InventoryConfig.cs b/OpenSim/Framework/InventoryConfig.cs index 1233196..554cd30 100644 --- a/OpenSim/Framework/InventoryConfig.cs +++ b/OpenSim/Framework/InventoryConfig.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Framework | |||
38 | configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | 38 | configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |
39 | "Key to expect from user server", "null", false); | 39 | "Key to expect from user server", "null", false); |
40 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | 40 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |
41 | "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | 41 | "DLL for database provider", "OpenSim.Framework.Data.SQLite.dll", false); |
42 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | 42 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, |
43 | "Http Listener port", DefaultHttpPort.ToString(), false); | 43 | "Http Listener port", DefaultHttpPort.ToString(), false); |
44 | } | 44 | } |
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 80f631e..0ee30bb 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs | |||
@@ -245,6 +245,25 @@ namespace OpenSim.Framework | |||
245 | void deleteInventoryFolder(LLUUID folder); | 245 | void deleteInventoryFolder(LLUUID folder); |
246 | } | 246 | } |
247 | 247 | ||
248 | public class InventoryCollection | ||
249 | { | ||
250 | public List<InventoryFolderBase> Folders; | ||
251 | public List<InventoryItemBase> AllItems; | ||
252 | public LLUUID UserID; | ||
253 | |||
254 | public InventoryCollection() | ||
255 | { | ||
256 | Folders = new List<InventoryFolderBase>(); | ||
257 | AllItems = new List<InventoryItemBase>(); | ||
258 | } | ||
259 | |||
260 | public InventoryCollection(List<InventoryFolderBase> folders, List<InventoryItemBase> allItems) | ||
261 | { | ||
262 | Folders = folders; | ||
263 | AllItems = allItems; | ||
264 | } | ||
265 | } | ||
266 | |||
248 | /* | 267 | /* |
249 | * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder | 268 | * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder |
250 | * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize | 269 | * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize |
diff --git a/OpenSim/Framework/Servers/RestObjectPoster.cs b/OpenSim/Framework/Servers/RestObjectPoster.cs index b77cbcc..07095f3 100644 --- a/OpenSim/Framework/Servers/RestObjectPoster.cs +++ b/OpenSim/Framework/Servers/RestObjectPoster.cs | |||
@@ -8,8 +8,11 @@ using System.Xml.Serialization; | |||
8 | 8 | ||
9 | namespace OpenSim.Framework.Servers | 9 | namespace OpenSim.Framework.Servers |
10 | { | 10 | { |
11 | public delegate void ReturnResponse<T>(T reponse); | ||
12 | |||
11 | public class RestObjectPoster | 13 | public class RestObjectPoster |
12 | { | 14 | { |
15 | |||
13 | public static void BeginPostObject<TRequest>(string requestUrl, TRequest obj) | 16 | public static void BeginPostObject<TRequest>(string requestUrl, TRequest obj) |
14 | { | 17 | { |
15 | Type type = typeof(TRequest); | 18 | Type type = typeof(TRequest); |
@@ -46,4 +49,93 @@ namespace OpenSim.Framework.Servers | |||
46 | } | 49 | } |
47 | } | 50 | } |
48 | } | 51 | } |
52 | |||
53 | public class RestObjectPosterResponse<TResponse> | ||
54 | { | ||
55 | public ReturnResponse<TResponse> ReturnResponseVal; | ||
56 | |||
57 | public void BeginPostObject<TRequest>(string requestUrl, TRequest obj) | ||
58 | { | ||
59 | Type type = typeof(TRequest); | ||
60 | |||
61 | WebRequest request = WebRequest.Create(requestUrl); | ||
62 | request.Method = "POST"; | ||
63 | request.ContentType = "text/xml"; | ||
64 | |||
65 | MemoryStream buffer = new MemoryStream(); | ||
66 | |||
67 | XmlWriterSettings settings = new XmlWriterSettings(); | ||
68 | settings.Encoding = Encoding.UTF8; | ||
69 | |||
70 | using (XmlWriter writer = XmlWriter.Create(buffer, settings)) | ||
71 | { | ||
72 | XmlSerializer serializer = new XmlSerializer(type); | ||
73 | serializer.Serialize(writer, obj); | ||
74 | writer.Flush(); | ||
75 | } | ||
76 | |||
77 | int length = (int)buffer.Length; | ||
78 | request.ContentLength = length; | ||
79 | |||
80 | Stream requestStream = request.GetRequestStream(); | ||
81 | requestStream.Write(buffer.ToArray(), 0, length); | ||
82 | IAsyncResult result = request.BeginGetResponse(AsyncCallback, request); | ||
83 | } | ||
84 | |||
85 | private void AsyncCallback(IAsyncResult result) | ||
86 | { | ||
87 | WebRequest request = (WebRequest)result.AsyncState; | ||
88 | using (WebResponse resp = request.EndGetResponse(result)) | ||
89 | { | ||
90 | TResponse deserial; | ||
91 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | ||
92 | deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); | ||
93 | |||
94 | if (deserial != null && ReturnResponseVal != null) | ||
95 | { | ||
96 | ReturnResponseVal(deserial); | ||
97 | } | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public class SyncRestObjectPoster | ||
103 | { | ||
104 | |||
105 | public static TResponse BeginPostObject<TRequest, TResponse>(string requestUrl, TRequest obj) | ||
106 | { | ||
107 | Type type = typeof(TRequest); | ||
108 | |||
109 | WebRequest request = WebRequest.Create(requestUrl); | ||
110 | request.Method = "POST"; | ||
111 | request.ContentType = "text/xml"; | ||
112 | |||
113 | MemoryStream buffer = new MemoryStream(); | ||
114 | |||
115 | XmlWriterSettings settings = new XmlWriterSettings(); | ||
116 | settings.Encoding = Encoding.UTF8; | ||
117 | |||
118 | using (XmlWriter writer = XmlWriter.Create(buffer, settings)) | ||
119 | { | ||
120 | XmlSerializer serializer = new XmlSerializer(type); | ||
121 | serializer.Serialize(writer, obj); | ||
122 | writer.Flush(); | ||
123 | } | ||
124 | |||
125 | int length = (int)buffer.Length; | ||
126 | request.ContentLength = length; | ||
127 | |||
128 | Stream requestStream = request.GetRequestStream(); | ||
129 | requestStream.Write(buffer.ToArray(), 0, length); | ||
130 | TResponse deserial = default(TResponse); | ||
131 | using (WebResponse resp = request.GetResponse()) | ||
132 | { | ||
133 | |||
134 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | ||
135 | deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); | ||
136 | } | ||
137 | return deserial; | ||
138 | } | ||
139 | |||
140 | } | ||
49 | } \ No newline at end of file | 141 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs index d4ee62f..4c6b3b8 100644 --- a/OpenSim/Framework/UserConfig.cs +++ b/OpenSim/Framework/UserConfig.cs | |||
@@ -38,6 +38,8 @@ namespace OpenSim.Framework | |||
38 | public string GridSendKey = ""; | 38 | public string GridSendKey = ""; |
39 | public string GridRecvKey = ""; | 39 | public string GridRecvKey = ""; |
40 | 40 | ||
41 | public string InventoryUrl = ""; | ||
42 | |||
41 | public string DatabaseProvider = ""; | 43 | public string DatabaseProvider = ""; |
42 | 44 | ||
43 | public static uint DefaultHttpPort = 8002; | 45 | public static uint DefaultHttpPort = 8002; |
@@ -68,6 +70,11 @@ namespace OpenSim.Framework | |||
68 | "Key to send to grid server", "null", false); | 70 | "Key to send to grid server", "null", false); |
69 | configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | 71 | configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |
70 | "Key to expect from grid server", "null", false); | 72 | "Key to expect from grid server", "null", false); |
73 | |||
74 | configMember.addConfigurationOption("default_inventory_server", | ||
75 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
76 | "Default Inventory Server URI", | ||
77 | "http://127.0.0.1:8004/", false); | ||
71 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | 78 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |
72 | "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | 79 | "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); |
73 | 80 | ||
@@ -95,6 +102,9 @@ namespace OpenSim.Framework | |||
95 | case "grid_recv_key": | 102 | case "grid_recv_key": |
96 | GridRecvKey = (string) configuration_result; | 103 | GridRecvKey = (string) configuration_result; |
97 | break; | 104 | break; |
105 | case "default_inventory_server": | ||
106 | InventoryUrl = (string)configuration_result; | ||
107 | break; | ||
98 | case "database_provider": | 108 | case "database_provider": |
99 | DatabaseProvider = (string) configuration_result; | 109 | DatabaseProvider = (string) configuration_result; |
100 | break; | 110 | break; |