From 3aed77bd2c5fecc2a077fdad501774b2b00001b1 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 15 Nov 2007 19:53:10 +0000 Subject: *** BIG CHANGES : REGION STORAGE MOVED : UPDATE YOUR OpenSim.ini FROM OpenSim.ini.example ** * Now moved region storage from region to application, so we have one storage per application, instead of one per region. * Changed so that the region store providers use connectionstrings, not filenames * Removed various unfit fields and properties (call me Darwin) --- OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | 24 ++-------------------- OpenSim/Framework/RegionInfo.cs | 4 ++-- OpenSim/Region/Application/OpenSimMain.cs | 19 +++++++++-------- .../Region/ClientStack/RegionApplicationBase.cs | 10 ++++++--- .../Environment/Interfaces/IRegionDataStore.cs | 2 +- OpenSim/Region/Environment/StorageManager.cs | 8 ++------ OpenSim/Region/Examples/SimpleApp/Program.cs | 4 ++-- .../MonoSqliteDataStore.cs | 14 ++++++------- .../OpenSim.DataStore.NullStorage/NullDataStore.cs | 2 +- 9 files changed, 34 insertions(+), 53 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index c468414..343970e 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs @@ -36,7 +36,7 @@ namespace OpenSim.Framework.Data.MySQL * **********************************************************************/ - public void Initialise(string connectionstring, string dbname) + public void Initialise(string connectionstring) { m_dataSet = new DataSet(); @@ -307,23 +307,6 @@ namespace OpenSim.Framework.Data.MySQL } } - //private void DisplayTableMappings( MySqlDataAdapter adapter ) - //{ - // DataTableMappingCollection mappings = adapter.TableMappings; - - // foreach( DataTableMapping mapping in mappings ) - // { - // Debug.WriteLine( String.Format( "Source Table: ", mapping.SourceTable )); - - // DataColumnMappingCollection columnMappings = mapping.ColumnMappings; - - // foreach (DataColumnMapping columnMapping in columnMappings) - // { - // Debug.WriteLine( String.Format( "DataSet [{0}] <-> Source [{1}]", columnMapping.DataSetColumn, columnMapping.SourceColumn )); - // } - // } - //} - public void Commit() { if (m_connection.State != ConnectionState.Open) @@ -333,10 +316,7 @@ namespace OpenSim.Framework.Data.MySQL lock (m_dataSet) { - DisplayDataSet(m_dataSet, "Region DataSet"); - //DisplayTableMappings(m_primDataAdapter); - - // m_primDataAdapter.MissingMappingAction = MissingMappingAction.Error; + // DisplayDataSet(m_dataSet, "Region DataSet"); m_primDataAdapter.Update(m_primTable); m_shapeDataAdapter.Update(m_shapeTable); diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 2a75dbc..cfd15fc 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -249,7 +249,7 @@ namespace OpenSim.Framework this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); - this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); + // this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); IPAddress ipAddressResult; @@ -289,7 +289,7 @@ namespace OpenSim.Framework configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false); configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); - configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); + //configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 8677b7e..8d56222 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -64,24 +64,24 @@ namespace OpenSim protected LocalLoginService m_loginService; - protected string m_storageDll = "OpenSim.DataStore.NullStorage.dll"; + protected string m_storageDll; - protected string m_startupCommandsFile = ""; - protected string m_shutdownCommandsFile = ""; + protected string m_startupCommandsFile; + protected string m_shutdownCommandsFile; protected List m_udpServers = new List(); protected List m_regionData = new List(); private bool m_verbose; private bool m_physicalPrim; - private readonly string m_logFilename = ("region-console.log"); + private readonly string m_logFilename = "region-console.log"; private bool m_permissions = false; private bool m_standaloneAuthenticate = false; private string m_standaloneWelcomeMessage = null; - private string m_standaloneInventoryPlugin = "OpenSim.Framework.Data.SQLite.dll"; - private string m_standaloneAssetPlugin = "OpenSim.Framework.Data.SQLite.dll"; - private string m_standaloneUserPlugin = "OpenSim.Framework.Data.SQLite.dll"; + private string m_standaloneInventoryPlugin; + private string m_standaloneAssetPlugin; + private string m_standaloneUserPlugin; private string m_assetStorage = "sqlite"; @@ -219,6 +219,7 @@ namespace OpenSim m_permissions = startupConfig.GetBoolean("serverside_object_permissions", false); m_storageDll = startupConfig.GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"); + m_storageConnectionString = startupConfig.GetString("storage_connection_string",""); m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", ""); m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", ""); @@ -357,9 +358,9 @@ namespace OpenSim new RegionInfo("DEFAULT REGION CONFIG", fileName); } - protected override StorageManager CreateStorageManager(RegionInfo regionInfo) + protected override StorageManager CreateStorageManager(string connectionstring) { - return new StorageManager(m_storageDll, regionInfo.DataStore, regionInfo.RegionName); + return new StorageManager(m_storageDll, connectionstring); } protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index b0e6419..bcd845f 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -55,6 +55,9 @@ namespace OpenSim.Region.ClientStack protected CommunicationsManager m_commsManager; protected SceneManager m_sceneManager = new SceneManager(); + + protected StorageManager m_storageManager; + protected string m_storageConnectionString; public SceneManager SceneManager { @@ -70,6 +73,8 @@ namespace OpenSim.Region.ClientStack { ClientView.TerrainManager = new TerrainManager(new SecondLife()); + m_storageManager = CreateStorageManager(m_storageConnectionString ); + Initialize(); m_httpServer = new BaseHttpServer(m_httpServerPort); @@ -88,7 +93,7 @@ namespace OpenSim.Region.ClientStack protected abstract LogBase CreateLog(); protected abstract PhysicsScene GetPhysicsScene(); - protected abstract StorageManager CreateStorageManager(RegionInfo regionInfo); + protected abstract StorageManager CreateStorageManager(string connectionstring); protected PhysicsScene GetPhysicsScene(string engine, string meshEngine) { @@ -103,8 +108,7 @@ namespace OpenSim.Region.ClientStack AgentCircuitManager circuitManager = new AgentCircuitManager(); udpServer = new UDPServer(regionInfo.InternalEndPoint.Port, m_assetCache, m_log, circuitManager); - StorageManager storageManager = CreateStorageManager(regionInfo); - Scene scene = CreateScene(regionInfo, storageManager, circuitManager); + Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); udpServer.LocalScene = scene; diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs index e375343..90cdf0a 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs @@ -40,7 +40,7 @@ namespace OpenSim.Region.Environment.Interfaces /// /// The file to save the database to (may not be applicable) /// The name of the database to store to (may not be applicable) - void Initialise(string filename, string dbname); + void Initialise(string filename); void StoreObject(SceneObjectGroup obj, LLUUID regionUUID); void RemoveObject(LLUUID uuid, LLUUID regionUUID); diff --git a/OpenSim/Region/Environment/StorageManager.cs b/OpenSim/Region/Environment/StorageManager.cs index 11f0ce0..b7bd8cc 100644 --- a/OpenSim/Region/Environment/StorageManager.cs +++ b/OpenSim/Region/Environment/StorageManager.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment m_dataStore = storage; } - public StorageManager(string dllName, string dataStoreFile, string dataStoreDB) + public StorageManager(string dllName, string connectionstring) { MainLog.Instance.Verbose("DATASTORE", "Attempting to load " + dllName); Assembly pluginAssembly = Assembly.LoadFrom(dllName); @@ -62,19 +62,15 @@ namespace OpenSim.Region.Environment { IRegionDataStore plug = (IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Initialise(dataStoreFile, dataStoreDB); + plug.Initialise(connectionstring); m_dataStore = plug; MainLog.Instance.Verbose("DATASTORE", "Added IRegionDataStore Interface"); } - - typeInterface = null; } } - pluginAssembly = null; - //TODO: Add checking and warning to make sure it initialised. } } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 73b8303..bd88e61 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -175,9 +175,9 @@ namespace SimpleApp new ModuleLoader(m_log, m_config), true); } - protected override StorageManager CreateStorageManager(RegionInfo regionInfo) + protected override StorageManager CreateStorageManager(string connectionstring) { - return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp"); + return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap"); } protected override PhysicsScene GetPhysicsScene() diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 44461df..e49e225 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs @@ -50,7 +50,7 @@ namespace OpenSim.DataStore.MonoSqlite private SqliteDataAdapter primDa; private SqliteDataAdapter shapeDa; private SqliteDataAdapter terrainDa; - private String connectionString; + private String m_connectionString; /*********************************************************************** * @@ -58,14 +58,14 @@ namespace OpenSim.DataStore.MonoSqlite * **********************************************************************/ - public void Initialise(string dbfile, string dbname) + public void Initialise(string connectionString) { - connectionString = "URI=file:" + dbfile + ",version=3"; + m_connectionString = connectionString; ds = new DataSet(); - MainLog.Instance.Verbose("DATASTORE", "Sqlite - connecting: " + dbfile); - SqliteConnection conn = new SqliteConnection(connectionString); + MainLog.Instance.Verbose("DATASTORE", "Sqlite - connecting: " + connectionString); + SqliteConnection conn = new SqliteConnection(m_connectionString); SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); primDa = new SqliteDataAdapter(primSelectCmd); @@ -266,7 +266,7 @@ namespace OpenSim.DataStore.MonoSqlite // the following is an work around for .NET. The perf // issues associated with it aren't as bad as you think. - SqliteConnection conn = new SqliteConnection(connectionString); + SqliteConnection conn = new SqliteConnection(m_connectionString); conn.Open(); MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + @@ -288,7 +288,7 @@ namespace OpenSim.DataStore.MonoSqlite terret.Initialize(); // the following is an work around for .NET. The perf // issues associated with it aren't as bad as you think. - SqliteConnection conn = new SqliteConnection(connectionString); + SqliteConnection conn = new SqliteConnection(m_connectionString); conn.Open(); String sql = "select RegionUUID, Revision, Heightfield from terrain" + " where RegionUUID=:RegionUUID order by Revision desc"; diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index 4e1f71e..657cfab 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs @@ -36,7 +36,7 @@ namespace OpenSim.DataStore.NullStorage { public class NullDataStore : IRegionDataStore { - public void Initialise(string dbfile, string dbname) + public void Initialise(string dbfile) { return; } -- cgit v1.1