diff options
author | Sean Dague | 2008-05-28 17:59:46 +0000 |
---|---|---|
committer | Sean Dague | 2008-05-28 17:59:46 +0000 |
commit | 89c164fbc18e082bf2d036bd2167b824e90aebc1 (patch) | |
tree | 9042b06429cb3941b04f79af084c13d022d861e7 /OpenSim/Data | |
parent | * Minor: Another small log adjustment (diff) | |
download | opensim-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 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/GridDataBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/IGridData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/ILogData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLGridData.cs | 3 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLLogData.cs | 3 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGridData.cs | 29 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLLogData.cs | 34 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteGridData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteManager.cs | 14 |
9 files changed, 60 insertions, 33 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 | */ |
27 | using System; | ||
28 | using System.Reflection; | ||
29 | using log4net; | ||
27 | 30 | ||
28 | namespace OpenSim.Data.MySQL | 31 | namespace 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(); |