diff options
author | lbsa71 | 2007-07-16 20:10:54 +0000 |
---|---|---|
committer | lbsa71 | 2007-07-16 20:10:54 +0000 |
commit | 85bdec5e0d30224f66851fe4183eb03e15828fbf (patch) | |
tree | 1215edd4ac26cdc37da2e43f975a04e71e1213cc /OpenSim/Region/Application | |
parent | *Adding some more files (diff) | |
download | opensim-SC-85bdec5e0d30224f66851fe4183eb03e15828fbf.zip opensim-SC-85bdec5e0d30224f66851fe4183eb03e15828fbf.tar.gz opensim-SC-85bdec5e0d30224f66851fe4183eb03e15828fbf.tar.bz2 opensim-SC-85bdec5e0d30224f66851fe4183eb03e15828fbf.tar.xz |
* Massive restructuring of RegionApplicationBase, OpenSimMain and SimpleApp
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/Application.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 97 |
2 files changed, 32 insertions, 67 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index a47ba48..a64d05f 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim | |||
43 | bool sandBoxMode = false; | 43 | bool sandBoxMode = false; |
44 | bool startLoginServer = false; | 44 | bool startLoginServer = false; |
45 | string physicsEngine = "basicphysics"; | 45 | string physicsEngine = "basicphysics"; |
46 | bool allowFlying = false; | 46 | |
47 | bool userAccounts = false; | 47 | bool userAccounts = false; |
48 | bool gridLocalAsset = false; | 48 | bool gridLocalAsset = false; |
49 | bool useConfigFile = false; | 49 | bool useConfigFile = false; |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 368af12..18c81a0 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -78,26 +78,16 @@ namespace OpenSim | |||
78 | m_silent = silent; | 78 | m_silent = silent; |
79 | } | 79 | } |
80 | 80 | ||
81 | |||
81 | /// <summary> | 82 | /// <summary> |
82 | /// Performs initialisation of the world, such as loading configuration from disk. | 83 | /// Performs initialisation of the world, such as loading configuration from disk. |
83 | /// </summary> | 84 | /// </summary> |
84 | public void StartUp() | 85 | public override void StartUp() |
85 | { | 86 | { |
86 | this.m_serversData = new NetworkServersInfo(); | 87 | base.StartUp(); |
87 | |||
88 | this.localConfig = new XmlConfig(m_config); | ||
89 | this.localConfig.LoadData(); | ||
90 | |||
91 | if (this.configFileSetup) | ||
92 | { | ||
93 | this.SetupFromConfigFile(this.localConfig); | ||
94 | } | ||
95 | |||
96 | m_log = new LogBase(m_logFilename, "Region", this, m_silent); | ||
97 | MainLog.Instance = m_log; | ||
98 | 88 | ||
99 | m_log.Verbose("Main.cs:Startup() - Loading configuration"); | 89 | m_log.Verbose("Main.cs:Startup() - Loading configuration"); |
100 | this.m_serversData.InitConfig(this.m_sandbox, this.localConfig); | 90 | this.m_networkServersInfo.InitConfig(this.m_sandbox, this.localConfig); |
101 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change | 91 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change |
102 | 92 | ||
103 | ScenePresence.LoadTextureFile("avatar-texture.dat"); | 93 | ScenePresence.LoadTextureFile("avatar-texture.dat"); |
@@ -106,19 +96,18 @@ namespace OpenSim | |||
106 | 96 | ||
107 | this.SetupHttpListener(); | 97 | this.SetupHttpListener(); |
108 | 98 | ||
99 | m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); | ||
100 | m_inventoryCache = new InventoryCache(); | ||
101 | |||
109 | if (m_sandbox) | 102 | if (m_sandbox) |
110 | { | 103 | { |
111 | this.SetupLocalGridServers(); | 104 | this.commsManager = new CommunicationsLocal( m_networkServersInfo, m_httpServer); |
112 | // this.checkServer = new CheckSumServer(12036); | ||
113 | // this.checkServer.ServerListener(); | ||
114 | } | 105 | } |
115 | else | 106 | else |
116 | { | 107 | { |
117 | this.SetupRemoteGridServers(); | 108 | this.commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer ); |
118 | } | 109 | } |
119 | 110 | ||
120 | m_startuptime = DateTime.Now; | ||
121 | |||
122 | this.SetupScene(); | 111 | this.SetupScene(); |
123 | 112 | ||
124 | m_log.Verbose("Main.cs:Startup() - Initialising HTTP server"); | 113 | m_log.Verbose("Main.cs:Startup() - Initialising HTTP server"); |
@@ -135,44 +124,30 @@ namespace OpenSim | |||
135 | 124 | ||
136 | } | 125 | } |
137 | 126 | ||
138 | # region Setup methods | 127 | protected override void Initialize() |
139 | protected void SetupLocalGridServers() | ||
140 | { | 128 | { |
141 | try | 129 | this.localConfig = new XmlConfig(m_config); |
142 | { | 130 | this.localConfig.LoadData(); |
143 | m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.m_serversData.AssetURL, this.m_serversData.AssetSendKey); | 131 | |
144 | m_inventoryCache = new InventoryCache(); | 132 | if (this.configFileSetup) |
145 | this.commsManager = new CommunicationsLocal(this.m_serversData, m_httpServer); | ||
146 | } | ||
147 | catch (Exception e) | ||
148 | { | 133 | { |
149 | m_log.Error(e.Message + "\nSorry, could not setup local cache"); | 134 | this.SetupFromConfigFile(this.localConfig); |
150 | Environment.Exit(1); | ||
151 | } | 135 | } |
152 | |||
153 | } | 136 | } |
154 | 137 | ||
155 | protected void SetupRemoteGridServers() | 138 | protected override LogBase CreateLog() |
156 | { | 139 | { |
157 | try | 140 | return new LogBase(m_logFilename, "Region", this, m_silent); |
158 | { | ||
159 | m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.m_serversData.AssetURL, this.m_serversData.AssetSendKey); | ||
160 | m_inventoryCache = new InventoryCache(); | ||
161 | this.commsManager = new CommunicationsOGS1(this.m_serversData, m_httpServer); | ||
162 | } | ||
163 | catch (Exception e) | ||
164 | { | ||
165 | m_log.Error(e.Message + "\nSorry, could not setup remote cache"); | ||
166 | Environment.Exit(1); | ||
167 | } | ||
168 | } | 141 | } |
169 | 142 | ||
143 | # region Setup methods | ||
144 | |||
170 | protected void SetupScene() | 145 | protected void SetupScene() |
171 | { | 146 | { |
172 | IGenericConfig regionConfig; | 147 | IGenericConfig regionConfig; |
173 | Scene scene; | 148 | |
174 | UDPServer udpServer; | 149 | UDPServer udpServer; |
175 | RegionInfo regionDat = new RegionInfo(); | 150 | RegionInfo m_regionInfo = new RegionInfo(); |
176 | AuthenticateSessionsBase authenBase; | 151 | AuthenticateSessionsBase authenBase; |
177 | 152 | ||
178 | string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); | 153 | string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); |
@@ -194,7 +169,7 @@ namespace OpenSim | |||
194 | 169 | ||
195 | for (int i = 0; i < configFiles.Length; i++) | 170 | for (int i = 0; i < configFiles.Length; i++) |
196 | { | 171 | { |
197 | regionDat = new RegionInfo(); | 172 | m_regionInfo = new RegionInfo(); |
198 | if (m_sandbox) | 173 | if (m_sandbox) |
199 | { | 174 | { |
200 | AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); // new AuthenticateSessionsLocal(); | 175 | AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); // new AuthenticateSessionsLocal(); |
@@ -210,17 +185,17 @@ namespace OpenSim | |||
210 | Console.WriteLine("Loading region config file"); | 185 | Console.WriteLine("Loading region config file"); |
211 | regionConfig = new XmlConfig(configFiles[i]); | 186 | regionConfig = new XmlConfig(configFiles[i]); |
212 | regionConfig.LoadData(); | 187 | regionConfig.LoadData(); |
213 | regionDat.InitConfig(this.m_sandbox, regionConfig); | 188 | m_regionInfo.InitConfig(this.m_sandbox, regionConfig); |
214 | regionConfig.Close(); | 189 | regionConfig.Close(); |
215 | 190 | ||
216 | udpServer = new UDPServer(regionDat.InternalEndPoint.Port, m_assetCache, this.m_inventoryCache, this.m_log, authenBase); | 191 | udpServer = new UDPServer(m_regionInfo.InternalEndPoint.Port, m_assetCache, this.m_inventoryCache, this.m_log, authenBase); |
217 | 192 | ||
218 | m_udpServer.Add(udpServer); | 193 | m_udpServer.Add(udpServer); |
219 | this.m_regionData.Add(regionDat); | 194 | this.m_regionData.Add(m_regionInfo); |
220 | 195 | ||
221 | StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", regionDat.DataStore, regionDat.RegionName); | 196 | StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", m_regionInfo.DataStore, m_regionInfo.RegionName); |
222 | 197 | ||
223 | scene = new Scene( regionDat, authenBase, commsManager, m_assetCache, tmpStoreManager, m_httpServer); | 198 | Scene scene = new Scene( m_regionInfo, authenBase, commsManager, m_assetCache, tmpStoreManager, m_httpServer); |
224 | this.m_localWorld.Add(scene); | 199 | this.m_localWorld.Add(scene); |
225 | 200 | ||
226 | udpServer.LocalWorld = scene; | 201 | udpServer.LocalWorld = scene; |
@@ -253,12 +228,9 @@ namespace OpenSim | |||
253 | } | 228 | } |
254 | } | 229 | } |
255 | 230 | ||
256 | private static PhysicsScene GetPhysicsScene(string physicsEngine) | 231 | protected override PhysicsScene GetPhysicsScene( ) |
257 | { | 232 | { |
258 | PhysicsPluginManager physicsPluginManager; | 233 | return GetPhysicsScene( m_physicsEngine ); |
259 | physicsPluginManager = new PhysicsPluginManager(); | ||
260 | physicsPluginManager.LoadPlugins(); | ||
261 | return physicsPluginManager.GetPhysicsScene( physicsEngine ); | ||
262 | } | 234 | } |
263 | 235 | ||
264 | private class SimStatusHandler : IStreamHandler | 236 | private class SimStatusHandler : IStreamHandler |
@@ -286,7 +258,7 @@ namespace OpenSim | |||
286 | 258 | ||
287 | protected void SetupHttpListener() | 259 | protected void SetupHttpListener() |
288 | { | 260 | { |
289 | m_httpServer = new BaseHttpServer(this.m_serversData.HttpListenerPort); //regionData[0].IPListenPort); | 261 | m_httpServer = new BaseHttpServer(this.m_networkServersInfo.HttpListenerPort); //regionData[0].IPListenPort); |
290 | 262 | ||
291 | if (!this.m_sandbox) | 263 | if (!this.m_sandbox) |
292 | { | 264 | { |
@@ -372,16 +344,9 @@ namespace OpenSim | |||
372 | switch (attri) | 344 | switch (attri) |
373 | { | 345 | { |
374 | default: | 346 | default: |
375 | m_log.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); | 347 | throw new ArgumentException(String.Format( "Invalid value [{0}] for PhysicsEngine attribute, terminating", attri ) ); |
376 | Environment.Exit(1); | ||
377 | break; | ||
378 | 348 | ||
379 | case "": | 349 | case "": |
380 | this.m_physicsEngine = "basicphysics"; | ||
381 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
382 | ScenePresence.PhysicsEngineFlying = false; | ||
383 | break; | ||
384 | |||
385 | case "basicphysics": | 350 | case "basicphysics": |
386 | this.m_physicsEngine = "basicphysics"; | 351 | this.m_physicsEngine = "basicphysics"; |
387 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | 352 | configData.SetAttribute("PhysicsEngine", "basicphysics"); |