let Grid Servers specify a connect string in their configuration.
parent
a8b8bacf28
commit
89c164fbc1
|
@ -36,7 +36,7 @@ namespace OpenSim.Data
|
|||
public abstract RegionProfileData GetProfileByString(string regionName);
|
||||
public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
||||
public abstract bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
|
||||
public abstract void Initialise();
|
||||
public abstract void Initialise(string connect);
|
||||
public abstract void Close();
|
||||
public abstract string getName();
|
||||
public abstract string getVersion();
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace OpenSim.Data
|
|||
/// <summary>
|
||||
/// Initialises the interface
|
||||
/// </summary>
|
||||
void Initialise();
|
||||
void Initialise(string connect);
|
||||
|
||||
/// <summary>
|
||||
/// Closes the interface
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace OpenSim.Data
|
|||
/// <summary>
|
||||
/// Initialises the interface
|
||||
/// </summary>
|
||||
void Initialise();
|
||||
void Initialise(string connect);
|
||||
|
||||
/// <summary>
|
||||
/// Closes the interface
|
||||
|
|
|
@ -53,8 +53,9 @@ namespace OpenSim.Data.MSSQL
|
|||
/// <summary>
|
||||
/// Initialises the Grid Interface
|
||||
/// </summary>
|
||||
override public void Initialise()
|
||||
override public void Initialise(string connect)
|
||||
{
|
||||
// TODO: make the connect string actually do something
|
||||
IniFile iniFile = new IniFile("mssql_connection.ini");
|
||||
|
||||
string settingDataSource = iniFile.ParseFileReadValue("data_source");
|
||||
|
|
|
@ -43,8 +43,9 @@ namespace OpenSim.Data.MSSQL
|
|||
/// <summary>
|
||||
/// Artificial constructor called when the plugin is loaded
|
||||
/// </summary>
|
||||
public void Initialise()
|
||||
public void Initialise(string connect)
|
||||
{
|
||||
// TODO: do something with the connect string
|
||||
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
||||
string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
|
||||
string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog");
|
||||
|
|
|
@ -51,8 +51,12 @@ namespace OpenSim.Data.MySQL
|
|||
/// <summary>
|
||||
/// Initialises the Grid Interface
|
||||
/// </summary>
|
||||
override public void Initialise()
|
||||
override public void Initialise(string connect)
|
||||
{
|
||||
if (connect != String.Empty) {
|
||||
database = new MySQLManager(connect);
|
||||
} else {
|
||||
m_log.Warn("Using deprecated mysql_connection.ini. Please update database_connect in GridServer_Config.xml and we'll use that instead");
|
||||
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
||||
string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
|
||||
string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
|
||||
|
@ -64,6 +68,7 @@ namespace OpenSim.Data.MySQL
|
|||
database =
|
||||
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
|
||||
settingPort);
|
||||
}
|
||||
|
||||
TestTables();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Data.MySQL
|
||||
{
|
||||
|
@ -32,6 +35,7 @@ namespace OpenSim.Data.MySQL
|
|||
/// </summary>
|
||||
internal class MySQLLogData : ILogData
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
/// <summary>
|
||||
/// The database manager
|
||||
/// </summary>
|
||||
|
@ -40,8 +44,13 @@ namespace OpenSim.Data.MySQL
|
|||
/// <summary>
|
||||
/// Artificial constructor called when the plugin is loaded
|
||||
/// </summary>
|
||||
public void Initialise()
|
||||
public void Initialise(string connect)
|
||||
{
|
||||
if (connect != String.Empty) {
|
||||
database = new MySQLManager(connect);
|
||||
} else {
|
||||
m_log.Warn("Using deprecated mysql_connection.ini. Please update database_connect in GridServer_Config.xml and we'll use that instead");
|
||||
|
||||
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
||||
string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
|
||||
string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
|
||||
|
@ -54,6 +63,7 @@ namespace OpenSim.Data.MySQL
|
|||
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
|
||||
settingPort);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves a log item to the database
|
||||
|
|
|
@ -48,9 +48,9 @@ namespace OpenSim.Data.SQLite
|
|||
/// <summary>
|
||||
/// Initialises the Grid Interface
|
||||
/// </summary>
|
||||
override public void Initialise()
|
||||
override public void Initialise(string connect)
|
||||
{
|
||||
database = new SQLiteManager("localhost", "db", "user", "password", "false");
|
||||
database = new SQLiteManager(connect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -49,11 +49,21 @@ namespace OpenSim.Data.SQLite
|
|||
/// <param name="username">The username logging into the database</param>
|
||||
/// <param name="password">The password for the user logging in</param>
|
||||
/// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
|
||||
public SQLiteManager(string hostname, string database, string username, string password, string cpooling)
|
||||
public SQLiteManager(string connect)
|
||||
{
|
||||
try
|
||||
{
|
||||
string connectionString = "URI=file:GridServerSqlite.db;";
|
||||
string connectionString = String.Empty;
|
||||
if (connect != String.Empty)
|
||||
{
|
||||
connectionString = connect;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[SQLITE] grid db not specified, using default");
|
||||
connectionString = "URI=file:GridServerSqlite.db;";
|
||||
}
|
||||
|
||||
dbcon = new SQLiteConnection(connectionString);
|
||||
|
||||
dbcon.Open();
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace OpenSim.Framework
|
|||
|
||||
private ConfigurationMember configMember;
|
||||
public string DatabaseProvider = String.Empty;
|
||||
public string DatabaseConnect = String.Empty;
|
||||
public string DefaultAssetServer = String.Empty;
|
||||
public string DefaultUserServer = String.Empty;
|
||||
public string GridOwner = String.Empty;
|
||||
|
@ -85,6 +86,8 @@ namespace OpenSim.Framework
|
|||
"Key to expect from a simulator", "null", 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,
|
||||
"Database connect string", "", false);
|
||||
|
||||
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Http Listener port", DefaultHttpPort.ToString(), false);
|
||||
|
@ -128,6 +131,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;
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Grid.GridServer
|
|||
/// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
|
||||
/// </summary>
|
||||
/// <param name="FileName">The filename to the grid server plugin DLL</param>
|
||||
public void AddPlugin(string FileName)
|
||||
public void AddPlugin(string FileName, string Connect)
|
||||
{
|
||||
m_log.Info("[DATA]: Attempting to load " + FileName);
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||
|
@ -75,7 +75,7 @@ namespace OpenSim.Grid.GridServer
|
|||
{
|
||||
IGridData plug =
|
||||
(IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
plug.Initialise();
|
||||
plug.Initialise(Connect);
|
||||
_plugins.Add(plug.getName(), plug);
|
||||
m_log.Info("[DATA]: Added IGridData Interface");
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ namespace OpenSim.Grid.GridServer
|
|||
{
|
||||
ILogData plug =
|
||||
(ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
plug.Initialise();
|
||||
plug.Initialise(Connect);
|
||||
_logplugins.Add(plug.getName(), plug);
|
||||
m_log.Info("[DATA]: Added ILogData Interface");
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace OpenSim.Grid.GridServer
|
|||
{
|
||||
m_log.Info("[DATA]: Connecting to Storage Server");
|
||||
m_gridManager = new GridManager();
|
||||
m_gridManager.AddPlugin(m_config.DatabaseProvider);
|
||||
m_gridManager.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
|
||||
m_gridManager.Config = m_config;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue