aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimBase.cs
diff options
context:
space:
mode:
authorMelanie Thielker2009-05-18 23:18:04 +0000
committerMelanie Thielker2009-05-18 23:18:04 +0000
commit23d902be42fd6d554a9098936d501609fc6e5315 (patch)
tree1830b906665ffa34b3f7c085e28d87ee16bf4c9f /OpenSim/Region/Application/OpenSimBase.cs
parentBug fix and config rename. (diff)
downloadopensim-SC_OLD-23d902be42fd6d554a9098936d501609fc6e5315.zip
opensim-SC_OLD-23d902be42fd6d554a9098936d501609fc6e5315.tar.gz
opensim-SC_OLD-23d902be42fd6d554a9098936d501609fc6e5315.tar.bz2
opensim-SC_OLD-23d902be42fd6d554a9098936d501609fc6e5315.tar.xz
Remove the old asset cache and local services and the configurations for them
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs164
1 files changed, 1 insertions, 163 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index cc1f59a..14ae5f1 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -281,7 +281,6 @@ namespace OpenSim
281 // Called from base.StartUp() 281 // Called from base.StartUp()
282 282
283 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 283 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
284 InitialiseAssetCache();
285 m_sceneManager.OnRestartSim += handleRestartRegion; 284 m_sceneManager.OnRestartSim += handleRestartRegion;
286 } 285 }
287 286
@@ -296,167 +295,6 @@ namespace OpenSim
296 /// returns an IAssetCache implementation, if possible. This is a virtual 295 /// returns an IAssetCache implementation, if possible. This is a virtual
297 /// method. 296 /// method.
298 /// </summary> 297 /// </summary>
299 protected virtual void InitialiseAssetCache()
300 {
301 LegacyAssetClientPluginInitialiser linit = null;
302 CryptoAssetClientPluginInitialiser cinit = null;
303 AssetClientPluginInitialiser init = null;
304
305 IAssetServer assetServer = null;
306 string mode = m_configSettings.AssetStorage;
307
308 if (mode == null | mode == String.Empty)
309 mode = "default";
310
311 // If "default" is specified, then the value is adjusted
312 // according to whether or not the server is running in
313 // standalone mode.
314 if (mode.ToLower() == "default")
315 {
316 if (m_configSettings.Standalone == false)
317 mode = "grid";
318 else
319 mode = "local";
320 }
321
322 switch (mode.ToLower())
323 {
324 // If grid is specified then the grid server is chose regardless
325 // of whether the server is standalone.
326 case "grid":
327 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
328 assetServer = loadAssetServer("Grid", linit);
329 break;
330
331 // If cryptogrid is specified then the cryptogrid server is chose regardless
332 // of whether the server is standalone.
333 case "cryptogrid":
334 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
335 Environment.CurrentDirectory, true);
336 assetServer = loadAssetServer("Crypto", cinit);
337 break;
338
339 // If cryptogrid_eou is specified then the cryptogrid_eou server is chose regardless
340 // of whether the server is standalone.
341 case "cryptogrid_eou":
342 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
343 Environment.CurrentDirectory, false);
344 assetServer = loadAssetServer("Crypto", cinit);
345 break;
346
347 // If file is specified then the file server is chose regardless
348 // of whether the server is standalone.
349 case "file":
350 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
351 assetServer = loadAssetServer("File", linit);
352 break;
353
354 // If local is specified then we're going to use the local SQL server
355 // implementation. We drop through, because that will be the fallback
356 // for the following default clause too.
357 case "local":
358 break;
359
360 // If the asset_database value is none of the previously mentioned strings, then we
361 // try to load a turnkey plugin that matches this value. If not we drop through to
362 // a local default.
363 default:
364 try
365 {
366 init = new AssetClientPluginInitialiser(m_configSettings);
367 assetServer = loadAssetServer(m_configSettings.AssetStorage, init);
368 break;
369 }
370 catch
371 {
372 }
373 m_log.Info("[OPENSIMBASE]: Default assetserver will be used");
374 break;
375 }
376
377 // Open the local SQL-based database asset server
378 if (assetServer == null)
379 {
380 init = new AssetClientPluginInitialiser(m_configSettings);
381 SQLAssetServer sqlAssetServer = (SQLAssetServer) loadAssetServer("SQL", init);
382 sqlAssetServer.LoadDefaultAssets(m_configSettings.AssetSetsXMLFile);
383 assetServer = sqlAssetServer;
384 }
385
386 // Initialize the asset cache, passing a reference to the selected
387 // asset server interface.
388 m_assetCache = ResolveAssetCache(assetServer);
389
390 assetServer.Start();
391 }
392
393 // This method loads the identified asset server, passing an approrpiately
394 // initialized Initialise wrapper. There should to be exactly one match,
395 // if not, then the first match is used.
396 private IAssetServer loadAssetServer(string id, PluginInitialiserBase pi)
397 {
398 if (id != null && id != String.Empty)
399 {
400 m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset server id={0}", id);
401
402 try
403 {
404 PluginLoader<IAssetServer> loader = new PluginLoader<IAssetServer>(pi);
405 loader.AddFilter(PLUGIN_ASSET_SERVER_CLIENT, new PluginProviderFilter(id));
406 loader.Load(PLUGIN_ASSET_SERVER_CLIENT);
407
408 if (loader.Plugins.Count > 0)
409 {
410 m_log.DebugFormat("[OPENSIMBASE] Asset server {0} loaded", id);
411 return (IAssetServer) loader.Plugins[0];
412 }
413 }
414 catch (Exception e)
415 {
416 m_log.DebugFormat("[OPENSIMBASE] Asset server {0} not loaded ({1})", id, e.Message);
417 }
418 }
419 return null;
420 }
421
422 /// <summary>
423 /// Attempt to instantiate an IAssetCache implementation, using the
424 /// provided IAssetServer reference.
425 /// An asset cache implementation must provide a constructor that
426 /// accepts two parameters;
427 /// [1] A ConfigSettings reference.
428 /// [2] An IAssetServer reference.
429 /// The AssetCache value is obtained from the
430 /// [StartUp]/AssetCache value in the configuration file.
431 /// </summary>
432 protected virtual IAssetCache ResolveAssetCache(IAssetServer assetServer)
433 {
434 IAssetCache assetCache = null;
435 if (m_configSettings.AssetCache != null && m_configSettings.AssetCache != String.Empty)
436 {
437 m_log.DebugFormat("[OPENSIMBASE]: Attempting to load asset cache id = {0}", m_configSettings.AssetCache);
438
439 try
440 {
441 PluginInitialiserBase init = new AssetCachePluginInitialiser(m_configSettings, assetServer);
442 PluginLoader<IAssetCache> loader = new PluginLoader<IAssetCache>(init);
443 loader.AddFilter(PLUGIN_ASSET_CACHE, new PluginProviderFilter(m_configSettings.AssetCache));
444
445 loader.Load(PLUGIN_ASSET_CACHE);
446 if (loader.Plugins.Count > 0)
447 assetCache = (IAssetCache) loader.Plugins[0];
448 }
449 catch (Exception e)
450 {
451 m_log.Error("[OPENSIMBASE]: ResolveAssetCache failed");
452 m_log.Error(e);
453 }
454 }
455
456 // If everything else fails, we force load the built-in asset cache
457 return (IAssetCache) ((assetCache != null) ? assetCache : new AssetCache(assetServer));
458 }
459
460 public void ProcessLogin(bool LoginEnabled) 298 public void ProcessLogin(bool LoginEnabled)
461 { 299 {
462 if (LoginEnabled) 300 if (LoginEnabled)
@@ -755,7 +593,7 @@ namespace OpenSim
755 593
756 return new Scene( 594 return new Scene(
757 regionInfo, circuitManager, m_commsManager, sceneGridService, 595 regionInfo, circuitManager, m_commsManager, sceneGridService,
758 storageManager, m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, 596 storageManager, m_moduleLoader, false, m_configSettings.PhysicalPrim,
759 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); 597 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
760 } 598 }
761 599