Added a PostInitialise method to IApplicationPlugin, this allows us to do work in there knowing that all other ApplicationPlugins have been initialised by that time.

Moved the loadRegions code in LoadRegionsPlugin to the PostInitialise method.
GenericGridServerConcept
MW 2009-02-26 15:21:06 +00:00
parent 04a6c735d6
commit de82bf9eb5
7 changed files with 32 additions and 45 deletions

View File

@ -54,6 +54,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
public string Version { get { return m_version; } }
public string Name { get { return m_name; } }
protected OpenSimBase m_openSim;
public void Initialise()
{
m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
@ -61,11 +63,16 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
}
public void Initialise(OpenSimBase openSim)
{
m_openSim = openSim;
}
public void PostInitialise()
{
m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
IRegionLoader regionLoader;
if (openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
{
m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem");
regionLoader = new RegionLoaderFileSystem();
@ -76,14 +83,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
regionLoader = new RegionLoaderWebServer();
}
regionLoader.SetIniConfigSource(openSim.ConfigSource.Source);
regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
if (!CheckRegionsForSanity(regionsToLoad))
{
m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
@ -94,11 +101,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
{
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() +
")");
openSim.CreateRegion(regionsToLoad[i], true);
m_openSim.CreateRegion(regionsToLoad[i], true);
}
openSim.ModuleLoader.PostInitialise();
openSim.ModuleLoader.ClearCache();
m_openSim.ModuleLoader.PostInitialise();
m_openSim.ModuleLoader.ClearCache();
}
public void Dispose()

View File

@ -131,6 +131,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
}
public void PostInitialise()
{
}
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();

View File

@ -246,6 +246,10 @@ namespace OpenSim.ApplicationPlugins.Rest
}
}
public virtual void PostInitialise()
{
}
private List<RestStreamHandler> _handlers = new List<RestStreamHandler>();
private Dictionary<string, IHttpAgentHandler> _agents = new Dictionary<string, IHttpAgentHandler>();

View File

@ -63,6 +63,10 @@ namespace OpenSim.ApplicationPlugins.ScriptEngine
//m_OpenSim.Shutdown();
}
public void PostInitialise()
{
}
#region IApplicationPlugin stuff
/// <summary>

View File

@ -176,39 +176,6 @@ namespace OpenSim.Grid.GridServer
public void CheckSims(object sender, ElapsedEventArgs e)
{
/*
foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
{
string SimResponse = String.Empty;
try
{
WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
CheckSim.Method = "GET";
CheckSim.ContentType = "text/plaintext";
CheckSim.ContentLength = 0;
StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
stOut.Write(String.Empty);
stOut.Close();
StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
SimResponse = stIn.ReadToEnd();
stIn.Close();
}
catch
{
}
if (SimResponse == "OK")
{
m_simProfileManager.SimProfiles[sim.UUID].online = true;
}
else
{
m_simProfileManager.SimProfiles[sim.UUID].online = false;
}
}
*/
}
public override void ShutdownSpecific()

View File

@ -130,10 +130,10 @@ namespace OpenSim.Grid.UserServer
//Should be in modules?
IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
// IRegionProfileService regionProfileService = new RegionProfileServiceProxy();
// IRegionProfileRouter regionProfileService = new RegionProfileServiceProxy();
RegisterInterface<IInterServiceInventoryServices>(inventoryService);
// RegisterInterface<IRegionProfileService>(regionProfileService);
// RegisterInterface<IRegionProfileRouter>(regionProfileService);
return inventoryService;
}

View File

@ -32,6 +32,7 @@ namespace OpenSim
public interface IApplicationPlugin : IPlugin
{
void Initialise(OpenSimBase openSim);
void PostInitialise();
}
public class ApplicationPluginInitialiser : PluginInitialiserBase