Beispiel #1
0
        public CommunicationsLocal(
            ConfigSettings configSettings,                                   
            NetworkServersInfo serversInfo,
            BaseHttpServer httpServer,
            IAssetCache assetCache,
            LibraryRootFolder libraryRootFolder) 
            : base(serversInfo, httpServer, assetCache, libraryRootFolder)
        {
            PluginLoader<IInventoryStoragePlugin> loader = new PluginLoader<IInventoryStoragePlugin>();
            loader.Add("/OpenSim/InventoryStorage", new PluginProviderFilter(configSettings.InventoryPlugin));
            loader.Load();

            loader.Plugin.Initialize(configSettings);
            

            LocalUserServices lus 
                = new LocalUserServices(
                    serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
            //lus.AddPlugin(new TemporaryUserProfilePlugin());
            lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);            
            m_userService = lus;
            m_userAdminService = lus;            
            m_avatarService = lus;
            m_messageService = lus;

            m_gridService = new LocalBackEndServices();                   
        }
 public HGCommunicationsStandalone(
     ConfigSettings configSettings,                          
     NetworkServersInfo serversInfo,
     BaseHttpServer httpServer,
     HGGridServices gridService, 
     LibraryRootFolder libraryRootFolder, 
     bool dumpAssetsToFile)
     : base(serversInfo, libraryRootFolder)
 {           
     LocalUserServices localUserService =
         new LocalUserServices(
             serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
     localUserService.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource); 
     
     HGUserServices hgUserService = new HGUserServices(this, localUserService);
     // This plugin arrangement could eventually be configurable rather than hardcoded here.
     hgUserService.AddPlugin(new TemporaryUserProfilePlugin());
     hgUserService.AddPlugin(new HGUserDataPlugin(this, hgUserService));
     
     m_userService = hgUserService;            
     m_userAdminService = hgUserService;            
     m_avatarService = hgUserService;
     m_messageService = hgUserService;
     
     gridService.UserProfileCache = m_userProfileCacheService;
     m_gridService = gridService;                        
 }
