aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService
diff options
context:
space:
mode:
authorMelanie2010-01-09 20:46:32 +0000
committerMelanie2010-01-09 20:46:32 +0000
commit28d6705358c2e383fb46c57f064de4dcff144e33 (patch)
tree9a95b712626d89ec8b957352a84b3c51f2b344ca /OpenSim/Services/GridService
parentLess refs to UserProfileCacheService. Compiles but likely doesn't run. (diff)
downloadopensim-SC-28d6705358c2e383fb46c57f064de4dcff144e33.zip
opensim-SC-28d6705358c2e383fb46c57f064de4dcff144e33.tar.gz
opensim-SC-28d6705358c2e383fb46c57f064de4dcff144e33.tar.bz2
opensim-SC-28d6705358c2e383fb46c57f064de4dcff144e33.tar.xz
Preliminary work on the new default region setting mechanism
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r--OpenSim/Services/GridService/GridService.cs69
1 files changed, 69 insertions, 0 deletions
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}