plumb in connection string to the user database paths. mysql and mssql
just ignore this for now, but it lets us get connect strings to sqlite and nhibernate.0.6.0-stable
parent
72a7c2e2bb
commit
1b7f1c956c
|
@ -55,10 +55,11 @@ namespace OpenSim.Data.MSSQL
|
|||
/// <summary>
|
||||
/// Loads and initialises the MySQL storage plugin
|
||||
/// </summary>
|
||||
override public void Initialise()
|
||||
override public void Initialise(string connect)
|
||||
{
|
||||
// Load from an INI file connection details
|
||||
// TODO: move this to XML?
|
||||
// TODO: do something with the connect string instead of
|
||||
// ignoring it.
|
||||
|
||||
IniFile iniFile = new IniFile("mssql_connection.ini");
|
||||
string settingDataSource = iniFile.ParseFileReadValue("data_source");
|
||||
string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
|
||||
|
|
|
@ -55,10 +55,10 @@ namespace OpenSim.Data.MySQL
|
|||
/// <summary>
|
||||
/// Loads and initialises the MySQL storage plugin
|
||||
/// </summary>
|
||||
override public void Initialise()
|
||||
override public void Initialise(string connect)
|
||||
{
|
||||
// Load from an INI file connection details
|
||||
// TODO: move this to XML? Yes, PLEASE!
|
||||
// TODO: actually do something with our connect string
|
||||
// instead of loading the second config
|
||||
|
||||
IniFile iniFile = new IniFile("mysql_connection.ini");
|
||||
string settingHostname = iniFile.ParseFileReadValue("hostname");
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
@ -35,6 +36,7 @@ using NHibernate.Cfg;
|
|||
using NHibernate.Expression;
|
||||
using NHibernate.Mapping.Attributes;
|
||||
using OpenSim.Framework;
|
||||
using Environment=NHibernate.Cfg.Environment;
|
||||
|
||||
namespace OpenSim.Data.NHibernate
|
||||
{
|
||||
|
@ -48,20 +50,24 @@ namespace OpenSim.Data.NHibernate
|
|||
private Configuration cfg;
|
||||
private ISessionFactory factory;
|
||||
|
||||
public override void Initialise()
|
||||
public override void Initialise(string connect)
|
||||
{
|
||||
// TODO: hard coding for sqlite based stuff to begin with, just making it easier to test
|
||||
char[] split = {';'};
|
||||
string[] parts = connect.Split(split, 3);
|
||||
if (parts.Length != 3) {
|
||||
// TODO: make this a real exception type
|
||||
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
||||
}
|
||||
|
||||
// This is stubbing for now, it will become dynamic later and support different db backends
|
||||
cfg = new Configuration();
|
||||
cfg.SetProperty(Environment.ConnectionProvider,
|
||||
"NHibernate.Connection.DriverConnectionProvider");
|
||||
cfg.SetProperty(Environment.Dialect,
|
||||
"NHibernate.Dialect.SQLiteDialect");
|
||||
"NHibernate.Dialect." + parts[0]);
|
||||
cfg.SetProperty(Environment.ConnectionDriver,
|
||||
"NHibernate.Driver.SqliteClientDriver");
|
||||
cfg.SetProperty(Environment.ConnectionString,
|
||||
"URI=file:User.db,version=3");
|
||||
"NHibernate.Driver." + parts[1]);
|
||||
cfg.SetProperty(Environment.ConnectionString, parts[2]);
|
||||
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
||||
|
||||
HbmSerializer.Default.Validate = true;
|
||||
|
|
|
@ -64,9 +64,13 @@ namespace OpenSim.Data.SQLite
|
|||
private SqliteDataAdapter daf;
|
||||
SqliteConnection g_conn;
|
||||
|
||||
override public void Initialise()
|
||||
override public void Initialise(string connect)
|
||||
{
|
||||
SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3");
|
||||
// default to something sensible
|
||||
if (connect == "")
|
||||
connect = "URI=file:userprofiles.db,version=3";
|
||||
|
||||
SqliteConnection conn = new SqliteConnection(connect);
|
||||
TestTables(conn);
|
||||
|
||||
// This sucks, but It doesn't seem to work with the dataset Syncing :P
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Data
|
|||
public abstract bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
|
||||
public abstract string Version {get;}
|
||||
public abstract string Name {get;}
|
||||
public abstract void Initialise();
|
||||
public abstract void Initialise(string connect);
|
||||
public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
|
||||
public abstract UserAppearance GetUserAppearance(LLUUID user);
|
||||
public abstract void UpdateUserAppearance(LLUUID user, UserAppearance appearance);
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenSim.Framework.Communications
|
|||
/// Adds a new user server plugin - user servers will be requested in the order they were loaded.
|
||||
/// </summary>
|
||||
/// <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))
|
||||
{
|
||||
|
@ -71,16 +71,16 @@ namespace OpenSim.Framework.Communications
|
|||
{
|
||||
IUserData plug =
|
||||
(IUserData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
AddPlugin(plug);
|
||||
AddPlugin(plug, connect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPlugin(IUserData plug)
|
||||
public void AddPlugin(IUserData plug, string connect)
|
||||
{
|
||||
plug.Initialise();
|
||||
plug.Initialise(connect);
|
||||
_plugins.Add(plug.Name, plug);
|
||||
m_log.Info("[USERSTORAGE]: Added IUserData Interface");
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// Initialises the plugin (artificial constructor)
|
||||
/// </summary>
|
||||
void Initialise();
|
||||
void Initialise(string connect);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user appearance
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace OpenSim.Framework
|
|||
public static bool DefaultHttpSSL = false;
|
||||
private ConfigurationMember configMember;
|
||||
public string DatabaseProvider = String.Empty;
|
||||
public string DatabaseConnect = String.Empty;
|
||||
public string DefaultStartupMsg = String.Empty;
|
||||
public uint DefaultX = 1000;
|
||||
public uint DefaultY = 1000;
|
||||
|
@ -77,6 +78,8 @@ namespace OpenSim.Framework
|
|||
false);
|
||||
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"DLL for database provider", "OpenSim.Data.MySQL.dll", false);
|
||||
configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Connection String for Database", "", false);
|
||||
|
||||
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Http Listener port", DefaultHttpPort.ToString(), false);
|
||||
|
@ -110,6 +113,9 @@ namespace OpenSim.Framework
|
|||
case "database_provider":
|
||||
DatabaseProvider = (string) configuration_result;
|
||||
break;
|
||||
case "database_connect":
|
||||
DatabaseConnect = (string) configuration_result;
|
||||
break;
|
||||
case "http_port":
|
||||
HttpPort = (uint) configuration_result;
|
||||
break;
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace OpenSim.Grid.UserServer
|
|||
m_log.Info("[REGION]: Establishing data connection");
|
||||
m_userManager = new UserManager();
|
||||
m_userManager._config = Cfg;
|
||||
m_userManager.AddPlugin(Cfg.DatabaseProvider);
|
||||
m_userManager.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect);
|
||||
|
||||
m_loginService = new UserLoginService(
|
||||
m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
|
||||
|
|
|
@ -362,7 +362,7 @@ namespace OpenSim
|
|||
LocalUserServices userService =
|
||||
new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
|
||||
m_networkServersInfo.DefaultHomeLocY, inventoryService);
|
||||
userService.AddPlugin(m_standaloneUserPlugin);
|
||||
userService.AddPlugin(m_standaloneUserPlugin, m_standaloneUserSource);
|
||||
|
||||
LocalBackEndServices backendService = new LocalBackEndServices();
|
||||
|
||||
|
|
Loading…
Reference in New Issue