* Rex merge, region/storage

afrisby-3
Adam Frisby 2008-02-23 04:04:54 +00:00
parent bd57a81e76
commit 642ced53d1
6 changed files with 1451 additions and 3159 deletions

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
@ -42,9 +42,10 @@ using Db4objects.Db4o.Query;
namespace OpenSim.DataStore.DB4oStorage
{
public class SceneObjectQuery : Predicate
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private LLUUID globalIDSearch;
public SceneObjectQuery(LLUUID find)
@ -58,17 +59,14 @@ namespace OpenSim.DataStore.DB4oStorage
}
}
public class DB4oDataStore : IRegionDataStore
{
private IObjectContainer db;
public void Initialise(string dbfile, string dbname)
{
MainLog.Instance.Verbose("DATASTORE", "DB4O - Opening " + dbfile);
m_log.Info("[DATASTORE]: DB4O - Opening " + dbfile);
db = Db4oFactory.OpenFile(dbfile);
return;
}
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
@ -91,7 +89,7 @@ namespace OpenSim.DataStore.DB4oStorage
IObjectSet result = db.Get(typeof(SceneObjectGroup));
List<SceneObjectGroup> retvals = new List<SceneObjectGroup>();
MainLog.Instance.Verbose("DATASTORE", "DB4O - LoadObjects found " + result.Count.ToString() + " objects");
m_log.Info("[DATASTORE]: DB4O - LoadObjects found " + result.Count.ToString() + " objects");
foreach (Object obj in result)
{
@ -103,7 +101,6 @@ namespace OpenSim.DataStore.DB4oStorage
public void StoreTerrain(double[,] ter)
{
}
public double[,] LoadTerrain()
@ -113,12 +110,10 @@ namespace OpenSim.DataStore.DB4oStorage
public void RemoveLandObject(uint id)
{
}
public void StoreParcel(Land parcel)
{
}
public List<Land> LoadLandObjects()

View File

@ -1,4 +1,32 @@
using System.Reflection;
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
@ -43,6 +43,8 @@ namespace OpenSim.DataStore.MSSQL
{
public class MSSQLDataStore : IRegionDataStore
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private const string primSelect = "select * from prims";
private const string shapeSelect = "select * from primshapes";
private const string terrainSelect = "select * from terrain";
@ -68,7 +70,7 @@ namespace OpenSim.DataStore.MSSQL
ds = new DataSet();
MainLog.Instance.Verbose("DATASTORE", "MSSQL - connecting: " + settingInitialCatalog);
m_log.Info("[DATASTORE]: MSSQL - connecting: " + settingInitialCatalog);
SqlConnection conn = new SqlConnection(connectionString);
SqlCommand primSelectCmd = new SqlCommand(primSelect, conn);
primDa = new SqlDataAdapter(primSelectCmd);
@ -109,7 +111,7 @@ namespace OpenSim.DataStore.MSSQL
}
catch (Exception)
{
MainLog.Instance.Verbose("DATASTORE", "Caught fill error on primshapes table");
m_log.Info("[DATASTORE]: Caught fill error on primshapes table");
}
try
{
@ -117,7 +119,7 @@ namespace OpenSim.DataStore.MSSQL
}
catch (Exception)
{
MainLog.Instance.Verbose("DATASTORE", "Caught fill error on terrain table");
m_log.Info("[DATASTORE]: Caught fill error on terrain table");
}
return;
}
@ -129,17 +131,19 @@ namespace OpenSim.DataStore.MSSQL
{
foreach (SceneObjectPart prim in obj.Children.Values)
{
MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID);
m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
addPrim(prim, obj.UUID, regionUUID);
}
}
Commit();
// MainLog.Instance.Verbose("Dump of prims:", ds.GetXml());
// m_log.Info("Dump of prims:", ds.GetXml());
}
public void RemoveObject(LLUUID obj, LLUUID regionUUID)
{
m_log.InfoFormat("[DATASTORE]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["primshapes"];
@ -177,7 +181,7 @@ namespace OpenSim.DataStore.MSSQL
lock (ds)
{
DataRow[] primsForRegion = prims.Select(byRegion, orderByParent);
MainLog.Instance.Verbose("DATASTORE",
m_log.Info("[DATASTORE]: " +
"Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
foreach (DataRow primRow in primsForRegion)
@ -197,7 +201,7 @@ namespace OpenSim.DataStore.MSSQL
}
else
{
MainLog.Instance.Notice(
m_log.Info(
"No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default;
}
@ -217,7 +221,7 @@ namespace OpenSim.DataStore.MSSQL
}
else
{
MainLog.Instance.Notice(
m_log.Info(
"No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default;
}
@ -226,11 +230,11 @@ namespace OpenSim.DataStore.MSSQL
}
catch (Exception e)
{
MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows");
MainLog.Instance.Verbose("DATASTORE", e.ToString());
m_log.Error("[DATASTORE]: Failed create prim object, exception and data follows");
m_log.Info("[DATASTORE]: " + e.ToString());
foreach (DataColumn col in prims.Columns)
{
MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]);
m_log.Info("[DATASTORE]: Col: " + col.ColumnName + " => " + primRow[col]);
}
}
}
@ -243,7 +247,7 @@ namespace OpenSim.DataStore.MSSQL
{
int revision = Util.UnixTimeSinceEpoch();
MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString());
m_log.Info("[DATASTORE]: Storing terrain revision r" + revision.ToString());
DataTable terrain = ds.Tables["terrain"];
lock (ds)
@ -286,12 +290,12 @@ namespace OpenSim.DataStore.MSSQL
}
else
{
MainLog.Instance.Verbose("DATASTORE", "No terrain found for region");
m_log.Info("[DATASTORE]: No terrain found for region");
return null;
}
MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString());
m_log.Info("[DATASTORE]: Loaded terrain revision r" + rev.ToString());
}
return terret;
@ -751,6 +755,12 @@ namespace OpenSim.DataStore.MSSQL
}
}
// see IRegionDatastore
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
{
// No implementation yet
}
/***********************************************************************
*
* SQL Statement Creation Functions
@ -798,7 +808,7 @@ namespace OpenSim.DataStore.MSSQL
private SqlCommand createUpdateCommand(string table, string pk, DataTable dt)
{
string sql = "update " + table + " set ";
string subsql = "";
string subsql = String.Empty;
foreach (DataColumn col in dt.Columns)
{
if (subsql.Length > 0)
@ -825,7 +835,7 @@ namespace OpenSim.DataStore.MSSQL
private string defineTable(DataTable dt)
{
string sql = "create table " + dt.TableName + "(";
string subsql = "";
string subsql = String.Empty;
foreach (DataColumn col in dt.Columns)
{
if (subsql.Length > 0)
@ -942,7 +952,7 @@ namespace OpenSim.DataStore.MSSQL
}
catch (SqlException)
{
MainLog.Instance.Warn("MSSQL", "Primitives Table Already Exists");
m_log.Warn("[MSSQL]: Primitives Table Already Exists");
}
try
@ -952,7 +962,7 @@ namespace OpenSim.DataStore.MSSQL
}
catch (SqlException)
{
MainLog.Instance.Warn("MSSQL", "Shapes Table Already Exists");
m_log.Warn("[MSSQL]: Shapes Table Already Exists");
}
try
@ -962,7 +972,7 @@ namespace OpenSim.DataStore.MSSQL
}
catch (SqlException)
{
MainLog.Instance.Warn("MSSQL", "Terrain Table Already Exists");
m_log.Warn("[MSSQL]: Terrain Table Already Exists");
}
conn.Close();
@ -986,7 +996,7 @@ namespace OpenSim.DataStore.MSSQL
}
catch (SqlException)
{
MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating");
m_log.Info("[DATASTORE]: MSSQL Database doesn't exist... creating");
InitDB(conn);
}
@ -1001,14 +1011,14 @@ namespace OpenSim.DataStore.MSSQL
}
catch (SqlException e)
{
MainLog.Instance.Verbose("DATASTORE", e.ToString());
m_log.Info("[DATASTORE]: " + e.ToString());
}
foreach (DataColumn col in createPrimTable().Columns)
{
if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName))
{
MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName);
return false;
}
}
@ -1016,7 +1026,7 @@ namespace OpenSim.DataStore.MSSQL
{
if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName))
{
MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName);
return false;
}
}
@ -1024,7 +1034,7 @@ namespace OpenSim.DataStore.MSSQL
{
if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName))
{
MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName);
m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName);
return false;
}
}

View File

@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
@ -50,6 +50,11 @@ namespace OpenSim.DataStore.NullStorage
{
}
// see IRegionDatastore
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
{
}
public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
{
return new List<SceneObjectGroup>();

View File

@ -1,3 +1,31 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System.Reflection;
using System.Runtime.InteropServices;
@ -10,7 +38,7 @@ using System.Runtime.InteropServices;
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("")]
[assembly : AssemblyProduct("OpenSim.DataStore.NullStorage")]
[assembly : AssemblyCopyright("Copyright © 2007")]
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]