Refactoring of CreateCommsManagerPlugin.

Plus some general cleanup of a few other files (deleting excess blank lines etc)
This commit is contained in:
MW
2009-03-03 12:51:54 +00:00
parent 8ebd5b409a
commit 76133d0763
4 changed files with 34 additions and 70 deletions

View File

@@ -206,7 +206,6 @@ namespace OpenSim
}
AddPluginCommands();
}
protected virtual void AddPluginCommands()
@@ -269,14 +268,10 @@ namespace OpenSim
protected override void Initialize()
{
//
// Called from base.StartUp()
//
m_httpServerPort = m_networkServersInfo.HttpListenerPort;
InitialiseAssetCache();
m_sceneManager.OnRestartSim += handleRestartRegion;
}
@@ -291,10 +286,8 @@ namespace OpenSim
/// returns an IAssetCache implementation, if possible. This is a virtual
/// method.
/// </summary>
protected virtual void InitialiseAssetCache()
{
LegacyAssetClientPluginInitialiser linit = null;
CryptoAssetClientPluginInitialiser cinit = null;
AssetClientPluginInitialiser init = null;
@@ -308,7 +301,6 @@ namespace OpenSim
// If "default" is specified, then the value is adjusted
// according to whether or not the server is running in
// standalone mode.
if (mode.ToLower() == "default")
{
if (m_configSettings.Standalone == false)
@@ -319,19 +311,15 @@ namespace OpenSim
switch (mode.ToLower())
{
// If grid is specified then the grid server is chose regardless
// of whether the server is standalone.
case "grid" :
linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
assetServer = loadAssetServer("Grid", linit);
break;
// If cryptogrid is specified then the cryptogrid server is chose regardless
// of whether the server is standalone.
case "cryptogrid" :
cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
Environment.CurrentDirectory, true);
@@ -340,7 +328,6 @@ namespace OpenSim
// If cryptogrid_eou is specified then the cryptogrid_eou server is chose regardless
// of whether the server is standalone.
case "cryptogrid_eou" :
cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
Environment.CurrentDirectory, false);
@@ -349,7 +336,6 @@ namespace OpenSim
// If file is specified then the file server is chose regardless
// of whether the server is standalone.
case "file" :
linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
assetServer = loadAssetServer("File", linit);
@@ -358,14 +344,12 @@ namespace OpenSim
// If local is specified then we're going to use the local SQL server
// implementation. We drop through, because that will be the fallback
// for the following default clause too.
case "local" :
break;
// If the asset_database value is none of the previously mentioned strings, then we
// try to load a turnkey plugin that matches this value. If not we drop through to
// a local default.
default :
try
{
@@ -376,11 +360,9 @@ namespace OpenSim
catch {}
m_log.Info("[OPENSIMBASE] Default assetserver will be used");
break;
}
// Open the local SQL-based database asset server
if (assetServer == null)
{
init = new AssetClientPluginInitialiser(m_configSettings);
@@ -391,18 +373,14 @@ namespace OpenSim
// Initialize the asset cache, passing a reference to the selected
// asset server interface.
m_assetCache = ResolveAssetCache(assetServer);
}
// This method loads the identified asset server, passing an approrpiately
// initialized Initialise wrapper. There should to be exactly one match,
// if not, then the first match is used.
private IAssetServer loadAssetServer(string id, PluginInitialiserBase pi)
{
if (id != null && id != String.Empty)
{
m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset server id={0}", id);
@@ -424,9 +402,7 @@ namespace OpenSim
m_log.DebugFormat("[OPENSIMBASE] Asset server {0} not loaded ({1})", id, e.Message);
}
}
return null;
}
/// <summary>
@@ -439,21 +415,14 @@ namespace OpenSim
/// The AssetCache value is obtained from the
/// [StartUp]/AssetCache value in the configuration file.
/// </summary>
protected virtual IAssetCache ResolveAssetCache(IAssetServer assetServer)
{
IAssetCache assetCache = null;
if (m_configSettings.AssetCache != null && m_configSettings.AssetCache != String.Empty)
{
m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset cache id={0}", m_configSettings.AssetCache);
try
{
PluginInitialiserBase init = new AssetCachePluginInitialiser(m_configSettings, assetServer);
PluginLoader<IAssetCache> loader = new PluginLoader<IAssetCache>(init);
loader.AddFilter(PLUGIN_ASSET_CACHE, new PluginProviderFilter(m_configSettings.AssetCache));
@@ -461,7 +430,6 @@ namespace OpenSim
loader.Load(PLUGIN_ASSET_CACHE);
if (loader.Plugins.Count > 0)
assetCache = (IAssetCache) loader.Plugins[0];
}
catch (Exception e)
{
@@ -471,9 +439,7 @@ namespace OpenSim
}
// If everything else fails, we force load the built-in asset cache
return (IAssetCache) ((assetCache != null) ? assetCache : new AssetCache(assetServer));
}
public void ProcessLogin(bool LoginEnabled)