add a database_connect field for the asset server config

which will let you specify a connection string.  Required
for Nhibernate, optional for sqlite (there is a sane default), 
ignored for mysql and mssql until someone implements the 
Iniatialise(string) method.
0.6.0-stable
Sean Dague 2008-04-23 20:57:18 +00:00
parent 3dd98a112f
commit 3f95804911
2 changed files with 12 additions and 4 deletions

View File

@ -38,7 +38,9 @@ namespace OpenSim.Framework
public string DatabaseProvider = String.Empty;
public static uint DefaultHttpPort = 8003;
public string DatabaseConnect = String.Empty;
public const uint DefaultHttpPort = 8003;
public uint HttpPort = DefaultHttpPort;
private ConfigurationMember configMember;
@ -59,6 +61,9 @@ namespace OpenSim.Framework
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,
"Database connection string", "", false);
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Http Listener port", DefaultHttpPort.ToString(), false);
}
@ -73,6 +78,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;

View File

@ -116,7 +116,7 @@ namespace OpenSim.Grid.AssetServer
return null;
}
public IAssetProvider LoadDatabasePlugin(string FileName)
public IAssetProvider LoadDatabasePlugin(string FileName, string connect)
{
m_log.Info("[ASSET SERVER]: LoadDatabasePlugin: Attempting to load " + FileName);
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
@ -132,7 +132,7 @@ namespace OpenSim.Grid.AssetServer
IAssetProvider plug =
(IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
assetPlugin = plug;
assetPlugin.Initialise();
assetPlugin.Initialise(connect);
m_log.Info("[ASSET SERVER]: Added " + assetPlugin.Name + " " + assetPlugin.Version);
break;
@ -150,7 +150,7 @@ namespace OpenSim.Grid.AssetServer
{
try
{
m_assetProvider = LoadDatabasePlugin(config.DatabaseProvider);
m_assetProvider = LoadDatabasePlugin(config.DatabaseProvider, config.DatabaseConnect);
if (m_assetProvider == null)
{
m_log.Error("[ASSET]: Failed to load a database plugin, server halting");