aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate
diff options
context:
space:
mode:
authorJeff Ames2008-08-18 00:39:10 +0000
committerJeff Ames2008-08-18 00:39:10 +0000
commit6ef9d4da901a346c232458317cca6268da888e2e (patch)
treedd1d935b10f34f261839da9f9879c02322e8ede7 /OpenSim/Data/NHibernate
parentUpdate svn properties, minor formatting cleanup. (diff)
downloadopensim-SC_OLD-6ef9d4da901a346c232458317cca6268da888e2e.zip
opensim-SC_OLD-6ef9d4da901a346c232458317cca6268da888e2e.tar.gz
opensim-SC_OLD-6ef9d4da901a346c232458317cca6268da888e2e.tar.bz2
opensim-SC_OLD-6ef9d4da901a346c232458317cca6268da888e2e.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Data/NHibernate')
-rw-r--r--OpenSim/Data/NHibernate/LLQuaternionUserType.cs10
-rw-r--r--OpenSim/Data/NHibernate/LLVector3UserType.cs2
-rw-r--r--OpenSim/Data/NHibernate/NHibernateAssetData.cs6
-rw-r--r--OpenSim/Data/NHibernate/NHibernateManager.cs2
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs36
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs26
-rw-r--r--OpenSim/Data/NHibernate/Terrain.cs20
7 files changed, 51 insertions, 51 deletions
diff --git a/OpenSim/Data/NHibernate/LLQuaternionUserType.cs b/OpenSim/Data/NHibernate/LLQuaternionUserType.cs
index c4f3136..80fb9ff 100644
--- a/OpenSim/Data/NHibernate/LLQuaternionUserType.cs
+++ b/OpenSim/Data/NHibernate/LLQuaternionUserType.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Data.NHibernate
72 public object NullSafeGet(IDataReader rs, string[] names, object owner) 72 public object NullSafeGet(IDataReader rs, string[] names, object owner)
73 { 73 {
74 object quat = null; 74 object quat = null;
75 75
76 int x = rs.GetOrdinal(names[0]); 76 int x = rs.GetOrdinal(names[0]);
77 int y = rs.GetOrdinal(names[1]); 77 int y = rs.GetOrdinal(names[1]);
78 int z = rs.GetOrdinal(names[2]); 78 int z = rs.GetOrdinal(names[2]);
@@ -105,10 +105,10 @@ namespace OpenSim.Data.NHibernate
105 105
106 public SqlType[] SqlTypes 106 public SqlType[] SqlTypes
107 { 107 {
108 get { return new SqlType [] { 108 get { return new SqlType [] {
109 NHibernateUtil.Single.SqlType, 109 NHibernateUtil.Single.SqlType,
110 NHibernateUtil.Single.SqlType, 110 NHibernateUtil.Single.SqlType,
111 NHibernateUtil.Single.SqlType, 111 NHibernateUtil.Single.SqlType,
112 NHibernateUtil.Single.SqlType 112 NHibernateUtil.Single.SqlType
113 }; } 113 }; }
114 } 114 }
diff --git a/OpenSim/Data/NHibernate/LLVector3UserType.cs b/OpenSim/Data/NHibernate/LLVector3UserType.cs
index b040ca7d..d2df2c4 100644
--- a/OpenSim/Data/NHibernate/LLVector3UserType.cs
+++ b/OpenSim/Data/NHibernate/LLVector3UserType.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Data.NHibernate
70 public object NullSafeGet(IDataReader rs, string[] names, object owner) 70 public object NullSafeGet(IDataReader rs, string[] names, object owner)
71 { 71 {
72 object vector = null; 72 object vector = null;
73 73
74 int x = rs.GetOrdinal(names[0]); 74 int x = rs.GetOrdinal(names[0]);
75 int y = rs.GetOrdinal(names[1]); 75 int y = rs.GetOrdinal(names[1]);
76 int z = rs.GetOrdinal(names[2]); 76 int z = rs.GetOrdinal(names[2]);
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
index 2e9e897..400451f 100644
--- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Data.NHibernate
93 93
94 factory = cfg.BuildSessionFactory(); 94 factory = cfg.BuildSessionFactory();
95 session = factory.OpenSession(); 95 session = factory.OpenSession();
96 96
97 // This actually does the roll forward assembly stuff 97 // This actually does the roll forward assembly stuff
98 Assembly assem = GetType().Assembly; 98 Assembly assem = GetType().Assembly;
99 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore"); 99 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore");
@@ -111,7 +111,7 @@ namespace OpenSim.Data.NHibernate
111 { 111 {
112 m_log.ErrorFormat("[NHIBERNATE] no such asset {0}", uuid); 112 m_log.ErrorFormat("[NHIBERNATE] no such asset {0}", uuid);
113 return null; 113 return null;
114 } 114 }
115 catch (Exception e) 115 catch (Exception e)
116 { 116 {
117 m_log.Error("[NHIBERNATE] unexpected exception: ", e); 117 m_log.Error("[NHIBERNATE] unexpected exception: ", e);
@@ -121,7 +121,7 @@ namespace OpenSim.Data.NHibernate
121 121
122 private void Save(AssetBase asset) 122 private void Save(AssetBase asset)
123 { 123 {
124 try 124 try
125 { 125 {
126 // a is not used anywhere? 126 // a is not used anywhere?
127 // AssetBase a = session.Load(typeof(AssetBase), asset.FullID) as AssetBase; 127 // AssetBase a = session.Load(typeof(AssetBase), asset.FullID) as AssetBase;
diff --git a/OpenSim/Data/NHibernate/NHibernateManager.cs b/OpenSim/Data/NHibernate/NHibernateManager.cs
index 4c5ec01..161ec1d 100644
--- a/OpenSim/Data/NHibernate/NHibernateManager.cs
+++ b/OpenSim/Data/NHibernate/NHibernateManager.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Data.NHibernate
51// "NHibernate.Driver.SqliteClientDriver"; 51// "NHibernate.Driver.SqliteClientDriver";
52// cfg.Properties[NHibernate.Cfg.Environment.ConnectionString] = 52// cfg.Properties[NHibernate.Cfg.Environment.ConnectionString] =
53// "URI=file:opensim-nh.db,version=3"; 53// "URI=file:opensim-nh.db,version=3";
54 54
55// factory = cfg.BuildSessionFactory(); 55// factory = cfg.BuildSessionFactory();
56 } 56 }
57 57
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 52db32d..9682d87 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -89,10 +89,10 @@ namespace OpenSim.Data.NHibernate
89 using (MemoryStream stream = 89 using (MemoryStream stream =
90 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) 90 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
91 cfg.AddInputStream(stream); 91 cfg.AddInputStream(stream);
92 92
93 factory = cfg.BuildSessionFactory(); 93 factory = cfg.BuildSessionFactory();
94 session = factory.OpenSession(); 94 session = factory.OpenSession();
95 95
96 // This actually does the roll forward assembly stuff 96 // This actually does the roll forward assembly stuff
97 Assembly assem = GetType().Assembly; 97 Assembly assem = GetType().Assembly;
98 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "RegionStore"); 98 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "RegionStore");
@@ -113,7 +113,7 @@ namespace OpenSim.Data.NHibernate
113 { 113 {
114 return null; 114 return null;
115 } 115 }
116 116
117 // This looks inefficient, but it turns out that it isn't 117 // This looks inefficient, but it turns out that it isn't
118 // based on trial runs with nhibernate 1.2 118 // based on trial runs with nhibernate 1.2
119 private void SaveOrUpdate(SceneObjectPart p) 119 private void SaveOrUpdate(SceneObjectPart p)
@@ -164,7 +164,7 @@ namespace OpenSim.Data.NHibernate
164 /// <param name="regionUUID">the region UUID</param> 164 /// <param name="regionUUID">the region UUID</param>
165 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) 165 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
166 { 166 {
167 try 167 try
168 { 168 {
169 foreach (SceneObjectPart part in obj.Children.Values) 169 foreach (SceneObjectPart part in obj.Children.Values)
170 { 170 {
@@ -173,7 +173,7 @@ namespace OpenSim.Data.NHibernate
173 } 173 }
174 session.Flush(); 174 session.Flush();
175 } 175 }
176 catch (Exception e) 176 catch (Exception e)
177 { 177 {
178 m_log.Error("Can't save: ", e); 178 m_log.Error("Can't save: ", e);
179 } 179 }
@@ -196,7 +196,7 @@ namespace OpenSim.Data.NHibernate
196 group.AddPart(p); 196 group.AddPart(p);
197 group.RootPart = p; 197 group.RootPart = p;
198 } 198 }
199 else 199 else
200 { 200 {
201 group.AddPart(p); 201 group.AddPart(p);
202 } 202 }
@@ -232,7 +232,7 @@ namespace OpenSim.Data.NHibernate
232 { 232 {
233 Dictionary<LLUUID, SceneObjectGroup> SOG = new Dictionary<LLUUID, SceneObjectGroup>(); 233 Dictionary<LLUUID, SceneObjectGroup> SOG = new Dictionary<LLUUID, SceneObjectGroup>();
234 List<SceneObjectGroup> ret = new List<SceneObjectGroup>(); 234 List<SceneObjectGroup> ret = new List<SceneObjectGroup>();
235 235
236 ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart)); 236 ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart));
237 criteria.Add(Expression.Eq("RegionID", regionUUID)); 237 criteria.Add(Expression.Eq("RegionID", regionUUID));
238 criteria.AddOrder( Order.Asc("ParentID") ); 238 criteria.AddOrder( Order.Asc("ParentID") );
@@ -246,12 +246,12 @@ namespace OpenSim.Data.NHibernate
246 group.RootPart = p; 246 group.RootPart = p;
247 SOG.Add(p.ParentUUID, group); 247 SOG.Add(p.ParentUUID, group);
248 } 248 }
249 else 249 else
250 { 250 {
251 SOG[p.ParentUUID].AddPart(p); 251 SOG[p.ParentUUID].AddPart(p);
252 } 252 }
253 // get the inventory 253 // get the inventory
254 254
255 ICriteria InvCriteria = session.CreateCriteria(typeof(TaskInventoryItem)); 255 ICriteria InvCriteria = session.CreateCriteria(typeof(TaskInventoryItem));
256 InvCriteria.Add(Expression.Eq("ParentPartID", p.UUID)); 256 InvCriteria.Add(Expression.Eq("ParentPartID", p.UUID));
257 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 257 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
@@ -263,7 +263,7 @@ namespace OpenSim.Data.NHibernate
263 if (inventory.Count > 0) 263 if (inventory.Count > 0)
264 p.RestoreInventoryItems(inventory); 264 p.RestoreInventoryItems(inventory);
265 } 265 }
266 foreach (SceneObjectGroup g in SOG.Values) 266 foreach (SceneObjectGroup g in SOG.Values)
267 { 267 {
268 ret.Add(g); 268 ret.Add(g);
269 } 269 }
@@ -304,7 +304,7 @@ namespace OpenSim.Data.NHibernate
304 } 304 }
305 305
306 /// <summary> 306 /// <summary>
307 /// 307 ///
308 /// </summary> 308 /// </summary>
309 /// <param name="globalID"></param> 309 /// <param name="globalID"></param>
310 public void RemoveLandObject(LLUUID globalID) 310 public void RemoveLandObject(LLUUID globalID)
@@ -313,7 +313,7 @@ namespace OpenSim.Data.NHibernate
313 } 313 }
314 314
315 /// <summary> 315 /// <summary>
316 /// 316 ///
317 /// </summary> 317 /// </summary>
318 /// <param name="parcel"></param> 318 /// <param name="parcel"></param>
319 public void StoreLandObject(ILandObject parcel) 319 public void StoreLandObject(ILandObject parcel)
@@ -322,7 +322,7 @@ namespace OpenSim.Data.NHibernate
322 } 322 }
323 323
324 /// <summary> 324 /// <summary>
325 /// 325 ///
326 /// </summary> 326 /// </summary>
327 /// <param name="regionUUID"></param> 327 /// <param name="regionUUID"></param>
328 /// <returns></returns> 328 /// <returns></returns>
@@ -341,7 +341,7 @@ namespace OpenSim.Data.NHibernate
341 { 341 {
342 session.Flush(); 342 session.Flush();
343 } 343 }
344 344
345 /// <summary> 345 /// <summary>
346 /// Load a region banlist 346 /// Load a region banlist
347 /// </summary> 347 /// </summary>
@@ -373,7 +373,7 @@ namespace OpenSim.Data.NHibernate
373 } 373 }
374 374
375 /// <summary> 375 /// <summary>
376 /// 376 ///
377 /// </summary> 377 /// </summary>
378 /// <param name="val"></param> 378 /// <param name="val"></param>
379 /// <returns></returns> 379 /// <returns></returns>
@@ -399,17 +399,17 @@ namespace OpenSim.Data.NHibernate
399 { 399 {
400 ICriteria criteria = session.CreateCriteria(typeof(TaskInventoryItem)); 400 ICriteria criteria = session.CreateCriteria(typeof(TaskInventoryItem));
401 criteria.Add(Expression.Eq("ParentPartID", primID)); 401 criteria.Add(Expression.Eq("ParentPartID", primID));
402 try 402 try
403 { 403 {
404 foreach (TaskInventoryItem i in criteria.List()) 404 foreach (TaskInventoryItem i in criteria.List())
405 { 405 {
406 session.Delete(i); 406 session.Delete(i);
407 } 407 }
408 408
409 foreach (TaskInventoryItem i in items) 409 foreach (TaskInventoryItem i in items)
410 { 410 {
411 session.Save(i); 411 session.Save(i);
412 412
413 } 413 }
414 session.Flush(); 414 session.Flush();
415 } 415 }
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index bceae7c..c776474 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -53,8 +53,8 @@ namespace OpenSim.Data.NHibernate
53 private ISessionFactory factory; 53 private ISessionFactory factory;
54 private ISession session; 54 private ISession session;
55 55
56 public override void Initialise() 56 public override void Initialise()
57 { 57 {
58 m_log.Info("[NHibernateUserData]: " + Name + " cannot be default-initialized!"); 58 m_log.Info("[NHibernateUserData]: " + Name + " cannot be default-initialized!");
59 throw new PluginNotInitialisedException (Name); 59 throw new PluginNotInitialisedException (Name);
60 } 60 }
@@ -83,7 +83,7 @@ namespace OpenSim.Data.NHibernate
83 83
84 factory = cfg.BuildSessionFactory(); 84 factory = cfg.BuildSessionFactory();
85 session = factory.OpenSession(); 85 session = factory.OpenSession();
86 86
87 // This actually does the roll forward assembly stuff 87 // This actually does the roll forward assembly stuff
88 Assembly assem = GetType().Assembly; 88 Assembly assem = GetType().Assembly;
89 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "UserStore"); 89 Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "UserStore");
@@ -97,7 +97,7 @@ namespace OpenSim.Data.NHibernate
97 { 97 {
98 user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; 98 user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
99 } 99 }
100 catch (ObjectNotFoundException) 100 catch (ObjectNotFoundException)
101 { 101 {
102 user = null; 102 user = null;
103 } 103 }
@@ -109,12 +109,12 @@ namespace OpenSim.Data.NHibernate
109 { 109 {
110 UserProfileData user; 110 UserProfileData user;
111 // TODO: I'm sure I'll have to do something silly here 111 // TODO: I'm sure I'll have to do something silly here
112 try 112 try
113 { 113 {
114 user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; 114 user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
115 user.CurrentAgent = GetAgentByUUID(uuid); 115 user.CurrentAgent = GetAgentByUUID(uuid);
116 } 116 }
117 catch (ObjectNotFoundException) 117 catch (ObjectNotFoundException)
118 { 118 {
119 user = null; 119 user = null;
120 } 120 }
@@ -144,12 +144,12 @@ namespace OpenSim.Data.NHibernate
144 } 144 }
145 else 145 else
146 { 146 {
147 try 147 try
148 { 148 {
149 UserAgentData old = session.Load(typeof(UserAgentData), uuid) as UserAgentData; 149 UserAgentData old = session.Load(typeof(UserAgentData), uuid) as UserAgentData;
150 session.Delete(old); 150 session.Delete(old);
151 } 151 }
152 catch (ObjectNotFoundException) 152 catch (ObjectNotFoundException)
153 { 153 {
154 } 154 }
155 session.Save(agent); 155 session.Save(agent);
@@ -174,12 +174,12 @@ namespace OpenSim.Data.NHibernate
174 174
175 override public void AddNewUserAgent(UserAgentData agent) 175 override public void AddNewUserAgent(UserAgentData agent)
176 { 176 {
177 try 177 try
178 { 178 {
179 UserAgentData old = session.Load(typeof(UserAgentData), agent.ProfileID) as UserAgentData; 179 UserAgentData old = session.Load(typeof(UserAgentData), agent.ProfileID) as UserAgentData;
180 session.Delete(old); 180 session.Delete(old);
181 } 181 }
182 catch (ObjectNotFoundException) 182 catch (ObjectNotFoundException)
183 { 183 {
184 } 184 }
185 session.Save(agent); 185 session.Save(agent);
@@ -287,9 +287,9 @@ namespace OpenSim.Data.NHibernate
287 287
288 public override void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) 288 public override void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
289 { 289 {
290 if (appearance == null) 290 if (appearance == null)
291 return; 291 return;
292 292
293 appearance.Owner = user; 293 appearance.Owner = user;
294 294
295 bool exists = ExistsAppearance(user); 295 bool exists = ExistsAppearance(user);
diff --git a/OpenSim/Data/NHibernate/Terrain.cs b/OpenSim/Data/NHibernate/Terrain.cs
index a95e45a..608f03e 100644
--- a/OpenSim/Data/NHibernate/Terrain.cs
+++ b/OpenSim/Data/NHibernate/Terrain.cs
@@ -32,21 +32,21 @@ using OpenSim.Framework;
32using log4net; 32using log4net;
33using libsecondlife; 33using libsecondlife;
34 34
35namespace OpenSim.Data.NHibernate 35namespace OpenSim.Data.NHibernate
36{ 36{
37 public class Terrain 37 public class Terrain
38 { 38 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 40
41 private double[,] map; 41 private double[,] map;
42 private LLUUID regionID; 42 private LLUUID regionID;
43 43
44 public Terrain(LLUUID Region, double[,] array) 44 public Terrain(LLUUID Region, double[,] array)
45 { 45 {
46 map = array; 46 map = array;
47 regionID = Region; 47 regionID = Region;
48 } 48 }
49 49
50 public Terrain() 50 public Terrain()
51 { 51 {
52 map = new double[Constants.RegionSize, Constants.RegionSize]; 52 map = new double[Constants.RegionSize, Constants.RegionSize];
@@ -65,7 +65,7 @@ namespace OpenSim.Data.NHibernate
65 get { return serializeTerrain(map); } 65 get { return serializeTerrain(map); }
66 set { map = parseTerrain(value); } 66 set { map = parseTerrain(value); }
67 } 67 }
68 68
69 public double[,] Doubles 69 public double[,] Doubles
70 { 70 {
71 get {return map;} 71 get {return map;}
@@ -76,7 +76,7 @@ namespace OpenSim.Data.NHibernate
76 { 76 {
77 double[,] terret = new double[256,256]; 77 double[,] terret = new double[256,256];
78 terret.Initialize(); 78 terret.Initialize();
79 79
80 MemoryStream str = new MemoryStream(data); 80 MemoryStream str = new MemoryStream(data);
81 BinaryReader br = new BinaryReader(str); 81 BinaryReader br = new BinaryReader(str);
82 try { 82 try {
@@ -87,7 +87,7 @@ namespace OpenSim.Data.NHibernate
87 terret[x, y] = br.ReadDouble(); 87 terret[x, y] = br.ReadDouble();
88 } 88 }
89 } 89 }
90 } 90 }
91 catch (Exception e) 91 catch (Exception e)
92 { 92 {
93 m_log.Error("Issue parsing Map", e); 93 m_log.Error("Issue parsing Map", e);
@@ -99,7 +99,7 @@ namespace OpenSim.Data.NHibernate
99 { 99 {
100 MemoryStream str = new MemoryStream((int)(65536 * sizeof (double))); 100 MemoryStream str = new MemoryStream((int)(65536 * sizeof (double)));
101 BinaryWriter bw = new BinaryWriter(str); 101 BinaryWriter bw = new BinaryWriter(str);
102 102
103 // TODO: COMPATIBILITY - Add byte-order conversions 103 // TODO: COMPATIBILITY - Add byte-order conversions
104 for (int x = 0; x < 256; x++) 104 for (int x = 0; x < 256; x++)
105 { 105 {
@@ -108,11 +108,11 @@ namespace OpenSim.Data.NHibernate
108 double height = val[x, y]; 108 double height = val[x, y];
109 if (height <= 0.0) 109 if (height <= 0.0)
110 height = double.Epsilon; 110 height = double.Epsilon;
111 111
112 bw.Write(height); 112 bw.Write(height);
113 } 113 }
114 } 114 }
115 return str.ToArray(); 115 return str.ToArray();
116 } 116 }
117 } 117 }
118} \ No newline at end of file 118}