Esempio n. 1
0
        public void Initialise(IConfigSource source, IRegistryCore simBase, List <Type> types)
        {
            IConfig m_config = source.Configs["AuroraData"];

            if (m_config != null)
            {
                StorageProvider  = m_config.GetString("StorageProvider", StorageProvider);
                ConnectionString = m_config.GetString("ConnectionString", ConnectionString);
            }

            IGenericData DataConnector = null;

            if (StorageProvider == "MySQL")
            //Allow for fallback when AuroraData isn't set
            {
                MySQLDataLoader GenericData = new MySQLDataLoader();

                DataConnector = GenericData;
            }

            /*else if (StorageProvider == "MSSQL2008")
             * {
             * MSSQLDataLoader GenericData = new MSSQLDataLoader();
             *
             * DataConnector = GenericData;
             * }
             * else if (StorageProvider == "MSSQL7")
             * {
             * MSSQLDataLoader GenericData = new MSSQLDataLoader();
             *
             * DataConnector = GenericData;
             * }*/
            else if (StorageProvider == "SQLite")
            //Allow for fallback when AuroraData isn't set
            {
                SQLiteLoader GenericData = new SQLiteLoader();

                DataConnector = GenericData;
            }

            foreach (Type t in types)
            {
                List <dynamic> Plugins = AuroraModuleLoader.PickupModules(t);
                foreach (dynamic plugin in Plugins)
                {
                    try
                    {
                        plugin.Initialize(DataConnector.Copy(), source, simBase, ConnectionString);
                    }
                    catch (Exception ex)
                    {
                        if (MainConsole.Instance != null)
                        {
                            MainConsole.Instance.Warn("[DataService]: Exeception occured starting data plugin " +
                                                      plugin.Name + ", " + ex.ToString());
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public void Initialise(IConfigSource config, IRegistryCore registry)
        {
            IConfig m_config = config.Configs ["WhiteCoreData"];

            if (m_config != null)
            {
                storageProvider  = m_config.GetString("StorageProvider", storageProvider);
                connectionString = m_config.GetString("ConnectionString", connectionString);
            }

            IGenericData dataConnector = null;

            if (storageProvider == "MySQL")
            // Allow for fallback when WhiteCoreData isn't set
            {
                MySQLDataLoader genericData = new MySQLDataLoader();

                dataConnector = genericData;
            }

            /*else if (StorageProvider == "MSSQL2008")
             * {
             *  MSSQLDataLoader GenericData = new MSSQLDataLoader();
             *
             *  DataConnector = GenericData;
             * }
             * else if (StorageProvider == "MSSQL7")
             * {
             *  MSSQLDataLoader GenericData = new MSSQLDataLoader();
             *
             *  DataConnector = GenericData;
             * }*/
            else if (storageProvider == "SQLite")
            // Allow for fallback when WhiteCoreData isn't set
            {
                SQLiteLoader genericData = new SQLiteLoader();

                // set default data directory in case it is needed
                var simBase = registry.RequestModuleInterface <ISimulationBase> ();
                genericData.DefaultDataPath = simBase.DefaultDataPath;

                dataConnector = genericData;
            }

            List <IWhiteCoreDataPlugin> Plugins = WhiteCoreModuleLoader.PickupModules <IWhiteCoreDataPlugin> ();

            foreach (IWhiteCoreDataPlugin plugin in Plugins)
            {
                try {
                    plugin.Initialize(dataConnector == null ? null : dataConnector.Copy(), config, registry,
                                      connectionString);
                } catch (Exception ex) {
                    if (MainConsole.Instance != null)
                    {
                        MainConsole.Instance.Warn("[DataService]: Exception occurred starting data plugin " +
                                                  plugin.Name + ", " + ex);
                    }
                }
            }
        }
Esempio n. 3
0
        public void Initialise(IConfigSource source, IRegistryCore simBase)
        {
            //
            // Try reading the [DatabaseService] section, if it exists
            //
            IConfig dbConfig = source.Configs["DatabaseService"];

            if (dbConfig != null)
            {
                StorageProvider  = dbConfig.GetString("StorageProvider", String.Empty);
                ConnectionString = dbConfig.GetString("ConnectionString", String.Empty);
            }

            //
            // [AuroraData] section overrides [DatabaseService], if it exists
            //
            IConfig m_config = source.Configs["AuroraData"];

            if (m_config != null)
            {
                StorageProvider  = m_config.GetString("StorageProvider", StorageProvider);
                ConnectionString = m_config.GetString("ConnectionString", ConnectionString);
            }

            IGenericData DataConnector = null;

            if (StorageProvider == "MySQL" || StorageProvider == "OpenSim.Data.MySQL.dll") //Allow for fallback when AuroraData isn't set
            {
                MySQLDataLoader GenericData = new MySQLDataLoader();

                DataConnector = GenericData;
            }
            else if (StorageProvider == "MSSQL2008")
            {
                MSSQLDataLoader GenericData = new MSSQLDataLoader();

                DataConnector = GenericData;
            }
            else if (StorageProvider == "MSSQL7")
            {
                MSSQLDataLoader GenericData = new MSSQLDataLoader();

                DataConnector = GenericData;
            }
            else if (StorageProvider == "SQLite" || StorageProvider == "OpenSim.Data.SQLite.dll") //Allow for fallback when AuroraData isn't set
            {
                SQLiteLoader GenericData = new SQLiteLoader();

                DataConnector = GenericData;
            }

            List <IAuroraDataPlugin> Plugins = AuroraModuleLoader.PickupModules <IAuroraDataPlugin>();

            foreach (IAuroraDataPlugin plugin in Plugins)
            {
                plugin.Initialize(DataConnector.Copy(), source, simBase, ConnectionString);
            }
        }
        public void Initialise(IConfigSource source, IRegistryCore simBase)
        {
            IConfig m_config = source.Configs["UniverseData"];

            if (m_config != null)
            {
                StorageProvider  = m_config.GetString("StorageProvider", StorageProvider);
                ConnectionString = m_config.GetString("ConnectionString", ConnectionString);
            }

            IGenericData DataConnector = null;

            if (StorageProvider == "MySQL")
            //Allow for fallback when UniverseData isn't set
            {
                MySQLDataLoader GenericData = new MySQLDataLoader();

                DataConnector = GenericData;
            }
            else if (StorageProvider == "SQLite")
            //Allow for fallback when UniverseData isn't set
            {
                SQLiteLoader GenericData = new SQLiteLoader();

                DataConnector = GenericData;
            }

            List <IUniverseDataPlugin> Plugins = UniverseModuleLoader.PickupModules <IUniverseDataPlugin>();

            foreach (IUniverseDataPlugin plugin in Plugins)
            {
                try
                {
                    plugin.Initialize(DataConnector == null ? null : DataConnector.Copy(), source, simBase,
                                      ConnectionString);
                }
                catch (Exception ex)
                {
                    if (MainConsole.Instance != null)
                    {
                        MainConsole.Instance.Warn("[DataService]: Exception occurred starting data plugin " +
                                                  plugin.Name + ", " + ex.ToString());
                    }
                }
            }
        }
Esempio n. 5
0
        public void Initialise(IConfigSource source, IRegistryCore simBase)
        {
            //
            // Try reading the [DatabaseService] section, if it exists
            //
            IConfig dbConfig = source.Configs["DatabaseService"];

            if (dbConfig != null)
            {
                StorageProvider  = dbConfig.GetString("StorageProvider", String.Empty);
                ConnectionString = dbConfig.GetString("ConnectionString", String.Empty);
            }

            //
            // [AuroraData] section overrides [DatabaseService], if it exists
            //
            IConfig m_config = source.Configs["AuroraData"];

            if (m_config != null)
            {
                StorageProvider  = m_config.GetString("StorageProvider", StorageProvider);
                ConnectionString = m_config.GetString("ConnectionString", ConnectionString);
            }

            IGenericData DataConnector = null;

            if (StorageProvider == "MySQL" || StorageProvider == "Aurora.DataManager.MySQL.dll")
            //Allow for fallback when AuroraData isn't set
            {
                MySQLDataLoader GenericData = new MySQLDataLoader();

                DataConnector = GenericData;
            }

            /*else if (StorageProvider == "MSSQL2008")
             * {
             *  MSSQLDataLoader GenericData = new MSSQLDataLoader();
             *
             *  DataConnector = GenericData;
             * }
             * else if (StorageProvider == "MSSQL7")
             * {
             *  MSSQLDataLoader GenericData = new MSSQLDataLoader();
             *
             *  DataConnector = GenericData;
             * }*/
            else if (StorageProvider == "SQLite" || StorageProvider == "Aurora.DataManager.SQLite.dll")
            //Allow for fallback when AuroraData isn't set
            {
                SQLiteLoader GenericData = new SQLiteLoader();

                DataConnector = GenericData;
            }

            List <IAuroraDataPlugin> Plugins = AuroraModuleLoader.PickupModules <IAuroraDataPlugin>();

            foreach (IAuroraDataPlugin plugin in Plugins)
            {
                try
                {
                    plugin.Initialize(DataConnector.Copy(), source, simBase, ConnectionString);
                }
                catch (Exception ex)
                {
                    MainConsole.Instance.Warn("[DataService]: Exeception occured starting data plugin " + plugin.Name + ", " + ex.ToString());
                }
            }
        }
Esempio n. 6
0
        public void Initialize(IConfigSource config, IRegistryCore registry, List <Type> types)
        {
            IConfig m_config = config.Configs["UniverseData"];

            if (m_config != null)
            {
                StorageProvider  = m_config.GetString("StorageProvider", StorageProvider);
                ConnectionString = m_config.GetString("ConnectionString", ConnectionString);
            }

            IGenericData DataConnector = null;

            if (StorageProvider == "MySQL")
            //Allow for fallback when UniverseData isn't set
            {
                MySQLDataLoader GenericData = new MySQLDataLoader();

                DataConnector = GenericData;
            }

            /*else if (StorageProvider == "MSSQL2008")
             * {
             * MSSQLDataLoader GenericData = new MSSQLDataLoader();
             *
             * DataConnector = GenericData;
             * }
             * else if (StorageProvider == "MSSQL7")
             * {
             * MSSQLDataLoader GenericData = new MSSQLDataLoader();
             *
             * DataConnector = GenericData;
             * }*/
            else if (StorageProvider == "SQLite")
            //Allow for fallback when UniverseData isn't set
            {
                SQLiteLoader GenericData = new SQLiteLoader();

                // set default data directory in case it is needed
                var simBase = registry.RequestModuleInterface <ISimulationBase> ();
                GenericData.DefaultDataPath = simBase.DefaultDataPath;

                DataConnector = GenericData;
            }

            if (DataConnector != null)      // we have a problem if so...
            {
                foreach (Type t in types)
                {
                    List <dynamic> Plugins = UniverseModuleLoader.PickupModules(t);
                    foreach (dynamic plugin in Plugins)
                    {
                        try
                        {
                            plugin.Initialize(DataConnector.Copy(), config, registry, ConnectionString);
                        } catch (Exception ex)
                        {
                            if (MainConsole.Instance != null)
                            {
                                MainConsole.Instance.Warn("[DataService]: Exception occurred starting data plugin " +
                                                          plugin.Name + ", " + ex);
                            }
                        }
                    }
                }
            }
        }