Beispiel #1
0
        /// <summary>
        ///     Attempt to instantiate an IAssetCache implementation, using the
        ///     provided IAssetServer reference.
        ///     An asset cache implementation must provide a constructor that
        ///     accepts two parameters;
        ///         [1] A ConfigSettings reference.
        ///         [2] An IAssetServer reference.
        ///     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("[OpenSim Base]: 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));

                    loader.Load(PLUGIN_ASSET_CACHE);

                    if (loader.Plugins.Count > 0)
                    {
                        assetCache = (IAssetCache)loader.Plugins[0];
                    }
                }

                catch (Exception e)
                {
                    m_log.Error("[OpenSim Base]: ResolveAssetCache failed");
                    m_log.Error(e);
                }
            }

            // If everything else fails, we force load the built-in asset cache
            return (IAssetCache) ((assetCache != null) ? assetCache : new AssetCache(assetServer));
        }
Beispiel #2
0
        // This method loads the identified asset server, passing an approrpiately
        // initialized Initialize wrapper. There should to be exactly one match,
        // if not, then the first match is used.
        private IAssetServer loadAssetServer(string id, PluginInitializerBase pi)
        {
            if (!String.IsNullOrEmpty(id))
            {
                m_log.DebugFormat("[HALCYONBASE] Attempting to load asset server id={0}", id);

                try
                {
                    PluginLoader <IAssetServer> loader = new PluginLoader <IAssetServer>(pi);
                    loader.AddFilter(PLUGIN_ASSET_SERVER_CLIENT, new PluginProviderFilter(id));
                    loader.Load(PLUGIN_ASSET_SERVER_CLIENT);

                    if (loader.Plugins.Count > 0)
                    {
                        m_log.DebugFormat("[HALCYONBASE] Asset server {0} loaded", id);
                        return((IAssetServer)loader.Plugins[0]);
                    }
                }
                catch (Exception e)
                {
                    m_log.DebugFormat("[HALCYONBASE] Asset server {0} not loaded ({1})", id, e.Message);
                }
            }
            return(null);
        }
Beispiel #3
0
        // 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("[OpenSim Base]: Attempting to load asset server id={0}", id);

                try
                {
                    PluginLoader<IAssetServer> loader = new PluginLoader<IAssetServer>(pi);
                    loader.AddFilter(PLUGIN_ASSET_SERVER_CLIENT, new PluginProviderFilter(id));
                    loader.Load(PLUGIN_ASSET_SERVER_CLIENT);

                    if (loader.Plugins.Count > 0)
                    {
                        m_log.DebugFormat("[OpenSim Base]: Asset server {0} loaded", id);
                        return (IAssetServer) loader.Plugins[0];
                    }
                }

                catch (Exception e)
                {
                    m_log.DebugFormat("[OpenSim]: Asset server {0} not loaded ({1})", id, e.Message);
                }
            }

            return null;
        }
        // This method loads the identified asset server, passing an approrpiately
        // initialized Initialize wrapper. There should to be exactly one match,
        // if not, then the first match is used.
        private IAssetServer loadAssetServer(string id, PluginInitializerBase pi)
        {
            if (!String.IsNullOrEmpty(id))
            {
                m_log.DebugFormat("[HALCYONBASE] Attempting to load asset server id={0}", id);

                try
                {
                    PluginLoader<IAssetServer> loader = new PluginLoader<IAssetServer>(pi);
                    loader.AddFilter(PLUGIN_ASSET_SERVER_CLIENT, new PluginProviderFilter(id));
                    loader.Load(PLUGIN_ASSET_SERVER_CLIENT);

                    if (loader.Plugins.Count > 0)
                    {
                        m_log.DebugFormat("[HALCYONBASE] Asset server {0} loaded", id);
                        return (IAssetServer) loader.Plugins[0];
                    }
                }
                catch (Exception e)
                {
                    m_log.DebugFormat("[HALCYONBASE] Asset server {0} not loaded ({1})", id, e.Message);
                }
            }
            return null;
        }