diff options
author | Jeff Ames | 2008-05-14 06:09:39 +0000 |
---|---|---|
committer | Jeff Ames | 2008-05-14 06:09:39 +0000 |
commit | b7a0855c3afea27f207655fca25651b19b41636a (patch) | |
tree | d049510e51b337a82ebbf88e197b3141511d9155 /OpenSim | |
parent | Applied Patch mantis 1220. Implements llGetStartParameter. Thanks! (diff) | |
download | opensim-SC-b7a0855c3afea27f207655fca25651b19b41636a.zip opensim-SC-b7a0855c3afea27f207655fca25651b19b41636a.tar.gz opensim-SC-b7a0855c3afea27f207655fca25651b19b41636a.tar.bz2 opensim-SC-b7a0855c3afea27f207655fca25651b19b41636a.tar.xz |
More formatting cleanup. Minor refactoring.
Diffstat (limited to 'OpenSim')
8 files changed, 217 insertions, 108 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index 875f4e5..4eb9eef 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs | |||
@@ -60,7 +60,8 @@ namespace OpenSim.Data.NHibernate | |||
60 | // Split out the dialect, driver, and connect string | 60 | // Split out the dialect, driver, and connect string |
61 | char[] split = {';'}; | 61 | char[] split = {';'}; |
62 | string[] parts = connect.Split(split, 3); | 62 | string[] parts = connect.Split(split, 3); |
63 | if (parts.Length != 3) { | 63 | if (parts.Length != 3) |
64 | { | ||
64 | // TODO: make this a real exception type | 65 | // TODO: make this a real exception type |
65 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); | 66 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); |
66 | } | 67 | } |
@@ -96,15 +97,22 @@ namespace OpenSim.Data.NHibernate | |||
96 | { | 97 | { |
97 | string regex = @"no such table: Assets"; | 98 | string regex = @"no such table: Assets"; |
98 | Regex RE = new Regex(regex, RegexOptions.Multiline); | 99 | Regex RE = new Regex(regex, RegexOptions.Multiline); |
99 | try { | 100 | try |
100 | using (ISession session = factory.OpenSession()) { | 101 | { |
102 | using (ISession session = factory.OpenSession()) | ||
103 | { | ||
101 | session.Load(typeof(AssetBase), LLUUID.Zero); | 104 | session.Load(typeof(AssetBase), LLUUID.Zero); |
102 | } | 105 | } |
103 | } catch (ObjectNotFoundException) { | 106 | } |
107 | catch (ObjectNotFoundException) | ||
108 | { | ||
104 | // yes, we know it's not there, but that's ok | 109 | // yes, we know it's not there, but that's ok |
105 | } catch (ADOException e) { | 110 | } |
111 | catch (ADOException e) | ||
112 | { | ||
106 | Match m = RE.Match(e.ToString()); | 113 | Match m = RE.Match(e.ToString()); |
107 | if (m.Success) { | 114 | if (m.Success) |
115 | { | ||
108 | // We don't have this table, so create it. | 116 | // We don't have this table, so create it. |
109 | new SchemaExport(cfg).Create(true, true); | 117 | new SchemaExport(cfg).Create(true, true); |
110 | } | 118 | } |
@@ -113,10 +121,14 @@ namespace OpenSim.Data.NHibernate | |||
113 | 121 | ||
114 | override public AssetBase FetchAsset(LLUUID uuid) | 122 | override public AssetBase FetchAsset(LLUUID uuid) |
115 | { | 123 | { |
116 | using (ISession session = factory.OpenSession()) { | 124 | using (ISession session = factory.OpenSession()) |
117 | try { | 125 | { |
126 | try | ||
127 | { | ||
118 | return session.Load(typeof(AssetBase), uuid) as AssetBase; | 128 | return session.Load(typeof(AssetBase), uuid) as AssetBase; |
119 | } catch { | 129 | } |
130 | catch | ||
131 | { | ||
120 | return null; | 132 | return null; |
121 | } | 133 | } |
122 | } | 134 | } |
@@ -124,9 +136,12 @@ namespace OpenSim.Data.NHibernate | |||
124 | 136 | ||
125 | override public void CreateAsset(AssetBase asset) | 137 | override public void CreateAsset(AssetBase asset) |
126 | { | 138 | { |
127 | if (!ExistsAsset(asset.FullID)) { | 139 | if (!ExistsAsset(asset.FullID)) |
128 | using (ISession session = factory.OpenSession()) { | 140 | { |
129 | using (ITransaction transaction = session.BeginTransaction()) { | 141 | using (ISession session = factory.OpenSession()) |
142 | { | ||
143 | using (ITransaction transaction = session.BeginTransaction()) | ||
144 | { | ||
130 | session.Save(asset); | 145 | session.Save(asset); |
131 | transaction.Commit(); | 146 | transaction.Commit(); |
132 | } | 147 | } |
@@ -136,9 +151,12 @@ namespace OpenSim.Data.NHibernate | |||
136 | 151 | ||
137 | override public void UpdateAsset(AssetBase asset) | 152 | override public void UpdateAsset(AssetBase asset) |
138 | { | 153 | { |
139 | if (ExistsAsset(asset.FullID)) { | 154 | if (ExistsAsset(asset.FullID)) |
140 | using (ISession session = factory.OpenSession()) { | 155 | { |
141 | using (ITransaction transaction = session.BeginTransaction()) { | 156 | using (ISession session = factory.OpenSession()) |
157 | { | ||
158 | using (ITransaction transaction = session.BeginTransaction()) | ||
159 | { | ||
142 | session.Update(asset); | 160 | session.Update(asset); |
143 | transaction.Commit(); | 161 | transaction.Commit(); |
144 | } | 162 | } |
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs index 6ee1b4a..8305646 100644 --- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs +++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs | |||
@@ -57,7 +57,8 @@ namespace OpenSim.Data.NHibernate | |||
57 | // Split out the dialect, driver, and connect string | 57 | // Split out the dialect, driver, and connect string |
58 | char[] split = {';'}; | 58 | char[] split = {';'}; |
59 | string[] parts = connect.Split(split, 3); | 59 | string[] parts = connect.Split(split, 3); |
60 | if (parts.Length != 3) { | 60 | if (parts.Length != 3) |
61 | { | ||
61 | // TODO: make this a real exception type | 62 | // TODO: make this a real exception type |
62 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); | 63 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); |
63 | } | 64 | } |
@@ -94,15 +95,22 @@ namespace OpenSim.Data.NHibernate | |||
94 | { | 95 | { |
95 | string regex = @"no such table: Inventory"; | 96 | string regex = @"no such table: Inventory"; |
96 | Regex RE = new Regex(regex, RegexOptions.Multiline); | 97 | Regex RE = new Regex(regex, RegexOptions.Multiline); |
97 | try { | 98 | try |
98 | using (ISession session = factory.OpenSession()) { | 99 | { |
100 | using (ISession session = factory.OpenSession()) | ||
101 | { | ||
99 | session.Load(typeof(InventoryItemBase), LLUUID.Zero); | 102 | session.Load(typeof(InventoryItemBase), LLUUID.Zero); |
100 | } | 103 | } |
101 | } catch (ObjectNotFoundException) { | 104 | } |
105 | catch (ObjectNotFoundException) | ||
106 | { | ||
102 | // yes, we know it's not there, but that's ok | 107 | // yes, we know it's not there, but that's ok |
103 | } catch (ADOException e) { | 108 | } |
109 | catch (ADOException e) | ||
110 | { | ||
104 | Match m = RE.Match(e.ToString()); | 111 | Match m = RE.Match(e.ToString()); |
105 | if (m.Success) { | 112 | if (m.Success) |
113 | { | ||
106 | // We don't have this table, so create it. | 114 | // We don't have this table, so create it. |
107 | new SchemaExport(cfg).Create(true, true); | 115 | new SchemaExport(cfg).Create(true, true); |
108 | } | 116 | } |
@@ -125,10 +133,14 @@ namespace OpenSim.Data.NHibernate | |||
125 | /// <returns>A class containing item information</returns> | 133 | /// <returns>A class containing item information</returns> |
126 | public InventoryItemBase getInventoryItem(LLUUID item) | 134 | public InventoryItemBase getInventoryItem(LLUUID item) |
127 | { | 135 | { |
128 | using (ISession session = factory.OpenSession()) { | 136 | using (ISession session = factory.OpenSession()) |
129 | try { | 137 | { |
138 | try | ||
139 | { | ||
130 | return session.Load(typeof(InventoryItemBase), item) as InventoryItemBase; | 140 | return session.Load(typeof(InventoryItemBase), item) as InventoryItemBase; |
131 | } catch { | 141 | } |
142 | catch | ||
143 | { | ||
132 | m_log.ErrorFormat("Couldn't find inventory item: {0}", item); | 144 | m_log.ErrorFormat("Couldn't find inventory item: {0}", item); |
133 | return null; | 145 | return null; |
134 | } | 146 | } |
@@ -141,14 +153,19 @@ namespace OpenSim.Data.NHibernate | |||
141 | /// <param name="item">The item to be created</param> | 153 | /// <param name="item">The item to be created</param> |
142 | public void addInventoryItem(InventoryItemBase item) | 154 | public void addInventoryItem(InventoryItemBase item) |
143 | { | 155 | { |
144 | if (!ExistsItem(item.ID)) { | 156 | if (!ExistsItem(item.ID)) |
145 | using (ISession session = factory.OpenSession()) { | 157 | { |
146 | using (ITransaction transaction = session.BeginTransaction()) { | 158 | using (ISession session = factory.OpenSession()) |
159 | { | ||
160 | using (ITransaction transaction = session.BeginTransaction()) | ||
161 | { | ||
147 | session.Save(item); | 162 | session.Save(item); |
148 | transaction.Commit(); | 163 | transaction.Commit(); |
149 | } | 164 | } |
150 | } | 165 | } |
151 | } else { | 166 | } |
167 | else | ||
168 | { | ||
152 | m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists, updating instead", item.ID); | 169 | m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists, updating instead", item.ID); |
153 | updateInventoryItem(item); | 170 | updateInventoryItem(item); |
154 | } | 171 | } |
@@ -160,14 +177,19 @@ namespace OpenSim.Data.NHibernate | |||
160 | /// <param name="item">The updated item</param> | 177 | /// <param name="item">The updated item</param> |
161 | public void updateInventoryItem(InventoryItemBase item) | 178 | public void updateInventoryItem(InventoryItemBase item) |
162 | { | 179 | { |
163 | if (ExistsItem(item.ID)) { | 180 | if (ExistsItem(item.ID)) |
164 | using (ISession session = factory.OpenSession()) { | 181 | { |
165 | using (ITransaction transaction = session.BeginTransaction()) { | 182 | using (ISession session = factory.OpenSession()) |
183 | { | ||
184 | using (ITransaction transaction = session.BeginTransaction()) | ||
185 | { | ||
166 | session.Update(item); | 186 | session.Update(item); |
167 | transaction.Commit(); | 187 | transaction.Commit(); |
168 | } | 188 | } |
169 | } | 189 | } |
170 | } else { | 190 | } |
191 | else | ||
192 | { | ||
171 | m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists", item.ID); | 193 | m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists", item.ID); |
172 | } | 194 | } |
173 | } | 195 | } |
@@ -178,15 +200,16 @@ namespace OpenSim.Data.NHibernate | |||
178 | /// <param name="item"></param> | 200 | /// <param name="item"></param> |
179 | public void deleteInventoryItem(LLUUID itemID) | 201 | public void deleteInventoryItem(LLUUID itemID) |
180 | { | 202 | { |
181 | using (ISession session = factory.OpenSession()) { | 203 | using (ISession session = factory.OpenSession()) |
182 | using (ITransaction transaction = session.BeginTransaction()) { | 204 | { |
205 | using (ITransaction transaction = session.BeginTransaction()) | ||
206 | { | ||
183 | session.Delete(itemID); | 207 | session.Delete(itemID); |
184 | transaction.Commit(); | 208 | transaction.Commit(); |
185 | } | 209 | } |
186 | } | 210 | } |
187 | } | 211 | } |
188 | 212 | ||
189 | |||
190 | /// <summary> | 213 | /// <summary> |
191 | /// Returns an inventory folder by its UUID | 214 | /// Returns an inventory folder by its UUID |
192 | /// </summary> | 215 | /// </summary> |
@@ -194,10 +217,14 @@ namespace OpenSim.Data.NHibernate | |||
194 | /// <returns>A class containing folder information</returns> | 217 | /// <returns>A class containing folder information</returns> |
195 | public InventoryFolderBase getInventoryFolder(LLUUID folder) | 218 | public InventoryFolderBase getInventoryFolder(LLUUID folder) |
196 | { | 219 | { |
197 | using (ISession session = factory.OpenSession()) { | 220 | using (ISession session = factory.OpenSession()) |
198 | try { | 221 | { |
222 | try | ||
223 | { | ||
199 | return session.Load(typeof(InventoryFolderBase), folder) as InventoryFolderBase; | 224 | return session.Load(typeof(InventoryFolderBase), folder) as InventoryFolderBase; |
200 | } catch { | 225 | } |
226 | catch | ||
227 | { | ||
201 | m_log.ErrorFormat("Couldn't find inventory item: {0}", folder); | 228 | m_log.ErrorFormat("Couldn't find inventory item: {0}", folder); |
202 | return null; | 229 | return null; |
203 | } | 230 | } |
@@ -210,14 +237,19 @@ namespace OpenSim.Data.NHibernate | |||
210 | /// <param name="folder">The folder to be created</param> | 237 | /// <param name="folder">The folder to be created</param> |
211 | public void addInventoryFolder(InventoryFolderBase folder) | 238 | public void addInventoryFolder(InventoryFolderBase folder) |
212 | { | 239 | { |
213 | if (!ExistsFolder(folder.ID)) { | 240 | if (!ExistsFolder(folder.ID)) |
214 | using (ISession session = factory.OpenSession()) { | 241 | { |
215 | using (ITransaction transaction = session.BeginTransaction()) { | 242 | using (ISession session = factory.OpenSession()) |
243 | { | ||
244 | using (ITransaction transaction = session.BeginTransaction()) | ||
245 | { | ||
216 | session.Save(folder); | 246 | session.Save(folder); |
217 | transaction.Commit(); | 247 | transaction.Commit(); |
218 | } | 248 | } |
219 | } | 249 | } |
220 | } else { | 250 | } |
251 | else | ||
252 | { | ||
221 | m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists, updating instead", folder.ID); | 253 | m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists, updating instead", folder.ID); |
222 | updateInventoryFolder(folder); | 254 | updateInventoryFolder(folder); |
223 | } | 255 | } |
@@ -229,14 +261,19 @@ namespace OpenSim.Data.NHibernate | |||
229 | /// <param name="folder">The updated folder</param> | 261 | /// <param name="folder">The updated folder</param> |
230 | public void updateInventoryFolder(InventoryFolderBase folder) | 262 | public void updateInventoryFolder(InventoryFolderBase folder) |
231 | { | 263 | { |
232 | if (ExistsFolder(folder.ID)) { | 264 | if (ExistsFolder(folder.ID)) |
233 | using (ISession session = factory.OpenSession()) { | 265 | { |
234 | using (ITransaction transaction = session.BeginTransaction()) { | 266 | using (ISession session = factory.OpenSession()) |
267 | { | ||
268 | using (ITransaction transaction = session.BeginTransaction()) | ||
269 | { | ||
235 | session.Update(folder); | 270 | session.Update(folder); |
236 | transaction.Commit(); | 271 | transaction.Commit(); |
237 | } | 272 | } |
238 | } | 273 | } |
239 | } else { | 274 | } |
275 | else | ||
276 | { | ||
240 | m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists", folder.ID); | 277 | m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists", folder.ID); |
241 | } | 278 | } |
242 | } | 279 | } |
@@ -247,8 +284,10 @@ namespace OpenSim.Data.NHibernate | |||
247 | /// <param name="folder"></param> | 284 | /// <param name="folder"></param> |
248 | public void deleteInventoryFolder(LLUUID folderID) | 285 | public void deleteInventoryFolder(LLUUID folderID) |
249 | { | 286 | { |
250 | using (ISession session = factory.OpenSession()) { | 287 | using (ISession session = factory.OpenSession()) |
251 | using (ITransaction transaction = session.BeginTransaction()) { | 288 | { |
289 | using (ITransaction transaction = session.BeginTransaction()) | ||
290 | { | ||
252 | session.Delete(folderID.ToString()); | 291 | session.Delete(folderID.ToString()); |
253 | transaction.Commit(); | 292 | transaction.Commit(); |
254 | } | 293 | } |
@@ -324,7 +363,8 @@ namespace OpenSim.Data.NHibernate | |||
324 | /// <returns>A List of InventoryItemBase items</returns> | 363 | /// <returns>A List of InventoryItemBase items</returns> |
325 | public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) | 364 | public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) |
326 | { | 365 | { |
327 | using (ISession session = factory.OpenSession()) { | 366 | using (ISession session = factory.OpenSession()) |
367 | { | ||
328 | // try { | 368 | // try { |
329 | ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase)); | 369 | ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase)); |
330 | criteria.Add(Expression.Eq("Folder", folderID)); | 370 | criteria.Add(Expression.Eq("Folder", folderID)); |
@@ -334,7 +374,9 @@ namespace OpenSim.Data.NHibernate | |||
334 | list.Add(item); | 374 | list.Add(item); |
335 | } | 375 | } |
336 | return list; | 376 | return list; |
337 | // } catch { | 377 | // } |
378 | // catch | ||
379 | // { | ||
338 | // return new List<InventoryItemBase>(); | 380 | // return new List<InventoryItemBase>(); |
339 | // } | 381 | // } |
340 | } | 382 | } |
@@ -348,8 +390,10 @@ namespace OpenSim.Data.NHibernate | |||
348 | // see InventoryItemBase.getUserRootFolder | 390 | // see InventoryItemBase.getUserRootFolder |
349 | public InventoryFolderBase getUserRootFolder(LLUUID user) | 391 | public InventoryFolderBase getUserRootFolder(LLUUID user) |
350 | { | 392 | { |
351 | using (ISession session = factory.OpenSession()) { | 393 | using (ISession session = factory.OpenSession()) |
352 | // try { | 394 | { |
395 | // try | ||
396 | // { | ||
353 | ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); | 397 | ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); |
354 | criteria.Add(Expression.Eq("ParentID", LLUUID.Zero)); | 398 | criteria.Add(Expression.Eq("ParentID", LLUUID.Zero)); |
355 | criteria.Add(Expression.Eq("Owner", user)); | 399 | criteria.Add(Expression.Eq("Owner", user)); |
@@ -359,7 +403,9 @@ namespace OpenSim.Data.NHibernate | |||
359 | } | 403 | } |
360 | m_log.ErrorFormat("No Inventory Root Folder Found for: {0}", user); | 404 | m_log.ErrorFormat("No Inventory Root Folder Found for: {0}", user); |
361 | return new InventoryFolderBase(); | 405 | return new InventoryFolderBase(); |
362 | // } catch { | 406 | // } |
407 | // catch | ||
408 | // { | ||
363 | // return new InventoryFolderBase(); | 409 | // return new InventoryFolderBase(); |
364 | // } | 410 | // } |
365 | } | 411 | } |
@@ -372,15 +418,19 @@ namespace OpenSim.Data.NHibernate | |||
372 | /// <param name="parentID">ID of parent</param> | 418 | /// <param name="parentID">ID of parent</param> |
373 | private void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID) | 419 | private void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID) |
374 | { | 420 | { |
375 | using (ISession session = factory.OpenSession()) { | 421 | using (ISession session = factory.OpenSession()) |
376 | // try { | 422 | { |
423 | // try | ||
424 | // { | ||
377 | ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); | 425 | ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); |
378 | criteria.Add(Expression.Eq("ParentID", parentID)); | 426 | criteria.Add(Expression.Eq("ParentID", parentID)); |
379 | foreach (InventoryFolderBase item in criteria.List()) | 427 | foreach (InventoryFolderBase item in criteria.List()) |
380 | { | 428 | { |
381 | folders.Add(item); | 429 | folders.Add(item); |
382 | } | 430 | } |
383 | // } catch { | 431 | // } |
432 | // catch | ||
433 | // { | ||
384 | // m_log.ErrorFormat("Can't run getInventoryFolders for Folder ID: {0}", parentID); | 434 | // m_log.ErrorFormat("Can't run getInventoryFolders for Folder ID: {0}", parentID); |
385 | // } | 435 | // } |
386 | } | 436 | } |
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 2c84ef9..43d8c32 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs | |||
@@ -56,7 +56,8 @@ namespace OpenSim.Data.NHibernate | |||
56 | { | 56 | { |
57 | char[] split = {';'}; | 57 | char[] split = {';'}; |
58 | string[] parts = connect.Split(split, 3); | 58 | string[] parts = connect.Split(split, 3); |
59 | if (parts.Length != 3) { | 59 | if (parts.Length != 3) |
60 | { | ||
60 | // TODO: make this a real exception type | 61 | // TODO: make this a real exception type |
61 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); | 62 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); |
62 | } | 63 | } |
@@ -87,15 +88,22 @@ namespace OpenSim.Data.NHibernate | |||
87 | { | 88 | { |
88 | string regex = @"no such table: UserProfiles"; | 89 | string regex = @"no such table: UserProfiles"; |
89 | Regex RE = new Regex(regex, RegexOptions.Multiline); | 90 | Regex RE = new Regex(regex, RegexOptions.Multiline); |
90 | try { | 91 | try |
91 | using (ISession session = factory.OpenSession()) { | 92 | { |
93 | using (ISession session = factory.OpenSession()) | ||
94 | { | ||
92 | session.Load(typeof(UserProfileData), LLUUID.Zero); | 95 | session.Load(typeof(UserProfileData), LLUUID.Zero); |
93 | } | 96 | } |
94 | } catch (ObjectNotFoundException) { | 97 | } |
98 | catch (ObjectNotFoundException) | ||
99 | { | ||
95 | // yes, we know it's not there, but that's ok | 100 | // yes, we know it's not there, but that's ok |
96 | } catch (ADOException e) { | 101 | } |
102 | catch (ADOException e) | ||
103 | { | ||
97 | Match m = RE.Match(e.ToString()); | 104 | Match m = RE.Match(e.ToString()); |
98 | if (m.Success) { | 105 | if (m.Success) |
106 | { | ||
99 | // We don't have this table, so create it. | 107 | // We don't have this table, so create it. |
100 | new SchemaExport(cfg).Create(true, true); | 108 | new SchemaExport(cfg).Create(true, true); |
101 | } | 109 | } |
@@ -105,12 +113,15 @@ namespace OpenSim.Data.NHibernate | |||
105 | private bool ExistsUser(LLUUID uuid) | 113 | private bool ExistsUser(LLUUID uuid) |
106 | { | 114 | { |
107 | UserProfileData user = null; | 115 | UserProfileData user = null; |
108 | try { | 116 | try |
109 | using (ISession session = factory.OpenSession()) { | 117 | { |
118 | using (ISession session = factory.OpenSession()) | ||
119 | { | ||
110 | user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; | 120 | user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; |
111 | } | 121 | } |
112 | // BUG: CATCHALL IS BAD. | 122 | // BUG: CATCHALL IS BAD. |
113 | } catch (Exception) {} | 123 | } |
124 | catch (Exception) {} | ||
114 | 125 | ||
115 | return (user != null); | 126 | return (user != null); |
116 | } | 127 | } |
@@ -119,7 +130,8 @@ namespace OpenSim.Data.NHibernate | |||
119 | { | 130 | { |
120 | UserProfileData user; | 131 | UserProfileData user; |
121 | // TODO: I'm sure I'll have to do something silly here | 132 | // TODO: I'm sure I'll have to do something silly here |
122 | using (ISession session = factory.OpenSession()) { | 133 | using (ISession session = factory.OpenSession()) |
134 | { | ||
123 | user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; | 135 | user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; |
124 | user.CurrentAgent = GetAgentByUUID(uuid); | 136 | user.CurrentAgent = GetAgentByUUID(uuid); |
125 | } | 137 | } |
@@ -128,16 +140,21 @@ namespace OpenSim.Data.NHibernate | |||
128 | 140 | ||
129 | override public void AddNewUserProfile(UserProfileData profile) | 141 | override public void AddNewUserProfile(UserProfileData profile) |
130 | { | 142 | { |
131 | if (!ExistsUser(profile.ID)) { | 143 | if (!ExistsUser(profile.ID)) |
132 | using (ISession session = factory.OpenSession()) { | 144 | { |
133 | using (ITransaction transaction = session.BeginTransaction()) { | 145 | using (ISession session = factory.OpenSession()) |
146 | { | ||
147 | using (ITransaction transaction = session.BeginTransaction()) | ||
148 | { | ||
134 | session.Save(profile); | 149 | session.Save(profile); |
135 | SetAgentData(profile.ID, profile.CurrentAgent, session); | 150 | SetAgentData(profile.ID, profile.CurrentAgent, session); |
136 | // TODO: save agent | 151 | // TODO: save agent |
137 | transaction.Commit(); | 152 | transaction.Commit(); |
138 | } | 153 | } |
139 | } | 154 | } |
140 | } else { | 155 | } |
156 | else | ||
157 | { | ||
141 | m_log.ErrorFormat("Attempted to add User {0} {1} that already exists, updating instead", profile.FirstName, profile.SurName); | 158 | m_log.ErrorFormat("Attempted to add User {0} {1} that already exists, updating instead", profile.FirstName, profile.SurName); |
142 | UpdateUserProfile(profile); | 159 | UpdateUserProfile(profile); |
143 | } | 160 | } |
@@ -165,16 +182,21 @@ namespace OpenSim.Data.NHibernate | |||
165 | } | 182 | } |
166 | override public bool UpdateUserProfile(UserProfileData profile) | 183 | override public bool UpdateUserProfile(UserProfileData profile) |
167 | { | 184 | { |
168 | if (ExistsUser(profile.ID)) { | 185 | if (ExistsUser(profile.ID)) |
169 | using (ISession session = factory.OpenSession()) { | 186 | { |
170 | using (ITransaction transaction = session.BeginTransaction()) { | 187 | using (ISession session = factory.OpenSession()) |
188 | { | ||
189 | using (ITransaction transaction = session.BeginTransaction()) | ||
190 | { | ||
171 | session.Update(profile); | 191 | session.Update(profile); |
172 | SetAgentData(profile.ID, profile.CurrentAgent, session); | 192 | SetAgentData(profile.ID, profile.CurrentAgent, session); |
173 | transaction.Commit(); | 193 | transaction.Commit(); |
174 | return true; | 194 | return true; |
175 | } | 195 | } |
176 | } | 196 | } |
177 | } else { | 197 | } |
198 | else | ||
199 | { | ||
178 | m_log.ErrorFormat("Attempted to update User {0} {1} that doesn't exist, updating instead", profile.FirstName, profile.SurName); | 200 | m_log.ErrorFormat("Attempted to update User {0} {1} that doesn't exist, updating instead", profile.FirstName, profile.SurName); |
179 | AddNewUserProfile(profile); | 201 | AddNewUserProfile(profile); |
180 | return true; | 202 | return true; |
@@ -183,8 +205,10 @@ namespace OpenSim.Data.NHibernate | |||
183 | 205 | ||
184 | override public void AddNewUserAgent(UserAgentData agent) | 206 | override public void AddNewUserAgent(UserAgentData agent) |
185 | { | 207 | { |
186 | using (ISession session = factory.OpenSession()) { | 208 | using (ISession session = factory.OpenSession()) |
187 | using (ITransaction transaction = session.BeginTransaction()) { | 209 | { |
210 | using (ITransaction transaction = session.BeginTransaction()) | ||
211 | { | ||
188 | session.Save(agent); | 212 | session.Save(agent); |
189 | transaction.Commit(); | 213 | transaction.Commit(); |
190 | } | 214 | } |
@@ -193,30 +217,35 @@ namespace OpenSim.Data.NHibernate | |||
193 | 217 | ||
194 | public void UpdateUserAgent(UserAgentData agent) | 218 | public void UpdateUserAgent(UserAgentData agent) |
195 | { | 219 | { |
196 | using (ISession session = factory.OpenSession()) { | 220 | using (ISession session = factory.OpenSession()) |
197 | using (ITransaction transaction = session.BeginTransaction()) { | 221 | { |
222 | using (ITransaction transaction = session.BeginTransaction()) | ||
223 | { | ||
198 | session.Update(agent); | 224 | session.Update(agent); |
199 | transaction.Commit(); | 225 | transaction.Commit(); |
200 | } | 226 | } |
201 | } | 227 | } |
202 | } | 228 | } |
203 | 229 | ||
204 | |||
205 | |||
206 | override public UserAgentData GetAgentByUUID(LLUUID uuid) | 230 | override public UserAgentData GetAgentByUUID(LLUUID uuid) |
207 | { | 231 | { |
208 | try { | 232 | try |
209 | using (ISession session = factory.OpenSession()) { | 233 | { |
234 | using (ISession session = factory.OpenSession()) | ||
235 | { | ||
210 | return session.Load(typeof(UserAgentData), uuid) as UserAgentData; | 236 | return session.Load(typeof(UserAgentData), uuid) as UserAgentData; |
211 | } | 237 | } |
212 | } catch { | 238 | } |
239 | catch | ||
240 | { | ||
213 | return null; | 241 | return null; |
214 | } | 242 | } |
215 | } | 243 | } |
216 | 244 | ||
217 | override public UserProfileData GetUserByName(string fname, string lname) | 245 | override public UserProfileData GetUserByName(string fname, string lname) |
218 | { | 246 | { |
219 | using (ISession session = factory.OpenSession()) { | 247 | using (ISession session = factory.OpenSession()) |
248 | { | ||
220 | ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); | 249 | ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); |
221 | criteria.Add(Expression.Eq("FirstName", fname)); | 250 | criteria.Add(Expression.Eq("FirstName", fname)); |
222 | criteria.Add(Expression.Eq("SurName", lname)); | 251 | criteria.Add(Expression.Eq("SurName", lname)); |
@@ -247,7 +276,8 @@ namespace OpenSim.Data.NHibernate | |||
247 | 276 | ||
248 | if (querysplit.Length == 2) | 277 | if (querysplit.Length == 2) |
249 | { | 278 | { |
250 | using (ISession session = factory.OpenSession()) { | 279 | using (ISession session = factory.OpenSession()) |
280 | { | ||
251 | ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); | 281 | ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); |
252 | criteria.Add(Expression.Like("FirstName", querysplit[0])); | 282 | criteria.Add(Expression.Like("FirstName", querysplit[0])); |
253 | criteria.Add(Expression.Like("SurName", querysplit[1])); | 283 | criteria.Add(Expression.Like("SurName", querysplit[1])); |
@@ -280,7 +310,8 @@ namespace OpenSim.Data.NHibernate | |||
280 | { | 310 | { |
281 | UserAppearance appearance; | 311 | UserAppearance appearance; |
282 | // 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 |
283 | using (ISession session = factory.OpenSession()) { | 313 | using (ISession session = factory.OpenSession()) |
314 | { | ||
284 | appearance = session.Load(typeof(UserAppearance), user) as UserAppearance; | 315 | appearance = session.Load(typeof(UserAppearance), user) as UserAppearance; |
285 | } | 316 | } |
286 | return appearance; | 317 | return appearance; |
@@ -289,7 +320,8 @@ namespace OpenSim.Data.NHibernate | |||
289 | private bool ExistsAppearance(LLUUID uuid) | 320 | private bool ExistsAppearance(LLUUID uuid) |
290 | { | 321 | { |
291 | UserAppearance appearance; | 322 | UserAppearance appearance; |
292 | using (ISession session = factory.OpenSession()) { | 323 | using (ISession session = factory.OpenSession()) |
324 | { | ||
293 | appearance = session.Load(typeof(UserAppearance), uuid) as UserAppearance; | 325 | appearance = session.Load(typeof(UserAppearance), uuid) as UserAppearance; |
294 | } | 326 | } |
295 | return (appearance == null) ? false : true; | 327 | return (appearance == null) ? false : true; |
@@ -299,11 +331,16 @@ namespace OpenSim.Data.NHibernate | |||
299 | override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance) | 331 | override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance) |
300 | { | 332 | { |
301 | bool exists = ExistsAppearance(user); | 333 | bool exists = ExistsAppearance(user); |
302 | using (ISession session = factory.OpenSession()) { | 334 | using (ISession session = factory.OpenSession()) |
303 | using (ITransaction transaction = session.BeginTransaction()) { | 335 | { |
304 | if (exists) { | 336 | using (ITransaction transaction = session.BeginTransaction()) |
337 | { | ||
338 | if (exists) | ||
339 | { | ||
305 | session.Update(appearance); | 340 | session.Update(appearance); |
306 | } else { | 341 | } |
342 | else | ||
343 | { | ||
307 | session.Save(appearance); | 344 | session.Save(appearance); |
308 | } | 345 | } |
309 | transaction.Commit(); | 346 | transaction.Commit(); |
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs index 4892b8e..64a9b0d 100644 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs | |||
@@ -32,7 +32,7 @@ namespace OpenGridServices.Manager | |||
32 | { | 32 | { |
33 | public partial class MainWindow: Gtk.Window | 33 | public partial class MainWindow: Gtk.Window |
34 | { | 34 | { |
35 | public MainWindow (): base (Gtk.WindowType.Toplevel) | 35 | public MainWindow() : base (Gtk.WindowType.Toplevel) |
36 | { | 36 | { |
37 | Build(); | 37 | Build(); |
38 | } | 38 | } |
@@ -57,10 +57,13 @@ namespace OpenGridServices.Manager | |||
57 | 57 | ||
58 | public void SetGridServerConnected(bool connected) | 58 | public void SetGridServerConnected(bool connected) |
59 | { | 59 | { |
60 | if (connected) { | 60 | if (connected) |
61 | { | ||
61 | this.ConnectToGridserver.Visible=false; | 62 | this.ConnectToGridserver.Visible=false; |
62 | this.DisconnectFromGridServer.Visible=true; | 63 | this.DisconnectFromGridServer.Visible=true; |
63 | } else { | 64 | } |
65 | else | ||
66 | { | ||
64 | this.ConnectToGridserver.Visible=true; | 67 | this.ConnectToGridserver.Visible=true; |
65 | this.DisconnectFromGridServer.Visible=false; | 68 | this.DisconnectFromGridServer.Visible=false; |
66 | } | 69 | } |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_Builtins.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_Builtins.cs index d2e565d..a551fde 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_Builtins.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_Builtins.cs | |||
@@ -35,24 +35,29 @@ | |||
35 | // { | 35 | // { |
36 | 36 | ||
37 | 37 | ||
38 | // public float llSin() { | 38 | // public float llSin() |
39 | // { | ||
39 | // float f = (float)LSLStack.Pop(); | 40 | // float f = (float)LSLStack.Pop(); |
40 | // return LSL_Builtins.llSin(f); | 41 | // return LSL_Builtins.llSin(f); |
41 | // } | 42 | // } |
42 | // public float llCos() { | 43 | // public float llCos() |
44 | // { | ||
43 | // float f = (float)LSLStack.Pop(); | 45 | // float f = (float)LSLStack.Pop(); |
44 | // return LSL_Builtins.llCos(f); | 46 | // return LSL_Builtins.llCos(f); |
45 | // } | 47 | // } |
46 | // public float llTan() { | 48 | // public float llTan() |
49 | // { | ||
47 | // float f = (float)LSLStack.Pop(); | 50 | // float f = (float)LSLStack.Pop(); |
48 | // return LSL_Builtins.llTan(f); | 51 | // return LSL_Builtins.llTan(f); |
49 | // } | 52 | // } |
50 | // public float llAtan2() { | 53 | // public float llAtan2() |
54 | // { | ||
51 | // float x = (float)LSLStack.Pop(); | 55 | // float x = (float)LSLStack.Pop(); |
52 | // float y = (float)LSLStack.Pop(); | 56 | // float y = (float)LSLStack.Pop(); |
53 | // return LSL_Builtins.llAtan2(x, y); | 57 | // return LSL_Builtins.llAtan2(x, y); |
54 | // } | 58 | // } |
55 | // public float llSqrt() { | 59 | // public float llSqrt() |
60 | // { | ||
56 | // float f = (float)LSLStack.Pop(); | 61 | // float f = (float)LSLStack.Pop(); |
57 | // return LSL_Builtins.llSqrt(f); | 62 | // return LSL_Builtins.llSqrt(f); |
58 | // } | 63 | // } |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs index c679e49..97ccc18 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs | |||
@@ -34,7 +34,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
34 | { | 34 | { |
35 | //public System.Collections.Generic.Dictionary<Byte, Type> OpCode_Add_Types; | 35 | //public System.Collections.Generic.Dictionary<Byte, Type> OpCode_Add_Types; |
36 | 36 | ||
37 | //LSO_Enums() { | 37 | //LSO_Enums() |
38 | //{ | ||
38 | // OpCode_Add_Types.Add(51, typeof(String)); | 39 | // OpCode_Add_Types.Add(51, typeof(String)); |
39 | // OpCode_Add_Types.Add(17, typeof(UInt32)); | 40 | // OpCode_Add_Types.Add(17, typeof(UInt32)); |
40 | //} | 41 | //} |
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index b123b8c..32b1ada 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -163,7 +163,8 @@ namespace OpenSim.Grid.UserServer | |||
163 | 163 | ||
164 | theUser.CurrentAgent.Region = SimInfo.UUID; | 164 | theUser.CurrentAgent.Region = SimInfo.UUID; |
165 | theUser.CurrentAgent.Handle = SimInfo.regionHandle; | 165 | theUser.CurrentAgent.Handle = SimInfo.regionHandle; |
166 | if (start_x >= 0 && start_y >= 0 && start_z >= 0) { | 166 | if (start_x >= 0 && start_y >= 0 && start_z >= 0) |
167 | { | ||
167 | LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z); | 168 | LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z); |
168 | theUser.CurrentAgent.Position = tmp_v; | 169 | theUser.CurrentAgent.Position = tmp_v; |
169 | } | 170 | } |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index c7094c7..639e3c2 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -745,13 +745,7 @@ namespace OpenSim | |||
745 | /// <param name="regionnum">The first out parameter describing the number of regions</param> | 745 | /// <param name="regionnum">The first out parameter describing the number of regions</param> |
746 | public void GetRegionNumber(out int regionnum) | 746 | public void GetRegionNumber(out int regionnum) |
747 | { | 747 | { |
748 | int accounter = 0; | 748 | regionnum = m_sceneManager.Scenes.Count; |
749 | //List<string> regionNameList = new List<string>(); | ||
750 | |||
751 | m_sceneManager.ForEachScene(delegate(Scene scene) { | ||
752 | accounter++; | ||
753 | }); | ||
754 | regionnum = accounter; | ||
755 | } | 749 | } |
756 | } | 750 | } |
757 | } | 751 | } |