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
parent
04a6c735d6
commit
de82bf9eb5
|
@ -54,6 +54,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
public string Version { get { return m_version; } }
|
public string Version { get { return m_version; } }
|
||||||
public string Name { get { return m_name; } }
|
public string Name { get { return m_name; } }
|
||||||
|
|
||||||
|
protected OpenSimBase m_openSim;
|
||||||
|
|
||||||
public void Initialise()
|
public void Initialise()
|
||||||
{
|
{
|
||||||
m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
|
m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
|
||||||
|
@ -61,11 +63,16 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(OpenSimBase openSim)
|
public void Initialise(OpenSimBase openSim)
|
||||||
|
{
|
||||||
|
m_openSim = openSim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
|
m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
|
||||||
|
|
||||||
IRegionLoader regionLoader;
|
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");
|
m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem");
|
||||||
regionLoader = new RegionLoaderFileSystem();
|
regionLoader = new RegionLoaderFileSystem();
|
||||||
|
@ -76,14 +83,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
regionLoader = new RegionLoaderWebServer();
|
regionLoader = new RegionLoaderWebServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
regionLoader.SetIniConfigSource(openSim.ConfigSource.Source);
|
regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
|
||||||
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
||||||
|
|
||||||
openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
|
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
|
||||||
openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
|
m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
|
||||||
openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
||||||
openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
|
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
|
||||||
openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
||||||
if (!CheckRegionsForSanity(regionsToLoad))
|
if (!CheckRegionsForSanity(regionsToLoad))
|
||||||
{
|
{
|
||||||
m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
|
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() +
|
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();
|
m_openSim.ModuleLoader.PostInitialise();
|
||||||
openSim.ModuleLoader.ClearCache();
|
m_openSim.ModuleLoader.ClearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
@ -131,6 +131,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
|
|
@ -246,6 +246,10 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void PostInitialise()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private List<RestStreamHandler> _handlers = new List<RestStreamHandler>();
|
private List<RestStreamHandler> _handlers = new List<RestStreamHandler>();
|
||||||
private Dictionary<string, IHttpAgentHandler> _agents = new Dictionary<string, IHttpAgentHandler>();
|
private Dictionary<string, IHttpAgentHandler> _agents = new Dictionary<string, IHttpAgentHandler>();
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,10 @@ namespace OpenSim.ApplicationPlugins.ScriptEngine
|
||||||
//m_OpenSim.Shutdown();
|
//m_OpenSim.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region IApplicationPlugin stuff
|
#region IApplicationPlugin stuff
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -176,39 +176,6 @@ namespace OpenSim.Grid.GridServer
|
||||||
|
|
||||||
public void CheckSims(object sender, ElapsedEventArgs e)
|
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()
|
public override void ShutdownSpecific()
|
||||||
|
|
|
@ -130,10 +130,10 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
//Should be in modules?
|
//Should be in modules?
|
||||||
IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
|
IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
|
||||||
// IRegionProfileService regionProfileService = new RegionProfileServiceProxy();
|
// IRegionProfileRouter regionProfileService = new RegionProfileServiceProxy();
|
||||||
|
|
||||||
RegisterInterface<IInterServiceInventoryServices>(inventoryService);
|
RegisterInterface<IInterServiceInventoryServices>(inventoryService);
|
||||||
// RegisterInterface<IRegionProfileService>(regionProfileService);
|
// RegisterInterface<IRegionProfileRouter>(regionProfileService);
|
||||||
|
|
||||||
return inventoryService;
|
return inventoryService;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace OpenSim
|
||||||
public interface IApplicationPlugin : IPlugin
|
public interface IApplicationPlugin : IPlugin
|
||||||
{
|
{
|
||||||
void Initialise(OpenSimBase openSim);
|
void Initialise(OpenSimBase openSim);
|
||||||
|
void PostInitialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ApplicationPluginInitialiser : PluginInitialiserBase
|
public class ApplicationPluginInitialiser : PluginInitialiserBase
|
||||||
|
|
Loading…
Reference in New Issue