allow for Inventory database source to be specified in main
configs. This works with sqlite and nhibernate backends, and stays with default seperate ini files for mysql and mssql until someone writes those.0.6.0-stable
parent
a1cc0e436f
commit
3dd98a112f
|
@ -51,6 +51,12 @@ namespace OpenSim.Data.MSSQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads and initialises this database plugin
|
/// Loads and initialises this database plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
public void Initialise(string connect)
|
||||||
|
{
|
||||||
|
// TODO: actually use the provided connect string
|
||||||
|
Initialise();
|
||||||
|
}
|
||||||
|
|
||||||
public void Initialise()
|
public void Initialise()
|
||||||
{
|
{
|
||||||
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
||||||
|
|
|
@ -51,6 +51,12 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads and initialises this database plugin
|
/// Loads and initialises this database plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
public void Initialise(string connect)
|
||||||
|
{
|
||||||
|
// TODO: actually use the provided connect string
|
||||||
|
Initialise();
|
||||||
|
}
|
||||||
|
|
||||||
public void Initialise()
|
public void Initialise()
|
||||||
{
|
{
|
||||||
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
||||||
|
|
|
@ -55,11 +55,11 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
public override void Initialise(string connect)
|
public override void Initialise(string connect)
|
||||||
{
|
{
|
||||||
// TODO: hard coding for sqlite based stuff to begin with, just making it easier to test
|
// Split out the dialect, driver, and connect string
|
||||||
char[] split = {';'};
|
char[] split = {';'};
|
||||||
string[] parts = connect.Split(split);
|
string[] parts = connect.Split(split);
|
||||||
|
|
||||||
// This is stubbing for now, it will become dynamic later and support different db backends
|
// NHibernate setup
|
||||||
cfg = new Configuration();
|
cfg = new Configuration();
|
||||||
cfg.SetProperty(Environment.ConnectionProvider,
|
cfg.SetProperty(Environment.ConnectionProvider,
|
||||||
"NHibernate.Connection.DriverConnectionProvider");
|
"NHibernate.Connection.DriverConnectionProvider");
|
||||||
|
@ -74,7 +74,11 @@ namespace OpenSim.Data.NHibernate
|
||||||
using ( MemoryStream stream =
|
using ( MemoryStream stream =
|
||||||
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
|
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
|
||||||
cfg.AddInputStream(stream);
|
cfg.AddInputStream(stream);
|
||||||
|
|
||||||
|
// If uncommented this will auto create tables, but it
|
||||||
|
// does drops of the old tables, so we need a smarter way
|
||||||
|
// to acturally manage this.
|
||||||
|
|
||||||
// new SchemaExport(cfg).Create(true, true);
|
// new SchemaExport(cfg).Create(true, true);
|
||||||
|
|
||||||
factory = cfg.BuildSessionFactory();
|
factory = cfg.BuildSessionFactory();
|
||||||
|
|
|
@ -50,25 +50,21 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialises the interface
|
/// Initialises the interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialise()
|
public void Initialise(string connect)
|
||||||
{
|
{
|
||||||
Initialise("Inventory.db", "Inventory");
|
// Split out the dialect, driver, and connect string
|
||||||
}
|
char[] split = {';'};
|
||||||
|
string[] parts = connect.Split(split);
|
||||||
public void Initialise(string dbfile, string dbname)
|
|
||||||
{
|
// Establish NHibernate Connection
|
||||||
// TODO: hard coding for sqlite based stuff to begin with, just making it easier to test
|
|
||||||
|
|
||||||
// This is stubbing for now, it will become dynamic later and support different db backends
|
|
||||||
cfg = new Configuration();
|
cfg = new Configuration();
|
||||||
cfg.SetProperty(Environment.ConnectionProvider,
|
cfg.SetProperty(Environment.ConnectionProvider,
|
||||||
"NHibernate.Connection.DriverConnectionProvider");
|
"NHibernate.Connection.DriverConnectionProvider");
|
||||||
cfg.SetProperty(Environment.Dialect,
|
cfg.SetProperty(Environment.Dialect,
|
||||||
"NHibernate.Dialect.SQLiteDialect");
|
"NHibernate.Dialect." + parts[0]);
|
||||||
cfg.SetProperty(Environment.ConnectionDriver,
|
cfg.SetProperty(Environment.ConnectionDriver,
|
||||||
"NHibernate.Driver.SqliteClientDriver");
|
"NHibernate.Driver." + parts[1]);
|
||||||
cfg.SetProperty(Environment.ConnectionString,
|
cfg.SetProperty(Environment.ConnectionString, parts[2]);
|
||||||
"URI=file:" + dbfile + ",version=3");
|
|
||||||
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
||||||
|
|
||||||
HbmSerializer.Default.Validate = true;
|
HbmSerializer.Default.Validate = true;
|
||||||
|
@ -76,6 +72,10 @@ namespace OpenSim.Data.NHibernate
|
||||||
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
|
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
|
||||||
cfg.AddInputStream(stream);
|
cfg.AddInputStream(stream);
|
||||||
|
|
||||||
|
// If uncommented this will auto create tables, but it
|
||||||
|
// does drops of the old tables, so we need a smarter way
|
||||||
|
// to acturally manage this.
|
||||||
|
|
||||||
// new SchemaExport(cfg).Create(true, true);
|
// new SchemaExport(cfg).Create(true, true);
|
||||||
|
|
||||||
factory = cfg.BuildSessionFactory();
|
factory = cfg.BuildSessionFactory();
|
||||||
|
|
|
@ -50,17 +50,13 @@ namespace OpenSim.Data.SQLite
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialises the interface
|
/// Initialises the interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialise()
|
public void Initialise(string dbconnect)
|
||||||
{
|
{
|
||||||
Initialise("inventoryStore.db", "inventoryDatabase");
|
if (dbconnect == string.Empty) {
|
||||||
}
|
dbconnect = "URI=file:inventoryStore.db,version=3";
|
||||||
|
}
|
||||||
public void Initialise(string dbfile, string dbname)
|
m_log.Info("[Inventory]: Sqlite - connecting: " + dbconnect);
|
||||||
{
|
SqliteConnection conn = new SqliteConnection(dbconnect);
|
||||||
string connectionString = "URI=file:" + dbfile + ",version=3";
|
|
||||||
|
|
||||||
m_log.Info("[Inventory]: Sqlite - connecting: " + dbfile);
|
|
||||||
SqliteConnection conn = new SqliteConnection(connectionString);
|
|
||||||
|
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace OpenSim.Framework.Communications
|
||||||
/// Adds a new user server plugin - plugins will be requested in the order they were loaded.
|
/// Adds a new user server plugin - plugins will be requested in the order they were loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="FileName">The filename to the user server plugin DLL</param>
|
/// <param name="FileName">The filename to the user server plugin DLL</param>
|
||||||
public void AddPlugin(string FileName)
|
public void AddPlugin(string FileName, string connect)
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(FileName))
|
if (!String.IsNullOrEmpty(FileName))
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
IInventoryData plug =
|
IInventoryData plug =
|
||||||
(IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
(IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
plug.Initialise();
|
plug.Initialise(connect);
|
||||||
m_plugins.Add(plug.getName(), plug);
|
m_plugins.Add(plug.getName(), plug);
|
||||||
m_log.Info("[AGENTINVENTORY]: Added IInventoryData Interface");
|
m_log.Info("[AGENTINVENTORY]: Added IInventoryData Interface");
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialises the interface
|
/// Initialises the interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Initialise();
|
void Initialise(string connect);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the interface
|
/// Closes the interface
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace OpenSim.Framework
|
||||||
public string UserRecvKey = String.Empty;
|
public string UserRecvKey = String.Empty;
|
||||||
|
|
||||||
public string DatabaseProvider = String.Empty;
|
public string DatabaseProvider = String.Empty;
|
||||||
|
public string DatabaseConnect = String.Empty;
|
||||||
public static uint DefaultHttpPort = 8004;
|
public static uint DefaultHttpPort = 8004;
|
||||||
|
|
||||||
public uint HttpPort = DefaultHttpPort;
|
public uint HttpPort = DefaultHttpPort;
|
||||||
|
@ -68,6 +69,8 @@ namespace OpenSim.Framework
|
||||||
"Key to expect from user server", "null", false);
|
"Key to expect from user server", "null", false);
|
||||||
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
"DLL for database provider", "OpenSim.Data.SQLite.dll", false);
|
"DLL for database provider", "OpenSim.Data.SQLite.dll", false);
|
||||||
|
configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
|
"Database Connect String", "", false);
|
||||||
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||||
"Http Listener port", DefaultHttpPort.ToString(), false);
|
"Http Listener port", DefaultHttpPort.ToString(), false);
|
||||||
}
|
}
|
||||||
|
@ -76,24 +79,27 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
switch (configuration_key)
|
switch (configuration_key)
|
||||||
{
|
{
|
||||||
case "default_startup_message":
|
case "default_startup_message":
|
||||||
DefaultStartupMsg = (string) configuration_result;
|
DefaultStartupMsg = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "default_user_server":
|
case "default_user_server":
|
||||||
UserServerURL = (string) configuration_result;
|
UserServerURL = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "user_send_key":
|
case "user_send_key":
|
||||||
UserSendKey = (string) configuration_result;
|
UserSendKey = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "user_recv_key":
|
case "user_recv_key":
|
||||||
UserRecvKey = (string) configuration_result;
|
UserRecvKey = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "database_provider":
|
case "database_provider":
|
||||||
DatabaseProvider = (string) configuration_result;
|
DatabaseProvider = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "http_port":
|
case "database_connect":
|
||||||
HttpPort = (uint) configuration_result;
|
DatabaseConnect = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
|
case "http_port":
|
||||||
|
HttpPort = (uint) configuration_result;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
/// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
|
/// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="FileName">The filename to the inventory server plugin DLL</param>
|
/// <param name="FileName">The filename to the inventory server plugin DLL</param>
|
||||||
public void AddDatabasePlugin(string FileName)
|
public void AddDatabasePlugin(string FileName, string dbconnect)
|
||||||
{
|
{
|
||||||
m_log.Info("[" + OpenInventory_Main.LogName + "]: Invenstorage: Attempting to load " + FileName);
|
m_log.Info("[" + OpenInventory_Main.LogName + "]: Invenstorage: Attempting to load " + FileName);
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||||
|
@ -65,7 +65,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
{
|
{
|
||||||
IInventoryData plug =
|
IInventoryData plug =
|
||||||
(IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
(IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
plug.Initialise();
|
plug.Initialise(dbconnect);
|
||||||
_databasePlugin = plug;
|
_databasePlugin = plug;
|
||||||
m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
|
m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
|
||||||
"Invenstorage: Added IInventoryData Interface");
|
"Invenstorage: Added IInventoryData Interface");
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
|
|
||||||
m_inventoryService = new GridInventoryService();
|
m_inventoryService = new GridInventoryService();
|
||||||
// m_inventoryManager = new InventoryManager();
|
// m_inventoryManager = new InventoryManager();
|
||||||
m_inventoryService.AddPlugin(m_config.DatabaseProvider);
|
m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
|
||||||
|
|
||||||
m_log.Info("[" + LogName + "]: Starting HTTP server ...");
|
m_log.Info("[" + LogName + "]: Starting HTTP server ...");
|
||||||
|
|
||||||
|
|
|
@ -353,7 +353,7 @@ namespace OpenSim
|
||||||
if (m_sandbox)
|
if (m_sandbox)
|
||||||
{
|
{
|
||||||
LocalInventoryService inventoryService = new LocalInventoryService();
|
LocalInventoryService inventoryService = new LocalInventoryService();
|
||||||
inventoryService.AddPlugin(m_standaloneInventoryPlugin);
|
inventoryService.AddPlugin(m_standaloneInventoryPlugin, m_standaloneInventorySource);
|
||||||
|
|
||||||
LocalUserServices userService =
|
LocalUserServices userService =
|
||||||
new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
|
new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
|
||||||
|
|
|
@ -104,13 +104,18 @@ welcome_message = "Welcome to OpenSim"
|
||||||
; Asset database provider
|
; Asset database provider
|
||||||
asset_plugin = "OpenSim.Data.SQLite.dll"
|
asset_plugin = "OpenSim.Data.SQLite.dll"
|
||||||
; asset_plugin = "OpenSim.Data.MySQL.dll"
|
; asset_plugin = "OpenSim.Data.MySQL.dll"
|
||||||
|
|
||||||
; the Asset DB source. This only works for sqlite and nhibernate for now
|
; the Asset DB source. This only works for sqlite and nhibernate for now
|
||||||
asset_source = "URI=file:Asset.db,version=3"
|
; Asset Source SQLite Exampe
|
||||||
|
; asset_source = "URI=file:Asset.db,version=3"
|
||||||
|
; Asset Source NHibernate Example (DIALECT;DRIVER;CONNECTSTRING)
|
||||||
|
; asset_source = "SQLiteDialect;SqliteClientDriver;URI=file:Asset.db,version=3"
|
||||||
|
|
||||||
; Inventory database provider
|
; Inventory database provider
|
||||||
inventory_plugin = "OpenSim.Data.SQLite.dll"
|
inventory_plugin = "OpenSim.Data.SQLite.dll"
|
||||||
; inventory_plugin = "OpenSim.Data.MySQL.dll"
|
; inventory_plugin = "OpenSim.Data.MySQL.dll"
|
||||||
|
|
||||||
|
|
||||||
; User Data Database provider
|
; User Data Database provider
|
||||||
userDatabase_plugin = "OpenSim.Data.SQLite.dll"
|
userDatabase_plugin = "OpenSim.Data.SQLite.dll"
|
||||||
; userDatabase_plugin = "OpenSim.Data.MySQL.dll"
|
; userDatabase_plugin = "OpenSim.Data.MySQL.dll"
|
||||||
|
|
Loading…
Reference in New Issue