aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorlbsa712007-07-16 21:53:39 +0000
committerlbsa712007-07-16 21:53:39 +0000
commitf35f5ddaf753d88d2a5ed7c334a8cc1a4ad23664 (patch)
tree210f6cbfde37e62e31142782c7f33f6cea172cb2 /OpenSim/Region
parent* Reset IP in SimpleApp back to localhost (diff)
downloadopensim-SC_OLD-f35f5ddaf753d88d2a5ed7c334a8cc1a4ad23664.zip
opensim-SC_OLD-f35f5ddaf753d88d2a5ed7c334a8cc1a4ad23664.tar.gz
opensim-SC_OLD-f35f5ddaf753d88d2a5ed7c334a8cc1a4ad23664.tar.bz2
opensim-SC_OLD-f35f5ddaf753d88d2a5ed7c334a8cc1a4ad23664.tar.xz
* And yet more restructuring of startup sequence...
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/Application.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs162
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs16
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs29
4 files changed, 102 insertions, 107 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index a64d05f..ff261d0 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -103,7 +103,7 @@ namespace OpenSim
103 OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile); 103 OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile);
104 104
105 sim.user_accounts = userAccounts; 105 sim.user_accounts = userAccounts;
106 sim.gridLocalAsset = gridLocalAsset; 106 sim.m_gridLocalAsset = gridLocalAsset;
107 107
108 sim.StartUp(); 108 sim.StartUp();
109 109
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 18c81a0..074b34b 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -53,28 +53,26 @@ namespace OpenSim
53 public class OpenSimMain : RegionApplicationBase, conscmd_callback 53 public class OpenSimMain : RegionApplicationBase, conscmd_callback
54 { 54 {
55 public string m_physicsEngine; 55 public string m_physicsEngine;
56 protected IGenericConfig localConfig; 56 public bool m_sandbox;
57 public bool m_sandbox = false;
58 public bool m_loginserver; 57 public bool m_loginserver;
59 public bool user_accounts = false; 58 public bool user_accounts;
60 public bool gridLocalAsset = false; 59 public bool m_gridLocalAsset;
61 protected bool configFileSetup = false; 60 protected bool m_useConfigFile;
62 public string m_config; 61 public string m_configFileName;
63 62
64 protected CommunicationsManager commsManager; 63 protected CommunicationsManager commsManager;
65 // private CheckSumServer checkServer;
66 64
67 private bool m_silent; 65 private bool m_silent;
68 private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; 66 private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log";
69 67
70 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) 68 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngineName, bool useConfigFile, bool silent, string configFileName)
71 :base( ) 69 :base( )
72 { 70 {
73 this.configFileSetup = useConfigFile; 71 m_useConfigFile = useConfigFile;
74 m_sandbox = sandBoxMode; 72 m_sandbox = sandBoxMode;
75 m_loginserver = startLoginServer; 73 m_loginserver = startLoginServer;
76 m_physicsEngine = physicsEngine; 74 m_physicsEngine = physicsEngineName;
77 m_config = configFile; 75 m_configFileName = configFileName;
78 m_silent = silent; 76 m_silent = silent;
79 } 77 }
80 78
@@ -86,17 +84,13 @@ namespace OpenSim
86 { 84 {
87 base.StartUp(); 85 base.StartUp();
88 86
89 m_log.Verbose("Main.cs:Startup() - Loading configuration"); 87 if (!m_sandbox)
90 this.m_networkServersInfo.InitConfig(this.m_sandbox, this.localConfig); 88 {
91 this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change 89 m_httpServer.AddStreamHandler(new SimStatusHandler());
92 90 }
93 ScenePresence.LoadTextureFile("avatar-texture.dat");
94
95 ClientView.TerrainManager = new TerrainManager(new SecondLife());
96
97 this.SetupHttpListener();
98 91
99 m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); 92 AssetCache assetCache = m_assetCache;
93 assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
100 m_inventoryCache = new InventoryCache(); 94 m_inventoryCache = new InventoryCache();
101 95
102 if (m_sandbox) 96 if (m_sandbox)
@@ -108,48 +102,6 @@ namespace OpenSim
108 this.commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer ); 102 this.commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer );
109 } 103 }
110 104
111 this.SetupScene();
112
113 m_log.Verbose("Main.cs:Startup() - Initialising HTTP server");
114
115 //Start http server
116 m_log.Verbose("Main.cs:Startup() - Starting HTTP server");
117 m_httpServer.Start();
118
119 // Start UDP servers
120 for (int i = 0; i < m_udpServer.Count; i++)
121 {
122 this.m_udpServer[i].ServerListener();
123 }
124
125 }
126
127 protected override void Initialize()
128 {
129 this.localConfig = new XmlConfig(m_config);
130 this.localConfig.LoadData();
131
132 if (this.configFileSetup)
133 {
134 this.SetupFromConfigFile(this.localConfig);
135 }
136 }
137
138 protected override LogBase CreateLog()
139 {
140 return new LogBase(m_logFilename, "Region", this, m_silent);
141 }
142
143 # region Setup methods
144
145 protected void SetupScene()
146 {
147 IGenericConfig regionConfig;
148
149 UDPServer udpServer;
150 RegionInfo m_regionInfo = new RegionInfo();
151 AuthenticateSessionsBase authenBase;
152
153 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); 105 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions");
154 string[] configFiles = Directory.GetFiles(path, "*.xml"); 106 string[] configFiles = Directory.GetFiles(path, "*.xml");
155 107
@@ -169,7 +121,18 @@ namespace OpenSim
169 121
170 for (int i = 0; i < configFiles.Length; i++) 122 for (int i = 0; i < configFiles.Length; i++)
171 { 123 {
172 m_regionInfo = new RegionInfo(); 124 Console.WriteLine("Loading region config file");
125
126 IGenericConfig regionConfig = new XmlConfig(configFiles[i]);
127 RegionInfo regionInfo = new RegionInfo();
128 regionConfig.LoadData();
129 regionInfo.InitConfig(this.m_sandbox, regionConfig);
130 regionConfig.Close();
131
132
133
134 AuthenticateSessionsBase authenBase;
135
173 if (m_sandbox) 136 if (m_sandbox)
174 { 137 {
175 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); // new AuthenticateSessionsLocal(); 138 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); // new AuthenticateSessionsLocal();
@@ -182,28 +145,23 @@ namespace OpenSim
182 this.AuthenticateSessionsHandler.Add(authen); 145 this.AuthenticateSessionsHandler.Add(authen);
183 authenBase = authen; 146 authenBase = authen;
184 } 147 }
185 Console.WriteLine("Loading region config file");
186 regionConfig = new XmlConfig(configFiles[i]);
187 regionConfig.LoadData();
188 m_regionInfo.InitConfig(this.m_sandbox, regionConfig);
189 regionConfig.Close();
190 148
191 udpServer = new UDPServer(m_regionInfo.InternalEndPoint.Port, m_assetCache, this.m_inventoryCache, this.m_log, authenBase); 149 UDPServer udpServer = new UDPServer(regionInfo.InternalEndPoint.Port, assetCache, this.m_inventoryCache, this.m_log, authenBase);
192 150
193 m_udpServer.Add(udpServer); 151 m_udpServers.Add(udpServer);
194 this.m_regionData.Add(m_regionInfo); 152 m_regionData.Add(regionInfo);
195 153
196 StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", m_regionInfo.DataStore, m_regionInfo.RegionName); 154 StorageManager tmpStoreManager = GetStoreManager(regionInfo);
197 155
198 Scene scene = new Scene( m_regionInfo, authenBase, commsManager, m_assetCache, tmpStoreManager, m_httpServer); 156 Scene scene = new Scene(regionInfo, authenBase, commsManager, assetCache, tmpStoreManager, m_httpServer);
199 this.m_localWorld.Add(scene); 157 m_localWorld.Add(scene);
200 158
201 udpServer.LocalWorld = scene; 159 udpServer.LocalWorld = scene;
202 160
203 scene.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. 161 scene.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
204 scene.LoadWorldMap(); 162 scene.LoadWorldMap();
205 163
206 PhysicsScene physicsScene = GetPhysicsScene( m_physicsEngine ); 164 PhysicsScene physicsScene = GetPhysicsScene(m_physicsEngine);
207 165
208 scene.PhysScene = physicsScene; 166 scene.PhysScene = physicsScene;
209 scene.PhysScene.SetTerrain(scene.Terrain.getHeights1D()); 167 scene.PhysScene.SetTerrain(scene.Terrain.getHeights1D());
@@ -226,8 +184,46 @@ namespace OpenSim
226 scene.performParcelPrimCountUpdate(); 184 scene.performParcelPrimCountUpdate();
227 scene.StartTimer(); 185 scene.StartTimer();
228 } 186 }
187
188 // Start UDP servers
189 for (int i = 0; i < m_udpServers.Count; i++)
190 {
191 this.m_udpServers[i].ServerListener();
192 }
193
194 }
195
196 protected override StorageManager GetStoreManager(RegionInfo regionInfo)
197 {
198 return new StorageManager("OpenSim.DataStore.NullStorage.dll", regionInfo.DataStore, regionInfo.RegionName);
199 }
200
201 protected override void Initialize()
202 {
203 m_log.Verbose("Loading Configuration [{0}]", m_configFileName);
204
205 IGenericConfig localConfig = new XmlConfig(m_configFileName);
206 localConfig.LoadData();
207
208 if (m_useConfigFile)
209 {
210 SetupFromConfigFile(localConfig);
211 }
212
213 m_networkServersInfo.InitConfig(m_sandbox, localConfig);
214 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
215
216 localConfig.Close();
217
218 }
219
220 protected override LogBase CreateLog()
221 {
222 return new LogBase(m_logFilename, "Region", this, m_silent);
229 } 223 }
230 224
225 # region Setup methods
226
231 protected override PhysicsScene GetPhysicsScene( ) 227 protected override PhysicsScene GetPhysicsScene( )
232 { 228 {
233 return GetPhysicsScene( m_physicsEngine ); 229 return GetPhysicsScene( m_physicsEngine );
@@ -256,16 +252,6 @@ namespace OpenSim
256 } 252 }
257 } 253 }
258 254
259 protected void SetupHttpListener()
260 {
261 m_httpServer = new BaseHttpServer(this.m_networkServersInfo.HttpListenerPort); //regionData[0].IPListenPort);
262
263 if (!this.m_sandbox)
264 {
265 m_httpServer.AddStreamHandler( new SimStatusHandler() );
266 }
267 }
268
269 protected void ConnectToRemoteGridServer() 255 protected void ConnectToRemoteGridServer()
270 { 256 {
271 257
@@ -330,12 +316,12 @@ namespace OpenSim
330 attri = configData.GetAttribute("LocalAssets"); 316 attri = configData.GetAttribute("LocalAssets");
331 if ((attri == "") || ((attri != "false") && (attri != "true"))) 317 if ((attri == "") || ((attri != "false") && (attri != "true")))
332 { 318 {
333 this.gridLocalAsset = false; 319 this.m_gridLocalAsset = false;
334 configData.SetAttribute("LocalAssets", "false"); 320 configData.SetAttribute("LocalAssets", "false");
335 } 321 }
336 else if (attri == "true") 322 else if (attri == "true")
337 { 323 {
338 this.gridLocalAsset = Convert.ToBoolean(attri); 324 this.m_gridLocalAsset = Convert.ToBoolean(attri);
339 } 325 }
340 326
341 327
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 043659b..8467082 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -38,6 +38,7 @@ using OpenSim.Physics.Manager;
38using OpenSim.Region.Caches; 38using OpenSim.Region.Caches;
39using OpenSim.Region.Environment; 39using OpenSim.Region.Environment;
40using libsecondlife; 40using libsecondlife;
41using OpenSim.Region.Environment.Scenes;
41 42
42namespace OpenSim.Region.ClientStack 43namespace OpenSim.Region.ClientStack
43{ 44{
@@ -49,10 +50,11 @@ namespace OpenSim.Region.ClientStack
49 protected DateTime m_startuptime; 50 protected DateTime m_startuptime;
50 protected NetworkServersInfo m_networkServersInfo; 51 protected NetworkServersInfo m_networkServersInfo;
51 52
52 protected List<UDPServer> m_udpServer = new List<UDPServer>(); 53 protected List<UDPServer> m_udpServers = new List<UDPServer>();
53 protected List<RegionInfo> m_regionData = new List<RegionInfo>(); 54 protected List<RegionInfo> m_regionData = new List<RegionInfo>();
54 protected List<IWorld> m_localWorld = new List<IWorld>(); 55 protected List<IWorld> m_localWorld = new List<IWorld>();
55 protected BaseHttpServer m_httpServer; 56 protected BaseHttpServer m_httpServer;
57 protected int m_httpServerPort;
56 protected List<AuthenticateSessionsBase> AuthenticateSessionsHandler = new List<AuthenticateSessionsBase>(); 58 protected List<AuthenticateSessionsBase> AuthenticateSessionsHandler = new List<AuthenticateSessionsBase>();
57 59
58 protected LogBase m_log; 60 protected LogBase m_log;
@@ -72,20 +74,26 @@ namespace OpenSim.Region.ClientStack
72 74
73 StartLog(); 75 StartLog();
74 76
77 ScenePresence.LoadTextureFile("avatar-texture.dat");
78
79 m_httpServer = new BaseHttpServer( m_httpServerPort );
80
81 m_log.Verbose("Starting HTTP server");
82 m_httpServer.Start();
75 } 83 }
76 84
77 protected abstract void Initialize(); 85 protected abstract void Initialize();
78 86
79 private void StartLog() 87 private void StartLog()
80 { 88 {
81 LogBase logBase = CreateLog(); 89 m_log = CreateLog();
82 m_log = logBase;
83 MainLog.Instance = m_log; 90 MainLog.Instance = m_log;
84 } 91 }
85 92
86 protected abstract LogBase CreateLog(); 93 protected abstract LogBase CreateLog();
87 protected abstract PhysicsScene GetPhysicsScene( ); 94 protected abstract PhysicsScene GetPhysicsScene( );
88 95 protected abstract StorageManager GetStoreManager(RegionInfo regionInfo);
96
89 protected PhysicsScene GetPhysicsScene(string engine) 97 protected PhysicsScene GetPhysicsScene(string engine)
90 { 98 {
91 PhysicsPluginManager physicsPluginManager; 99 PhysicsPluginManager physicsPluginManager;
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 2c0d43b..fe8c11a 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -16,6 +16,7 @@ using OpenSim.Region.GridInterfaces.Local;
16using System.Timers; 16using System.Timers;
17using OpenSim.Region.Environment.Scenes; 17using OpenSim.Region.Environment.Scenes;
18using OpenSim.Framework.Data; 18using OpenSim.Framework.Data;
19using OpenSim.Region.Environment;
19 20
20namespace SimpleApp 21namespace SimpleApp
21{ 22{
@@ -34,42 +35,38 @@ namespace SimpleApp
34 35
35 protected override void Initialize() 36 protected override void Initialize()
36 { 37 {
38 m_httpServerPort = 9000;
37 } 39 }
38 40
39 public void Run() 41 public void Run()
40 { 42 {
41 base.StartUp(); 43 base.StartUp();
42 44
43 string ipaddr = "127.0.0.1";
44
45 MainLog.Instance = m_log;
46
47 m_circuitManager = new AuthenticateSessionsBase(); 45 m_circuitManager = new AuthenticateSessionsBase();
48 46
49 InventoryCache inventoryCache = new InventoryCache(); 47 InventoryCache inventoryCache = new InventoryCache();
50 48
51 LocalAssetServer assetServer = new LocalAssetServer(); 49 LocalAssetServer assetServer = new LocalAssetServer();
52 assetServer.SetServerInfo("http://" + ipaddr + ":8003/", ""); 50 assetServer.SetServerInfo("http://localhost:8003/", "");
53 51
54 AssetCache assetCache = new AssetCache(assetServer); 52 AssetCache assetCache = new AssetCache(assetServer);
55 53
56 ScenePresence.LoadTextureFile("avatar-texture.dat"); 54 ScenePresence.LoadTextureFile("avatar-texture.dat");
57 ScenePresence.PhysicsEngineFlying = true; 55 ScenePresence.PhysicsEngineFlying = true;
58 56
59 IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse(ipaddr), 9000); 57 IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9000);
58 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost");
60 59
61 UDPServer udpServer = new UDPServer(internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager); 60 UDPServer udpServer = new UDPServer(internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager);
62 PacketServer packetServer = new PacketServer(udpServer); 61 PacketServer packetServer = new PacketServer(udpServer);
63 62
64 BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port); 63 CommunicationsLocal communicationsManager = new CommunicationsLocal(m_networkServersInfo, m_httpServer);
65 64
66 CommunicationsLocal communicationsManager = new CommunicationsLocal(m_networkServersInfo, httpServer); 65 StorageManager storeMan = GetStoreManager(regionInfo);
67 66
68 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, ipaddr);
69 67
70 OpenSim.Region.Environment.StorageManager storeMan = new OpenSim.Region.Environment.StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp");
71 68
72 m_world = new MyWorld( regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer); 69 m_world = new MyWorld( regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, m_httpServer);
73 m_world.PhysScene = GetPhysicsScene( ); 70 m_world.PhysScene = GetPhysicsScene( );
74 71
75 m_world.LoadWorldMap(); 72 m_world.LoadWorldMap();
@@ -78,7 +75,7 @@ namespace SimpleApp
78 75
79 udpServer.LocalWorld = m_world; 76 udpServer.LocalWorld = m_world;
80 77
81 httpServer.Start(); 78 m_httpServer.Start();
82 udpServer.ServerListener(); 79 udpServer.ServerListener();
83 80
84 UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test"); 81 UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test");
@@ -105,6 +102,11 @@ namespace SimpleApp
105 102
106 } 103 }
107 104
105 protected override StorageManager GetStoreManager(RegionInfo regionInfo)
106 {
107 return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp");
108 }
109
108 protected override PhysicsScene GetPhysicsScene( ) 110 protected override PhysicsScene GetPhysicsScene( )
109 { 111 {
110 return GetPhysicsScene("basicphysics"); 112 return GetPhysicsScene("basicphysics");
@@ -128,8 +130,7 @@ namespace SimpleApp
128 { 130 {
129 Program app = new Program(); 131 Program app = new Program();
130 132
131 //app.StartUp(); 133 app.StartUp();
132 app.Run();
133 } 134 }
134 } 135 }
135} 136}