More formatting cleanup. Minor refactoring.
parent
39eb39c0d5
commit
b7a0855c3a
|
@ -60,7 +60,8 @@ namespace OpenSim.Data.NHibernate
|
||||||
// Split out the dialect, driver, and connect string
|
// Split out the dialect, driver, and connect string
|
||||||
char[] split = {';'};
|
char[] split = {';'};
|
||||||
string[] parts = connect.Split(split, 3);
|
string[] parts = connect.Split(split, 3);
|
||||||
if (parts.Length != 3) {
|
if (parts.Length != 3)
|
||||||
|
{
|
||||||
// TODO: make this a real exception type
|
// TODO: make this a real exception type
|
||||||
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
||||||
}
|
}
|
||||||
|
@ -96,15 +97,22 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
string regex = @"no such table: Assets";
|
string regex = @"no such table: Assets";
|
||||||
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
||||||
try {
|
try
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
session.Load(typeof(AssetBase), LLUUID.Zero);
|
session.Load(typeof(AssetBase), LLUUID.Zero);
|
||||||
}
|
}
|
||||||
} catch (ObjectNotFoundException) {
|
}
|
||||||
|
catch (ObjectNotFoundException)
|
||||||
|
{
|
||||||
// yes, we know it's not there, but that's ok
|
// yes, we know it's not there, but that's ok
|
||||||
} catch (ADOException e) {
|
}
|
||||||
|
catch (ADOException e)
|
||||||
|
{
|
||||||
Match m = RE.Match(e.ToString());
|
Match m = RE.Match(e.ToString());
|
||||||
if (m.Success) {
|
if (m.Success)
|
||||||
|
{
|
||||||
// We don't have this table, so create it.
|
// We don't have this table, so create it.
|
||||||
new SchemaExport(cfg).Create(true, true);
|
new SchemaExport(cfg).Create(true, true);
|
||||||
}
|
}
|
||||||
|
@ -113,10 +121,14 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
override public AssetBase FetchAsset(LLUUID uuid)
|
override public AssetBase FetchAsset(LLUUID uuid)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return session.Load(typeof(AssetBase), uuid) as AssetBase;
|
return session.Load(typeof(AssetBase), uuid) as AssetBase;
|
||||||
} catch {
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,9 +136,12 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
override public void CreateAsset(AssetBase asset)
|
override public void CreateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
if (!ExistsAsset(asset.FullID)) {
|
if (!ExistsAsset(asset.FullID))
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Save(asset);
|
session.Save(asset);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
|
@ -136,9 +151,12 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
override public void UpdateAsset(AssetBase asset)
|
override public void UpdateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
if (ExistsAsset(asset.FullID)) {
|
if (ExistsAsset(asset.FullID))
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Update(asset);
|
session.Update(asset);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,8 @@ namespace OpenSim.Data.NHibernate
|
||||||
// Split out the dialect, driver, and connect string
|
// Split out the dialect, driver, and connect string
|
||||||
char[] split = {';'};
|
char[] split = {';'};
|
||||||
string[] parts = connect.Split(split, 3);
|
string[] parts = connect.Split(split, 3);
|
||||||
if (parts.Length != 3) {
|
if (parts.Length != 3)
|
||||||
|
{
|
||||||
// TODO: make this a real exception type
|
// TODO: make this a real exception type
|
||||||
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
||||||
}
|
}
|
||||||
|
@ -94,15 +95,22 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
string regex = @"no such table: Inventory";
|
string regex = @"no such table: Inventory";
|
||||||
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
||||||
try {
|
try
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
session.Load(typeof(InventoryItemBase), LLUUID.Zero);
|
session.Load(typeof(InventoryItemBase), LLUUID.Zero);
|
||||||
}
|
}
|
||||||
} catch (ObjectNotFoundException) {
|
}
|
||||||
|
catch (ObjectNotFoundException)
|
||||||
|
{
|
||||||
// yes, we know it's not there, but that's ok
|
// yes, we know it's not there, but that's ok
|
||||||
} catch (ADOException e) {
|
}
|
||||||
|
catch (ADOException e)
|
||||||
|
{
|
||||||
Match m = RE.Match(e.ToString());
|
Match m = RE.Match(e.ToString());
|
||||||
if (m.Success) {
|
if (m.Success)
|
||||||
|
{
|
||||||
// We don't have this table, so create it.
|
// We don't have this table, so create it.
|
||||||
new SchemaExport(cfg).Create(true, true);
|
new SchemaExport(cfg).Create(true, true);
|
||||||
}
|
}
|
||||||
|
@ -125,10 +133,14 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <returns>A class containing item information</returns>
|
/// <returns>A class containing item information</returns>
|
||||||
public InventoryItemBase getInventoryItem(LLUUID item)
|
public InventoryItemBase getInventoryItem(LLUUID item)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return session.Load(typeof(InventoryItemBase), item) as InventoryItemBase;
|
return session.Load(typeof(InventoryItemBase), item) as InventoryItemBase;
|
||||||
} catch {
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
m_log.ErrorFormat("Couldn't find inventory item: {0}", item);
|
m_log.ErrorFormat("Couldn't find inventory item: {0}", item);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -141,14 +153,19 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="item">The item to be created</param>
|
/// <param name="item">The item to be created</param>
|
||||||
public void addInventoryItem(InventoryItemBase item)
|
public void addInventoryItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
if (!ExistsItem(item.ID)) {
|
if (!ExistsItem(item.ID))
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Save(item);
|
session.Save(item);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists, updating instead", item.ID);
|
m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists, updating instead", item.ID);
|
||||||
updateInventoryItem(item);
|
updateInventoryItem(item);
|
||||||
}
|
}
|
||||||
|
@ -160,14 +177,19 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="item">The updated item</param>
|
/// <param name="item">The updated item</param>
|
||||||
public void updateInventoryItem(InventoryItemBase item)
|
public void updateInventoryItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
if (ExistsItem(item.ID)) {
|
if (ExistsItem(item.ID))
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Update(item);
|
session.Update(item);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists", item.ID);
|
m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists", item.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,15 +200,16 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
public void deleteInventoryItem(LLUUID itemID)
|
public void deleteInventoryItem(LLUUID itemID)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Delete(itemID);
|
session.Delete(itemID);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an inventory folder by its UUID
|
/// Returns an inventory folder by its UUID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -194,10 +217,14 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <returns>A class containing folder information</returns>
|
/// <returns>A class containing folder information</returns>
|
||||||
public InventoryFolderBase getInventoryFolder(LLUUID folder)
|
public InventoryFolderBase getInventoryFolder(LLUUID folder)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return session.Load(typeof(InventoryFolderBase), folder) as InventoryFolderBase;
|
return session.Load(typeof(InventoryFolderBase), folder) as InventoryFolderBase;
|
||||||
} catch {
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
m_log.ErrorFormat("Couldn't find inventory item: {0}", folder);
|
m_log.ErrorFormat("Couldn't find inventory item: {0}", folder);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -210,14 +237,19 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="folder">The folder to be created</param>
|
/// <param name="folder">The folder to be created</param>
|
||||||
public void addInventoryFolder(InventoryFolderBase folder)
|
public void addInventoryFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
if (!ExistsFolder(folder.ID)) {
|
if (!ExistsFolder(folder.ID))
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Save(folder);
|
session.Save(folder);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists, updating instead", folder.ID);
|
m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists, updating instead", folder.ID);
|
||||||
updateInventoryFolder(folder);
|
updateInventoryFolder(folder);
|
||||||
}
|
}
|
||||||
|
@ -229,14 +261,19 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="folder">The updated folder</param>
|
/// <param name="folder">The updated folder</param>
|
||||||
public void updateInventoryFolder(InventoryFolderBase folder)
|
public void updateInventoryFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
if (ExistsFolder(folder.ID)) {
|
if (ExistsFolder(folder.ID))
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Update(folder);
|
session.Update(folder);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists", folder.ID);
|
m_log.ErrorFormat("Attempted to add Inventory Folder {0} that already exists", folder.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,8 +284,10 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="folder"></param>
|
/// <param name="folder"></param>
|
||||||
public void deleteInventoryFolder(LLUUID folderID)
|
public void deleteInventoryFolder(LLUUID folderID)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Delete(folderID.ToString());
|
session.Delete(folderID.ToString());
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
|
@ -324,7 +363,8 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <returns>A List of InventoryItemBase items</returns>
|
/// <returns>A List of InventoryItemBase items</returns>
|
||||||
public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
|
public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
// try {
|
// try {
|
||||||
ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase));
|
ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase));
|
||||||
criteria.Add(Expression.Eq("Folder", folderID));
|
criteria.Add(Expression.Eq("Folder", folderID));
|
||||||
|
@ -334,7 +374,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
// } catch {
|
// }
|
||||||
|
// catch
|
||||||
|
// {
|
||||||
// return new List<InventoryItemBase>();
|
// return new List<InventoryItemBase>();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -348,8 +390,10 @@ namespace OpenSim.Data.NHibernate
|
||||||
// see InventoryItemBase.getUserRootFolder
|
// see InventoryItemBase.getUserRootFolder
|
||||||
public InventoryFolderBase getUserRootFolder(LLUUID user)
|
public InventoryFolderBase getUserRootFolder(LLUUID user)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
// try {
|
{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
|
ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
|
||||||
criteria.Add(Expression.Eq("ParentID", LLUUID.Zero));
|
criteria.Add(Expression.Eq("ParentID", LLUUID.Zero));
|
||||||
criteria.Add(Expression.Eq("Owner", user));
|
criteria.Add(Expression.Eq("Owner", user));
|
||||||
|
@ -359,7 +403,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
}
|
}
|
||||||
m_log.ErrorFormat("No Inventory Root Folder Found for: {0}", user);
|
m_log.ErrorFormat("No Inventory Root Folder Found for: {0}", user);
|
||||||
return new InventoryFolderBase();
|
return new InventoryFolderBase();
|
||||||
// } catch {
|
// }
|
||||||
|
// catch
|
||||||
|
// {
|
||||||
// return new InventoryFolderBase();
|
// return new InventoryFolderBase();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -372,15 +418,19 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="parentID">ID of parent</param>
|
/// <param name="parentID">ID of parent</param>
|
||||||
private void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID)
|
private void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
// try {
|
{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
|
ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
|
||||||
criteria.Add(Expression.Eq("ParentID", parentID));
|
criteria.Add(Expression.Eq("ParentID", parentID));
|
||||||
foreach (InventoryFolderBase item in criteria.List())
|
foreach (InventoryFolderBase item in criteria.List())
|
||||||
{
|
{
|
||||||
folders.Add(item);
|
folders.Add(item);
|
||||||
}
|
}
|
||||||
// } catch {
|
// }
|
||||||
|
// catch
|
||||||
|
// {
|
||||||
// m_log.ErrorFormat("Can't run getInventoryFolders for Folder ID: {0}", parentID);
|
// m_log.ErrorFormat("Can't run getInventoryFolders for Folder ID: {0}", parentID);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,8 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
char[] split = {';'};
|
char[] split = {';'};
|
||||||
string[] parts = connect.Split(split, 3);
|
string[] parts = connect.Split(split, 3);
|
||||||
if (parts.Length != 3) {
|
if (parts.Length != 3)
|
||||||
|
{
|
||||||
// TODO: make this a real exception type
|
// TODO: make this a real exception type
|
||||||
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
||||||
}
|
}
|
||||||
|
@ -87,15 +88,22 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
string regex = @"no such table: UserProfiles";
|
string regex = @"no such table: UserProfiles";
|
||||||
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
||||||
try {
|
try
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
session.Load(typeof(UserProfileData), LLUUID.Zero);
|
session.Load(typeof(UserProfileData), LLUUID.Zero);
|
||||||
}
|
}
|
||||||
} catch (ObjectNotFoundException) {
|
}
|
||||||
|
catch (ObjectNotFoundException)
|
||||||
|
{
|
||||||
// yes, we know it's not there, but that's ok
|
// yes, we know it's not there, but that's ok
|
||||||
} catch (ADOException e) {
|
}
|
||||||
|
catch (ADOException e)
|
||||||
|
{
|
||||||
Match m = RE.Match(e.ToString());
|
Match m = RE.Match(e.ToString());
|
||||||
if (m.Success) {
|
if (m.Success)
|
||||||
|
{
|
||||||
// We don't have this table, so create it.
|
// We don't have this table, so create it.
|
||||||
new SchemaExport(cfg).Create(true, true);
|
new SchemaExport(cfg).Create(true, true);
|
||||||
}
|
}
|
||||||
|
@ -105,12 +113,15 @@ namespace OpenSim.Data.NHibernate
|
||||||
private bool ExistsUser(LLUUID uuid)
|
private bool ExistsUser(LLUUID uuid)
|
||||||
{
|
{
|
||||||
UserProfileData user = null;
|
UserProfileData user = null;
|
||||||
try {
|
try
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
|
user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
|
||||||
}
|
}
|
||||||
// BUG: CATCHALL IS BAD.
|
// BUG: CATCHALL IS BAD.
|
||||||
} catch (Exception) {}
|
}
|
||||||
|
catch (Exception) {}
|
||||||
|
|
||||||
return (user != null);
|
return (user != null);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +130,8 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
UserProfileData user;
|
UserProfileData user;
|
||||||
// TODO: I'm sure I'll have to do something silly here
|
// TODO: I'm sure I'll have to do something silly here
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
|
user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
|
||||||
user.CurrentAgent = GetAgentByUUID(uuid);
|
user.CurrentAgent = GetAgentByUUID(uuid);
|
||||||
}
|
}
|
||||||
|
@ -128,16 +140,21 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
override public void AddNewUserProfile(UserProfileData profile)
|
override public void AddNewUserProfile(UserProfileData profile)
|
||||||
{
|
{
|
||||||
if (!ExistsUser(profile.ID)) {
|
if (!ExistsUser(profile.ID))
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Save(profile);
|
session.Save(profile);
|
||||||
SetAgentData(profile.ID, profile.CurrentAgent, session);
|
SetAgentData(profile.ID, profile.CurrentAgent, session);
|
||||||
// TODO: save agent
|
// TODO: save agent
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_log.ErrorFormat("Attempted to add User {0} {1} that already exists, updating instead", profile.FirstName, profile.SurName);
|
m_log.ErrorFormat("Attempted to add User {0} {1} that already exists, updating instead", profile.FirstName, profile.SurName);
|
||||||
UpdateUserProfile(profile);
|
UpdateUserProfile(profile);
|
||||||
}
|
}
|
||||||
|
@ -165,16 +182,21 @@ namespace OpenSim.Data.NHibernate
|
||||||
}
|
}
|
||||||
override public bool UpdateUserProfile(UserProfileData profile)
|
override public bool UpdateUserProfile(UserProfileData profile)
|
||||||
{
|
{
|
||||||
if (ExistsUser(profile.ID)) {
|
if (ExistsUser(profile.ID))
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Update(profile);
|
session.Update(profile);
|
||||||
SetAgentData(profile.ID, profile.CurrentAgent, session);
|
SetAgentData(profile.ID, profile.CurrentAgent, session);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_log.ErrorFormat("Attempted to update User {0} {1} that doesn't exist, updating instead", profile.FirstName, profile.SurName);
|
m_log.ErrorFormat("Attempted to update User {0} {1} that doesn't exist, updating instead", profile.FirstName, profile.SurName);
|
||||||
AddNewUserProfile(profile);
|
AddNewUserProfile(profile);
|
||||||
return true;
|
return true;
|
||||||
|
@ -183,8 +205,10 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
override public void AddNewUserAgent(UserAgentData agent)
|
override public void AddNewUserAgent(UserAgentData agent)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Save(agent);
|
session.Save(agent);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
|
@ -193,30 +217,35 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
public void UpdateUserAgent(UserAgentData agent)
|
public void UpdateUserAgent(UserAgentData agent)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
{
|
||||||
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
session.Update(agent);
|
session.Update(agent);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override public UserAgentData GetAgentByUUID(LLUUID uuid)
|
override public UserAgentData GetAgentByUUID(LLUUID uuid)
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
using (ISession session = factory.OpenSession()) {
|
{
|
||||||
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
return session.Load(typeof(UserAgentData), uuid) as UserAgentData;
|
return session.Load(typeof(UserAgentData), uuid) as UserAgentData;
|
||||||
}
|
}
|
||||||
} catch {
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override public UserProfileData GetUserByName(string fname, string lname)
|
override public UserProfileData GetUserByName(string fname, string lname)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
ICriteria criteria = session.CreateCriteria(typeof(UserProfileData));
|
ICriteria criteria = session.CreateCriteria(typeof(UserProfileData));
|
||||||
criteria.Add(Expression.Eq("FirstName", fname));
|
criteria.Add(Expression.Eq("FirstName", fname));
|
||||||
criteria.Add(Expression.Eq("SurName", lname));
|
criteria.Add(Expression.Eq("SurName", lname));
|
||||||
|
@ -247,7 +276,8 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
if (querysplit.Length == 2)
|
if (querysplit.Length == 2)
|
||||||
{
|
{
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
ICriteria criteria = session.CreateCriteria(typeof(UserProfileData));
|
ICriteria criteria = session.CreateCriteria(typeof(UserProfileData));
|
||||||
criteria.Add(Expression.Like("FirstName", querysplit[0]));
|
criteria.Add(Expression.Like("FirstName", querysplit[0]));
|
||||||
criteria.Add(Expression.Like("SurName", querysplit[1]));
|
criteria.Add(Expression.Like("SurName", querysplit[1]));
|
||||||
|
@ -280,7 +310,8 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
UserAppearance appearance;
|
UserAppearance appearance;
|
||||||
// TODO: I'm sure I'll have to do something silly here
|
// TODO: I'm sure I'll have to do something silly here
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
appearance = session.Load(typeof(UserAppearance), user) as UserAppearance;
|
appearance = session.Load(typeof(UserAppearance), user) as UserAppearance;
|
||||||
}
|
}
|
||||||
return appearance;
|
return appearance;
|
||||||
|
@ -289,7 +320,8 @@ namespace OpenSim.Data.NHibernate
|
||||||
private bool ExistsAppearance(LLUUID uuid)
|
private bool ExistsAppearance(LLUUID uuid)
|
||||||
{
|
{
|
||||||
UserAppearance appearance;
|
UserAppearance appearance;
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
|
{
|
||||||
appearance = session.Load(typeof(UserAppearance), uuid) as UserAppearance;
|
appearance = session.Load(typeof(UserAppearance), uuid) as UserAppearance;
|
||||||
}
|
}
|
||||||
return (appearance == null) ? false : true;
|
return (appearance == null) ? false : true;
|
||||||
|
@ -299,11 +331,16 @@ namespace OpenSim.Data.NHibernate
|
||||||
override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance)
|
override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance)
|
||||||
{
|
{
|
||||||
bool exists = ExistsAppearance(user);
|
bool exists = ExistsAppearance(user);
|
||||||
using (ISession session = factory.OpenSession()) {
|
using (ISession session = factory.OpenSession())
|
||||||
using (ITransaction transaction = session.BeginTransaction()) {
|
{
|
||||||
if (exists) {
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
|
if (exists)
|
||||||
|
{
|
||||||
session.Update(appearance);
|
session.Update(appearance);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
session.Save(appearance);
|
session.Save(appearance);
|
||||||
}
|
}
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace OpenGridServices.Manager
|
||||||
{
|
{
|
||||||
public partial class MainWindow: Gtk.Window
|
public partial class MainWindow: Gtk.Window
|
||||||
{
|
{
|
||||||
public MainWindow (): base (Gtk.WindowType.Toplevel)
|
public MainWindow() : base (Gtk.WindowType.Toplevel)
|
||||||
{
|
{
|
||||||
Build();
|
Build();
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,13 @@ namespace OpenGridServices.Manager
|
||||||
|
|
||||||
public void SetGridServerConnected(bool connected)
|
public void SetGridServerConnected(bool connected)
|
||||||
{
|
{
|
||||||
if (connected) {
|
if (connected)
|
||||||
|
{
|
||||||
this.ConnectToGridserver.Visible=false;
|
this.ConnectToGridserver.Visible=false;
|
||||||
this.DisconnectFromGridServer.Visible=true;
|
this.DisconnectFromGridServer.Visible=true;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.ConnectToGridserver.Visible=true;
|
this.ConnectToGridserver.Visible=true;
|
||||||
this.DisconnectFromGridServer.Visible=false;
|
this.DisconnectFromGridServer.Visible=false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,24 +35,29 @@
|
||||||
// {
|
// {
|
||||||
|
|
||||||
|
|
||||||
// public float llSin() {
|
// public float llSin()
|
||||||
|
// {
|
||||||
// float f = (float)LSLStack.Pop();
|
// float f = (float)LSLStack.Pop();
|
||||||
// return LSL_Builtins.llSin(f);
|
// return LSL_Builtins.llSin(f);
|
||||||
// }
|
// }
|
||||||
// public float llCos() {
|
// public float llCos()
|
||||||
|
// {
|
||||||
// float f = (float)LSLStack.Pop();
|
// float f = (float)LSLStack.Pop();
|
||||||
// return LSL_Builtins.llCos(f);
|
// return LSL_Builtins.llCos(f);
|
||||||
// }
|
// }
|
||||||
// public float llTan() {
|
// public float llTan()
|
||||||
|
// {
|
||||||
// float f = (float)LSLStack.Pop();
|
// float f = (float)LSLStack.Pop();
|
||||||
// return LSL_Builtins.llTan(f);
|
// return LSL_Builtins.llTan(f);
|
||||||
// }
|
// }
|
||||||
// public float llAtan2() {
|
// public float llAtan2()
|
||||||
|
// {
|
||||||
// float x = (float)LSLStack.Pop();
|
// float x = (float)LSLStack.Pop();
|
||||||
// float y = (float)LSLStack.Pop();
|
// float y = (float)LSLStack.Pop();
|
||||||
// return LSL_Builtins.llAtan2(x, y);
|
// return LSL_Builtins.llAtan2(x, y);
|
||||||
// }
|
// }
|
||||||
// public float llSqrt() {
|
// public float llSqrt()
|
||||||
|
// {
|
||||||
// float f = (float)LSLStack.Pop();
|
// float f = (float)LSLStack.Pop();
|
||||||
// return LSL_Builtins.llSqrt(f);
|
// return LSL_Builtins.llSqrt(f);
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -34,7 +34,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||||
{
|
{
|
||||||
//public System.Collections.Generic.Dictionary<Byte, Type> OpCode_Add_Types;
|
//public System.Collections.Generic.Dictionary<Byte, Type> OpCode_Add_Types;
|
||||||
|
|
||||||
//LSO_Enums() {
|
//LSO_Enums()
|
||||||
|
//{
|
||||||
// OpCode_Add_Types.Add(51, typeof(String));
|
// OpCode_Add_Types.Add(51, typeof(String));
|
||||||
// OpCode_Add_Types.Add(17, typeof(UInt32));
|
// OpCode_Add_Types.Add(17, typeof(UInt32));
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -163,7 +163,8 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
theUser.CurrentAgent.Region = SimInfo.UUID;
|
theUser.CurrentAgent.Region = SimInfo.UUID;
|
||||||
theUser.CurrentAgent.Handle = SimInfo.regionHandle;
|
theUser.CurrentAgent.Handle = SimInfo.regionHandle;
|
||||||
if (start_x >= 0 && start_y >= 0 && start_z >= 0) {
|
if (start_x >= 0 && start_y >= 0 && start_z >= 0)
|
||||||
|
{
|
||||||
LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z);
|
LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z);
|
||||||
theUser.CurrentAgent.Position = tmp_v;
|
theUser.CurrentAgent.Position = tmp_v;
|
||||||
}
|
}
|
||||||
|
|
|
@ -745,13 +745,7 @@ namespace OpenSim
|
||||||
/// <param name="regionnum">The first out parameter describing the number of regions</param>
|
/// <param name="regionnum">The first out parameter describing the number of regions</param>
|
||||||
public void GetRegionNumber(out int regionnum)
|
public void GetRegionNumber(out int regionnum)
|
||||||
{
|
{
|
||||||
int accounter = 0;
|
regionnum = m_sceneManager.Scenes.Count;
|
||||||
//List<string> regionNameList = new List<string>();
|
|
||||||
|
|
||||||
m_sceneManager.ForEachScene(delegate(Scene scene) {
|
|
||||||
accounter++;
|
|
||||||
});
|
|
||||||
regionnum = accounter;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
foreach (ScenePresence pre in presences)
|
foreach (ScenePresence pre in presences)
|
||||||
{
|
{
|
||||||
IClientAPI client = pre.ControllingClient;
|
IClientAPI client = pre.ControllingClient;
|
||||||
//if (pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
|
//if (pre.MovementFlag!=0 && client.PacketProcessingEnabled==true)
|
||||||
if (client.IsActive)
|
if (client.IsActive)
|
||||||
{
|
{
|
||||||
get_scene_presence_filter++;
|
get_scene_presence_filter++;
|
||||||
|
@ -160,7 +160,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
|
||||||
foreach (ScenePresence pre in avatars)
|
foreach (ScenePresence pre in avatars)
|
||||||
{
|
{
|
||||||
IClientAPI client = pre.ControllingClient;
|
IClientAPI client = pre.ControllingClient;
|
||||||
//if (pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
|
//if (pre.MovementFlag!=0 && client.PacketProcessingEnabled==true)
|
||||||
if (client.IsActive)
|
if (client.IsActive)
|
||||||
{
|
{
|
||||||
get_avatar_filter++;
|
get_avatar_filter++;
|
||||||
|
|
Loading…
Reference in New Issue