*** 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)
afrisby
lbsa71 2007-11-15 19:53:10 +00:00
parent 886f8b5548
commit 3aed77bd2c
10 changed files with 39 additions and 58 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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<UDPServer> m_udpServers = new List<UDPServer>();
protected List<RegionInfo> m_regionData = new List<RegionInfo>();
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,

View File

@ -56,6 +56,9 @@ namespace OpenSim.Region.ClientStack
protected SceneManager m_sceneManager = new SceneManager();
protected StorageManager m_storageManager;
protected string m_storageConnectionString;
public SceneManager SceneManager
{
get { return m_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;

View File

@ -40,7 +40,7 @@ namespace OpenSim.Region.Environment.Interfaces
/// </summary>
/// <param name="filename">The file to save the database to (may not be applicable)</param>
/// <param name="dbname">The name of the database to store to (may not be applicable)</param>
void Initialise(string filename, string dbname);
void Initialise(string filename);
void StoreObject(SceneObjectGroup obj, LLUUID regionUUID);
void RemoveObject(LLUUID uuid, LLUUID regionUUID);

View File

@ -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.
}
}

View File

@ -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()

View File

@ -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";

View File

@ -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;
}

View File

@ -16,16 +16,16 @@ physics = basicphysics
;physics = modified_BulletX
; *** Prim Storage - only leave one storage_plugin uncommented ***
; --- The NullStorage stores nothing - effectively disabling persistence.
; --- The NullStorage stores nothing - effectively disabling persistence:
; storage_plugin = "OpenSim.DataStore.NullStorage.dll"
; --- To use sqlite as region storage - don't forget to add datastore="MonoSqliteFilename.db"
; to region config xml (ie /Regions/default.xml) as the storages are (currently supposed to be) per region.
; --- To use sqlite as region storage:
storage_plugin = "OpenSim.DataStore.MonoSqlite.dll"
storage_connection_string="URI=file:OpenSim.db,version=3";
; --- This is to use MySQL storage - don't forget to add datastore="<MySql Connection String>"
; to region config xml (ie /Regions/default.xml) as the storages are (currently supposed to be) per region.
; --- To use MySQL storage, supply your own connectionstring:
; storage_plugin="OpenSim.Framework.Data.MySQL.dll"
; storage_connection_string="<MySql Connection String>";
startup_console_commands_file = "startup_commands.txt"
shutdown_console_commands_file = "shutdown_commands.txt"