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

0.7.4.1
Justin Clark-Casey (justincc) 2012-06-29 00:03:22 +01:00
parent bfa6896678
commit f202c36106
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

@ -614,8 +614,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;
@ -630,7 +629,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)
{ {
@ -659,10 +658,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
@ -828,7 +827,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;
@ -855,7 +854,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);
@ -1199,8 +1197,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();
@ -1720,14 +1718,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();
} }
@ -2218,7 +2216,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.
@ -2553,7 +2551,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);
@ -3734,9 +3732,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);
@ -3768,7 +3766,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)
{ {
@ -3786,8 +3784,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",
@ -3860,7 +3858,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.
@ -4079,13 +4077,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;
@ -4108,7 +4106,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!result) if (!result)
{ {
regionHandle = m_regInfo.RegionHandle; regionHandle = RegionInfo.RegionHandle;
} }
else else
{ {
@ -4614,7 +4612,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()
@ -5039,7 +5037,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