/// <summary>
        /// Based on <typeparam name="T" />, returns the appropriate
        /// PluginInitializerBase instance in <paramref name="init" /> and
        /// extension point path in <paramref name="path" />.
        /// </summary>
        /// <param name="connect">
        /// The DB connection string used when creating a new
        /// PluginInitializerBase, returned in <paramref name="init" />.
        /// </param>
        /// <param name="init">
        /// A reference to a PluginInitializerBase object in which the proper
        /// initializer will be returned.
        /// </param>
        /// <param name="path">
        /// A string in which the proper extension point path will be returned.
        /// </param>
        /// <typeparam name="T">
        /// The type of data plugin requested.
        /// </typeparam>
        /// <exception cref="NotImplementedException">
        /// Thrown if <typeparamref name="T" /> is not one of the expected data
        /// interfaces.
        /// </exception>
        private static void PluginLoaderParamFactory <T>(string connect, out PluginInitializerBase init, out string path) where T : IPlugin
        {
            Type type = typeof(T);

            if (type == typeof(IInventoryDataPlugin))
            {
                init = new InventoryDataInitializer(connect);
                path = "/OpenSim/InventoryData";
            }
            else if (type == typeof(IUserDataPlugin))
            {
                init = new UserDataInitializer(connect);
                path = "/OpenSim/UserData";
            }
            else if (type == typeof(IGridDataPlugin))
            {
                init = new GridDataInitializer(connect);
                path = "/OpenSim/GridData";
            }
            else if (type == typeof(ILogDataPlugin))
            {
                init = new LogDataInitializer(connect);
                path = "/OpenSim/LogData";
            }
            else if (type == typeof(IAssetDataPlugin))
            {
                init = new AssetDataInitializer(connect);
                path = "/OpenSim/AssetData";
            }
            else
            {
                // We don't support this data plugin.
                throw new NotImplementedException(String.Format("The type '{0}' is not a valid data plugin.", type));
            }
        }
Exemplo n.º 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);
        }