diff options
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.
7 files changed, 32 insertions, 45 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index c988ad8..24372fe 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -54,6 +54,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
54 | public string Version { get { return m_version; } } | 54 | public string Version { get { return m_version; } } |
55 | public string Name { get { return m_name; } } | 55 | public string Name { get { return m_name; } } |
56 | 56 | ||
57 | protected OpenSimBase m_openSim; | ||
58 | |||
57 | public void Initialise() | 59 | public void Initialise() |
58 | { | 60 | { |
59 | m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); | 61 | m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); |
@@ -62,10 +64,15 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
62 | 64 | ||
63 | public void Initialise(OpenSimBase openSim) | 65 | public void Initialise(OpenSimBase openSim) |
64 | { | 66 | { |
67 | m_openSim = openSim; | ||
68 | } | ||
69 | |||
70 | public void PostInitialise() | ||
71 | { | ||
65 | m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); | 72 | m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); |
66 | 73 | ||
67 | IRegionLoader regionLoader; | 74 | IRegionLoader regionLoader; |
68 | if (openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") | 75 | if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") |
69 | { | 76 | { |
70 | m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); | 77 | m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); |
71 | regionLoader = new RegionLoaderFileSystem(); | 78 | regionLoader = new RegionLoaderFileSystem(); |
@@ -76,14 +83,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
76 | regionLoader = new RegionLoaderWebServer(); | 83 | regionLoader = new RegionLoaderWebServer(); |
77 | } | 84 | } |
78 | 85 | ||
79 | regionLoader.SetIniConfigSource(openSim.ConfigSource.Source); | 86 | regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); |
80 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); | 87 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); |
81 | 88 | ||
82 | openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); | 89 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); |
83 | openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule()); | 90 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule()); |
84 | openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); | 91 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); |
85 | openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); | 92 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); |
86 | openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); | 93 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); |
87 | if (!CheckRegionsForSanity(regionsToLoad)) | 94 | if (!CheckRegionsForSanity(regionsToLoad)) |
88 | { | 95 | { |
89 | m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); | 96 | m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); |
@@ -94,11 +101,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
94 | { | 101 | { |
95 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() + | 102 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() + |
96 | ")"); | 103 | ")"); |
97 | openSim.CreateRegion(regionsToLoad[i], true); | 104 | m_openSim.CreateRegion(regionsToLoad[i], true); |
98 | } | 105 | } |
99 | 106 | ||
100 | openSim.ModuleLoader.PostInitialise(); | 107 | m_openSim.ModuleLoader.PostInitialise(); |
101 | openSim.ModuleLoader.ClearCache(); | 108 | m_openSim.ModuleLoader.ClearCache(); |
102 | } | 109 | } |
103 | 110 | ||
104 | public void Dispose() | 111 | public void Dispose() |
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 065f1ed..7f6ca9a 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -131,6 +131,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | public void PostInitialise() | ||
135 | { | ||
136 | } | ||
137 | |||
134 | public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) | 138 | public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) |
135 | { | 139 | { |
136 | XmlRpcResponse response = new XmlRpcResponse(); | 140 | XmlRpcResponse response = new XmlRpcResponse(); |
diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs index aa70886..a0d4209 100644 --- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs +++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs | |||
@@ -246,6 +246,10 @@ namespace OpenSim.ApplicationPlugins.Rest | |||
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | public virtual void PostInitialise() | ||
250 | { | ||
251 | } | ||
252 | |||
249 | private List<RestStreamHandler> _handlers = new List<RestStreamHandler>(); | 253 | private List<RestStreamHandler> _handlers = new List<RestStreamHandler>(); |
250 | private Dictionary<string, IHttpAgentHandler> _agents = new Dictionary<string, IHttpAgentHandler>(); | 254 | private Dictionary<string, IHttpAgentHandler> _agents = new Dictionary<string, IHttpAgentHandler>(); |
251 | 255 | ||
diff --git a/OpenSim/ApplicationPlugins/ScriptEngine/ScriptEnginePlugin.cs b/OpenSim/ApplicationPlugins/ScriptEngine/ScriptEnginePlugin.cs index b4b5d5b..39bb88e 100644 --- a/OpenSim/ApplicationPlugins/ScriptEngine/ScriptEnginePlugin.cs +++ b/OpenSim/ApplicationPlugins/ScriptEngine/ScriptEnginePlugin.cs | |||
@@ -63,6 +63,10 @@ namespace OpenSim.ApplicationPlugins.ScriptEngine | |||
63 | //m_OpenSim.Shutdown(); | 63 | //m_OpenSim.Shutdown(); |
64 | } | 64 | } |
65 | 65 | ||
66 | public void PostInitialise() | ||
67 | { | ||
68 | } | ||
69 | |||
66 | 70 | ||
67 | #region IApplicationPlugin stuff | 71 | #region IApplicationPlugin stuff |
68 | /// <summary> | 72 | /// <summary> |
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index 1bc3955..1ee97f4 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs | |||
@@ -176,39 +176,6 @@ namespace OpenSim.Grid.GridServer | |||
176 | 176 | ||
177 | public void CheckSims(object sender, ElapsedEventArgs e) | 177 | public void CheckSims(object sender, ElapsedEventArgs e) |
178 | { | 178 | { |
179 | /* | ||
180 | foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values) | ||
181 | { | ||
182 | string SimResponse = String.Empty; | ||
183 | try | ||
184 | { | ||
185 | WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/"); | ||
186 | CheckSim.Method = "GET"; | ||
187 | CheckSim.ContentType = "text/plaintext"; | ||
188 | CheckSim.ContentLength = 0; | ||
189 | |||
190 | StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII); | ||
191 | stOut.Write(String.Empty); | ||
192 | stOut.Close(); | ||
193 | |||
194 | StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream()); | ||
195 | SimResponse = stIn.ReadToEnd(); | ||
196 | stIn.Close(); | ||
197 | } | ||
198 | catch | ||
199 | { | ||
200 | } | ||
201 | |||
202 | if (SimResponse == "OK") | ||
203 | { | ||
204 | m_simProfileManager.SimProfiles[sim.UUID].online = true; | ||
205 | } | ||
206 | else | ||
207 | { | ||
208 | m_simProfileManager.SimProfiles[sim.UUID].online = false; | ||
209 | } | ||
210 | } | ||
211 | */ | ||
212 | } | 179 | } |
213 | 180 | ||
214 | public override void ShutdownSpecific() | 181 | public override void ShutdownSpecific() |
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index dc38a3f..5a1dfd1 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -130,10 +130,10 @@ namespace OpenSim.Grid.UserServer | |||
130 | 130 | ||
131 | //Should be in modules? | 131 | //Should be in modules? |
132 | IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl); | 132 | IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl); |
133 | // IRegionProfileService regionProfileService = new RegionProfileServiceProxy(); | 133 | // IRegionProfileRouter regionProfileService = new RegionProfileServiceProxy(); |
134 | 134 | ||
135 | RegisterInterface<IInterServiceInventoryServices>(inventoryService); | 135 | RegisterInterface<IInterServiceInventoryServices>(inventoryService); |
136 | // RegisterInterface<IRegionProfileService>(regionProfileService); | 136 | // RegisterInterface<IRegionProfileRouter>(regionProfileService); |
137 | 137 | ||
138 | return inventoryService; | 138 | return inventoryService; |
139 | } | 139 | } |
diff --git a/OpenSim/Region/Application/IApplicationPlugin.cs b/OpenSim/Region/Application/IApplicationPlugin.cs index 4fd93e8..09e3336 100644 --- a/OpenSim/Region/Application/IApplicationPlugin.cs +++ b/OpenSim/Region/Application/IApplicationPlugin.cs | |||
@@ -32,6 +32,7 @@ namespace OpenSim | |||
32 | public interface IApplicationPlugin : IPlugin | 32 | public interface IApplicationPlugin : IPlugin |
33 | { | 33 | { |
34 | void Initialise(OpenSimBase openSim); | 34 | void Initialise(OpenSimBase openSim); |
35 | void PostInitialise(); | ||
35 | } | 36 | } |
36 | 37 | ||
37 | public class ApplicationPluginInitialiser : PluginInitialiserBase | 38 | public class ApplicationPluginInitialiser : PluginInitialiserBase |