diff options
author | lbsa71 | 2009-02-21 09:39:33 +0000 |
---|---|---|
committer | lbsa71 | 2009-02-21 09:39:33 +0000 |
commit | 1cadad9ec62c54fe8ebde8a895817bd980fed975 (patch) | |
tree | 00e9f96a1486fdb59a65494ef0bf88cbde082c2c /OpenSim/Data | |
parent | Add copyright headers. Minor formatting cleanup. (diff) | |
download | opensim-SC-1cadad9ec62c54fe8ebde8a895817bd980fed975.zip opensim-SC-1cadad9ec62c54fe8ebde8a895817bd980fed975.tar.gz opensim-SC-1cadad9ec62c54fe8ebde8a895817bd980fed975.tar.bz2 opensim-SC-1cadad9ec62c54fe8ebde8a895817bd980fed975.tar.xz |
* Applied a patch that: Added estate ban table to migration scripts and nhibernate mapping. Refactored property getters and setters for estate ban object to support NHibernate.
* Added estate ban table to migration scripts of all supported databases.
* Added nhibernate mapping for EstateBans property of EstateSettings
* Refactored property accessors for EstateBan object.
* Added comments for EstateBan properties.
* Ensured that NHibernate tests pass with NUnitGUI.
* Ensured that nant test target passes.
This fixes mantis #3210. Thank you, tlaukkan!
Diffstat (limited to 'OpenSim/Data')
9 files changed, 66 insertions, 16 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index 4d5c116..3002fe3 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs | |||
@@ -332,9 +332,9 @@ namespace OpenSim.Data.MSSQL | |||
332 | // UUID uuid; | 332 | // UUID uuid; |
333 | // UUID.TryParse(reader["bannedUUID"].ToString(), out uuid); | 333 | // UUID.TryParse(reader["bannedUUID"].ToString(), out uuid); |
334 | 334 | ||
335 | eb.bannedUUID = new UUID((Guid)reader["bannedUUID"]); //uuid; | 335 | eb.BannedUserID = new UUID((Guid)reader["bannedUUID"]); //uuid; |
336 | eb.bannedIP = "0.0.0.0"; | 336 | eb.BannedHostAddress = "0.0.0.0"; |
337 | eb.bannedIPHostMask = "0.0.0.0"; | 337 | eb.BannedHostIPMask = "0.0.0.0"; |
338 | es.AddBan(eb); | 338 | es.AddBan(eb); |
339 | } | 339 | } |
340 | } | 340 | } |
@@ -386,7 +386,7 @@ namespace OpenSim.Data.MSSQL | |||
386 | { | 386 | { |
387 | cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID)); | 387 | cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID)); |
388 | 388 | ||
389 | cmd.Parameters.Add(_Database.CreateParameter("@bannedUUID", b.bannedUUID)); | 389 | cmd.Parameters.Add(_Database.CreateParameter("@bannedUUID", b.BannedUserID)); |
390 | 390 | ||
391 | cmd.ExecuteNonQuery(); | 391 | cmd.ExecuteNonQuery(); |
392 | 392 | ||
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 0db624d..133ee7a 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -314,9 +314,9 @@ namespace OpenSim.Data.MySQL | |||
314 | UUID uuid = new UUID(); | 314 | UUID uuid = new UUID(); |
315 | UUID.TryParse(r["bannedUUID"].ToString(), out uuid); | 315 | UUID.TryParse(r["bannedUUID"].ToString(), out uuid); |
316 | 316 | ||
317 | eb.bannedUUID = uuid; | 317 | eb.BannedUserID = uuid; |
318 | eb.bannedIP = "0.0.0.0"; | 318 | eb.BannedHostAddress = "0.0.0.0"; |
319 | eb.bannedIPHostMask = "0.0.0.0"; | 319 | eb.BannedHostIPMask = "0.0.0.0"; |
320 | es.AddBan(eb); | 320 | es.AddBan(eb); |
321 | } | 321 | } |
322 | r.Close(); | 322 | r.Close(); |
@@ -340,7 +340,7 @@ namespace OpenSim.Data.MySQL | |||
340 | foreach (EstateBan b in es.EstateBans) | 340 | foreach (EstateBan b in es.EstateBans) |
341 | { | 341 | { |
342 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); | 342 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); |
343 | cmd.Parameters.AddWithValue("?bannedUUID", b.bannedUUID.ToString()); | 343 | cmd.Parameters.AddWithValue("?bannedUUID", b.BannedUserID.ToString()); |
344 | 344 | ||
345 | cmd.ExecuteNonQuery(); | 345 | cmd.ExecuteNonQuery(); |
346 | cmd.Parameters.Clear(); | 346 | cmd.Parameters.Clear(); |
diff --git a/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml index d8c8975..d300b93 100644 --- a/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml | |||
@@ -52,6 +52,17 @@ | |||
52 | <index column="ArrayIndex" /> | 52 | <index column="ArrayIndex" /> |
53 | <element column="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> | 53 | <element column="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> |
54 | </array> | 54 | </array> |
55 | |||
56 | <array name="EstateBans" table="EstateBans" cascade="all"> | ||
57 | <key column="EstateID" /> | ||
58 | <index column="ArrayIndex" /> | ||
59 | <composite-element class="OpenSim.Framework.EstateBan, OpenSim.Framework"> | ||
60 | <property name="BannedUserID" column="BannedUserID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/> | ||
61 | <property name="BannedHostAddress" column="BannedHostAddress" type="String" length="16"/> | ||
62 | <property name="BannedHostIPMask" column="BannedHostIPMask" type="String" length="16"/> | ||
63 | <property name="BannedHostNameMask" column="BannedHostNameMask" type="String" length="16"/> | ||
64 | </composite-element> | ||
65 | </array> | ||
55 | 66 | ||
56 | </class> | 67 | </class> |
57 | </hibernate-mapping> | 68 | </hibernate-mapping> |
diff --git a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql index b852cbc..dd579f9 100644 --- a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql +++ b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql | |||
@@ -59,4 +59,14 @@ CREATE TABLE EstateGroups ( | |||
59 | GroupID NVARCHAR(36) NOT NULL, | 59 | GroupID NVARCHAR(36) NOT NULL, |
60 | ArrayIndex INT NOT NULL, | 60 | ArrayIndex INT NOT NULL, |
61 | PRIMARY KEY (EstateID,ArrayIndex) | 61 | PRIMARY KEY (EstateID,ArrayIndex) |
62 | ); | ||
63 | |||
64 | CREATE TABLE EstateBans ( | ||
65 | EstateID INT NOT NULL, | ||
66 | ArrayIndex INT NOT NULL, | ||
67 | BannedUserID NVARCHAR(36) NOT NULL, | ||
68 | BannedHostAddress NVARCHAR(16) NOT NULL, | ||
69 | BannedHostIPMask NVARCHAR(16) NOT NULL, | ||
70 | BannedHostNameMask NVARCHAR(16) NOT NULL, | ||
71 | PRIMARY KEY (EstateID,ArrayIndex) | ||
62 | ); \ No newline at end of file | 72 | ); \ No newline at end of file |
diff --git a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql index 69635d8..e9ae07e 100644 --- a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql +++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql | |||
@@ -60,3 +60,12 @@ CREATE TABLE EstateGroups ( | |||
60 | PRIMARY KEY (EstateID,ArrayIndex) | 60 | PRIMARY KEY (EstateID,ArrayIndex) |
61 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; | 61 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; |
62 | 62 | ||
63 | CREATE TABLE EstateBans ( | ||
64 | EstateID INT NOT NULL, | ||
65 | ArrayIndex INT NOT NULL, | ||
66 | BannedUserID VARCHAR(36) NOT NULL, | ||
67 | BannedHostAddress VARCHAR(16) NOT NULL, | ||
68 | BannedHostIPMask VARCHAR(16) NOT NULL, | ||
69 | BannedHostNameMask VARCHAR(16) NOT NULL, | ||
70 | PRIMARY KEY (EstateID,ArrayIndex) | ||
71 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; | ||
diff --git a/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql index d13a4d3..3f47930 100644 --- a/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql +++ b/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql | |||
@@ -59,4 +59,14 @@ CREATE TABLE EstateGroups ( | |||
59 | GroupID VARCHAR(36) NOT NULL, | 59 | GroupID VARCHAR(36) NOT NULL, |
60 | ArrayIndex INT NOT NULL, | 60 | ArrayIndex INT NOT NULL, |
61 | PRIMARY KEY (EstateID,ArrayIndex) | 61 | PRIMARY KEY (EstateID,ArrayIndex) |
62 | ); | ||
63 | |||
64 | CREATE TABLE EstateBans ( | ||
65 | EstateID INT NOT NULL, | ||
66 | ArrayIndex INT NOT NULL, | ||
67 | BannedUserID VARCHAR(36) NOT NULL, | ||
68 | BannedHostAddress VARCHAR(16) NOT NULL, | ||
69 | BannedHostIPMask VARCHAR(16) NOT NULL, | ||
70 | BannedHostNameMask VARCHAR(16) NOT NULL, | ||
71 | PRIMARY KEY (EstateID,ArrayIndex) | ||
62 | ); \ No newline at end of file | 72 | ); \ No newline at end of file |
diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql index 6e67630..afe702f 100644 --- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql | |||
@@ -59,3 +59,13 @@ CREATE TABLE EstateGroups ( | |||
59 | ArrayIndex INT NOT NULL, | 59 | ArrayIndex INT NOT NULL, |
60 | PRIMARY KEY (EstateID,ArrayIndex) | 60 | PRIMARY KEY (EstateID,ArrayIndex) |
61 | ); | 61 | ); |
62 | |||
63 | CREATE TABLE EstateBans ( | ||
64 | EstateID INT NOT NULL, | ||
65 | ArrayIndex INT NOT NULL, | ||
66 | BannedUserID VARCHAR(36) NOT NULL, | ||
67 | BannedHostAddress VARCHAR(16) NOT NULL, | ||
68 | BannedHostIPMask VARCHAR(16) NOT NULL, | ||
69 | BannedHostNameMask VARCHAR(16) NOT NULL, | ||
70 | PRIMARY KEY (EstateID,ArrayIndex) | ||
71 | ); | ||
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 3fb33c2..dea5624 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs | |||
@@ -258,9 +258,9 @@ namespace OpenSim.Data.SQLite | |||
258 | UUID uuid = new UUID(); | 258 | UUID uuid = new UUID(); |
259 | UUID.TryParse(r["bannedUUID"].ToString(), out uuid); | 259 | UUID.TryParse(r["bannedUUID"].ToString(), out uuid); |
260 | 260 | ||
261 | eb.bannedUUID = uuid; | 261 | eb.BannedUserID = uuid; |
262 | eb.bannedIP = "0.0.0.0"; | 262 | eb.BannedHostAddress = "0.0.0.0"; |
263 | eb.bannedIPHostMask = "0.0.0.0"; | 263 | eb.BannedHostIPMask = "0.0.0.0"; |
264 | es.AddBan(eb); | 264 | es.AddBan(eb); |
265 | } | 265 | } |
266 | r.Close(); | 266 | r.Close(); |
@@ -282,7 +282,7 @@ namespace OpenSim.Data.SQLite | |||
282 | foreach (EstateBan b in es.EstateBans) | 282 | foreach (EstateBan b in es.EstateBans) |
283 | { | 283 | { |
284 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 284 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); |
285 | cmd.Parameters.Add(":bannedUUID", b.bannedUUID.ToString()); | 285 | cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString()); |
286 | 286 | ||
287 | cmd.ExecuteNonQuery(); | 287 | cmd.ExecuteNonQuery(); |
288 | cmd.Parameters.Clear(); | 288 | cmd.Parameters.Clear(); |
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs index b37a392..f94ac46 100644 --- a/OpenSim/Data/Tests/BasicEstateTest.cs +++ b/OpenSim/Data/Tests/BasicEstateTest.cs | |||
@@ -223,10 +223,10 @@ namespace OpenSim.Data.Tests | |||
223 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); | 223 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); |
224 | 224 | ||
225 | EstateBan estateBan1 = new EstateBan(); | 225 | EstateBan estateBan1 = new EstateBan(); |
226 | estateBan1.bannedUUID = DataTestUtil.UUID_MIN; | 226 | estateBan1.BannedUserID = DataTestUtil.UUID_MIN; |
227 | 227 | ||
228 | EstateBan estateBan2 = new EstateBan(); | 228 | EstateBan estateBan2 = new EstateBan(); |
229 | estateBan2.bannedUUID = DataTestUtil.UUID_MAX; | 229 | estateBan2.BannedUserID = DataTestUtil.UUID_MAX; |
230 | 230 | ||
231 | originalSettings.EstateBans = new EstateBan[] { estateBan1, estateBan2 }; | 231 | originalSettings.EstateBans = new EstateBan[] { estateBan1, estateBan2 }; |
232 | 232 | ||
@@ -237,9 +237,9 @@ namespace OpenSim.Data.Tests | |||
237 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); | 237 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); |
238 | 238 | ||
239 | Assert.AreEqual(2, loadedSettings.EstateBans.Length); | 239 | Assert.AreEqual(2, loadedSettings.EstateBans.Length); |
240 | Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].bannedUUID); | 240 | Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].BannedUserID); |
241 | 241 | ||
242 | Assert.AreEqual(DataTestUtil.UUID_MAX, loadedSettings.EstateBans[1].bannedUUID); | 242 | Assert.AreEqual(DataTestUtil.UUID_MAX, loadedSettings.EstateBans[1].BannedUserID); |
243 | 243 | ||
244 | } | 244 | } |
245 | 245 | ||