Add IScene.Name for code clarity to replace the RegionInfo.RegionName used in many, many log messages.

0.7.3-extended
Justin Clark-Casey (justincc) 2012-06-29 00:03:22 +01:00
parent 663b0cc681
commit 70f85af75b
4 changed files with 38 additions and 32 deletions

View File

@ -56,6 +56,11 @@ namespace OpenSim.Framework
public interface IScene public interface IScene
{ {
/// <summary>
/// The name of this scene.
/// </summary>
string Name { get; }
RegionInfo RegionInfo { get; } RegionInfo RegionInfo { get; }
RegionStatus RegionStatus { get; set; } RegionStatus RegionStatus { get; set; }

View File

@ -44,9 +44,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
} }
protected int m_objectNameCallsReceived; protected int m_objectNameCallsReceived;
public MockScene() public MockScene() : base(new RegionInfo(1000, 1000, null, null))
{ {
m_regInfo = new RegionInfo(1000, 1000, null, null);
m_regStatus = RegionStatus.Up; m_regStatus = RegionStatus.Up;
} }

View File

@ -599,8 +599,7 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService = sceneGridService; m_sceneGridService = sceneGridService;
m_SimulationDataService = simDataService; m_SimulationDataService = simDataService;
m_EstateDataService = estateDataService; m_EstateDataService = estateDataService;
m_regionHandle = m_regInfo.RegionHandle; m_regionHandle = RegionInfo.RegionHandle;
m_regionName = m_regInfo.RegionName;
m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
m_asyncSceneObjectDeleter.Enabled = true; m_asyncSceneObjectDeleter.Enabled = true;
@ -615,7 +614,7 @@ namespace OpenSim.Region.Framework.Scenes
// resave. // resave.
// FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new // FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new
// region is set up and avoid these gyrations. // region is set up and avoid these gyrations.
RegionSettings rs = simDataService.LoadRegionSettings(m_regInfo.RegionID); RegionSettings rs = simDataService.LoadRegionSettings(RegionInfo.RegionID);
bool updatedTerrainTextures = false; bool updatedTerrainTextures = false;
if (rs.TerrainTexture1 == UUID.Zero) if (rs.TerrainTexture1 == UUID.Zero)
{ {
@ -644,10 +643,10 @@ namespace OpenSim.Region.Framework.Scenes
if (updatedTerrainTextures) if (updatedTerrainTextures)
rs.Save(); rs.Save();
m_regInfo.RegionSettings = rs; RegionInfo.RegionSettings = rs;
if (estateDataService != null) if (estateDataService != null)
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false);
#endregion Region Settings #endregion Region Settings
@ -809,7 +808,7 @@ namespace OpenSim.Region.Framework.Scenes
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
} }
public Scene(RegionInfo regInfo) public Scene(RegionInfo regInfo) : base(regInfo)
{ {
PhysicalPrims = true; PhysicalPrims = true;
CollidablePrims = true; CollidablePrims = true;
@ -836,7 +835,6 @@ namespace OpenSim.Region.Framework.Scenes
WestBorders.Add(westBorder); WestBorders.Add(westBorder);
BordersLocked = false; BordersLocked = false;
m_regInfo = regInfo;
m_eventManager = new EventManager(); m_eventManager = new EventManager();
m_permissions = new ScenePermissions(this); m_permissions = new ScenePermissions(this);
@ -1178,8 +1176,8 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.Close(); m_sceneGraph.Close();
if (!GridService.DeregisterRegion(m_regInfo.RegionID)) if (!GridService.DeregisterRegion(RegionInfo.RegionID))
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
// call the base class Close method. // call the base class Close method.
base.Close(); base.Close();
@ -1699,14 +1697,14 @@ namespace OpenSim.Region.Framework.Scenes
public void StoreWindlightProfile(RegionLightShareData wl) public void StoreWindlightProfile(RegionLightShareData wl)
{ {
m_regInfo.WindlightSettings = wl; RegionInfo.WindlightSettings = wl;
SimulationDataService.StoreRegionWindlightSettings(wl); SimulationDataService.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile(); m_eventManager.TriggerOnSaveNewWindlightProfile();
} }
public void LoadWindlightProfile() public void LoadWindlightProfile()
{ {
m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID); RegionInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_eventManager.TriggerOnSaveNewWindlightProfile(); m_eventManager.TriggerOnSaveNewWindlightProfile();
} }
@ -2191,7 +2189,7 @@ namespace OpenSim.Region.Framework.Scenes
ForceSceneObjectBackup(so); ForceSceneObjectBackup(so);
so.DetachFromBackup(); so.DetachFromBackup();
SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID); SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID);
} }
// We need to keep track of this state in case this group is still queued for further backup. // We need to keep track of this state in case this group is still queued for further backup.
@ -2526,7 +2524,7 @@ namespace OpenSim.Region.Framework.Scenes
// If the user is banned, we won't let any of their objects // If the user is banned, we won't let any of their objects
// enter. Period. // enter. Period.
// //
if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID))
{ {
m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID);
@ -3703,9 +3701,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
if (m_regInfo.EstateSettings != null) if (RegionInfo.EstateSettings != null)
{ {
if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) if (RegionInfo.EstateSettings.IsBanned(agent.AgentID))
{ {
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
@ -3737,7 +3735,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
bool groupAccess = false; bool groupAccess = false;
UUID[] estateGroups = m_regInfo.EstateSettings.EstateGroups; UUID[] estateGroups = RegionInfo.EstateSettings.EstateGroups;
if (estateGroups != null) if (estateGroups != null)
{ {
@ -3755,8 +3753,8 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
} }
if (!m_regInfo.EstateSettings.PublicAccess && if (!RegionInfo.EstateSettings.PublicAccess &&
!m_regInfo.EstateSettings.HasAccess(agent.AgentID) && !RegionInfo.EstateSettings.HasAccess(agent.AgentID) &&
!groupAccess) !groupAccess)
{ {
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
@ -3829,7 +3827,7 @@ namespace OpenSim.Region.Framework.Scenes
// if (loggingOffUser != null) // if (loggingOffUser != null)
// { // {
// UUID localRegionSecret = UUID.Zero; // UUID localRegionSecret = UUID.Zero;
// bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret); // bool parsedsecret = UUID.TryParse(RegionInfo.regionSecret, out localRegionSecret);
// //
// // Region Secret is used here in case a new sessionid overwrites an old one on the user server. // // Region Secret is used here in case a new sessionid overwrites an old one on the user server.
// // Will update the user server in a few revisions to use it. // // Will update the user server in a few revisions to use it.
@ -4048,13 +4046,13 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence sp = GetScenePresence(remoteClient.AgentId); ScenePresence sp = GetScenePresence(remoteClient.AgentId);
if (sp != null) if (sp != null)
{ {
uint regionX = m_regInfo.RegionLocX; uint regionX = RegionInfo.RegionLocX;
uint regionY = m_regInfo.RegionLocY; uint regionY = RegionInfo.RegionLocY;
Utils.LongToUInts(regionHandle, out regionX, out regionY); Utils.LongToUInts(regionHandle, out regionX, out regionY);
int shiftx = (int) regionX - (int) m_regInfo.RegionLocX * (int)Constants.RegionSize; int shiftx = (int) regionX - (int) RegionInfo.RegionLocX * (int)Constants.RegionSize;
int shifty = (int) regionY - (int) m_regInfo.RegionLocY * (int)Constants.RegionSize; int shifty = (int) regionY - (int) RegionInfo.RegionLocY * (int)Constants.RegionSize;
position.X += shiftx; position.X += shiftx;
position.Y += shifty; position.Y += shifty;
@ -4077,7 +4075,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!result) if (!result)
{ {
regionHandle = m_regInfo.RegionHandle; regionHandle = RegionInfo.RegionHandle;
} }
else else
{ {
@ -4588,7 +4586,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteFromStorage(UUID uuid) public void DeleteFromStorage(UUID uuid)
{ {
SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID);
} }
public int GetHealth() public int GetHealth()
@ -5013,7 +5011,7 @@ namespace OpenSim.Region.Framework.Scenes
IEstateDataService estateDataService = EstateDataService; IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null) if (estateDataService != null)
{ {
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false);
TriggerEstateSunUpdate(); TriggerEstateSunUpdate();
} }
} }

View File

@ -52,6 +52,8 @@ namespace OpenSim.Region.Framework.Scenes
#region Fields #region Fields
public string Name { get { return RegionInfo.RegionName; } }
public IConfigSource Config public IConfigSource Config
{ {
get { return GetConfig(); } get { return GetConfig(); }
@ -146,6 +148,11 @@ namespace OpenSim.Region.Framework.Scenes
#endregion #endregion
public SceneBase(RegionInfo regInfo)
{
RegionInfo = regInfo;
}
#region Update Methods #region Update Methods
/// <summary> /// <summary>
@ -209,10 +216,7 @@ namespace OpenSim.Region.Framework.Scenes
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual RegionInfo RegionInfo public virtual RegionInfo RegionInfo { get; private set; }
{
get { return m_regInfo; }
}
#region admin stuff #region admin stuff