From 8ed631307b97025bf25a5a08fa49223c3ad39eda Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 18 Feb 2009 13:15:07 +0000 Subject: From: Alan Webb I've changed the extension point name, and the internal references that used the same string. I also fixed up the messaging around the asset loader so that it is more explicit. --- .../Communications/Resources/AssetCache.addin.xml | 10 ++-- OpenSim/Framework/IAssetServer.cs | 12 ++--- OpenSim/Region/Application/OpenSimBase.cs | 54 ++++++++++++++-------- bin/OpenSim.addin.xml | 4 +- 4 files changed, 48 insertions(+), 32 deletions(-) diff --git a/OpenSim/Framework/Communications/Resources/AssetCache.addin.xml b/OpenSim/Framework/Communications/Resources/AssetCache.addin.xml index 61a9f0f..2ac6dca 100644 --- a/OpenSim/Framework/Communications/Resources/AssetCache.addin.xml +++ b/OpenSim/Framework/Communications/Resources/AssetCache.addin.xml @@ -8,10 +8,10 @@ - - - - - + + + + + diff --git a/OpenSim/Framework/IAssetServer.cs b/OpenSim/Framework/IAssetServer.cs index 0d9afe9..f76d125 100644 --- a/OpenSim/Framework/IAssetServer.cs +++ b/OpenSim/Framework/IAssetServer.cs @@ -65,11 +65,11 @@ namespace OpenSim.Framework void AssetNotFound(UUID assetID, bool IsTexture); } - public class AssetServerClientPluginInitialiser : PluginInitialiserBase + public class AssetClientPluginInitialiser : PluginInitialiserBase { private ConfigSettings config; - public AssetServerClientPluginInitialiser (ConfigSettings p_sv) + public AssetClientPluginInitialiser (ConfigSettings p_sv) { config = p_sv; } @@ -80,12 +80,12 @@ namespace OpenSim.Framework } } - public class LegacyAssetServerClientPluginInitialiser : PluginInitialiserBase + public class LegacyAssetClientPluginInitialiser : PluginInitialiserBase { private ConfigSettings config; private string assetURL; - public LegacyAssetServerClientPluginInitialiser (ConfigSettings p_sv, string p_url) + public LegacyAssetClientPluginInitialiser (ConfigSettings p_sv, string p_url) { config = p_sv; assetURL = p_url; @@ -97,14 +97,14 @@ namespace OpenSim.Framework } } - public class CryptoAssetServerClientPluginInitialiser : PluginInitialiserBase + public class CryptoAssetClientPluginInitialiser : PluginInitialiserBase { private ConfigSettings config; private string assetURL; private string currdir; private bool test; - public CryptoAssetServerClientPluginInitialiser (ConfigSettings p_sv, string p_url, string p_dir, bool p_test) + public CryptoAssetClientPluginInitialiser (ConfigSettings p_sv, string p_url, string p_dir, bool p_test) { config = p_sv; assetURL = p_url; diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index add7cb9..69ff2bd 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -59,7 +59,7 @@ namespace OpenSim // class during system startup. private const string PLUGIN_ASSET_CACHE = "/OpenSim/AssetCache"; - private const string PLUGIN_ASSET_SERVER_CLIENT = "/OpenSim/AssetServerClient"; + private const string PLUGIN_ASSET_SERVER_CLIENT = "/OpenSim/AssetClient"; protected string proxyUrl; protected int proxyOffset = 0; @@ -329,9 +329,9 @@ namespace OpenSim protected virtual void InitialiseAssetCache() { - LegacyAssetServerClientPluginInitialiser linit = null; - CryptoAssetServerClientPluginInitialiser cinit = null; - AssetServerClientPluginInitialiser init = null; + LegacyAssetClientPluginInitialiser linit = null; + CryptoAssetClientPluginInitialiser cinit = null; + AssetClientPluginInitialiser init = null; IAssetServer assetServer = null; string mode = m_configSettings.AssetStorage; @@ -358,7 +358,7 @@ namespace OpenSim // of whether the server is standalone. case "grid" : - linit = new LegacyAssetServerClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL); + linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL); assetServer = loadAssetServer("Grid", linit); break; @@ -367,7 +367,7 @@ namespace OpenSim // of whether the server is standalone. case "cryptogrid" : - cinit = new CryptoAssetServerClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL, + cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL, Environment.CurrentDirectory, true); assetServer = loadAssetServer("Crypto", cinit); break; @@ -376,7 +376,7 @@ namespace OpenSim // of whether the server is standalone. case "cryptogrid_eou" : - cinit = new CryptoAssetServerClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL, + cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL, Environment.CurrentDirectory, false); assetServer = loadAssetServer("Crypto", cinit); break; @@ -385,7 +385,7 @@ namespace OpenSim // of whether the server is standalone. case "file" : - linit = new LegacyAssetServerClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL); + linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL); assetServer = loadAssetServer("File", linit); break; @@ -403,7 +403,7 @@ namespace OpenSim default : try { - init = new AssetServerClientPluginInitialiser(m_configSettings); + init = new AssetClientPluginInitialiser(m_configSettings); assetServer = loadAssetServer(m_configSettings.AssetStorage, init); break; } @@ -417,7 +417,7 @@ namespace OpenSim if (assetServer == null) { - init = new AssetServerClientPluginInitialiser(m_configSettings); + init = new AssetClientPluginInitialiser(m_configSettings); SQLAssetServer sqlAssetServer = (SQLAssetServer) loadAssetServer("SQL", init); sqlAssetServer.LoadDefaultAssets(m_configSettings.AssetSetsXMLFile); assetServer = sqlAssetServer; @@ -437,15 +437,29 @@ namespace OpenSim private IAssetServer loadAssetServer(string id, PluginInitialiserBase pi) { - m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset server id={0}", id); + if(id != null && id != String.Empty) + { + m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset server id={0}", id); - PluginLoader loader = new PluginLoader(pi); - loader.AddFilter(PLUGIN_ASSET_SERVER_CLIENT, new PluginProviderFilter(id)); - loader.Load(PLUGIN_ASSET_SERVER_CLIENT); - if (loader.Plugins.Count > 0) - return (IAssetServer) loader.Plugins[0]; - else - return null; + try + { + PluginLoader loader = new PluginLoader(pi); + loader.AddFilter(PLUGIN_ASSET_SERVER_CLIENT, new PluginProviderFilter(id)); + loader.Load(PLUGIN_ASSET_SERVER_CLIENT); + + if (loader.Plugins.Count > 0) + { + m_log.DebugFormat("[OPENSIMBASE] Asset server {0} loaded", id); + return (IAssetServer) loader.Plugins[0]; + } + } + catch (Exception e) + { + m_log.DebugFormat("[OPENSIMBASE] Asset server {0} not loaded ({1})", id, e.Message); + } + } + + return null; } @@ -465,10 +479,12 @@ namespace OpenSim IAssetCache assetCache = null; - m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset cache id={0}", m_configSettings.AssetCache); 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 { diff --git a/bin/OpenSim.addin.xml b/bin/OpenSim.addin.xml index 707eaf3..82adfa6 100644 --- a/bin/OpenSim.addin.xml +++ b/bin/OpenSim.addin.xml @@ -9,7 +9,7 @@ - - + + -- cgit v1.1