aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-09-25 19:19:01 +0100
committerJustin Clark-Casey (justincc)2009-09-25 19:19:01 +0100
commit0bdf75637ff67ee443fa5c4d335c76ca594c254a (patch)
tree52c546b2118101b7bb82ccc7dee273573c8fa0a2 /OpenSim/Services
parentDon't preserve full user profile details within iars for now (diff)
parentMore small changes to FlotsamAssetCache as per mcortez' request. (diff)
downloadopensim-SC_OLD-0bdf75637ff67ee443fa5c4d335c76ca594c254a.zip
opensim-SC_OLD-0bdf75637ff67ee443fa5c4d335c76ca594c254a.tar.gz
opensim-SC_OLD-0bdf75637ff67ee443fa5c4d335c76ca594c254a.tar.bz2
opensim-SC_OLD-0bdf75637ff67ee443fa5c4d335c76ca594c254a.tar.xz
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs277
-rw-r--r--OpenSim/Services/GridService/GridService.cs91
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs68
3 files changed, 232 insertions, 204 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index 0a867db..748892a 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -97,14 +97,27 @@ namespace OpenSim.Services.Connectors
97 97
98 sendData["METHOD"] = "register"; 98 sendData["METHOD"] = "register";
99 99
100 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 100 string reqString = ServerUtils.BuildQueryString(sendData);
101 m_ServerURI + "/grid", 101 //m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
102 ServerUtils.BuildQueryString(sendData)); 102 try
103 103 {
104 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 104 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
105 m_ServerURI + "/grid",
106 reqString);
107 if (reply != string.Empty)
108 {
109 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
105 110
106 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) 111 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
107 return true; 112 return true;
113 }
114 else
115 m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
116 }
117 catch (Exception e)
118 {
119 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
120 }
108 121
109 return false; 122 return false;
110 } 123 }
@@ -117,14 +130,26 @@ namespace OpenSim.Services.Connectors
117 130
118 sendData["METHOD"] = "deregister"; 131 sendData["METHOD"] = "deregister";
119 132
120 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 133 try
121 m_ServerURI + "/grid", 134 {
122 ServerUtils.BuildQueryString(sendData)); 135 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
136 m_ServerURI + "/grid",
137 ServerUtils.BuildQueryString(sendData));
123 138
124 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 139 if (reply != string.Empty)
140 {
141 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
125 142
126 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) 143 if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
127 return true; 144 return true;
145 }
146 else
147 m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply");
148 }
149 catch (Exception e)
150 {
151 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
152 }
128 153
129 return false; 154 return false;
130 } 155 }
@@ -138,16 +163,28 @@ namespace OpenSim.Services.Connectors
138 163
139 sendData["METHOD"] = "get_neighbours"; 164 sendData["METHOD"] = "get_neighbours";
140 165
141 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 166 List<GridRegion> rinfos = new List<GridRegion>();
142 m_ServerURI + "/grid", 167
143 ServerUtils.BuildQueryString(sendData)); 168 string reqString = ServerUtils.BuildQueryString(sendData);
169 string reply = string.Empty;
170 try
171 {
172 reply = SynchronousRestFormsRequester.MakeRequest("POST",
173 m_ServerURI + "/grid",
174 reqString);
175 }
176 catch (Exception e)
177 {
178 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
179 return rinfos;
180 }
144 181
145 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 182 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
146 183
147 List<GridRegion> rinfos = new List<GridRegion>();
148 if (replyData != null) 184 if (replyData != null)
149 { 185 {
150 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; 186 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
187 //m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count);
151 foreach (object r in rinfosList) 188 foreach (object r in rinfosList)
152 { 189 {
153 if (r is Dictionary<string, object>) 190 if (r is Dictionary<string, object>)
@@ -156,8 +193,8 @@ namespace OpenSim.Services.Connectors
156 rinfos.Add(rinfo); 193 rinfos.Add(rinfo);
157 } 194 }
158 else 195 else
159 m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received invalid response", 196 m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received invalid response type {2}",
160 scopeID, regionID); 197 scopeID, regionID, r.GetType());
161 } 198 }
162 } 199 }
163 else 200 else
@@ -176,24 +213,39 @@ namespace OpenSim.Services.Connectors
176 213
177 sendData["METHOD"] = "get_region_by_uuid"; 214 sendData["METHOD"] = "get_region_by_uuid";
178 215
179 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 216 string reply = string.Empty;
180 m_ServerURI + "/grid", 217 try
181 ServerUtils.BuildQueryString(sendData)); 218 {
182 219 reply = SynchronousRestFormsRequester.MakeRequest("POST",
183 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 220 m_ServerURI + "/grid",
221 ServerUtils.BuildQueryString(sendData));
222 }
223 catch (Exception e)
224 {
225 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
226 return null;
227 }
184 228
185 GridRegion rinfo = null; 229 GridRegion rinfo = null;
186 if ((replyData != null) && (replyData["result"] != null)) 230
231 if (reply != string.Empty)
187 { 232 {
188 if (replyData["result"] is Dictionary<string, object>) 233 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
189 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); 234
235 if ((replyData != null) && (replyData["result"] != null))
236 {
237 if (replyData["result"] is Dictionary<string, object>)
238 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
239 //else
240 // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
241 // scopeID, regionID);
242 }
190 else 243 else
191 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received invalid response", 244 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
192 scopeID, regionID); 245 scopeID, regionID);
193 } 246 }
194 else 247 else
195 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response", 248 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID received null reply");
196 scopeID, regionID);
197 249
198 return rinfo; 250 return rinfo;
199 } 251 }
@@ -207,25 +259,38 @@ namespace OpenSim.Services.Connectors
207 sendData["Y"] = y.ToString(); 259 sendData["Y"] = y.ToString();
208 260
209 sendData["METHOD"] = "get_region_by_position"; 261 sendData["METHOD"] = "get_region_by_position";
210 262 string reply = string.Empty;
211 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 263 try
212 m_ServerURI + "/grid", 264 {
213 ServerUtils.BuildQueryString(sendData)); 265 reply = SynchronousRestFormsRequester.MakeRequest("POST",
214 266 m_ServerURI + "/grid",
215 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 267 ServerUtils.BuildQueryString(sendData));
268 }
269 catch (Exception e)
270 {
271 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
272 return null;
273 }
216 274
217 GridRegion rinfo = null; 275 GridRegion rinfo = null;
218 if ((replyData != null) && (replyData["result"] != null)) 276 if (reply != string.Empty)
219 { 277 {
220 if (replyData["result"] is Dictionary<string, object>) 278 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
221 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); 279
280 if ((replyData != null) && (replyData["result"] != null))
281 {
282 if (replyData["result"] is Dictionary<string, object>)
283 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
284 else
285 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response",
286 scopeID, x, y);
287 }
222 else 288 else
223 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response", 289 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response",
224 scopeID, x, y); 290 scopeID, x, y);
225 } 291 }
226 else 292 else
227 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response", 293 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply");
228 scopeID, x, y);
229 294
230 return rinfo; 295 return rinfo;
231 } 296 }
@@ -238,25 +303,35 @@ namespace OpenSim.Services.Connectors
238 sendData["NAME"] = regionName; 303 sendData["NAME"] = regionName;
239 304
240 sendData["METHOD"] = "get_region_by_name"; 305 sendData["METHOD"] = "get_region_by_name";
241 306 string reply = string.Empty;
242 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 307 try
243 m_ServerURI + "/grid", 308 {
244 ServerUtils.BuildQueryString(sendData)); 309 reply = SynchronousRestFormsRequester.MakeRequest("POST",
245 310 m_ServerURI + "/grid",
246 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 311 ServerUtils.BuildQueryString(sendData));
312 }
313 catch (Exception e)
314 {
315 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
316 return null;
317 }
247 318
248 GridRegion rinfo = null; 319 GridRegion rinfo = null;
249 if ((replyData != null) && (replyData["result"] != null)) 320 if (reply != string.Empty)
250 { 321 {
251 if (replyData["result"] is Dictionary<string, object>) 322 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
252 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); 323
324 if ((replyData != null) && (replyData["result"] != null))
325 {
326 if (replyData["result"] is Dictionary<string, object>)
327 rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
328 }
253 else 329 else
254 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received invalid response", 330 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response",
255 scopeID, regionName); 331 scopeID, regionName);
256 } 332 }
257 else 333 else
258 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response", 334 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByName received null reply");
259 scopeID, regionName);
260 335
261 return rinfo; 336 return rinfo;
262 } 337 }
@@ -270,32 +345,45 @@ namespace OpenSim.Services.Connectors
270 sendData["MAX"] = maxNumber.ToString(); 345 sendData["MAX"] = maxNumber.ToString();
271 346
272 sendData["METHOD"] = "get_regions_by_name"; 347 sendData["METHOD"] = "get_regions_by_name";
273
274 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
275 m_ServerURI + "/grid",
276 ServerUtils.BuildQueryString(sendData));
277
278 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
279
280 List<GridRegion> rinfos = new List<GridRegion>(); 348 List<GridRegion> rinfos = new List<GridRegion>();
281 if (replyData != null) 349 string reply = string.Empty;
350 try
282 { 351 {
283 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; 352 reply = SynchronousRestFormsRequester.MakeRequest("POST",
284 foreach (object r in rinfosList) 353 m_ServerURI + "/grid",
354 ServerUtils.BuildQueryString(sendData));
355 }
356 catch (Exception e)
357 {
358 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
359 return rinfos;
360 }
361
362 if (reply != string.Empty)
363 {
364 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
365
366 if (replyData != null)
285 { 367 {
286 if (r is Dictionary<string, object>) 368 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
369 foreach (object r in rinfosList)
287 { 370 {
288 GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); 371 if (r is Dictionary<string, object>)
289 rinfos.Add(rinfo); 372 {
373 GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
374 rinfos.Add(rinfo);
375 }
376 else
377 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response",
378 scopeID, name, maxNumber);
290 } 379 }
291 else
292 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response",
293 scopeID, name, maxNumber);
294 } 380 }
381 else
382 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response",
383 scopeID, name, maxNumber);
295 } 384 }
296 else 385 else
297 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response", 386 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName received null reply");
298 scopeID, name, maxNumber);
299 387
300 return rinfos; 388 return rinfos;
301 } 389 }
@@ -312,31 +400,44 @@ namespace OpenSim.Services.Connectors
312 400
313 sendData["METHOD"] = "get_region_range"; 401 sendData["METHOD"] = "get_region_range";
314 402
315 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 403 List<GridRegion> rinfos = new List<GridRegion>();
316 m_ServerURI + "/grid", 404 string reply = string.Empty;
317 ServerUtils.BuildQueryString(sendData)); 405 try
406 {
407 reply = SynchronousRestFormsRequester.MakeRequest("POST",
408 m_ServerURI + "/grid",
409 ServerUtils.BuildQueryString(sendData));
318 410
319 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 411 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
412 }
413 catch (Exception e)
414 {
415 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
416 return rinfos;
417 }
320 418
321 List<GridRegion> rinfos = new List<GridRegion>(); 419 if (reply != string.Empty)
322 if (replyData != null)
323 { 420 {
324 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; 421 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
325 foreach (object r in rinfosList) 422
423 if (replyData != null)
326 { 424 {
327 if (r is Dictionary<string, object>) 425 Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
426 foreach (object r in rinfosList)
328 { 427 {
329 GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); 428 if (r is Dictionary<string, object>)
330 rinfos.Add(rinfo); 429 {
430 GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
431 rinfos.Add(rinfo);
432 }
331 } 433 }
332 else
333 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received invalid response",
334 scopeID, xmin, xmax, ymin, ymax);
335 } 434 }
435 else
436 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response",
437 scopeID, xmin, xmax, ymin, ymax);
336 } 438 }
337 else 439 else
338 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response", 440 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange received null reply");
339 scopeID, xmin, xmax, ymin, ymax);
340 441
341 return rinfos; 442 return rinfos;
342 } 443 }
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 01ffa1d..991acf2 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -50,35 +50,27 @@ namespace OpenSim.Services.GridService
50 : base(config) 50 : base(config)
51 { 51 {
52 m_log.DebugFormat("[GRID SERVICE]: Starting..."); 52 m_log.DebugFormat("[GRID SERVICE]: Starting...");
53 MainConsole.Instance.Commands.AddCommand("kfs", false,
54 "show digest",
55 "show digest <ID>",
56 "Show asset digest", HandleShowDigest);
57
58 MainConsole.Instance.Commands.AddCommand("kfs", false,
59 "delete asset",
60 "delete asset <ID>",
61 "Delete asset from database", HandleDeleteAsset);
62
63 } 53 }
64 54
65 #region IGridService 55 #region IGridService
66 56
67 public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) 57 public bool RegisterRegion(UUID scopeID, GridRegion regionInfos)
68 { 58 {
69 if (m_Database.Get(regionInfos.RegionID, scopeID) != null)
70 {
71 m_log.WarnFormat("[GRID SERVICE]: Region {0} already registered in scope {1}.", regionInfos.RegionID, scopeID);
72 return false;
73 }
74 // This needs better sanity testing. What if regionInfo is registering in 59 // This needs better sanity testing. What if regionInfo is registering in
75 // overlapping coords? 60 // overlapping coords?
76 if (m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID) != null) 61 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
62 if ((region != null) && (region.RegionID != regionInfos.RegionID))
77 { 63 {
78 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", 64 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
79 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 65 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
80 return false; 66 return false;
81 } 67 }
68 if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
69 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
70 {
71 // Region reregistering in other coordinates. Delete the old entry
72 m_Database.Delete(regionInfos.RegionID);
73 }
82 74
83 // Everything is ok, let's register 75 // Everything is ok, let's register
84 RegionData rdata = RegionInfo2RegionData(regionInfos); 76 RegionData rdata = RegionInfo2RegionData(regionInfos);
@@ -183,9 +175,9 @@ namespace OpenSim.Services.GridService
183 rdata.posX = (int)rinfo.RegionLocX; 175 rdata.posX = (int)rinfo.RegionLocX;
184 rdata.posY = (int)rinfo.RegionLocY; 176 rdata.posY = (int)rinfo.RegionLocY;
185 rdata.RegionID = rinfo.RegionID; 177 rdata.RegionID = rinfo.RegionID;
186 rdata.Data = rinfo.ToKeyValuePairs();
187 rdata.RegionName = rinfo.RegionName; 178 rdata.RegionName = rinfo.RegionName;
188 179 rdata.Data = rinfo.ToKeyValuePairs();
180 rdata.Data["regionHandle"] = Utils.UIntsToLong((uint)rdata.posX, (uint)rdata.posY);
189 return rdata; 181 return rdata;
190 } 182 }
191 183
@@ -196,73 +188,12 @@ namespace OpenSim.Services.GridService
196 rinfo.RegionLocY = rdata.posY; 188 rinfo.RegionLocY = rdata.posY;
197 rinfo.RegionID = rdata.RegionID; 189 rinfo.RegionID = rdata.RegionID;
198 rinfo.RegionName = rdata.RegionName; 190 rinfo.RegionName = rdata.RegionName;
191 rinfo.ScopeID = rdata.ScopeID;
199 192
200 return rinfo; 193 return rinfo;
201 } 194 }
202 195
203 #endregion 196 #endregion
204 197
205 void HandleShowDigest(string module, string[] args)
206 {
207 //if (args.Length < 3)
208 //{
209 // MainConsole.Instance.Output("Syntax: show digest <ID>");
210 // return;
211 //}
212
213 //AssetBase asset = Get(args[2]);
214
215 //if (asset == null || asset.Data.Length == 0)
216 //{
217 // MainConsole.Instance.Output("Asset not found");
218 // return;
219 //}
220
221 //int i;
222
223 //MainConsole.Instance.Output(String.Format("Name: {0}", asset.Name));
224 //MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description));
225 //MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type));
226 //MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType));
227
228 //for (i = 0 ; i < 5 ; i++)
229 //{
230 // int off = i * 16;
231 // if (asset.Data.Length <= off)
232 // break;
233 // int len = 16;
234 // if (asset.Data.Length < off + len)
235 // len = asset.Data.Length - off;
236
237 // byte[] line = new byte[len];
238 // Array.Copy(asset.Data, off, line, 0, len);
239
240 // string text = BitConverter.ToString(line);
241 // MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text));
242 //}
243 }
244
245 void HandleDeleteAsset(string module, string[] args)
246 {
247 //if (args.Length < 3)
248 //{
249 // MainConsole.Instance.Output("Syntax: delete asset <ID>");
250 // return;
251 //}
252
253 //AssetBase asset = Get(args[2]);
254
255 //if (asset == null || asset.Data.Length == 0)
256 // MainConsole.Instance.Output("Asset not found");
257 // return;
258 //}
259
260 //Delete(args[2]);
261
262 ////MainConsole.Instance.Output("Asset deleted");
263 //// TODO: Implement this
264
265 //MainConsole.Instance.Output("Asset deletion not supported by database");
266 }
267 } 198 }
268} 199}
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index a188f7e..ce432ab 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -263,59 +263,55 @@ namespace OpenSim.Services.Interfaces
263 kvp["uuid"] = RegionID.ToString(); 263 kvp["uuid"] = RegionID.ToString();
264 kvp["locX"] = RegionLocX.ToString(); 264 kvp["locX"] = RegionLocX.ToString();
265 kvp["locY"] = RegionLocY.ToString(); 265 kvp["locY"] = RegionLocY.ToString();
266 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); 266 kvp["regionName"] = RegionName;
267 kvp["external_port"] = ExternalEndPoint.Port.ToString(); 267 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
268 kvp["external_host_name"] = ExternalHostName; 268 kvp["serverHttpPort"] = HttpPort.ToString();
269 kvp["http_port"] = HttpPort.ToString(); 269 kvp["serverURI"] = ServerURI;
270 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); 270 kvp["serverPort"] = InternalEndPoint.Port.ToString();
271 kvp["internal_port"] = InternalEndPoint.Port.ToString();
272 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
273 kvp["server_uri"] = ServerURI;
274 271
275 return kvp; 272 return kvp;
276 } 273 }
277 274
278 public GridRegion(Dictionary<string, object> kvp) 275 public GridRegion(Dictionary<string, object> kvp)
279 { 276 {
280 if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null)) 277 if (kvp.ContainsKey("uuid"))
281 { 278 RegionID = new UUID((string)kvp["uuid"]);
282 int port = 0;
283 Int32.TryParse((string)kvp["external_port"], out port);
284 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port);
285 ExternalEndPoint = ep;
286 }
287 else
288 ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
289 279
290 if (kvp["external_host_name"] != null) 280 if (kvp.ContainsKey("locX"))
291 ExternalHostName = (string)kvp["external_host_name"]; 281 RegionLocX = Convert.ToInt32((string)kvp["locX"]);
292 282
293 if (kvp["http_port"] != null) 283 if (kvp.ContainsKey("locY"))
284 RegionLocY = Convert.ToInt32((string)kvp["locY"]);
285
286 if (kvp.ContainsKey("regionName"))
287 RegionName = (string)kvp["regionName"];
288
289 if (kvp.ContainsKey("serverIP"))
294 { 290 {
295 UInt32 port = 0; 291 //int port = 0;
296 UInt32.TryParse((string)kvp["http_port"], out port); 292 //Int32.TryParse((string)kvp["serverPort"], out port);
297 HttpPort = port; 293 //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port);
294 ExternalHostName = (string)kvp["serverIP"];
298 } 295 }
296 else
297 ExternalHostName = "127.0.0.1";
299 298
300 if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null)) 299 if (kvp.ContainsKey("serverPort"))
301 { 300 {
302 int port = 0; 301 Int32 port = 0;
303 Int32.TryParse((string)kvp["internal_port"], out port); 302 Int32.TryParse((string)kvp["serverPort"], out port);
304 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port); 303 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
305 InternalEndPoint = ep;
306 } 304 }
307 else
308 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
309 305
310 if (kvp["alternate_ports"] != null) 306 if (kvp.ContainsKey("serverHttpPort"))
311 { 307 {
312 bool alts = false; 308 UInt32 port = 0;
313 Boolean.TryParse((string)kvp["alternate_ports"], out alts); 309 UInt32.TryParse((string)kvp["serverHttpPort"], out port);
314 m_allow_alternate_ports = alts; 310 HttpPort = port;
315 } 311 }
316 312
317 if (kvp["server_uri"] != null) 313 if (kvp.ContainsKey("serverURI"))
318 ServerURI = (string)kvp["server_uri"]; 314 ServerURI = (string)kvp["serverURI"];
319 } 315 }
320 } 316 }
321 317