diff options
Diffstat (limited to 'OpenSim/Data/NHibernate')
-rw-r--r-- | OpenSim/Data/NHibernate/LLUUIDUserType.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateAssetData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateInventoryData.cs | 30 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateUserData.cs | 42 |
4 files changed, 43 insertions, 43 deletions
diff --git a/OpenSim/Data/NHibernate/LLUUIDUserType.cs b/OpenSim/Data/NHibernate/LLUUIDUserType.cs index e4f1dc2..0f10344 100644 --- a/OpenSim/Data/NHibernate/LLUUIDUserType.cs +++ b/OpenSim/Data/NHibernate/LLUUIDUserType.cs | |||
@@ -35,7 +35,7 @@ using NHibernate.UserTypes; | |||
35 | namespace OpenSim.Data.NHibernate | 35 | namespace OpenSim.Data.NHibernate |
36 | { | 36 | { |
37 | [Serializable] | 37 | [Serializable] |
38 | public class LLUUIDUserType: IUserType | 38 | public class LLUUIDUserType: IUserType |
39 | { | 39 | { |
40 | public object Assemble(object cached, object owner) | 40 | public object Assemble(object cached, object owner) |
41 | { | 41 | { |
@@ -69,7 +69,7 @@ namespace OpenSim.Data.NHibernate | |||
69 | 69 | ||
70 | public object NullSafeGet(IDataReader rs, string[] names, object owner) | 70 | public object NullSafeGet(IDataReader rs, string[] names, object owner) |
71 | { | 71 | { |
72 | object uuid = null; | 72 | object uuid = null; |
73 | 73 | ||
74 | int ord = rs.GetOrdinal(names[0]); | 74 | int ord = rs.GetOrdinal(names[0]); |
75 | if (!rs.IsDBNull(ord)) | 75 | if (!rs.IsDBNull(ord)) |
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index 4eb9eef..075f2e9 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs | |||
@@ -65,20 +65,20 @@ namespace OpenSim.Data.NHibernate | |||
65 | // TODO: make this a real exception type | 65 | // TODO: make this a real exception type |
66 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); | 66 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); |
67 | } | 67 | } |
68 | 68 | ||
69 | // NHibernate setup | 69 | // NHibernate setup |
70 | cfg = new Configuration(); | 70 | cfg = new Configuration(); |
71 | cfg.SetProperty(Environment.ConnectionProvider, | 71 | cfg.SetProperty(Environment.ConnectionProvider, |
72 | "NHibernate.Connection.DriverConnectionProvider"); | 72 | "NHibernate.Connection.DriverConnectionProvider"); |
73 | cfg.SetProperty(Environment.Dialect, | 73 | cfg.SetProperty(Environment.Dialect, |
74 | "NHibernate.Dialect." + parts[0]); | 74 | "NHibernate.Dialect." + parts[0]); |
75 | cfg.SetProperty(Environment.ConnectionDriver, | 75 | cfg.SetProperty(Environment.ConnectionDriver, |
76 | "NHibernate.Driver." + parts[1]); | 76 | "NHibernate.Driver." + parts[1]); |
77 | cfg.SetProperty(Environment.ConnectionString, parts[2]); | 77 | cfg.SetProperty(Environment.ConnectionString, parts[2]); |
78 | cfg.AddAssembly("OpenSim.Data.NHibernate"); | 78 | cfg.AddAssembly("OpenSim.Data.NHibernate"); |
79 | 79 | ||
80 | HbmSerializer.Default.Validate = true; | 80 | HbmSerializer.Default.Validate = true; |
81 | using ( MemoryStream stream = | 81 | using ( MemoryStream stream = |
82 | HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) | 82 | HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) |
83 | cfg.AddInputStream(stream); | 83 | cfg.AddInputStream(stream); |
84 | 84 | ||
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs index fa75588..228e0b6 100644 --- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs +++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs | |||
@@ -62,23 +62,23 @@ namespace OpenSim.Data.NHibernate | |||
62 | // TODO: make this a real exception type | 62 | // TODO: make this a real exception type |
63 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); | 63 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); |
64 | } | 64 | } |
65 | 65 | ||
66 | // Establish NHibernate Connection | 66 | // Establish NHibernate Connection |
67 | cfg = new Configuration(); | 67 | cfg = new Configuration(); |
68 | cfg.SetProperty(Environment.ConnectionProvider, | 68 | cfg.SetProperty(Environment.ConnectionProvider, |
69 | "NHibernate.Connection.DriverConnectionProvider"); | 69 | "NHibernate.Connection.DriverConnectionProvider"); |
70 | cfg.SetProperty(Environment.Dialect, | 70 | cfg.SetProperty(Environment.Dialect, |
71 | "NHibernate.Dialect." + parts[0]); | 71 | "NHibernate.Dialect." + parts[0]); |
72 | cfg.SetProperty(Environment.ConnectionDriver, | 72 | cfg.SetProperty(Environment.ConnectionDriver, |
73 | "NHibernate.Driver." + parts[1]); | 73 | "NHibernate.Driver." + parts[1]); |
74 | cfg.SetProperty(Environment.ConnectionString, parts[2]); | 74 | cfg.SetProperty(Environment.ConnectionString, parts[2]); |
75 | cfg.AddAssembly("OpenSim.Data.NHibernate"); | 75 | cfg.AddAssembly("OpenSim.Data.NHibernate"); |
76 | 76 | ||
77 | HbmSerializer.Default.Validate = true; | 77 | HbmSerializer.Default.Validate = true; |
78 | using ( MemoryStream stream = | 78 | using ( MemoryStream stream = |
79 | HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) | 79 | HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) |
80 | cfg.AddInputStream(stream); | 80 | cfg.AddInputStream(stream); |
81 | 81 | ||
82 | // If uncommented this will auto create tables, but it | 82 | // If uncommented this will auto create tables, but it |
83 | // does drops of the old tables, so we need a smarter way | 83 | // does drops of the old tables, so we need a smarter way |
84 | // to acturally manage this. | 84 | // to acturally manage this. |
@@ -120,8 +120,8 @@ namespace OpenSim.Data.NHibernate | |||
120 | 120 | ||
121 | /***************************************************************** | 121 | /***************************************************************** |
122 | * | 122 | * |
123 | * Basic CRUD operations on Data | 123 | * Basic CRUD operations on Data |
124 | * | 124 | * |
125 | ****************************************************************/ | 125 | ****************************************************************/ |
126 | 126 | ||
127 | // READ | 127 | // READ |
@@ -195,7 +195,7 @@ namespace OpenSim.Data.NHibernate | |||
195 | } | 195 | } |
196 | 196 | ||
197 | /// <summary> | 197 | /// <summary> |
198 | /// | 198 | /// |
199 | /// </summary> | 199 | /// </summary> |
200 | /// <param name="item"></param> | 200 | /// <param name="item"></param> |
201 | public void deleteInventoryItem(LLUUID itemID) | 201 | public void deleteInventoryItem(LLUUID itemID) |
@@ -279,7 +279,7 @@ namespace OpenSim.Data.NHibernate | |||
279 | } | 279 | } |
280 | 280 | ||
281 | /// <summary> | 281 | /// <summary> |
282 | /// | 282 | /// |
283 | /// </summary> | 283 | /// </summary> |
284 | /// <param name="folder"></param> | 284 | /// <param name="folder"></param> |
285 | public void deleteInventoryFolder(LLUUID folderID) | 285 | public void deleteInventoryFolder(LLUUID folderID) |
@@ -353,7 +353,7 @@ namespace OpenSim.Data.NHibernate | |||
353 | { | 353 | { |
354 | updateInventoryItem(item); | 354 | updateInventoryItem(item); |
355 | } | 355 | } |
356 | 356 | ||
357 | 357 | ||
358 | 358 | ||
359 | /// <summary> | 359 | /// <summary> |
@@ -403,9 +403,9 @@ namespace OpenSim.Data.NHibernate | |||
403 | return null; | 403 | return null; |
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | /// <summary> | 407 | /// <summary> |
408 | /// Append a list of all the child folders of a parent folder | 408 | /// Append a list of all the child folders of a parent folder |
409 | /// </summary> | 409 | /// </summary> |
410 | /// <param name="folders">list where folders will be appended</param> | 410 | /// <param name="folders">list where folders will be appended</param> |
411 | /// <param name="parentID">ID of parent</param> | 411 | /// <param name="parentID">ID of parent</param> |
@@ -413,7 +413,7 @@ namespace OpenSim.Data.NHibernate | |||
413 | { | 413 | { |
414 | using (ISession session = factory.OpenSession()) | 414 | using (ISession session = factory.OpenSession()) |
415 | { | 415 | { |
416 | 416 | ||
417 | ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); | 417 | ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); |
418 | criteria.Add(Expression.Eq("ParentID", parentID)); | 418 | criteria.Add(Expression.Eq("ParentID", parentID)); |
419 | foreach (InventoryFolderBase item in criteria.List()) | 419 | foreach (InventoryFolderBase item in criteria.List()) |
@@ -443,7 +443,7 @@ namespace OpenSim.Data.NHibernate | |||
443 | 443 | ||
444 | for (int i = 0; i < folders.Count; i++) | 444 | for (int i = 0; i < folders.Count; i++) |
445 | getInventoryFolders(ref folders, folders[i].ID); | 445 | getInventoryFolders(ref folders, folders[i].ID); |
446 | 446 | ||
447 | return folders; | 447 | return folders; |
448 | } | 448 | } |
449 | } | 449 | } |
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 6ba2783..4de0291 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs | |||
@@ -64,20 +64,20 @@ namespace OpenSim.Data.NHibernate | |||
64 | 64 | ||
65 | // This is stubbing for now, it will become dynamic later and support different db backends | 65 | // This is stubbing for now, it will become dynamic later and support different db backends |
66 | cfg = new Configuration(); | 66 | cfg = new Configuration(); |
67 | cfg.SetProperty(Environment.ConnectionProvider, | 67 | cfg.SetProperty(Environment.ConnectionProvider, |
68 | "NHibernate.Connection.DriverConnectionProvider"); | 68 | "NHibernate.Connection.DriverConnectionProvider"); |
69 | cfg.SetProperty(Environment.Dialect, | 69 | cfg.SetProperty(Environment.Dialect, |
70 | "NHibernate.Dialect." + parts[0]); | 70 | "NHibernate.Dialect." + parts[0]); |
71 | cfg.SetProperty(Environment.ConnectionDriver, | 71 | cfg.SetProperty(Environment.ConnectionDriver, |
72 | "NHibernate.Driver." + parts[1]); | 72 | "NHibernate.Driver." + parts[1]); |
73 | cfg.SetProperty(Environment.ConnectionString, parts[2]); | 73 | cfg.SetProperty(Environment.ConnectionString, parts[2]); |
74 | cfg.AddAssembly("OpenSim.Data.NHibernate"); | 74 | cfg.AddAssembly("OpenSim.Data.NHibernate"); |
75 | 75 | ||
76 | HbmSerializer.Default.Validate = true; | 76 | HbmSerializer.Default.Validate = true; |
77 | using ( MemoryStream stream = | 77 | using ( MemoryStream stream = |
78 | HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) | 78 | HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) |
79 | cfg.AddInputStream(stream); | 79 | cfg.AddInputStream(stream); |
80 | 80 | ||
81 | // new SchemaExport(cfg).Create(true, true); | 81 | // new SchemaExport(cfg).Create(true, true); |
82 | 82 | ||
83 | factory = cfg.BuildSessionFactory(); | 83 | factory = cfg.BuildSessionFactory(); |
@@ -122,7 +122,7 @@ namespace OpenSim.Data.NHibernate | |||
122 | // BUG: CATCHALL IS BAD. | 122 | // BUG: CATCHALL IS BAD. |
123 | } | 123 | } |
124 | catch (Exception) {} | 124 | catch (Exception) {} |
125 | 125 | ||
126 | return (user != null); | 126 | return (user != null); |
127 | } | 127 | } |
128 | 128 | ||
@@ -151,7 +151,7 @@ namespace OpenSim.Data.NHibernate | |||
151 | // TODO: save agent | 151 | // TODO: save agent |
152 | transaction.Commit(); | 152 | transaction.Commit(); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | } | 155 | } |
156 | else | 156 | else |
157 | { | 157 | { |
@@ -162,7 +162,7 @@ namespace OpenSim.Data.NHibernate | |||
162 | 162 | ||
163 | private static void SetAgentData(LLUUID uuid, UserAgentData agent, ISession session) | 163 | private static void SetAgentData(LLUUID uuid, UserAgentData agent, ISession session) |
164 | { | 164 | { |
165 | if (agent == null) | 165 | if (agent == null) |
166 | { | 166 | { |
167 | // TODO: got to figure out how to do a delete right | 167 | // TODO: got to figure out how to do a delete right |
168 | } | 168 | } |
@@ -178,7 +178,7 @@ namespace OpenSim.Data.NHibernate | |||
178 | session.Update(agent); | 178 | session.Update(agent); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | } | 182 | } |
183 | override public bool UpdateUserProfile(UserProfileData profile) | 183 | override public bool UpdateUserProfile(UserProfileData profile) |
184 | { | 184 | { |
@@ -193,7 +193,7 @@ namespace OpenSim.Data.NHibernate | |||
193 | transaction.Commit(); | 193 | transaction.Commit(); |
194 | return true; | 194 | return true; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | } | 197 | } |
198 | else | 198 | else |
199 | { | 199 | { |
@@ -202,7 +202,7 @@ namespace OpenSim.Data.NHibernate | |||
202 | return true; | 202 | return true; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | override public void AddNewUserAgent(UserAgentData agent) | 206 | override public void AddNewUserAgent(UserAgentData agent) |
207 | { | 207 | { |
208 | using (ISession session = factory.OpenSession()) | 208 | using (ISession session = factory.OpenSession()) |
@@ -212,9 +212,9 @@ namespace OpenSim.Data.NHibernate | |||
212 | session.Save(agent); | 212 | session.Save(agent); |
213 | transaction.Commit(); | 213 | transaction.Commit(); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | public void UpdateUserAgent(UserAgentData agent) | 218 | public void UpdateUserAgent(UserAgentData agent) |
219 | { | 219 | { |
220 | using (ISession session = factory.OpenSession()) | 220 | using (ISession session = factory.OpenSession()) |
@@ -224,7 +224,7 @@ namespace OpenSim.Data.NHibernate | |||
224 | session.Update(agent); | 224 | session.Update(agent); |
225 | transaction.Commit(); | 225 | transaction.Commit(); |
226 | } | 226 | } |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
230 | override public UserAgentData GetAgentByUUID(LLUUID uuid) | 230 | override public UserAgentData GetAgentByUUID(LLUUID uuid) |
@@ -262,7 +262,7 @@ namespace OpenSim.Data.NHibernate | |||
262 | { | 262 | { |
263 | return GetUserByName(fname, lname).CurrentAgent; | 263 | return GetUserByName(fname, lname).CurrentAgent; |
264 | } | 264 | } |
265 | 265 | ||
266 | override public UserAgentData GetAgentByName(string name) | 266 | override public UserAgentData GetAgentByName(string name) |
267 | { | 267 | { |
268 | return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]); | 268 | return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]); |
@@ -273,7 +273,7 @@ namespace OpenSim.Data.NHibernate | |||
273 | List<AvatarPickerAvatar> results = new List<AvatarPickerAvatar>(); | 273 | List<AvatarPickerAvatar> results = new List<AvatarPickerAvatar>(); |
274 | string[] querysplit; | 274 | string[] querysplit; |
275 | querysplit = query.Split(' '); | 275 | querysplit = query.Split(' '); |
276 | 276 | ||
277 | if (querysplit.Length == 2) | 277 | if (querysplit.Length == 2) |
278 | { | 278 | { |
279 | using (ISession session = factory.OpenSession()) | 279 | using (ISession session = factory.OpenSession()) |
@@ -293,7 +293,7 @@ namespace OpenSim.Data.NHibernate | |||
293 | } | 293 | } |
294 | return results; | 294 | return results; |
295 | } | 295 | } |
296 | 296 | ||
297 | // TODO: actually implement these | 297 | // TODO: actually implement these |
298 | public override void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) {return;} | 298 | public override void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) {return;} |
299 | public override void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) {return;} | 299 | public override void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) {return;} |
@@ -306,7 +306,7 @@ namespace OpenSim.Data.NHibernate | |||
306 | 306 | ||
307 | /// Appearance | 307 | /// Appearance |
308 | /// TODO: stubs for now to get us to a compiling state gently | 308 | /// TODO: stubs for now to get us to a compiling state gently |
309 | public AvatarAppearance GetUserAppearance(LLUUID user) | 309 | public AvatarAppearance GetUserAppearance(LLUUID user) |
310 | { | 310 | { |
311 | AvatarAppearance appearance; | 311 | AvatarAppearance appearance; |
312 | // TODO: I'm sure I'll have to do something silly here | 312 | // TODO: I'm sure I'll have to do something silly here |
@@ -345,19 +345,19 @@ namespace OpenSim.Data.NHibernate | |||
345 | } | 345 | } |
346 | transaction.Commit(); | 346 | transaction.Commit(); |
347 | } | 347 | } |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | override public void AddAttachment(LLUUID user, LLUUID item) | 351 | override public void AddAttachment(LLUUID user, LLUUID item) |
352 | { | 352 | { |
353 | return; | 353 | return; |
354 | } | 354 | } |
355 | 355 | ||
356 | override public void RemoveAttachment(LLUUID user, LLUUID item) | 356 | override public void RemoveAttachment(LLUUID user, LLUUID item) |
357 | { | 357 | { |
358 | return; | 358 | return; |
359 | } | 359 | } |
360 | 360 | ||
361 | override public List<LLUUID> GetAttachments(LLUUID user) | 361 | override public List<LLUUID> GetAttachments(LLUUID user) |
362 | { | 362 | { |
363 | return new List<LLUUID>(); | 363 | return new List<LLUUID>(); |