aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-16 19:33:11 +0000
committerJustin Clarke Casey2009-02-16 19:33:11 +0000
commit80759f708b1766b6fd36bbdb6ce69f292e64e2f0 (patch)
tree2ca913692571127b1b9bc5327ddc937b8d0211ab
parentline ending fixes and set native eol property (diff)
downloadopensim-SC_OLD-80759f708b1766b6fd36bbdb6ce69f292e64e2f0.zip
opensim-SC_OLD-80759f708b1766b6fd36bbdb6ce69f292e64e2f0.tar.gz
opensim-SC_OLD-80759f708b1766b6fd36bbdb6ce69f292e64e2f0.tar.bz2
opensim-SC_OLD-80759f708b1766b6fd36bbdb6ce69f292e64e2f0.tar.xz
* Apply http://opensimulator.org/mantis/view.php?id=3166
* Adds estate access list supports to NHibernate data module * Thanks Tommil
-rw-r--r--OpenSim/Data/NHibernate/NHibernateAssetData.cs4
-rw-r--r--OpenSim/Data/NHibernate/NHibernateEstateData.cs8
-rw-r--r--OpenSim/Data/NHibernate/NHibernateGridData.cs8
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs8
-rw-r--r--OpenSim/Data/NHibernate/NHibernateManager.cs187
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs10
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs12
-rw-r--r--OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml18
-rw-r--r--OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql22
-rw-r--r--OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql22
-rw-r--r--OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql22
-rw-r--r--OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql21
12 files changed, 280 insertions, 62 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
index f8715cc..8f4877d 100644
--- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
@@ -59,12 +59,12 @@ namespace OpenSim.Data.NHibernate
59 59
60 override public AssetBase FetchAsset(UUID uuid) 60 override public AssetBase FetchAsset(UUID uuid)
61 { 61 {
62 return (AssetBase)manager.Load(typeof(AssetBase), uuid); 62 return (AssetBase)manager.Get(typeof(AssetBase), uuid);
63 } 63 }
64 64
65 private void Save(AssetBase asset) 65 private void Save(AssetBase asset)
66 { 66 {
67 AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.Metadata.FullID); 67 AssetBase temp = (AssetBase)manager.Get(typeof(AssetBase), asset.Metadata.FullID);
68 if (temp == null) 68 if (temp == null)
69 { 69 {
70 manager.Insert(asset); 70 manager.Insert(asset);
diff --git a/OpenSim/Data/NHibernate/NHibernateEstateData.cs b/OpenSim/Data/NHibernate/NHibernateEstateData.cs
index 3d74135..b16f6e1 100644
--- a/OpenSim/Data/NHibernate/NHibernateEstateData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateEstateData.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Data.NHibernate
89 // Ensure that estate settings exist for the link 89 // Ensure that estate settings exist for the link
90 if (link != null) 90 if (link != null)
91 { 91 {
92 if (manager.Load(typeof(EstateSettings), link.EstateID) == null) 92 if (manager.GetWithStatefullSession(typeof(EstateSettings), link.EstateID) == null)
93 { 93 {
94 // Delete broken link 94 // Delete broken link
95 manager.Delete(link); 95 manager.Delete(link);
@@ -116,11 +116,11 @@ namespace OpenSim.Data.NHibernate
116 link.EstateRegionLinkID = UUID.Random(); 116 link.EstateRegionLinkID = UUID.Random();
117 link.RegionID = regionID; 117 link.RegionID = regionID;
118 link.EstateID = estateID; 118 link.EstateID = estateID;
119 manager.Insert(link); 119 manager.InsertWithStatefullSession(link);
120 } 120 }
121 121
122 // Load estate settings according to the existing or created link. 122 // Load estate settings according to the existing or created link.
123 return (EstateSettings)manager.Load(typeof(EstateSettings), link.EstateID); 123 return (EstateSettings)manager.GetWithStatefullSession(typeof(EstateSettings), link.EstateID);
124 } 124 }
125 125
126 public void StoreEstateSettings(EstateSettings estateSettings) 126 public void StoreEstateSettings(EstateSettings estateSettings)
@@ -128,7 +128,7 @@ namespace OpenSim.Data.NHibernate
128 // Estates are always updated when stored. 128 // Estates are always updated when stored.
129 // Insert is always done via. load method as with the current API 129 // Insert is always done via. load method as with the current API
130 // this is explicitly the only way to create region link. 130 // this is explicitly the only way to create region link.
131 manager.Update(estateSettings); 131 manager.UpdateWithStatefullSession(estateSettings);
132 } 132 }
133 133
134 #endregion 134 #endregion
diff --git a/OpenSim/Data/NHibernate/NHibernateGridData.cs b/OpenSim/Data/NHibernate/NHibernateGridData.cs
index e58d1ed..b89cefc 100644
--- a/OpenSim/Data/NHibernate/NHibernateGridData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateGridData.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Data.NHibernate
111 111
112 public override DataResponse AddProfile(RegionProfileData profile) 112 public override DataResponse AddProfile(RegionProfileData profile)
113 { 113 {
114 if (manager.Load(typeof(RegionProfileData), profile.Uuid) == null) 114 if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null)
115 { 115 {
116 manager.Insert(profile); 116 manager.Insert(profile);
117 return DataResponse.RESPONSE_OK; 117 return DataResponse.RESPONSE_OK;
@@ -124,7 +124,7 @@ namespace OpenSim.Data.NHibernate
124 124
125 public override DataResponse UpdateProfile(RegionProfileData profile) 125 public override DataResponse UpdateProfile(RegionProfileData profile)
126 { 126 {
127 if (manager.Load(typeof(RegionProfileData), profile.Uuid) != null) 127 if (manager.Get(typeof(RegionProfileData), profile.Uuid) != null)
128 { 128 {
129 manager.Update(profile); 129 manager.Update(profile);
130 return DataResponse.RESPONSE_OK; 130 return DataResponse.RESPONSE_OK;
@@ -137,7 +137,7 @@ namespace OpenSim.Data.NHibernate
137 137
138 public override DataResponse DeleteProfile(string uuid) 138 public override DataResponse DeleteProfile(string uuid)
139 { 139 {
140 RegionProfileData regionProfileData = (RegionProfileData)manager.Load(typeof(RegionProfileData), new UUID(uuid)); 140 RegionProfileData regionProfileData = (RegionProfileData)manager.Get(typeof(RegionProfileData), new UUID(uuid));
141 if (regionProfileData != null) 141 if (regionProfileData != null)
142 { 142 {
143 manager.Delete(regionProfileData); 143 manager.Delete(regionProfileData);
@@ -148,7 +148,7 @@ namespace OpenSim.Data.NHibernate
148 148
149 public override RegionProfileData GetProfileByUUID(UUID UUID) 149 public override RegionProfileData GetProfileByUUID(UUID UUID)
150 { 150 {
151 return (RegionProfileData)manager.Load(typeof(RegionProfileData), UUID); 151 return (RegionProfileData)manager.Get(typeof(RegionProfileData), UUID);
152 } 152 }
153 153
154 public override RegionProfileData GetProfileByHandle(ulong regionHandle) 154 public override RegionProfileData GetProfileByHandle(ulong regionHandle)
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index 7657ae5..3e04417 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Data.NHibernate
110 try 110 try
111 { 111 {
112 m_log.InfoFormat("[NHIBERNATE] getInventoryItem {0}", item); 112 m_log.InfoFormat("[NHIBERNATE] getInventoryItem {0}", item);
113 return (InventoryItemBase)manager.Load(typeof(InventoryItemBase), item); 113 return (InventoryItemBase)manager.Get(typeof(InventoryItemBase), item);
114 } 114 }
115 catch 115 catch
116 { 116 {
@@ -158,7 +158,7 @@ namespace OpenSim.Data.NHibernate
158 /// <param name="item"></param> 158 /// <param name="item"></param>
159 public void deleteInventoryItem(UUID itemID) 159 public void deleteInventoryItem(UUID itemID)
160 { 160 {
161 InventoryItemBase item = (InventoryItemBase)manager.Load(typeof(InventoryItemBase), itemID); 161 InventoryItemBase item = (InventoryItemBase)manager.Get(typeof(InventoryItemBase), itemID);
162 if (item != null) 162 if (item != null)
163 { 163 {
164 manager.Delete(item); 164 manager.Delete(item);
@@ -179,7 +179,7 @@ namespace OpenSim.Data.NHibernate
179 { 179 {
180 try 180 try
181 { 181 {
182 return (InventoryFolderBase)manager.Load(typeof(InventoryFolderBase), folder); 182 return (InventoryFolderBase)manager.Get(typeof(InventoryFolderBase), folder);
183 } 183 }
184 catch 184 catch
185 { 185 {
@@ -227,7 +227,7 @@ namespace OpenSim.Data.NHibernate
227 /// <param name="folder"></param> 227 /// <param name="folder"></param>
228 public void deleteInventoryFolder(UUID folderID) 228 public void deleteInventoryFolder(UUID folderID)
229 { 229 {
230 InventoryFolderBase item = (InventoryFolderBase)manager.Load(typeof(InventoryFolderBase), folderID); 230 InventoryFolderBase item = (InventoryFolderBase)manager.Get(typeof(InventoryFolderBase), folderID);
231 if (item != null) 231 if (item != null)
232 { 232 {
233 manager.Delete(item); 233 manager.Delete(item);
diff --git a/OpenSim/Data/NHibernate/NHibernateManager.cs b/OpenSim/Data/NHibernate/NHibernateManager.cs
index 26bc219..cef98f2 100644
--- a/OpenSim/Data/NHibernate/NHibernateManager.cs
+++ b/OpenSim/Data/NHibernate/NHibernateManager.cs
@@ -45,6 +45,43 @@ namespace OpenSim.Data.NHibernate
45 private Configuration configuration; 45 private Configuration configuration;
46 private ISessionFactory sessionFactory; 46 private ISessionFactory sessionFactory;
47 47
48 #region Initialization
49
50 /// <summary>
51 /// Initiate NHibernate Manager
52 /// </summary>
53 /// <param name="connect">NHibernate dialect, driver and connection string separated by ';'</param>
54 /// <param name="store">Name of the store</param>
55 public NHibernateManager(string connect, string store)
56 {
57 ParseConnectionString(connect);
58
59 //To create sql file uncomment code below and write the name of the file
60 //SchemaExport exp = new SchemaExport(cfg);
61 //exp.SetOutputFile("nameofthefile.sql");
62 //exp.Create(false, true);
63
64 Assembly assembly = GetType().Assembly;
65
66 sessionFactory = configuration.BuildSessionFactory();
67 RunMigration(dialect, assembly, store);
68 }
69
70 /// <summary>
71 /// Initiate NHibernate Manager with spesific assembly
72 /// </summary>
73 /// <param name="connect">NHibernate dialect, driver and connection string separated by ';'</param>
74 /// <param name="store">Name of the store</param>
75 /// <param name="assembly">Outside assembly to be included </param>
76 public NHibernateManager(string connect, string store, Assembly assembly)
77 {
78 ParseConnectionString(connect);
79
80 configuration.AddAssembly(assembly);
81 sessionFactory = configuration.BuildSessionFactory();
82 RunMigration(dialect, assembly, store);
83 }
84
48 /// <summary> 85 /// <summary>
49 /// Parses the connection string and creates the NHibernate configuration 86 /// Parses the connection string and creates the NHibernate configuration
50 /// </summary> 87 /// </summary>
@@ -72,7 +109,6 @@ namespace OpenSim.Data.NHibernate
72 "NHibernate.Driver." + parts[1]); 109 "NHibernate.Driver." + parts[1]);
73 configuration.SetProperty(Environment.ConnectionString, parts[2]); 110 configuration.SetProperty(Environment.ConnectionString, parts[2]);
74 configuration.AddAssembly("OpenSim.Data.NHibernate"); 111 configuration.AddAssembly("OpenSim.Data.NHibernate");
75
76 } 112 }
77 113
78 /// <summary> 114 /// <summary>
@@ -96,44 +132,42 @@ namespace OpenSim.Data.NHibernate
96 migration.Update(); 132 migration.Update();
97 } 133 }
98 134
135 #endregion
136
99 /// <summary> 137 /// <summary>
100 /// Initiate NHibernate Manager 138 /// Gets object of given type from database with given id.
139 /// Uses stateless session for efficiency.
101 /// </summary> 140 /// </summary>
102 /// <param name="connect">NHibernate dialect, driver and connection string separated by ';'</param> 141 /// <param name="type">Type of the object.</param>
103 /// <param name="store">Name of the store</param> 142 /// <param name="id">Id of the object.</param>
104 public NHibernateManager(string connect, string store) 143 /// <returns>The object or null if object was not found.</returns>
144 public object Get(Type type, Object id)
105 { 145 {
106 ParseConnectionString(connect); 146 using (IStatelessSession session = sessionFactory.OpenStatelessSession())
107 147 {
108 //To create sql file uncomment code below and write the name of the file 148 object obj = null;
109 //SchemaExport exp = new SchemaExport(cfg); 149 try
110 //exp.SetOutputFile("nameofthefile.sql"); 150 {
111 //exp.Create(false, true); 151 obj = session.Get(type.FullName, id);
112 152 }
113 Assembly assembly = GetType().Assembly; 153 catch (Exception e)
114 154 {
115 sessionFactory = configuration.BuildSessionFactory(); 155 m_log.ErrorFormat("[NHIBERNATE] {0} of id {1} loading threw exception: " + e.ToString(), type.Name, id);
116 RunMigration(dialect, assembly, store); 156 }
157 return obj;
158 }
117 } 159 }
118 160
119 /// <summary> 161 /// <summary>
120 /// Initiate NHibernate Manager with spesific assembly 162 /// Gets object of given type from database with given id.
163 /// Use this method for objects containing collections. For flat objects stateless mode is more efficient.
121 /// </summary> 164 /// </summary>
122 /// <param name="connect">NHibernate dialect, driver and connection string separated by ';'</param> 165 /// <param name="type">Type of the object.</param>
123 /// <param name="store">Name of the store</param> 166 /// <param name="id">Id of the object.</param>
124 /// <param name="assembly">Outside assembly to be included </param> 167 /// <returns>The object or null if object was not found.</returns>
125 public NHibernateManager(string connect, string store, Assembly assembly) 168 public object GetWithStatefullSession(Type type, Object id)
126 { 169 {
127 ParseConnectionString(connect); 170 using (ISession session = sessionFactory.OpenSession())
128
129 configuration.AddAssembly(assembly);
130 sessionFactory = configuration.BuildSessionFactory();
131 RunMigration(dialect, assembly, store);
132 }
133
134 public object Load(Type type, Object id)
135 {
136 using (IStatelessSession session = sessionFactory.OpenStatelessSession())
137 { 171 {
138 object obj = null; 172 object obj = null;
139 try 173 try
@@ -146,9 +180,15 @@ namespace OpenSim.Data.NHibernate
146 } 180 }
147 return obj; 181 return obj;
148 } 182 }
149 183
150 } 184 }
151 185
186 /// <summary>
187 /// Inserts given object to database.
188 /// Uses stateless session for efficiency.
189 /// </summary>
190 /// <param name="obj">Object to be insterted.</param>
191 /// <returns>Identifier of the object. Useful for situations when NHibernate generates the identifier.</returns>
152 public object Insert(object obj) 192 public object Insert(object obj)
153 { 193 {
154 try 194 try
@@ -170,6 +210,39 @@ namespace OpenSim.Data.NHibernate
170 } 210 }
171 } 211 }
172 212
213 /// <summary>
214 /// Inserts given object to database.
215 /// Use this method for objects containing collections. For flat objects stateless mode is more efficient.
216 /// </summary>
217 /// <param name="obj">Object to be insterted.</param>
218 /// <returns>Identifier of the object. Useful for situations when NHibernate generates the identifier.</returns>
219 public object InsertWithStatefullSession(object obj)
220 {
221 try
222 {
223 using (ISession session = sessionFactory.OpenSession())
224 {
225 using (ITransaction transaction = session.BeginTransaction())
226 {
227 Object identifier = session.Save(obj);
228 transaction.Commit();
229 return identifier;
230 }
231 }
232 }
233 catch (Exception e)
234 {
235 m_log.Error("[NHIBERNATE] issue inserting object ", e);
236 return null;
237 }
238 }
239
240 /// <summary>
241 /// Updates given object to database.
242 /// Uses stateless session for efficiency.
243 /// </summary>
244 /// <param name="obj">Object to be updated.</param>
245 /// <returns>True if operation was succesful.</returns>
173 public bool Update(object obj) 246 public bool Update(object obj)
174 { 247 {
175 try 248 try
@@ -191,6 +264,38 @@ namespace OpenSim.Data.NHibernate
191 } 264 }
192 } 265 }
193 266
267 /// <summary>
268 /// Updates given object to database.
269 /// Use this method for objects containing collections. For flat objects stateless mode is more efficient.
270 /// </summary>
271 /// <param name="obj">Object to be updated.</param>
272 /// <returns>True if operation was succesful.</returns>
273 public bool UpdateWithStatefullSession(object obj)
274 {
275 try
276 {
277 using (ISession session = sessionFactory.OpenSession())
278 {
279 using (ITransaction transaction = session.BeginTransaction())
280 {
281 session.Update(obj);
282 transaction.Commit();
283 return true;
284 }
285 }
286 }
287 catch (Exception e)
288 {
289 m_log.Error("[NHIBERNATE] issue updating object ", e);
290 return false;
291 }
292 }
293
294 /// <summary>
295 /// Deletes given object from database.
296 /// </summary>
297 /// <param name="obj">Object to be deleted.</param>
298 /// <returns>True if operation was succesful.</returns>
194 public bool Delete(object obj) 299 public bool Delete(object obj)
195 { 300 {
196 try 301 try
@@ -212,6 +317,18 @@ namespace OpenSim.Data.NHibernate
212 } 317 }
213 } 318 }
214 319
320 /// <summary>
321 /// Returns statefull session which can be used to execute custom nhibernate or sql queries.
322 /// </summary>
323 /// <returns>Statefull session</returns>
324 public ISession GetSession()
325 {
326 return sessionFactory.OpenSession();
327 }
328
329 /// <summary>
330 /// Drops the database schema. This exist for unit tests. It should not be invoked from other than test teardown.
331 /// </summary>
215 public void DropSchema() 332 public void DropSchema()
216 { 333 {
217 SchemaExport export = new SchemaExport(this.configuration); 334 SchemaExport export = new SchemaExport(this.configuration);
@@ -219,14 +336,10 @@ namespace OpenSim.Data.NHibernate
219 336
220 using (ISession session = sessionFactory.OpenSession()) 337 using (ISession session = sessionFactory.OpenSession())
221 { 338 {
222 ISQLQuery sqlQuery=session.CreateSQLQuery("drop table migrations"); 339 ISQLQuery sqlQuery = session.CreateSQLQuery("drop table migrations");
223 sqlQuery.ExecuteUpdate(); 340 sqlQuery.ExecuteUpdate();
224 } 341 }
225 } 342 }
226 343
227 public ISession GetSession()
228 {
229 return sessionFactory.OpenSession();
230 }
231 } 344 }
232} 345}
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 78db52d..5af3d1a 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Data.NHibernate
63 63
64 public void StoreRegionSettings(RegionSettings rs) 64 public void StoreRegionSettings(RegionSettings rs)
65 { 65 {
66 RegionSettings oldRegionSettings = (RegionSettings)manager.Load(typeof(RegionSettings), rs.RegionUUID); 66 RegionSettings oldRegionSettings = (RegionSettings)manager.Get(typeof(RegionSettings), rs.RegionUUID);
67 if (oldRegionSettings != null) 67 if (oldRegionSettings != null)
68 { 68 {
69 manager.Update(rs); 69 manager.Update(rs);
@@ -76,7 +76,7 @@ namespace OpenSim.Data.NHibernate
76 76
77 public RegionSettings LoadRegionSettings(UUID regionUUID) 77 public RegionSettings LoadRegionSettings(UUID regionUUID)
78 { 78 {
79 RegionSettings regionSettings = (RegionSettings) manager.Load(typeof(RegionSettings), regionUUID); 79 RegionSettings regionSettings = (RegionSettings) manager.Get(typeof(RegionSettings), regionUUID);
80 80
81 if (regionSettings == null) 81 if (regionSettings == null)
82 { 82 {
@@ -96,7 +96,7 @@ namespace OpenSim.Data.NHibernate
96 { 96 {
97 try 97 try
98 { 98 {
99 SceneObjectPart old = (SceneObjectPart)manager.Load(typeof(SceneObjectPart), p.UUID); 99 SceneObjectPart old = (SceneObjectPart)manager.Get(typeof(SceneObjectPart), p.UUID);
100 if (old != null) 100 if (old != null)
101 { 101 {
102 m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID); 102 m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID);
@@ -120,7 +120,7 @@ namespace OpenSim.Data.NHibernate
120 try 120 try
121 { 121 {
122 122
123 Terrain old = (Terrain)manager.Load(typeof(Terrain), t.RegionID); 123 Terrain old = (Terrain)manager.Get(typeof(Terrain), t.RegionID);
124 if (old != null) 124 if (old != null)
125 { 125 {
126 m_log.InfoFormat("[NHIBERNATE] updating terrain {0}", t.RegionID); 126 m_log.InfoFormat("[NHIBERNATE] updating terrain {0}", t.RegionID);
@@ -279,7 +279,7 @@ namespace OpenSim.Data.NHibernate
279 /// <returns>Heightfield data</returns> 279 /// <returns>Heightfield data</returns>
280 public double[,] LoadTerrain(UUID regionID) 280 public double[,] LoadTerrain(UUID regionID)
281 { 281 {
282 Terrain t = (Terrain)manager.Load(typeof(Terrain), regionID); 282 Terrain t = (Terrain)manager.Get(typeof(Terrain), regionID);
283 if (t != null) 283 if (t != null)
284 { 284 {
285 return t.Doubles; 285 return t.Doubles;
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index 3f1f260..8aa4aa2 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Data.NHibernate
61 UserProfileData user = null; 61 UserProfileData user = null;
62 62
63 m_log.InfoFormat("[NHIBERNATE] ExistsUser; {0}", uuid); 63 m_log.InfoFormat("[NHIBERNATE] ExistsUser; {0}", uuid);
64 user = (UserProfileData)manager.Load(typeof(UserProfileData), uuid); 64 user = (UserProfileData)manager.Get(typeof(UserProfileData), uuid);
65 65
66 if (user == null) 66 if (user == null)
67 { 67 {
@@ -78,7 +78,7 @@ namespace OpenSim.Data.NHibernate
78 UserProfileData user; 78 UserProfileData user;
79 m_log.InfoFormat("[NHIBERNATE] GetUserByUUID: {0} ", uuid); 79 m_log.InfoFormat("[NHIBERNATE] GetUserByUUID: {0} ", uuid);
80 80
81 user = (UserProfileData)manager.Load(typeof(UserProfileData), uuid); 81 user = (UserProfileData)manager.Get(typeof(UserProfileData), uuid);
82 if (user != null) 82 if (user != null)
83 { 83 {
84 UserAgentData agent = GetAgentByUUID(uuid); 84 UserAgentData agent = GetAgentByUUID(uuid);
@@ -163,7 +163,7 @@ namespace OpenSim.Data.NHibernate
163 } 163 }
164 164
165 165
166 UserAgentData old = (UserAgentData)manager.Load(typeof(UserAgentData), agent.ProfileID); 166 UserAgentData old = (UserAgentData)manager.Get(typeof(UserAgentData), agent.ProfileID);
167 if (old != null) 167 if (old != null)
168 { 168 {
169 manager.Delete(old); 169 manager.Delete(old);
@@ -182,7 +182,7 @@ namespace OpenSim.Data.NHibernate
182 override public UserAgentData GetAgentByUUID(UUID uuid) 182 override public UserAgentData GetAgentByUUID(UUID uuid)
183 { 183 {
184 m_log.InfoFormat("[NHIBERNATE] GetAgentByUUID: {0} ", uuid); 184 m_log.InfoFormat("[NHIBERNATE] GetAgentByUUID: {0} ", uuid);
185 return (UserAgentData)manager.Load(typeof(UserAgentData), uuid); 185 return (UserAgentData)manager.Get(typeof(UserAgentData), uuid);
186 } 186 }
187 187
188 override public UserProfileData GetUserByName(string fname, string lname) 188 override public UserProfileData GetUserByName(string fname, string lname)
@@ -397,12 +397,12 @@ namespace OpenSim.Data.NHibernate
397 /// TODO: stubs for now to get us to a compiling state gently 397 /// TODO: stubs for now to get us to a compiling state gently
398 public override AvatarAppearance GetUserAppearance(UUID user) 398 public override AvatarAppearance GetUserAppearance(UUID user)
399 { 399 {
400 return (AvatarAppearance)manager.Load(typeof(AvatarAppearance), user); 400 return (AvatarAppearance)manager.Get(typeof(AvatarAppearance), user);
401 } 401 }
402 402
403 private bool ExistsAppearance(UUID uuid) 403 private bool ExistsAppearance(UUID uuid)
404 { 404 {
405 AvatarAppearance appearance = (AvatarAppearance)manager.Load(typeof(AvatarAppearance), uuid); 405 AvatarAppearance appearance = (AvatarAppearance)manager.Get(typeof(AvatarAppearance), uuid);
406 if (appearance == null) 406 if (appearance == null)
407 { 407 {
408 return false; 408 return false;
diff --git a/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml
index 2dc3949..d8c8975 100644
--- a/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml
@@ -35,5 +35,23 @@
35 35
36 <property name="AbuseEmail" type="String" length="255" /> 36 <property name="AbuseEmail" type="String" length="255" />
37 37
38 <array name="EstateManagers" table="EstateManagers" cascade="all">
39 <key column="EstateID" />
40 <index column="ArrayIndex" />
41 <element column="ManagerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
42 </array>
43
44 <array name="EstateAccess" table="EstateUsers" cascade="all">
45 <key column="EstateID" />
46 <index column="ArrayIndex" />
47 <element column="UserID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
48 </array>
49
50 <array name="EstateGroups" table="EstateGroups" cascade="all">
51 <key column="EstateID" />
52 <index column="ArrayIndex" />
53 <element column="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
54 </array>
55
38 </class> 56 </class>
39</hibernate-mapping> 57</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql
index 4ca51be..b852cbc 100644
--- a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql
@@ -38,3 +38,25 @@ CREATE TABLE EstateRegionLink (
38 38
39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); 39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
40CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); 40CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID);
41
42
43CREATE TABLE EstateManagers (
44 EstateID INT NOT NULL,
45 ManagerID NVARCHAR(36) NOT NULL,
46 ArrayIndex INT NOT NULL,
47 PRIMARY KEY (EstateID,ArrayIndex)
48);
49
50CREATE TABLE EstateUsers (
51 EstateID INT NOT NULL,
52 UserID NVARCHAR(36) NOT NULL,
53 ArrayIndex INT NOT NULL,
54 PRIMARY KEY (EstateID,ArrayIndex)
55);
56
57CREATE TABLE EstateGroups (
58 EstateID INT NOT NULL,
59 GroupID NVARCHAR(36) NOT NULL,
60 ArrayIndex INT NOT NULL,
61 PRIMARY KEY (EstateID,ArrayIndex)
62); \ 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 2114186..69635d8 100644
--- a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql
@@ -38,3 +38,25 @@ CREATE TABLE EstateRegionLink (
38 38
39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); 39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
40CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); 40CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID);
41
42CREATE TABLE EstateManagers (
43 EstateID INT NOT NULL,
44 ManagerID VARCHAR(36) NOT NULL,
45 ArrayIndex INT NOT NULL,
46 PRIMARY KEY (EstateID,ArrayIndex)
47) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
48
49CREATE TABLE EstateUsers (
50 EstateID INT NOT NULL,
51 UserID VARCHAR(36) NOT NULL,
52 ArrayIndex INT NOT NULL,
53 PRIMARY KEY (EstateID,ArrayIndex)
54) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
55
56CREATE TABLE EstateGroups (
57 EstateID INT NOT NULL,
58 GroupID VARCHAR(36) NOT NULL,
59 ArrayIndex INT NOT NULL,
60 PRIMARY KEY (EstateID,ArrayIndex)
61) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
62
diff --git a/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql
index e43fd86..d13a4d3 100644
--- a/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql
@@ -38,3 +38,25 @@ CREATE TABLE EstateRegionLink (
38 38
39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); 39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
40CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); 40CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID);
41
42
43CREATE TABLE EstateManagers (
44 EstateID INT NOT NULL,
45 ManagerID VARCHAR(36) NOT NULL,
46 ArrayIndex INT NOT NULL,
47 PRIMARY KEY (EstateID,ArrayIndex)
48);
49
50CREATE TABLE EstateUsers (
51 EstateID INT NOT NULL,
52 UserID VARCHAR(36) NOT NULL,
53 ArrayIndex INT NOT NULL,
54 PRIMARY KEY (EstateID,ArrayIndex)
55);
56
57CREATE TABLE EstateGroups (
58 EstateID INT NOT NULL,
59 GroupID VARCHAR(36) NOT NULL,
60 ArrayIndex INT NOT NULL,
61 PRIMARY KEY (EstateID,ArrayIndex)
62); \ 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 b540bc6..6e67630 100644
--- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql
@@ -38,3 +38,24 @@ CREATE TABLE EstateRegionLink (
38 38
39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); 39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
40CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); 40CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID);
41
42CREATE TABLE EstateManagers (
43 EstateID INT NOT NULL,
44 ManagerID VARCHAR(36) NOT NULL,
45 ArrayIndex INT NOT NULL,
46 PRIMARY KEY (EstateID,ArrayIndex)
47);
48
49CREATE TABLE EstateUsers (
50 EstateID INT NOT NULL,
51 UserID VARCHAR(36) NOT NULL,
52 ArrayIndex INT NOT NULL,
53 PRIMARY KEY (EstateID,ArrayIndex)
54);
55
56CREATE TABLE EstateGroups (
57 EstateID INT NOT NULL,
58 GroupID VARCHAR(36) NOT NULL,
59 ArrayIndex INT NOT NULL,
60 PRIMARY KEY (EstateID,ArrayIndex)
61);