Beispiel #3
0
//        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager,
            StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version)
        {
            HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager);

            return
                new HGScene(
                    regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager,
                    m_moduleLoader, false, m_configSettings.PhysicalPrim,
                    m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
        }
        //private UserDataBase m_userDb;

        public OGS1UserDataPlugin(CommunicationsManager commsManager, ConfigSettings settings)
        {
            m_log.DebugFormat("[OGS1 USER SERVICES]: {0} initialized", Name);
            m_commsManager = commsManager;

            //we short circuit some OGS calls to the user server due to numerous problems with user
            //profile data causing issues with data transfer via XML 

            //TODO: This sucks, all of this should be stripped out to remove the reliance on the 
            //user server. There is no reason to have yet another point of failure between the sim
            //and the database
            //m_userDb = 
        }
        public void Initialize(ConfigSettings settings)
        {
            _settings = settings;

            Nini.Config.IConfig netConfig = settings.SettingsFile["Network"];
            if (netConfig != null && netConfig.Contains("asset_server_url"))
            {
                string url = netConfig.GetString("asset_server_url");
                this.SetupConnections(url);
            }
            else
            {
                throw new Exception("Network/asset_server_url is a required setting");
            }
        }
        public CommunicationsLocal(
            ConfigSettings configSettings,
            NetworkServersInfo serversInfo,
            LibraryRootFolder libraryRootFolder)
            : base(serversInfo, libraryRootFolder)
        {
                       
            LocalUserServices lus 
                = new LocalUserServices(
                    serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
            lus.AddPlugin(new TemporaryUserProfilePlugin());
            lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
            m_userService = lus;
            m_userAdminService = lus;
            m_avatarService = lus;
            m_messageService = lus;

            //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
        }
        public void Initialize(ConfigSettings settings)
        {
            AquilesHelper.Initialize();
            _storage = new InventoryStorage(settings.InventoryCluster);

            _delayedMutationMgr = new DelayedMutationManager();
            _delayedMutationMgr.Start();
            _storage.DelayedMutationMgr = _delayedMutationMgr;

            if (settings.InventoryMigrationActive)
            {
                _legacyStorage = new LegacyMysqlInventoryStorage(settings.LegacyInventorySource);
            }

            _storageSelector = new CassandraMigrationProviderSelector(settings.InventoryMigrationActive, settings.CoreConnectionString,
                _storage, _legacyStorage);

            ProviderRegistry.Instance.RegisterInterface<IInventoryProviderSelector>(_storageSelector);
        }
        public OpenSimConfigSource LoadConfigSettings(
                IConfigSource argvSource, out ConfigSettings configSettings)
        {
            IConfig startupConfig = argvSource.Configs["Startup"];
            string iniFilename = startupConfig.GetString("inifile", DEFAULT_INI_FILE);

            // If we are using the default ini file path and it doesn't exist, create an initial 
            // file that includes the base ini file
            if (iniFilename == DEFAULT_INI_FILE)
            {
                try
                {
                    if (!File.Exists(iniFilename))
                    {
                        using (StreamWriter writer = new StreamWriter(iniFilename))
                            writer.WriteLine("Include " + DEFAULT_INI_BASE_FILE);
                    }
                }
                catch (Exception ex)
                {
                    m_log.Error("Failed to create initial OpenSim.ini file. Please check file permissions " +
                        "and pass the inifile parameter if necessary. Error: " + ex.Message);
                    Environment.Exit(-1);
                }
            }

            // Create a configuration source and load the ini file
            m_config = new OpenSimConfigSource();
            m_config.Source = LoadConfig(iniFilename);

            // Create m_configSettings and set it up
            configSettings = new ConfigSettings();
            m_configSettings = configSettings;
            ReadConfigSettings();

            return m_config;
        }
Beispiel #9
0
        public CommunicationsOGS1(
            NetworkServersInfo serversInfo, BaseHttpServer httpServer, 
            IAssetCache assetCache, LibraryRootFolder libraryRootFolder,
            ConfigSettings configSettings)
            : base(serversInfo, httpServer, assetCache, libraryRootFolder)
        {
            OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
            m_gridService = gridInterComms;

            // This plugin arrangement could eventually be configurable rather than hardcoded here.           
            OGS1UserServices userServices = new OGS1UserServices(this);
            //userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new OGS1UserDataPlugin(this, configSettings));
            
            m_userService = userServices;
            m_messageService = userServices;
            m_avatarService = (IAvatarService)m_userService;

            PluginLoader<IInventoryStoragePlugin> loader = new PluginLoader<IInventoryStoragePlugin>();
            loader.Add("/OpenSim/InventoryStorage", new PluginProviderFilter(configSettings.InventoryPlugin));
            loader.Load();

            loader.Plugin.Initialize(configSettings);
        }
Beispiel #10
0
        public CommunicationsLocal(
            ConfigSettings configSettings,                                   
            NetworkServersInfo serversInfo,
            LibraryRootFolder libraryRootFolder)
            : base(serversInfo, libraryRootFolder)
        {
            LocalInventoryService inventoryService = new LocalInventoryService();
            List<IInventoryDataPlugin> plugins 
                = DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(
                    configSettings.StandaloneInventoryPlugin, 
                    configSettings.StandaloneInventorySource);

            foreach (IInventoryDataPlugin plugin in plugins)
            {
                // Using the OSP wrapper plugin for database plugins should be made configurable at some point
                inventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this));
            }
            
            AddInventoryService(inventoryService);
            m_defaultInventoryHost = inventoryService.Host;
            m_interServiceInventoryService = inventoryService;
                        
            LocalUserServices lus 
                = new LocalUserServices(
                    serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
            lus.AddPlugin(new TemporaryUserProfilePlugin());
            lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);            
            m_userService = lus;
            m_userAdminService = lus;            
            m_avatarService = lus;
            m_messageService = lus;

            m_gridService = new LocalBackEndServices();

            //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);                      
        }
