* Unforunately it turns out not to be that simple. Revert the rest of r7560 for now.
parent
3b143088c0
commit
80520206fc
|
@ -82,7 +82,6 @@ namespace OpenSim.Data
|
||||||
// private static readonly string _migrations_init = "insert into migrations values('migrations', 1)";
|
// private static readonly string _migrations_init = "insert into migrations values('migrations', 1)";
|
||||||
// private static readonly string _migrations_find = "select version from migrations where name='migrations'";
|
// private static readonly string _migrations_find = "select version from migrations where name='migrations'";
|
||||||
|
|
||||||
|
|
||||||
public Migration(DbConnection conn, Assembly assem, string type)
|
public Migration(DbConnection conn, Assembly assem, string type)
|
||||||
{
|
{
|
||||||
_type = type;
|
_type = type;
|
||||||
|
@ -113,7 +112,6 @@ namespace OpenSim.Data
|
||||||
DbCommand cmd = _conn.CreateCommand();
|
DbCommand cmd = _conn.CreateCommand();
|
||||||
cmd.CommandText = _migrations_create;
|
cmd.CommandText = _migrations_create;
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Dispose();
|
|
||||||
|
|
||||||
InsertVersion("migrations", 1);
|
InsertVersion("migrations", 1);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +135,7 @@ namespace OpenSim.Data
|
||||||
int newversion = kvp.Key;
|
int newversion = kvp.Key;
|
||||||
cmd.CommandText = kvp.Value;
|
cmd.CommandText = kvp.Value;
|
||||||
// we need to up the command timeout to infinite as we might be doing long migrations.
|
// we need to up the command timeout to infinite as we might be doing long migrations.
|
||||||
//cmd.CommandTimeout = 0;
|
cmd.CommandTimeout = 0;
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
if (version == 0)
|
if (version == 0)
|
||||||
|
@ -149,7 +147,6 @@ namespace OpenSim.Data
|
||||||
UpdateVersion(_type, newversion);
|
UpdateVersion(_type, newversion);
|
||||||
}
|
}
|
||||||
version = newversion;
|
version = newversion;
|
||||||
cmd.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +189,7 @@ namespace OpenSim.Data
|
||||||
DbCommand cmd = conn.CreateCommand();
|
DbCommand cmd = conn.CreateCommand();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc";
|
cmd.CommandText = "select version from migrations where name='" + type + "' limit 1";
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
|
@ -206,7 +203,6 @@ namespace OpenSim.Data
|
||||||
{
|
{
|
||||||
// Something went wrong, so we're version 0
|
// Something went wrong, so we're version 0
|
||||||
}
|
}
|
||||||
cmd.Dispose();
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +212,6 @@ namespace OpenSim.Data
|
||||||
cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")";
|
cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")";
|
||||||
m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version);
|
m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateVersion(string type, int version)
|
private void UpdateVersion(string type, int version)
|
||||||
|
@ -225,7 +220,6 @@ namespace OpenSim.Data
|
||||||
cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'";
|
cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'";
|
||||||
m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version);
|
m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private SortedList<int, string> GetAllMigrations()
|
// private SortedList<int, string> GetAllMigrations()
|
||||||
|
|
|
@ -78,11 +78,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
int w = rs.GetOrdinal(names[3]);
|
int w = rs.GetOrdinal(names[3]);
|
||||||
if (!rs.IsDBNull(x))
|
if (!rs.IsDBNull(x))
|
||||||
{
|
{
|
||||||
float X = (Single)Convert.ToDouble(rs[x].ToString());
|
quat = new Quaternion((Single)rs[x], (Single)rs[y], (Single)rs[z], (Single)rs[w]);
|
||||||
float Y = (Single)Convert.ToDouble(rs[y].ToString());
|
|
||||||
float Z = (Single)Convert.ToDouble(rs[z].ToString());
|
|
||||||
float W = (Single)Convert.ToDouble(rs[w].ToString());
|
|
||||||
quat = new Quaternion(X, Y, Z, W);
|
|
||||||
}
|
}
|
||||||
return quat;
|
return quat;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
int x = rs.GetOrdinal(names[0]);
|
int x = rs.GetOrdinal(names[0]);
|
||||||
int y = rs.GetOrdinal(names[1]);
|
int y = rs.GetOrdinal(names[1]);
|
||||||
int z = rs.GetOrdinal(names[2]);
|
int z = rs.GetOrdinal(names[2]);
|
||||||
if (!rs.IsDBNull(x) && !rs.IsDBNull(y) && !rs.IsDBNull(z))
|
if (!rs.IsDBNull(x))
|
||||||
{
|
{
|
||||||
float X = (Single)Convert.ToDouble(rs[x].ToString());
|
vector = new Vector3((Single)rs[x], (Single)rs[y], (Single)rs[z]);
|
||||||
float Y = (Single)Convert.ToDouble(rs[y].ToString());
|
|
||||||
float Z = (Single)Convert.ToDouble(rs[z].ToString());
|
|
||||||
vector = new Vector3(X, Y, Z);
|
|
||||||
}
|
}
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,10 @@ using System.Text.RegularExpressions;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
|
using NHibernate.Cfg;
|
||||||
|
using NHibernate.Expression;
|
||||||
using NHibernate.Mapping.Attributes;
|
using NHibernate.Mapping.Attributes;
|
||||||
|
using NHibernate.Tool.hbm2ddl;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Environment=NHibernate.Cfg.Environment;
|
using Environment=NHibernate.Cfg.Environment;
|
||||||
|
|
||||||
|
@ -46,7 +49,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private NHibernateManager manager;
|
private Configuration cfg;
|
||||||
|
private ISessionFactory factory;
|
||||||
|
private ISession session;
|
||||||
|
|
||||||
override public void Dispose() { }
|
override public void Dispose() { }
|
||||||
|
|
||||||
|
@ -57,23 +62,79 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
public override void Initialise(string connect)
|
public override void Initialise(string connect)
|
||||||
{
|
{
|
||||||
|
// Split out the dialect, driver, and connect string
|
||||||
|
char[] split = {';'};
|
||||||
|
string[] parts = connect.Split(split, 3);
|
||||||
|
if (parts.Length != 3)
|
||||||
|
{
|
||||||
|
// TODO: make this a real exception type
|
||||||
|
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
||||||
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[NHIBERNATE] Initializing NHibernateAssetData");
|
string dialect = parts[0];
|
||||||
manager = new NHibernateManager(connect, "AssetStore");
|
|
||||||
|
// NHibernate setup
|
||||||
|
cfg = new Configuration();
|
||||||
|
cfg.SetProperty(Environment.ConnectionProvider,
|
||||||
|
"NHibernate.Connection.DriverConnectionProvider");
|
||||||
|
cfg.SetProperty(Environment.Dialect,
|
||||||
|
"NHibernate.Dialect." + dialect);
|
||||||
|
cfg.SetProperty(Environment.ConnectionDriver,
|
||||||
|
"NHibernate.Driver." + parts[1]);
|
||||||
|
cfg.SetProperty(Environment.ConnectionString, parts[2]);
|
||||||
|
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HbmSerializer.Default.Validate = true;
|
||||||
|
using (MemoryStream stream =
|
||||||
|
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
|
||||||
|
cfg.AddInputStream(stream);
|
||||||
|
|
||||||
|
factory = cfg.BuildSessionFactory();
|
||||||
|
session = factory.OpenSession();
|
||||||
|
|
||||||
|
// This actually does the roll forward assembly stuff
|
||||||
|
Assembly assem = GetType().Assembly;
|
||||||
|
Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore");
|
||||||
|
m.Update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override public AssetBase FetchAsset(UUID uuid)
|
override public AssetBase FetchAsset(UUID uuid)
|
||||||
{
|
{
|
||||||
return (AssetBase)manager.Load(typeof(AssetBase), uuid);
|
try
|
||||||
|
{
|
||||||
|
return session.Load(typeof(AssetBase), uuid) as AssetBase;
|
||||||
|
}
|
||||||
|
catch (ObjectNotFoundException)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[NHIBERNATE] no such asset {0}", uuid);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error("[NHIBERNATE] unexpected exception: ", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Save(AssetBase asset)
|
private void Save(AssetBase asset)
|
||||||
{
|
{
|
||||||
AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.FullID);
|
try
|
||||||
if (temp == null)
|
|
||||||
{
|
{
|
||||||
manager.Save(asset);
|
// a is not used anywhere?
|
||||||
|
// AssetBase a = session.Load(typeof(AssetBase), asset.FullID) as AssetBase;
|
||||||
|
session.Load(typeof(AssetBase), asset.FullID);
|
||||||
|
}
|
||||||
|
catch (ObjectNotFoundException)
|
||||||
|
{
|
||||||
|
session.Save(asset);
|
||||||
|
session.Flush();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error("[NHIBERNATE] issue saving asset", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +147,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
override public void UpdateAsset(AssetBase asset)
|
override public void UpdateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID);
|
m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID);
|
||||||
manager.Update(asset);
|
Save(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void LogAssetLoad(AssetBase asset)
|
// private void LogAssetLoad(AssetBase asset)
|
||||||
|
|
|
@ -33,7 +33,10 @@ using System.Text.RegularExpressions;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
using NHibernate.Criterion;
|
using NHibernate.Cfg;
|
||||||
|
using NHibernate.Expression;
|
||||||
|
using NHibernate.Mapping.Attributes;
|
||||||
|
using NHibernate.Tool.hbm2ddl;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Environment=NHibernate.Cfg.Environment;
|
using Environment=NHibernate.Cfg.Environment;
|
||||||
|
|
||||||
|
@ -43,7 +46,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private NHibernateManager manager;
|
private Configuration cfg;
|
||||||
|
private ISessionFactory factory;
|
||||||
|
private ISession session;
|
||||||
|
|
||||||
public void Initialise()
|
public void Initialise()
|
||||||
{
|
{
|
||||||
|
@ -56,8 +61,35 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialise(string connect)
|
public void Initialise(string connect)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] Initializing NHibernateInventoryData");
|
// Split out the dialect, driver, and connect string
|
||||||
manager = new NHibernateManager(connect, "InventoryStore");
|
char[] split = {';'};
|
||||||
|
string[] parts = connect.Split(split, 3);
|
||||||
|
if (parts.Length != 3)
|
||||||
|
{
|
||||||
|
// TODO: make this a real exception type
|
||||||
|
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
||||||
|
}
|
||||||
|
string dialect = parts[0];
|
||||||
|
|
||||||
|
// Establish NHibernate Connection
|
||||||
|
cfg = new Configuration();
|
||||||
|
cfg.SetProperty(Environment.ConnectionProvider,
|
||||||
|
"NHibernate.Connection.DriverConnectionProvider");
|
||||||
|
cfg.SetProperty(Environment.Dialect,
|
||||||
|
"NHibernate.Dialect." + parts[0]);
|
||||||
|
cfg.SetProperty(Environment.ConnectionDriver,
|
||||||
|
"NHibernate.Driver." + parts[1]);
|
||||||
|
cfg.SetProperty(Environment.ConnectionString, parts[2]);
|
||||||
|
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
||||||
|
|
||||||
|
factory = cfg.BuildSessionFactory();
|
||||||
|
session = factory.OpenSession();
|
||||||
|
|
||||||
|
// This actually does the roll forward assembly stuff
|
||||||
|
Assembly assem = GetType().Assembly;
|
||||||
|
Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "InventoryStore");
|
||||||
|
m.Update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
|
@ -77,8 +109,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] getInventoryItem {0}", item);
|
return session.Load(typeof(InventoryItemBase), item) as InventoryItemBase;
|
||||||
return (InventoryItemBase)manager.Load(typeof(InventoryItemBase), item);
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -95,11 +126,15 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
if (!ExistsItem(item.ID))
|
if (!ExistsItem(item.ID))
|
||||||
{
|
{
|
||||||
manager.Save(item);
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
|
session.Save(item);
|
||||||
|
transaction.Commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[NHIBERNATE] 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,11 +147,15 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
if (ExistsItem(item.ID))
|
if (ExistsItem(item.ID))
|
||||||
{
|
{
|
||||||
manager.Update(item);
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
|
session.Update(item);
|
||||||
|
transaction.Commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[NHIBERNATE] 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,16 +165,11 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
public void deleteInventoryItem(UUID itemID)
|
public void deleteInventoryItem(UUID itemID)
|
||||||
{
|
{
|
||||||
InventoryItemBase item = (InventoryItemBase)manager.Load(typeof(InventoryItemBase), itemID);
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
if (item != null)
|
|
||||||
{
|
{
|
||||||
manager.Delete(item);
|
session.Delete(itemID);
|
||||||
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[NHIBERNATE] Error deleting InventoryItemBase {0}", itemID);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -147,11 +181,11 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (InventoryFolderBase)manager.Load(typeof(InventoryFolderBase), folder);
|
return session.Load(typeof(InventoryFolderBase), folder) as InventoryFolderBase;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[NHIBERNATE] Couldn't find inventory item: {0}", folder);
|
m_log.ErrorFormat("Couldn't find inventory item: {0}", folder);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,11 +198,15 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
if (!ExistsFolder(folder.ID))
|
if (!ExistsFolder(folder.ID))
|
||||||
{
|
{
|
||||||
manager.Save(folder);
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
|
session.Save(folder);
|
||||||
|
transaction.Commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[NHIBERNATE] 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,11 +219,15 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
if (ExistsFolder(folder.ID))
|
if (ExistsFolder(folder.ID))
|
||||||
{
|
{
|
||||||
manager.Update(folder);
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
|
{
|
||||||
|
session.Update(folder);
|
||||||
|
transaction.Commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[NHIBERNATE] 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,16 +237,11 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="folder"></param>
|
/// <param name="folder"></param>
|
||||||
public void deleteInventoryFolder(UUID folderID)
|
public void deleteInventoryFolder(UUID folderID)
|
||||||
{
|
{
|
||||||
InventoryFolderBase item = (InventoryFolderBase)manager.Load(typeof(InventoryFolderBase), folderID);
|
using (ITransaction transaction = session.BeginTransaction())
|
||||||
if (item != null)
|
|
||||||
{
|
{
|
||||||
manager.Delete(item);
|
session.Delete(folderID.ToString());
|
||||||
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[NHIBERNATE] Error deleting InventoryFolderBase {0}", folderID);
|
|
||||||
}
|
|
||||||
manager.Delete(folderID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// useful private methods
|
// useful private methods
|
||||||
|
@ -280,7 +317,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
||||||
{
|
{
|
||||||
// try {
|
// try {
|
||||||
ICriteria criteria = manager.GetSession().CreateCriteria(typeof(InventoryItemBase));
|
ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase));
|
||||||
criteria.Add(Expression.Eq("Folder", folderID));
|
criteria.Add(Expression.Eq("Folder", folderID));
|
||||||
List<InventoryItemBase> list = new List<InventoryItemBase>();
|
List<InventoryItemBase> list = new List<InventoryItemBase>();
|
||||||
foreach (InventoryItemBase item in criteria.List())
|
foreach (InventoryItemBase item in criteria.List())
|
||||||
|
@ -303,7 +340,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
// see InventoryItemBase.getUserRootFolder
|
// see InventoryItemBase.getUserRootFolder
|
||||||
public InventoryFolderBase getUserRootFolder(UUID user)
|
public InventoryFolderBase getUserRootFolder(UUID user)
|
||||||
{
|
{
|
||||||
ICriteria criteria = manager.GetSession().CreateCriteria(typeof(InventoryFolderBase));
|
ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
|
||||||
criteria.Add(Expression.Eq("ParentID", UUID.Zero));
|
criteria.Add(Expression.Eq("ParentID", UUID.Zero));
|
||||||
criteria.Add(Expression.Eq("Owner", user));
|
criteria.Add(Expression.Eq("Owner", user));
|
||||||
foreach (InventoryFolderBase folder in criteria.List())
|
foreach (InventoryFolderBase folder in criteria.List())
|
||||||
|
@ -321,7 +358,7 @@ 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, UUID parentID)
|
private void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID)
|
||||||
{
|
{
|
||||||
ICriteria criteria = manager.GetSession().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())
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,141 +25,35 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.IO;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
using NHibernate.Cfg;
|
|
||||||
using NHibernate.Mapping.Attributes;
|
|
||||||
using NHibernate.Tool.hbm2ddl;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using Environment = NHibernate.Cfg.Environment;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.NHibernate
|
namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
public class NHibernateManager
|
internal class NHibernateManager
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private string dialect;
|
// private ISessionFactory factory;
|
||||||
private Configuration cfg;
|
// private ISession session;
|
||||||
private ISessionFactory factory;
|
// private ITransaction transaction;
|
||||||
private ISession session;
|
|
||||||
|
|
||||||
public NHibernateManager(string connect, string store)
|
public NHibernateManager()
|
||||||
{
|
{
|
||||||
|
// This is stubbing for now, it will become dynamic later and support different db backends
|
||||||
|
// NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
|
||||||
|
// cfg.Properties[NHibernate.Cfg.Environment.ConnectionProvider] =
|
||||||
|
// "NHibernate.Connection.DriverConnectionProvider";
|
||||||
|
// cfg.Properties[NHibernate.Cfg.Environment.Dialect] =
|
||||||
|
// "NHibernate.Dialect.SQLite";
|
||||||
|
// cfg.Properties[NHibernate.Cfg.Environment.ConnectionDriver] =
|
||||||
|
// "NHibernate.Driver.SqliteClientDriver";
|
||||||
|
// cfg.Properties[NHibernate.Cfg.Environment.ConnectionString] =
|
||||||
|
// "URI=file:opensim-nh.db,version=3";
|
||||||
|
|
||||||
// Split out the dialect, driver, and connect string
|
// factory = cfg.BuildSessionFactory();
|
||||||
char[] split = { ';' };
|
|
||||||
string[] parts = connect.Split(split, 3);
|
|
||||||
if (parts.Length != 3)
|
|
||||||
{
|
|
||||||
// TODO: make this a real exception type
|
|
||||||
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
dialect = parts[0];
|
|
||||||
|
|
||||||
// NHibernate setup
|
|
||||||
cfg = new Configuration();
|
|
||||||
cfg.SetProperty(Environment.ConnectionProvider,
|
|
||||||
"NHibernate.Connection.DriverConnectionProvider");
|
|
||||||
cfg.SetProperty(Environment.Dialect,
|
|
||||||
"NHibernate.Dialect." + dialect);
|
|
||||||
cfg.SetProperty(Environment.ConnectionDriver,
|
|
||||||
"NHibernate.Driver." + parts[1]);
|
|
||||||
cfg.SetProperty(Environment.ConnectionString, parts[2]);
|
|
||||||
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
|
||||||
|
|
||||||
//To create sql file uncomment code below and write the name of the file
|
|
||||||
//SchemaExport exp = new SchemaExport(cfg);
|
|
||||||
//exp.SetOutputFile("nameofthefile.sql");
|
|
||||||
//exp.Create(false, true);
|
|
||||||
|
|
||||||
HbmSerializer.Default.Validate = true;
|
|
||||||
using (MemoryStream stream =
|
|
||||||
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
|
|
||||||
cfg.AddInputStream(stream);
|
|
||||||
|
|
||||||
factory = cfg.BuildSessionFactory();
|
|
||||||
session = factory.OpenSession();
|
|
||||||
|
|
||||||
Assembly assem = GetType().Assembly;
|
|
||||||
Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, store);
|
|
||||||
m.Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Load(Type type, UUID uuid)
|
|
||||||
{
|
|
||||||
object obj = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
obj = session.Load(type, uuid);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[NHIBERNATE] {0} not found with ID {1} ", type.Name, uuid);
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Save(object obj)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
session.BeginTransaction();
|
|
||||||
session.Save(obj);
|
|
||||||
session.Transaction.Commit();
|
|
||||||
session.Flush();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error("[NHIBERNATE] issue saving object ", e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(object obj)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
session.BeginTransaction();
|
|
||||||
session.Update(obj);
|
|
||||||
session.Transaction.Commit();
|
|
||||||
session.Flush();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error("[NHIBERNATE] issue updating object ", e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(object obj)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
session.BeginTransaction();
|
|
||||||
session.Delete(obj);
|
|
||||||
session.Transaction.Commit();
|
|
||||||
session.Flush();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
m_log.Error("[NHIBERNATE] issue deleting object ", e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ISession GetSession()
|
|
||||||
{
|
|
||||||
return session;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,10 @@ using System.Text.RegularExpressions;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
using NHibernate.Criterion;
|
using NHibernate.Cfg;
|
||||||
|
using NHibernate.Expression;
|
||||||
|
using NHibernate.Mapping.Attributes;
|
||||||
|
using NHibernate.Tool.hbm2ddl;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
@ -49,12 +52,51 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private NHibernateManager manager;
|
private Configuration cfg;
|
||||||
|
private ISessionFactory factory;
|
||||||
|
private ISession session;
|
||||||
|
|
||||||
|
// public void Initialise()
|
||||||
|
// {
|
||||||
|
// Initialise("SQLiteDialect;SqliteClientDriver;URI=file:OpenSim.db,version=3", true);
|
||||||
|
// }
|
||||||
|
|
||||||
public void Initialise(string connect)
|
public void Initialise(string connect)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] Initializing NHibernateRegionData");
|
// Split out the dialect, driver, and connect string
|
||||||
manager = new NHibernateManager(connect, "RegionStore");
|
char[] split = {';'};
|
||||||
|
string[] parts = connect.Split(split, 3);
|
||||||
|
if (parts.Length != 3)
|
||||||
|
{
|
||||||
|
// TODO: make this a real exception type
|
||||||
|
throw new Exception("Malformed Region connection string '" + connect + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
string dialect = parts[0];
|
||||||
|
|
||||||
|
// NHibernate setup
|
||||||
|
cfg = new Configuration();
|
||||||
|
cfg.SetProperty(Environment.ConnectionProvider,
|
||||||
|
"NHibernate.Connection.DriverConnectionProvider");
|
||||||
|
cfg.SetProperty(Environment.Dialect,
|
||||||
|
"NHibernate.Dialect." + dialect);
|
||||||
|
cfg.SetProperty(Environment.ConnectionDriver,
|
||||||
|
"NHibernate.Driver." + parts[1]);
|
||||||
|
cfg.SetProperty(Environment.ConnectionString, parts[2]);
|
||||||
|
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
||||||
|
|
||||||
|
HbmSerializer.Default.Validate = true;
|
||||||
|
using (MemoryStream stream =
|
||||||
|
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
|
||||||
|
cfg.AddInputStream(stream);
|
||||||
|
|
||||||
|
factory = cfg.BuildSessionFactory();
|
||||||
|
session = factory.OpenSession();
|
||||||
|
|
||||||
|
// This actually does the roll forward assembly stuff
|
||||||
|
Assembly assem = GetType().Assembly;
|
||||||
|
Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "RegionStore");
|
||||||
|
m.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -80,18 +122,15 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SceneObjectPart old = (SceneObjectPart)manager.Load(typeof(SceneObjectPart), p.UUID);
|
SceneObjectPart old = session.Load(typeof(SceneObjectPart), p.UUID) as SceneObjectPart;
|
||||||
if (old != null)
|
session.Evict(old);
|
||||||
{
|
session.Update(p);
|
||||||
m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID);
|
m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID);
|
||||||
manager.Update(old);
|
}
|
||||||
}
|
catch (ObjectNotFoundException)
|
||||||
else
|
{
|
||||||
{
|
m_log.InfoFormat("[NHIBERNATE] saving object {0}", p.UUID);
|
||||||
m_log.InfoFormat("[NHIBERNATE] saving object {0}", p.UUID);
|
session.Save(p);
|
||||||
manager.Save(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -103,19 +142,15 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Terrain old = session.Load(typeof(Terrain), t.RegionID) as Terrain;
|
||||||
Terrain old = (Terrain)manager.Load(typeof(Terrain), t.RegionID);
|
session.Evict(old);
|
||||||
if (old != null)
|
session.Update(t);
|
||||||
{
|
session.Flush();
|
||||||
m_log.InfoFormat("[NHIBERNATE] updating terrain {0}", t.RegionID);
|
}
|
||||||
manager.Update(old);
|
catch (ObjectNotFoundException)
|
||||||
}
|
{
|
||||||
else
|
session.Save(t);
|
||||||
{
|
session.Flush();
|
||||||
m_log.InfoFormat("[NHIBERNATE] saving terrain {0}", t.RegionID);
|
|
||||||
manager.Save(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +173,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
m_log.InfoFormat("Storing part {0}", part.UUID);
|
m_log.InfoFormat("Storing part {0}", part.UUID);
|
||||||
SaveOrUpdate(part);
|
SaveOrUpdate(part);
|
||||||
}
|
}
|
||||||
|
session.Flush();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -149,7 +185,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
SceneObjectGroup group = new SceneObjectGroup();
|
SceneObjectGroup group = new SceneObjectGroup();
|
||||||
|
|
||||||
ICriteria criteria = manager.GetSession().CreateCriteria(typeof(SceneObjectPart));
|
ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart));
|
||||||
criteria.Add(Expression.Eq("RegionID", region));
|
criteria.Add(Expression.Eq("RegionID", region));
|
||||||
criteria.Add(Expression.Eq("ParentUUID", uuid));
|
criteria.Add(Expression.Eq("ParentUUID", uuid));
|
||||||
criteria.AddOrder( Order.Asc("ParentID") );
|
criteria.AddOrder( Order.Asc("ParentID") );
|
||||||
|
@ -180,8 +216,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
SceneObjectGroup g = LoadObject(obj, regionUUID);
|
SceneObjectGroup g = LoadObject(obj, regionUUID);
|
||||||
foreach (SceneObjectPart p in g.Children.Values)
|
foreach (SceneObjectPart p in g.Children.Values)
|
||||||
{
|
{
|
||||||
manager.Delete(p);
|
session.Delete(p);
|
||||||
}
|
}
|
||||||
|
session.Flush();
|
||||||
|
|
||||||
m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID);
|
m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID);
|
||||||
|
|
||||||
|
@ -197,7 +234,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
Dictionary<UUID, SceneObjectGroup> SOG = new Dictionary<UUID, SceneObjectGroup>();
|
Dictionary<UUID, SceneObjectGroup> SOG = new Dictionary<UUID, SceneObjectGroup>();
|
||||||
List<SceneObjectGroup> ret = new List<SceneObjectGroup>();
|
List<SceneObjectGroup> ret = new List<SceneObjectGroup>();
|
||||||
|
|
||||||
ICriteria criteria = manager.GetSession().CreateCriteria(typeof(SceneObjectPart));
|
ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart));
|
||||||
criteria.Add(Expression.Eq("RegionID", regionUUID));
|
criteria.Add(Expression.Eq("RegionID", regionUUID));
|
||||||
criteria.AddOrder( Order.Asc("ParentID") );
|
criteria.AddOrder( Order.Asc("ParentID") );
|
||||||
foreach (SceneObjectPart p in criteria.List())
|
foreach (SceneObjectPart p in criteria.List())
|
||||||
|
@ -215,7 +252,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
}
|
}
|
||||||
// get the inventory
|
// get the inventory
|
||||||
|
|
||||||
ICriteria InvCriteria = manager.GetSession().CreateCriteria(typeof(TaskInventoryItem));
|
ICriteria InvCriteria = session.CreateCriteria(typeof(TaskInventoryItem));
|
||||||
InvCriteria.Add(Expression.Eq("ParentPartID", p.UUID));
|
InvCriteria.Add(Expression.Eq("ParentPartID", p.UUID));
|
||||||
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
|
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
|
||||||
foreach (TaskInventoryItem i in InvCriteria.List())
|
foreach (TaskInventoryItem i in InvCriteria.List())
|
||||||
|
@ -254,14 +291,16 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <returns>Heightfield data</returns>
|
/// <returns>Heightfield data</returns>
|
||||||
public double[,] LoadTerrain(UUID regionID)
|
public double[,] LoadTerrain(UUID regionID)
|
||||||
{
|
{
|
||||||
Terrain t = (Terrain)manager.Load(typeof(Terrain), regionID);
|
try
|
||||||
if (t != null)
|
|
||||||
{
|
{
|
||||||
|
Terrain t = session.Load(typeof(Terrain), regionID) as Terrain;
|
||||||
return t.Doubles;
|
return t.Doubles;
|
||||||
}
|
}
|
||||||
|
catch (ObjectNotFoundException)
|
||||||
m_log.Info("No terrain yet");
|
{
|
||||||
return null;
|
m_log.Info("No terrain yet");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -300,7 +339,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Shutdown()
|
public void Shutdown()
|
||||||
{
|
{
|
||||||
//session.Flush();
|
session.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -358,20 +397,21 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// <param name="items"></param>
|
/// <param name="items"></param>
|
||||||
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
||||||
{
|
{
|
||||||
ICriteria criteria = manager.GetSession().CreateCriteria(typeof(TaskInventoryItem));
|
ICriteria criteria = session.CreateCriteria(typeof(TaskInventoryItem));
|
||||||
criteria.Add(Expression.Eq("ParentPartID", primID));
|
criteria.Add(Expression.Eq("ParentPartID", primID));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem i in criteria.List())
|
foreach (TaskInventoryItem i in criteria.List())
|
||||||
{
|
{
|
||||||
manager.Delete(i);
|
session.Delete(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TaskInventoryItem i in items)
|
foreach (TaskInventoryItem i in items)
|
||||||
{
|
{
|
||||||
manager.Save(i);
|
session.Save(i);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
session.Flush();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,10 @@ using System.Text.RegularExpressions;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
using NHibernate.Criterion;
|
using NHibernate.Cfg;
|
||||||
|
using NHibernate.Expression;
|
||||||
|
using NHibernate.Mapping.Attributes;
|
||||||
|
using NHibernate.Tool.hbm2ddl;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Environment=NHibernate.Cfg.Environment;
|
using Environment=NHibernate.Cfg.Environment;
|
||||||
|
|
||||||
|
@ -46,7 +49,9 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private NHibernateManager manager;
|
private Configuration cfg;
|
||||||
|
private ISessionFactory factory;
|
||||||
|
private ISession session;
|
||||||
|
|
||||||
public override void Initialise()
|
public override void Initialise()
|
||||||
{
|
{
|
||||||
|
@ -56,40 +61,62 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
public override void Initialise(string connect)
|
public override void Initialise(string connect)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] Initializing NHibernateUserData");
|
char[] split = {';'};
|
||||||
manager = new NHibernateManager(connect, "UserStore");
|
string[] parts = connect.Split(split, 3);
|
||||||
|
if (parts.Length != 3)
|
||||||
|
{
|
||||||
|
// TODO: make this a real exception type
|
||||||
|
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
||||||
|
}
|
||||||
|
string dialect = parts[0];
|
||||||
|
|
||||||
|
// This is stubbing for now, it will become dynamic later and support different db backends
|
||||||
|
cfg = new Configuration();
|
||||||
|
cfg.SetProperty(Environment.ConnectionProvider,
|
||||||
|
"NHibernate.Connection.DriverConnectionProvider");
|
||||||
|
cfg.SetProperty(Environment.Dialect,
|
||||||
|
"NHibernate.Dialect." + parts[0]);
|
||||||
|
cfg.SetProperty(Environment.ConnectionDriver,
|
||||||
|
"NHibernate.Driver." + parts[1]);
|
||||||
|
cfg.SetProperty(Environment.ConnectionString, parts[2]);
|
||||||
|
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
||||||
|
|
||||||
|
factory = cfg.BuildSessionFactory();
|
||||||
|
session = factory.OpenSession();
|
||||||
|
|
||||||
|
// This actually does the roll forward assembly stuff
|
||||||
|
Assembly assem = GetType().Assembly;
|
||||||
|
Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "UserStore");
|
||||||
|
m.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ExistsUser(UUID uuid)
|
private bool ExistsUser(UUID uuid)
|
||||||
{
|
{
|
||||||
UserProfileData user = null;
|
UserProfileData user = null;
|
||||||
|
try
|
||||||
m_log.InfoFormat("[NHIBERNATE] ExistsUser; {0}", uuid);
|
|
||||||
user = (UserProfileData)manager.Load(typeof(UserProfileData), uuid);
|
|
||||||
|
|
||||||
if (user == null)
|
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] User with given UUID does not exist {0} ", uuid);
|
user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
|
||||||
return false;
|
}
|
||||||
|
catch (ObjectNotFoundException)
|
||||||
|
{
|
||||||
|
user = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return (user != null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override public UserProfileData GetUserByUUID(UUID uuid)
|
override public UserProfileData GetUserByUUID(UUID uuid)
|
||||||
{
|
{
|
||||||
UserProfileData user;
|
UserProfileData user;
|
||||||
m_log.InfoFormat("[NHIBERNATE] GetUserByUUID: {0} ", uuid);
|
// TODO: I'm sure I'll have to do something silly here
|
||||||
|
try
|
||||||
user = (UserProfileData)manager.Load(typeof(UserProfileData), uuid);
|
|
||||||
if (user != null)
|
|
||||||
{
|
{
|
||||||
UserAgentData agent = GetAgentByUUID(uuid);
|
user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
|
||||||
if (agent != null)
|
user.CurrentAgent = GetAgentByUUID(uuid);
|
||||||
{
|
}
|
||||||
user.CurrentAgent = agent;
|
catch (ObjectNotFoundException)
|
||||||
}
|
{
|
||||||
|
user = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
|
@ -99,30 +126,33 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
if (!ExistsUser(profile.ID))
|
if (!ExistsUser(profile.ID))
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] AddNewUserProfile {0}", profile.ID);
|
session.Save(profile);
|
||||||
manager.Save(profile);
|
|
||||||
SetAgentData(profile.ID, profile.CurrentAgent);
|
SetAgentData(profile.ID, profile.CurrentAgent);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[NHIBERNATE] 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAgentData(UUID uuid, UserAgentData agent)
|
private void SetAgentData(UUID uuid, UserAgentData agent)
|
||||||
{
|
{
|
||||||
UserAgentData old = (UserAgentData)manager.Load(typeof(UserAgentData), uuid);
|
if (agent == null)
|
||||||
if (old != null)
|
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] SetAgentData deleting old: {0} ",uuid);
|
// TODO: got to figure out how to do a delete right
|
||||||
manager.Delete(old);
|
|
||||||
}
|
}
|
||||||
if (agent != null)
|
else
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] SetAgentData: {0} ", agent.ProfileID);
|
try
|
||||||
manager.Save(agent);
|
{
|
||||||
|
UserAgentData old = session.Load(typeof(UserAgentData), uuid) as UserAgentData;
|
||||||
|
session.Delete(old);
|
||||||
|
}
|
||||||
|
catch (ObjectNotFoundException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
session.Save(agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -130,13 +160,13 @@ namespace OpenSim.Data.NHibernate
|
||||||
{
|
{
|
||||||
if (ExistsUser(profile.ID))
|
if (ExistsUser(profile.ID))
|
||||||
{
|
{
|
||||||
manager.Update(profile);
|
session.Update(profile);
|
||||||
SetAgentData(profile.ID, profile.CurrentAgent);
|
SetAgentData(profile.ID, profile.CurrentAgent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[NHIBERNATE] 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;
|
||||||
}
|
}
|
||||||
|
@ -144,32 +174,37 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
override public void AddNewUserAgent(UserAgentData agent)
|
override public void AddNewUserAgent(UserAgentData agent)
|
||||||
{
|
{
|
||||||
UserAgentData old = (UserAgentData)manager.Load(typeof(UserAgentData), agent.ProfileID);
|
try
|
||||||
if (old != null)
|
|
||||||
{
|
{
|
||||||
manager.Delete(old);
|
UserAgentData old = session.Load(typeof(UserAgentData), agent.ProfileID) as UserAgentData;
|
||||||
|
session.Delete(old);
|
||||||
}
|
}
|
||||||
|
catch (ObjectNotFoundException)
|
||||||
manager.Save(agent);
|
{
|
||||||
|
}
|
||||||
|
session.Save(agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateUserAgent(UserAgentData agent)
|
public void UpdateUserAgent(UserAgentData agent)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] UpdateUserAgent: {0} ", agent.ProfileID);
|
session.Update(agent);
|
||||||
manager.Update(agent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override public UserAgentData GetAgentByUUID(UUID uuid)
|
override public UserAgentData GetAgentByUUID(UUID uuid)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] GetAgentByUUID: {0} ", uuid);
|
try
|
||||||
return (UserAgentData)manager.Load(typeof(UserAgentData), uuid);
|
{
|
||||||
|
return session.Load(typeof(UserAgentData), uuid) as UserAgentData;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override public UserProfileData GetUserByName(string fname, string lname)
|
override public UserProfileData GetUserByName(string fname, string lname)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[NHIBERNATE] GetUserByName: {0} {1} ", fname, lname);
|
ICriteria criteria = session.CreateCriteria(typeof(UserProfileData));
|
||||||
ICriteria criteria = manager.GetSession().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));
|
||||||
foreach (UserProfileData profile in criteria.List())
|
foreach (UserProfileData profile in criteria.List())
|
||||||
|
@ -198,7 +233,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
if (querysplit.Length == 2)
|
if (querysplit.Length == 2)
|
||||||
{
|
{
|
||||||
ICriteria criteria = manager.GetSession().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]));
|
||||||
foreach (UserProfileData profile in criteria.List())
|
foreach (UserProfileData profile in criteria.List())
|
||||||
|
@ -227,18 +262,26 @@ namespace OpenSim.Data.NHibernate
|
||||||
/// TODO: stubs for now to get us to a compiling state gently
|
/// TODO: stubs for now to get us to a compiling state gently
|
||||||
public override AvatarAppearance GetUserAppearance(UUID user)
|
public override AvatarAppearance GetUserAppearance(UUID user)
|
||||||
{
|
{
|
||||||
return (AvatarAppearance)manager.Load(typeof(AvatarAppearance), user);
|
AvatarAppearance appearance;
|
||||||
|
// TODO: I'm sure I'll have to do something silly here
|
||||||
|
try {
|
||||||
|
appearance = session.Load(typeof(AvatarAppearance), user) as AvatarAppearance;
|
||||||
|
} catch (ObjectNotFoundException) {
|
||||||
|
appearance = null;
|
||||||
|
}
|
||||||
|
return appearance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ExistsAppearance(UUID uuid)
|
private bool ExistsAppearance(UUID uuid)
|
||||||
{
|
{
|
||||||
AvatarAppearance appearance = (AvatarAppearance)manager.Load(typeof(AvatarAppearance), uuid);
|
AvatarAppearance appearance;
|
||||||
if (appearance == null)
|
try {
|
||||||
{
|
appearance = session.Load(typeof(AvatarAppearance), uuid) as AvatarAppearance;
|
||||||
return false;
|
} catch (ObjectNotFoundException) {
|
||||||
|
appearance = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return (appearance == null) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,11 +295,11 @@ namespace OpenSim.Data.NHibernate
|
||||||
bool exists = ExistsAppearance(user);
|
bool exists = ExistsAppearance(user);
|
||||||
if (exists)
|
if (exists)
|
||||||
{
|
{
|
||||||
manager.Update(appearance);
|
session.Update(appearance);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
manager.Save(appearance);
|
session.Save(appearance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<id name="FullID" column="ID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
<id name="FullID" column="ID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
||||||
<generator class="assigned" />
|
<generator class="assigned" />
|
||||||
</id>
|
</id>
|
||||||
<property name="Type" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
|
<property name="Type" type="System.SByte" />
|
||||||
<property name="Name" type="String" length="64" />
|
<property name="Name" type="String" length="64" />
|
||||||
<property name="Description" type="String" length="64" />
|
<property name="Description" type="String" length="64" />
|
||||||
<property name="Local" type="boolean" />
|
<property name="Local" type="boolean" />
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<generator class="assigned" />
|
<generator class="assigned" />
|
||||||
</id>
|
</id>
|
||||||
<property name="Type" type="Int16" />
|
<property name="Type" type="Int16" />
|
||||||
<property name="Version" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
|
<property name="Version" type="System.UInt16" />
|
||||||
<property name="ParentID" index="folder_parent_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="ParentID" index="folder_parent_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="Owner" index="folder_owner_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="Owner" index="folder_owner_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="Name" type="String" length="64" />
|
<property name="Name" type="String" length="64" />
|
||||||
|
|
|
@ -12,15 +12,15 @@
|
||||||
<property name="Creator" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="Creator" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="Name" type="String" length="64" />
|
<property name="Name" type="String" length="64" />
|
||||||
<property name="Description" type="String" length="64" />
|
<property name="Description" type="String" length="64" />
|
||||||
<property name="NextPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="NextPermissions" type="System.UInt32" />
|
||||||
<property name="CurrentPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="CurrentPermissions" type="System.UInt32" />
|
||||||
<property name="BasePermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="BasePermissions" type="System.UInt32" />
|
||||||
<property name="EveryOnePermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="EveryOnePermissions" type="System.UInt32" />
|
||||||
<property name="GroupID" index="item_group_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="GroupID" index="item_group_id" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="GroupOwned" type="boolean" />
|
<property name="GroupOwned" type="boolean" />
|
||||||
<property name="SalePrice" type="System.Int32" />
|
<property name="SalePrice" type="System.Int32" />
|
||||||
<property name="SaleType" type="System.Byte" />
|
<property name="SaleType" type="System.Byte" />
|
||||||
<property name="Flags" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="Flags" type="System.UInt32" />
|
||||||
<property name="CreationDate" type="System.Int32" />
|
<property name="CreationDate" type="System.Int32" />
|
||||||
</class>
|
</class>
|
||||||
</hibernate-mapping>
|
</hibernate-mapping>
|
||||||
|
|
|
@ -2,8 +2,8 @@ BEGIN;
|
||||||
|
|
||||||
CREATE TABLE `Terrain` (
|
CREATE TABLE `Terrain` (
|
||||||
`RegionID` char(36) not null,
|
`RegionID` char(36) not null,
|
||||||
`MapData` longblob,
|
`Map` longblob,
|
||||||
PRIMARY KEY (`RegionID`)
|
PRIMARY KEY (`RegionID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
|
@ -4,7 +4,7 @@
|
||||||
<id name="UUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
<id name="UUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
||||||
<generator class="assigned" />
|
<generator class="assigned" />
|
||||||
</id>
|
</id>
|
||||||
<property name="ParentID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate"/>
|
<property name="ParentID" type="System.UInt32"/>
|
||||||
<property name="ParentUUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="ParentUUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="CreationDate" type="System.Int32" />
|
<property name="CreationDate" type="System.Int32" />
|
||||||
|
@ -14,17 +14,17 @@
|
||||||
<property name="SitName" type="String" length="255" />
|
<property name="SitName" type="String" length="255" />
|
||||||
<property name="TouchName" type="String" length="255" />
|
<property name="TouchName" type="String" length="255" />
|
||||||
|
|
||||||
<property name="ObjectFlags" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="ObjectFlags" type="System.UInt32" />
|
||||||
<property name="CreatorID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="CreatorID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
|
|
||||||
<property name="OwnerMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="OwnerMask" type="System.UInt32" />
|
||||||
<property name="NextOwnerMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="NextOwnerMask" type="System.UInt32" />
|
||||||
<property name="GroupMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="GroupMask" type="System.UInt32" />
|
||||||
<property name="EveryoneMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="EveryoneMask" type="System.UInt32" />
|
||||||
<property name="BaseMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="BaseMask" type="System.UInt32" />
|
||||||
|
|
||||||
<property name="OffsetPosition" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" >
|
<property name="OffsetPosition" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" >
|
||||||
<column name="PositionX" />
|
<column name="PositionX" />
|
||||||
|
@ -83,24 +83,24 @@
|
||||||
<column name="ScaleZ" />
|
<column name="ScaleZ" />
|
||||||
</property>
|
</property>
|
||||||
<property name="PCode" type="System.Byte" />
|
<property name="PCode" type="System.Byte" />
|
||||||
<property name="PathBegin" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
|
<property name="PathBegin" type="System.UInt16" />
|
||||||
<property name="PathEnd" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
|
<property name="PathEnd" type="System.UInt16" />
|
||||||
<property name="PathScaleX" type="System.Byte" />
|
<property name="PathScaleX" type="System.Byte" />
|
||||||
<property name="PathScaleY" type="System.Byte" />
|
<property name="PathScaleY" type="System.Byte" />
|
||||||
<property name="PathShearX" type="System.Byte" />
|
<property name="PathShearX" type="System.Byte" />
|
||||||
<property name="PathShearY" type="System.Byte" />
|
<property name="PathShearY" type="System.Byte" />
|
||||||
<property name="PathSkew" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
|
<property name="PathSkew" type="System.SByte" />
|
||||||
<property name="PathCurve" type="System.Byte" />
|
<property name="PathCurve" type="System.Byte" />
|
||||||
<property name="PathRadiusOffset" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
|
<property name="PathRadiusOffset" type="System.SByte" />
|
||||||
<property name="PathRevolutions" type="System.Byte" />
|
<property name="PathRevolutions" type="System.Byte" />
|
||||||
<property name="PathTaperX" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
|
<property name="PathTaperX" type="System.SByte" />
|
||||||
<property name="PathTwist" type="OpenSim.Data.NHibernate.SByteType, OpenSim.Data.NHibernate" />
|
<property name="PathTwist" type="System.SByte" />
|
||||||
<property name="ProfileBegin" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
|
<property name="ProfileBegin" type="System.UInt16" />
|
||||||
<property name="ProfileEnd" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
|
<property name="ProfileEnd" type="System.UInt16" />
|
||||||
<property name="ProfileCurve" type="System.Byte" />
|
<property name="ProfileCurve" type="System.Byte" />
|
||||||
<property name="ProfileHollow" type="OpenSim.Data.NHibernate.UInt16Type, OpenSim.Data.NHibernate" />
|
<property name="ProfileHollow" type="System.UInt16" />
|
||||||
<property name="TextureEntry" column="Texture" type="binary" />
|
<property name="TextureEntry" column="Texture" type="System.Byte[]" />
|
||||||
<property name="ExtraParams" type="binary" />
|
<property name="ExtraParams" type="System.Byte[]" />
|
||||||
<property name="State" type="System.Byte" />
|
<property name="State" type="System.Byte" />
|
||||||
</component>
|
</component>
|
||||||
</class>
|
</class>
|
||||||
|
@ -108,8 +108,7 @@
|
||||||
<id name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
<id name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
||||||
<generator class="assigned" />
|
<generator class="assigned" />
|
||||||
</id>
|
</id>
|
||||||
<!-- <property name="MapData" type="OpenSim.Data.NHibernate.BlobType, OpenSim.Data.NHibernate" /> -->
|
<property name="Map" type="System.Byte[]" />
|
||||||
<property name="MapData" type="binary" />
|
|
||||||
</class>
|
</class>
|
||||||
<class name="OpenSim.Framework.TaskInventoryItem, OpenSim.Framework" table="PrimItems" lazy="false">
|
<class name="OpenSim.Framework.TaskInventoryItem, OpenSim.Framework" table="PrimItems" lazy="false">
|
||||||
<id name="ItemID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
<id name="ItemID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
||||||
|
@ -122,47 +121,15 @@
|
||||||
<property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
|
<property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
|
||||||
<property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
|
<property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
|
||||||
<property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
|
<property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
|
||||||
<property name="CurrentPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="CurrentPermissions" type="System.UInt32" />
|
||||||
<property name="BasePermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="BasePermissions" type="System.UInt32" />
|
||||||
<property name="EveryonePermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="EveryonePermissions" type="System.UInt32" />
|
||||||
<property name="GroupPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="GroupPermissions" type="System.UInt32" />
|
||||||
<property name="NextPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="NextPermissions" type="System.UInt32" />
|
||||||
<property name="Name" type="String" length="255" />
|
<property name="Name" type="String" length="255" />
|
||||||
<property name="Description" type="String" length="255" />
|
<property name="Description" type="String" length="255" />
|
||||||
<property name="CreationDate" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="CreationDate" type="System.UInt32" />
|
||||||
<property name="Flags" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="Flags" type="System.UInt32" />
|
||||||
<property name="InvType" type="System.Int32" />
|
<property name="InvType" type="System.Int32" />
|
||||||
</class>
|
</class>
|
||||||
<class name="OpenSim.Data.RegionProfileData, OpenSim.Data" table="Regions" lazy="false">
|
|
||||||
<id name="Uuid" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
|
||||||
<generator class="assigned" />
|
|
||||||
</id>
|
|
||||||
<property name="RegionHandle" index="region_handle" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="RegionName" index="region_name" type="String" length="32"/>
|
|
||||||
<property name="RegionRecvKey" type="String" length="128"/>
|
|
||||||
<property name="RegionSendKey" type="String" length="128"/>
|
|
||||||
<property name="RegionSecret" type="String" length="128"/>
|
|
||||||
<property name="RegionDataURI" type="String" length="255"/>
|
|
||||||
<property name="ServerIP" type="String" length="64"/>
|
|
||||||
<property name="ServerPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="ServerURI" type="String" length="255"/>
|
|
||||||
<property name="RegionLocX" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="RegionLocY" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="RegionLocZ" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="EastOverrideHandle" index="overrideHandles" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="WestOverrideHandle" index="overrideHandles" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="SouthOverrideHandle" index="overrideHandles" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="NorthOverrideHandle" index="overrideHandles" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="RegionAssetURI" type="String" length="255"/>
|
|
||||||
<property name="RegionAssetRecvKey" type="String" length="128"/>
|
|
||||||
<property name="RegionAssetSendKey" type="String" length="128"/>
|
|
||||||
<property name="RegionUserURI" type="String" length="255"/>
|
|
||||||
<property name="RegionUserRecvKey" type="String" length="128"/>
|
|
||||||
<property name="RegionUserSendKey" type="String" length="128"/>
|
|
||||||
<property name="ServerHttpPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="ServerRemotingPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
|
||||||
<property name="RegionMapTextureID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
|
|
||||||
<property name="Owner_uuid" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
|
|
||||||
<property name="OriginUUID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"/>
|
|
||||||
</class>
|
|
||||||
</hibernate-mapping>
|
</hibernate-mapping>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<generator class="assigned" />
|
<generator class="assigned" />
|
||||||
</id>
|
</id>
|
||||||
<property name="AgentIP" type="String" length="24" />
|
<property name="AgentIP" type="String" length="24" />
|
||||||
<property name="AgentPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="AgentPort" type="Int32" />
|
||||||
<property name="AgentOnline" type="boolean" />
|
<property name="AgentOnline" type="boolean" />
|
||||||
<property name="SessionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="SessionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="SecureSessionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="SecureSessionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
|
@ -13,9 +13,9 @@
|
||||||
<property name="Region" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="Region" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="LoginTime" type="Int32" />
|
<property name="LoginTime" type="Int32" />
|
||||||
<property name="LogoutTime" type="Int32" />
|
<property name="LogoutTime" type="Int32" />
|
||||||
<property name="Handle" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
|
<property name="Handle" type="Int64" />
|
||||||
<!-- <property name="PositionX" type="Single" />
|
<property name="PositionX" type="Single" />
|
||||||
<property name="PositionY" type="Single" />
|
<property name="PositionY" type="Single" />
|
||||||
<property name="PositionZ" type="Single" /> -->
|
<property name="PositionZ" type="Single" />
|
||||||
</class>
|
</class>
|
||||||
</hibernate-mapping>
|
</hibernate-mapping>
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
<property name="PasswordHash" type="String" length="32" />
|
<property name="PasswordHash" type="String" length="32" />
|
||||||
<property name="PasswordSalt" type="String" length="32" />
|
<property name="PasswordSalt" type="String" length="32" />
|
||||||
<property name="WebLoginKey" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="WebLoginKey" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="HomeRegionX" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="HomeRegionX" type="System.UInt32" />
|
||||||
<property name="HomeRegionY" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="HomeRegionY" type="System.UInt32" />
|
||||||
<property name="HomeLocationX" type="Single" />
|
<property name="HomeLocationX" type="Single" />
|
||||||
<property name="HomeLocationY" type="Single" />
|
<property name="HomeLocationY" type="Single" />
|
||||||
<property name="HomeLocationZ" type="Single" />
|
<property name="HomeLocationZ" type="Single" />
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Data.NHibernate
|
||||||
set { regionID = value; }
|
set { regionID = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] MapData
|
public byte[] Map
|
||||||
{
|
{
|
||||||
get { return serializeTerrain(map); }
|
get { return serializeTerrain(map); }
|
||||||
set { map = parseTerrain(value); }
|
set { map = parseTerrain(value); }
|
||||||
|
|
|
@ -36,7 +36,6 @@ namespace OpenSim.Data
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A class which contains information known to the grid server about a region
|
/// A class which contains information known to the grid server about a region
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
|
||||||
public class RegionProfileData
|
public class RegionProfileData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -211,155 +210,5 @@ namespace OpenSim.Data
|
||||||
{
|
{
|
||||||
return RequestSimData(gridserver_url, gridserver_sendkey, "region_name_search", regionName );
|
return RequestSimData(gridserver_url, gridserver_sendkey, "region_name_search", regionName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Data Wrappers
|
|
||||||
public string RegionName
|
|
||||||
{
|
|
||||||
get { return regionName; }
|
|
||||||
set { regionName = value; }
|
|
||||||
}
|
|
||||||
public ulong RegionHandle
|
|
||||||
{
|
|
||||||
get { return regionHandle; }
|
|
||||||
set { regionHandle = value; }
|
|
||||||
}
|
|
||||||
public UUID Uuid
|
|
||||||
{
|
|
||||||
get { return UUID; }
|
|
||||||
set { UUID = value; }
|
|
||||||
}
|
|
||||||
public uint RegionLocX
|
|
||||||
{
|
|
||||||
get { return regionLocX; }
|
|
||||||
set { regionLocX = value; }
|
|
||||||
}
|
|
||||||
public uint RegionLocY
|
|
||||||
{
|
|
||||||
get { return regionLocY; }
|
|
||||||
set { regionLocY = value; }
|
|
||||||
}
|
|
||||||
public uint RegionLocZ
|
|
||||||
{
|
|
||||||
get { return regionLocZ; }
|
|
||||||
set { regionLocZ = value; }
|
|
||||||
}
|
|
||||||
public string RegionSendKey
|
|
||||||
{
|
|
||||||
get { return regionSendKey; }
|
|
||||||
set { regionSendKey = value; }
|
|
||||||
}
|
|
||||||
public string RegionRecvKey
|
|
||||||
{
|
|
||||||
get { return regionRecvKey; }
|
|
||||||
set { regionRecvKey = value; }
|
|
||||||
}
|
|
||||||
public string RegionSecret
|
|
||||||
{
|
|
||||||
get { return regionSecret; }
|
|
||||||
set { regionSecret = value; }
|
|
||||||
}
|
|
||||||
public bool RegionOnline
|
|
||||||
{
|
|
||||||
get { return regionOnline; }
|
|
||||||
set { regionOnline = value; }
|
|
||||||
}
|
|
||||||
public string ServerIP
|
|
||||||
{
|
|
||||||
get { return serverIP; }
|
|
||||||
set { serverIP = value; }
|
|
||||||
}
|
|
||||||
public uint ServerPort
|
|
||||||
{
|
|
||||||
get { return serverPort; }
|
|
||||||
set { serverPort = value; }
|
|
||||||
}
|
|
||||||
public string ServerURI
|
|
||||||
{
|
|
||||||
get { return serverURI; }
|
|
||||||
set { serverURI = value; }
|
|
||||||
}
|
|
||||||
public uint ServerHttpPort
|
|
||||||
{
|
|
||||||
get { return httpPort; }
|
|
||||||
set { httpPort = value; }
|
|
||||||
}
|
|
||||||
public uint ServerRemotingPort
|
|
||||||
{
|
|
||||||
get { return remotingPort; }
|
|
||||||
set { remotingPort = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong NorthOverrideHandle
|
|
||||||
{
|
|
||||||
get { return regionNorthOverrideHandle; }
|
|
||||||
set { regionNorthOverrideHandle = value; }
|
|
||||||
}
|
|
||||||
public ulong SouthOverrideHandle
|
|
||||||
{
|
|
||||||
get { return regionSouthOverrideHandle; }
|
|
||||||
set { regionSouthOverrideHandle = value; }
|
|
||||||
}
|
|
||||||
public ulong EastOverrideHandle
|
|
||||||
{
|
|
||||||
get { return regionEastOverrideHandle; }
|
|
||||||
set { regionEastOverrideHandle = value; }
|
|
||||||
}
|
|
||||||
public ulong WestOverrideHandle
|
|
||||||
{
|
|
||||||
get { return regionWestOverrideHandle; }
|
|
||||||
set { regionWestOverrideHandle = value; }
|
|
||||||
}
|
|
||||||
public string RegionDataURI
|
|
||||||
{
|
|
||||||
get { return regionDataURI; }
|
|
||||||
set { regionDataURI = value; }
|
|
||||||
}
|
|
||||||
public string RegionAssetURI
|
|
||||||
{
|
|
||||||
get { return regionAssetURI; }
|
|
||||||
set { regionAssetURI = value; }
|
|
||||||
}
|
|
||||||
public string RegionAssetSendKey
|
|
||||||
{
|
|
||||||
get { return regionAssetSendKey; }
|
|
||||||
set { regionAssetSendKey = value; }
|
|
||||||
}
|
|
||||||
public string RegionAssetRecvKey
|
|
||||||
{
|
|
||||||
get { return regionAssetRecvKey; }
|
|
||||||
set { regionAssetRecvKey = value; }
|
|
||||||
}
|
|
||||||
public string RegionUserURI
|
|
||||||
{
|
|
||||||
get { return regionUserURI; }
|
|
||||||
set { regionUserURI = value; }
|
|
||||||
}
|
|
||||||
public string RegionUserSendKey
|
|
||||||
{
|
|
||||||
get { return regionUserSendKey; }
|
|
||||||
set { regionUserSendKey = value; }
|
|
||||||
}
|
|
||||||
public string RegionUserRecvKey
|
|
||||||
{
|
|
||||||
get { return regionUserRecvKey; }
|
|
||||||
set { regionUserRecvKey = value; }
|
|
||||||
}
|
|
||||||
public UUID RegionMapTextureID
|
|
||||||
{
|
|
||||||
get { return regionMapTextureID; }
|
|
||||||
set { regionMapTextureID = value; }
|
|
||||||
}
|
|
||||||
public UUID Owner_uuid
|
|
||||||
{
|
|
||||||
get { return owner_uuid; }
|
|
||||||
set { owner_uuid = value; }
|
|
||||||
}
|
|
||||||
public UUID OriginUUID
|
|
||||||
{
|
|
||||||
get { return originUUID; }
|
|
||||||
set { originUUID = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -19,12 +19,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- if you'd like to know what NHibernate is doing more set value="DEBUG" -->
|
|
||||||
<logger name="NHibernate" additivity="false">
|
|
||||||
<level value="INFO"/>
|
|
||||||
<appender-ref ref="NHibernateFileLog"/>
|
|
||||||
</logger>
|
|
||||||
|
|
||||||
<root>
|
<root>
|
||||||
<level value="DEBUG" />
|
<level value="DEBUG" />
|
||||||
<appender-ref ref="Console" />
|
<appender-ref ref="Console" />
|
||||||
|
|
|
@ -1867,11 +1867,9 @@
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
<Match path="Resources" pattern="*.xml" buildAction="EmbeddedResource"/>
|
<Match path="Resources" pattern="*.xml" buildAction="EmbeddedResource"/>
|
||||||
<Match pattern="*.addin.xml" path="Resources" buildAction="EmbeddedResource" recurse="true"/>
|
|
||||||
<!-- add more as you go -->
|
<!-- add more as you go -->
|
||||||
<Match path="Resources/SQLiteDialect" pattern="*.sql" buildAction="EmbeddedResource"/>
|
<Match path="Resources/SQLiteDialect" pattern="*.sql" buildAction="EmbeddedResource"/>
|
||||||
<Match path="Resources/MySQLDialect" pattern="*.sql" buildAction="EmbeddedResource"/>
|
<Match path="Resources/MySQLDialect" pattern="*.sql" buildAction="EmbeddedResource"/>
|
||||||
<Match path="Resources/MsSql2005Dialect" pattern="*.sql" buildAction="EmbeddedResource"/>
|
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue