aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorMelanie2010-01-09 20:46:32 +0000
committerMelanie2010-01-09 20:46:32 +0000
commit28d6705358c2e383fb46c57f064de4dcff144e33 (patch)
tree9a95b712626d89ec8b957352a84b3c51f2b344ca /OpenSim/Services
parentLess refs to UserProfileCacheService. Compiles but likely doesn't run. (diff)
downloadopensim-SC_OLD-28d6705358c2e383fb46c57f064de4dcff144e33.zip
opensim-SC_OLD-28d6705358c2e383fb46c57f064de4dcff144e33.tar.gz
opensim-SC_OLD-28d6705358c2e383fb46c57f064de4dcff144e33.tar.bz2
opensim-SC_OLD-28d6705358c2e383fb46c57f064de4dcff144e33.tar.xz
Preliminary work on the new default region setting mechanism
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs14
-rw-r--r--OpenSim/Services/GridService/GridService.cs69
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs4
3 files changed, 87 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index 99aa3fb..7f1f2fd 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -450,5 +450,19 @@ namespace OpenSim.Services.Connectors
450 450
451 #endregion 451 #endregion
452 452
453 public List<GridRegion> GetDefaultRegions(UUID scopeID)
454 {
455 return null;
456 }
457
458 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
459 {
460 return null;
461 }
462
463 public int GetRegionFlags(UUID scopeID, UUID regionID)
464 {
465 return 0;
466 }
453 } 467 }
454} 468}
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 86815e5..884bc95 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -46,10 +46,18 @@ namespace OpenSim.Services.GridService
46 LogManager.GetLogger( 46 LogManager.GetLogger(
47 MethodBase.GetCurrentMethod().DeclaringType); 47 MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private bool m_DeleteOnUnregister = true;
50
49 public GridService(IConfigSource config) 51 public GridService(IConfigSource config)
50 : base(config) 52 : base(config)
51 { 53 {
52 m_log.DebugFormat("[GRID SERVICE]: Starting..."); 54 m_log.DebugFormat("[GRID SERVICE]: Starting...");
55
56 IConfig gridConfig = config.Configs["GridService"];
57 if (gridConfig != null)
58 {
59 m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true);
60 }
53 } 61 }
54 62
55 #region IGridService 63 #region IGridService
@@ -85,6 +93,15 @@ namespace OpenSim.Services.GridService
85 // Everything is ok, let's register 93 // Everything is ok, let's register
86 RegionData rdata = RegionInfo2RegionData(regionInfos); 94 RegionData rdata = RegionInfo2RegionData(regionInfos);
87 rdata.ScopeID = scopeID; 95 rdata.ScopeID = scopeID;
96
97 if (region != null)
98 {
99 rdata.Data["flags"] = region.Data["flags"]; // Preserve fields
100 }
101 int flags = Convert.ToInt32(rdata.Data["flags"]);
102 flags |= (int)OpenSim.Data.RegionFlags.RegionOnline;
103 rdata.Data["flags"] = flags.ToString();
104
88 try 105 try
89 { 106 {
90 m_Database.Store(rdata); 107 m_Database.Store(rdata);
@@ -103,6 +120,28 @@ namespace OpenSim.Services.GridService
103 public bool DeregisterRegion(UUID regionID) 120 public bool DeregisterRegion(UUID regionID)
104 { 121 {
105 m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID); 122 m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID);
123 if (!m_DeleteOnUnregister)
124 {
125 RegionData region = m_Database.Get(regionID, UUID.Zero);
126 if (region == null)
127 return false;
128
129 int flags = Convert.ToInt32(region.Data["flags"]);
130 flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline;
131 region.Data["flags"] = flags.ToString();
132 try
133 {
134 m_Database.Store(region);
135 }
136 catch (Exception e)
137 {
138 m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
139 }
140
141 return true;
142
143 }
144
106 return m_Database.Delete(regionID); 145 return m_Database.Delete(regionID);
107 } 146 }
108 147
@@ -218,5 +257,35 @@ namespace OpenSim.Services.GridService
218 257
219 #endregion 258 #endregion
220 259
260 public List<GridRegion> GetDefaultRegions(UUID scopeID)
261 {
262 List<GridRegion> ret = new List<GridRegion>();
263
264 List<RegionData> regions = m_Database.GetDefaultRegions(scopeID);
265
266 foreach (RegionData r in regions)
267 ret.Add(RegionData2RegionInfo(r));
268
269 return ret;
270 }
271
272 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
273 {
274 List<GridRegion> ret = new List<GridRegion>();
275
276 List<RegionData> regions = m_Database.GetFallbackRegions(scopeID, x, y);
277
278 foreach (RegionData r in regions)
279 ret.Add(RegionData2RegionInfo(r));
280
281 return ret;
282 }
283
284 public int GetRegionFlags(UUID scopeID, UUID regionID)
285 {
286 RegionData region = m_Database.Get(regionID, scopeID);
287
288 return Convert.ToInt32(region.Data["flags"]);
289 }
221 } 290 }
222} 291}
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index e69e4cd..5ea136f 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -90,6 +90,10 @@ namespace OpenSim.Services.Interfaces
90 90
91 List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax); 91 List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax);
92 92
93 List<GridRegion> GetDefaultRegions(UUID scopeID);
94 List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y);
95
96 int GetRegionFlags(UUID scopeID, UUID regionID);
93 } 97 }
94 98
95 public class GridRegion 99 public class GridRegion