Beispiel #1
0
        public void Initialise(ISimulationBase simBase)
        {
            IConfigSource source = simBase.ConfigSource;
            //
            // 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
            {
                DataManager.DataSessionProviderConnector.DataSessionProvider = new DataSessionProvider(DataManagerTechnology.MySql, ConnectionString);
                MySQLDataLoader GenericData = new MySQLDataLoader();

                DataConnector = GenericData;
            }
            else if (StorageProvider == "MSSQL2008")
            {
                DataManager.DataSessionProviderConnector.DataSessionProvider = new DataSessionProvider(DataManagerTechnology.MSSQL2008, ConnectionString);
                MSSQLDataLoader GenericData = new MSSQLDataLoader();

                DataConnector = GenericData;
            }
            else if (StorageProvider == "MSSQL7")
            {
                DataManager.DataSessionProviderConnector.DataSessionProvider = new DataSessionProvider(DataManagerTechnology.MSSQL7, ConnectionString);
                MSSQLDataLoader GenericData = new MSSQLDataLoader();

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

                DataConnector = GenericData;
            }

            List<IAuroraDataPlugin> Plugins = AuroraModuleLoader.PickupModules<IAuroraDataPlugin>();
            foreach (IAuroraDataPlugin plugin in Plugins)
            {
                plugin.Initialize(DataConnector.Copy(), simBase, ConnectionString);
            }
        }
Beispiel #2
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 == "SQLite" || StorageProvider == "Aurora.DataManager.SQLite.dll")
                //Allow for fallback when AuroraData isn't set
            {
                SQLiteLoader GenericData = new SQLiteLoader();

                // Setting to define directory to store databases in
                if (m_config != null)
                    GenericData.m_DatabasePath = m_config.GetString("DatabaseDirectory", "");

                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());
                }
            }
        }
Beispiel #3
0
        public void Initialise(IConfigSource source, IRegistryCore simBase)
        {
            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;
            }

            List<IAuroraDataPlugin> Plugins = AuroraModuleLoader.PickupModules<IAuroraDataPlugin>();
            foreach (IAuroraDataPlugin 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());
                }
            }
        }
Beispiel #4
0
 public override IGenericData Copy()
 {
     var copy = new SQLiteLoader();
     copy.m_DatabasePath = m_DatabasePath;
     return copy;
 }