the attached patch set is centered around RemoteAdminPlugin and focuses
mainly on making it more robust (i.e. more parameter checking and better
error reporting) but also we've re-implemented the LoadTerrain stuff that
got disabled during the terrain code reworking:

   * missing PostInitialize() calls on region modules that were loaded
     for regions created via RemoteAdmin's CreateRegion XmlRpc call
   * re-implements RemoteAdmin's LoadTerrain XmlRpc call (probably lost
     during the TerrainModule rework)
   * adds lots more parameter checking and error reporting to RemoteAdmin
   * adds a read-only property to RegionApplicationBase so that we can
     access the CommsManager
   * adds Exceptions to TerrainModule so that we get better error case
     feedback (and can report more meaningful errors in turn)
   * adds a CheckForTerrainUpdate() call to
     TerrainModule.LoadFromFile() to make terrain changes effective
   * adds TryGetCurrentScene(LLUUID) to SceneManager so that we can
     retrieve Scenes not only by name but also by LLUUID


   cheers,
   dr scofield
This commit is contained in:
Sean Dague
2008-04-21 12:42:56 +00:00
parent a0b8c46ef3
commit bf1580fba4
8 changed files with 170 additions and 68 deletions

View File

@@ -462,7 +462,28 @@ namespace OpenSim
/// <param name="regionInfo"></param>
/// <param name="portadd_flag"></param>
/// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag) {
return CreateRegion(regionInfo, portadd_flag, false);
}
/// <summary>
/// Execute the region creation process. This includes setting up scene infrastructure.
/// </summary>
/// <param name="regionInfo"></param>
/// <param name="portadd_flag"></param>
/// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo) {
return CreateRegion(regionInfo, false, true);
}
/// <summary>
/// Execute the region creation process. This includes setting up scene infrastructure.
/// </summary>
/// <param name="regionInfo"></param>
/// <param name="portadd_flag"></param>
/// <param name="do_post_init"></param>
/// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init)
{
int port = regionInfo.InternalEndPoint.Port;
@@ -487,7 +508,7 @@ namespace OpenSim
m_log.Info("[MODULES]: Loading Region's modules");
m_moduleLoader.PickupModules(scene, ".");
List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, ".");
//m_moduleLoader.PickupModules(scene, "ScriptEngines");
//m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene);
@@ -536,6 +557,14 @@ namespace OpenSim
m_regionData.Add(regionInfo);
udpServer.ServerListener();
if (do_post_init)
{
foreach (IRegionModule module in modules)
{
module.PostInitialise();
}
}
return udpServer;
}

View File

@@ -54,6 +54,9 @@ namespace OpenSim.Region.ClientStack
protected uint m_httpServerPort;
protected CommunicationsManager m_commsManager;
public CommunicationsManager CommunicationsManager {
get { return m_commsManager; }
}
protected SceneManager m_sceneManager = new SceneManager();

View File

@@ -62,14 +62,16 @@ namespace OpenSim.Region.Environment
}
}
public void PickupModules(Scene scene, string moduleDir)
public List<IRegionModule> PickupModules(Scene scene, string moduleDir)
{
DirectoryInfo dir = new DirectoryInfo(moduleDir);
List<IRegionModule> modules = new List<IRegionModule>();
foreach (FileInfo fileInfo in dir.GetFiles("*.dll"))
{
LoadRegionModules(fileInfo.FullName, scene);
modules.AddRange(LoadRegionModules(fileInfo.FullName, scene));
}
return modules;
}
public void LoadDefaultSharedModules()
@@ -190,9 +192,10 @@ namespace OpenSim.Region.Environment
}
}
public void LoadRegionModules(string dllName, Scene scene)
public List<IRegionModule> LoadRegionModules(string dllName, Scene scene)
{
IRegionModule[] modules = LoadModules(dllName);
List<IRegionModule> initializedModules = new List<IRegionModule>();
if (modules.Length > 0)
{
@@ -203,6 +206,7 @@ namespace OpenSim.Region.Environment
{
m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name);
InitializeModule(module, scene);
initializedModules.Add(module);
}
else
{
@@ -211,6 +215,7 @@ namespace OpenSim.Region.Environment
}
}
}
return initializedModules;
}
public void LoadRegionModule(string dllName, string moduleName, Scene scene)

View File

@@ -178,20 +178,24 @@ namespace OpenSim.Region.Environment.Modules.Terrain
{
m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value +
" parser does not support file loading. (May be save only)");
return;
throw new Exception(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value));
}
catch (FileNotFoundException)
{
m_log.Error(
"[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)");
return;
throw new Exception(String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access",
filename));
}
}
CheckForTerrainUpdates();
m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully");
return;
}
}
m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader availible for that format.");
throw new Exception(String.Format("unable to load heightmap from file {0}: no loader available for that format",
filename));
}
/// <summary>
@@ -214,6 +218,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain
catch (NotImplementedException)
{
m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented.");
throw new Exception(String.Format("unable to save heightmap: {0}: saving of this file format not implemented"));
}
}

View File

@@ -250,6 +250,22 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public bool TrySetCurrentScene(LLUUID regionID)
{
Console.WriteLine("Searching for Region: '{0}'", regionID.ToString());
foreach (Scene scene in m_localScenes)
{
if (scene.RegionInfo.RegionID == regionID)
{
m_currentScene = scene;
return true;
}
}
return false;
}
public bool TryGetScene(string regionName, out Scene scene)
{
foreach (Scene mscene in m_localScenes)