Beispiel #11
0
 public void Initialise(ConfigSettings cs, IAssetServer server)
 {
     throw new NotImplementedException();
 }
 public LegacyAssetClientPluginInitialiser(ConfigSettings p_sv, string p_url)
 {
     config   = p_sv;
     assetURL = p_url;
 }
        /// <summary>
        /// Loads the region configuration
        /// </summary>
        /// <param name="argvSource">Parameters passed into the process when started</param>
        /// <param name="configSettings"></param>
        /// <param name="networkInfo"></param>
        /// <returns>A configuration that gets passed to modules</returns>
        public OpenSimConfigSource LoadConfigSettings(
                IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings,
                out NetworkServersInfo networkInfo)
        {
            m_configSettings = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();

            bool iniFileExists = false;

            IConfig startupConfig = argvSource.Configs["Startup"];

            List<string> sources = new List<string>();

            string masterFileName = startupConfig.GetString("inimaster", "OpenSimDefaults.ini");

            if (masterFileName == "none")
                masterFileName = String.Empty;

            if (IsUri(masterFileName))
            {
                if (!sources.Contains(masterFileName))
                    sources.Add(masterFileName);
            }
            else
            {
                string masterFilePath = Path.GetFullPath(
                        Path.Combine(Util.configDir(), masterFileName));

                if (masterFileName != String.Empty)
                {
                    if (File.Exists(masterFilePath))
                    {
                        if (!sources.Contains(masterFilePath))
                            sources.Add(masterFilePath);
                    }
                    else
                    {
                        m_log.ErrorFormat("Master ini file {0} not found", Path.GetFullPath(masterFilePath));
                        Environment.Exit(1);
                    }
                }
            }

            string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");

            if (IsUri(iniFileName))
            {
                if (!sources.Contains(iniFileName))
                    sources.Add(iniFileName);
                Application.iniFilePath = iniFileName;
            }
            else
            {
                Application.iniFilePath = Path.GetFullPath(
                    Path.Combine(Util.configDir(), iniFileName));

                if (!File.Exists(Application.iniFilePath))
                {
                    iniFileName = "OpenSim.xml";
                    Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName));
                }

                if (File.Exists(Application.iniFilePath))
                {
                    if (!sources.Contains(Application.iniFilePath))
                        sources.Add(Application.iniFilePath);
                }
            }

            m_config = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG]: Reading configuration settings");

            for (int i = 0 ; i < sources.Count ; i++)
            {
                if (ReadConfig(m_config, sources[i]))
                {
                    iniFileExists = true;
                    AddIncludes(m_config, sources);
                }
            }

            // Override distro settings with contents of inidirectory
            string iniDirName = startupConfig.GetString("inidirectory", "config");
            string iniDirPath = Path.Combine(Util.configDir(), iniDirName);

            if (Directory.Exists(iniDirPath))
            {
                m_log.InfoFormat("[CONFIG]: Searching folder {0} for config ini files", iniDirPath);
                List<string> overrideSources = new List<string>();

                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        if (!sources.Contains(Path.GetFullPath(filePath)))
                        {
                            overrideSources.Add(Path.GetFullPath(filePath));
                            // put it in sources too, to avoid circularity
                            sources.Add(Path.GetFullPath(filePath));
                        }
                    }
                }


                if (overrideSources.Count > 0)
                {
                    OpenSimConfigSource overrideConfig = new OpenSimConfigSource();
                    overrideConfig.Source = new IniConfigSource();

                    for (int i = 0 ; i < overrideSources.Count ; i++)
                    {
                        if (ReadConfig(overrideConfig, overrideSources[i]))
                        {
                            iniFileExists = true;
                            AddIncludes(overrideConfig, overrideSources);
                        } 
                    }
                    m_config.Source.Merge(overrideConfig.Source);
                }
            }

            if (sources.Count == 0)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                Environment.Exit(1);
            } 
            else if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
                Environment.Exit(1);
            }

            // Merge OpSys env vars
            m_log.Info("[CONFIG]: Loading environment variables for Config");
            Util.MergeEnvironmentToConfig(m_config.Source);

            // Make sure command line options take precedence
            m_config.Source.Merge(argvSource);

            m_config.Source.ReplaceKeyValues();

            ReadConfigSettings();

            return m_config;
        }
