aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2009-03-03 12:51:54 +0000
committerMW2009-03-03 12:51:54 +0000
commit76133d07630d8a1547c034b28585a931f751ad1b (patch)
tree672bd4752f83c566942ce92b36a307bf187cfbea /OpenSim
parentRenamed OpenSimBase m_autoCreateLindenStack to m_autoCreateClientStack (diff)
downloadopensim-SC_OLD-76133d07630d8a1547c034b28585a931f751ad1b.zip
opensim-SC_OLD-76133d07630d8a1547c034b28585a931f751ad1b.tar.gz
opensim-SC_OLD-76133d07630d8a1547c034b28585a931f751ad1b.tar.bz2
opensim-SC_OLD-76133d07630d8a1547c034b28585a931f751ad1b.tar.xz
Refactoring of CreateCommsManagerPlugin.
Plus some general cleanup of a few other files (deleting excess blank lines etc)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs60
-rw-r--r--OpenSim/Client/Linden/LLClientStackModule.cs7
-rw-r--r--OpenSim/Framework/Util.cs3
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs34
4 files changed, 34 insertions, 70 deletions
diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
index 94183c3..7323ad7 100644
--- a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
+++ b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
@@ -176,10 +176,7 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
176 176
177 LocalBackEndServices backendService = new LocalBackEndServices(); 177 LocalBackEndServices backendService = new LocalBackEndServices();
178 178
179 LocalLoginService loginService = 179 LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
180 new LocalLoginService(
181 userService, m_openSim.ConfigurationSettings.StandaloneWelcomeMessage, inventoryService, backendService, m_openSim.NetServersInfo,
182 m_openSim.ConfigurationSettings.StandaloneAuthenticate, libraryRootFolder);
183 180
184 m_commsManager 181 m_commsManager
185 = new CommunicationsLocal( 182 = new CommunicationsLocal(
@@ -187,20 +184,7 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
187 inventoryService, backendService, userService, 184 inventoryService, backendService, userService,
188 libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile); 185 libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile);
189 186
190 // set up XMLRPC handler for client's initial login request message 187 CreateGridInfoService();
191 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
192
193 // provides the web form login
194 m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin);
195
196 // Provides the LLSD login
197 m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod);
198
199 // provide grid info
200 // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini")));
201 m_gridInfoService = new GridInfoService(m_openSim.ConfigSource.Source);
202 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
203 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
204 } 188 }
205 189
206 protected virtual void InitialiseGridServices(LibraryRootFolder libraryRootFolder) 190 protected virtual void InitialiseGridServices(LibraryRootFolder libraryRootFolder)
@@ -226,11 +210,7 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
226 //LocalBackEndServices backendService = new LocalBackEndServices(); 210 //LocalBackEndServices backendService = new LocalBackEndServices();
227 HGGridServicesStandalone gridService = new HGGridServicesStandalone(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager); 211 HGGridServicesStandalone gridService = new HGGridServicesStandalone(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager);
228 212
229 LocalLoginService loginService = 213 LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, gridService.LocalBackend);
230 new LocalLoginService(
231 userService, m_openSim.ConfigurationSettings.StandaloneWelcomeMessage, inventoryService, gridService.LocalBackend, m_openSim.NetServersInfo,
232 m_openSim.ConfigurationSettings.StandaloneAuthenticate, libraryRootFolder);
233
234 214
235 m_commsManager = new HGCommunicationsStandalone(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, 215 m_commsManager = new HGCommunicationsStandalone(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache,
236 userService, userService, inventoryService, gridService, userService, libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile); 216 userService, userService, inventoryService, gridService, userService, libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile);
@@ -238,6 +218,26 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
238 inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService; 218 inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService;
239 HGServices = gridService; 219 HGServices = gridService;
240 220
221 CreateGridInfoService();
222 }
223
224
225 protected virtual void InitialiseHGGridServices(LibraryRootFolder libraryRootFolder)
226 {
227 m_commsManager = new HGCommunicationsGridMode(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager, libraryRootFolder);
228
229 HGServices = ((HGCommunicationsGridMode)m_commsManager).HGServices;
230
231 m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
232 }
233
234 private LocalLoginService CreateLoginService(LibraryRootFolder libraryRootFolder, IInterServiceInventoryServices inventoryService, LocalUserServices userService, LocalBackEndServices backendService)
235 {
236 LocalLoginService loginService =
237 new LocalLoginService(
238 userService, m_openSim.ConfigurationSettings.StandaloneWelcomeMessage, inventoryService, backendService, m_openSim.NetServersInfo,
239 m_openSim.ConfigurationSettings.StandaloneAuthenticate, libraryRootFolder);
240
241 // set up XMLRPC handler for client's initial login request message 241 // set up XMLRPC handler for client's initial login request message
242 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); 242 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
243 243
@@ -247,20 +247,16 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
247 // Provides the LLSD login 247 // Provides the LLSD login
248 m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod); 248 m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod);
249 249
250 return loginService;
251 }
252
253 private void CreateGridInfoService()
254 {
250 // provide grid info 255 // provide grid info
251 // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini"))); 256 // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini")));
252 m_gridInfoService = new GridInfoService(m_openSim.ConfigSource.Source); 257 m_gridInfoService = new GridInfoService(m_openSim.ConfigSource.Source);
253 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); 258 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
254 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); 259 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
255 } 260 }
256
257 protected virtual void InitialiseHGGridServices(LibraryRootFolder libraryRootFolder)
258 {
259 m_commsManager = new HGCommunicationsGridMode(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager, libraryRootFolder);
260
261 HGServices = ((HGCommunicationsGridMode)m_commsManager).HGServices;
262
263 m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
264 }
265 } 261 }
266} 262}
diff --git a/OpenSim/Client/Linden/LLClientStackModule.cs b/OpenSim/Client/Linden/LLClientStackModule.cs
index 57331e5..6b23224 100644
--- a/OpenSim/Client/Linden/LLClientStackModule.cs
+++ b/OpenSim/Client/Linden/LLClientStackModule.cs
@@ -1,5 +1,6 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Net;
3using System.Reflection; 4using System.Reflection;
4using System.Text; 5using System.Text;
5using log4net; 6using log4net;
@@ -47,11 +48,13 @@ namespace OpenSim.Client.Linden
47 if ((m_scene != null) && (m_createClientStack)) 48 if ((m_scene != null) && (m_createClientStack))
48 { 49 {
49 m_log.Info("[LLClientStackModule] Starting up LLClientStack."); 50 m_log.Info("[LLClientStackModule] Starting up LLClientStack.");
50 uint port = (uint)m_scene.RegionInfo.InternalEndPoint.Port; 51 IPEndPoint endPoint = m_scene.RegionInfo.InternalEndPoint;
52
53 uint port = (uint)endPoint.Port;
51 m_clientStackManager = new ClientStackManager(m_clientStackDll); 54 m_clientStackManager = new ClientStackManager(m_clientStackDll);
52 55
53 m_clientServer 56 m_clientServer
54 = m_clientStackManager.CreateServer(m_scene.RegionInfo.InternalEndPoint.Address, 57 = m_clientStackManager.CreateServer(endPoint.Address,
55 ref port, m_scene.RegionInfo.ProxyOffset, m_scene.RegionInfo.m_allow_alternate_ports, m_source, 58 ref port, m_scene.RegionInfo.ProxyOffset, m_scene.RegionInfo.m_allow_alternate_ports, m_source,
56 m_scene.CommsManager.AssetCache, m_scene.AuthenticateHandler); 59 m_scene.CommsManager.AssetCache, m_scene.AuthenticateHandler);
57 60
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index d978c4c..ba19dc6 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -766,8 +766,7 @@ namespace OpenSim.Framework
766 } 766 }
767 767
768 memory.Position = 0; 768 memory.Position = 0;
769 // MemoryStream outStream = new MemoryStream(); 769
770
771 byte[] compressed = new byte[memory.Length]; 770 byte[] compressed = new byte[memory.Length];
772 memory.Read(compressed, 0, compressed.Length); 771 memory.Read(compressed, 0, compressed.Length);
773 772
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 7569502..323d90c 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -206,7 +206,6 @@ namespace OpenSim
206 } 206 }
207 207
208 AddPluginCommands(); 208 AddPluginCommands();
209
210 } 209 }
211 210
212 protected virtual void AddPluginCommands() 211 protected virtual void AddPluginCommands()
@@ -269,14 +268,10 @@ namespace OpenSim
269 268
270 protected override void Initialize() 269 protected override void Initialize()
271 { 270 {
272 //
273 // Called from base.StartUp() 271 // Called from base.StartUp()
274 //
275 272
276 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 273 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
277
278 InitialiseAssetCache(); 274 InitialiseAssetCache();
279
280 m_sceneManager.OnRestartSim += handleRestartRegion; 275 m_sceneManager.OnRestartSim += handleRestartRegion;
281 } 276 }
282 277
@@ -291,10 +286,8 @@ namespace OpenSim
291 /// returns an IAssetCache implementation, if possible. This is a virtual 286 /// returns an IAssetCache implementation, if possible. This is a virtual
292 /// method. 287 /// method.
293 /// </summary> 288 /// </summary>
294
295 protected virtual void InitialiseAssetCache() 289 protected virtual void InitialiseAssetCache()
296 { 290 {
297
298 LegacyAssetClientPluginInitialiser linit = null; 291 LegacyAssetClientPluginInitialiser linit = null;
299 CryptoAssetClientPluginInitialiser cinit = null; 292 CryptoAssetClientPluginInitialiser cinit = null;
300 AssetClientPluginInitialiser init = null; 293 AssetClientPluginInitialiser init = null;
@@ -308,7 +301,6 @@ namespace OpenSim
308 // If "default" is specified, then the value is adjusted 301 // If "default" is specified, then the value is adjusted
309 // according to whether or not the server is running in 302 // according to whether or not the server is running in
310 // standalone mode. 303 // standalone mode.
311
312 if (mode.ToLower() == "default") 304 if (mode.ToLower() == "default")
313 { 305 {
314 if (m_configSettings.Standalone == false) 306 if (m_configSettings.Standalone == false)
@@ -319,19 +311,15 @@ namespace OpenSim
319 311
320 switch (mode.ToLower()) 312 switch (mode.ToLower())
321 { 313 {
322
323 // If grid is specified then the grid server is chose regardless 314 // If grid is specified then the grid server is chose regardless
324 // of whether the server is standalone. 315 // of whether the server is standalone.
325
326 case "grid" : 316 case "grid" :
327 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL); 317 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
328 assetServer = loadAssetServer("Grid", linit); 318 assetServer = loadAssetServer("Grid", linit);
329 break; 319 break;
330 320
331
332 // If cryptogrid is specified then the cryptogrid server is chose regardless 321 // If cryptogrid is specified then the cryptogrid server is chose regardless
333 // of whether the server is standalone. 322 // of whether the server is standalone.
334
335 case "cryptogrid" : 323 case "cryptogrid" :
336 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL, 324 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
337 Environment.CurrentDirectory, true); 325 Environment.CurrentDirectory, true);
@@ -340,7 +328,6 @@ namespace OpenSim
340 328
341 // If cryptogrid_eou is specified then the cryptogrid_eou server is chose regardless 329 // If cryptogrid_eou is specified then the cryptogrid_eou server is chose regardless
342 // of whether the server is standalone. 330 // of whether the server is standalone.
343
344 case "cryptogrid_eou" : 331 case "cryptogrid_eou" :
345 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL, 332 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
346 Environment.CurrentDirectory, false); 333 Environment.CurrentDirectory, false);
@@ -349,7 +336,6 @@ namespace OpenSim
349 336
350 // If file is specified then the file server is chose regardless 337 // If file is specified then the file server is chose regardless
351 // of whether the server is standalone. 338 // of whether the server is standalone.
352
353 case "file" : 339 case "file" :
354 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL); 340 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
355 assetServer = loadAssetServer("File", linit); 341 assetServer = loadAssetServer("File", linit);
@@ -358,14 +344,12 @@ namespace OpenSim
358 // If local is specified then we're going to use the local SQL server 344 // If local is specified then we're going to use the local SQL server
359 // implementation. We drop through, because that will be the fallback 345 // implementation. We drop through, because that will be the fallback
360 // for the following default clause too. 346 // for the following default clause too.
361
362 case "local" : 347 case "local" :
363 break; 348 break;
364 349
365 // If the asset_database value is none of the previously mentioned strings, then we 350 // If the asset_database value is none of the previously mentioned strings, then we
366 // try to load a turnkey plugin that matches this value. If not we drop through to 351 // try to load a turnkey plugin that matches this value. If not we drop through to
367 // a local default. 352 // a local default.
368
369 default : 353 default :
370 try 354 try
371 { 355 {
@@ -376,11 +360,9 @@ namespace OpenSim
376 catch {} 360 catch {}
377 m_log.Info("[OPENSIMBASE] Default assetserver will be used"); 361 m_log.Info("[OPENSIMBASE] Default assetserver will be used");
378 break; 362 break;
379
380 } 363 }
381 364
382 // Open the local SQL-based database asset server 365 // Open the local SQL-based database asset server
383
384 if (assetServer == null) 366 if (assetServer == null)
385 { 367 {
386 init = new AssetClientPluginInitialiser(m_configSettings); 368 init = new AssetClientPluginInitialiser(m_configSettings);
@@ -391,18 +373,14 @@ namespace OpenSim
391 373
392 // Initialize the asset cache, passing a reference to the selected 374 // Initialize the asset cache, passing a reference to the selected
393 // asset server interface. 375 // asset server interface.
394
395 m_assetCache = ResolveAssetCache(assetServer); 376 m_assetCache = ResolveAssetCache(assetServer);
396
397 } 377 }
398 378
399 // This method loads the identified asset server, passing an approrpiately 379 // This method loads the identified asset server, passing an approrpiately
400 // initialized Initialise wrapper. There should to be exactly one match, 380 // initialized Initialise wrapper. There should to be exactly one match,
401 // if not, then the first match is used. 381 // if not, then the first match is used.
402
403 private IAssetServer loadAssetServer(string id, PluginInitialiserBase pi) 382 private IAssetServer loadAssetServer(string id, PluginInitialiserBase pi)
404 { 383 {
405
406 if (id != null && id != String.Empty) 384 if (id != null && id != String.Empty)
407 { 385 {
408 m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset server id={0}", id); 386 m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset server id={0}", id);
@@ -424,9 +402,7 @@ namespace OpenSim
424 m_log.DebugFormat("[OPENSIMBASE] Asset server {0} not loaded ({1})", id, e.Message); 402 m_log.DebugFormat("[OPENSIMBASE] Asset server {0} not loaded ({1})", id, e.Message);
425 } 403 }
426 } 404 }
427
428 return null; 405 return null;
429
430 } 406 }
431 407
432 /// <summary> 408 /// <summary>
@@ -439,21 +415,14 @@ namespace OpenSim
439 /// The AssetCache value is obtained from the 415 /// The AssetCache value is obtained from the
440 /// [StartUp]/AssetCache value in the configuration file. 416 /// [StartUp]/AssetCache value in the configuration file.
441 /// </summary> 417 /// </summary>
442
443 protected virtual IAssetCache ResolveAssetCache(IAssetServer assetServer) 418 protected virtual IAssetCache ResolveAssetCache(IAssetServer assetServer)
444 { 419 {
445
446 IAssetCache assetCache = null; 420 IAssetCache assetCache = null;
447
448
449 if (m_configSettings.AssetCache != null && m_configSettings.AssetCache != String.Empty) 421 if (m_configSettings.AssetCache != null && m_configSettings.AssetCache != String.Empty)
450 { 422 {
451
452 m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset cache id={0}", m_configSettings.AssetCache); 423 m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset cache id={0}", m_configSettings.AssetCache);
453
454 try 424 try
455 { 425 {
456
457 PluginInitialiserBase init = new AssetCachePluginInitialiser(m_configSettings, assetServer); 426 PluginInitialiserBase init = new AssetCachePluginInitialiser(m_configSettings, assetServer);
458 PluginLoader<IAssetCache> loader = new PluginLoader<IAssetCache>(init); 427 PluginLoader<IAssetCache> loader = new PluginLoader<IAssetCache>(init);
459 loader.AddFilter(PLUGIN_ASSET_CACHE, new PluginProviderFilter(m_configSettings.AssetCache)); 428 loader.AddFilter(PLUGIN_ASSET_CACHE, new PluginProviderFilter(m_configSettings.AssetCache));
@@ -461,7 +430,6 @@ namespace OpenSim
461 loader.Load(PLUGIN_ASSET_CACHE); 430 loader.Load(PLUGIN_ASSET_CACHE);
462 if (loader.Plugins.Count > 0) 431 if (loader.Plugins.Count > 0)
463 assetCache = (IAssetCache) loader.Plugins[0]; 432 assetCache = (IAssetCache) loader.Plugins[0];
464
465 } 433 }
466 catch (Exception e) 434 catch (Exception e)
467 { 435 {
@@ -471,9 +439,7 @@ namespace OpenSim
471 } 439 }
472 440
473 // If everything else fails, we force load the built-in asset cache 441 // If everything else fails, we force load the built-in asset cache
474
475 return (IAssetCache) ((assetCache != null) ? assetCache : new AssetCache(assetServer)); 442 return (IAssetCache) ((assetCache != null) ? assetCache : new AssetCache(assetServer));
476
477 } 443 }
478 444
479 public void ProcessLogin(bool LoginEnabled) 445 public void ProcessLogin(bool LoginEnabled)