Exemplo n.º 1
0
        public TestCommunicationsManager(NetworkServersInfo serversInfo)
            : base(serversInfo, new BaseHttpServer(666), null, false, null)
        {
            SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin());

            m_assetCache = new AssetCache(assetService);

            LocalInventoryService lis = new LocalInventoryService();

            m_inventoryDataPlugin = new TestInventoryDataPlugin();
            lis.AddPlugin(m_inventoryDataPlugin);
            m_interServiceInventoryService = lis;
            AddInventoryService(lis);

            LocalUserServices lus = new LocalUserServices(991, 992, this);

            lus.AddPlugin(new TemporaryUserProfilePlugin());
            m_userDataPlugin = new TestUserDataPlugin();
            lus.AddPlugin(m_userDataPlugin);
            m_userService      = lus;
            m_userAdminService = lus;

            LocalBackEndServices gs = new LocalBackEndServices();

            m_gridService = gs;
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Initialises the asset cache. This supports legacy configuration values
        ///     to ensure consistent operation, but values outside of that namespace
        ///     are handled by the more generic resolution mechanism provided by 
        ///     the ResolveAssetServer virtual method. If extended resolution fails, 
        ///     then the normal default action is taken.
        ///     Creation of the AssetCache is handled by ResolveAssetCache. This
        ///     function accepts a reference to the instantiated AssetServer and
        ///     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;

            IAssetServer assetServer = null;
            string mode = m_configSettings.AssetStorage;

            if (mode == null | mode == String.Empty)
            {
                mode = "default";
            }

            // 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)
                {
                    mode = "grid";
                }
                else
                {
                    mode = "local";
                }
            }

            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);
                    assetServer = loadAssetServer("Crypto", cinit);
                    break;

                // 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);
                    assetServer = loadAssetServer("Crypto", cinit);
                    break;

                // 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);
                    break;

                // 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
                    {
                        init = new AssetClientPluginInitialiser(m_configSettings);
                        assetServer = loadAssetServer(m_configSettings.AssetStorage, init);
                        break;
                    }
                    catch
                    {
                    }

                    m_log.Info("[OpenSim Base]: Default assetserver will be used");                
                    break;
            }

            // Open the local SQL-based database asset server
            if (assetServer == null)
            {
                init = new AssetClientPluginInitialiser(m_configSettings);
                SQLAssetServer sqlAssetServer = (SQLAssetServer) loadAssetServer("SQL", init);
                sqlAssetServer.LoadDefaultAssets(m_configSettings.AssetSetsXMLFile);
                assetServer = sqlAssetServer;
            }

            // Initialize the asset cache, passing a reference to the selected
            // asset server interface.
            m_assetCache = ResolveAssetCache(assetServer);
            
            assetServer.Start();
        }