Beispiel #14
0
        public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings,
                                                      out NetworkServersInfo networkInfo)
        {
            m_configSettings = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();
            bool iniFileExists = false;

            IConfig startupConfig = configSource.Configs["Startup"];

            //old style or new style settings?
            string iniFileName = startupConfig.GetString("inifile", "Halcyon.ini");
            ApplicationBase.iniFilePath = Path.Combine(Util.configDir(), iniFileName);

            string masterFileName = startupConfig.GetString("inimaster", String.Empty);
            string masterfilePath = Path.Combine(Util.configDir(), masterFileName);

            string iniDirName = startupConfig.GetString("inidirectory", "config");
            //string iniDirPath = Path.Combine(Util.configDir(), iniDirName);

            m_config = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG] Reading configuration settings");

            Uri configUri;
            
            String xmlPath = Path.Combine(Util.configDir(), "Halcyon.xml");

            //check for master .INI file (name passed in command line, no default), or XML over http
            if (!String.IsNullOrEmpty(masterFileName)) // If a master file name is given ...
            {
                m_log.InfoFormat("[CONFIG] Reading config master file {0}", masterfilePath);

                bool isMasterUri = Uri.TryCreate(masterFileName, UriKind.Absolute, out configUri) &&
                                   configUri.Scheme == Uri.UriSchemeHttp;

                if (!ReadConfig(masterFileName, masterfilePath, m_config, isMasterUri))
                {
                    m_log.FatalFormat("[CONFIG] Could not open master config file {0}", masterfilePath);
                }
            }

            if (Directory.Exists(iniDirName))
            {
                m_log.InfoFormat("Searching folder: {0} , for config ini files", iniDirName);
                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        // m_log.InfoFormat("reading ini file < {0} > from config dir", filePath);
                        ReadConfig(Path.GetFileName(filePath), filePath, m_config, false);
                    }
                }
            }

            // Check for .INI file (either default or name passed on command
            // line) or XML config source over http
            bool isIniUri = Uri.TryCreate(iniFileName, UriKind.Absolute, out configUri) &&
                            configUri.Scheme == Uri.UriSchemeHttp;
            iniFileExists = ReadConfig(iniFileName, ApplicationBase.iniFilePath, m_config, isIniUri);

            if (!iniFileExists)
            {
                // check for a xml config file                                
                if (File.Exists(xmlPath))
                {
                    ApplicationBase.iniFilePath = xmlPath;

                    m_log.InfoFormat("Reading XML configuration from {0}", Path.GetFullPath(xmlPath));
                    iniFileExists = true;

                    m_config.Source = new XmlConfigSource();
                    m_config.Source.Merge(new XmlConfigSource(ApplicationBase.iniFilePath));
                }
            }

            m_config.Source.Merge(configSource);

            if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG] Could not load any configuration");
                if (!isIniUri)
                    m_log.FatalFormat("[CONFIG] Tried to load {0}, ", Path.GetFullPath(ApplicationBase.iniFilePath));
                else
                    m_log.FatalFormat("[CONFIG] Tried to load from URI {0}, ", iniFileName);
                m_log.FatalFormat("[CONFIG] and XML source {0}", Path.GetFullPath(xmlPath));

                string sampleName = Path.GetFileNameWithoutExtension(ApplicationBase.iniFilePath) + ".sample.ini";

                m_log.FatalFormat("[CONFIG] Did you copy the {0} file to {1}?", sampleName, ApplicationBase.iniFilePath);
                Environment.Exit(1);
            }

            ReadConfigSettings();

            return m_config;
        }
Beispiel #15
0
 public AssetCachePluginInitialiser(ConfigSettings p_sv, IAssetServer p_as)
 {
     config = p_sv;
     server = p_as;
 }
Beispiel #16
0
 public AssetCachePluginInitializer (ConfigSettings p_sv, IAssetServer p_as)
 {
     config = p_sv;
     server = p_as;
 }
