aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2008-05-28 17:59:46 +0000
committerSean Dague2008-05-28 17:59:46 +0000
commit89c164fbc18e082bf2d036bd2167b824e90aebc1 (patch)
tree9042b06429cb3941b04f79af084c13d022d861e7 /OpenSim
parent* Minor: Another small log adjustment (diff)
downloadopensim-SC-89c164fbc18e082bf2d036bd2167b824e90aebc1.zip
opensim-SC-89c164fbc18e082bf2d036bd2167b824e90aebc1.tar.gz
opensim-SC-89c164fbc18e082bf2d036bd2167b824e90aebc1.tar.bz2
opensim-SC-89c164fbc18e082bf2d036bd2167b824e90aebc1.tar.xz
let Grid Servers specify a connect string in their configuration.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/GridDataBase.cs2
-rw-r--r--OpenSim/Data/IGridData.cs2
-rw-r--r--OpenSim/Data/ILogData.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGridData.cs3
-rw-r--r--OpenSim/Data/MSSQL/MSSQLLogData.cs3
-rw-r--r--OpenSim/Data/MySQL/MySQLGridData.cs29
-rw-r--r--OpenSim/Data/MySQL/MySQLLogData.cs34
-rw-r--r--OpenSim/Data/SQLite/SQLiteGridData.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteManager.cs14
-rw-r--r--OpenSim/Framework/GridConfig.cs6
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs6
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs2
12 files changed, 70 insertions, 37 deletions
diff --git a/OpenSim/Data/GridDataBase.cs b/OpenSim/Data/GridDataBase.cs
index 036e2eb..0c9d24a 100644
--- a/OpenSim/Data/GridDataBase.cs
+++ b/OpenSim/Data/GridDataBase.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Data
36 public abstract RegionProfileData GetProfileByString(string regionName); 36 public abstract RegionProfileData GetProfileByString(string regionName);
37 public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); 37 public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
38 public abstract bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey); 38 public abstract bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
39 public abstract void Initialise(); 39 public abstract void Initialise(string connect);
40 public abstract void Close(); 40 public abstract void Close();
41 public abstract string getName(); 41 public abstract string getName();
42 public abstract string getVersion(); 42 public abstract string getVersion();
diff --git a/OpenSim/Data/IGridData.cs b/OpenSim/Data/IGridData.cs
index b2a8d26..e242312 100644
--- a/OpenSim/Data/IGridData.cs
+++ b/OpenSim/Data/IGridData.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Data
86 /// <summary> 86 /// <summary>
87 /// Initialises the interface 87 /// Initialises the interface
88 /// </summary> 88 /// </summary>
89 void Initialise(); 89 void Initialise(string connect);
90 90
91 /// <summary> 91 /// <summary>
92 /// Closes the interface 92 /// Closes the interface
diff --git a/OpenSim/Data/ILogData.cs b/OpenSim/Data/ILogData.cs
index a533c87..7275637 100644
--- a/OpenSim/Data/ILogData.cs
+++ b/OpenSim/Data/ILogData.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Data
69 /// <summary> 69 /// <summary>
70 /// Initialises the interface 70 /// Initialises the interface
71 /// </summary> 71 /// </summary>
72 void Initialise(); 72 void Initialise(string connect);
73 73
74 /// <summary> 74 /// <summary>
75 /// Closes the interface 75 /// Closes the interface
diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs
index 0bdd460..d7adb84 100644
--- a/OpenSim/Data/MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs
@@ -53,8 +53,9 @@ namespace OpenSim.Data.MSSQL
53 /// <summary> 53 /// <summary>
54 /// Initialises the Grid Interface 54 /// Initialises the Grid Interface
55 /// </summary> 55 /// </summary>
56 override public void Initialise() 56 override public void Initialise(string connect)
57 { 57 {
58 // TODO: make the connect string actually do something
58 IniFile iniFile = new IniFile("mssql_connection.ini"); 59 IniFile iniFile = new IniFile("mssql_connection.ini");
59 60
60 string settingDataSource = iniFile.ParseFileReadValue("data_source"); 61 string settingDataSource = iniFile.ParseFileReadValue("data_source");
diff --git a/OpenSim/Data/MSSQL/MSSQLLogData.cs b/OpenSim/Data/MSSQL/MSSQLLogData.cs
index 2bb5839..c75290e 100644
--- a/OpenSim/Data/MSSQL/MSSQLLogData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLLogData.cs
@@ -43,8 +43,9 @@ namespace OpenSim.Data.MSSQL
43 /// <summary> 43 /// <summary>
44 /// Artificial constructor called when the plugin is loaded 44 /// Artificial constructor called when the plugin is loaded
45 /// </summary> 45 /// </summary>
46 public void Initialise() 46 public void Initialise(string connect)
47 { 47 {
48 // TODO: do something with the connect string
48 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); 49 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
49 string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); 50 string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
50 string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); 51 string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog");
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs
index e830133..421c283 100644
--- a/OpenSim/Data/MySQL/MySQLGridData.cs
+++ b/OpenSim/Data/MySQL/MySQLGridData.cs
@@ -51,19 +51,24 @@ namespace OpenSim.Data.MySQL
51 /// <summary> 51 /// <summary>
52 /// Initialises the Grid Interface 52 /// Initialises the Grid Interface
53 /// </summary> 53 /// </summary>
54 override public void Initialise() 54 override public void Initialise(string connect)
55 { 55 {
56 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 56 if (connect != String.Empty) {
57 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); 57 database = new MySQLManager(connect);
58 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); 58 } else {
59 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); 59 m_log.Warn("Using deprecated mysql_connection.ini. Please update database_connect in GridServer_Config.xml and we'll use that instead");
60 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 60 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
61 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 61 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
62 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 62 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
63 63 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
64 database = 64 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
65 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, 65 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
66 settingPort); 66 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
67
68 database =
69 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
70 settingPort);
71 }
67 72
68 TestTables(); 73 TestTables();
69 } 74 }
diff --git a/OpenSim/Data/MySQL/MySQLLogData.cs b/OpenSim/Data/MySQL/MySQLLogData.cs
index bb34d34..0873066 100644
--- a/OpenSim/Data/MySQL/MySQLLogData.cs
+++ b/OpenSim/Data/MySQL/MySQLLogData.cs
@@ -24,6 +24,9 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27using System;
28using System.Reflection;
29using log4net;
27 30
28namespace OpenSim.Data.MySQL 31namespace OpenSim.Data.MySQL
29{ 32{
@@ -31,7 +34,8 @@ namespace OpenSim.Data.MySQL
31 /// An interface to the log database for MySQL 34 /// An interface to the log database for MySQL
32 /// </summary> 35 /// </summary>
33 internal class MySQLLogData : ILogData 36 internal class MySQLLogData : ILogData
34 { 37 {
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
35 /// <summary> 39 /// <summary>
36 /// The database manager 40 /// The database manager
37 /// </summary> 41 /// </summary>
@@ -40,19 +44,25 @@ namespace OpenSim.Data.MySQL
40 /// <summary> 44 /// <summary>
41 /// Artificial constructor called when the plugin is loaded 45 /// Artificial constructor called when the plugin is loaded
42 /// </summary> 46 /// </summary>
43 public void Initialise() 47 public void Initialise(string connect)
44 { 48 {
45 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 49 if (connect != String.Empty) {
46 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); 50 database = new MySQLManager(connect);
47 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); 51 } else {
48 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); 52 m_log.Warn("Using deprecated mysql_connection.ini. Please update database_connect in GridServer_Config.xml and we'll use that instead");
49 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
50 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
51 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
52 53
53 database = 54 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
54 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, 55 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
55 settingPort); 56 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
57 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
58 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
59 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
60 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
61
62 database =
63 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
64 settingPort);
65 }
56 } 66 }
57 67
58 /// <summary> 68 /// <summary>
diff --git a/OpenSim/Data/SQLite/SQLiteGridData.cs b/OpenSim/Data/SQLite/SQLiteGridData.cs
index 989ec77..7c5bb0c 100644
--- a/OpenSim/Data/SQLite/SQLiteGridData.cs
+++ b/OpenSim/Data/SQLite/SQLiteGridData.cs
@@ -48,9 +48,9 @@ namespace OpenSim.Data.SQLite
48 /// <summary> 48 /// <summary>
49 /// Initialises the Grid Interface 49 /// Initialises the Grid Interface
50 /// </summary> 50 /// </summary>
51 override public void Initialise() 51 override public void Initialise(string connect)
52 { 52 {
53 database = new SQLiteManager("localhost", "db", "user", "password", "false"); 53 database = new SQLiteManager(connect);
54 } 54 }
55 55
56 /// <summary> 56 /// <summary>
diff --git a/OpenSim/Data/SQLite/SQLiteManager.cs b/OpenSim/Data/SQLite/SQLiteManager.cs
index e1d2cdf..4d39527 100644
--- a/OpenSim/Data/SQLite/SQLiteManager.cs
+++ b/OpenSim/Data/SQLite/SQLiteManager.cs
@@ -49,11 +49,21 @@ namespace OpenSim.Data.SQLite
49 /// <param name="username">The username logging into the database</param> 49 /// <param name="username">The username logging into the database</param>
50 /// <param name="password">The password for the user logging in</param> 50 /// <param name="password">The password for the user logging in</param>
51 /// <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> 51 /// <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>
52 public SQLiteManager(string hostname, string database, string username, string password, string cpooling) 52 public SQLiteManager(string connect)
53 { 53 {
54 try 54 try
55 { 55 {
56 string connectionString = "URI=file:GridServerSqlite.db;"; 56 string connectionString = String.Empty;
57 if (connect != String.Empty)
58 {
59 connectionString = connect;
60 }
61 else
62 {
63 m_log.Warn("[SQLITE] grid db not specified, using default");
64 connectionString = "URI=file:GridServerSqlite.db;";
65 }
66
57 dbcon = new SQLiteConnection(connectionString); 67 dbcon = new SQLiteConnection(connectionString);
58 68
59 dbcon.Open(); 69 dbcon.Open();
diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs
index f0cf91f..e405b26 100644
--- a/OpenSim/Framework/GridConfig.cs
+++ b/OpenSim/Framework/GridConfig.cs
@@ -39,6 +39,7 @@ namespace OpenSim.Framework
39 39
40 private ConfigurationMember configMember; 40 private ConfigurationMember configMember;
41 public string DatabaseProvider = String.Empty; 41 public string DatabaseProvider = String.Empty;
42 public string DatabaseConnect = String.Empty;
42 public string DefaultAssetServer = String.Empty; 43 public string DefaultAssetServer = String.Empty;
43 public string DefaultUserServer = String.Empty; 44 public string DefaultUserServer = String.Empty;
44 public string GridOwner = String.Empty; 45 public string GridOwner = String.Empty;
@@ -85,6 +86,8 @@ namespace OpenSim.Framework
85 "Key to expect from a simulator", "null", false); 86 "Key to expect from a simulator", "null", false);
86 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 87 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
87 "DLL for database provider", "OpenSim.Data.MySQL.dll", false); 88 "DLL for database provider", "OpenSim.Data.MySQL.dll", false);
89 configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
90 "Database connect string", "", false);
88 91
89 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 92 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
90 "Http Listener port", DefaultHttpPort.ToString(), false); 93 "Http Listener port", DefaultHttpPort.ToString(), false);
@@ -128,6 +131,9 @@ namespace OpenSim.Framework
128 case "database_provider": 131 case "database_provider":
129 DatabaseProvider = (string) configuration_result; 132 DatabaseProvider = (string) configuration_result;
130 break; 133 break;
134 case "database_connect":
135 DatabaseConnect = (string) configuration_result;
136 break;
131 case "http_port": 137 case "http_port":
132 HttpPort = (uint) configuration_result; 138 HttpPort = (uint) configuration_result;
133 break; 139 break;
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index d0eec32..2933f04 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Grid.GridServer
58 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. 58 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
59 /// </summary> 59 /// </summary>
60 /// <param name="FileName">The filename to the grid server plugin DLL</param> 60 /// <param name="FileName">The filename to the grid server plugin DLL</param>
61 public void AddPlugin(string FileName) 61 public void AddPlugin(string FileName, string Connect)
62 { 62 {
63 m_log.Info("[DATA]: Attempting to load " + FileName); 63 m_log.Info("[DATA]: Attempting to load " + FileName);
64 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 64 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
@@ -75,7 +75,7 @@ namespace OpenSim.Grid.GridServer
75 { 75 {
76 IGridData plug = 76 IGridData plug =
77 (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 77 (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
78 plug.Initialise(); 78 plug.Initialise(Connect);
79 _plugins.Add(plug.getName(), plug); 79 _plugins.Add(plug.getName(), plug);
80 m_log.Info("[DATA]: Added IGridData Interface"); 80 m_log.Info("[DATA]: Added IGridData Interface");
81 } 81 }
@@ -87,7 +87,7 @@ namespace OpenSim.Grid.GridServer
87 { 87 {
88 ILogData plug = 88 ILogData plug =
89 (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 89 (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
90 plug.Initialise(); 90 plug.Initialise(Connect);
91 _logplugins.Add(plug.getName(), plug); 91 _logplugins.Add(plug.getName(), plug);
92 m_log.Info("[DATA]: Added ILogData Interface"); 92 m_log.Info("[DATA]: Added ILogData Interface");
93 } 93 }
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 4e29cbf..263866a 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -135,7 +135,7 @@ namespace OpenSim.Grid.GridServer
135 { 135 {
136 m_log.Info("[DATA]: Connecting to Storage Server"); 136 m_log.Info("[DATA]: Connecting to Storage Server");
137 m_gridManager = new GridManager(); 137 m_gridManager = new GridManager();
138 m_gridManager.AddPlugin(m_config.DatabaseProvider); 138 m_gridManager.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
139 m_gridManager.Config = m_config; 139 m_gridManager.Config = m_config;
140 } 140 }
141 141