Beispiel #17
0
        /// <summary>
        /// Loads the region configuration
        /// </summary>
        /// <param name="argvSource">Parameters passed into the process when started</param>
        /// <param name="configSettings"></param>
        /// <param name="networkInfo"></param>
        /// <returns>A configuration that gets passed to modules</returns>
        public OpenSimConfigSource LoadConfigSettings(
                IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings,
                out NetworkServersInfo networkInfo)
        {
            m_configSettings = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();

            bool iniFileExists = false;

            IConfig startupConfig = argvSource.Configs["Startup"];

            List<string> sources = new List<string>();

            string masterFileName =
                    startupConfig.GetString("inimaster", "OpenSimDefaults.ini");

            if (masterFileName == "none")
                masterFileName = String.Empty;

            if (IsUri(masterFileName))
            {
                if (!sources.Contains(masterFileName))
                    sources.Add(masterFileName);
            }
            else
            {
                string masterFilePath = Path.GetFullPath(
                        Path.Combine(Util.configDir(), masterFileName));

                if (masterFileName != String.Empty)
                {
                    if (File.Exists(masterFilePath))
                    {
                        if (!sources.Contains(masterFilePath))
                            sources.Add(masterFilePath);
                    }
                    else
                    {
                        m_log.ErrorFormat("Master ini file {0} not found", masterFilePath);
                        Environment.Exit(1);
                    }
                }
            }


            string iniFileName =
                    startupConfig.GetString("inifile", "OpenSim.ini");

            if (IsUri(iniFileName))
            {
                if (!sources.Contains(iniFileName))
                    sources.Add(iniFileName);
                Application.iniFilePath = iniFileName;
            }
            else
            {
                Application.iniFilePath = Path.GetFullPath(
                        Path.Combine(Util.configDir(), iniFileName));

                if (!File.Exists(Application.iniFilePath))
                {
                    iniFileName = "OpenSim.xml";
                    Application.iniFilePath = Path.GetFullPath(
                            Path.Combine(Util.configDir(), iniFileName));
                }

                if (File.Exists(Application.iniFilePath))
                {
                    if (!sources.Contains(Application.iniFilePath))
                        sources.Add(Application.iniFilePath);
                }
            }

            string iniDirName =
                    startupConfig.GetString("inidirectory", "config");
            string iniDirPath =
                    Path.Combine(Util.configDir(), iniDirName);

            if (Directory.Exists(iniDirPath))
            {
                m_log.InfoFormat("Searching folder {0} for config ini files",
                        iniDirPath);

                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        if (!sources.Contains(Path.GetFullPath(filePath)))
                            sources.Add(Path.GetFullPath(filePath));
                    }
                }
            }

            m_config = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG]: Reading configuration settings");

            if (sources.Count == 0)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Did you copy the OpenSimDefaults.ini.example file to OpenSimDefaults.ini?");
                Environment.Exit(1);
            }

            for (int i = 0 ; i < sources.Count ; i++)
            {
                if (ReadConfig(sources[i]))
                {
                    iniFileExists = true;
                    AddIncludes(sources);
                }
            }

            if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
                Environment.Exit(1);
            }

            // Make sure command line options take precedence
            m_config.Source.Merge(argvSource);


            IConfig enVars = m_config.Source.Configs["Environment"];

            if( enVars != null )
            {
                string[] env_keys = enVars.GetKeys();

                foreach ( string key in env_keys )
                {
                    envConfigSource.AddEnv(key, string.Empty);
                }

                envConfigSource.LoadEnv();
                m_config.Source.Merge(envConfigSource);
                m_config.Source.ExpandKeyValues();
            }


            ReadConfigSettings();

            return m_config;
        }
Beispiel #18
0
 public CryptoAssetClientPluginInitialiser (ConfigSettings p_sv, string p_url, string p_dir, bool p_test)
 {
     config   = p_sv;
     assetURL = p_url;
     currdir  = p_dir;
     test     = p_test;
 }
Beispiel #19
0
 public virtual void Initialize(ConfigSettings settings, IAssetServer assetServer)
 {
     m_log.Debug("[ASSET CACHE]: Asset cache configured initialization");
     Initialize(assetServer);
 }
Beispiel #20
0
 public LegacyAssetClientPluginInitialiser (ConfigSettings p_sv, string p_url)
 {
     config   = p_sv;
     assetURL = p_url;
 }
Beispiel #21
0
 public AssetClientPluginInitializer (ConfigSettings p_sv)
 {
     config = p_sv;
 }
        public void Initialize(ConfigSettings settings)
        {
            IConfig stratusConfig = settings.SettingsFile["InWorldz.Data.Assets.Stratus"];
            if (stratusConfig != null && stratusConfig.GetBoolean("enabled", true))
            {
                Config.Settings.Instance.Enabled = true;
                Config.Settings.Instance.CFSupport = stratusConfig.GetBoolean("CFSupport", true);
                Config.Settings.Instance.LegacySupport = stratusConfig.GetBoolean("LegacySupport", false);
                Config.Settings.Instance.WhipURL = stratusConfig.GetString("WhipURL", null);

                if (Config.Settings.Instance.LegacySupport == true && Config.Settings.Instance.WhipURL == null)
                {
                    //not allowed, we need a whip URL
                    throw new Exception("To enable stratus legacy asset support, you must include the WhipURL setting");
                }

                //used for testing. should be disabled except for unit tests
                Config.Settings.Instance.UnitTest_ThrowTimeout = false;
                Config.Settings.Instance.UnitTest_DeleteOldCacheFilesImmediately = false;

                Config.Settings.Instance.CFDefaultRegion = stratusConfig.GetString("CFDefaultRegion", null);
                Config.Settings.Instance.CFUsername = stratusConfig.GetString("CFUsername", null);
                Config.Settings.Instance.CFApiKey = stratusConfig.GetString("CFAPIKey", null);
                Config.Settings.Instance.CFContainerPrefix = stratusConfig.GetString("CFContainerPrefix", null);
                Config.Settings.Instance.CFWorkerThreads = stratusConfig.GetInt("CFWorkerThreads", 8);
                Config.Settings.Instance.CFUseInternalURL = stratusConfig.GetBoolean("CFUseInternalURL", true);
                Config.Settings.Instance.CFUseCache = stratusConfig.GetBoolean("CFUseCache", true);
                Config.Settings.Instance.CFCacheSize = stratusConfig.GetInt("CFCacheSize", 20 * 1024 * 1024);

                if (Config.Settings.Instance.CFSupport == true && 
                    (Config.Settings.Instance.CFUsername == null || Config.Settings.Instance.CFApiKey == null || 
                    Config.Settings.Instance.CFContainerPrefix == null || Config.Settings.Instance.CFDefaultRegion == null))
                {
                    //not allowed, we need the full cloudfiles auth information
                    throw new Exception("To enable stratus Cloud Files support, you must include the CFDefaultRegion, CFUsername, CFAPIKey, and CFContainerPrefix settings");
                }

                Config.Settings.Instance.WriteTarget = stratusConfig.GetString("WriteTarget", null);
                if (Config.Settings.Instance.CFSupport && Config.Settings.Instance.LegacySupport && Config.Settings.Instance.WriteTarget == null)
                {
                    throw new Exception("If both legacy and Cloud Files support is enabled, you must specify 'whip' or 'cf' in the WriteTarget setting");
                }

                Config.Settings.Instance.WriteTarget = Config.Settings.Instance.WriteTarget.ToLower();

                m_log.InfoFormat("[InWorldz.Stratus] Plugin is enabled");

                if (Config.Settings.Instance.LegacySupport)
                {
                    _whipAssetClient = new Whip.Client.AssetClient(Config.Settings.Instance.WhipURL);

                    if (Config.Settings.Instance.CFSupport)
                    {
                        //legacy and CF support.
                        _firstReadServer = _whipAssetClient; //whip is the first read server with legacy/cf since it has lower latency
                        if (Config.Settings.Instance.WriteTarget == "whip")
                        {
                            _writeServer = _whipAssetClient;
                        }
                    }
                    else
                    {
                        //just legacy
                        _firstReadServer = _whipAssetClient;
                        _writeServer = _whipAssetClient;
                    }
                }

                if (Config.Settings.Instance.CFSupport)
                {
                    _cfAssetClient = new CloudFilesAssetClient();
                    
                    if (Config.Settings.Instance.LegacySupport)
                    {
                        _secondReadServer = _cfAssetClient; //cf is the second read server when whip is enabled

                        //legacy and CF support
                        if (Config.Settings.Instance.WriteTarget == "cf")
                        {
                            _writeServer = _cfAssetClient;
                        }
                    }
                    else
                    {
                        _firstReadServer = _cfAssetClient; //first read server when only CF is enabled

                        //just CF
                        _writeServer = _cfAssetClient;
                    }
                }

                _firstReadServer.SetReceiver(this);
                if (_secondReadServer != null) _secondReadServer.SetReceiver(this);
            }
            else
            {
                Config.Settings.Instance.Enabled = false;
                m_log.InfoFormat("[InWorldz.Stratus] Plugin is disabled");
            }
        }
Beispiel #23
0
 public void Initialize(ConfigSettings settings)
 {
     //if this is being called, we were loaded as a plugin instead of the StratusAssetClient
     //we shouldnt be loaded like this, throw.
     throw new Exception("CloudFilesAssetClient should not be loaded directly as a plugin");
 }
 public AssetClientPluginInitialiser(ConfigSettings p_sv)
 {
     config = p_sv;
 }