From f7b28dd32155eac2d55ccf0757b059794d6b5f67 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 7 Sep 2010 03:41:29 +0100
Subject: If a scene object part UUID is changed (only possible when not in a
scene), then adjust the inventory items to point to the new uuid as well
---
OpenSim/Framework/TaskInventoryItem.cs | 10 +++++-----
.../Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 2 +-
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 ++++++++--
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 3 +++
4 files changed, 17 insertions(+), 8 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 2cb7895..df5b936 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -348,15 +348,15 @@ namespace OpenSim.Framework
/// The new part ID to which this item belongs
public void ResetIDs(UUID partID)
{
- _oldID = _itemID;
- _itemID = UUID.Random();
- _parentPartID = partID;
- _parentID = partID;
+ OldItemID = ItemID;
+ ItemID = UUID.Random();
+ ParentPartID = partID;
+ ParentID = partID;
}
public TaskInventoryItem()
{
- _creationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
+ CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
}
}
}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 58698ee..32b3724 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
public void TestLoadOarV0_2()
{
TestHelper.InMethod();
- //log4net.Config.XmlConfigurator.Configure();
+// log4net.Config.XmlConfigurator.Configure();
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 3ed74e1..3753dcb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -494,7 +494,14 @@ namespace OpenSim.Region.Framework.Scenes
public UUID UUID
{
get { return m_uuid; }
- set { m_uuid = value; }
+ set
+ {
+ m_uuid = value;
+
+ // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part
+ if (Inventory != null)
+ Inventory.ResetInventoryIDs();
+ }
}
public uint LocalId
@@ -2756,7 +2763,6 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random();
LinkNum = linkNum;
LocalId = 0;
- Inventory.ResetInventoryIDs();
}
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index ca089a1..87c4860 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -119,6 +119,9 @@ namespace OpenSim.Region.Framework.Scenes
/// Link number for the part
public void ResetInventoryIDs()
{
+ if (null == m_part || null == m_part.ParentGroup)
+ return;
+
lock (m_items)
{
if (0 == m_items.Count)
--
cgit v1.1
From 5ca4c238e0e5aec6d3de74a7155324dddf34cc2d Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 7 Sep 2010 11:33:46 -0700
Subject: SimianUserAccountServiceConnector was not initializing the user cache
---
.../Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index deb8695..991c0f3 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -54,8 +54,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
MethodBase.GetCurrentMethod().DeclaringType);
private string m_serverUrl = String.Empty;
- private ExpiringCache m_accountCache;
- private bool m_Enabled = false;
+ private ExpiringCache m_accountCache = new ExpiringCache();
+ private bool m_Enabled;
#region ISharedRegionModule
--
cgit v1.1
From b28d1b6ccd3e8728e429528ea87714680e6ac643 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 7 Sep 2010 20:19:52 +0100
Subject: Fix Simian regression
---
.../SimianGrid/SimianAssetServiceConnector.cs | 37 +++++++++--------
.../SimianAuthenticationServiceConnector.cs | 35 ++++++++--------
.../SimianGrid/SimianAvatarServiceConnector.cs | 35 ++++++++--------
.../SimianGrid/SimianGridServiceConnector.cs | 35 ++++++++--------
.../SimianGrid/SimianInventoryServiceConnector.cs | 47 ++++++++++++----------
.../SimianGrid/SimianPresenceServiceConnector.cs | 35 ++++++++--------
.../SimianUserAccountServiceConnector.cs | 35 ++++++++--------
7 files changed, 140 insertions(+), 119 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 99e6983..6d5b30e 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -81,7 +81,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAssetServiceConnector(IConfigSource source)
{
- Initialise(source);
+ CommonInit(source);
}
public void Initialise(IConfigSource source)
@@ -91,25 +91,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
{
string name = moduleConfig.GetString("AssetServices", "");
if (name == Name)
- {
- IConfig gridConfig = source.Configs["AssetService"];
- if (gridConfig != null)
- {
- string serviceUrl = gridConfig.GetString("AssetServerURI");
- if (!String.IsNullOrEmpty(serviceUrl))
- {
- if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
- serviceUrl = serviceUrl + '/';
- m_serverUrl = serviceUrl;
- }
- }
+ CommonInit(source);
+ }
+ }
- if (String.IsNullOrEmpty(m_serverUrl))
- m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector");
- else
- m_Enabled = true;
+ private void CommonInit(IConfigSource source)
+ {
+ IConfig gridConfig = source.Configs["AssetService"];
+ if (gridConfig != null)
+ {
+ string serviceUrl = gridConfig.GetString("AssetServerURI");
+ if (!String.IsNullOrEmpty(serviceUrl))
+ {
+ if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
+ serviceUrl = serviceUrl + '/';
+ m_serverUrl = serviceUrl;
}
}
+
+ if (String.IsNullOrEmpty(m_serverUrl))
+ m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector");
+ else
+ m_Enabled = true;
}
#region IAssetService
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index 68f73ee..51a09f8 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAuthenticationServiceConnector(IConfigSource source)
{
- Initialise(source);
+ CommonInit(source);
}
public void Initialise(IConfigSource source)
@@ -79,24 +79,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
{
string name = moduleConfig.GetString("AuthenticationServices", "");
if (name == Name)
- {
- IConfig gridConfig = source.Configs["AuthenticationService"];
- if (gridConfig != null)
- {
- string serviceUrl = gridConfig.GetString("AuthenticationServerURI");
- if (!String.IsNullOrEmpty(serviceUrl))
- {
- if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
- serviceUrl = serviceUrl + '/';
- m_serverUrl = serviceUrl;
- m_Enabled = true;
- }
- }
+ CommonInit(source);
+ }
+ }
- if (String.IsNullOrEmpty(m_serverUrl))
- m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
+ private void CommonInit(IConfigSource source)
+ {
+ IConfig gridConfig = source.Configs["AuthenticationService"];
+ if (gridConfig != null)
+ {
+ string serviceUrl = gridConfig.GetString("AuthenticationServerURI");
+ if (!String.IsNullOrEmpty(serviceUrl))
+ {
+ if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
+ serviceUrl = serviceUrl + '/';
+ m_serverUrl = serviceUrl;
+ m_Enabled = true;
}
}
+
+ if (String.IsNullOrEmpty(m_serverUrl))
+ m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
}
public string Authenticate(UUID principalID, string password, int lifetime)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index 7e56bd1..3505c64 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAvatarServiceConnector(IConfigSource source)
{
- Initialise(source);
+ CommonInit(source);
}
public void Initialise(IConfigSource source)
@@ -84,24 +84,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
{
string name = moduleConfig.GetString("AvatarServices", "");
if (name == Name)
- {
- IConfig gridConfig = source.Configs["AvatarService"];
- if (gridConfig != null)
- {
- string serviceUrl = gridConfig.GetString("AvatarServerURI");
- if (!String.IsNullOrEmpty(serviceUrl))
- {
- if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
- serviceUrl = serviceUrl + '/';
- m_serverUrl = serviceUrl;
- m_Enabled = true;
- }
- }
+ CommonInit(source);
+ }
+ }
- if (String.IsNullOrEmpty(m_serverUrl))
- m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector");
+ private void CommonInit(IConfigSource source)
+ {
+ IConfig gridConfig = source.Configs["AvatarService"];
+ if (gridConfig != null)
+ {
+ string serviceUrl = gridConfig.GetString("AvatarServerURI");
+ if (!String.IsNullOrEmpty(serviceUrl))
+ {
+ if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
+ serviceUrl = serviceUrl + '/';
+ m_serverUrl = serviceUrl;
+ m_Enabled = true;
}
}
+
+ if (String.IsNullOrEmpty(m_serverUrl))
+ m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector");
}
#region IAvatarService
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index a94620b..4409d5c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianGridServiceConnector(IConfigSource source)
{
- Initialise(source);
+ CommonInit(source);
}
public void Initialise(IConfigSource source)
@@ -108,24 +108,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
{
string name = moduleConfig.GetString("GridServices", "");
if (name == Name)
- {
- IConfig gridConfig = source.Configs["GridService"];
- if (gridConfig != null)
- {
- string serviceUrl = gridConfig.GetString("GridServerURI");
- if (!String.IsNullOrEmpty(serviceUrl))
- {
- if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
- serviceUrl = serviceUrl + '/';
- m_serverUrl = serviceUrl;
- m_Enabled = true;
- }
- }
+ CommonInit(source);
+ }
+ }
- if (String.IsNullOrEmpty(m_serverUrl))
- m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
+ private void CommonInit(IConfigSource source)
+ {
+ IConfig gridConfig = source.Configs["GridService"];
+ if (gridConfig != null)
+ {
+ string serviceUrl = gridConfig.GetString("GridServerURI");
+ if (!String.IsNullOrEmpty(serviceUrl))
+ {
+ if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
+ serviceUrl = serviceUrl + '/';
+ m_serverUrl = serviceUrl;
+ m_Enabled = true;
}
}
+
+ if (String.IsNullOrEmpty(m_serverUrl))
+ m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
}
#region IGridService
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index eb118ae..470eccd 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianInventoryServiceConnector(IConfigSource source)
{
- Initialise(source);
+ CommonInit(source);
}
public void Initialise(IConfigSource source)
@@ -98,36 +98,39 @@ namespace OpenSim.Services.Connectors.SimianGrid
{
string name = moduleConfig.GetString("InventoryServices", "");
if (name == Name)
+ CommonInit(source);
+ }
+ }
+
+ private void CommonInit(IConfigSource source)
+ {
+ IConfig gridConfig = source.Configs["InventoryService"];
+ if (gridConfig != null)
+ {
+ string serviceUrl = gridConfig.GetString("InventoryServerURI");
+ if (!String.IsNullOrEmpty(serviceUrl))
{
- IConfig gridConfig = source.Configs["InventoryService"];
+ if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
+ serviceUrl = serviceUrl + '/';
+ m_serverUrl = serviceUrl;
+
+ gridConfig = source.Configs["UserAccountService"];
if (gridConfig != null)
{
- string serviceUrl = gridConfig.GetString("InventoryServerURI");
+ serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
{
- if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
- serviceUrl = serviceUrl + '/';
- m_serverUrl = serviceUrl;
-
- gridConfig = source.Configs["UserAccountService"];
- if (gridConfig != null)
- {
- serviceUrl = gridConfig.GetString("UserAccountServerURI");
- if (!String.IsNullOrEmpty(serviceUrl))
- {
- m_userServerUrl = serviceUrl;
- m_Enabled = true;
- }
- }
+ m_userServerUrl = serviceUrl;
+ m_Enabled = true;
}
}
-
- if (String.IsNullOrEmpty(m_serverUrl))
- m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector");
- else if (String.IsNullOrEmpty(m_userServerUrl))
- m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector");
}
}
+
+ if (String.IsNullOrEmpty(m_serverUrl))
+ m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector");
+ else if (String.IsNullOrEmpty(m_userServerUrl))
+ m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector");
}
///
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 074c80f..077be3c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianPresenceServiceConnector(IConfigSource source)
{
- Initialise(source);
+ CommonInit(source);
}
public void Initialise(IConfigSource source)
@@ -109,24 +109,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
{
string name = moduleConfig.GetString("PresenceServices", "");
if (name == Name)
+ CommonInit(source);
+ }
+ }
+
+ private void CommonInit(IConfigSource source)
+ {
+ IConfig gridConfig = source.Configs["PresenceService"];
+ if (gridConfig != null)
+ {
+ string serviceUrl = gridConfig.GetString("PresenceServerURI");
+ if (!String.IsNullOrEmpty(serviceUrl))
{
- IConfig gridConfig = source.Configs["PresenceService"];
- if (gridConfig != null)
- {
- string serviceUrl = gridConfig.GetString("PresenceServerURI");
- if (!String.IsNullOrEmpty(serviceUrl))
- {
- if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
- serviceUrl = serviceUrl + '/';
- m_serverUrl = serviceUrl;
- m_Enabled = true;
- }
- }
-
- if (String.IsNullOrEmpty(m_serverUrl))
- m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector");
+ if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
+ serviceUrl = serviceUrl + '/';
+ m_serverUrl = serviceUrl;
+ m_Enabled = true;
}
}
+
+ if (String.IsNullOrEmpty(m_serverUrl))
+ m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector");
}
#region IPresenceService
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 991c0f3..446ac71 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianUserAccountServiceConnector(IConfigSource source)
{
- Initialise(source);
+ CommonInit(source);
}
public void Initialise(IConfigSource source)
@@ -83,24 +83,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
{
string name = moduleConfig.GetString("UserAccountServices", "");
if (name == Name)
- {
- IConfig gridConfig = source.Configs["UserAccountService"];
- if (gridConfig != null)
- {
- string serviceUrl = gridConfig.GetString("UserAccountServerURI");
- if (!String.IsNullOrEmpty(serviceUrl))
- {
- if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
- serviceUrl = serviceUrl + '/';
- m_serverUrl = serviceUrl;
- m_Enabled = true;
- }
- }
+ CommonInit(source);
+ }
+ }
- if (String.IsNullOrEmpty(m_serverUrl))
- m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector");
+ private void CommonInit(IConfigSource source)
+ {
+ IConfig gridConfig = source.Configs["UserAccountService"];
+ if (gridConfig != null)
+ {
+ string serviceUrl = gridConfig.GetString("UserAccountServerURI");
+ if (!String.IsNullOrEmpty(serviceUrl))
+ {
+ if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
+ serviceUrl = serviceUrl + '/';
+ m_serverUrl = serviceUrl;
+ m_Enabled = true;
}
}
+
+ if (String.IsNullOrEmpty(m_serverUrl))
+ m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector");
}
public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
--
cgit v1.1
From 029c9548040e0206640f41151f4a4643540bfeff Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 7 Sep 2010 13:43:36 -0700
Subject: * Added sanity checks to the SimianAssetServiceConnector so it will
throw a sensible error message when it is misconfigured instead of a
mysterious "Uri is empty" error
---
.../SimianGrid/SimianAssetServiceConnector.cs | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
(limited to 'OpenSim')
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 99e6983..caeabb7 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -116,6 +116,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
public AssetBase Get(string id)
{
+ if (String.IsNullOrEmpty(m_serverUrl))
+ {
+ m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
+ throw new InvalidOperationException();
+ }
+
// Cache fetch
if (m_cache != null)
{
@@ -142,6 +148,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
///
public AssetMetadata GetMetadata(string id)
{
+ if (String.IsNullOrEmpty(m_serverUrl))
+ {
+ m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
+ throw new InvalidOperationException();
+ }
+
AssetMetadata metadata = null;
// Cache fetch
@@ -213,6 +225,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// True if the id was parseable, false otherwise
public bool Get(string id, Object sender, AssetRetrieved handler)
{
+ if (String.IsNullOrEmpty(m_serverUrl))
+ {
+ m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
+ throw new InvalidOperationException();
+ }
+
// Cache fetch
if (m_cache != null)
{
@@ -243,6 +261,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
///
public string Store(AssetBase asset)
{
+ if (String.IsNullOrEmpty(m_serverUrl))
+ {
+ m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
+ throw new InvalidOperationException();
+ }
+
bool storedInCache = false;
string errorMessage = null;
@@ -375,6 +399,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
///
public bool Delete(string id)
{
+ if (String.IsNullOrEmpty(m_serverUrl))
+ {
+ m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
+ throw new InvalidOperationException();
+ }
+
//string errorMessage = String.Empty;
string url = m_serverUrl + id;
--
cgit v1.1
From 9be1c0ff448d4ea650ca921937905653b4017d61 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 7 Sep 2010 14:41:13 -0700
Subject: * Cache null account responses in the
SimianUserAccountServiceConnector to avoid repeated requests for missing
avatar IDs * Updated to OpenMetaverse r3442 to fix a timezone issue with
ExpiringCache
---
OpenSim/Framework/SLUtil.cs | 10 ++++------
OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++---
.../ClientStack/LindenUDP/UnackedPacketCollection.cs | 4 ++--
OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +-
.../UserAccounts/UserAccountCache.cs | 6 ++++--
.../CoreModules/World/Archiver/Tests/ArchiverTests.cs | 5 ++++-
.../Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 4 +++-
.../SimianGrid/SimianUserAccountServiceConnector.cs | 16 +++++++++++++---
8 files changed, 34 insertions(+), 19 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs
index a489806..9941a7f 100644
--- a/OpenSim/Framework/SLUtil.cs
+++ b/OpenSim/Framework/SLUtil.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Framework
case AssetType.Texture:
return "image/x-j2c";
case AssetType.Sound:
- return "application/ogg";
+ return "audio/ogg";
case AssetType.CallingCard:
return "application/vnd.ll.callingcard";
case AssetType.Landmark:
@@ -98,8 +98,6 @@ namespace OpenSim.Framework
return "application/vnd.ll.outfitfolder";
case AssetType.MyOutfitsFolder:
return "application/vnd.ll.myoutfitsfolder";
- case AssetType.InboxFolder:
- return "application/vnd.ll.inboxfolder";
case AssetType.Unknown:
default:
return "application/octet-stream";
@@ -128,7 +126,7 @@ namespace OpenSim.Framework
case InventoryType.Object:
return "application/vnd.ll.primitive";
case InventoryType.Sound:
- return "application/ogg";
+ return "audio/ogg";
case InventoryType.Snapshot:
case InventoryType.Texture:
return "image/x-j2c";
@@ -147,6 +145,7 @@ namespace OpenSim.Framework
case "image/jp2":
return (sbyte)AssetType.Texture;
case "application/ogg":
+ case "audio/ogg":
return (sbyte)AssetType.Sound;
case "application/vnd.ll.callingcard":
case "application/x-metaverse-callingcard":
@@ -209,8 +208,6 @@ namespace OpenSim.Framework
return (sbyte)AssetType.OutfitFolder;
case "application/vnd.ll.myoutfitsfolder":
return (sbyte)AssetType.MyOutfitsFolder;
- case "application/vnd.ll.inboxfolder":
- return (sbyte)AssetType.InboxFolder;
case "application/octet-stream":
default:
return (sbyte)AssetType.Unknown;
@@ -227,6 +224,7 @@ namespace OpenSim.Framework
case "image/jpeg":
return (sbyte)InventoryType.Texture;
case "application/ogg":
+ case "audio/ogg":
case "audio/x-wav":
return (sbyte)InventoryType.Sound;
case "application/vnd.ll.callingcard":
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 9cdc80b..0925222 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3529,9 +3529,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void ProcessEntityUpdates(int maxUpdates)
{
- Lazy> objectUpdateBlocks = new Lazy>();
- Lazy> compressedUpdateBlocks = new Lazy>();
- Lazy> terseUpdateBlocks = new Lazy>();
+ OpenMetaverse.Lazy> objectUpdateBlocks = new OpenMetaverse.Lazy>();
+ OpenMetaverse.Lazy> compressedUpdateBlocks = new OpenMetaverse.Lazy>();
+ OpenMetaverse.Lazy> terseUpdateBlocks = new OpenMetaverse.Lazy>();
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
int updatesThisCall = 0;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index e43f7cf..194c064 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -140,13 +140,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
// Process all the pending adds
OutgoingPacket pendingAdd;
- while (m_pendingAdds.Dequeue(out pendingAdd))
+ while (m_pendingAdds.TryDequeue(out pendingAdd))
m_packets[pendingAdd.SequenceNumber] = pendingAdd;
// Process all the pending removes, including updating statistics and round-trip times
PendingAck pendingRemove;
OutgoingPacket ackedPacket;
- while (m_pendingRemoves.Dequeue(out pendingRemove))
+ while (m_pendingRemoves.TryDequeue(out pendingRemove))
{
if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
{
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 9eaa758..5255d30 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -252,7 +252,7 @@ namespace Flotsam.RegionModules.AssetCache
}
else
{
- m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue);
+ m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue);
}
}
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index e1bc243..e7cfda1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
public class UserAccountCache
{
+ private const double CACHE_EXPIRATION_SECONDS = 120.0;
+
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
@@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public void Cache(UUID userID, UserAccount account)
{
// Cache even null accounts
- m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d));
+ m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS);
if (account != null)
- m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d));
+ m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS);
m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 58698ee..0f08408 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup;
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
+using RegionSettings = OpenSim.Framework.RegionSettings;
namespace OpenSim.Region.CoreModules.World.Archiver.Tests
{
@@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SceneObjectPart part2 = CreateSceneObjectPart2();
- AssetNotecard nc = new AssetNotecard("Hello World!");
+ AssetNotecard nc = new AssetNotecard();
+ nc.BodyText = "Hello World!";
+ nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index da8199d..5e491c2 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -75,7 +75,9 @@ namespace OpenSim.Region.Framework.Tests
protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part)
{
- AssetNotecard nc = new AssetNotecard("Hello World!");
+ AssetNotecard nc = new AssetNotecard();
+ nc.BodyText = "Hello World!";
+ nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 446ac71..23f2b10 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -49,6 +49,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
{
+ private const double CACHE_EXPIRATION_SECONDS = 120.0;
+
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
@@ -141,7 +143,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
{ "UserID", userID.ToString() }
};
- return GetUser(requestArgs);
+ account = GetUser(requestArgs);
+
+ if (account == null)
+ {
+ // Store null responses too, to avoid repeated lookups for missing accounts
+ m_accountCache.AddOrUpdate(userID, null, CACHE_EXPIRATION_SECONDS);
+ }
+
+ return account;
}
public List GetUserAccounts(UUID scopeID, string query)
@@ -216,7 +226,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (success)
{
// Cache the user account info
- m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d));
+ m_accountCache.AddOrUpdate(data.PrincipalID, data, CACHE_EXPIRATION_SECONDS);
}
else
{
@@ -281,7 +291,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
// Cache the user account info
- m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d));
+ m_accountCache.AddOrUpdate(account.PrincipalID, account, CACHE_EXPIRATION_SECONDS);
return account;
}
--
cgit v1.1
From 0bebe94231c3b5aeaa24a0eeb38272a08b73473b Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 7 Sep 2010 15:45:33 -0700
Subject: Rolling back the recent libomv update but keeping the ExpiringCache
cleanups (as much as is possible). There was a report of non-finite avatar
positions after the update
---
OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++---
OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | 4 ++--
OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +-
.../ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | 4 ++--
.../Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | 6 +++---
5 files changed, 11 insertions(+), 11 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 0925222..cdf8cb1 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3529,9 +3529,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void ProcessEntityUpdates(int maxUpdates)
{
- OpenMetaverse.Lazy> objectUpdateBlocks = new OpenMetaverse.Lazy>();
- OpenMetaverse.Lazy> compressedUpdateBlocks = new OpenMetaverse.Lazy>();
- OpenMetaverse.Lazy> terseUpdateBlocks = new OpenMetaverse.Lazy>();
+ OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>();
+ OpenSim.Framework.Lazy> compressedUpdateBlocks = new OpenSim.Framework.Lazy>();
+ OpenSim.Framework.Lazy> terseUpdateBlocks = new OpenSim.Framework.Lazy>();
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
int updatesThisCall = 0;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index 194c064..e43f7cf 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -140,13 +140,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
// Process all the pending adds
OutgoingPacket pendingAdd;
- while (m_pendingAdds.TryDequeue(out pendingAdd))
+ while (m_pendingAdds.Dequeue(out pendingAdd))
m_packets[pendingAdd.SequenceNumber] = pendingAdd;
// Process all the pending removes, including updating statistics and round-trip times
PendingAck pendingRemove;
OutgoingPacket ackedPacket;
- while (m_pendingRemoves.TryDequeue(out pendingRemove))
+ while (m_pendingRemoves.Dequeue(out pendingRemove))
{
if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
{
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 5255d30..9eaa758 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -252,7 +252,7 @@ namespace Flotsam.RegionModules.AssetCache
}
else
{
- m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue);
+ m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue);
}
}
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index e7cfda1..7c12b8c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -53,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public void Cache(UUID userID, UserAccount account)
{
// Cache even null accounts
- m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS);
+ m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
if (account != null)
- m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS);
+ m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 23f2b10..1ac9882 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -148,7 +148,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (account == null)
{
// Store null responses too, to avoid repeated lookups for missing accounts
- m_accountCache.AddOrUpdate(userID, null, CACHE_EXPIRATION_SECONDS);
+ m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
}
return account;
@@ -226,7 +226,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (success)
{
// Cache the user account info
- m_accountCache.AddOrUpdate(data.PrincipalID, data, CACHE_EXPIRATION_SECONDS);
+ m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
}
else
{
@@ -291,7 +291,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
// Cache the user account info
- m_accountCache.AddOrUpdate(account.PrincipalID, account, CACHE_EXPIRATION_SECONDS);
+ m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
return account;
}
--
cgit v1.1
From 904d6b787a7fc399544145ae023162d6fa43fb63 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 8 Sep 2010 09:53:57 -0700
Subject: First version of the Hypergrid HELO service that will enable
different backends to interoperate.
---
.../Handlers/Hypergrid/HeloServerConnector.cs | 85 ++++++++++++++++++++++
.../Connectors/Hypergrid/HeloServiceConnector.cs | 75 +++++++++++++++++++
2 files changed, 160 insertions(+)
create mode 100644 OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
create mode 100644 OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
(limited to 'OpenSim')
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
new file mode 100644
index 0000000..3b25a52
--- /dev/null
+++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
@@ -0,0 +1,85 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using System.IO;
+using System.Net;
+using System.Reflection;
+using Nini.Config;
+using log4net;
+using OpenSim.Server.Base;
+using OpenSim.Services.Interfaces;
+using OpenSim.Framework.Servers.HttpServer;
+using OpenSim.Server.Handlers.Base;
+
+namespace OpenSim.Server.Handlers.Hypergrid
+{
+ public class HeloServiceConnector : ServiceConnector
+ {
+ private string m_ConfigName = "HeloService";
+
+ public HeloServiceConnector(IConfigSource config, IHttpServer server, string configName) :
+ base(config, server, configName)
+ {
+ IConfig serverConfig = config.Configs[m_ConfigName];
+ if (serverConfig == null)
+ throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
+
+ string handlers = serverConfig.GetString("Handlers", "opensim-robust");
+ server.AddStreamHandler(new HeloServerGetHandler(handlers));
+ }
+ }
+
+ public class HeloServerGetHandler : BaseStreamHandler
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private string m_HandlersType;
+
+ public HeloServerGetHandler(string handlersType) :
+ base("GET", "/helo")
+ {
+ m_HandlersType = handlersType;
+ }
+
+ public override byte[] Handle(string path, Stream requestData,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return OKResponse(httpResponse);
+ }
+
+ private byte[] OKResponse(OSHttpResponse httpResponse)
+ {
+ httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
+ httpResponse.StatusCode = (int)HttpStatusCode.OK;
+ httpResponse.StatusDescription = "OK";
+ return new byte[0];
+ }
+
+ }
+}
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
new file mode 100644
index 0000000..7b166c1
--- /dev/null
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 OpenSimulator 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 log4net;
+using System;
+using System.Net;
+using System.Reflection;
+using Nini.Config;
+
+namespace OpenSim.Services.Connectors
+{
+ public class HeloServicesConnector
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+
+ private string m_ServerURI = String.Empty;
+
+ public HeloServicesConnector()
+ {
+ }
+
+ public HeloServicesConnector(string serverURI)
+ {
+ m_ServerURI = serverURI.TrimEnd('/');
+ }
+
+
+ public virtual string Helo()
+ {
+ HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo");
+
+ try
+ {
+ WebResponse response = req.GetResponse();
+ if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null
+ return string.Empty;
+ return response.Headers.Get("X-Handlers-Provided");
+ }
+ catch (Exception e)
+ {
+ m_log.DebugFormat("[HELO SERVICE]: Unable to perform HELO request to {0}: {1}", m_ServerURI, e.Message);
+ }
+
+ // fail
+ return string.Empty;
+ }
+
+ }
+}
--
cgit v1.1
From 3fb4a17f1044f5bd995f703233f656f72ebe5269 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 8 Sep 2010 11:30:38 -0700
Subject: No need for a config var for the HELO message on the server-side.
It's robust.
---
OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
index 3b25a52..6c83aff 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
@@ -41,17 +41,10 @@ namespace OpenSim.Server.Handlers.Hypergrid
{
public class HeloServiceConnector : ServiceConnector
{
- private string m_ConfigName = "HeloService";
-
public HeloServiceConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
- IConfig serverConfig = config.Configs[m_ConfigName];
- if (serverConfig == null)
- throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
-
- string handlers = serverConfig.GetString("Handlers", "opensim-robust");
- server.AddStreamHandler(new HeloServerGetHandler(handlers));
+ server.AddStreamHandler(new HeloServerGetHandler("opensim-robust"));
}
}
--
cgit v1.1
From 8cc3d60e59b631951618d6b89c8ba54a72061bc4 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 8 Sep 2010 14:09:43 -0700
Subject: Added constructor that takes an URL to asset and inventory simian
connectors.
---
.../Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | 5 +++++
.../Connectors/SimianGrid/SimianInventoryServiceConnector.cs | 5 +++++
2 files changed, 10 insertions(+)
(limited to 'OpenSim')
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 8f601e8..30d3147 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -84,6 +84,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
CommonInit(source);
}
+ public SimianAssetServiceConnector(string url)
+ {
+ m_serverUrl = url;
+ }
+
public void Initialise(IConfigSource source)
{
IConfig moduleConfig = source.Configs["Modules"];
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 470eccd..3953369 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -91,6 +91,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
CommonInit(source);
}
+ public SimianInventoryServiceConnector(string url)
+ {
+ m_serverUrl = url;
+ }
+
public void Initialise(IConfigSource source)
{
IConfig moduleConfig = source.Configs["Modules"];
--
cgit v1.1
From d301f3fd6ad65e3eb39cfaff65cd3fbb896fa5c1 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 8 Sep 2010 14:12:01 -0700
Subject: Renamed the Helo server connector to a consistent name. Added this in
connector to both Robust.HG.ini.example and
HypergridServiceInConnectorModule.
---
.../Hypergrid/HypergridServiceInConnectorModule.cs | 1 +
OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
index 235914a..2f96bcb 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
@@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
new UserAgentServerConnector(m_Config, MainServer.Instance);
+ new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService");
}
scene.RegisterModuleInterface(m_HypergridHandler.GateKeeper);
}
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
index 6c83aff..39baa32 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
@@ -39,9 +39,9 @@ using OpenSim.Server.Handlers.Base;
namespace OpenSim.Server.Handlers.Hypergrid
{
- public class HeloServiceConnector : ServiceConnector
+ public class HeloServiceInConnector : ServiceConnector
{
- public HeloServiceConnector(IConfigSource config, IHttpServer server, string configName) :
+ public HeloServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
server.AddStreamHandler(new HeloServerGetHandler("opensim-robust"));
@@ -68,6 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
private byte[] OKResponse(OSHttpResponse httpResponse)
{
+ m_log.Debug("[HELO]: hi, I was called");
httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
httpResponse.StatusCode = (int)HttpStatusCode.OK;
httpResponse.StatusDescription = "OK";
--
cgit v1.1
From ae6682036df0268b47a27756915c72367663efec Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 8 Sep 2010 14:13:01 -0700
Subject: Made the HG asset and inventory brokers use the Helo service in order
to instantiate the right network connectors. Tested on Robust only.
---
.../Inventory/HGInventoryBroker.cs | 15 ++++++++------
.../Connectors/Asset/HGAssetServiceConnector.cs | 23 ++++++++++++++--------
2 files changed, 24 insertions(+), 14 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 5b4fecb..39410b5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors;
+using OpenSim.Services.Connectors.SimianGrid;
using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
@@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
else
{
- // We're instantiating this class explicitly, but this won't
- // work in general, because the remote grid may be running
- // an inventory server that has a different protocol.
- // Eventually we will want a piece of protocol asking
- // the remote server about its kind. Definitely cool thing to do!
- connector = new RemoteXInventoryServicesConnector(url);
+ // Still not as flexible as I would like this to be,
+ // but good enough for now
+ string connectorType = new HeloServicesConnector(url).Helo();
+ m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType);
+ if (connectorType == "opensim-simian")
+ connector = new SimianInventoryServiceConnector(url);
+ else
+ connector = new RemoteXInventoryServicesConnector(url);
m_connectors.Add(url, connector);
}
}
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
index 34df54a..5c31639 100644
--- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
@@ -32,6 +32,8 @@ using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
+using OpenSim.Services.Connectors.Hypergrid;
+using OpenSim.Services.Connectors.SimianGrid;
namespace OpenSim.Services.Connectors
{
@@ -41,7 +43,7 @@ namespace OpenSim.Services.Connectors
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
- private Dictionary m_connectors = new Dictionary();
+ private Dictionary m_connectors = new Dictionary();
public HGAssetServiceConnector(IConfigSource source)
{
@@ -81,7 +83,7 @@ namespace OpenSim.Services.Connectors
private IAssetService GetConnector(string url)
{
- AssetServicesConnector connector = null;
+ IAssetService connector = null;
lock (m_connectors)
{
if (m_connectors.ContainsKey(url))
@@ -90,12 +92,17 @@ namespace OpenSim.Services.Connectors
}
else
{
- // We're instantiating this class explicitly, but this won't
- // work in general, because the remote grid may be running
- // an asset server that has a different protocol.
- // Eventually we will want a piece of protocol asking
- // the remote server about its kind. Definitely cool thing to do!
- connector = new AssetServicesConnector(url);
+ // Still not as flexible as I would like this to be,
+ // but good enough for now
+ string connectorType = new HeloServicesConnector(url).Helo();
+ m_log.DebugFormat("[HG ASSET SERVICE]: HELO returned {0}", connectorType);
+ if (connectorType == "opensim-simian")
+ {
+ connector = new SimianAssetServiceConnector(url);
+ }
+ else
+ connector = new AssetServicesConnector(url);
+
m_connectors.Add(url, connector);
}
}
--
cgit v1.1
From 5dc9ea2f2487804d788b4b80d40d91bd792de4c2 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Wed, 8 Sep 2010 15:08:49 -0700
Subject: * Changed 11 calls for session info to the more optimized API method
---
.../CoreModules/Avatar/Friends/FriendsModule.cs | 100 +++++++--------------
.../Avatar/InstantMessage/MessageTransferModule.cs | 4 +-
.../Shared/Api/Implementation/LSL_Api.cs | 10 +--
.../Connectors/SimianGrid/SimianProfiles.cs | 4 +-
4 files changed, 37 insertions(+), 81 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 6f044cb..1c1ba2d 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -348,10 +348,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID));
im.fromAgentName = account.FirstName + " " + account.LastName;
- PresenceInfo presence = null;
- PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
- if (presences != null && presences.Length > 0)
- presence = presences[0];
+ PresenceInfo presence = PresenceService.GetAgent(new UUID(im.fromAgentID));
if (presence != null)
im.offline = 0;
@@ -470,26 +467,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
// The friend is not here [as root]. Let's forward.
- PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
- if (friendSessions != null && friendSessions.Length > 0)
+ PresenceInfo friendSession = PresenceService.GetAgent(friendID);
+ if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check
{
- PresenceInfo friendSession = null;
- foreach (PresenceInfo pinfo in friendSessions)
- if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad
- {
- friendSession = pinfo;
- break;
- }
-
- if (friendSession != null)
- {
- GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
- //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
- m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
- }
+ GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
+ //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
+ m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
}
-
- // Friend is not online. Ignore.
}
else
m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
@@ -528,15 +512,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
// The prospective friend is not here [as root]. Let's forward.
- PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
- if (friendSessions != null && friendSessions.Length > 0)
+ PresenceInfo friendSession = PresenceService.GetAgent(friendID);
+ if (friendSession != null)
{
- PresenceInfo friendSession = friendSessions[0];
- if (friendSession != null)
- {
- GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
- m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
- }
+ GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
+ m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
}
// If the prospective friend is not online, he'll get the message upon login.
}
@@ -563,16 +543,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
// The friend is not here
- PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
- if (friendSessions != null && friendSessions.Length > 0)
+ PresenceInfo friendSession = PresenceService.GetAgent(friendID);
+ if (friendSession != null)
{
- PresenceInfo friendSession = friendSessions[0];
- if (friendSession != null)
- {
- GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
- m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
- client.SendAgentOnline(new UUID[] { friendID });
- }
+ GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
+ m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
+ client.SendAgentOnline(new UUID[] { friendID });
}
}
@@ -591,18 +567,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipDenied(agentID, client.Name, friendID))
return;
- PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
- if (friendSessions != null && friendSessions.Length > 0)
+ PresenceInfo friendSession = PresenceService.GetAgent(friendID);
+ if (friendSession != null)
{
- PresenceInfo friendSession = friendSessions[0];
- if (friendSession != null)
- {
- GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
- if (region != null)
- m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
- else
- m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
- }
+ GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
+ if (region != null)
+ m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
+ else
+ m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
}
}
@@ -624,15 +596,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipTerminated(exfriendID))
return;
- PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
- if (friendSessions != null && friendSessions.Length > 0)
+ PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
+ if (friendSession != null)
{
- PresenceInfo friendSession = friendSessions[0];
- if (friendSession != null)
- {
- GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
- m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
- }
+ GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
+ m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
}
}
@@ -669,17 +637,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalGrantRights(requester, target, myFlags, rights))
return;
- PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
- if (friendSessions != null && friendSessions.Length > 0)
+ PresenceInfo friendSession = PresenceService.GetAgent(target);
+ if (friendSession != null)
{
- PresenceInfo friendSession = friendSessions[0];
- if (friendSession != null)
- {
- GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
- // TODO: You might want to send the delta to save the lookup
- // on the other end!!
- m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
- }
+ GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
+ // TODO: You might want to send the delta to save the lookup
+ // on the other end!!
+ m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
}
}
}
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 730cc77..13bae2e 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -498,9 +498,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (lookupAgent)
{
// Non-cached user agent lookup.
- PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
- if (presences != null && presences.Length > 0)
- upd = presences[0];
+ upd = PresenceService.GetAgent(toAgentID);
if (upd != null)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b51b410..a9c5d10 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3971,9 +3971,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
- PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
- if (pinfos != null && pinfos.Length > 0)
- pinfo = pinfos[0];
+ pinfo = World.PresenceService.GetAgent(uuid);
ce = new UserInfoCacheEntry();
ce.time = Util.EnvironmentTickCount();
@@ -3991,11 +3989,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
{
- PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
- if (pinfos != null && pinfos.Length > 0)
- pinfo = pinfos[0];
- else
- pinfo = null;
+ pinfo = World.PresenceService.GetAgent(uuid);
ce.time = Util.EnvironmentTickCount();
ce.pinfo = pinfo;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index 0ef4974..b7e8538 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
// Check if the user is online
if (client.Scene is Scene)
{
- OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() });
- if (presences != null && presences.Length > 0)
+ OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID);
+ if (presence != null)
flags |= ProfileFlags.Online;
}
--
cgit v1.1
From 8415b988063234ab7686b873520708891bca50a6 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 9 Sep 2010 14:45:10 -0700
Subject: Over a dozen thread safety fixes in FriendsModule
---
.../CoreModules/Avatar/Friends/FriendsModule.cs | 330 ++++++++++-----------
1 file changed, 163 insertions(+), 167 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 1c1ba2d..4e4eee9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public UUID PrincipalID;
public FriendInfo[] Friends;
public int Refcount;
- public UUID RegionID;
public bool IsFriend(string friend)
{
@@ -67,7 +66,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return false;
}
}
-
+
+ private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0];
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected List m_Scenes = new List();
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected Dictionary m_Friends =
new Dictionary();
- protected List m_NeedsListOfFriends = new List();
+ protected HashSet m_NeedsListOfFriends = new HashSet();
protected IPresenceService PresenceService
{
@@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Instantiate the request handler
IHttpServer server = MainServer.GetHttpServer((uint)mPort);
server.AddStreamHandler(new FriendsRequestHandler(this));
-
}
if (m_FriendsService == null)
@@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
- scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
scene.EventManager.OnClientLogin += OnClientLogin;
}
@@ -198,16 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public uint GetFriendPerms(UUID principalID, UUID friendID)
{
- if (!m_Friends.ContainsKey(principalID))
- return 0;
-
- UserFriendData data = m_Friends[principalID];
-
- foreach (FriendInfo fi in data.Friends)
+ FriendInfo[] friends = GetFriends(principalID);
+ foreach (FriendInfo fi in friends)
{
if (fi.Friend == friendID.ToString())
return (uint)fi.TheirFlags;
}
+
return 0;
}
@@ -217,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnApproveFriendRequest += OnApproveFriendRequest;
client.OnDenyFriendRequest += OnDenyFriendRequest;
client.OnTerminateFriendship += OnTerminateFriendship;
-
client.OnGrantUserRights += OnGrantUserRights;
- lock (m_Friends)
- {
- if (m_Friends.ContainsKey(client.AgentId))
+ // Asynchronously fetch the friends list or increment the refcount for the existing
+ // friends list
+ Util.FireAndForget(
+ delegate(object o)
{
- m_Friends[client.AgentId].Refcount++;
- return;
- }
-
- UserFriendData newFriends = new UserFriendData();
-
- newFriends.PrincipalID = client.AgentId;
- newFriends.Friends = m_FriendsService.GetFriends(client.AgentId);
- newFriends.Refcount = 1;
- newFriends.RegionID = UUID.Zero;
+ lock (m_Friends)
+ {
+ UserFriendData friendsData;
+ if (m_Friends.TryGetValue(client.AgentId, out friendsData))
+ {
+ friendsData.Refcount++;
+ }
+ else
+ {
+ friendsData = new UserFriendData();
+ friendsData.PrincipalID = client.AgentId;
+ friendsData.Friends = FriendsService.GetFriends(client.AgentId);
+ friendsData.Refcount = 1;
- m_Friends.Add(client.AgentId, newFriends);
- }
-
+ m_Friends[client.AgentId] = friendsData;
+ }
+ }
+ }
+ );
}
private void OnClientClosed(UUID agentID, Scene scene)
{
ScenePresence sp = scene.GetScenePresence(agentID);
if (sp != null && !sp.IsChildAgent)
+ {
// do this for root agents closing out
StatusChange(agentID, false);
+ }
lock (m_Friends)
- if (m_Friends.ContainsKey(agentID))
+ {
+ UserFriendData friendsData;
+ if (m_Friends.TryGetValue(agentID, out friendsData))
{
- if (m_Friends[agentID].Refcount == 1)
+ friendsData.Refcount--;
+ if (friendsData.Refcount <= 0)
m_Friends.Remove(agentID);
- else
- m_Friends[agentID].Refcount--;
}
- }
-
- private void OnMakeRootAgent(ScenePresence sp)
- {
- UUID agentID = sp.ControllingClient.AgentId;
-
- if (m_Friends.ContainsKey(agentID))
- {
- // This is probably an overkill, but just
- // to make sure we have the latest and greatest
- // friends list -- always pull OnMakeRoot
- m_Friends[agentID].Friends =
- m_FriendsService.GetFriends(agentID);
-
- m_Friends[agentID].RegionID =
- sp.ControllingClient.Scene.RegionInfo.RegionID;
}
}
-
- private void OnMakeChildAgent(ScenePresence sp)
+ private void OnMakeRootAgent(ScenePresence sp)
{
UUID agentID = sp.ControllingClient.AgentId;
-
- if (m_Friends.ContainsKey(agentID))
- {
- if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID)
- m_Friends[agentID].RegionID = UUID.Zero;
- }
+ UpdateFriendsCache(agentID);
}
private void OnClientLogin(IClientAPI client)
@@ -295,72 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Register that we need to send the list of online friends to this user
lock (m_NeedsListOfFriends)
- if (!m_NeedsListOfFriends.Contains(agentID))
- {
- m_NeedsListOfFriends.Add(agentID);
- }
+ m_NeedsListOfFriends.Add(agentID);
}
public void SendFriendsOnlineIfNeeded(IClientAPI client)
{
UUID agentID = client.AgentId;
- if (m_NeedsListOfFriends.Contains(agentID))
+
+ // Check if the online friends list is needed
+ lock (m_NeedsListOfFriends)
{
- if (!m_Friends.ContainsKey(agentID))
- {
- m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID);
+ if (!m_NeedsListOfFriends.Remove(agentID))
return;
- }
-
- //
- // Send the friends online
- //
- List online = GetOnlineFriends(agentID);
- if (online.Count > 0)
- {
- m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
- client.SendAgentOnline(online.ToArray());
- }
-
- //
- // Send outstanding friendship offers
- //
- if (m_Friends.ContainsKey(agentID))
- {
- List outstanding = new List();
+ }
- foreach (FriendInfo fi in m_Friends[agentID].Friends)
- if (fi.TheirFlags == -1)
- outstanding.Add(fi.Friend);
+ // Send the friends online
+ List online = GetOnlineFriends(agentID);
+ if (online.Count > 0)
+ {
+ m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
+ client.SendAgentOnline(online.ToArray());
+ }
- GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero);
- foreach (string fid in outstanding)
- {
- try
- {
- im.fromAgentID = new Guid(fid);
- }
- catch
- {
- continue;
- }
+ // Send outstanding friendship offers
+ List outstanding = new List();
+ FriendInfo[] friends = GetFriends(agentID);
+ foreach (FriendInfo fi in friends)
+ {
+ if (fi.TheirFlags == -1)
+ outstanding.Add(fi.Friend);
+ }
- UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID));
- im.fromAgentName = account.FirstName + " " + account.LastName;
+ GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered,
+ "Will you be my friend?", true, Vector3.Zero);
- PresenceInfo presence = PresenceService.GetAgent(new UUID(im.fromAgentID));
- if (presence != null)
- im.offline = 0;
+ foreach (string fid in outstanding)
+ {
+ UUID fromAgentID;
+ if (!UUID.TryParse(fid, out fromAgentID))
+ continue;
- im.imSessionID = im.fromAgentID;
+ UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
+ PresenceInfo presence = PresenceService.GetAgent(fromAgentID);
- // Finally
- LocalFriendshipOffered(agentID, im);
- }
- }
+ im.fromAgentID = fromAgentID.Guid;
+ im.fromAgentName = account.FirstName + " " + account.LastName;
+ im.offline = (byte)((presence == null) ? 1 : 0);
+ im.imSessionID = im.fromAgentID;
- lock (m_NeedsListOfFriends)
- m_NeedsListOfFriends.Remove(agentID);
+ // Finally
+ LocalFriendshipOffered(agentID, im);
}
}
@@ -369,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
List friendList = new List();
List online = new List();
- foreach (FriendInfo fi in m_Friends[userID].Friends)
+ FriendInfo[] friends = GetFriends(userID);
+ foreach (FriendInfo fi in friends)
{
if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi.Friend);
}
- if (friendList.Count == 0)
- // no friends whatsoever
- return online;
-
- PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
-
- foreach (PresenceInfo pi in presence)
- online.Add(new UUID(pi.UserID));
- //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
+ if (friendList.Count > 0)
+ {
+ PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
+ foreach (PresenceInfo pi in presence)
+ {
+ UUID presenceID;
+ if (UUID.TryParse(pi.UserID, out presenceID))
+ online.Add(presenceID);
+ }
+ }
return online;
}
- //
- // Find the client for a ID
- //
+ ///
+ /// Find the client for a ID
+ ///
public IClientAPI LocateClientObject(UUID agentID)
{
Scene scene = GetClientScene(agentID);
- if (scene == null)
- return null;
-
- ScenePresence presence = scene.GetScenePresence(agentID);
- if (presence == null)
- return null;
+ if (scene != null)
+ {
+ ScenePresence presence = scene.GetScenePresence(agentID);
+ if (presence != null)
+ return presence.ControllingClient;
+ }
- return presence.ControllingClient;
+ return null;
}
- //
- // Find the scene for an agent
- //
+ ///
+ /// Find the scene for an agent
+ ///
private Scene GetClientScene(UUID agentId)
{
lock (m_Scenes)
@@ -414,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
foreach (Scene scene in m_Scenes)
{
ScenePresence presence = scene.GetScenePresence(agentId);
- if (presence != null)
- {
- if (!presence.IsChildAgent)
- return scene;
- }
+ if (presence != null && !presence.IsChildAgent)
+ return scene;
}
}
+
return null;
}
@@ -431,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
///
private void StatusChange(UUID agentID, bool online)
{
- //m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online);
- if (m_Friends.ContainsKey(agentID))
+ FriendInfo[] friends = GetFriends(agentID);
+ if (friends.Length > 0)
{
- //m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length);
List friendList = new List();
- foreach (FriendInfo fi in m_Friends[agentID].Friends)
+ foreach (FriendInfo fi in friends)
{
if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi);
}
- Util.FireAndForget(delegate
- {
- foreach (FriendInfo fi in friendList)
+ Util.FireAndForget(
+ delegate
{
- //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
- // Notify about this user status
- StatusNotify(fi, agentID, online);
+ foreach (FriendInfo fi in friendList)
+ {
+ //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
+ // Notify about this user status
+ StatusNotify(fi, agentID, online);
+ }
}
- });
+ );
}
- else
- m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID);
}
private void StatusNotify(FriendInfo friend, UUID userID, bool online)
{
- UUID friendID = UUID.Zero;
-
+ UUID friendID;
if (UUID.TryParse(friend.Friend, out friendID))
{
// Try local
@@ -476,12 +439,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
else
+ {
m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
+ }
}
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
- if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered)
+ if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
{
// we got a friendship offer
UUID principalID = new UUID(im.fromAgentID);
@@ -527,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
- // update the local cache
- m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
+ // Update the local cache
+ UpdateFriendsCache(agentID);
//
// Notify the friend
@@ -584,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
FriendsService.Delete(exfriendID, agentID.ToString());
// Update local cache
- m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
+ UpdateFriendsCache(agentID);
client.SendTerminateFriend(exfriendID);
@@ -606,16 +571,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
{
- if (!m_Friends.ContainsKey(remoteClient.AgentId))
+ FriendInfo[] friends = GetFriends(remoteClient.AgentId);
+ if (friends.Length == 0)
return;
m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
// Let's find the friend in this user's friend list
- UserFriendData fd = m_Friends[remoteClient.AgentId];
FriendInfo friend = null;
- foreach (FriendInfo fi in fd.Friends)
+ foreach (FriendInfo fi in friends)
+ {
if (fi.Friend == target.ToString())
friend = fi;
+ }
if (friend != null) // Found it
{
@@ -672,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im);
- // update the local cache
- m_Friends[friendID].Friends = FriendsService.GetFriends(friendID);
+
+ // Update the local cache
+ UpdateFriendsCache(friendID);
+
// we're done
return true;
}
@@ -687,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (friendClient != null)
{
// the prospective friend in this sim as root agent
-
GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im);
@@ -706,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// the friend in this sim as root agent
friendClient.SendTerminateFriend(exfriendID);
// update local cache
- m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID);
+ UpdateFriendsCache(exfriendID);
// we're done
return true;
}
@@ -735,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
- // update local cache
- //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID);
- foreach (FriendInfo finfo in m_Friends[friendID].Friends)
- if (finfo.Friend == userID.ToString())
- finfo.TheirFlags = rights;
+ // Update local cache
+ lock (m_Friends)
+ {
+ FriendInfo[] friends = GetFriends(friendID);
+ foreach (FriendInfo finfo in friends)
+ {
+ if (finfo.Friend == userID.ToString())
+ finfo.TheirFlags = rights;
+ }
+ }
return true;
}
@@ -765,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return false;
}
+
#endregion
+ private FriendInfo[] GetFriends(UUID agentID)
+ {
+ UserFriendData friendsData;
+
+ lock (m_Friends)
+ {
+ if (m_Friends.TryGetValue(agentID, out friendsData))
+ return friendsData.Friends;
+ }
+
+ return EMPTY_FRIENDS;
+ }
+
+ private void UpdateFriendsCache(UUID agentID)
+ {
+ lock (m_Friends)
+ {
+ UserFriendData friendsData;
+ if (m_Friends.TryGetValue(agentID, out friendsData))
+ friendsData.Friends = FriendsService.GetFriends(agentID);
+ }
+ }
}
}
--
cgit v1.1
From 9609faa8eb330dc85dfb2efec1e7e5652f01d6f2 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 9 Sep 2010 15:05:22 -0700
Subject: * Run SimianGrid session updates asynchronously instead of from the
main heartbeat thread * Minor dead code cleanup
---
.../SimianGrid/SimianActivityDetector.cs | 8 ++--
.../SimianGrid/SimianAvatarServiceConnector.cs | 3 --
.../SimianGrid/SimianFriendsServiceConnector.cs | 3 --
.../SimianGrid/SimianInventoryServiceConnector.cs | 1 -
.../SimianGrid/SimianPresenceServiceConnector.cs | 55 ----------------------
.../SimianUserAccountServiceConnector.cs | 1 -
6 files changed, 5 insertions(+), 66 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
index a871d07..67b73f3 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
@@ -26,11 +26,9 @@
*/
using System;
-using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
-using OpenSim.Services.Interfaces;
using OpenMetaverse;
using log4net;
@@ -107,7 +105,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
{
- m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
+ // Asynchronously update the position stored in the session table for this agent
+ Util.FireAndForget(delegate(object o)
+ {
+ m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
+ });
}
}
}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index 3505c64..4d0d53e 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -28,8 +28,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
-using System.IO;
-using System.Net;
using System.Reflection;
using log4net;
using Mono.Addins;
@@ -37,7 +35,6 @@ using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
-using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
index 5b18aef..6f2d735 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
@@ -30,13 +30,10 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Reflection;
using log4net;
-using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 3953369..21ad4ab 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -37,7 +37,6 @@ using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
-using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
namespace OpenSim.Services.Connectors.SimianGrid
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 077be3c..a344594 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -28,17 +28,14 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
-using System.Net;
using System.Reflection;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
-using OpenSim.Server.Base;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
@@ -358,25 +355,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
return null;
}
-// private OSDMap GetSessionData(UUID sessionID)
-// {
-// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID);
-//
-// NameValueCollection requestArgs = new NameValueCollection
-// {
-// { "RequestMethod", "GetSession" },
-// { "SessionID", sessionID.ToString() }
-// };
-//
-// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
-// if (response["Success"].AsBoolean())
-// return response;
-// else
-// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID);
-//
-// return null;
-// }
-
private List GetSessions(UUID userID)
{
List presences = new List(1);
@@ -429,39 +407,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
return success;
}
- /////
- ///// Fetch the last known avatar location with GetSession and persist it
- ///// as user data with AddUserData
- /////
- //private bool SetLastLocation(UUID sessionID)
- //{
- // NameValueCollection requestArgs = new NameValueCollection
- // {
- // { "RequestMethod", "GetSession" },
- // { "SessionID", sessionID.ToString() }
- // };
-
- // OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
- // bool success = response["Success"].AsBoolean();
-
- // if (success)
- // {
- // UUID userID = response["UserID"].AsUUID();
- // UUID sceneID = response["SceneID"].AsUUID();
- // Vector3 position = response["ScenePosition"].AsVector3();
- // Vector3 lookAt = response["SceneLookAt"].AsVector3();
-
- // return SetLastLocation(userID, sceneID, position, lookAt);
- // }
- // else
- // {
- // m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID +
- // " while saving last location: " + response["Message"].AsString());
- // }
-
- // return success;
- //}
-
private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse)
{
if (sessionResponse == null)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 1ac9882..ddd2322 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -28,7 +28,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
-using System.IO;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
--
cgit v1.1
From dd277a0d02f1aa79f4fcb5d108cbc696e90500c2 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 10 Sep 2010 12:04:12 -0700
Subject: First pass at cleaning up thread safety in EntityManager and
SceneGraph
---
OpenSim/Data/IAssetData.cs | 11 -
OpenSim/Data/IInventoryData.cs | 11 -
.../Avatar/Attachments/AttachmentsModule.cs | 2 +-
.../Archiver/ArchiveWriteRequestPreparation.cs | 2 +-
.../CoreModules/World/Land/LandManagementModule.cs | 3 +-
.../World/Serialiser/SerialiseObjects.cs | 2 +-
.../World/Serialiser/SerialiserModule.cs | 4 +-
.../CoreModules/World/WorldMap/MapImageModule.cs | 2 +-
OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | 3 +-
.../Interfaces/IRegionSerialiserModule.cs | 4 +-
OpenSim/Region/Framework/Scenes/EntityManager.cs | 210 ++++------------
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 3 +-
.../Framework/Scenes/Scene.PacketHandlers.cs | 16 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 45 ++--
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 263 ++++++++++-----------
OpenSim/Region/Framework/Scenes/SceneViewer.cs | 3 +-
.../Scenes/Serialization/SceneXmlLoader.cs | 23 +-
.../Server/IRCClientView.cs | 10 +-
.../ContentManagementSystem/CMEntityCollection.cs | 2 +-
.../ContentManagementEntity.cs | 2 +-
.../Scripting/Minimodule/ObjectAccessor.cs | 4 +-
.../OptionalModules/Scripting/Minimodule/World.cs | 6 +-
.../World/TreePopulator/TreePopulatorModule.cs | 3 +-
.../Api/Implementation/Plugins/SensorRepeat.cs | 2 +-
.../SimianGrid/SimianActivityDetector.cs | 5 +-
25 files changed, 249 insertions(+), 392 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs
index 90d5eeb..f31b215c 100644
--- a/OpenSim/Data/IAssetData.cs
+++ b/OpenSim/Data/IAssetData.cs
@@ -40,15 +40,4 @@ namespace OpenSim.Data
void Initialise(string connect);
bool Delete(string id);
}
-
- public class AssetDataInitialiser : PluginInitialiserBase
- {
- private string connect;
- public AssetDataInitialiser (string s) { connect = s; }
- public override void Initialise (IPlugin plugin)
- {
- IAssetDataPlugin p = plugin as IAssetDataPlugin;
- p.Initialise (connect);
- }
- }
}
diff --git a/OpenSim/Data/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs
index 90f74b7..74d5d37 100644
--- a/OpenSim/Data/IInventoryData.cs
+++ b/OpenSim/Data/IInventoryData.cs
@@ -155,15 +155,4 @@ namespace OpenSim.Data
///
List fetchActiveGestures(UUID avatarID);
}
-
- public class InventoryDataInitialiser : PluginInitialiserBase
- {
- private string connect;
- public InventoryDataInitialiser (string s) { connect = s; }
- public override void Initialise (IPlugin plugin)
- {
- IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
- p.Initialise (connect);
- }
- }
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index dd7d831..7270304 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -436,7 +436,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// We can NOT use the dictionries here, as we are looking
// for an entity by the fromAssetID, which is NOT the prim UUID
- List detachEntities = m_scene.GetEntities();
+ EntityBase[] detachEntities = m_scene.GetEntities();
SceneObjectGroup group;
foreach (EntityBase entity in detachEntities)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index b25636f..283b33b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
Dictionary assetUuids = new Dictionary();
- List entities = m_scene.GetEntities();
+ EntityBase[] entities = m_scene.GetEntities();
List sceneObjects = new List();
/*
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index da7a284..ea71fd9 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -794,7 +794,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnParcelPrimCountUpdate()
{
ResetAllLandPrimCounts();
- foreach (EntityBase obj in m_scene.Entities)
+ EntityBase[] entities = m_scene.Entities.GetEntities();
+ foreach (EntityBase obj in entities)
{
if (obj != null)
{
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
index bef7fe4..5067ebd 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
{
string xmlstream = "";
- List EntityList = scene.GetEntities();
+ EntityBase[] EntityList = scene.GetEntities();
List EntityXml = new List();
foreach (EntityBase ent in EntityList)
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
index 58e4261..98fe493 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
@@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
return SceneXmlLoader.SaveGroupToXml2(grp);
}
- public void SavePrimListToXml2(List entityList, string fileName)
+ public void SavePrimListToXml2(EntityBase[] entityList, string fileName)
{
SceneXmlLoader.SavePrimListToXml2(entityList, fileName);
}
- public void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max)
+ public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
{
SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max);
}
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 57eff8a..1d9c2bd 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
double[,] hm = whichScene.Heightmap.GetDoubles();
tc = Environment.TickCount;
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
- List objs = whichScene.GetEntities();
+ EntityBase[] objs = whichScene.GetEntities();
Dictionary z_sort = new Dictionary();
//SortedList z_sort = new SortedList();
List z_sortheights = new List();
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
index 3c39f9e..5e75cae 100644
--- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
@@ -101,7 +101,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", "");
XmlNode node;
- foreach (EntityBase entity in m_scene.Entities)
+ EntityBase[] entities = m_scene.Entities.GetEntities();
+ foreach (EntityBase entity in entities)
{
// only objects, not avatars
if (entity is SceneObjectGroup)
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
index e7562a5..18758c8 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces
///
///
///
- void SavePrimListToXml2(List entityList, string fileName);
+ void SavePrimListToXml2(EntityBase[] entityList, string fileName);
///
/// Save a set of prims in the xml2 format, optionally specifying a bounding box for which
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Interfaces
///
///
///
- void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max);
+ void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max);
void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName);
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs
index 099fcce..85d0a4f 100644
--- a/OpenSim/Region/Framework/Scenes/EntityManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs
@@ -34,187 +34,89 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Scenes
{
- public class EntityManager : IEnumerable
+ public class EntityManager //: IEnumerable
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private readonly Dictionary m_eb_uuid = new Dictionary();
- private readonly Dictionary m_eb_localID = new Dictionary();
- //private readonly Dictionary m_pres_uuid = new Dictionary();
- private readonly Object m_lock = new Object();
+ private readonly DoubleDictionary m_entities = new DoubleDictionary();
- [Obsolete("Use Add() instead.")]
- public void Add(UUID id, EntityBase eb)
+ public int Count
{
- Add(eb);
+ get { return m_entities.Count; }
}
public void Add(EntityBase entity)
{
- lock (m_lock)
- {
- try
- {
- m_eb_uuid.Add(entity.UUID, entity);
- m_eb_localID.Add(entity.LocalId, entity);
- }
- catch(Exception e)
- {
- m_log.ErrorFormat("Add Entity failed: {0}", e.Message);
- }
- }
- }
-
- public void InsertOrReplace(EntityBase entity)
- {
- lock (m_lock)
- {
- try
- {
- m_eb_uuid[entity.UUID] = entity;
- m_eb_localID[entity.LocalId] = entity;
- }
- catch(Exception e)
- {
- m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message);
- }
- }
+ m_entities.Add(entity.UUID, entity.LocalId, entity);
}
public void Clear()
{
- lock (m_lock)
- {
- m_eb_uuid.Clear();
- m_eb_localID.Clear();
- }
- }
-
- public int Count
- {
- get
- {
- return m_eb_uuid.Count;
- }
+ m_entities.Clear();
}
public bool ContainsKey(UUID id)
{
- try
- {
- return m_eb_uuid.ContainsKey(id);
- }
- catch
- {
- return false;
- }
+ return m_entities.ContainsKey(id);
}
public bool ContainsKey(uint localID)
{
- try
- {
- return m_eb_localID.ContainsKey(localID);
- }
- catch
- {
- return false;
- }
+ return m_entities.ContainsKey(localID);
}
public bool Remove(uint localID)
{
- lock (m_lock)
- {
- try
- {
- bool a = false;
- EntityBase entity;
- if (m_eb_localID.TryGetValue(localID, out entity))
- a = m_eb_uuid.Remove(entity.UUID);
-
- bool b = m_eb_localID.Remove(localID);
- return a && b;
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("Remove Entity failed for {0}", localID, e);
- return false;
- }
- }
+ return m_entities.Remove(localID);
}
public bool Remove(UUID id)
{
- lock (m_lock)
- {
- try
- {
- bool a = false;
- EntityBase entity;
- if (m_eb_uuid.TryGetValue(id, out entity))
- a = m_eb_localID.Remove(entity.LocalId);
-
- bool b = m_eb_uuid.Remove(id);
- return a && b;
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("Remove Entity failed for {0}", id, e);
- return false;
- }
- }
+ return m_entities.Remove(id);
}
- public List GetAllByType()
+ public EntityBase[] GetAllByType()
{
List tmp = new List();
- lock (m_lock)
- {
- try
+ m_entities.ForEach(
+ delegate(EntityBase entity)
{
- foreach (KeyValuePair pair in m_eb_uuid)
- {
- if (pair.Value is T)
- {
- tmp.Add(pair.Value);
- }
- }
+ if (entity is T)
+ tmp.Add(entity);
}
- catch (Exception e)
- {
- m_log.ErrorFormat("GetAllByType failed for {0}", e);
- tmp = null;
- }
- }
+ );
- return tmp;
+ return tmp.ToArray();
}
- public List GetEntities()
+ public EntityBase[] GetEntities()
{
- lock (m_lock)
- {
- return new List(m_eb_uuid.Values);
- }
+ List tmp = new List(m_entities.Count);
+ m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); });
+ return tmp.ToArray();
+ }
+
+ public void ForEach(Action action)
+ {
+ m_entities.ForEach(action);
+ }
+
+ public EntityBase Find(Predicate predicate)
+ {
+ return m_entities.FindValue(predicate);
}
public EntityBase this[UUID id]
{
get
{
- lock (m_lock)
- {
- EntityBase entity;
- if (m_eb_uuid.TryGetValue(id, out entity))
- return entity;
- else
- return null;
- }
+ EntityBase entity;
+ m_entities.TryGetValue(id, out entity);
+ return entity;
}
set
{
- InsertOrReplace(value);
+ Add(value);
}
}
@@ -222,50 +124,38 @@ namespace OpenSim.Region.Framework.Scenes
{
get
{
- lock (m_lock)
- {
- EntityBase entity;
- if (m_eb_localID.TryGetValue(localID, out entity))
- return entity;
- else
- return null;
- }
+ EntityBase entity;
+ m_entities.TryGetValue(localID, out entity);
+ return entity;
}
set
{
- InsertOrReplace(value);
+ Add(value);
}
}
public bool TryGetValue(UUID key, out EntityBase obj)
{
- lock (m_lock)
- {
- return m_eb_uuid.TryGetValue(key, out obj);
- }
+ return m_entities.TryGetValue(key, out obj);
}
public bool TryGetValue(uint key, out EntityBase obj)
{
- lock (m_lock)
- {
- return m_eb_localID.TryGetValue(key, out obj);
- }
+ return m_entities.TryGetValue(key, out obj);
}
///
/// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that.
///
///
- public IEnumerator GetEnumerator()
- {
- return GetEntities().GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
+ //public IEnumerator GetEnumerator()
+ //{
+ // return GetEntities().GetEnumerator();
+ //}
+
+ //IEnumerator IEnumerable.GetEnumerator()
+ //{
+ // return GetEnumerator();
+ //}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index c49386a..a439eb9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
- foreach (EntityBase group in Entities)
+ EntityBase[] entities = Entities.GetEntities();
+ foreach (EntityBase group in entities)
{
if (group is SceneObjectGroup)
{
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index c511774..2f69476 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
///
public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
{
- List EntityList = GetEntities();
-
- foreach (EntityBase ent in EntityList)
+ EntityBase[] entityList = GetEntities();
+ foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
///
public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
{
- List EntityList = GetEntities();
-
- foreach (EntityBase ent in EntityList)
+ EntityBase[] entityList = GetEntities();
+ foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List surfaceArgs)
{
- List EntityList = GetEntities();
+ EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0)
@@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs)
{
- List EntityList = GetEntities();
+ EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0)
@@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List surfaceArgs)
{
- List EntityList = GetEntities();
+ EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 82e7d76..7ce95a7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1029,29 +1029,30 @@ namespace OpenSim.Region.Framework.Scenes
if (ScriptEngine)
{
m_log.Info("Stopping all Scripts in Scene");
- foreach (EntityBase ent in Entities)
+
+ EntityBase[] entities = Entities.GetEntities();
+ foreach (EntityBase ent in entities)
{
if (ent is SceneObjectGroup)
- {
- ((SceneObjectGroup) ent).RemoveScriptInstances(false);
- }
+ ((SceneObjectGroup)ent).RemoveScriptInstances(false);
}
}
else
{
m_log.Info("Starting all Scripts in Scene");
- lock (Entities)
+
+ EntityBase[] entities = Entities.GetEntities();
+ foreach (EntityBase ent in entities)
{
- foreach (EntityBase ent in Entities)
+ if (ent is SceneObjectGroup)
{
- if (ent is SceneObjectGroup)
- {
- ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
- ((SceneObjectGroup)ent).ResumeScripts();
- }
+ SceneObjectGroup sog = (SceneObjectGroup)ent;
+ sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
+ sog.ResumeScripts();
}
}
}
+
m_scripts_enabled = !ScriptEngine;
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
}
@@ -1098,7 +1099,7 @@ namespace OpenSim.Region.Framework.Scenes
shuttingdown = true;
m_log.Debug("[SCENE]: Persisting changed objects");
- List entities = GetEntities();
+ EntityBase[] entities = GetEntities();
foreach (EntityBase entity in entities)
{
if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
@@ -2037,8 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes
{
lock (Entities)
{
- ICollection entities = new List(Entities);
-
+ EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase e in entities)
{
if (e is SceneObjectGroup)
@@ -3977,9 +3977,8 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ForceClientUpdate()
{
- List EntityList = GetEntities();
-
- foreach (EntityBase ent in EntityList)
+ EntityBase[] entityList = GetEntities();
+ foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@@ -3997,9 +3996,8 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'");
- List EntityList = GetEntities();
-
- foreach (EntityBase ent in EntityList)
+ EntityBase[] entityList = GetEntities();
+ foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@@ -4368,7 +4366,7 @@ namespace OpenSim.Region.Framework.Scenes
/// will not affect the original list of objects in the scene.
///
///
- public List GetEntities()
+ public EntityBase[] GetEntities()
{
return m_sceneGraph.GetEntities();
}
@@ -4402,9 +4400,8 @@ namespace OpenSim.Region.Framework.Scenes
public void CleanTempObjects()
{
- List objs = GetEntities();
-
- foreach (EntityBase obj in objs)
+ EntityBase[] entities = GetEntities();
+ foreach (EntityBase obj in entities)
{
if (obj is SceneObjectGroup)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index dfb26b9..3d3e822 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -348,68 +348,57 @@ namespace OpenSim.Region.Framework.Scenes
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
return false;
- lock (sceneObject)
- {
- if (Entities.ContainsKey(sceneObject.UUID))
- {
-// m_log.WarnFormat(
-// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request",
-// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
- return false;
- }
-
-// m_log.DebugFormat(
-// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
-// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
-
- lock (sceneObject.Children)
+ if (Entities.ContainsKey(sceneObject.UUID))
+ return false;
+
+ // Clamp child prim sizes and add child prims to the m_numPrim count
+ lock (sceneObject.Children)
+ {
+ if (m_parentScene.m_clampPrimSize)
{
- if (m_parentScene.m_clampPrimSize)
+ foreach (SceneObjectPart part in sceneObject.Children.Values)
{
- foreach (SceneObjectPart part in sceneObject.Children.Values)
- {
- Vector3 scale = part.Shape.Scale;
-
- if (scale.X > m_parentScene.m_maxNonphys)
- scale.X = m_parentScene.m_maxNonphys;
- if (scale.Y > m_parentScene.m_maxNonphys)
- scale.Y = m_parentScene.m_maxNonphys;
- if (scale.Z > m_parentScene.m_maxNonphys)
- scale.Z = m_parentScene.m_maxNonphys;
-
- part.Shape.Scale = scale;
- }
+ Vector3 scale = part.Shape.Scale;
+
+ if (scale.X > m_parentScene.m_maxNonphys)
+ scale.X = m_parentScene.m_maxNonphys;
+ if (scale.Y > m_parentScene.m_maxNonphys)
+ scale.Y = m_parentScene.m_maxNonphys;
+ if (scale.Z > m_parentScene.m_maxNonphys)
+ scale.Z = m_parentScene.m_maxNonphys;
+
+ part.Shape.Scale = scale;
}
-
- m_numPrim += sceneObject.Children.Count;
}
-
- sceneObject.AttachToScene(m_parentScene);
- if (sendClientUpdates)
- sceneObject.ScheduleGroupForFullUpdate();
-
- Entities.Add(sceneObject);
+ m_numPrim += sceneObject.Children.Count;
+ }
- if (attachToBackup)
- sceneObject.AttachToBackup();
+ sceneObject.AttachToScene(m_parentScene);
- if (OnObjectCreate != null)
- OnObjectCreate(sceneObject);
-
- lock (SceneObjectGroupsByFullID)
- {
- SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
- foreach (SceneObjectPart part in sceneObject.Children.Values)
- SceneObjectGroupsByFullID[part.UUID] = sceneObject;
- }
-
- lock (SceneObjectGroupsByLocalID)
- {
- SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
- foreach (SceneObjectPart part in sceneObject.Children.Values)
- SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
- }
+ if (sendClientUpdates)
+ sceneObject.ScheduleGroupForFullUpdate();
+
+ Entities.Add(sceneObject);
+
+ if (attachToBackup)
+ sceneObject.AttachToBackup();
+
+ if (OnObjectCreate != null)
+ OnObjectCreate(sceneObject);
+
+ lock (SceneObjectGroupsByFullID)
+ {
+ SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
+ foreach (SceneObjectPart part in sceneObject.Children.Values)
+ SceneObjectGroupsByFullID[part.UUID] = sceneObject;
+ }
+
+ lock (SceneObjectGroupsByLocalID)
+ {
+ SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
+ foreach (SceneObjectPart part in sceneObject.Children.Values)
+ SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
}
return true;
@@ -421,42 +410,38 @@ namespace OpenSim.Region.Framework.Scenes
/// true if the object was deleted, false if there was no object to delete
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
{
- if (Entities.ContainsKey(uuid))
- {
- SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid];
+ EntityBase entity;
+ if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup)
+ return false;
- if (!resultOfObjectLinked)
- {
- m_numPrim -= grp.PrimCount;
+ SceneObjectGroup grp = (SceneObjectGroup)entity;
- if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
- RemovePhysicalPrim(grp.PrimCount);
- }
+ if (!resultOfObjectLinked)
+ {
+ m_numPrim -= grp.PrimCount;
- if (OnObjectRemove != null)
- OnObjectRemove(Entities[uuid]);
+ if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
+ RemovePhysicalPrim(grp.PrimCount);
+ }
- lock (SceneObjectGroupsByFullID)
- {
- foreach (SceneObjectPart part in grp.Children.Values)
- SceneObjectGroupsByFullID.Remove(part.UUID);
- SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
- }
- lock (SceneObjectGroupsByLocalID)
- {
- foreach (SceneObjectPart part in grp.Children.Values)
- SceneObjectGroupsByLocalID.Remove(part.LocalId);
- SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
- }
+ if (OnObjectRemove != null)
+ OnObjectRemove(Entities[uuid]);
- Entities.Remove(uuid);
- //SceneObjectGroup part;
- //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
+ lock (SceneObjectGroupsByFullID)
+ {
+ foreach (SceneObjectPart part in grp.Children.Values)
+ SceneObjectGroupsByFullID.Remove(part.UUID);
+ SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
+ }
- return true;
+ lock (SceneObjectGroupsByLocalID)
+ {
+ foreach (SceneObjectPart part in grp.Children.Values)
+ SceneObjectGroupsByLocalID.Remove(part.LocalId);
+ SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
}
- return false;
+ return Entities.Remove(uuid);
}
///
@@ -468,9 +453,7 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void AddToUpdateList(SceneObjectGroup obj)
{
lock (m_updateList)
- {
m_updateList[obj.UUID] = obj;
- }
}
///
@@ -480,34 +463,39 @@ namespace OpenSim.Region.Framework.Scenes
{
if (!Monitor.TryEnter(m_updateLock))
return;
-
- List updates;
-
- // Some updates add more updates to the updateList.
- // Get the current list of updates and clear the list before iterating
- lock (m_updateList)
- {
- updates = new List(m_updateList.Values);
- m_updateList.Clear();
- }
-
- // Go through all updates
- for (int i = 0; i < updates.Count; i++)
+ try
{
- SceneObjectGroup sog = updates[i];
+ List updates;
- // Don't abort the whole update if one entity happens to give us an exception.
- try
+ // Some updates add more updates to the updateList.
+ // Get the current list of updates and clear the list before iterating
+ lock (m_updateList)
{
- sog.Update();
+ updates = new List(m_updateList.Values);
+ m_updateList.Clear();
}
- catch (Exception e)
+
+ // Go through all updates
+ for (int i = 0; i < updates.Count; i++)
{
- m_log.ErrorFormat(
- "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
+ SceneObjectGroup sog = updates[i];
+
+ // Don't abort the whole update if one entity happens to give us an exception.
+ try
+ {
+ sog.Update();
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat(
+ "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
+ }
}
}
- Monitor.Exit(m_updateLock);
+ finally
+ {
+ Monitor.Exit(m_updateLock);
+ }
}
protected internal void AddPhysicalPrim(int number)
@@ -864,8 +852,9 @@ namespace OpenSim.Region.Framework.Scenes
/// null if no scene object group containing that prim is found
public SceneObjectGroup GetGroupByPrim(uint localID)
{
- if (Entities.ContainsKey(localID))
- return Entities[localID] as SceneObjectGroup;
+ EntityBase entity;
+ if (Entities.TryGetValue(localID, out entity))
+ return entity as SceneObjectGroup;
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog;
@@ -879,23 +868,22 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- List EntityList = GetEntities();
- foreach (EntityBase ent in EntityList)
+ EntityBase[] entityList = GetEntities();
+ foreach (EntityBase ent in entityList)
{
//m_log.DebugFormat("Looking at entity {0}", ent.UUID);
if (ent is SceneObjectGroup)
{
- if (((SceneObjectGroup)ent).HasChildPrim(localID))
+ sog = (SceneObjectGroup)ent;
+ if (sog.HasChildPrim(localID))
{
- sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByLocalID)
- {
SceneObjectGroupsByLocalID[localID] = sog;
- }
return sog;
}
}
}
+
return null;
}
@@ -921,23 +909,21 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- List EntityList = GetEntities();
-
- foreach (EntityBase ent in EntityList)
+ EntityBase[] entityList = GetEntities();
+ foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
- if (((SceneObjectGroup)ent).HasChildPrim(fullID))
+ sog = (SceneObjectGroup)ent;
+ if (sog.HasChildPrim(fullID))
{
- sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByFullID)
- {
SceneObjectGroupsByFullID[fullID] = sog;
- }
return sog;
}
}
}
+
return null;
}
@@ -946,7 +932,7 @@ namespace OpenSim.Region.Framework.Scenes
// Primitive Ray Tracing
float closestDistance = 280f;
EntityIntersection result = new EntityIntersection();
- List EntityList = GetEntities();
+ EntityBase[] EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
{
if (ent is SceneObjectGroup)
@@ -984,23 +970,28 @@ namespace OpenSim.Region.Framework.Scenes
/// null if the part was not found
protected internal SceneObjectPart GetSceneObjectPart(string name)
{
- List EntityList = GetEntities();
+ SceneObjectPart sop = null;
- // FIXME: use a dictionary here
- foreach (EntityBase ent in EntityList)
- {
- if (ent is SceneObjectGroup)
+ Entities.Find(
+ delegate(EntityBase entity)
{
- foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts())
+ if (entity is SceneObjectGroup)
{
- if (p.Name == name)
+ foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts())
{
- return p;
+ if (p.Name == name)
+ {
+ sop = p;
+ return true;
+ }
}
}
+
+ return false;
}
- }
- return null;
+ );
+
+ return sop;
}
///
@@ -1021,7 +1012,7 @@ namespace OpenSim.Region.Framework.Scenes
/// it
///
///
- protected internal List GetEntities()
+ protected internal EntityBase[] GetEntities()
{
return Entities.GetEntities();
}
@@ -1030,7 +1021,7 @@ namespace OpenSim.Region.Framework.Scenes
{
Dictionary topScripts = new Dictionary();
- List EntityList = GetEntities();
+ EntityBase[] EntityList = GetEntities();
int limit = 0;
foreach (EntityBase ent in EntityList)
{
@@ -1726,8 +1717,8 @@ namespace OpenSim.Region.Framework.Scenes
UUID objid = UUID.Zero;
SceneObjectPart obj = null;
- List EntityList = GetEntities();
- foreach (EntityBase ent in EntityList)
+ EntityBase[] entityList = GetEntities();
+ foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index f478a4a..7aa5a93 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -75,7 +75,8 @@ namespace OpenSim.Region.Framework.Scenes
lock(m_pendingObjects)
{
- foreach (EntityBase e in m_presence.Scene.Entities)
+ EntityBase[] entities = m_presence.Scene.Entities.GetEntities();
+ foreach (EntityBase e in entities)
{
if (e != null && e is SceneObjectGroup)
m_pendingObjects.Enqueue((SceneObjectGroup)e);
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index b6677f0..5494549 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -84,9 +84,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
int primCount = 0;
stream.WriteLine("\n");
- List EntityList = scene.GetEntities();
-
- foreach (EntityBase ent in EntityList)
+ EntityBase[] entityList = scene.GetEntities();
+ foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@@ -204,16 +203,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
public static void SavePrimsToXml2(Scene scene, string fileName)
{
- List EntityList = scene.GetEntities();
-
- SavePrimListToXml2(EntityList, fileName);
+ EntityBase[] entityList = scene.GetEntities();
+ SavePrimListToXml2(entityList, fileName);
}
public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max)
{
- List EntityList = scene.GetEntities();
-
- SavePrimListToXml2(EntityList, stream, min, max);
+ EntityBase[] entityList = scene.GetEntities();
+ SavePrimListToXml2(entityList, stream, min, max);
}
public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName)
@@ -222,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
"[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}",
primName, scene.RegionInfo.RegionName, fileName);
- List entityList = scene.GetEntities();
+ EntityBase[] entityList = scene.GetEntities();
List primList = new List();
foreach (EntityBase ent in entityList)
@@ -236,10 +233,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
}
- SavePrimListToXml2(primList, fileName);
+ SavePrimListToXml2(primList.ToArray(), fileName);
}
- public static void SavePrimListToXml2(List entityList, string fileName)
+ public static void SavePrimListToXml2(EntityBase[] entityList, string fileName)
{
FileStream file = new FileStream(fileName, FileMode.Create);
try
@@ -260,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
}
- public static void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max)
+ public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
{
int primCount = 0;
stream.WriteLine("\n");
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 6793ef6..159af79 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -375,8 +375,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendNamesReply()
{
- List users = m_scene.Entities.GetAllByType();
-
+ EntityBase[] users = m_scene.Entities.GetAllByType();
foreach (EntityBase user in users)
{
SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", ""));
@@ -386,8 +385,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendWhoReply()
{
- List users = m_scene.Entities.GetAllByType();
-
+ EntityBase[] users = m_scene.Entities.GetAllByType();
foreach (EntityBase user in users)
{
/*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName,
@@ -415,11 +413,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendReplyUsers()
{
- List users = m_scene.Entities.GetAllByType();
+ EntityBase[] users = m_scene.Entities.GetAllByType();
SendServerCommand("392 :UserID Terminal Host");
- if (users.Count == 0)
+ if (users.Length == 0)
{
SendServerCommand("395 :Nobody logged in");
return;
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
index de1e01c..d21b652 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
}
// Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash
- public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List currList)
+ public System.Collections.ArrayList CheckForMissingEntities(EntityBase[] currList)
{
System.Collections.ArrayList missingList = new System.Collections.ArrayList();
SceneObjectGroup temp = null;
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
index 2730eee..49d20e1 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
@@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
///
public void FindDifferences()
{
- System.Collections.Generic.List sceneEntityList = m_Entity.Scene.GetEntities();
+ List sceneEntityList = new List(m_Entity.Scene.GetEntities());
DiffersFromSceneGroup = false;
// if group is not contained in scene's list
if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
index 6ba5ccf..140264b 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
@@ -41,12 +41,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
private readonly Scene m_scene;
private readonly IEnumerator m_sogEnum;
private readonly ISecurityCredential m_security;
+ private readonly List m_entities;
public IObjEnum(Scene scene, ISecurityCredential security)
{
m_scene = scene;
m_security = security;
- m_sogEnum = m_scene.Entities.GetAllByType().GetEnumerator();
+ m_entities = new List(m_scene.Entities.GetEntities());
+ m_sogEnum = m_entities.GetEnumerator();
}
public void Dispose()
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
index 45bb005..f2324d2 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
@@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
get
{
- List ents = m_internalScene.Entities.GetAllByType();
- IAvatar[] rets = new IAvatar[ents.Count];
+ EntityBase[] ents = m_internalScene.Entities.GetAllByType();
+ IAvatar[] rets = new IAvatar[ents.Length];
- for (int i = 0; i < ents.Count; i++)
+ for (int i = 0; i < ents.Length; i++)
{
EntityBase ent = ents[i];
rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security);
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index 3ed338b..421da36 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -568,8 +568,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
{
m_copse = new List();
- List objs = m_scene.GetEntities();
-
+ EntityBase[] objs = m_scene.GetEntities();
foreach (EntityBase obj in objs)
{
if (obj is SceneObjectGroup)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 5c2abd5..2b67e84 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
}
else
{
- Entities = m_CmdManager.m_ScriptEngine.World.GetEntities();
+ Entities = new List(m_CmdManager.m_ScriptEngine.World.GetEntities());
}
SceneObjectPart SensePoint = ts.host;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
index 67b73f3..67a06f3 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
@@ -69,7 +69,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void OnMakeRootAgent(ScenePresence sp)
{
m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
- m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
+ Util.FireAndForget(delegate(object o)
+ {
+ m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
+ });
}
public void OnNewClient(IClientAPI client)
--
cgit v1.1
From b597a295c489cef217b9dca6bd22df1340ca39ce Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 10 Sep 2010 12:41:36 -0700
Subject: Second pass at cleaning up thread safety in EntityManager and
SceneGraph
---
OpenSim/Region/Framework/Scenes/EntityManager.cs | 16 +-----
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 66 +++++++++++-----------
.../Region/Framework/Scenes/SceneObjectGroup.cs | 11 +---
3 files changed, 35 insertions(+), 58 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs
index 85d0a4f..0defa93 100644
--- a/OpenSim/Region/Framework/Scenes/EntityManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs
@@ -34,7 +34,7 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Scenes
{
- public class EntityManager //: IEnumerable
+ public class EntityManager
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly DoubleDictionary m_entities = new DoubleDictionary();
@@ -143,19 +143,5 @@ namespace OpenSim.Region.Framework.Scenes
{
return m_entities.TryGetValue(key, out obj);
}
-
- ///
- /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that.
- ///
- ///
- //public IEnumerator GetEnumerator()
- //{
- // return GetEntities().GetEnumerator();
- //}
-
- //IEnumerator IEnumerable.GetEnumerator()
- //{
- // return GetEnumerator();
- //}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 3d3e822..f779a6d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -72,10 +72,7 @@ namespace OpenSim.Region.Framework.Scenes
protected Dictionary m_scenePresenceMap = new Dictionary();
protected List m_scenePresenceArray = new List();
- // SceneObjects is not currently populated or used.
- //public Dictionary SceneObjects;
protected internal EntityManager Entities = new EntityManager();
-// protected internal Dictionary Entities = new Dictionary();
protected internal Dictionary RestorePresences = new Dictionary();
protected RegionInfo m_regInfo;
@@ -351,28 +348,28 @@ namespace OpenSim.Region.Framework.Scenes
if (Entities.ContainsKey(sceneObject.UUID))
return false;
- // Clamp child prim sizes and add child prims to the m_numPrim count
+ List children;
lock (sceneObject.Children)
+ children = new List(sceneObject.Children.Values);
+
+ // Clamp child prim sizes and add child prims to the m_numPrim count
+ if (m_parentScene.m_clampPrimSize)
{
- if (m_parentScene.m_clampPrimSize)
+ foreach (SceneObjectPart part in children)
{
- foreach (SceneObjectPart part in sceneObject.Children.Values)
- {
- Vector3 scale = part.Shape.Scale;
+ Vector3 scale = part.Shape.Scale;
- if (scale.X > m_parentScene.m_maxNonphys)
- scale.X = m_parentScene.m_maxNonphys;
- if (scale.Y > m_parentScene.m_maxNonphys)
- scale.Y = m_parentScene.m_maxNonphys;
- if (scale.Z > m_parentScene.m_maxNonphys)
- scale.Z = m_parentScene.m_maxNonphys;
+ if (scale.X > m_parentScene.m_maxNonphys)
+ scale.X = m_parentScene.m_maxNonphys;
+ if (scale.Y > m_parentScene.m_maxNonphys)
+ scale.Y = m_parentScene.m_maxNonphys;
+ if (scale.Z > m_parentScene.m_maxNonphys)
+ scale.Z = m_parentScene.m_maxNonphys;
- part.Shape.Scale = scale;
- }
+ part.Shape.Scale = scale;
}
-
- m_numPrim += sceneObject.Children.Count;
}
+ m_numPrim += children.Count;
sceneObject.AttachToScene(m_parentScene);
@@ -390,14 +387,14 @@ namespace OpenSim.Region.Framework.Scenes
lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
- foreach (SceneObjectPart part in sceneObject.Children.Values)
+ foreach (SceneObjectPart part in children)
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
}
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
- foreach (SceneObjectPart part in sceneObject.Children.Values)
+ foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
}
@@ -859,13 +856,13 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog;
lock (SceneObjectGroupsByLocalID)
+ SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
+
+ if (sog != null)
{
- if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog))
- {
- if (sog.HasChildPrim(localID))
- return sog;
- SceneObjectGroupsByLocalID.Remove(localID);
- }
+ if (sog.HasChildPrim(localID))
+ return sog;
+ SceneObjectGroupsByLocalID.Remove(localID);
}
EntityBase[] entityList = GetEntities();
@@ -896,17 +893,18 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectGroup sog;
lock (SceneObjectGroupsByFullID)
+ SceneObjectGroupsByFullID.TryGetValue(fullID, out sog);
+
+ if (sog != null)
{
- if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog))
+ lock (sog.Children)
{
- lock (sog.Children)
- {
- if (sog.Children.ContainsKey(fullID))
- return sog;
- }
-
- SceneObjectGroupsByFullID.Remove(fullID);
+ if (sog.Children.ContainsKey(fullID))
+ return sog;
}
+
+ lock (SceneObjectGroupsByFullID)
+ SceneObjectGroupsByFullID.Remove(fullID);
}
EntityBase[] entityList = GetEntities();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 09e3e0e..ba5e33c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2091,16 +2091,9 @@ namespace OpenSim.Region.Framework.Scenes
/// null if a child part with the primID was not found
public SceneObjectPart GetChildPart(UUID primID)
{
- SceneObjectPart childPart = null;
-
+ SceneObjectPart childPart;
lock (m_parts)
- {
- if (m_parts.ContainsKey(primID))
- {
- childPart = m_parts[primID];
- }
- }
-
+ m_parts.TryGetValue(primID, out childPart);
return childPart;
}
--
cgit v1.1
From a7f4e10f425cef4b85810486ba31c59b3ba206fc Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 10 Sep 2010 21:50:40 +0100
Subject: Remove parenthesis around the release flavour to get the version
string back under 27 chars
Can't quite remember why this has to be <=27 chars, maybe something to do with the space available for the version string in a typical client
---
OpenSim/Framework/Servers/VersionInfo.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 100bf1f..c88e0d1 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -49,7 +49,7 @@ namespace OpenSim
public static string GetVersionString(string versionNumber, Flavour flavour)
{
- string versionString = "OpenSim " + versionNumber + " (" + flavour + ")";
+ string versionString = "OpenSim " + versionNumber + " " + flavour;
return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
}
--
cgit v1.1
From 30306a775af74e1fe080590998a71a4c7e64ad12 Mon Sep 17 00:00:00 2001
From: randomhuman
Date: Sun, 5 Sep 2010 21:44:46 +0100
Subject: Made it impossible to create a user with names containing spaces and
prevented passwords from being echoed after enter is pressed.
---
OpenSim/Framework/Console/ConsoleBase.cs | 51 ++++++++++++++++++++++
OpenSim/Framework/Console/LocalConsole.cs | 5 ++-
OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++-
.../UserAccountService/UserAccountService.cs | 6 ++-
4 files changed, 61 insertions(+), 6 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index aab920b..22ce880 100755
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -89,6 +89,57 @@ namespace OpenSim.Framework.Console
return ret;
}
+
+ public string CmdPrompt(string p, List excludedCharacters)
+ {
+ bool itisdone = false;
+ string ret = String.Empty;
+ while (!itisdone)
+ {
+ itisdone = true;
+ ret = CmdPrompt(p);
+
+ foreach (char c in excludedCharacters)
+ {
+ if (ret.Contains(c.ToString()))
+ {
+ System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
+ itisdone = false;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ public string CmdPrompt(string p, string def, List excludedCharacters)
+ {
+ bool itisdone = false;
+ string ret = String.Empty;
+ while (!itisdone)
+ {
+ itisdone = true;
+ ret = CmdPrompt(p, def);
+
+ if (ret == String.Empty)
+ {
+ ret = def;
+ }
+ else
+ {
+ foreach (char c in excludedCharacters)
+ {
+ if (ret.Contains(c.ToString()))
+ {
+ System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
+ itisdone = false;
+ }
+ }
+ }
+ }
+
+ return ret;
+ }
// Displays a command prompt and returns a default value, user may only enter 1 of 2 options
public string CmdPrompt(string prompt, string defaultresponse, List options)
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs
index a3036d0..c968031 100644
--- a/OpenSim/Framework/Console/LocalConsole.cs
+++ b/OpenSim/Framework/Console/LocalConsole.cs
@@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console
SetCursorLeft(0);
y = SetCursorTop(y);
- System.Console.WriteLine("{0}{1}", prompt, cmdline);
+ System.Console.WriteLine();
+ //Show();
lock (cmdline)
{
@@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console
}
}
- AddToHistory(cmdline.ToString());
+ //AddToHistory(cmdline.ToString());
return cmdline.ToString();
default:
break;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7ce95a7..6fa78e0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1159,8 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes
while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
{
MainConsole.Instance.Output("The current estate has no owner set.");
- string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test");
- string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User");
+ List excluded = new List(new char[1]{' '});
+ string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
+ string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 326e502..65c247f 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -296,13 +296,15 @@ namespace OpenSim.Services.UserAccountService
string lastName;
string password;
string email;
+
+ List excluded = new List(new char[]{' '});
if (cmdparams.Length < 3)
- firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
+ firstName = MainConsole.Instance.CmdPrompt("First name", "Default", excluded);
else firstName = cmdparams[2];
if (cmdparams.Length < 4)
- lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
+ lastName = MainConsole.Instance.CmdPrompt("Last name", "User", excluded);
else lastName = cmdparams[3];
if (cmdparams.Length < 5)
--
cgit v1.1
From 220f82a0f0e05ab7d01c9028675c5c779cb6f5fc Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 11 Sep 2010 00:27:52 +0100
Subject: Make it clear that the "create region" command will reference ini
files in the regions directory (usually Regions/)
Also convert some tabs into spaces.
---
OpenSim/Region/Application/OpenSim.cs | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 3c2575d..4f2d223 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -316,7 +316,7 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "create region",
"create region [\"region name\"] ",
"Create a new region.",
- "The settings for \"region name\" are read from ."
+ "The settings for \"region name\" are read from in your Regions directory."
+ " If \"region name\" does not exist in , it will be added." + Environment.NewLine
+ "Without \"region name\", the first region found in will be created." + Environment.NewLine
+ "If does not exist, it will be created.",
@@ -552,17 +552,18 @@ namespace OpenSim
regionFile = Path.Combine(regionsDir, regionFile);
}
- RegionInfo regInfo;
+ RegionInfo regInfo;
if (isXml)
{
- regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
+ regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
}
else
{
- regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
+ regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
}
+
IScene scene;
- PopulateRegionEstateInfo(regInfo);
+ PopulateRegionEstateInfo(regInfo);
CreateRegion(regInfo, true, out scene);
regInfo.EstateSettings.Save();
}
--
cgit v1.1
From 47a5e2633c4a5cb5e0e89e4b8ffc42bf5996c4e6 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sat, 11 Sep 2010 20:22:10 +0100
Subject: Prevent child agents from being blacklisted in the kill record.
---
OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index cdf8cb1..a6315a9 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1519,10 +1519,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
kill.Header.Reliable = true;
kill.Header.Zerocoded = true;
- lock (m_entityUpdates.SyncRoot)
+ if (m_scene.GetScenePresence(localID) == null)
{
- m_killRecord.Add(localID);
- OutPacket(kill, ThrottleOutPacketType.State);
+ lock (m_entityUpdates.SyncRoot)
+ {
+ m_killRecord.Add(localID);
+ OutPacket(kill, ThrottleOutPacketType.State);
+ }
}
}
--
cgit v1.1
From 47ac9f97b11ae9de535550ba7e6c836ee81dab55 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sat, 11 Sep 2010 18:29:38 -0700
Subject: Re-enabled asset last access time logging in MySQL
---
OpenSim/Data/MySQL/MySQLAssetData.cs | 3 ---
1 file changed, 3 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index fe5152a..ed92f3e 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -214,9 +214,6 @@ namespace OpenSim.Data.MySQL
private void UpdateAccessTime(AssetBase asset)
{
- // Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph
- return;
-
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
--
cgit v1.1
From 109b51758398d24a96a16900e8feb24361aee29d Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sat, 11 Sep 2010 20:43:06 -0700
Subject: Fixed the naming mess around data connectors for simulation data
---
OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 1572 -------------
OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 1572 +++++++++++++
OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 1820 ---------------
OpenSim/Data/MySQL/MySQLSimulationData.cs | 1820 +++++++++++++++
OpenSim/Data/Null/NullDataStore.cs | 112 -
OpenSim/Data/Null/NullSimulationData.cs | 112 +
OpenSim/Data/SQLite/SQLiteRegionData.cs | 2355 --------------------
OpenSim/Data/SQLite/SQLiteSimulationData.cs | 2355 ++++++++++++++++++++
OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs | 2261 -------------------
OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs | 2261 +++++++++++++++++++
OpenSim/Data/Tests/RegionTests.cs | 12 +-
.../Framework/Interfaces/IEntityInventory.cs | 2 +-
.../Framework/Interfaces/IRegionDataStore.cs | 111 -
.../Framework/Interfaces/ISimulationDataStore.cs | 111 +
OpenSim/Region/Framework/Scenes/EventManager.cs | 4 +-
.../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
.../Framework/Scenes/SceneObjectPartInventory.cs | 2 +-
OpenSim/Region/Framework/StorageManager.cs | 10 +-
OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 2 +-
19 files changed, 8248 insertions(+), 8248 deletions(-)
delete mode 100644 OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
create mode 100644 OpenSim/Data/MSSQL/MSSQLSimulationData.cs
delete mode 100644 OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
create mode 100644 OpenSim/Data/MySQL/MySQLSimulationData.cs
delete mode 100644 OpenSim/Data/Null/NullDataStore.cs
create mode 100644 OpenSim/Data/Null/NullSimulationData.cs
delete mode 100644 OpenSim/Data/SQLite/SQLiteRegionData.cs
create mode 100644 OpenSim/Data/SQLite/SQLiteSimulationData.cs
delete mode 100644 OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
create mode 100644 OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
delete mode 100644 OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
create mode 100644 OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs
(limited to 'OpenSim')
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
deleted file mode 100644
index 77b8a10..0000000
--- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
+++ /dev/null
@@ -1,1572 +0,0 @@
-/*
- * 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 OpenSimulator 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;
-using System.Collections.Generic;
-using System.Data;
-using System.Data.SqlClient;
-using System.Drawing;
-using System.IO;
-using System.Reflection;
-using log4net;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Data.MSSQL
-{
- ///
- /// A MSSQL Interface for the Region Server.
- ///
- public class MSSQLRegionDataStore : IRegionDataStore
- {
- private const string _migrationStore = "RegionStore";
-
- // private static FileSystemDataStore Instance = new FileSystemDataStore();
- private static readonly ILog _Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- ///
- /// The database manager
- ///
- private MSSQLManager _Database;
- private string m_connectionString;
- ///
- /// Initialises the region datastore
- ///
- /// The connection string.
- public void Initialise(string connectionString)
- {
- m_connectionString = connectionString;
- _Database = new MSSQLManager(connectionString);
-
-
- //Migration settings
- _Database.CheckMigration(_migrationStore);
- }
-
- ///
- /// Dispose the database
- ///
- public void Dispose() { }
-
- #region SceneObjectGroup region for loading and Store of the scene.
-
- ///
- /// Loads the objects present in the region.
- ///
- /// The region UUID.
- ///
- public List LoadObjects(UUID regionUUID)
- {
- UUID lastGroupID = UUID.Zero;
-
- Dictionary prims = new Dictionary();
- Dictionary objects = new Dictionary();
- SceneObjectGroup grp = null;
-
- string sql = "SELECT *, " +
- "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " +
- "FROM prims " +
- "LEFT JOIN primshapes ON prims.UUID = primshapes.UUID " +
- "WHERE RegionUUID = @RegionUUID " +
- "ORDER BY SceneGroupID asc, sort asc, LinkNumber asc";
-
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand command = new SqlCommand(sql, conn))
- {
- command.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID));
- conn.Open();
- using (SqlDataReader reader = command.ExecuteReader())
- {
- while (reader.Read())
- {
- SceneObjectPart sceneObjectPart = BuildPrim(reader);
- if (reader["Shape"] is DBNull)
- sceneObjectPart.Shape = PrimitiveBaseShape.Default;
- else
- sceneObjectPart.Shape = BuildShape(reader);
-
- prims[sceneObjectPart.UUID] = sceneObjectPart;
-
- UUID groupID = new UUID((Guid)reader["SceneGroupID"]);
-
- if (groupID != lastGroupID) // New SOG
- {
- if (grp != null)
- objects[grp.UUID] = grp;
-
- lastGroupID = groupID;
-
- // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are
- // recorded as the root prim (for which the UUID must equal the persisted group UUID). In
- // this case, force the UUID to be the same as the group UUID so that at least these can be
- // deleted (we need to change the UUID so that any other prims in the linkset can also be
- // deleted).
- if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero)
- {
- _Log.WarnFormat(
- "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID",
- sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID);
-
- sceneObjectPart.UUID = groupID;
- }
-
- grp = new SceneObjectGroup(sceneObjectPart);
- }
- else
- {
- // Black magic to preserve link numbers
- // Why is this needed, fix this in AddPart method.
- int link = sceneObjectPart.LinkNum;
-
- grp.AddPart(sceneObjectPart);
-
- if (link != 0)
- sceneObjectPart.LinkNum = link;
- }
- }
- }
- }
-
- if (grp != null)
- objects[grp.UUID] = grp;
-
- // Instead of attempting to LoadItems on every prim,
- // most of which probably have no items... get a
- // list from DB of all prims which have items and
- // LoadItems only on those
- List primsWithInventory = new List();
- string qry = "select distinct primID from primitems";
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand command = new SqlCommand(qry, conn))
- {
- conn.Open();
- using (SqlDataReader itemReader = command.ExecuteReader())
- {
- while (itemReader.Read())
- {
- if (!(itemReader["primID"] is DBNull))
- {
- UUID primID = new UUID(itemReader["primID"].ToString());
- if (prims.ContainsKey(primID))
- {
- primsWithInventory.Add(prims[primID]);
- }
- }
- }
- }
- }
-
- LoadItems(primsWithInventory);
-
- _Log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count);
-
- return new List(objects.Values);
- }
-
- ///
- /// Load in the prim's persisted inventory.
- ///
- /// all prims with inventory on a region
- private void LoadItems(List allPrimsWithInventory)
- {
- string sql = "SELECT * FROM primitems WHERE PrimID = @PrimID";
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand command = new SqlCommand(sql, conn))
- {
- conn.Open();
- foreach (SceneObjectPart objectPart in allPrimsWithInventory)
- {
- command.Parameters.Clear();
- command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID));
-
- List inventory = new List();
-
- using (SqlDataReader reader = command.ExecuteReader())
- {
- while (reader.Read())
- {
- TaskInventoryItem item = BuildItem(reader);
-
- item.ParentID = objectPart.UUID; // Values in database are
- // often wrong
- inventory.Add(item);
- }
- }
-
- objectPart.Inventory.RestoreInventoryItems(inventory);
- }
- }
- }
-
- ///
- /// Stores all object's details apart from inventory
- ///
- ///
- ///
- public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
- {
- _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count);
-
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- {
- conn.Open();
- SqlTransaction transaction = conn.BeginTransaction();
-
- try
- {
- foreach (SceneObjectPart sceneObjectPart in obj.Children.Values)
- {
- //Update prim
- using (SqlCommand sqlCommand = conn.CreateCommand())
- {
- sqlCommand.Transaction = transaction;
- try
- {
- StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
- }
- catch (SqlException sqlEx)
- {
- _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber);
- throw;
- }
- }
-
- //Update primshapes
- using (SqlCommand sqlCommand = conn.CreateCommand())
- {
- sqlCommand.Transaction = transaction;
- try
- {
- StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
- }
- catch (SqlException sqlEx)
- {
- _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber);
- throw;
- }
- }
- }
-
- transaction.Commit();
- }
- catch (Exception ex)
- {
- _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message);
- try
- {
- transaction.Rollback();
- }
- catch (Exception ex2)
- {
- //Show error
- _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message);
-
- }
- }
- }
- }
-
- ///
- /// Stores the prim of the sceneobjectpart.
- ///
- /// The sceneobjectpart or prim.
- /// The SQL command with the transaction.
- /// The scenegroup UUID.
- /// The region UUID.
- private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
- {
- //Big query to update or insert a new prim.
- //Note for SQL Server 2008 this could be simplified
- string queryPrims = @"
-IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID)
- BEGIN
- UPDATE prims SET
- CreationDate = @CreationDate, Name = @Name, Text = @Text, Description = @Description, SitName = @SitName,
- TouchName = @TouchName, ObjectFlags = @ObjectFlags, OwnerMask = @OwnerMask, NextOwnerMask = @NextOwnerMask, GroupMask = @GroupMask,
- EveryoneMask = @EveryoneMask, BaseMask = @BaseMask, PositionX = @PositionX, PositionY = @PositionY, PositionZ = @PositionZ,
- GroupPositionX = @GroupPositionX, GroupPositionY = @GroupPositionY, GroupPositionZ = @GroupPositionZ, VelocityX = @VelocityX,
- VelocityY = @VelocityY, VelocityZ = @VelocityZ, AngularVelocityX = @AngularVelocityX, AngularVelocityY = @AngularVelocityY,
- AngularVelocityZ = @AngularVelocityZ, AccelerationX = @AccelerationX, AccelerationY = @AccelerationY,
- AccelerationZ = @AccelerationZ, RotationX = @RotationX, RotationY = @RotationY, RotationZ = @RotationZ, RotationW = @RotationW,
- SitTargetOffsetX = @SitTargetOffsetX, SitTargetOffsetY = @SitTargetOffsetY, SitTargetOffsetZ = @SitTargetOffsetZ,
- SitTargetOrientW = @SitTargetOrientW, SitTargetOrientX = @SitTargetOrientX, SitTargetOrientY = @SitTargetOrientY,
- SitTargetOrientZ = @SitTargetOrientZ, RegionUUID = @RegionUUID, CreatorID = @CreatorID, OwnerID = @OwnerID, GroupID = @GroupID,
- LastOwnerID = @LastOwnerID, SceneGroupID = @SceneGroupID, PayPrice = @PayPrice, PayButton1 = @PayButton1, PayButton2 = @PayButton2,
- PayButton3 = @PayButton3, PayButton4 = @PayButton4, LoopedSound = @LoopedSound, LoopedSoundGain = @LoopedSoundGain,
- TextureAnimation = @TextureAnimation, OmegaX = @OmegaX, OmegaY = @OmegaY, OmegaZ = @OmegaZ, CameraEyeOffsetX = @CameraEyeOffsetX,
- CameraEyeOffsetY = @CameraEyeOffsetY, CameraEyeOffsetZ = @CameraEyeOffsetZ, CameraAtOffsetX = @CameraAtOffsetX,
- CameraAtOffsetY = @CameraAtOffsetY, CameraAtOffsetZ = @CameraAtOffsetZ, ForceMouselook = @ForceMouselook,
- ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice,
- SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem,
- ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches,
- LinkNumber = @LinkNumber, MediaURL = @MediaURL
- WHERE UUID = @UUID
- END
-ELSE
- BEGIN
- INSERT INTO
- prims (
- UUID, CreationDate, Name, Text, Description, SitName, TouchName, ObjectFlags, OwnerMask, NextOwnerMask, GroupMask,
- EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX,
- VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ,
- RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW,
- SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, RegionUUID, CreatorID, OwnerID, GroupID, LastOwnerID, SceneGroupID,
- PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX,
- OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ,
- ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA,
- ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL
- ) VALUES (
- @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask,
- @EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX,
- @VelocityY, @VelocityZ, @AngularVelocityX, @AngularVelocityY, @AngularVelocityZ, @AccelerationX, @AccelerationY, @AccelerationZ,
- @RotationX, @RotationY, @RotationZ, @RotationW, @SitTargetOffsetX, @SitTargetOffsetY, @SitTargetOffsetZ, @SitTargetOrientW,
- @SitTargetOrientX, @SitTargetOrientY, @SitTargetOrientZ, @RegionUUID, @CreatorID, @OwnerID, @GroupID, @LastOwnerID, @SceneGroupID,
- @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX,
- @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ,
- @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA,
- @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL
- )
- END";
-
- //Set commandtext.
- sqlCommand.CommandText = queryPrims;
- //Add parameters
- sqlCommand.Parameters.AddRange(CreatePrimParameters(sceneObjectPart, sceneGroupID, regionUUID));
-
- //Execute the query. If it fails then error is trapped in calling function
- sqlCommand.ExecuteNonQuery();
- }
-
- ///
- /// Stores the scene object prim shapes.
- ///
- /// The sceneobjectpart containing prim shape.
- /// The SQL command with the transaction.
- /// The scenegroup UUID.
- /// The region UUID.
- private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
- {
- //Big query to or insert or update primshapes
- //Note for SQL Server 2008 this can be simplified
- string queryPrimShapes = @"
-IF EXISTS (SELECT UUID FROM primshapes WHERE UUID = @UUID)
- BEGIN
- UPDATE primshapes SET
- Shape = @Shape, ScaleX = @ScaleX, ScaleY = @ScaleY, ScaleZ = @ScaleZ, PCode = @PCode, PathBegin = @PathBegin,
- PathEnd = @PathEnd, PathScaleX = @PathScaleX, PathScaleY = @PathScaleY, PathShearX = @PathShearX, PathShearY = @PathShearY,
- PathSkew = @PathSkew, PathCurve = @PathCurve, PathRadiusOffset = @PathRadiusOffset, PathRevolutions = @PathRevolutions,
- PathTaperX = @PathTaperX, PathTaperY = @PathTaperY, PathTwist = @PathTwist, PathTwistBegin = @PathTwistBegin,
- ProfileBegin = @ProfileBegin, ProfileEnd = @ProfileEnd, ProfileCurve = @ProfileCurve, ProfileHollow = @ProfileHollow,
- Texture = @Texture, ExtraParams = @ExtraParams, State = @State, Media = @Media
- WHERE UUID = @UUID
- END
-ELSE
- BEGIN
- INSERT INTO
- primshapes (
- UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY,
- PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin,
- ProfileEnd, ProfileCurve, ProfileHollow, Texture, ExtraParams, State, Media
- ) VALUES (
- @UUID, @Shape, @ScaleX, @ScaleY, @ScaleZ, @PCode, @PathBegin, @PathEnd, @PathScaleX, @PathScaleY, @PathShearX, @PathShearY,
- @PathSkew, @PathCurve, @PathRadiusOffset, @PathRevolutions, @PathTaperX, @PathTaperY, @PathTwist, @PathTwistBegin, @ProfileBegin,
- @ProfileEnd, @ProfileCurve, @ProfileHollow, @Texture, @ExtraParams, @State, @Media
- )
- END";
-
- //Set commandtext.
- sqlCommand.CommandText = queryPrimShapes;
-
- //Add parameters
- sqlCommand.Parameters.AddRange(CreatePrimShapeParameters(sceneObjectPart, sceneGroupID, regionUUID));
-
- //Execute the query. If it fails then error is trapped in calling function
- sqlCommand.ExecuteNonQuery();
-
- }
-
- ///
- /// Removes a object from the database.
- /// Meaning removing it from tables Prims, PrimShapes and PrimItems
- ///
- /// id of scenegroup
- /// regionUUID (is this used anyway
- public void RemoveObject(UUID objectID, UUID regionUUID)
- {
- _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID);
-
- //Remove from prims and primsitem table
- string sqlPrims = "DELETE FROM PRIMS WHERE SceneGroupID = @objectID";
- string sqlPrimItems = "DELETE FROM PRIMITEMS WHERE primID in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)";
- string sqlPrimShapes = "DELETE FROM PRIMSHAPES WHERE uuid in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)";
-
- lock (_Database)
- {
- //Using the non transaction mode.
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand())
- {
- cmd.Connection = conn;
- cmd.CommandText = sqlPrimShapes;
- conn.Open();
- cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID));
- cmd.ExecuteNonQuery();
-
- cmd.CommandText = sqlPrimItems;
- cmd.ExecuteNonQuery();
-
- cmd.CommandText = sqlPrims;
- cmd.ExecuteNonQuery();
- }
- }
- }
-
- ///
- /// Store the inventory of a prim. Warning deletes everything first and then adds all again.
- ///
- ///
- ///
- public void StorePrimInventory(UUID primID, ICollection items)
- {
- //_Log.InfoFormat("[REGION DB: Persisting Prim Inventory with prim ID {0}", primID);
-
- //Statement from MySQL section!
- // For now, we're just going to crudely remove all the previous inventory items
- // no matter whether they have changed or not, and replace them with the current set.
-
- //Delete everything from PrimID
- //TODO add index on PrimID in DB, if not already exist
-
- string sql = "DELETE PRIMITEMS WHERE primID = @primID";
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.Add(_Database.CreateParameter("@primID", primID));
- conn.Open();
- cmd.ExecuteNonQuery();
- }
-
- sql =
- @"INSERT INTO primitems (
- itemID,primID,assetID,parentFolderID,invType,assetType,name,description,creationDate,creatorID,ownerID,lastOwnerID,groupID,
- nextPermissions,currentPermissions,basePermissions,everyonePermissions,groupPermissions,flags)
- VALUES (@itemID,@primID,@assetID,@parentFolderID,@invType,@assetType,@name,@description,@creationDate,@creatorID,@ownerID,
- @lastOwnerID,@groupID,@nextPermissions,@currentPermissions,@basePermissions,@everyonePermissions,@groupPermissions,@flags)";
-
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- foreach (TaskInventoryItem taskItem in items)
- {
- cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem));
- conn.Open();
- cmd.ExecuteNonQuery();
-
- cmd.Parameters.Clear();
- }
- }
- }
-
- #endregion
-
- ///
- /// Loads the terrain map.
- ///
- /// regionID.
- ///
- public double[,] LoadTerrain(UUID regionID)
- {
- double[,] terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
- terrain.Initialize();
-
- string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc";
-
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- // MySqlParameter param = new MySqlParameter();
- cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID));
- conn.Open();
- using (SqlDataReader reader = cmd.ExecuteReader())
- {
- int rev;
- if (reader.Read())
- {
- MemoryStream str = new MemoryStream((byte[])reader["Heightfield"]);
- BinaryReader br = new BinaryReader(str);
- for (int x = 0; x < (int)Constants.RegionSize; x++)
- {
- for (int y = 0; y < (int)Constants.RegionSize; y++)
- {
- terrain[x, y] = br.ReadDouble();
- }
- }
- rev = (int)reader["Revision"];
- }
- else
- {
- _Log.Info("[REGION DB]: No terrain found for region");
- return null;
- }
- _Log.Info("[REGION DB]: Loaded terrain revision r" + rev);
- }
- }
-
- return terrain;
- }
-
- ///
- /// Stores the terrain map to DB.
- ///
- /// terrain map data.
- /// regionID.
- public void StoreTerrain(double[,] terrain, UUID regionID)
- {
- int revision = Util.UnixTimeSinceEpoch();
-
- //Delete old terrain map
- string sql = "delete from terrain where RegionUUID=@RegionUUID";
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID));
- conn.Open();
- cmd.ExecuteNonQuery();
- }
-
- sql = "insert into terrain(RegionUUID, Revision, Heightfield) values(@RegionUUID, @Revision, @Heightfield)";
-
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID));
- cmd.Parameters.Add(_Database.CreateParameter("@Revision", revision));
- cmd.Parameters.Add(_Database.CreateParameter("@Heightfield", serializeTerrain(terrain)));
- conn.Open();
- cmd.ExecuteNonQuery();
- }
-
- _Log.Info("[REGION DB]: Stored terrain revision r " + revision);
- }
-
- ///
- /// Loads all the land objects of a region.
- ///
- /// The region UUID.
- ///
- public List LoadLandObjects(UUID regionUUID)
- {
- List LandDataForRegion = new List();
-
- string sql = "select * from land where RegionUUID = @RegionUUID";
-
- //Retrieve all land data from region
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionUUID));
- conn.Open();
- using (SqlDataReader readerLandData = cmd.ExecuteReader())
- {
- while (readerLandData.Read())
- {
- LandDataForRegion.Add(BuildLandData(readerLandData));
- }
- }
- }
-
- //Retrieve all accesslist data for all landdata
- foreach (LandData LandData in LandDataForRegion)
- {
- sql = "select * from landaccesslist where LandUUID = @LandUUID";
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.Add(_Database.CreateParameter("@LandUUID", LandData.GlobalID));
- conn.Open();
- using (SqlDataReader readerAccessList = cmd.ExecuteReader())
- {
- while (readerAccessList.Read())
- {
- LandData.ParcelAccessList.Add(BuildLandAccessData(readerAccessList));
- }
- }
- }
- }
-
- //Return data
- return LandDataForRegion;
- }
-
- ///
- /// Stores land object with landaccess list.
- ///
- /// parcel data.
- public void StoreLandObject(ILandObject parcel)
- {
- //As this is only one record in land table I just delete all and then add a new record.
- //As the delete landaccess is already in the mysql code
-
- //Delete old values
- RemoveLandObject(parcel.LandData.GlobalID);
-
- //Insert new values
- string sql = @"INSERT INTO [land]
-([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime])
-VALUES
-(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)";
-
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.AddRange(CreateLandParameters(parcel.LandData, parcel.RegionUUID));
- conn.Open();
- cmd.ExecuteNonQuery();
- }
-
- sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)";
-
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- conn.Open();
- foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList)
- {
- cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID));
-
- cmd.ExecuteNonQuery();
- cmd.Parameters.Clear();
- }
- }
- }
-
- ///
- /// Removes a land object from DB.
- ///
- /// UUID of landobject
- public void RemoveLandObject(UUID globalID)
- {
- string sql = "delete from land where UUID=@UUID";
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID));
- conn.Open();
- cmd.ExecuteNonQuery();
- }
- sql = "delete from landaccesslist where LandUUID=@UUID";
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID));
- conn.Open();
- cmd.ExecuteNonQuery();
- }
- }
- public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
- {
- //This connector doesn't support the windlight module yet
- //Return default LL windlight settings
- return new RegionLightShareData();
- }
- public void StoreRegionWindlightSettings(RegionLightShareData wl)
- {
- //This connector doesn't support the windlight module yet
- }
- ///
- /// Loads the settings of a region.
- ///
- /// The region UUID.
- ///
- public RegionSettings LoadRegionSettings(UUID regionUUID)
- {
- string sql = "select * from regionsettings where regionUUID = @regionUUID";
- RegionSettings regionSettings;
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID));
- conn.Open();
- using (SqlDataReader reader = cmd.ExecuteReader())
- {
- if (reader.Read())
- {
- regionSettings = BuildRegionSettings(reader);
- regionSettings.OnSave += StoreRegionSettings;
-
- return regionSettings;
- }
- }
- }
-
- //If we reach this point then there are new region settings for that region
- regionSettings = new RegionSettings();
- regionSettings.RegionUUID = regionUUID;
- regionSettings.OnSave += StoreRegionSettings;
-
- //Store new values
- StoreNewRegionSettings(regionSettings);
-
- return regionSettings;
- }
-
- ///
- /// Store region settings, need to check if the check is really necesary. If we can make something for creating new region.
- ///
- /// region settings.
- public void StoreRegionSettings(RegionSettings regionSettings)
- {
- //Little check if regionUUID already exist in DB
- string regionUUID;
- string sql = "SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID";
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID));
- conn.Open();
- regionUUID = cmd.ExecuteScalar().ToString();
- }
-
- if (string.IsNullOrEmpty(regionUUID))
- {
- StoreNewRegionSettings(regionSettings);
- }
- else
- {
- //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB
- sql =
- @"UPDATE [regionsettings] SET [block_terraform] = @block_terraform ,[block_fly] = @block_fly ,[allow_damage] = @allow_damage
-,[restrict_pushing] = @restrict_pushing ,[allow_land_resell] = @allow_land_resell ,[allow_land_join_divide] = @allow_land_join_divide
-,[block_show_in_search] = @block_show_in_search ,[agent_limit] = @agent_limit ,[object_bonus] = @object_bonus ,[maturity] = @maturity
-,[disable_scripts] = @disable_scripts ,[disable_collisions] = @disable_collisions ,[disable_physics] = @disable_physics
-,[terrain_texture_1] = @terrain_texture_1 ,[terrain_texture_2] = @terrain_texture_2 ,[terrain_texture_3] = @terrain_texture_3
-,[terrain_texture_4] = @terrain_texture_4 ,[elevation_1_nw] = @elevation_1_nw ,[elevation_2_nw] = @elevation_2_nw
-,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se
-,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit
-,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position
-,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id
- WHERE [regionUUID] = @regionUUID";
-
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings));
- conn.Open();
- cmd.ExecuteNonQuery();
- }
- }
- }
-
- public void Shutdown()
- {
- //Not used??
- }
-
- #region Private Methods
-
- ///
- /// Serializes the terrain data for storage in DB.
- ///
- /// terrain data
- ///
- private static Array serializeTerrain(double[,] val)
- {
- MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) * sizeof(double));
- BinaryWriter bw = new BinaryWriter(str);
-
- // TODO: COMPATIBILITY - Add byte-order conversions
- for (int x = 0; x < (int)Constants.RegionSize; x++)
- for (int y = 0; y < (int)Constants.RegionSize; y++)
- {
- double height = val[x, y];
- if (height == 0.0)
- height = double.Epsilon;
-
- bw.Write(height);
- }
-
- return str.ToArray();
- }
-
- ///
- /// Stores new regionsettings.
- ///
- /// The region settings.
- private void StoreNewRegionSettings(RegionSettings regionSettings)
- {
- string sql = @"INSERT INTO [regionsettings]
- ([regionUUID],[block_terraform],[block_fly],[allow_damage],[restrict_pushing],[allow_land_resell],[allow_land_join_divide],
- [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics],
- [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne],
- [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit],
- [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id]
- )
- VALUES
- (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide,
- @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics,
- @terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne,
- @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit,
- @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)";
-
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
- cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings));
- conn.Open();
- cmd.ExecuteNonQuery();
- }
- }
-
- #region Private DataRecord conversion methods
-
- ///
- /// Builds the region settings from a datarecod.
- ///
- /// datarecord with regionsettings.
- ///
- private static RegionSettings BuildRegionSettings(IDataRecord row)
- {
- //TODO change this is some more generic code so we doesnt have to change it every time a new field is added?
- RegionSettings newSettings = new RegionSettings();
-
- newSettings.RegionUUID = new UUID((Guid)row["regionUUID"]);
- newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
- newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
- newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
- newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
- newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
- newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
- newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
- newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
- newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
- newSettings.Maturity = Convert.ToInt32(row["maturity"]);
- newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
- newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
- newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
- newSettings.TerrainTexture1 = new UUID((Guid)row["terrain_texture_1"]);
- newSettings.TerrainTexture2 = new UUID((Guid)row["terrain_texture_2"]);
- newSettings.TerrainTexture3 = new UUID((Guid)row["terrain_texture_3"]);
- newSettings.TerrainTexture4 = new UUID((Guid)row["terrain_texture_4"]);
- newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
- newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
- newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
- newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
- newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
- newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
- newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
- newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
- newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
- newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
- newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
- newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
- newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
- newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
- newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
- newSettings.SunVector = new Vector3(
- Convert.ToSingle(row["sunvectorx"]),
- Convert.ToSingle(row["sunvectory"]),
- Convert.ToSingle(row["sunvectorz"])
- );
- newSettings.Covenant = new UUID((Guid)row["covenant"]);
-
- newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
-
- if (row["loaded_creation_id"] is DBNull)
- newSettings.LoadedCreationID = "";
- else
- newSettings.LoadedCreationID = (String)row["loaded_creation_id"];
- return newSettings;
- }
-
- ///
- /// Builds the land data from a datarecord.
- ///
- /// datarecord with land data
- ///
- private static LandData BuildLandData(IDataRecord row)
- {
- LandData newData = new LandData();
-
- newData.GlobalID = new UUID((Guid)row["UUID"]);
- newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
-
- // Bitmap is a byte[512]
- newData.Bitmap = (Byte[])row["Bitmap"];
-
- newData.Name = (string)row["Name"];
- newData.Description = (string)row["Description"];
- newData.OwnerID = new UUID((Guid)row["OwnerUUID"]);
- newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
- newData.Area = Convert.ToInt32(row["Area"]);
- newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
- newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]);
- //Enum libsecondlife.Parcel.ParcelCategory
- newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
- newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
- newData.GroupID = new UUID((Guid)row["GroupUUID"]);
- newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
- newData.Status = (ParcelStatus)Convert.ToInt32(row["LandStatus"]);
- //Enum. libsecondlife.Parcel.ParcelStatus
- newData.Flags = Convert.ToUInt32(row["LandFlags"]);
- newData.LandingType = Convert.ToByte(row["LandingType"]);
- newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
- newData.MediaID = new UUID((Guid)row["MediaTextureUUID"]);
- newData.MediaURL = (string)row["MediaURL"];
- newData.MusicURL = (string)row["MusicURL"];
- newData.PassHours = Convert.ToSingle(row["PassHours"]);
- newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
-
- // UUID authedbuyer;
- // UUID snapshotID;
- //
- // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer))
- // newData.AuthBuyerID = authedbuyer;
- //
- // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID))
- // newData.SnapshotID = snapshotID;
- newData.AuthBuyerID = new UUID((Guid)row["AuthBuyerID"]);
- newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
-
- newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
-
- try
- {
- newData.UserLocation =
- new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
- Convert.ToSingle(row["UserLocationZ"]));
- newData.UserLookAt =
- new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
- Convert.ToSingle(row["UserLookAtZ"]));
- }
- catch (InvalidCastException)
- {
- newData.UserLocation = Vector3.Zero;
- newData.UserLookAt = Vector3.Zero;
- _Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
- }
-
- newData.ParcelAccessList = new List();
-
- return newData;
- }
-
- ///
- /// Builds the landaccess data from a data record.
- ///
- /// datarecord with landaccess data
- ///
- private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row)
- {
- ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
- entry.AgentID = new UUID((Guid)row["AccessUUID"]);
- entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
- entry.Time = new DateTime();
- return entry;
- }
-
- ///
- /// Builds the prim from a datarecord.
- ///
- /// datarecord
- ///
- private static SceneObjectPart BuildPrim(IDataRecord primRow)
- {
- SceneObjectPart prim = new SceneObjectPart();
-
- prim.UUID = new UUID((Guid)primRow["UUID"]);
- // explicit conversion of integers is required, which sort
- // of sucks. No idea if there is a shortcut here or not.
- prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]);
- prim.Name = (string)primRow["Name"];
- // various text fields
- prim.Text = (string)primRow["Text"];
- prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]),
- Convert.ToInt32(primRow["ColorR"]),
- Convert.ToInt32(primRow["ColorG"]),
- Convert.ToInt32(primRow["ColorB"]));
- prim.Description = (string)primRow["Description"];
- prim.SitName = (string)primRow["SitName"];
- prim.TouchName = (string)primRow["TouchName"];
- // permissions
- prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
- prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
- prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
- prim.GroupID = new UUID((Guid)primRow["GroupID"]);
- prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
- prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
- prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
- prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
- prim.EveryoneMask = Convert.ToUInt32(primRow["EveryoneMask"]);
- prim.BaseMask = Convert.ToUInt32(primRow["BaseMask"]);
- // vectors
- prim.OffsetPosition = new Vector3(
- Convert.ToSingle(primRow["PositionX"]),
- Convert.ToSingle(primRow["PositionY"]),
- Convert.ToSingle(primRow["PositionZ"]));
-
- prim.GroupPosition = new Vector3(
- Convert.ToSingle(primRow["GroupPositionX"]),
- Convert.ToSingle(primRow["GroupPositionY"]),
- Convert.ToSingle(primRow["GroupPositionZ"]));
-
- prim.Velocity = new Vector3(
- Convert.ToSingle(primRow["VelocityX"]),
- Convert.ToSingle(primRow["VelocityY"]),
- Convert.ToSingle(primRow["VelocityZ"]));
-
- prim.AngularVelocity = new Vector3(
- Convert.ToSingle(primRow["AngularVelocityX"]),
- Convert.ToSingle(primRow["AngularVelocityY"]),
- Convert.ToSingle(primRow["AngularVelocityZ"]));
-
- prim.Acceleration = new Vector3(
- Convert.ToSingle(primRow["AccelerationX"]),
- Convert.ToSingle(primRow["AccelerationY"]),
- Convert.ToSingle(primRow["AccelerationZ"]));
-
- // quaternions
- prim.RotationOffset = new Quaternion(
- Convert.ToSingle(primRow["RotationX"]),
- Convert.ToSingle(primRow["RotationY"]),
- Convert.ToSingle(primRow["RotationZ"]),
- Convert.ToSingle(primRow["RotationW"]));
-
- prim.SitTargetPositionLL = new Vector3(
- Convert.ToSingle(primRow["SitTargetOffsetX"]),
- Convert.ToSingle(primRow["SitTargetOffsetY"]),
- Convert.ToSingle(primRow["SitTargetOffsetZ"]));
-
- prim.SitTargetOrientationLL = new Quaternion(
- Convert.ToSingle(primRow["SitTargetOrientX"]),
- Convert.ToSingle(primRow["SitTargetOrientY"]),
- Convert.ToSingle(primRow["SitTargetOrientZ"]),
- Convert.ToSingle(primRow["SitTargetOrientW"]));
-
- prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]);
- prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]);
- prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]);
- prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]);
- prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]);
-
- prim.Sound = new UUID((Guid)primRow["LoopedSound"]);
- prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]);
- prim.SoundFlags = 1; // If it's persisted at all, it's looped
-
- if (!(primRow["TextureAnimation"] is DBNull))
- prim.TextureAnimation = (Byte[])primRow["TextureAnimation"];
- if (!(primRow["ParticleSystem"] is DBNull))
- prim.ParticleSystem = (Byte[])primRow["ParticleSystem"];
-
- prim.AngularVelocity = new Vector3(
- Convert.ToSingle(primRow["OmegaX"]),
- Convert.ToSingle(primRow["OmegaY"]),
- Convert.ToSingle(primRow["OmegaZ"]));
-
- prim.SetCameraEyeOffset(new Vector3(
- Convert.ToSingle(primRow["CameraEyeOffsetX"]),
- Convert.ToSingle(primRow["CameraEyeOffsetY"]),
- Convert.ToSingle(primRow["CameraEyeOffsetZ"])
- ));
-
- prim.SetCameraAtOffset(new Vector3(
- Convert.ToSingle(primRow["CameraAtOffsetX"]),
- Convert.ToSingle(primRow["CameraAtOffsetY"]),
- Convert.ToSingle(primRow["CameraAtOffsetZ"])
- ));
-
- if (Convert.ToInt16(primRow["ForceMouselook"]) != 0)
- prim.SetForceMouselook(true);
-
- prim.ScriptAccessPin = Convert.ToInt32(primRow["ScriptAccessPin"]);
-
- if (Convert.ToInt16(primRow["AllowedDrop"]) != 0)
- prim.AllowedDrop = true;
-
- if (Convert.ToInt16(primRow["DieAtEdge"]) != 0)
- prim.DIE_AT_EDGE = true;
-
- prim.SalePrice = Convert.ToInt32(primRow["SalePrice"]);
- prim.ObjectSaleType = Convert.ToByte(primRow["SaleType"]);
-
- prim.Material = Convert.ToByte(primRow["Material"]);
-
- if (!(primRow["ClickAction"] is DBNull))
- prim.ClickAction = Convert.ToByte(primRow["ClickAction"]);
-
- prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]);
- prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
- if (Convert.ToInt16(primRow["PassTouches"]) != 0)
- prim.PassTouches = true;
- prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]);
-
- if (!(primRow["MediaURL"] is System.DBNull))
- prim.MediaUrl = (string)primRow["MediaURL"];
-
- return prim;
- }
-
- ///
- /// Builds the prim shape from a datarecord.
- ///
- /// The row.
- ///
- private static PrimitiveBaseShape BuildShape(IDataRecord shapeRow)
- {
- PrimitiveBaseShape baseShape = new PrimitiveBaseShape();
-
- baseShape.Scale = new Vector3(
- Convert.ToSingle(shapeRow["ScaleX"]),
- Convert.ToSingle(shapeRow["ScaleY"]),
- Convert.ToSingle(shapeRow["ScaleZ"]));
-
- // paths
- baseShape.PCode = Convert.ToByte(shapeRow["PCode"]);
- baseShape.PathBegin = Convert.ToUInt16(shapeRow["PathBegin"]);
- baseShape.PathEnd = Convert.ToUInt16(shapeRow["PathEnd"]);
- baseShape.PathScaleX = Convert.ToByte(shapeRow["PathScaleX"]);
- baseShape.PathScaleY = Convert.ToByte(shapeRow["PathScaleY"]);
- baseShape.PathShearX = Convert.ToByte(shapeRow["PathShearX"]);
- baseShape.PathShearY = Convert.ToByte(shapeRow["PathShearY"]);
- baseShape.PathSkew = Convert.ToSByte(shapeRow["PathSkew"]);
- baseShape.PathCurve = Convert.ToByte(shapeRow["PathCurve"]);
- baseShape.PathRadiusOffset = Convert.ToSByte(shapeRow["PathRadiusOffset"]);
- baseShape.PathRevolutions = Convert.ToByte(shapeRow["PathRevolutions"]);
- baseShape.PathTaperX = Convert.ToSByte(shapeRow["PathTaperX"]);
- baseShape.PathTaperY = Convert.ToSByte(shapeRow["PathTaperY"]);
- baseShape.PathTwist = Convert.ToSByte(shapeRow["PathTwist"]);
- baseShape.PathTwistBegin = Convert.ToSByte(shapeRow["PathTwistBegin"]);
- // profile
- baseShape.ProfileBegin = Convert.ToUInt16(shapeRow["ProfileBegin"]);
- baseShape.ProfileEnd = Convert.ToUInt16(shapeRow["ProfileEnd"]);
- baseShape.ProfileCurve = Convert.ToByte(shapeRow["ProfileCurve"]);
- baseShape.ProfileHollow = Convert.ToUInt16(shapeRow["ProfileHollow"]);
-
- byte[] textureEntry = (byte[])shapeRow["Texture"];
- baseShape.TextureEntry = textureEntry;
-
- baseShape.ExtraParams = (byte[])shapeRow["ExtraParams"];
-
- try
- {
- baseShape.State = Convert.ToByte(shapeRow["State"]);
- }
- catch (InvalidCastException)
- {
- }
-
- if (!(shapeRow["Media"] is System.DBNull))
- baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
-
- return baseShape;
- }
-
- ///
- /// Build a prim inventory item from the persisted data.
- ///
- ///
- ///
- private static TaskInventoryItem BuildItem(IDataRecord inventoryRow)
- {
- TaskInventoryItem taskItem = new TaskInventoryItem();
-
- taskItem.ItemID = new UUID((Guid)inventoryRow["itemID"]);
- taskItem.ParentPartID = new UUID((Guid)inventoryRow["primID"]);
- taskItem.AssetID = new UUID((Guid)inventoryRow["assetID"]);
- taskItem.ParentID = new UUID((Guid)inventoryRow["parentFolderID"]);
-
- taskItem.InvType = Convert.ToInt32(inventoryRow["invType"]);
- taskItem.Type = Convert.ToInt32(inventoryRow["assetType"]);
-
- taskItem.Name = (string)inventoryRow["name"];
- taskItem.Description = (string)inventoryRow["description"];
- taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]);
- taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
- taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]);
- taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]);
- taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]);
-
- taskItem.NextPermissions = Convert.ToUInt32(inventoryRow["nextPermissions"]);
- taskItem.CurrentPermissions = Convert.ToUInt32(inventoryRow["currentPermissions"]);
- taskItem.BasePermissions = Convert.ToUInt32(inventoryRow["basePermissions"]);
- taskItem.EveryonePermissions = Convert.ToUInt32(inventoryRow["everyonePermissions"]);
- taskItem.GroupPermissions = Convert.ToUInt32(inventoryRow["groupPermissions"]);
- taskItem.Flags = Convert.ToUInt32(inventoryRow["flags"]);
-
- return taskItem;
- }
-
- #endregion
-
- #region Create parameters methods
-
- ///
- /// Creates the prim inventory parameters.
- ///
- /// item in inventory.
- ///
- private SqlParameter[] CreatePrimInventoryParameters(TaskInventoryItem taskItem)
- {
- List parameters = new List();
-
- parameters.Add(_Database.CreateParameter("itemID", taskItem.ItemID));
- parameters.Add(_Database.CreateParameter("primID", taskItem.ParentPartID));
- parameters.Add(_Database.CreateParameter("assetID", taskItem.AssetID));
- parameters.Add(_Database.CreateParameter("parentFolderID", taskItem.ParentID));
- parameters.Add(_Database.CreateParameter("invType", taskItem.InvType));
- parameters.Add(_Database.CreateParameter("assetType", taskItem.Type));
-
- parameters.Add(_Database.CreateParameter("name", taskItem.Name));
- parameters.Add(_Database.CreateParameter("description", taskItem.Description));
- parameters.Add(_Database.CreateParameter("creationDate", taskItem.CreationDate));
- parameters.Add(_Database.CreateParameter("creatorID", taskItem.CreatorID));
- parameters.Add(_Database.CreateParameter("ownerID", taskItem.OwnerID));
- parameters.Add(_Database.CreateParameter("lastOwnerID", taskItem.LastOwnerID));
- parameters.Add(_Database.CreateParameter("groupID", taskItem.GroupID));
- parameters.Add(_Database.CreateParameter("nextPermissions", taskItem.NextPermissions));
- parameters.Add(_Database.CreateParameter("currentPermissions", taskItem.CurrentPermissions));
- parameters.Add(_Database.CreateParameter("basePermissions", taskItem.BasePermissions));
- parameters.Add(_Database.CreateParameter("everyonePermissions", taskItem.EveryonePermissions));
- parameters.Add(_Database.CreateParameter("groupPermissions", taskItem.GroupPermissions));
- parameters.Add(_Database.CreateParameter("flags", taskItem.Flags));
-
- return parameters.ToArray();
- }
-
- ///
- /// Creates the region setting parameters.
- ///
- /// regionsettings.
- ///
- private SqlParameter[] CreateRegionSettingParameters(RegionSettings settings)
- {
- List parameters = new List();
-
- parameters.Add(_Database.CreateParameter("regionUUID", settings.RegionUUID));
- parameters.Add(_Database.CreateParameter("block_terraform", settings.BlockTerraform));
- parameters.Add(_Database.CreateParameter("block_fly", settings.BlockFly));
- parameters.Add(_Database.CreateParameter("allow_damage", settings.AllowDamage));
- parameters.Add(_Database.CreateParameter("restrict_pushing", settings.RestrictPushing));
- parameters.Add(_Database.CreateParameter("allow_land_resell", settings.AllowLandResell));
- parameters.Add(_Database.CreateParameter("allow_land_join_divide", settings.AllowLandJoinDivide));
- parameters.Add(_Database.CreateParameter("block_show_in_search", settings.BlockShowInSearch));
- parameters.Add(_Database.CreateParameter("agent_limit", settings.AgentLimit));
- parameters.Add(_Database.CreateParameter("object_bonus", settings.ObjectBonus));
- parameters.Add(_Database.CreateParameter("maturity", settings.Maturity));
- parameters.Add(_Database.CreateParameter("disable_scripts", settings.DisableScripts));
- parameters.Add(_Database.CreateParameter("disable_collisions", settings.DisableCollisions));
- parameters.Add(_Database.CreateParameter("disable_physics", settings.DisablePhysics));
- parameters.Add(_Database.CreateParameter("terrain_texture_1", settings.TerrainTexture1));
- parameters.Add(_Database.CreateParameter("terrain_texture_2", settings.TerrainTexture2));
- parameters.Add(_Database.CreateParameter("terrain_texture_3", settings.TerrainTexture3));
- parameters.Add(_Database.CreateParameter("terrain_texture_4", settings.TerrainTexture4));
- parameters.Add(_Database.CreateParameter("elevation_1_nw", settings.Elevation1NW));
- parameters.Add(_Database.CreateParameter("elevation_2_nw", settings.Elevation2NW));
- parameters.Add(_Database.CreateParameter("elevation_1_ne", settings.Elevation1NE));
- parameters.Add(_Database.CreateParameter("elevation_2_ne", settings.Elevation2NE));
- parameters.Add(_Database.CreateParameter("elevation_1_se", settings.Elevation1SE));
- parameters.Add(_Database.CreateParameter("elevation_2_se", settings.Elevation2SE));
- parameters.Add(_Database.CreateParameter("elevation_1_sw", settings.Elevation1SW));
- parameters.Add(_Database.CreateParameter("elevation_2_sw", settings.Elevation2SW));
- parameters.Add(_Database.CreateParameter("water_height", settings.WaterHeight));
- parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit));
- parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit));
- parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun));
- parameters.Add(_Database.CreateParameter("sandbox", settings.Sandbox));
- parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun));
- parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition));
- parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X));
- parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y));
- parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z));
- parameters.Add(_Database.CreateParameter("covenant", settings.Covenant));
- parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
- parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));
-
- return parameters.ToArray();
- }
-
- ///
- /// Creates the land parameters.
- ///
- /// land parameters.
- /// region UUID.
- ///
- private SqlParameter[] CreateLandParameters(LandData land, UUID regionUUID)
- {
- List parameters = new List();
-
- parameters.Add(_Database.CreateParameter("UUID", land.GlobalID));
- parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID));
- parameters.Add(_Database.CreateParameter("LocalLandID", land.LocalID));
-
- // Bitmap is a byte[512]
- parameters.Add(_Database.CreateParameter("Bitmap", land.Bitmap));
-
- parameters.Add(_Database.CreateParameter("Name", land.Name));
- parameters.Add(_Database.CreateParameter("Description", land.Description));
- parameters.Add(_Database.CreateParameter("OwnerUUID", land.OwnerID));
- parameters.Add(_Database.CreateParameter("IsGroupOwned", land.IsGroupOwned));
- parameters.Add(_Database.CreateParameter("Area", land.Area));
- parameters.Add(_Database.CreateParameter("AuctionID", land.AuctionID)); //Unemplemented
- parameters.Add(_Database.CreateParameter("Category", (int)land.Category)); //Enum libsecondlife.Parcel.ParcelCategory
- parameters.Add(_Database.CreateParameter("ClaimDate", land.ClaimDate));
- parameters.Add(_Database.CreateParameter("ClaimPrice", land.ClaimPrice));
- parameters.Add(_Database.CreateParameter("GroupUUID", land.GroupID));
- parameters.Add(_Database.CreateParameter("SalePrice", land.SalePrice));
- parameters.Add(_Database.CreateParameter("LandStatus", (int)land.Status)); //Enum. libsecondlife.Parcel.ParcelStatus
- parameters.Add(_Database.CreateParameter("LandFlags", land.Flags));
- parameters.Add(_Database.CreateParameter("LandingType", land.LandingType));
- parameters.Add(_Database.CreateParameter("MediaAutoScale", land.MediaAutoScale));
- parameters.Add(_Database.CreateParameter("MediaTextureUUID", land.MediaID));
- parameters.Add(_Database.CreateParameter("MediaURL", land.MediaURL));
- parameters.Add(_Database.CreateParameter("MusicURL", land.MusicURL));
- parameters.Add(_Database.CreateParameter("PassHours", land.PassHours));
- parameters.Add(_Database.CreateParameter("PassPrice", land.PassPrice));
- parameters.Add(_Database.CreateParameter("SnapshotUUID", land.SnapshotID));
- parameters.Add(_Database.CreateParameter("UserLocationX", land.UserLocation.X));
- parameters.Add(_Database.CreateParameter("UserLocationY", land.UserLocation.Y));
- parameters.Add(_Database.CreateParameter("UserLocationZ", land.UserLocation.Z));
- parameters.Add(_Database.CreateParameter("UserLookAtX", land.UserLookAt.X));
- parameters.Add(_Database.CreateParameter("UserLookAtY", land.UserLookAt.Y));
- parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
- parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
- parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
-
- return parameters.ToArray();
- }
-
- ///
- /// Creates the land access parameters.
- ///
- /// parcel access entry.
- /// parcel ID.
- ///
- private SqlParameter[] CreateLandAccessParameters(ParcelManager.ParcelAccessEntry parcelAccessEntry, UUID parcelID)
- {
- List parameters = new List();
-
- parameters.Add(_Database.CreateParameter("LandUUID", parcelID));
- parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID));
- parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags));
-
- return parameters.ToArray();
- }
-
- ///
- /// Creates the prim parameters for storing in DB.
- ///
- /// Basic data of SceneObjectpart prim.
- /// The scenegroup ID.
- /// The region ID.
- ///
- private SqlParameter[] CreatePrimParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
- {
- List parameters = new List();
-
- parameters.Add(_Database.CreateParameter("UUID", prim.UUID));
- parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID));
- parameters.Add(_Database.CreateParameter("CreationDate", prim.CreationDate));
- parameters.Add(_Database.CreateParameter("Name", prim.Name));
- parameters.Add(_Database.CreateParameter("SceneGroupID", sceneGroupID));
- // the UUID of the root part for this SceneObjectGroup
- // various text fields
- parameters.Add(_Database.CreateParameter("Text", prim.Text));
- parameters.Add(_Database.CreateParameter("ColorR", prim.Color.R));
- parameters.Add(_Database.CreateParameter("ColorG", prim.Color.G));
- parameters.Add(_Database.CreateParameter("ColorB", prim.Color.B));
- parameters.Add(_Database.CreateParameter("ColorA", prim.Color.A));
- parameters.Add(_Database.CreateParameter("Description", prim.Description));
- parameters.Add(_Database.CreateParameter("SitName", prim.SitName));
- parameters.Add(_Database.CreateParameter("TouchName", prim.TouchName));
- // permissions
- parameters.Add(_Database.CreateParameter("ObjectFlags", (uint)prim.Flags));
- parameters.Add(_Database.CreateParameter("CreatorID", prim.CreatorID));
- parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
- parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
- parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
- parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
- parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
- parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
- parameters.Add(_Database.CreateParameter("EveryoneMask", prim.EveryoneMask));
- parameters.Add(_Database.CreateParameter("BaseMask", prim.BaseMask));
- // vectors
- parameters.Add(_Database.CreateParameter("PositionX", prim.OffsetPosition.X));
- parameters.Add(_Database.CreateParameter("PositionY", prim.OffsetPosition.Y));
- parameters.Add(_Database.CreateParameter("PositionZ", prim.OffsetPosition.Z));
- parameters.Add(_Database.CreateParameter("GroupPositionX", prim.GroupPosition.X));
- parameters.Add(_Database.CreateParameter("GroupPositionY", prim.GroupPosition.Y));
- parameters.Add(_Database.CreateParameter("GroupPositionZ", prim.GroupPosition.Z));
- parameters.Add(_Database.CreateParameter("VelocityX", prim.Velocity.X));
- parameters.Add(_Database.CreateParameter("VelocityY", prim.Velocity.Y));
- parameters.Add(_Database.CreateParameter("VelocityZ", prim.Velocity.Z));
- parameters.Add(_Database.CreateParameter("AngularVelocityX", prim.AngularVelocity.X));
- parameters.Add(_Database.CreateParameter("AngularVelocityY", prim.AngularVelocity.Y));
- parameters.Add(_Database.CreateParameter("AngularVelocityZ", prim.AngularVelocity.Z));
- parameters.Add(_Database.CreateParameter("AccelerationX", prim.Acceleration.X));
- parameters.Add(_Database.CreateParameter("AccelerationY", prim.Acceleration.Y));
- parameters.Add(_Database.CreateParameter("AccelerationZ", prim.Acceleration.Z));
- // quaternions
- parameters.Add(_Database.CreateParameter("RotationX", prim.RotationOffset.X));
- parameters.Add(_Database.CreateParameter("RotationY", prim.RotationOffset.Y));
- parameters.Add(_Database.CreateParameter("RotationZ", prim.RotationOffset.Z));
- parameters.Add(_Database.CreateParameter("RotationW", prim.RotationOffset.W));
-
- // Sit target
- Vector3 sitTargetPos = prim.SitTargetPositionLL;
- parameters.Add(_Database.CreateParameter("SitTargetOffsetX", sitTargetPos.X));
- parameters.Add(_Database.CreateParameter("SitTargetOffsetY", sitTargetPos.Y));
- parameters.Add(_Database.CreateParameter("SitTargetOffsetZ", sitTargetPos.Z));
-
- Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
- parameters.Add(_Database.CreateParameter("SitTargetOrientW", sitTargetOrient.W));
- parameters.Add(_Database.CreateParameter("SitTargetOrientX", sitTargetOrient.X));
- parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y));
- parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z));
-
- parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0]));
- parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1]));
- parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2]));
- parameters.Add(_Database.CreateParameter("PayButton3", prim.PayPrice[3]));
- parameters.Add(_Database.CreateParameter("PayButton4", prim.PayPrice[4]));
-
- if ((prim.SoundFlags & 1) != 0) // Looped
- {
- parameters.Add(_Database.CreateParameter("LoopedSound", prim.Sound));
- parameters.Add(_Database.CreateParameter("LoopedSoundGain", prim.SoundGain));
- }
- else
- {
- parameters.Add(_Database.CreateParameter("LoopedSound", UUID.Zero));
- parameters.Add(_Database.CreateParameter("LoopedSoundGain", 0.0f));
- }
-
- parameters.Add(_Database.CreateParameter("TextureAnimation", prim.TextureAnimation));
- parameters.Add(_Database.CreateParameter("ParticleSystem", prim.ParticleSystem));
-
- parameters.Add(_Database.CreateParameter("OmegaX", prim.AngularVelocity.X));
- parameters.Add(_Database.CreateParameter("OmegaY", prim.AngularVelocity.Y));
- parameters.Add(_Database.CreateParameter("OmegaZ", prim.AngularVelocity.Z));
-
- parameters.Add(_Database.CreateParameter("CameraEyeOffsetX", prim.GetCameraEyeOffset().X));
- parameters.Add(_Database.CreateParameter("CameraEyeOffsetY", prim.GetCameraEyeOffset().Y));
- parameters.Add(_Database.CreateParameter("CameraEyeOffsetZ", prim.GetCameraEyeOffset().Z));
-
- parameters.Add(_Database.CreateParameter("CameraAtOffsetX", prim.GetCameraAtOffset().X));
- parameters.Add(_Database.CreateParameter("CameraAtOffsetY", prim.GetCameraAtOffset().Y));
- parameters.Add(_Database.CreateParameter("CameraAtOffsetZ", prim.GetCameraAtOffset().Z));
-
- if (prim.GetForceMouselook())
- parameters.Add(_Database.CreateParameter("ForceMouselook", 1));
- else
- parameters.Add(_Database.CreateParameter("ForceMouselook", 0));
-
- parameters.Add(_Database.CreateParameter("ScriptAccessPin", prim.ScriptAccessPin));
-
- if (prim.AllowedDrop)
- parameters.Add(_Database.CreateParameter("AllowedDrop", 1));
- else
- parameters.Add(_Database.CreateParameter("AllowedDrop", 0));
-
- if (prim.DIE_AT_EDGE)
- parameters.Add(_Database.CreateParameter("DieAtEdge", 1));
- else
- parameters.Add(_Database.CreateParameter("DieAtEdge", 0));
-
- parameters.Add(_Database.CreateParameter("SalePrice", prim.SalePrice));
- parameters.Add(_Database.CreateParameter("SaleType", prim.ObjectSaleType));
-
- byte clickAction = prim.ClickAction;
- parameters.Add(_Database.CreateParameter("ClickAction", clickAction));
-
- parameters.Add(_Database.CreateParameter("Material", prim.Material));
-
- parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
- parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
- if (prim.PassTouches)
- parameters.Add(_Database.CreateParameter("PassTouches", 1));
- else
- parameters.Add(_Database.CreateParameter("PassTouches", 0));
- parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
- parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
-
- return parameters.ToArray();
- }
-
- ///
- /// Creates the primshape parameters for stroing in DB.
- ///
- /// Basic data of SceneObjectpart prim.
- /// The scene group ID.
- /// The region UUID.
- ///
- private SqlParameter[] CreatePrimShapeParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
- {
- List parameters = new List();
-
- PrimitiveBaseShape s = prim.Shape;
- parameters.Add(_Database.CreateParameter("UUID", prim.UUID));
- // shape is an enum
- parameters.Add(_Database.CreateParameter("Shape", 0));
- // vectors
- parameters.Add(_Database.CreateParameter("ScaleX", s.Scale.X));
- parameters.Add(_Database.CreateParameter("ScaleY", s.Scale.Y));
- parameters.Add(_Database.CreateParameter("ScaleZ", s.Scale.Z));
- // paths
- parameters.Add(_Database.CreateParameter("PCode", s.PCode));
- parameters.Add(_Database.CreateParameter("PathBegin", s.PathBegin));
- parameters.Add(_Database.CreateParameter("PathEnd", s.PathEnd));
- parameters.Add(_Database.CreateParameter("PathScaleX", s.PathScaleX));
- parameters.Add(_Database.CreateParameter("PathScaleY", s.PathScaleY));
- parameters.Add(_Database.CreateParameter("PathShearX", s.PathShearX));
- parameters.Add(_Database.CreateParameter("PathShearY", s.PathShearY));
- parameters.Add(_Database.CreateParameter("PathSkew", s.PathSkew));
- parameters.Add(_Database.CreateParameter("PathCurve", s.PathCurve));
- parameters.Add(_Database.CreateParameter("PathRadiusOffset", s.PathRadiusOffset));
- parameters.Add(_Database.CreateParameter("PathRevolutions", s.PathRevolutions));
- parameters.Add(_Database.CreateParameter("PathTaperX", s.PathTaperX));
- parameters.Add(_Database.CreateParameter("PathTaperY", s.PathTaperY));
- parameters.Add(_Database.CreateParameter("PathTwist", s.PathTwist));
- parameters.Add(_Database.CreateParameter("PathTwistBegin", s.PathTwistBegin));
- // profile
- parameters.Add(_Database.CreateParameter("ProfileBegin", s.ProfileBegin));
- parameters.Add(_Database.CreateParameter("ProfileEnd", s.ProfileEnd));
- parameters.Add(_Database.CreateParameter("ProfileCurve", s.ProfileCurve));
- parameters.Add(_Database.CreateParameter("ProfileHollow", s.ProfileHollow));
- parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry));
- parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams));
- parameters.Add(_Database.CreateParameter("State", s.State));
- parameters.Add(_Database.CreateParameter("Media", null == s.Media ? null : s.Media.ToXml()));
-
- return parameters.ToArray();
- }
-
- #endregion
-
- #endregion
- }
-}
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
new file mode 100644
index 0000000..ae105d5
--- /dev/null
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -0,0 +1,1572 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Drawing;
+using System.IO;
+using System.Reflection;
+using log4net;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Data.MSSQL
+{
+ ///
+ /// A MSSQL Interface for the Region Server.
+ ///
+ public class MSSQLSimulationData : ISimulationDataStore
+ {
+ private const string _migrationStore = "RegionStore";
+
+ // private static FileSystemDataStore Instance = new FileSystemDataStore();
+ private static readonly ILog _Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ ///
+ /// The database manager
+ ///
+ private MSSQLManager _Database;
+ private string m_connectionString;
+ ///
+ /// Initialises the region datastore
+ ///
+ /// The connection string.
+ public void Initialise(string connectionString)
+ {
+ m_connectionString = connectionString;
+ _Database = new MSSQLManager(connectionString);
+
+
+ //Migration settings
+ _Database.CheckMigration(_migrationStore);
+ }
+
+ ///
+ /// Dispose the database
+ ///
+ public void Dispose() { }
+
+ #region SceneObjectGroup region for loading and Store of the scene.
+
+ ///
+ /// Loads the objects present in the region.
+ ///
+ /// The region UUID.
+ ///
+ public List LoadObjects(UUID regionUUID)
+ {
+ UUID lastGroupID = UUID.Zero;
+
+ Dictionary prims = new Dictionary();
+ Dictionary objects = new Dictionary();
+ SceneObjectGroup grp = null;
+
+ string sql = "SELECT *, " +
+ "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " +
+ "FROM prims " +
+ "LEFT JOIN primshapes ON prims.UUID = primshapes.UUID " +
+ "WHERE RegionUUID = @RegionUUID " +
+ "ORDER BY SceneGroupID asc, sort asc, LinkNumber asc";
+
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand command = new SqlCommand(sql, conn))
+ {
+ command.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID));
+ conn.Open();
+ using (SqlDataReader reader = command.ExecuteReader())
+ {
+ while (reader.Read())
+ {
+ SceneObjectPart sceneObjectPart = BuildPrim(reader);
+ if (reader["Shape"] is DBNull)
+ sceneObjectPart.Shape = PrimitiveBaseShape.Default;
+ else
+ sceneObjectPart.Shape = BuildShape(reader);
+
+ prims[sceneObjectPart.UUID] = sceneObjectPart;
+
+ UUID groupID = new UUID((Guid)reader["SceneGroupID"]);
+
+ if (groupID != lastGroupID) // New SOG
+ {
+ if (grp != null)
+ objects[grp.UUID] = grp;
+
+ lastGroupID = groupID;
+
+ // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are
+ // recorded as the root prim (for which the UUID must equal the persisted group UUID). In
+ // this case, force the UUID to be the same as the group UUID so that at least these can be
+ // deleted (we need to change the UUID so that any other prims in the linkset can also be
+ // deleted).
+ if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero)
+ {
+ _Log.WarnFormat(
+ "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID",
+ sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID);
+
+ sceneObjectPart.UUID = groupID;
+ }
+
+ grp = new SceneObjectGroup(sceneObjectPart);
+ }
+ else
+ {
+ // Black magic to preserve link numbers
+ // Why is this needed, fix this in AddPart method.
+ int link = sceneObjectPart.LinkNum;
+
+ grp.AddPart(sceneObjectPart);
+
+ if (link != 0)
+ sceneObjectPart.LinkNum = link;
+ }
+ }
+ }
+ }
+
+ if (grp != null)
+ objects[grp.UUID] = grp;
+
+ // Instead of attempting to LoadItems on every prim,
+ // most of which probably have no items... get a
+ // list from DB of all prims which have items and
+ // LoadItems only on those
+ List primsWithInventory = new List();
+ string qry = "select distinct primID from primitems";
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand command = new SqlCommand(qry, conn))
+ {
+ conn.Open();
+ using (SqlDataReader itemReader = command.ExecuteReader())
+ {
+ while (itemReader.Read())
+ {
+ if (!(itemReader["primID"] is DBNull))
+ {
+ UUID primID = new UUID(itemReader["primID"].ToString());
+ if (prims.ContainsKey(primID))
+ {
+ primsWithInventory.Add(prims[primID]);
+ }
+ }
+ }
+ }
+ }
+
+ LoadItems(primsWithInventory);
+
+ _Log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count);
+
+ return new List(objects.Values);
+ }
+
+ ///
+ /// Load in the prim's persisted inventory.
+ ///
+ /// all prims with inventory on a region
+ private void LoadItems(List allPrimsWithInventory)
+ {
+ string sql = "SELECT * FROM primitems WHERE PrimID = @PrimID";
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand command = new SqlCommand(sql, conn))
+ {
+ conn.Open();
+ foreach (SceneObjectPart objectPart in allPrimsWithInventory)
+ {
+ command.Parameters.Clear();
+ command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID));
+
+ List inventory = new List();
+
+ using (SqlDataReader reader = command.ExecuteReader())
+ {
+ while (reader.Read())
+ {
+ TaskInventoryItem item = BuildItem(reader);
+
+ item.ParentID = objectPart.UUID; // Values in database are
+ // often wrong
+ inventory.Add(item);
+ }
+ }
+
+ objectPart.Inventory.RestoreInventoryItems(inventory);
+ }
+ }
+ }
+
+ ///
+ /// Stores all object's details apart from inventory
+ ///
+ ///
+ ///
+ public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
+ {
+ _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count);
+
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ {
+ conn.Open();
+ SqlTransaction transaction = conn.BeginTransaction();
+
+ try
+ {
+ foreach (SceneObjectPart sceneObjectPart in obj.Children.Values)
+ {
+ //Update prim
+ using (SqlCommand sqlCommand = conn.CreateCommand())
+ {
+ sqlCommand.Transaction = transaction;
+ try
+ {
+ StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
+ }
+ catch (SqlException sqlEx)
+ {
+ _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber);
+ throw;
+ }
+ }
+
+ //Update primshapes
+ using (SqlCommand sqlCommand = conn.CreateCommand())
+ {
+ sqlCommand.Transaction = transaction;
+ try
+ {
+ StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
+ }
+ catch (SqlException sqlEx)
+ {
+ _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber);
+ throw;
+ }
+ }
+ }
+
+ transaction.Commit();
+ }
+ catch (Exception ex)
+ {
+ _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message);
+ try
+ {
+ transaction.Rollback();
+ }
+ catch (Exception ex2)
+ {
+ //Show error
+ _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message);
+
+ }
+ }
+ }
+ }
+
+ ///
+ /// Stores the prim of the sceneobjectpart.
+ ///
+ /// The sceneobjectpart or prim.
+ /// The SQL command with the transaction.
+ /// The scenegroup UUID.
+ /// The region UUID.
+ private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
+ {
+ //Big query to update or insert a new prim.
+ //Note for SQL Server 2008 this could be simplified
+ string queryPrims = @"
+IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID)
+ BEGIN
+ UPDATE prims SET
+ CreationDate = @CreationDate, Name = @Name, Text = @Text, Description = @Description, SitName = @SitName,
+ TouchName = @TouchName, ObjectFlags = @ObjectFlags, OwnerMask = @OwnerMask, NextOwnerMask = @NextOwnerMask, GroupMask = @GroupMask,
+ EveryoneMask = @EveryoneMask, BaseMask = @BaseMask, PositionX = @PositionX, PositionY = @PositionY, PositionZ = @PositionZ,
+ GroupPositionX = @GroupPositionX, GroupPositionY = @GroupPositionY, GroupPositionZ = @GroupPositionZ, VelocityX = @VelocityX,
+ VelocityY = @VelocityY, VelocityZ = @VelocityZ, AngularVelocityX = @AngularVelocityX, AngularVelocityY = @AngularVelocityY,
+ AngularVelocityZ = @AngularVelocityZ, AccelerationX = @AccelerationX, AccelerationY = @AccelerationY,
+ AccelerationZ = @AccelerationZ, RotationX = @RotationX, RotationY = @RotationY, RotationZ = @RotationZ, RotationW = @RotationW,
+ SitTargetOffsetX = @SitTargetOffsetX, SitTargetOffsetY = @SitTargetOffsetY, SitTargetOffsetZ = @SitTargetOffsetZ,
+ SitTargetOrientW = @SitTargetOrientW, SitTargetOrientX = @SitTargetOrientX, SitTargetOrientY = @SitTargetOrientY,
+ SitTargetOrientZ = @SitTargetOrientZ, RegionUUID = @RegionUUID, CreatorID = @CreatorID, OwnerID = @OwnerID, GroupID = @GroupID,
+ LastOwnerID = @LastOwnerID, SceneGroupID = @SceneGroupID, PayPrice = @PayPrice, PayButton1 = @PayButton1, PayButton2 = @PayButton2,
+ PayButton3 = @PayButton3, PayButton4 = @PayButton4, LoopedSound = @LoopedSound, LoopedSoundGain = @LoopedSoundGain,
+ TextureAnimation = @TextureAnimation, OmegaX = @OmegaX, OmegaY = @OmegaY, OmegaZ = @OmegaZ, CameraEyeOffsetX = @CameraEyeOffsetX,
+ CameraEyeOffsetY = @CameraEyeOffsetY, CameraEyeOffsetZ = @CameraEyeOffsetZ, CameraAtOffsetX = @CameraAtOffsetX,
+ CameraAtOffsetY = @CameraAtOffsetY, CameraAtOffsetZ = @CameraAtOffsetZ, ForceMouselook = @ForceMouselook,
+ ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice,
+ SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem,
+ ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches,
+ LinkNumber = @LinkNumber, MediaURL = @MediaURL
+ WHERE UUID = @UUID
+ END
+ELSE
+ BEGIN
+ INSERT INTO
+ prims (
+ UUID, CreationDate, Name, Text, Description, SitName, TouchName, ObjectFlags, OwnerMask, NextOwnerMask, GroupMask,
+ EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX,
+ VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ,
+ RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW,
+ SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, RegionUUID, CreatorID, OwnerID, GroupID, LastOwnerID, SceneGroupID,
+ PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX,
+ OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ,
+ ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA,
+ ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL
+ ) VALUES (
+ @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask,
+ @EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX,
+ @VelocityY, @VelocityZ, @AngularVelocityX, @AngularVelocityY, @AngularVelocityZ, @AccelerationX, @AccelerationY, @AccelerationZ,
+ @RotationX, @RotationY, @RotationZ, @RotationW, @SitTargetOffsetX, @SitTargetOffsetY, @SitTargetOffsetZ, @SitTargetOrientW,
+ @SitTargetOrientX, @SitTargetOrientY, @SitTargetOrientZ, @RegionUUID, @CreatorID, @OwnerID, @GroupID, @LastOwnerID, @SceneGroupID,
+ @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX,
+ @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ,
+ @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA,
+ @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL
+ )
+ END";
+
+ //Set commandtext.
+ sqlCommand.CommandText = queryPrims;
+ //Add parameters
+ sqlCommand.Parameters.AddRange(CreatePrimParameters(sceneObjectPart, sceneGroupID, regionUUID));
+
+ //Execute the query. If it fails then error is trapped in calling function
+ sqlCommand.ExecuteNonQuery();
+ }
+
+ ///
+ /// Stores the scene object prim shapes.
+ ///
+ /// The sceneobjectpart containing prim shape.
+ /// The SQL command with the transaction.
+ /// The scenegroup UUID.
+ /// The region UUID.
+ private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
+ {
+ //Big query to or insert or update primshapes
+ //Note for SQL Server 2008 this can be simplified
+ string queryPrimShapes = @"
+IF EXISTS (SELECT UUID FROM primshapes WHERE UUID = @UUID)
+ BEGIN
+ UPDATE primshapes SET
+ Shape = @Shape, ScaleX = @ScaleX, ScaleY = @ScaleY, ScaleZ = @ScaleZ, PCode = @PCode, PathBegin = @PathBegin,
+ PathEnd = @PathEnd, PathScaleX = @PathScaleX, PathScaleY = @PathScaleY, PathShearX = @PathShearX, PathShearY = @PathShearY,
+ PathSkew = @PathSkew, PathCurve = @PathCurve, PathRadiusOffset = @PathRadiusOffset, PathRevolutions = @PathRevolutions,
+ PathTaperX = @PathTaperX, PathTaperY = @PathTaperY, PathTwist = @PathTwist, PathTwistBegin = @PathTwistBegin,
+ ProfileBegin = @ProfileBegin, ProfileEnd = @ProfileEnd, ProfileCurve = @ProfileCurve, ProfileHollow = @ProfileHollow,
+ Texture = @Texture, ExtraParams = @ExtraParams, State = @State, Media = @Media
+ WHERE UUID = @UUID
+ END
+ELSE
+ BEGIN
+ INSERT INTO
+ primshapes (
+ UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY,
+ PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin,
+ ProfileEnd, ProfileCurve, ProfileHollow, Texture, ExtraParams, State, Media
+ ) VALUES (
+ @UUID, @Shape, @ScaleX, @ScaleY, @ScaleZ, @PCode, @PathBegin, @PathEnd, @PathScaleX, @PathScaleY, @PathShearX, @PathShearY,
+ @PathSkew, @PathCurve, @PathRadiusOffset, @PathRevolutions, @PathTaperX, @PathTaperY, @PathTwist, @PathTwistBegin, @ProfileBegin,
+ @ProfileEnd, @ProfileCurve, @ProfileHollow, @Texture, @ExtraParams, @State, @Media
+ )
+ END";
+
+ //Set commandtext.
+ sqlCommand.CommandText = queryPrimShapes;
+
+ //Add parameters
+ sqlCommand.Parameters.AddRange(CreatePrimShapeParameters(sceneObjectPart, sceneGroupID, regionUUID));
+
+ //Execute the query. If it fails then error is trapped in calling function
+ sqlCommand.ExecuteNonQuery();
+
+ }
+
+ ///
+ /// Removes a object from the database.
+ /// Meaning removing it from tables Prims, PrimShapes and PrimItems
+ ///
+ /// id of scenegroup
+ /// regionUUID (is this used anyway
+ public void RemoveObject(UUID objectID, UUID regionUUID)
+ {
+ _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID);
+
+ //Remove from prims and primsitem table
+ string sqlPrims = "DELETE FROM PRIMS WHERE SceneGroupID = @objectID";
+ string sqlPrimItems = "DELETE FROM PRIMITEMS WHERE primID in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)";
+ string sqlPrimShapes = "DELETE FROM PRIMSHAPES WHERE uuid in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)";
+
+ lock (_Database)
+ {
+ //Using the non transaction mode.
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand())
+ {
+ cmd.Connection = conn;
+ cmd.CommandText = sqlPrimShapes;
+ conn.Open();
+ cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID));
+ cmd.ExecuteNonQuery();
+
+ cmd.CommandText = sqlPrimItems;
+ cmd.ExecuteNonQuery();
+
+ cmd.CommandText = sqlPrims;
+ cmd.ExecuteNonQuery();
+ }
+ }
+ }
+
+ ///
+ /// Store the inventory of a prim. Warning deletes everything first and then adds all again.
+ ///
+ ///
+ ///
+ public void StorePrimInventory(UUID primID, ICollection items)
+ {
+ //_Log.InfoFormat("[REGION DB: Persisting Prim Inventory with prim ID {0}", primID);
+
+ //Statement from MySQL section!
+ // For now, we're just going to crudely remove all the previous inventory items
+ // no matter whether they have changed or not, and replace them with the current set.
+
+ //Delete everything from PrimID
+ //TODO add index on PrimID in DB, if not already exist
+
+ string sql = "DELETE PRIMITEMS WHERE primID = @primID";
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.Add(_Database.CreateParameter("@primID", primID));
+ conn.Open();
+ cmd.ExecuteNonQuery();
+ }
+
+ sql =
+ @"INSERT INTO primitems (
+ itemID,primID,assetID,parentFolderID,invType,assetType,name,description,creationDate,creatorID,ownerID,lastOwnerID,groupID,
+ nextPermissions,currentPermissions,basePermissions,everyonePermissions,groupPermissions,flags)
+ VALUES (@itemID,@primID,@assetID,@parentFolderID,@invType,@assetType,@name,@description,@creationDate,@creatorID,@ownerID,
+ @lastOwnerID,@groupID,@nextPermissions,@currentPermissions,@basePermissions,@everyonePermissions,@groupPermissions,@flags)";
+
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ foreach (TaskInventoryItem taskItem in items)
+ {
+ cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem));
+ conn.Open();
+ cmd.ExecuteNonQuery();
+
+ cmd.Parameters.Clear();
+ }
+ }
+ }
+
+ #endregion
+
+ ///
+ /// Loads the terrain map.
+ ///
+ /// regionID.
+ ///
+ public double[,] LoadTerrain(UUID regionID)
+ {
+ double[,] terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
+ terrain.Initialize();
+
+ string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc";
+
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ // MySqlParameter param = new MySqlParameter();
+ cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID));
+ conn.Open();
+ using (SqlDataReader reader = cmd.ExecuteReader())
+ {
+ int rev;
+ if (reader.Read())
+ {
+ MemoryStream str = new MemoryStream((byte[])reader["Heightfield"]);
+ BinaryReader br = new BinaryReader(str);
+ for (int x = 0; x < (int)Constants.RegionSize; x++)
+ {
+ for (int y = 0; y < (int)Constants.RegionSize; y++)
+ {
+ terrain[x, y] = br.ReadDouble();
+ }
+ }
+ rev = (int)reader["Revision"];
+ }
+ else
+ {
+ _Log.Info("[REGION DB]: No terrain found for region");
+ return null;
+ }
+ _Log.Info("[REGION DB]: Loaded terrain revision r" + rev);
+ }
+ }
+
+ return terrain;
+ }
+
+ ///
+ /// Stores the terrain map to DB.
+ ///
+ /// terrain map data.
+ /// regionID.
+ public void StoreTerrain(double[,] terrain, UUID regionID)
+ {
+ int revision = Util.UnixTimeSinceEpoch();
+
+ //Delete old terrain map
+ string sql = "delete from terrain where RegionUUID=@RegionUUID";
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID));
+ conn.Open();
+ cmd.ExecuteNonQuery();
+ }
+
+ sql = "insert into terrain(RegionUUID, Revision, Heightfield) values(@RegionUUID, @Revision, @Heightfield)";
+
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID));
+ cmd.Parameters.Add(_Database.CreateParameter("@Revision", revision));
+ cmd.Parameters.Add(_Database.CreateParameter("@Heightfield", serializeTerrain(terrain)));
+ conn.Open();
+ cmd.ExecuteNonQuery();
+ }
+
+ _Log.Info("[REGION DB]: Stored terrain revision r " + revision);
+ }
+
+ ///
+ /// Loads all the land objects of a region.
+ ///
+ /// The region UUID.
+ ///
+ public List LoadLandObjects(UUID regionUUID)
+ {
+ List LandDataForRegion = new List();
+
+ string sql = "select * from land where RegionUUID = @RegionUUID";
+
+ //Retrieve all land data from region
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionUUID));
+ conn.Open();
+ using (SqlDataReader readerLandData = cmd.ExecuteReader())
+ {
+ while (readerLandData.Read())
+ {
+ LandDataForRegion.Add(BuildLandData(readerLandData));
+ }
+ }
+ }
+
+ //Retrieve all accesslist data for all landdata
+ foreach (LandData LandData in LandDataForRegion)
+ {
+ sql = "select * from landaccesslist where LandUUID = @LandUUID";
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.Add(_Database.CreateParameter("@LandUUID", LandData.GlobalID));
+ conn.Open();
+ using (SqlDataReader readerAccessList = cmd.ExecuteReader())
+ {
+ while (readerAccessList.Read())
+ {
+ LandData.ParcelAccessList.Add(BuildLandAccessData(readerAccessList));
+ }
+ }
+ }
+ }
+
+ //Return data
+ return LandDataForRegion;
+ }
+
+ ///
+ /// Stores land object with landaccess list.
+ ///
+ /// parcel data.
+ public void StoreLandObject(ILandObject parcel)
+ {
+ //As this is only one record in land table I just delete all and then add a new record.
+ //As the delete landaccess is already in the mysql code
+
+ //Delete old values
+ RemoveLandObject(parcel.LandData.GlobalID);
+
+ //Insert new values
+ string sql = @"INSERT INTO [land]
+([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime])
+VALUES
+(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)";
+
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.AddRange(CreateLandParameters(parcel.LandData, parcel.RegionUUID));
+ conn.Open();
+ cmd.ExecuteNonQuery();
+ }
+
+ sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)";
+
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ conn.Open();
+ foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList)
+ {
+ cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID));
+
+ cmd.ExecuteNonQuery();
+ cmd.Parameters.Clear();
+ }
+ }
+ }
+
+ ///
+ /// Removes a land object from DB.
+ ///
+ /// UUID of landobject
+ public void RemoveLandObject(UUID globalID)
+ {
+ string sql = "delete from land where UUID=@UUID";
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID));
+ conn.Open();
+ cmd.ExecuteNonQuery();
+ }
+ sql = "delete from landaccesslist where LandUUID=@UUID";
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID));
+ conn.Open();
+ cmd.ExecuteNonQuery();
+ }
+ }
+ public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
+ {
+ //This connector doesn't support the windlight module yet
+ //Return default LL windlight settings
+ return new RegionLightShareData();
+ }
+ public void StoreRegionWindlightSettings(RegionLightShareData wl)
+ {
+ //This connector doesn't support the windlight module yet
+ }
+ ///
+ /// Loads the settings of a region.
+ ///
+ /// The region UUID.
+ ///
+ public RegionSettings LoadRegionSettings(UUID regionUUID)
+ {
+ string sql = "select * from regionsettings where regionUUID = @regionUUID";
+ RegionSettings regionSettings;
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID));
+ conn.Open();
+ using (SqlDataReader reader = cmd.ExecuteReader())
+ {
+ if (reader.Read())
+ {
+ regionSettings = BuildRegionSettings(reader);
+ regionSettings.OnSave += StoreRegionSettings;
+
+ return regionSettings;
+ }
+ }
+ }
+
+ //If we reach this point then there are new region settings for that region
+ regionSettings = new RegionSettings();
+ regionSettings.RegionUUID = regionUUID;
+ regionSettings.OnSave += StoreRegionSettings;
+
+ //Store new values
+ StoreNewRegionSettings(regionSettings);
+
+ return regionSettings;
+ }
+
+ ///
+ /// Store region settings, need to check if the check is really necesary. If we can make something for creating new region.
+ ///
+ /// region settings.
+ public void StoreRegionSettings(RegionSettings regionSettings)
+ {
+ //Little check if regionUUID already exist in DB
+ string regionUUID;
+ string sql = "SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID";
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID));
+ conn.Open();
+ regionUUID = cmd.ExecuteScalar().ToString();
+ }
+
+ if (string.IsNullOrEmpty(regionUUID))
+ {
+ StoreNewRegionSettings(regionSettings);
+ }
+ else
+ {
+ //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB
+ sql =
+ @"UPDATE [regionsettings] SET [block_terraform] = @block_terraform ,[block_fly] = @block_fly ,[allow_damage] = @allow_damage
+,[restrict_pushing] = @restrict_pushing ,[allow_land_resell] = @allow_land_resell ,[allow_land_join_divide] = @allow_land_join_divide
+,[block_show_in_search] = @block_show_in_search ,[agent_limit] = @agent_limit ,[object_bonus] = @object_bonus ,[maturity] = @maturity
+,[disable_scripts] = @disable_scripts ,[disable_collisions] = @disable_collisions ,[disable_physics] = @disable_physics
+,[terrain_texture_1] = @terrain_texture_1 ,[terrain_texture_2] = @terrain_texture_2 ,[terrain_texture_3] = @terrain_texture_3
+,[terrain_texture_4] = @terrain_texture_4 ,[elevation_1_nw] = @elevation_1_nw ,[elevation_2_nw] = @elevation_2_nw
+,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se
+,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit
+,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position
+,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id
+ WHERE [regionUUID] = @regionUUID";
+
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings));
+ conn.Open();
+ cmd.ExecuteNonQuery();
+ }
+ }
+ }
+
+ public void Shutdown()
+ {
+ //Not used??
+ }
+
+ #region Private Methods
+
+ ///
+ /// Serializes the terrain data for storage in DB.
+ ///
+ /// terrain data
+ ///
+ private static Array serializeTerrain(double[,] val)
+ {
+ MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) * sizeof(double));
+ BinaryWriter bw = new BinaryWriter(str);
+
+ // TODO: COMPATIBILITY - Add byte-order conversions
+ for (int x = 0; x < (int)Constants.RegionSize; x++)
+ for (int y = 0; y < (int)Constants.RegionSize; y++)
+ {
+ double height = val[x, y];
+ if (height == 0.0)
+ height = double.Epsilon;
+
+ bw.Write(height);
+ }
+
+ return str.ToArray();
+ }
+
+ ///
+ /// Stores new regionsettings.
+ ///
+ /// The region settings.
+ private void StoreNewRegionSettings(RegionSettings regionSettings)
+ {
+ string sql = @"INSERT INTO [regionsettings]
+ ([regionUUID],[block_terraform],[block_fly],[allow_damage],[restrict_pushing],[allow_land_resell],[allow_land_join_divide],
+ [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics],
+ [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne],
+ [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit],
+ [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id]
+ )
+ VALUES
+ (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide,
+ @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics,
+ @terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne,
+ @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit,
+ @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)";
+
+ using (SqlConnection conn = new SqlConnection(m_connectionString))
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings));
+ conn.Open();
+ cmd.ExecuteNonQuery();
+ }
+ }
+
+ #region Private DataRecord conversion methods
+
+ ///
+ /// Builds the region settings from a datarecod.
+ ///
+ /// datarecord with regionsettings.
+ ///
+ private static RegionSettings BuildRegionSettings(IDataRecord row)
+ {
+ //TODO change this is some more generic code so we doesnt have to change it every time a new field is added?
+ RegionSettings newSettings = new RegionSettings();
+
+ newSettings.RegionUUID = new UUID((Guid)row["regionUUID"]);
+ newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
+ newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
+ newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
+ newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
+ newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
+ newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
+ newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
+ newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
+ newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
+ newSettings.Maturity = Convert.ToInt32(row["maturity"]);
+ newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
+ newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
+ newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
+ newSettings.TerrainTexture1 = new UUID((Guid)row["terrain_texture_1"]);
+ newSettings.TerrainTexture2 = new UUID((Guid)row["terrain_texture_2"]);
+ newSettings.TerrainTexture3 = new UUID((Guid)row["terrain_texture_3"]);
+ newSettings.TerrainTexture4 = new UUID((Guid)row["terrain_texture_4"]);
+ newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
+ newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
+ newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
+ newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
+ newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
+ newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
+ newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
+ newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
+ newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
+ newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
+ newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
+ newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
+ newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
+ newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
+ newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
+ newSettings.SunVector = new Vector3(
+ Convert.ToSingle(row["sunvectorx"]),
+ Convert.ToSingle(row["sunvectory"]),
+ Convert.ToSingle(row["sunvectorz"])
+ );
+ newSettings.Covenant = new UUID((Guid)row["covenant"]);
+
+ newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
+
+ if (row["loaded_creation_id"] is DBNull)
+ newSettings.LoadedCreationID = "";
+ else
+ newSettings.LoadedCreationID = (String)row["loaded_creation_id"];
+ return newSettings;
+ }
+
+ ///
+ /// Builds the land data from a datarecord.
+ ///
+ /// datarecord with land data
+ ///
+ private static LandData BuildLandData(IDataRecord row)
+ {
+ LandData newData = new LandData();
+
+ newData.GlobalID = new UUID((Guid)row["UUID"]);
+ newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
+
+ // Bitmap is a byte[512]
+ newData.Bitmap = (Byte[])row["Bitmap"];
+
+ newData.Name = (string)row["Name"];
+ newData.Description = (string)row["Description"];
+ newData.OwnerID = new UUID((Guid)row["OwnerUUID"]);
+ newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
+ newData.Area = Convert.ToInt32(row["Area"]);
+ newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
+ newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]);
+ //Enum libsecondlife.Parcel.ParcelCategory
+ newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
+ newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
+ newData.GroupID = new UUID((Guid)row["GroupUUID"]);
+ newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
+ newData.Status = (ParcelStatus)Convert.ToInt32(row["LandStatus"]);
+ //Enum. libsecondlife.Parcel.ParcelStatus
+ newData.Flags = Convert.ToUInt32(row["LandFlags"]);
+ newData.LandingType = Convert.ToByte(row["LandingType"]);
+ newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
+ newData.MediaID = new UUID((Guid)row["MediaTextureUUID"]);
+ newData.MediaURL = (string)row["MediaURL"];
+ newData.MusicURL = (string)row["MusicURL"];
+ newData.PassHours = Convert.ToSingle(row["PassHours"]);
+ newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
+
+ // UUID authedbuyer;
+ // UUID snapshotID;
+ //
+ // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer))
+ // newData.AuthBuyerID = authedbuyer;
+ //
+ // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID))
+ // newData.SnapshotID = snapshotID;
+ newData.AuthBuyerID = new UUID((Guid)row["AuthBuyerID"]);
+ newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
+
+ newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
+
+ try
+ {
+ newData.UserLocation =
+ new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
+ Convert.ToSingle(row["UserLocationZ"]));
+ newData.UserLookAt =
+ new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
+ Convert.ToSingle(row["UserLookAtZ"]));
+ }
+ catch (InvalidCastException)
+ {
+ newData.UserLocation = Vector3.Zero;
+ newData.UserLookAt = Vector3.Zero;
+ _Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
+ }
+
+ newData.ParcelAccessList = new List();
+
+ return newData;
+ }
+
+ ///
+ /// Builds the landaccess data from a data record.
+ ///
+ /// datarecord with landaccess data
+ ///
+ private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row)
+ {
+ ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
+ entry.AgentID = new UUID((Guid)row["AccessUUID"]);
+ entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
+ entry.Time = new DateTime();
+ return entry;
+ }
+
+ ///
+ /// Builds the prim from a datarecord.
+ ///
+ /// datarecord
+ ///
+ private static SceneObjectPart BuildPrim(IDataRecord primRow)
+ {
+ SceneObjectPart prim = new SceneObjectPart();
+
+ prim.UUID = new UUID((Guid)primRow["UUID"]);
+ // explicit conversion of integers is required, which sort
+ // of sucks. No idea if there is a shortcut here or not.
+ prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]);
+ prim.Name = (string)primRow["Name"];
+ // various text fields
+ prim.Text = (string)primRow["Text"];
+ prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]),
+ Convert.ToInt32(primRow["ColorR"]),
+ Convert.ToInt32(primRow["ColorG"]),
+ Convert.ToInt32(primRow["ColorB"]));
+ prim.Description = (string)primRow["Description"];
+ prim.SitName = (string)primRow["SitName"];
+ prim.TouchName = (string)primRow["TouchName"];
+ // permissions
+ prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
+ prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
+ prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
+ prim.GroupID = new UUID((Guid)primRow["GroupID"]);
+ prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
+ prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
+ prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
+ prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
+ prim.EveryoneMask = Convert.ToUInt32(primRow["EveryoneMask"]);
+ prim.BaseMask = Convert.ToUInt32(primRow["BaseMask"]);
+ // vectors
+ prim.OffsetPosition = new Vector3(
+ Convert.ToSingle(primRow["PositionX"]),
+ Convert.ToSingle(primRow["PositionY"]),
+ Convert.ToSingle(primRow["PositionZ"]));
+
+ prim.GroupPosition = new Vector3(
+ Convert.ToSingle(primRow["GroupPositionX"]),
+ Convert.ToSingle(primRow["GroupPositionY"]),
+ Convert.ToSingle(primRow["GroupPositionZ"]));
+
+ prim.Velocity = new Vector3(
+ Convert.ToSingle(primRow["VelocityX"]),
+ Convert.ToSingle(primRow["VelocityY"]),
+ Convert.ToSingle(primRow["VelocityZ"]));
+
+ prim.AngularVelocity = new Vector3(
+ Convert.ToSingle(primRow["AngularVelocityX"]),
+ Convert.ToSingle(primRow["AngularVelocityY"]),
+ Convert.ToSingle(primRow["AngularVelocityZ"]));
+
+ prim.Acceleration = new Vector3(
+ Convert.ToSingle(primRow["AccelerationX"]),
+ Convert.ToSingle(primRow["AccelerationY"]),
+ Convert.ToSingle(primRow["AccelerationZ"]));
+
+ // quaternions
+ prim.RotationOffset = new Quaternion(
+ Convert.ToSingle(primRow["RotationX"]),
+ Convert.ToSingle(primRow["RotationY"]),
+ Convert.ToSingle(primRow["RotationZ"]),
+ Convert.ToSingle(primRow["RotationW"]));
+
+ prim.SitTargetPositionLL = new Vector3(
+ Convert.ToSingle(primRow["SitTargetOffsetX"]),
+ Convert.ToSingle(primRow["SitTargetOffsetY"]),
+ Convert.ToSingle(primRow["SitTargetOffsetZ"]));
+
+ prim.SitTargetOrientationLL = new Quaternion(
+ Convert.ToSingle(primRow["SitTargetOrientX"]),
+ Convert.ToSingle(primRow["SitTargetOrientY"]),
+ Convert.ToSingle(primRow["SitTargetOrientZ"]),
+ Convert.ToSingle(primRow["SitTargetOrientW"]));
+
+ prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]);
+ prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]);
+ prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]);
+ prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]);
+ prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]);
+
+ prim.Sound = new UUID((Guid)primRow["LoopedSound"]);
+ prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]);
+ prim.SoundFlags = 1; // If it's persisted at all, it's looped
+
+ if (!(primRow["TextureAnimation"] is DBNull))
+ prim.TextureAnimation = (Byte[])primRow["TextureAnimation"];
+ if (!(primRow["ParticleSystem"] is DBNull))
+ prim.ParticleSystem = (Byte[])primRow["ParticleSystem"];
+
+ prim.AngularVelocity = new Vector3(
+ Convert.ToSingle(primRow["OmegaX"]),
+ Convert.ToSingle(primRow["OmegaY"]),
+ Convert.ToSingle(primRow["OmegaZ"]));
+
+ prim.SetCameraEyeOffset(new Vector3(
+ Convert.ToSingle(primRow["CameraEyeOffsetX"]),
+ Convert.ToSingle(primRow["CameraEyeOffsetY"]),
+ Convert.ToSingle(primRow["CameraEyeOffsetZ"])
+ ));
+
+ prim.SetCameraAtOffset(new Vector3(
+ Convert.ToSingle(primRow["CameraAtOffsetX"]),
+ Convert.ToSingle(primRow["CameraAtOffsetY"]),
+ Convert.ToSingle(primRow["CameraAtOffsetZ"])
+ ));
+
+ if (Convert.ToInt16(primRow["ForceMouselook"]) != 0)
+ prim.SetForceMouselook(true);
+
+ prim.ScriptAccessPin = Convert.ToInt32(primRow["ScriptAccessPin"]);
+
+ if (Convert.ToInt16(primRow["AllowedDrop"]) != 0)
+ prim.AllowedDrop = true;
+
+ if (Convert.ToInt16(primRow["DieAtEdge"]) != 0)
+ prim.DIE_AT_EDGE = true;
+
+ prim.SalePrice = Convert.ToInt32(primRow["SalePrice"]);
+ prim.ObjectSaleType = Convert.ToByte(primRow["SaleType"]);
+
+ prim.Material = Convert.ToByte(primRow["Material"]);
+
+ if (!(primRow["ClickAction"] is DBNull))
+ prim.ClickAction = Convert.ToByte(primRow["ClickAction"]);
+
+ prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]);
+ prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
+ if (Convert.ToInt16(primRow["PassTouches"]) != 0)
+ prim.PassTouches = true;
+ prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]);
+
+ if (!(primRow["MediaURL"] is System.DBNull))
+ prim.MediaUrl = (string)primRow["MediaURL"];
+
+ return prim;
+ }
+
+ ///
+ /// Builds the prim shape from a datarecord.
+ ///
+ /// The row.
+ ///
+ private static PrimitiveBaseShape BuildShape(IDataRecord shapeRow)
+ {
+ PrimitiveBaseShape baseShape = new PrimitiveBaseShape();
+
+ baseShape.Scale = new Vector3(
+ Convert.ToSingle(shapeRow["ScaleX"]),
+ Convert.ToSingle(shapeRow["ScaleY"]),
+ Convert.ToSingle(shapeRow["ScaleZ"]));
+
+ // paths
+ baseShape.PCode = Convert.ToByte(shapeRow["PCode"]);
+ baseShape.PathBegin = Convert.ToUInt16(shapeRow["PathBegin"]);
+ baseShape.PathEnd = Convert.ToUInt16(shapeRow["PathEnd"]);
+ baseShape.PathScaleX = Convert.ToByte(shapeRow["PathScaleX"]);
+ baseShape.PathScaleY = Convert.ToByte(shapeRow["PathScaleY"]);
+ baseShape.PathShearX = Convert.ToByte(shapeRow["PathShearX"]);
+ baseShape.PathShearY = Convert.ToByte(shapeRow["PathShearY"]);
+ baseShape.PathSkew = Convert.ToSByte(shapeRow["PathSkew"]);
+ baseShape.PathCurve = Convert.ToByte(shapeRow["PathCurve"]);
+ baseShape.PathRadiusOffset = Convert.ToSByte(shapeRow["PathRadiusOffset"]);
+ baseShape.PathRevolutions = Convert.ToByte(shapeRow["PathRevolutions"]);
+ baseShape.PathTaperX = Convert.ToSByte(shapeRow["PathTaperX"]);
+ baseShape.PathTaperY = Convert.ToSByte(shapeRow["PathTaperY"]);
+ baseShape.PathTwist = Convert.ToSByte(shapeRow["PathTwist"]);
+ baseShape.PathTwistBegin = Convert.ToSByte(shapeRow["PathTwistBegin"]);
+ // profile
+ baseShape.ProfileBegin = Convert.ToUInt16(shapeRow["ProfileBegin"]);
+ baseShape.ProfileEnd = Convert.ToUInt16(shapeRow["ProfileEnd"]);
+ baseShape.ProfileCurve = Convert.ToByte(shapeRow["ProfileCurve"]);
+ baseShape.ProfileHollow = Convert.ToUInt16(shapeRow["ProfileHollow"]);
+
+ byte[] textureEntry = (byte[])shapeRow["Texture"];
+ baseShape.TextureEntry = textureEntry;
+
+ baseShape.ExtraParams = (byte[])shapeRow["ExtraParams"];
+
+ try
+ {
+ baseShape.State = Convert.ToByte(shapeRow["State"]);
+ }
+ catch (InvalidCastException)
+ {
+ }
+
+ if (!(shapeRow["Media"] is System.DBNull))
+ baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
+
+ return baseShape;
+ }
+
+ ///
+ /// Build a prim inventory item from the persisted data.
+ ///
+ ///
+ ///
+ private static TaskInventoryItem BuildItem(IDataRecord inventoryRow)
+ {
+ TaskInventoryItem taskItem = new TaskInventoryItem();
+
+ taskItem.ItemID = new UUID((Guid)inventoryRow["itemID"]);
+ taskItem.ParentPartID = new UUID((Guid)inventoryRow["primID"]);
+ taskItem.AssetID = new UUID((Guid)inventoryRow["assetID"]);
+ taskItem.ParentID = new UUID((Guid)inventoryRow["parentFolderID"]);
+
+ taskItem.InvType = Convert.ToInt32(inventoryRow["invType"]);
+ taskItem.Type = Convert.ToInt32(inventoryRow["assetType"]);
+
+ taskItem.Name = (string)inventoryRow["name"];
+ taskItem.Description = (string)inventoryRow["description"];
+ taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]);
+ taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
+ taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]);
+ taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]);
+ taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]);
+
+ taskItem.NextPermissions = Convert.ToUInt32(inventoryRow["nextPermissions"]);
+ taskItem.CurrentPermissions = Convert.ToUInt32(inventoryRow["currentPermissions"]);
+ taskItem.BasePermissions = Convert.ToUInt32(inventoryRow["basePermissions"]);
+ taskItem.EveryonePermissions = Convert.ToUInt32(inventoryRow["everyonePermissions"]);
+ taskItem.GroupPermissions = Convert.ToUInt32(inventoryRow["groupPermissions"]);
+ taskItem.Flags = Convert.ToUInt32(inventoryRow["flags"]);
+
+ return taskItem;
+ }
+
+ #endregion
+
+ #region Create parameters methods
+
+ ///
+ /// Creates the prim inventory parameters.
+ ///
+ /// item in inventory.
+ ///
+ private SqlParameter[] CreatePrimInventoryParameters(TaskInventoryItem taskItem)
+ {
+ List parameters = new List();
+
+ parameters.Add(_Database.CreateParameter("itemID", taskItem.ItemID));
+ parameters.Add(_Database.CreateParameter("primID", taskItem.ParentPartID));
+ parameters.Add(_Database.CreateParameter("assetID", taskItem.AssetID));
+ parameters.Add(_Database.CreateParameter("parentFolderID", taskItem.ParentID));
+ parameters.Add(_Database.CreateParameter("invType", taskItem.InvType));
+ parameters.Add(_Database.CreateParameter("assetType", taskItem.Type));
+
+ parameters.Add(_Database.CreateParameter("name", taskItem.Name));
+ parameters.Add(_Database.CreateParameter("description", taskItem.Description));
+ parameters.Add(_Database.CreateParameter("creationDate", taskItem.CreationDate));
+ parameters.Add(_Database.CreateParameter("creatorID", taskItem.CreatorID));
+ parameters.Add(_Database.CreateParameter("ownerID", taskItem.OwnerID));
+ parameters.Add(_Database.CreateParameter("lastOwnerID", taskItem.LastOwnerID));
+ parameters.Add(_Database.CreateParameter("groupID", taskItem.GroupID));
+ parameters.Add(_Database.CreateParameter("nextPermissions", taskItem.NextPermissions));
+ parameters.Add(_Database.CreateParameter("currentPermissions", taskItem.CurrentPermissions));
+ parameters.Add(_Database.CreateParameter("basePermissions", taskItem.BasePermissions));
+ parameters.Add(_Database.CreateParameter("everyonePermissions", taskItem.EveryonePermissions));
+ parameters.Add(_Database.CreateParameter("groupPermissions", taskItem.GroupPermissions));
+ parameters.Add(_Database.CreateParameter("flags", taskItem.Flags));
+
+ return parameters.ToArray();
+ }
+
+ ///
+ /// Creates the region setting parameters.
+ ///
+ /// regionsettings.
+ ///
+ private SqlParameter[] CreateRegionSettingParameters(RegionSettings settings)
+ {
+ List parameters = new List();
+
+ parameters.Add(_Database.CreateParameter("regionUUID", settings.RegionUUID));
+ parameters.Add(_Database.CreateParameter("block_terraform", settings.BlockTerraform));
+ parameters.Add(_Database.CreateParameter("block_fly", settings.BlockFly));
+ parameters.Add(_Database.CreateParameter("allow_damage", settings.AllowDamage));
+ parameters.Add(_Database.CreateParameter("restrict_pushing", settings.RestrictPushing));
+ parameters.Add(_Database.CreateParameter("allow_land_resell", settings.AllowLandResell));
+ parameters.Add(_Database.CreateParameter("allow_land_join_divide", settings.AllowLandJoinDivide));
+ parameters.Add(_Database.CreateParameter("block_show_in_search", settings.BlockShowInSearch));
+ parameters.Add(_Database.CreateParameter("agent_limit", settings.AgentLimit));
+ parameters.Add(_Database.CreateParameter("object_bonus", settings.ObjectBonus));
+ parameters.Add(_Database.CreateParameter("maturity", settings.Maturity));
+ parameters.Add(_Database.CreateParameter("disable_scripts", settings.DisableScripts));
+ parameters.Add(_Database.CreateParameter("disable_collisions", settings.DisableCollisions));
+ parameters.Add(_Database.CreateParameter("disable_physics", settings.DisablePhysics));
+ parameters.Add(_Database.CreateParameter("terrain_texture_1", settings.TerrainTexture1));
+ parameters.Add(_Database.CreateParameter("terrain_texture_2", settings.TerrainTexture2));
+ parameters.Add(_Database.CreateParameter("terrain_texture_3", settings.TerrainTexture3));
+ parameters.Add(_Database.CreateParameter("terrain_texture_4", settings.TerrainTexture4));
+ parameters.Add(_Database.CreateParameter("elevation_1_nw", settings.Elevation1NW));
+ parameters.Add(_Database.CreateParameter("elevation_2_nw", settings.Elevation2NW));
+ parameters.Add(_Database.CreateParameter("elevation_1_ne", settings.Elevation1NE));
+ parameters.Add(_Database.CreateParameter("elevation_2_ne", settings.Elevation2NE));
+ parameters.Add(_Database.CreateParameter("elevation_1_se", settings.Elevation1SE));
+ parameters.Add(_Database.CreateParameter("elevation_2_se", settings.Elevation2SE));
+ parameters.Add(_Database.CreateParameter("elevation_1_sw", settings.Elevation1SW));
+ parameters.Add(_Database.CreateParameter("elevation_2_sw", settings.Elevation2SW));
+ parameters.Add(_Database.CreateParameter("water_height", settings.WaterHeight));
+ parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit));
+ parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit));
+ parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun));
+ parameters.Add(_Database.CreateParameter("sandbox", settings.Sandbox));
+ parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun));
+ parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition));
+ parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X));
+ parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y));
+ parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z));
+ parameters.Add(_Database.CreateParameter("covenant", settings.Covenant));
+ parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
+ parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));
+
+ return parameters.ToArray();
+ }
+
+ ///
+ /// Creates the land parameters.
+ ///
+ /// land parameters.
+ /// region UUID.
+ ///
+ private SqlParameter[] CreateLandParameters(LandData land, UUID regionUUID)
+ {
+ List parameters = new List();
+
+ parameters.Add(_Database.CreateParameter("UUID", land.GlobalID));
+ parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID));
+ parameters.Add(_Database.CreateParameter("LocalLandID", land.LocalID));
+
+ // Bitmap is a byte[512]
+ parameters.Add(_Database.CreateParameter("Bitmap", land.Bitmap));
+
+ parameters.Add(_Database.CreateParameter("Name", land.Name));
+ parameters.Add(_Database.CreateParameter("Description", land.Description));
+ parameters.Add(_Database.CreateParameter("OwnerUUID", land.OwnerID));
+ parameters.Add(_Database.CreateParameter("IsGroupOwned", land.IsGroupOwned));
+ parameters.Add(_Database.CreateParameter("Area", land.Area));
+ parameters.Add(_Database.CreateParameter("AuctionID", land.AuctionID)); //Unemplemented
+ parameters.Add(_Database.CreateParameter("Category", (int)land.Category)); //Enum libsecondlife.Parcel.ParcelCategory
+ parameters.Add(_Database.CreateParameter("ClaimDate", land.ClaimDate));
+ parameters.Add(_Database.CreateParameter("ClaimPrice", land.ClaimPrice));
+ parameters.Add(_Database.CreateParameter("GroupUUID", land.GroupID));
+ parameters.Add(_Database.CreateParameter("SalePrice", land.SalePrice));
+ parameters.Add(_Database.CreateParameter("LandStatus", (int)land.Status)); //Enum. libsecondlife.Parcel.ParcelStatus
+ parameters.Add(_Database.CreateParameter("LandFlags", land.Flags));
+ parameters.Add(_Database.CreateParameter("LandingType", land.LandingType));
+ parameters.Add(_Database.CreateParameter("MediaAutoScale", land.MediaAutoScale));
+ parameters.Add(_Database.CreateParameter("MediaTextureUUID", land.MediaID));
+ parameters.Add(_Database.CreateParameter("MediaURL", land.MediaURL));
+ parameters.Add(_Database.CreateParameter("MusicURL", land.MusicURL));
+ parameters.Add(_Database.CreateParameter("PassHours", land.PassHours));
+ parameters.Add(_Database.CreateParameter("PassPrice", land.PassPrice));
+ parameters.Add(_Database.CreateParameter("SnapshotUUID", land.SnapshotID));
+ parameters.Add(_Database.CreateParameter("UserLocationX", land.UserLocation.X));
+ parameters.Add(_Database.CreateParameter("UserLocationY", land.UserLocation.Y));
+ parameters.Add(_Database.CreateParameter("UserLocationZ", land.UserLocation.Z));
+ parameters.Add(_Database.CreateParameter("UserLookAtX", land.UserLookAt.X));
+ parameters.Add(_Database.CreateParameter("UserLookAtY", land.UserLookAt.Y));
+ parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
+ parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
+ parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
+
+ return parameters.ToArray();
+ }
+
+ ///
+ /// Creates the land access parameters.
+ ///
+ /// parcel access entry.
+ /// parcel ID.
+ ///
+ private SqlParameter[] CreateLandAccessParameters(ParcelManager.ParcelAccessEntry parcelAccessEntry, UUID parcelID)
+ {
+ List parameters = new List();
+
+ parameters.Add(_Database.CreateParameter("LandUUID", parcelID));
+ parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID));
+ parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags));
+
+ return parameters.ToArray();
+ }
+
+ ///
+ /// Creates the prim parameters for storing in DB.
+ ///
+ /// Basic data of SceneObjectpart prim.
+ /// The scenegroup ID.
+ /// The region ID.
+ ///
+ private SqlParameter[] CreatePrimParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
+ {
+ List parameters = new List();
+
+ parameters.Add(_Database.CreateParameter("UUID", prim.UUID));
+ parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID));
+ parameters.Add(_Database.CreateParameter("CreationDate", prim.CreationDate));
+ parameters.Add(_Database.CreateParameter("Name", prim.Name));
+ parameters.Add(_Database.CreateParameter("SceneGroupID", sceneGroupID));
+ // the UUID of the root part for this SceneObjectGroup
+ // various text fields
+ parameters.Add(_Database.CreateParameter("Text", prim.Text));
+ parameters.Add(_Database.CreateParameter("ColorR", prim.Color.R));
+ parameters.Add(_Database.CreateParameter("ColorG", prim.Color.G));
+ parameters.Add(_Database.CreateParameter("ColorB", prim.Color.B));
+ parameters.Add(_Database.CreateParameter("ColorA", prim.Color.A));
+ parameters.Add(_Database.CreateParameter("Description", prim.Description));
+ parameters.Add(_Database.CreateParameter("SitName", prim.SitName));
+ parameters.Add(_Database.CreateParameter("TouchName", prim.TouchName));
+ // permissions
+ parameters.Add(_Database.CreateParameter("ObjectFlags", (uint)prim.Flags));
+ parameters.Add(_Database.CreateParameter("CreatorID", prim.CreatorID));
+ parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
+ parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
+ parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
+ parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
+ parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
+ parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
+ parameters.Add(_Database.CreateParameter("EveryoneMask", prim.EveryoneMask));
+ parameters.Add(_Database.CreateParameter("BaseMask", prim.BaseMask));
+ // vectors
+ parameters.Add(_Database.CreateParameter("PositionX", prim.OffsetPosition.X));
+ parameters.Add(_Database.CreateParameter("PositionY", prim.OffsetPosition.Y));
+ parameters.Add(_Database.CreateParameter("PositionZ", prim.OffsetPosition.Z));
+ parameters.Add(_Database.CreateParameter("GroupPositionX", prim.GroupPosition.X));
+ parameters.Add(_Database.CreateParameter("GroupPositionY", prim.GroupPosition.Y));
+ parameters.Add(_Database.CreateParameter("GroupPositionZ", prim.GroupPosition.Z));
+ parameters.Add(_Database.CreateParameter("VelocityX", prim.Velocity.X));
+ parameters.Add(_Database.CreateParameter("VelocityY", prim.Velocity.Y));
+ parameters.Add(_Database.CreateParameter("VelocityZ", prim.Velocity.Z));
+ parameters.Add(_Database.CreateParameter("AngularVelocityX", prim.AngularVelocity.X));
+ parameters.Add(_Database.CreateParameter("AngularVelocityY", prim.AngularVelocity.Y));
+ parameters.Add(_Database.CreateParameter("AngularVelocityZ", prim.AngularVelocity.Z));
+ parameters.Add(_Database.CreateParameter("AccelerationX", prim.Acceleration.X));
+ parameters.Add(_Database.CreateParameter("AccelerationY", prim.Acceleration.Y));
+ parameters.Add(_Database.CreateParameter("AccelerationZ", prim.Acceleration.Z));
+ // quaternions
+ parameters.Add(_Database.CreateParameter("RotationX", prim.RotationOffset.X));
+ parameters.Add(_Database.CreateParameter("RotationY", prim.RotationOffset.Y));
+ parameters.Add(_Database.CreateParameter("RotationZ", prim.RotationOffset.Z));
+ parameters.Add(_Database.CreateParameter("RotationW", prim.RotationOffset.W));
+
+ // Sit target
+ Vector3 sitTargetPos = prim.SitTargetPositionLL;
+ parameters.Add(_Database.CreateParameter("SitTargetOffsetX", sitTargetPos.X));
+ parameters.Add(_Database.CreateParameter("SitTargetOffsetY", sitTargetPos.Y));
+ parameters.Add(_Database.CreateParameter("SitTargetOffsetZ", sitTargetPos.Z));
+
+ Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
+ parameters.Add(_Database.CreateParameter("SitTargetOrientW", sitTargetOrient.W));
+ parameters.Add(_Database.CreateParameter("SitTargetOrientX", sitTargetOrient.X));
+ parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y));
+ parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z));
+
+ parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0]));
+ parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1]));
+ parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2]));
+ parameters.Add(_Database.CreateParameter("PayButton3", prim.PayPrice[3]));
+ parameters.Add(_Database.CreateParameter("PayButton4", prim.PayPrice[4]));
+
+ if ((prim.SoundFlags & 1) != 0) // Looped
+ {
+ parameters.Add(_Database.CreateParameter("LoopedSound", prim.Sound));
+ parameters.Add(_Database.CreateParameter("LoopedSoundGain", prim.SoundGain));
+ }
+ else
+ {
+ parameters.Add(_Database.CreateParameter("LoopedSound", UUID.Zero));
+ parameters.Add(_Database.CreateParameter("LoopedSoundGain", 0.0f));
+ }
+
+ parameters.Add(_Database.CreateParameter("TextureAnimation", prim.TextureAnimation));
+ parameters.Add(_Database.CreateParameter("ParticleSystem", prim.ParticleSystem));
+
+ parameters.Add(_Database.CreateParameter("OmegaX", prim.AngularVelocity.X));
+ parameters.Add(_Database.CreateParameter("OmegaY", prim.AngularVelocity.Y));
+ parameters.Add(_Database.CreateParameter("OmegaZ", prim.AngularVelocity.Z));
+
+ parameters.Add(_Database.CreateParameter("CameraEyeOffsetX", prim.GetCameraEyeOffset().X));
+ parameters.Add(_Database.CreateParameter("CameraEyeOffsetY", prim.GetCameraEyeOffset().Y));
+ parameters.Add(_Database.CreateParameter("CameraEyeOffsetZ", prim.GetCameraEyeOffset().Z));
+
+ parameters.Add(_Database.CreateParameter("CameraAtOffsetX", prim.GetCameraAtOffset().X));
+ parameters.Add(_Database.CreateParameter("CameraAtOffsetY", prim.GetCameraAtOffset().Y));
+ parameters.Add(_Database.CreateParameter("CameraAtOffsetZ", prim.GetCameraAtOffset().Z));
+
+ if (prim.GetForceMouselook())
+ parameters.Add(_Database.CreateParameter("ForceMouselook", 1));
+ else
+ parameters.Add(_Database.CreateParameter("ForceMouselook", 0));
+
+ parameters.Add(_Database.CreateParameter("ScriptAccessPin", prim.ScriptAccessPin));
+
+ if (prim.AllowedDrop)
+ parameters.Add(_Database.CreateParameter("AllowedDrop", 1));
+ else
+ parameters.Add(_Database.CreateParameter("AllowedDrop", 0));
+
+ if (prim.DIE_AT_EDGE)
+ parameters.Add(_Database.CreateParameter("DieAtEdge", 1));
+ else
+ parameters.Add(_Database.CreateParameter("DieAtEdge", 0));
+
+ parameters.Add(_Database.CreateParameter("SalePrice", prim.SalePrice));
+ parameters.Add(_Database.CreateParameter("SaleType", prim.ObjectSaleType));
+
+ byte clickAction = prim.ClickAction;
+ parameters.Add(_Database.CreateParameter("ClickAction", clickAction));
+
+ parameters.Add(_Database.CreateParameter("Material", prim.Material));
+
+ parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
+ parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
+ if (prim.PassTouches)
+ parameters.Add(_Database.CreateParameter("PassTouches", 1));
+ else
+ parameters.Add(_Database.CreateParameter("PassTouches", 0));
+ parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
+ parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
+
+ return parameters.ToArray();
+ }
+
+ ///
+ /// Creates the primshape parameters for stroing in DB.
+ ///
+ /// Basic data of SceneObjectpart prim.
+ /// The scene group ID.
+ /// The region UUID.
+ ///
+ private SqlParameter[] CreatePrimShapeParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
+ {
+ List parameters = new List();
+
+ PrimitiveBaseShape s = prim.Shape;
+ parameters.Add(_Database.CreateParameter("UUID", prim.UUID));
+ // shape is an enum
+ parameters.Add(_Database.CreateParameter("Shape", 0));
+ // vectors
+ parameters.Add(_Database.CreateParameter("ScaleX", s.Scale.X));
+ parameters.Add(_Database.CreateParameter("ScaleY", s.Scale.Y));
+ parameters.Add(_Database.CreateParameter("ScaleZ", s.Scale.Z));
+ // paths
+ parameters.Add(_Database.CreateParameter("PCode", s.PCode));
+ parameters.Add(_Database.CreateParameter("PathBegin", s.PathBegin));
+ parameters.Add(_Database.CreateParameter("PathEnd", s.PathEnd));
+ parameters.Add(_Database.CreateParameter("PathScaleX", s.PathScaleX));
+ parameters.Add(_Database.CreateParameter("PathScaleY", s.PathScaleY));
+ parameters.Add(_Database.CreateParameter("PathShearX", s.PathShearX));
+ parameters.Add(_Database.CreateParameter("PathShearY", s.PathShearY));
+ parameters.Add(_Database.CreateParameter("PathSkew", s.PathSkew));
+ parameters.Add(_Database.CreateParameter("PathCurve", s.PathCurve));
+ parameters.Add(_Database.CreateParameter("PathRadiusOffset", s.PathRadiusOffset));
+ parameters.Add(_Database.CreateParameter("PathRevolutions", s.PathRevolutions));
+ parameters.Add(_Database.CreateParameter("PathTaperX", s.PathTaperX));
+ parameters.Add(_Database.CreateParameter("PathTaperY", s.PathTaperY));
+ parameters.Add(_Database.CreateParameter("PathTwist", s.PathTwist));
+ parameters.Add(_Database.CreateParameter("PathTwistBegin", s.PathTwistBegin));
+ // profile
+ parameters.Add(_Database.CreateParameter("ProfileBegin", s.ProfileBegin));
+ parameters.Add(_Database.CreateParameter("ProfileEnd", s.ProfileEnd));
+ parameters.Add(_Database.CreateParameter("ProfileCurve", s.ProfileCurve));
+ parameters.Add(_Database.CreateParameter("ProfileHollow", s.ProfileHollow));
+ parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry));
+ parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams));
+ parameters.Add(_Database.CreateParameter("State", s.State));
+ parameters.Add(_Database.CreateParameter("Media", null == s.Media ? null : s.Media.ToXml()));
+
+ return parameters.ToArray();
+ }
+
+ #endregion
+
+ #endregion
+ }
+}
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
deleted file mode 100644
index a39e68d..0000000
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ /dev/null
@@ -1,1820 +0,0 @@
-/*
- * 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 OpenSimulator 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;
-using System.Collections.Generic;
-using System.Data;
-using System.Drawing;
-using System.IO;
-using System.Reflection;
-using System.Threading;
-using log4net;
-using MySql.Data.MySqlClient;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Data;
-
-namespace OpenSim.Data.MySQL
-{
- ///
- /// A MySQL Interface for the Region Server
- ///
- public class MySQLDataStore : IRegionDataStore
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private string m_connectionString;
- private object m_dbLock = new object();
-
- public void Initialise(string connectionString)
- {
- m_connectionString = connectionString;
-
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- // Apply new Migrations
- //
- Assembly assem = GetType().Assembly;
- Migration m = new Migration(dbcon, assem, "RegionStore");
- m.Update();
-
- // Clean dropped attachments
- //
- try
- {
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "delete from prims, primshapes using prims " +
- "left join primshapes on prims.uuid = primshapes.uuid " +
- "where PCode = 9 and State <> 0";
- ExecuteNonQuery(cmd);
- }
- }
- catch (MySqlException ex)
- {
- m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message);
- }
- }
- }
-
- private IDataReader ExecuteReader(MySqlCommand c)
- {
- IDataReader r = null;
-
- try
- {
- r = c.ExecuteReader();
- }
- catch (Exception e)
- {
- m_log.Error("[REGION DB]: MySQL error in ExecuteReader: " + e.Message);
- throw;
- }
-
- return r;
- }
-
- private void ExecuteNonQuery(MySqlCommand c)
- {
- try
- {
- c.ExecuteNonQuery();
- }
- catch (Exception e)
- {
- m_log.Error("[REGION DB]: MySQL error in ExecuteNonQuery: " + e.Message);
- throw;
- }
- }
-
- public void Dispose() {}
-
- public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
- {
- uint flags = obj.RootPart.GetEffectiveObjectFlags();
-
- // Eligibility check
- //
- if ((flags & (uint)PrimFlags.Temporary) != 0)
- return;
- if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
- return;
-
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
- MySqlCommand cmd = dbcon.CreateCommand();
-
- foreach (SceneObjectPart prim in obj.Children.Values)
- {
- cmd.Parameters.Clear();
-
- cmd.CommandText = "replace into prims (" +
- "UUID, CreationDate, " +
- "Name, Text, Description, " +
- "SitName, TouchName, ObjectFlags, " +
- "OwnerMask, NextOwnerMask, GroupMask, " +
- "EveryoneMask, BaseMask, PositionX, " +
- "PositionY, PositionZ, GroupPositionX, " +
- "GroupPositionY, GroupPositionZ, VelocityX, " +
- "VelocityY, VelocityZ, AngularVelocityX, " +
- "AngularVelocityY, AngularVelocityZ, " +
- "AccelerationX, AccelerationY, " +
- "AccelerationZ, RotationX, " +
- "RotationY, RotationZ, " +
- "RotationW, SitTargetOffsetX, " +
- "SitTargetOffsetY, SitTargetOffsetZ, " +
- "SitTargetOrientW, SitTargetOrientX, " +
- "SitTargetOrientY, SitTargetOrientZ, " +
- "RegionUUID, CreatorID, " +
- "OwnerID, GroupID, " +
- "LastOwnerID, SceneGroupID, " +
- "PayPrice, PayButton1, " +
- "PayButton2, PayButton3, " +
- "PayButton4, LoopedSound, " +
- "LoopedSoundGain, TextureAnimation, " +
- "OmegaX, OmegaY, OmegaZ, " +
- "CameraEyeOffsetX, CameraEyeOffsetY, " +
- "CameraEyeOffsetZ, CameraAtOffsetX, " +
- "CameraAtOffsetY, CameraAtOffsetZ, " +
- "ForceMouselook, ScriptAccessPin, " +
- "AllowedDrop, DieAtEdge, " +
- "SalePrice, SaleType, " +
- "ColorR, ColorG, ColorB, ColorA, " +
- "ParticleSystem, ClickAction, Material, " +
- "CollisionSound, CollisionSoundVolume, " +
- "PassTouches, " +
- "LinkNumber, MediaURL) values (" + "?UUID, " +
- "?CreationDate, ?Name, ?Text, " +
- "?Description, ?SitName, ?TouchName, " +
- "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
- "?GroupMask, ?EveryoneMask, ?BaseMask, " +
- "?PositionX, ?PositionY, ?PositionZ, " +
- "?GroupPositionX, ?GroupPositionY, " +
- "?GroupPositionZ, ?VelocityX, " +
- "?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
- "?AngularVelocityY, ?AngularVelocityZ, " +
- "?AccelerationX, ?AccelerationY, " +
- "?AccelerationZ, ?RotationX, " +
- "?RotationY, ?RotationZ, " +
- "?RotationW, ?SitTargetOffsetX, " +
- "?SitTargetOffsetY, ?SitTargetOffsetZ, " +
- "?SitTargetOrientW, ?SitTargetOrientX, " +
- "?SitTargetOrientY, ?SitTargetOrientZ, " +
- "?RegionUUID, ?CreatorID, ?OwnerID, " +
- "?GroupID, ?LastOwnerID, ?SceneGroupID, " +
- "?PayPrice, ?PayButton1, ?PayButton2, " +
- "?PayButton3, ?PayButton4, ?LoopedSound, " +
- "?LoopedSoundGain, ?TextureAnimation, " +
- "?OmegaX, ?OmegaY, ?OmegaZ, " +
- "?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
- "?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
- "?CameraAtOffsetY, ?CameraAtOffsetZ, " +
- "?ForceMouselook, ?ScriptAccessPin, " +
- "?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
- "?SaleType, ?ColorR, ?ColorG, " +
- "?ColorB, ?ColorA, ?ParticleSystem, " +
- "?ClickAction, ?Material, ?CollisionSound, " +
- "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
-
- FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
-
- ExecuteNonQuery(cmd);
-
- cmd.Parameters.Clear();
-
- cmd.CommandText = "replace into primshapes (" +
- "UUID, Shape, ScaleX, ScaleY, " +
- "ScaleZ, PCode, PathBegin, PathEnd, " +
- "PathScaleX, PathScaleY, PathShearX, " +
- "PathShearY, PathSkew, PathCurve, " +
- "PathRadiusOffset, PathRevolutions, " +
- "PathTaperX, PathTaperY, PathTwist, " +
- "PathTwistBegin, ProfileBegin, ProfileEnd, " +
- "ProfileCurve, ProfileHollow, Texture, " +
- "ExtraParams, State, Media) values (?UUID, " +
- "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
- "?PCode, ?PathBegin, ?PathEnd, " +
- "?PathScaleX, ?PathScaleY, " +
- "?PathShearX, ?PathShearY, " +
- "?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
- "?PathRevolutions, ?PathTaperX, " +
- "?PathTaperY, ?PathTwist, " +
- "?PathTwistBegin, ?ProfileBegin, " +
- "?ProfileEnd, ?ProfileCurve, " +
- "?ProfileHollow, ?Texture, ?ExtraParams, " +
- "?State, ?Media)";
-
- FillShapeCommand(cmd, prim);
-
- ExecuteNonQuery(cmd);
- }
-
- cmd.Dispose();
- }
- }
- }
-
- public void RemoveObject(UUID obj, UUID regionUUID)
- {
-// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
-
- List uuids = new List();
-
- // Formerly, this used to check the region UUID.
- // That makes no sense, as we remove the contents of a prim
- // unconditionally, but the prim dependent on the region ID.
- // So, we would destroy an object and cause hard to detect
- // issues if we delete the contents only. Deleting it all may
- // cause the loss of a prim, but is cleaner.
- // It's also faster because it uses the primary key.
- //
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "select UUID from prims where SceneGroupID= ?UUID";
- cmd.Parameters.AddWithValue("UUID", obj.ToString());
-
- using (IDataReader reader = ExecuteReader(cmd))
- {
- while (reader.Read())
- uuids.Add(DBGuid.FromDB(reader["UUID"].ToString()));
- }
-
- // delete the main prims
- cmd.CommandText = "delete from prims where SceneGroupID= ?UUID";
- ExecuteNonQuery(cmd);
- }
- }
- }
-
- // there is no way this should be < 1 unless there is
- // a very corrupt database, but in that case be extra
- // safe anyway.
- if (uuids.Count > 0)
- {
- RemoveShapes(uuids);
- RemoveItems(uuids);
- }
- }
-
- ///
- /// Remove all persisted items of the given prim.
- /// The caller must acquire the necessrary synchronization locks
- ///
- /// the Item UUID
- private void RemoveItems(UUID uuid)
- {
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "delete from primitems where PrimID = ?PrimID";
- cmd.Parameters.AddWithValue("PrimID", uuid.ToString());
-
- ExecuteNonQuery(cmd);
- }
- }
- }
- }
-
- ///
- /// Remove all persisted shapes for a list of prims
- /// The caller must acquire the necessrary synchronization locks
- ///
- /// the list of UUIDs
- private void RemoveShapes(List uuids)
- {
- lock (m_dbLock)
- {
- string sql = "delete from primshapes where ";
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- for (int i = 0; i < uuids.Count; i++)
- {
- if ((i + 1) == uuids.Count)
- {// end of the list
- sql += "(UUID = ?UUID" + i + ")";
- }
- else
- {
- sql += "(UUID = ?UUID" + i + ") or ";
- }
- }
- cmd.CommandText = sql;
-
- for (int i = 0; i < uuids.Count; i++)
- cmd.Parameters.AddWithValue("UUID" + i, uuids[i].ToString());
-
- ExecuteNonQuery(cmd);
- }
- }
- }
- }
-
- ///
- /// Remove all persisted items for a list of prims
- /// The caller must acquire the necessrary synchronization locks
- ///
- /// the list of UUIDs
- private void RemoveItems(List uuids)
- {
- lock (m_dbLock)
- {
- string sql = "delete from primitems where ";
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- for (int i = 0; i < uuids.Count; i++)
- {
- if ((i + 1) == uuids.Count)
- {
- // end of the list
- sql += "(PrimID = ?PrimID" + i + ")";
- }
- else
- {
- sql += "(PrimID = ?PrimID" + i + ") or ";
- }
- }
- cmd.CommandText = sql;
-
- for (int i = 0; i < uuids.Count; i++)
- cmd.Parameters.AddWithValue("PrimID" + i, uuids[i].ToString());
-
- ExecuteNonQuery(cmd);
- }
- }
- }
- }
-
- public List LoadObjects(UUID regionID)
- {
- const int ROWS_PER_QUERY = 5000;
-
- Dictionary prims = new Dictionary(ROWS_PER_QUERY);
- Dictionary objects = new Dictionary();
- int count = 0;
-
- #region Prim Loading
-
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText =
- "SELECT * FROM prims LEFT JOIN primshapes ON prims.UUID = primshapes.UUID WHERE RegionUUID = ?RegionUUID";
- cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
-
- using (IDataReader reader = ExecuteReader(cmd))
- {
- while (reader.Read())
- {
- SceneObjectPart prim = BuildPrim(reader);
- if (reader["Shape"] is DBNull)
- prim.Shape = PrimitiveBaseShape.Default;
- else
- prim.Shape = BuildShape(reader);
-
- UUID parentID = DBGuid.FromDB(reader["SceneGroupID"].ToString());
- if (parentID != prim.UUID)
- prim.ParentUUID = parentID;
-
- prims[prim.UUID] = prim;
-
- ++count;
- if (count % ROWS_PER_QUERY == 0)
- m_log.Debug("[REGION DB]: Loaded " + count + " prims...");
- }
- }
- }
- }
- }
-
- #endregion Prim Loading
-
- #region SceneObjectGroup Creation
-
- // Create all of the SOGs from the root prims first
- foreach (SceneObjectPart prim in prims.Values)
- {
- if (prim.ParentUUID == UUID.Zero)
- objects[prim.UUID] = new SceneObjectGroup(prim);
- }
-
- // Add all of the children objects to the SOGs
- foreach (SceneObjectPart prim in prims.Values)
- {
- SceneObjectGroup sog;
- if (prim.UUID != prim.ParentUUID)
- {
- if (objects.TryGetValue(prim.ParentUUID, out sog))
- {
- int originalLinkNum = prim.LinkNum;
-
- sog.AddPart(prim);
-
- // SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum.
- // We override that here
- if (originalLinkNum != 0)
- prim.LinkNum = originalLinkNum;
- }
- else
- {
- m_log.WarnFormat(
- "[REGION DB]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.",
- prim.Name, prim.UUID, regionID, prim.ParentUUID);
- }
- }
- }
-
- #endregion SceneObjectGroup Creation
-
- m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count);
-
- #region Prim Inventory Loading
-
- // Instead of attempting to LoadItems on every prim,
- // most of which probably have no items... get a
- // list from DB of all prims which have items and
- // LoadItems only on those
- List primsWithInventory = new List();
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand itemCmd = dbcon.CreateCommand())
- {
- itemCmd.CommandText = "SELECT DISTINCT primID FROM primitems";
- using (IDataReader itemReader = ExecuteReader(itemCmd))
- {
- while (itemReader.Read())
- {
- if (!(itemReader["primID"] is DBNull))
- {
- UUID primID = DBGuid.FromDB(itemReader["primID"].ToString());
- if (prims.ContainsKey(primID))
- primsWithInventory.Add(prims[primID]);
- }
- }
- }
- }
- }
- }
-
- foreach (SceneObjectPart prim in primsWithInventory)
- {
- LoadItems(prim);
- }
-
- #endregion Prim Inventory Loading
-
- m_log.DebugFormat("[REGION DB]: Loaded inventory from {0} objects", primsWithInventory.Count);
-
- return new List(objects.Values);
- }
-
- ///
- /// Load in a prim's persisted inventory.
- ///
- /// The prim
- private void LoadItems(SceneObjectPart prim)
- {
- lock (m_dbLock)
- {
- List inventory = new List();
-
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "select * from primitems where PrimID = ?PrimID";
- cmd.Parameters.AddWithValue("PrimID", prim.UUID.ToString());
-
- using (IDataReader reader = ExecuteReader(cmd))
- {
- while (reader.Read())
- {
- TaskInventoryItem item = BuildItem(reader);
-
- item.ParentID = prim.UUID; // Values in database are often wrong
- inventory.Add(item);
- }
- }
- }
- }
-
- prim.Inventory.RestoreInventoryItems(inventory);
- }
- }
-
- public void StoreTerrain(double[,] ter, UUID regionID)
- {
- m_log.Info("[REGION DB]: Storing terrain");
-
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
- cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
-
- ExecuteNonQuery(cmd);
-
- cmd.CommandText = "insert into terrain (RegionUUID, " +
- "Revision, Heightfield) values (?RegionUUID, " +
- "1, ?Heightfield)";
-
- cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter));
-
- ExecuteNonQuery(cmd);
- }
- }
- }
- }
-
- public double[,] LoadTerrain(UUID regionID)
- {
- double[,] terrain = null;
-
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "select RegionUUID, Revision, Heightfield " +
- "from terrain where RegionUUID = ?RegionUUID " +
- "order by Revision desc limit 1";
- cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
-
- using (IDataReader reader = ExecuteReader(cmd))
- {
- while (reader.Read())
- {
- int rev = Convert.ToInt32(reader["Revision"]);
-
- terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
- terrain.Initialize();
-
- using (MemoryStream mstr = new MemoryStream((byte[])reader["Heightfield"]))
- {
- using (BinaryReader br = new BinaryReader(mstr))
- {
- for (int x = 0; x < (int)Constants.RegionSize; x++)
- {
- for (int y = 0; y < (int)Constants.RegionSize; y++)
- {
- terrain[x, y] = br.ReadDouble();
- }
- }
- }
-
- m_log.InfoFormat("[REGION DB]: Loaded terrain revision r{0}", rev);
- }
- }
- }
- }
- }
- }
-
- return terrain;
- }
-
- public void RemoveLandObject(UUID globalID)
- {
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "delete from land where UUID = ?UUID";
- cmd.Parameters.AddWithValue("UUID", globalID.ToString());
-
- ExecuteNonQuery(cmd);
- }
- }
- }
- }
-
- public void StoreLandObject(ILandObject parcel)
- {
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "replace into land (UUID, RegionUUID, " +
- "LocalLandID, Bitmap, Name, Description, " +
- "OwnerUUID, IsGroupOwned, Area, AuctionID, " +
- "Category, ClaimDate, ClaimPrice, GroupUUID, " +
- "SalePrice, LandStatus, LandFlags, LandingType, " +
- "MediaAutoScale, MediaTextureUUID, MediaURL, " +
- "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
- "UserLocationX, UserLocationY, UserLocationZ, " +
- "UserLookAtX, UserLookAtY, UserLookAtZ, " +
- "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
- "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
- "?UUID, ?RegionUUID, " +
- "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
- "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
- "?Category, ?ClaimDate, ?ClaimPrice, ?GroupUUID, " +
- "?SalePrice, ?LandStatus, ?LandFlags, ?LandingType, " +
- "?MediaAutoScale, ?MediaTextureUUID, ?MediaURL, " +
- "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
- "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
- "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
- "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
- "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
-
- FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
-
- ExecuteNonQuery(cmd);
-
- cmd.CommandText = "delete from landaccesslist where LandUUID = ?UUID";
-
- ExecuteNonQuery(cmd);
-
- cmd.Parameters.Clear();
- cmd.CommandText = "insert into landaccesslist (LandUUID, " +
- "AccessUUID, Flags) values (?LandUUID, ?AccessUUID, " +
- "?Flags)";
-
- foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList)
- {
- FillLandAccessCommand(cmd, entry, parcel.LandData.GlobalID);
- ExecuteNonQuery(cmd);
- cmd.Parameters.Clear();
- }
- }
- }
- }
- }
-
- public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
- {
- RegionLightShareData nWP = new RegionLightShareData();
- nWP.OnSave += StoreRegionWindlightSettings;
-
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- string command = "select * from `regionwindlight` where region_id = ?regionID";
-
- using(MySqlCommand cmd = new MySqlCommand(command))
- {
- cmd.Connection = dbcon;
-
- cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
-
- IDataReader result = ExecuteReader(cmd);
- if (!result.Read())
- {
- //No result, so store our default windlight profile and return it
- nWP.regionID = regionUUID;
- StoreRegionWindlightSettings(nWP);
- return nWP;
- }
- else
- {
- nWP.regionID = DBGuid.FromDB(result["region_id"]);
- nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
- nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
- nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
- nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
- nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
- nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
- nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
- nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
- nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
- nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
- nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
- nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
- nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
- nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
- nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
- nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
- nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
- UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
- nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
- nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
- nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
- nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
- nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
- nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
- nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
- nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
- nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
- nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
- nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
- nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
- nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
- nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
- nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
- nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
- nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
- nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
- nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
- nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
- nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
- nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
- nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
- nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
- nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
- nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
- nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
- nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
- nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
- nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
- nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
- nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
- nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
- nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
- nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
- nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
- nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
- nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
- nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
- nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
- nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
- nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
- nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
- nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
- }
- }
- }
- return nWP;
- }
-
- public RegionSettings LoadRegionSettings(UUID regionUUID)
- {
- RegionSettings rs = null;
-
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "select * from regionsettings where regionUUID = ?RegionUUID";
- cmd.Parameters.AddWithValue("regionUUID", regionUUID);
-
- using (IDataReader reader = ExecuteReader(cmd))
- {
- if (reader.Read())
- {
- rs = BuildRegionSettings(reader);
- rs.OnSave += StoreRegionSettings;
- }
- else
- {
- rs = new RegionSettings();
- rs.RegionUUID = regionUUID;
- rs.OnSave += StoreRegionSettings;
-
- StoreRegionSettings(rs);
- }
- }
- }
- }
- }
-
- return rs;
- }
-
- public void StoreRegionWindlightSettings(RegionLightShareData wl)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
- cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
- cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
- cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
- cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
- cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
- cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
- cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
- cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
- cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
- cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
- cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
- cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
- cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
- cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
- cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
- cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
- cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
- cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
- cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
- cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
- cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
- cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
- cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
- cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
-
- cmd.Parameters.AddWithValue("region_id", wl.regionID);
- cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
- cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
- cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
- cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
- cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
- cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
- cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
- cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
- cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
- cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
- cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
- cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
- cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
- cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
- cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
- cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
- cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
- cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
- cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
- cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
- cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
- cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
- cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
- cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
- cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
- cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
- cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
- cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
- cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
- cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
- cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
- cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
- cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
- cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
- cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
- cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
- cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
- cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
- cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
- cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
- cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
- cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
- cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
- cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
- cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
- cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
- cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
- cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
- cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
- cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
- cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
- cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
- cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
- cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
- cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
- cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
- cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
- cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
- cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
- cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
- cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
- cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
-
- ExecuteNonQuery(cmd);
- }
- }
- }
-
- public void StoreRegionSettings(RegionSettings rs)
- {
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "replace into regionsettings (regionUUID, " +
- "block_terraform, block_fly, allow_damage, " +
- "restrict_pushing, allow_land_resell, " +
- "allow_land_join_divide, block_show_in_search, " +
- "agent_limit, object_bonus, maturity, " +
- "disable_scripts, disable_collisions, " +
- "disable_physics, terrain_texture_1, " +
- "terrain_texture_2, terrain_texture_3, " +
- "terrain_texture_4, elevation_1_nw, " +
- "elevation_2_nw, elevation_1_ne, " +
- "elevation_2_ne, elevation_1_se, " +
- "elevation_2_se, elevation_1_sw, " +
- "elevation_2_sw, water_height, " +
- "terrain_raise_limit, terrain_lower_limit, " +
- "use_estate_sun, fixed_sun, sun_position, " +
- "covenant, Sandbox, sunvectorx, sunvectory, " +
- "sunvectorz, loaded_creation_datetime, " +
- "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " +
- "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
- "?AllowLandResell, ?AllowLandJoinDivide, " +
- "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
- "?Maturity, ?DisableScripts, ?DisableCollisions, " +
- "?DisablePhysics, ?TerrainTexture1, " +
- "?TerrainTexture2, ?TerrainTexture3, " +
- "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
- "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
- "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
- "?WaterHeight, ?TerrainRaiseLimit, " +
- "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
- "?SunPosition, ?Covenant, ?Sandbox, " +
- "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
- "?LoadedCreationDateTime, ?LoadedCreationID, " +
- "?TerrainImageID)";
-
- FillRegionSettingsCommand(cmd, rs);
-
- ExecuteNonQuery(cmd);
- }
- }
- }
- }
-
- public List LoadLandObjects(UUID regionUUID)
- {
- List landData = new List();
-
- lock (m_dbLock)
- {
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- cmd.CommandText = "select * from land where RegionUUID = ?RegionUUID";
- cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
-
- using (IDataReader reader = ExecuteReader(cmd))
- {
- while (reader.Read())
- {
- LandData newLand = BuildLandData(reader);
- landData.Add(newLand);
- }
- }
- }
-
- using (MySqlCommand cmd = dbcon.CreateCommand())
- {
- foreach (LandData land in landData)
- {
- cmd.Parameters.Clear();
- cmd.CommandText = "select * from landaccesslist where LandUUID = ?LandUUID";
- cmd.Parameters.AddWithValue("LandUUID", land.GlobalID.ToString());
-
- using (IDataReader reader = ExecuteReader(cmd))
- {
- while (reader.Read())
- {
- land.ParcelAccessList.Add(BuildLandAccessData(reader));
- }
- }
- }
- }
- }
- }
-
- return landData;
- }
-
- public void Shutdown()
- {
- }
-
- private SceneObjectPart BuildPrim(IDataReader row)
- {
- SceneObjectPart prim = new SceneObjectPart();
-
- // depending on the MySQL connector version, CHAR(36) may be already converted to Guid!
- prim.UUID = DBGuid.FromDB(row["UUID"]);
- prim.CreatorID = DBGuid.FromDB(row["CreatorID"]);
- prim.OwnerID = DBGuid.FromDB(row["OwnerID"]);
- prim.GroupID = DBGuid.FromDB(row["GroupID"]);
- prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]);
-
- // explicit conversion of integers is required, which sort
- // of sucks. No idea if there is a shortcut here or not.
- prim.CreationDate = (int)row["CreationDate"];
- if (row["Name"] != DBNull.Value)
- prim.Name = (string)row["Name"];
- else
- prim.Name = String.Empty;
- // Various text fields
- prim.Text = (string)row["Text"];
- prim.Color = Color.FromArgb((int)row["ColorA"],
- (int)row["ColorR"],
- (int)row["ColorG"],
- (int)row["ColorB"]);
- prim.Description = (string)row["Description"];
- prim.SitName = (string)row["SitName"];
- prim.TouchName = (string)row["TouchName"];
- // Permissions
- prim.Flags = (PrimFlags)(int)row["ObjectFlags"];
- prim.OwnerMask = (uint)(int)row["OwnerMask"];
- prim.NextOwnerMask = (uint)(int)row["NextOwnerMask"];
- prim.GroupMask = (uint)(int)row["GroupMask"];
- prim.EveryoneMask = (uint)(int)row["EveryoneMask"];
- prim.BaseMask = (uint)(int)row["BaseMask"];
-
- // Vectors
- prim.OffsetPosition = new Vector3(
- (float)(double)row["PositionX"],
- (float)(double)row["PositionY"],
- (float)(double)row["PositionZ"]
- );
- prim.GroupPosition = new Vector3(
- (float)(double)row["GroupPositionX"],
- (float)(double)row["GroupPositionY"],
- (float)(double)row["GroupPositionZ"]
- );
- prim.Velocity = new Vector3(
- (float)(double)row["VelocityX"],
- (float)(double)row["VelocityY"],
- (float)(double)row["VelocityZ"]
- );
- prim.AngularVelocity = new Vector3(
- (float)(double)row["AngularVelocityX"],
- (float)(double)row["AngularVelocityY"],
- (float)(double)row["AngularVelocityZ"]
- );
- prim.Acceleration = new Vector3(
- (float)(double)row["AccelerationX"],
- (float)(double)row["AccelerationY"],
- (float)(double)row["AccelerationZ"]
- );
- // quaternions
- prim.RotationOffset = new Quaternion(
- (float)(double)row["RotationX"],
- (float)(double)row["RotationY"],
- (float)(double)row["RotationZ"],
- (float)(double)row["RotationW"]
- );
- prim.SitTargetPositionLL = new Vector3(
- (float)(double)row["SitTargetOffsetX"],
- (float)(double)row["SitTargetOffsetY"],
- (float)(double)row["SitTargetOffsetZ"]
- );
- prim.SitTargetOrientationLL = new Quaternion(
- (float)(double)row["SitTargetOrientX"],
- (float)(double)row["SitTargetOrientY"],
- (float)(double)row["SitTargetOrientZ"],
- (float)(double)row["SitTargetOrientW"]
- );
-
- prim.PayPrice[0] = (int)row["PayPrice"];
- prim.PayPrice[1] = (int)row["PayButton1"];
- prim.PayPrice[2] = (int)row["PayButton2"];
- prim.PayPrice[3] = (int)row["PayButton3"];
- prim.PayPrice[4] = (int)row["PayButton4"];
-
- prim.Sound = DBGuid.FromDB(row["LoopedSound"].ToString());
- prim.SoundGain = (float)(double)row["LoopedSoundGain"];
- prim.SoundFlags = 1; // If it's persisted at all, it's looped
-
- if (!(row["TextureAnimation"] is DBNull))
- prim.TextureAnimation = (byte[])row["TextureAnimation"];
- if (!(row["ParticleSystem"] is DBNull))
- prim.ParticleSystem = (byte[])row["ParticleSystem"];
-
- prim.AngularVelocity = new Vector3(
- (float)(double)row["OmegaX"],
- (float)(double)row["OmegaY"],
- (float)(double)row["OmegaZ"]
- );
-
- prim.SetCameraEyeOffset(new Vector3(
- (float)(double)row["CameraEyeOffsetX"],
- (float)(double)row["CameraEyeOffsetY"],
- (float)(double)row["CameraEyeOffsetZ"]
- ));
-
- prim.SetCameraAtOffset(new Vector3(
- (float)(double)row["CameraAtOffsetX"],
- (float)(double)row["CameraAtOffsetY"],
- (float)(double)row["CameraAtOffsetZ"]
- ));
-
- prim.SetForceMouselook((sbyte)row["ForceMouselook"] != 0);
- prim.ScriptAccessPin = (int)row["ScriptAccessPin"];
- prim.AllowedDrop = ((sbyte)row["AllowedDrop"] != 0);
- prim.DIE_AT_EDGE = ((sbyte)row["DieAtEdge"] != 0);
-
- prim.SalePrice = (int)row["SalePrice"];
- prim.ObjectSaleType = unchecked((byte)(sbyte)row["SaleType"]);
-
- prim.Material = unchecked((byte)(sbyte)row["Material"]);
-
- if (!(row["ClickAction"] is DBNull))
- prim.ClickAction = unchecked((byte)(sbyte)row["ClickAction"]);
-
- prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]);
- prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
-
- prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
- prim.LinkNum = (int)row["LinkNumber"];
-
- if (!(row["MediaURL"] is System.DBNull))
- prim.MediaUrl = (string)row["MediaURL"];
-
- return prim;
- }
-
-
- ///
- /// Build a prim inventory item from the persisted data.
- ///
- ///
- ///
- private static TaskInventoryItem BuildItem(IDataReader row)
- {
- TaskInventoryItem taskItem = new TaskInventoryItem();
-
- taskItem.ItemID = DBGuid.FromDB(row["itemID"]);
- taskItem.ParentPartID = DBGuid.FromDB(row["primID"]);
- taskItem.AssetID = DBGuid.FromDB(row["assetID"]);
- taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]);
-
- taskItem.InvType = Convert.ToInt32(row["invType"]);
- taskItem.Type = Convert.ToInt32(row["assetType"]);
-
- taskItem.Name = (String)row["name"];
- taskItem.Description = (String)row["description"];
- taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
- taskItem.CreatorID = DBGuid.FromDB(row["creatorID"]);
- taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]);
- taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]);
- taskItem.GroupID = DBGuid.FromDB(row["groupID"]);
-
- taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
- taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
- taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
- taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
- taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
- taskItem.Flags = Convert.ToUInt32(row["flags"]);
-
- return taskItem;
- }
-
- private static RegionSettings BuildRegionSettings(IDataReader row)
- {
- RegionSettings newSettings = new RegionSettings();
-
- newSettings.RegionUUID = DBGuid.FromDB(row["regionUUID"]);
- newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
- newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
- newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
- newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
- newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
- newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
- newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
- newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
- newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
- newSettings.Maturity = Convert.ToInt32(row["maturity"]);
- newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
- newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
- newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
- newSettings.TerrainTexture1 = DBGuid.FromDB(row["terrain_texture_1"]);
- newSettings.TerrainTexture2 = DBGuid.FromDB(row["terrain_texture_2"]);
- newSettings.TerrainTexture3 = DBGuid.FromDB(row["terrain_texture_3"]);
- newSettings.TerrainTexture4 = DBGuid.FromDB(row["terrain_texture_4"]);
- newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
- newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
- newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
- newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
- newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
- newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
- newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
- newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
- newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
- newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
- newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
- newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
- newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
- newSettings.SunVector = new Vector3 (
- Convert.ToSingle(row["sunvectorx"]),
- Convert.ToSingle(row["sunvectory"]),
- Convert.ToSingle(row["sunvectorz"])
- );
- newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
- newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
- newSettings.Covenant = DBGuid.FromDB(row["covenant"]);
-
- newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
-
- if (row["loaded_creation_id"] is DBNull)
- newSettings.LoadedCreationID = "";
- else
- newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
-
- newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]);
-
- return newSettings;
- }
-
- ///
- ///
- ///
- ///
- ///
- private static LandData BuildLandData(IDataReader row)
- {
- LandData newData = new LandData();
-
- newData.GlobalID = DBGuid.FromDB(row["UUID"]);
- newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
-
- // Bitmap is a byte[512]
- newData.Bitmap = (Byte[]) row["Bitmap"];
-
- newData.Name = (String) row["Name"];
- newData.Description = (String) row["Description"];
- newData.OwnerID = DBGuid.FromDB(row["OwnerUUID"]);
- newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
- newData.Area = Convert.ToInt32(row["Area"]);
- newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unimplemented
- newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]);
- //Enum libsecondlife.Parcel.ParcelCategory
- newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
- newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
- newData.GroupID = DBGuid.FromDB(row["GroupUUID"]);
- newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
- newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]);
- //Enum. libsecondlife.Parcel.ParcelStatus
- newData.Flags = Convert.ToUInt32(row["LandFlags"]);
- newData.LandingType = Convert.ToByte(row["LandingType"]);
- newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
- newData.MediaID = DBGuid.FromDB(row["MediaTextureUUID"]);
- newData.MediaURL = (String) row["MediaURL"];
- newData.MusicURL = (String) row["MusicURL"];
- newData.PassHours = Convert.ToSingle(row["PassHours"]);
- newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
- UUID authedbuyer = UUID.Zero;
- UUID snapshotID = UUID.Zero;
-
- UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer);
- UUID.TryParse((string)row["SnapshotUUID"], out snapshotID);
- newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
-
- newData.AuthBuyerID = authedbuyer;
- newData.SnapshotID = snapshotID;
- try
- {
- newData.UserLocation =
- new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
- Convert.ToSingle(row["UserLocationZ"]));
- newData.UserLookAt =
- new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
- Convert.ToSingle(row["UserLookAtZ"]));
- }
- catch (InvalidCastException)
- {
- newData.UserLocation = Vector3.Zero;
- newData.UserLookAt = Vector3.Zero;
- m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
- }
-
- newData.MediaDescription = (string) row["MediaDescription"];
- newData.MediaType = (string) row["MediaType"];
- newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
- newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
- newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
- newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
- newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
-
- newData.ParcelAccessList = new List();
-
- return newData;
- }
-
- ///
- ///
- ///
- ///
- ///
- private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row)
- {
- ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
- entry.AgentID = DBGuid.FromDB(row["AccessUUID"]);
- entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]);
- entry.Time = new DateTime();
- return entry;
- }
-
- ///
- ///
- ///
- ///
- ///
- private static Array SerializeTerrain(double[,] val)
- {
- MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
- BinaryWriter bw = new BinaryWriter(str);
-
- // TODO: COMPATIBILITY - Add byte-order conversions
- for (int x = 0; x < (int)Constants.RegionSize; x++)
- for (int y = 0; y < (int)Constants.RegionSize; y++)
- {
- double height = val[x, y];
- if (height == 0.0)
- height = double.Epsilon;
-
- bw.Write(height);
- }
-
- return str.ToArray();
- }
-
- ///
- /// Fill the prim command with prim values
- ///
- ///
- ///
- ///
- ///
- private void FillPrimCommand(MySqlCommand cmd, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
- {
- cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString());
- cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
- cmd.Parameters.AddWithValue("CreationDate", prim.CreationDate);
- cmd.Parameters.AddWithValue("Name", prim.Name);
- cmd.Parameters.AddWithValue("SceneGroupID", sceneGroupID.ToString());
- // the UUID of the root part for this SceneObjectGroup
- // various text fields
- cmd.Parameters.AddWithValue("Text", prim.Text);
- cmd.Parameters.AddWithValue("ColorR", prim.Color.R);
- cmd.Parameters.AddWithValue("ColorG", prim.Color.G);
- cmd.Parameters.AddWithValue("ColorB", prim.Color.B);
- cmd.Parameters.AddWithValue("ColorA", prim.Color.A);
- cmd.Parameters.AddWithValue("Description", prim.Description);
- cmd.Parameters.AddWithValue("SitName", prim.SitName);
- cmd.Parameters.AddWithValue("TouchName", prim.TouchName);
- // permissions
- cmd.Parameters.AddWithValue("ObjectFlags", (uint)prim.Flags);
- cmd.Parameters.AddWithValue("CreatorID", prim.CreatorID.ToString());
- cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString());
- cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString());
- cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString());
- cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask);
- cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask);
- cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask);
- cmd.Parameters.AddWithValue("EveryoneMask", prim.EveryoneMask);
- cmd.Parameters.AddWithValue("BaseMask", prim.BaseMask);
- // vectors
- cmd.Parameters.AddWithValue("PositionX", (double)prim.OffsetPosition.X);
- cmd.Parameters.AddWithValue("PositionY", (double)prim.OffsetPosition.Y);
- cmd.Parameters.AddWithValue("PositionZ", (double)prim.OffsetPosition.Z);
- cmd.Parameters.AddWithValue("GroupPositionX", (double)prim.GroupPosition.X);
- cmd.Parameters.AddWithValue("GroupPositionY", (double)prim.GroupPosition.Y);
- cmd.Parameters.AddWithValue("GroupPositionZ", (double)prim.GroupPosition.Z);
- cmd.Parameters.AddWithValue("VelocityX", (double)prim.Velocity.X);
- cmd.Parameters.AddWithValue("VelocityY", (double)prim.Velocity.Y);
- cmd.Parameters.AddWithValue("VelocityZ", (double)prim.Velocity.Z);
- cmd.Parameters.AddWithValue("AngularVelocityX", (double)prim.AngularVelocity.X);
- cmd.Parameters.AddWithValue("AngularVelocityY", (double)prim.AngularVelocity.Y);
- cmd.Parameters.AddWithValue("AngularVelocityZ", (double)prim.AngularVelocity.Z);
- cmd.Parameters.AddWithValue("AccelerationX", (double)prim.Acceleration.X);
- cmd.Parameters.AddWithValue("AccelerationY", (double)prim.Acceleration.Y);
- cmd.Parameters.AddWithValue("AccelerationZ", (double)prim.Acceleration.Z);
- // quaternions
- cmd.Parameters.AddWithValue("RotationX", (double)prim.RotationOffset.X);
- cmd.Parameters.AddWithValue("RotationY", (double)prim.RotationOffset.Y);
- cmd.Parameters.AddWithValue("RotationZ", (double)prim.RotationOffset.Z);
- cmd.Parameters.AddWithValue("RotationW", (double)prim.RotationOffset.W);
-
- // Sit target
- Vector3 sitTargetPos = prim.SitTargetPositionLL;
- cmd.Parameters.AddWithValue("SitTargetOffsetX", (double)sitTargetPos.X);
- cmd.Parameters.AddWithValue("SitTargetOffsetY", (double)sitTargetPos.Y);
- cmd.Parameters.AddWithValue("SitTargetOffsetZ", (double)sitTargetPos.Z);
-
- Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
- cmd.Parameters.AddWithValue("SitTargetOrientW", (double)sitTargetOrient.W);
- cmd.Parameters.AddWithValue("SitTargetOrientX", (double)sitTargetOrient.X);
- cmd.Parameters.AddWithValue("SitTargetOrientY", (double)sitTargetOrient.Y);
- cmd.Parameters.AddWithValue("SitTargetOrientZ", (double)sitTargetOrient.Z);
-
- cmd.Parameters.AddWithValue("PayPrice", prim.PayPrice[0]);
- cmd.Parameters.AddWithValue("PayButton1", prim.PayPrice[1]);
- cmd.Parameters.AddWithValue("PayButton2", prim.PayPrice[2]);
- cmd.Parameters.AddWithValue("PayButton3", prim.PayPrice[3]);
- cmd.Parameters.AddWithValue("PayButton4", prim.PayPrice[4]);
-
- if ((prim.SoundFlags & 1) != 0) // Looped
- {
- cmd.Parameters.AddWithValue("LoopedSound", prim.Sound.ToString());
- cmd.Parameters.AddWithValue("LoopedSoundGain", prim.SoundGain);
- }
- else
- {
- cmd.Parameters.AddWithValue("LoopedSound", UUID.Zero);
- cmd.Parameters.AddWithValue("LoopedSoundGain", 0.0f);
- }
-
- cmd.Parameters.AddWithValue("TextureAnimation", prim.TextureAnimation);
- cmd.Parameters.AddWithValue("ParticleSystem", prim.ParticleSystem);
-
- cmd.Parameters.AddWithValue("OmegaX", (double)prim.AngularVelocity.X);
- cmd.Parameters.AddWithValue("OmegaY", (double)prim.AngularVelocity.Y);
- cmd.Parameters.AddWithValue("OmegaZ", (double)prim.AngularVelocity.Z);
-
- cmd.Parameters.AddWithValue("CameraEyeOffsetX", (double)prim.GetCameraEyeOffset().X);
- cmd.Parameters.AddWithValue("CameraEyeOffsetY", (double)prim.GetCameraEyeOffset().Y);
- cmd.Parameters.AddWithValue("CameraEyeOffsetZ", (double)prim.GetCameraEyeOffset().Z);
-
- cmd.Parameters.AddWithValue("CameraAtOffsetX", (double)prim.GetCameraAtOffset().X);
- cmd.Parameters.AddWithValue("CameraAtOffsetY", (double)prim.GetCameraAtOffset().Y);
- cmd.Parameters.AddWithValue("CameraAtOffsetZ", (double)prim.GetCameraAtOffset().Z);
-
- if (prim.GetForceMouselook())
- cmd.Parameters.AddWithValue("ForceMouselook", 1);
- else
- cmd.Parameters.AddWithValue("ForceMouselook", 0);
-
- cmd.Parameters.AddWithValue("ScriptAccessPin", prim.ScriptAccessPin);
-
- if (prim.AllowedDrop)
- cmd.Parameters.AddWithValue("AllowedDrop", 1);
- else
- cmd.Parameters.AddWithValue("AllowedDrop", 0);
-
- if (prim.DIE_AT_EDGE)
- cmd.Parameters.AddWithValue("DieAtEdge", 1);
- else
- cmd.Parameters.AddWithValue("DieAtEdge", 0);
-
- cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice);
- cmd.Parameters.AddWithValue("SaleType", unchecked((sbyte)(prim.ObjectSaleType)));
-
- byte clickAction = prim.ClickAction;
- cmd.Parameters.AddWithValue("ClickAction", unchecked((sbyte)(clickAction)));
-
- cmd.Parameters.AddWithValue("Material", unchecked((sbyte)(prim.Material)));
-
- cmd.Parameters.AddWithValue("CollisionSound", prim.CollisionSound.ToString());
- cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume);
-
- if (prim.PassTouches)
- cmd.Parameters.AddWithValue("PassTouches", 1);
- else
- cmd.Parameters.AddWithValue("PassTouches", 0);
-
- cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
- cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
- }
-
- ///
- ///
- ///
- ///
- ///
- private static void FillItemCommand(MySqlCommand cmd, TaskInventoryItem taskItem)
- {
- cmd.Parameters.AddWithValue("itemID", taskItem.ItemID);
- cmd.Parameters.AddWithValue("primID", taskItem.ParentPartID);
- cmd.Parameters.AddWithValue("assetID", taskItem.AssetID);
- cmd.Parameters.AddWithValue("parentFolderID", taskItem.ParentID);
-
- cmd.Parameters.AddWithValue("invType", taskItem.InvType);
- cmd.Parameters.AddWithValue("assetType", taskItem.Type);
-
- cmd.Parameters.AddWithValue("name", taskItem.Name);
- cmd.Parameters.AddWithValue("description", taskItem.Description);
- cmd.Parameters.AddWithValue("creationDate", taskItem.CreationDate);
- cmd.Parameters.AddWithValue("creatorID", taskItem.CreatorID);
- cmd.Parameters.AddWithValue("ownerID", taskItem.OwnerID);
- cmd.Parameters.AddWithValue("lastOwnerID", taskItem.LastOwnerID);
- cmd.Parameters.AddWithValue("groupID", taskItem.GroupID);
- cmd.Parameters.AddWithValue("nextPermissions", taskItem.NextPermissions);
- cmd.Parameters.AddWithValue("currentPermissions", taskItem.CurrentPermissions);
- cmd.Parameters.AddWithValue("basePermissions", taskItem.BasePermissions);
- cmd.Parameters.AddWithValue("everyonePermissions", taskItem.EveryonePermissions);
- cmd.Parameters.AddWithValue("groupPermissions", taskItem.GroupPermissions);
- cmd.Parameters.AddWithValue("flags", taskItem.Flags);
- }
-
- ///
- ///
- ///
- private static void FillRegionSettingsCommand(MySqlCommand cmd, RegionSettings settings)
- {
- cmd.Parameters.AddWithValue("RegionUUID", settings.RegionUUID.ToString());
- cmd.Parameters.AddWithValue("BlockTerraform", settings.BlockTerraform);
- cmd.Parameters.AddWithValue("BlockFly", settings.BlockFly);
- cmd.Parameters.AddWithValue("AllowDamage", settings.AllowDamage);
- cmd.Parameters.AddWithValue("RestrictPushing", settings.RestrictPushing);
- cmd.Parameters.AddWithValue("AllowLandResell", settings.AllowLandResell);
- cmd.Parameters.AddWithValue("AllowLandJoinDivide", settings.AllowLandJoinDivide);
- cmd.Parameters.AddWithValue("BlockShowInSearch", settings.BlockShowInSearch);
- cmd.Parameters.AddWithValue("AgentLimit", settings.AgentLimit);
- cmd.Parameters.AddWithValue("ObjectBonus", settings.ObjectBonus);
- cmd.Parameters.AddWithValue("Maturity", settings.Maturity);
- cmd.Parameters.AddWithValue("DisableScripts", settings.DisableScripts);
- cmd.Parameters.AddWithValue("DisableCollisions", settings.DisableCollisions);
- cmd.Parameters.AddWithValue("DisablePhysics", settings.DisablePhysics);
- cmd.Parameters.AddWithValue("TerrainTexture1", settings.TerrainTexture1.ToString());
- cmd.Parameters.AddWithValue("TerrainTexture2", settings.TerrainTexture2.ToString());
- cmd.Parameters.AddWithValue("TerrainTexture3", settings.TerrainTexture3.ToString());
- cmd.Parameters.AddWithValue("TerrainTexture4", settings.TerrainTexture4.ToString());
- cmd.Parameters.AddWithValue("Elevation1NW", settings.Elevation1NW);
- cmd.Parameters.AddWithValue("Elevation2NW", settings.Elevation2NW);
- cmd.Parameters.AddWithValue("Elevation1NE", settings.Elevation1NE);
- cmd.Parameters.AddWithValue("Elevation2NE", settings.Elevation2NE);
- cmd.Parameters.AddWithValue("Elevation1SE", settings.Elevation1SE);
- cmd.Parameters.AddWithValue("Elevation2SE", settings.Elevation2SE);
- cmd.Parameters.AddWithValue("Elevation1SW", settings.Elevation1SW);
- cmd.Parameters.AddWithValue("Elevation2SW", settings.Elevation2SW);
- cmd.Parameters.AddWithValue("WaterHeight", settings.WaterHeight);
- cmd.Parameters.AddWithValue("TerrainRaiseLimit", settings.TerrainRaiseLimit);
- cmd.Parameters.AddWithValue("TerrainLowerLimit", settings.TerrainLowerLimit);
- cmd.Parameters.AddWithValue("UseEstateSun", settings.UseEstateSun);
- cmd.Parameters.AddWithValue("Sandbox", settings.Sandbox);
- cmd.Parameters.AddWithValue("SunVectorX", settings.SunVector.X);
- cmd.Parameters.AddWithValue("SunVectorY", settings.SunVector.Y);
- cmd.Parameters.AddWithValue("SunVectorZ", settings.SunVector.Z);
- cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun);
- cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition);
- cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
- cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
- cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
- cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
-
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- private static void FillLandCommand(MySqlCommand cmd, LandData land, UUID regionUUID)
- {
- cmd.Parameters.AddWithValue("UUID", land.GlobalID.ToString());
- cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
- cmd.Parameters.AddWithValue("LocalLandID", land.LocalID);
-
- // Bitmap is a byte[512]
- cmd.Parameters.AddWithValue("Bitmap", land.Bitmap);
-
- cmd.Parameters.AddWithValue("Name", land.Name);
- cmd.Parameters.AddWithValue("Description", land.Description);
- cmd.Parameters.AddWithValue("OwnerUUID", land.OwnerID.ToString());
- cmd.Parameters.AddWithValue("IsGroupOwned", land.IsGroupOwned);
- cmd.Parameters.AddWithValue("Area", land.Area);
- cmd.Parameters.AddWithValue("AuctionID", land.AuctionID); //Unemplemented
- cmd.Parameters.AddWithValue("Category", land.Category); //Enum libsecondlife.Parcel.ParcelCategory
- cmd.Parameters.AddWithValue("ClaimDate", land.ClaimDate);
- cmd.Parameters.AddWithValue("ClaimPrice", land.ClaimPrice);
- cmd.Parameters.AddWithValue("GroupUUID", land.GroupID.ToString());
- cmd.Parameters.AddWithValue("SalePrice", land.SalePrice);
- cmd.Parameters.AddWithValue("LandStatus", land.Status); //Enum. libsecondlife.Parcel.ParcelStatus
- cmd.Parameters.AddWithValue("LandFlags", land.Flags);
- cmd.Parameters.AddWithValue("LandingType", land.LandingType);
- cmd.Parameters.AddWithValue("MediaAutoScale", land.MediaAutoScale);
- cmd.Parameters.AddWithValue("MediaTextureUUID", land.MediaID.ToString());
- cmd.Parameters.AddWithValue("MediaURL", land.MediaURL);
- cmd.Parameters.AddWithValue("MusicURL", land.MusicURL);
- cmd.Parameters.AddWithValue("PassHours", land.PassHours);
- cmd.Parameters.AddWithValue("PassPrice", land.PassPrice);
- cmd.Parameters.AddWithValue("SnapshotUUID", land.SnapshotID.ToString());
- cmd.Parameters.AddWithValue("UserLocationX", land.UserLocation.X);
- cmd.Parameters.AddWithValue("UserLocationY", land.UserLocation.Y);
- cmd.Parameters.AddWithValue("UserLocationZ", land.UserLocation.Z);
- cmd.Parameters.AddWithValue("UserLookAtX", land.UserLookAt.X);
- cmd.Parameters.AddWithValue("UserLookAtY", land.UserLookAt.Y);
- cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z);
- cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
- cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
- cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
- cmd.Parameters.AddWithValue("MediaType", land.MediaType);
- cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);
- cmd.Parameters.AddWithValue("MediaHeight", land.MediaHeight);
- cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop);
- cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic);
- cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia);
-
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- private static void FillLandAccessCommand(MySqlCommand cmd, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
- {
- cmd.Parameters.AddWithValue("LandUUID", parcelID.ToString());
- cmd.Parameters.AddWithValue("AccessUUID", entry.AgentID.ToString());
- cmd.Parameters.AddWithValue("Flags", entry.Flags);
- }
-
- ///
- ///
- ///
- ///
- ///
- private PrimitiveBaseShape BuildShape(IDataReader row)
- {
- PrimitiveBaseShape s = new PrimitiveBaseShape();
- s.Scale = new Vector3(
- (float)(double)row["ScaleX"],
- (float)(double)row["ScaleY"],
- (float)(double)row["ScaleZ"]
- );
- // paths
- s.PCode = (byte)(int)row["PCode"];
- s.PathBegin = (ushort)(int)row["PathBegin"];
- s.PathEnd = (ushort)(int)row["PathEnd"];
- s.PathScaleX = (byte)(int)row["PathScaleX"];
- s.PathScaleY = (byte)(int)row["PathScaleY"];
- s.PathShearX = (byte)(int)row["PathShearX"];
- s.PathShearY = (byte)(int)row["PathShearY"];
- s.PathSkew = (sbyte)(int)row["PathSkew"];
- s.PathCurve = (byte)(int)row["PathCurve"];
- s.PathRadiusOffset = (sbyte)(int)row["PathRadiusOffset"];
- s.PathRevolutions = (byte)(int)row["PathRevolutions"];
- s.PathTaperX = (sbyte)(int)row["PathTaperX"];
- s.PathTaperY = (sbyte)(int)row["PathTaperY"];
- s.PathTwist = (sbyte)(int)row["PathTwist"];
- s.PathTwistBegin = (sbyte)(int)row["PathTwistBegin"];
- // profile
- s.ProfileBegin = (ushort)(int)row["ProfileBegin"];
- s.ProfileEnd = (ushort)(int)row["ProfileEnd"];
- s.ProfileCurve = (byte)(int)row["ProfileCurve"];
- s.ProfileHollow = (ushort)(int)row["ProfileHollow"];
- s.TextureEntry = (byte[])row["Texture"];
-
- s.ExtraParams = (byte[])row["ExtraParams"];
-
- s.State = (byte)(int)row["State"];
-
- if (!(row["Media"] is System.DBNull))
- s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
-
- return s;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void FillShapeCommand(MySqlCommand cmd, SceneObjectPart prim)
- {
- PrimitiveBaseShape s = prim.Shape;
- cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString());
- // shape is an enum
- cmd.Parameters.AddWithValue("Shape", 0);
- // vectors
- cmd.Parameters.AddWithValue("ScaleX", (double)s.Scale.X);
- cmd.Parameters.AddWithValue("ScaleY", (double)s.Scale.Y);
- cmd.Parameters.AddWithValue("ScaleZ", (double)s.Scale.Z);
- // paths
- cmd.Parameters.AddWithValue("PCode", s.PCode);
- cmd.Parameters.AddWithValue("PathBegin", s.PathBegin);
- cmd.Parameters.AddWithValue("PathEnd", s.PathEnd);
- cmd.Parameters.AddWithValue("PathScaleX", s.PathScaleX);
- cmd.Parameters.AddWithValue("PathScaleY", s.PathScaleY);
- cmd.Parameters.AddWithValue("PathShearX", s.PathShearX);
- cmd.Parameters.AddWithValue("PathShearY", s.PathShearY);
- cmd.Parameters.AddWithValue("PathSkew", s.PathSkew);
- cmd.Parameters.AddWithValue("PathCurve", s.PathCurve);
- cmd.Parameters.AddWithValue("PathRadiusOffset", s.PathRadiusOffset);
- cmd.Parameters.AddWithValue("PathRevolutions", s.PathRevolutions);
- cmd.Parameters.AddWithValue("PathTaperX", s.PathTaperX);
- cmd.Parameters.AddWithValue("PathTaperY", s.PathTaperY);
- cmd.Parameters.AddWithValue("PathTwist", s.PathTwist);
- cmd.Parameters.AddWithValue("PathTwistBegin", s.PathTwistBegin);
- // profile
- cmd.Parameters.AddWithValue("ProfileBegin", s.ProfileBegin);
- cmd.Parameters.AddWithValue("ProfileEnd", s.ProfileEnd);
- cmd.Parameters.AddWithValue("ProfileCurve", s.ProfileCurve);
- cmd.Parameters.AddWithValue("ProfileHollow", s.ProfileHollow);
- cmd.Parameters.AddWithValue("Texture", s.TextureEntry);
- cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams);
- cmd.Parameters.AddWithValue("State", s.State);
- cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
- }
-
- public void StorePrimInventory(UUID primID, ICollection items)
- {
- lock (m_dbLock)
- {
- RemoveItems(primID);
-
- using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
- {
- dbcon.Open();
-
- MySqlCommand cmd = dbcon.CreateCommand();
-
- if (items.Count == 0)
- return;
-
- cmd.CommandText = "insert into primitems (" +
- "invType, assetType, name, " +
- "description, creationDate, nextPermissions, " +
- "currentPermissions, basePermissions, " +
- "everyonePermissions, groupPermissions, " +
- "flags, itemID, primID, assetID, " +
- "parentFolderID, creatorID, ownerID, " +
- "groupID, lastOwnerID) values (?invType, " +
- "?assetType, ?name, ?description, " +
- "?creationDate, ?nextPermissions, " +
- "?currentPermissions, ?basePermissions, " +
- "?everyonePermissions, ?groupPermissions, " +
- "?flags, ?itemID, ?primID, ?assetID, " +
- "?parentFolderID, ?creatorID, ?ownerID, " +
- "?groupID, ?lastOwnerID)";
-
- foreach (TaskInventoryItem item in items)
- {
- cmd.Parameters.Clear();
-
- FillItemCommand(cmd, item);
-
- ExecuteNonQuery(cmd);
- }
-
- cmd.Dispose();
- }
- }
- }
- }
-}
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
new file mode 100644
index 0000000..36f73ef
--- /dev/null
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -0,0 +1,1820 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using System.Data;
+using System.Drawing;
+using System.IO;
+using System.Reflection;
+using System.Threading;
+using log4net;
+using MySql.Data.MySqlClient;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Data;
+
+namespace OpenSim.Data.MySQL
+{
+ ///
+ /// A MySQL Interface for the Region Server
+ ///
+ public class MySQLSimulationData : ISimulationDataStore
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private string m_connectionString;
+ private object m_dbLock = new object();
+
+ public void Initialise(string connectionString)
+ {
+ m_connectionString = connectionString;
+
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ // Apply new Migrations
+ //
+ Assembly assem = GetType().Assembly;
+ Migration m = new Migration(dbcon, assem, "RegionStore");
+ m.Update();
+
+ // Clean dropped attachments
+ //
+ try
+ {
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "delete from prims, primshapes using prims " +
+ "left join primshapes on prims.uuid = primshapes.uuid " +
+ "where PCode = 9 and State <> 0";
+ ExecuteNonQuery(cmd);
+ }
+ }
+ catch (MySqlException ex)
+ {
+ m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message);
+ }
+ }
+ }
+
+ private IDataReader ExecuteReader(MySqlCommand c)
+ {
+ IDataReader r = null;
+
+ try
+ {
+ r = c.ExecuteReader();
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[REGION DB]: MySQL error in ExecuteReader: " + e.Message);
+ throw;
+ }
+
+ return r;
+ }
+
+ private void ExecuteNonQuery(MySqlCommand c)
+ {
+ try
+ {
+ c.ExecuteNonQuery();
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[REGION DB]: MySQL error in ExecuteNonQuery: " + e.Message);
+ throw;
+ }
+ }
+
+ public void Dispose() {}
+
+ public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
+ {
+ uint flags = obj.RootPart.GetEffectiveObjectFlags();
+
+ // Eligibility check
+ //
+ if ((flags & (uint)PrimFlags.Temporary) != 0)
+ return;
+ if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
+ return;
+
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+ MySqlCommand cmd = dbcon.CreateCommand();
+
+ foreach (SceneObjectPart prim in obj.Children.Values)
+ {
+ cmd.Parameters.Clear();
+
+ cmd.CommandText = "replace into prims (" +
+ "UUID, CreationDate, " +
+ "Name, Text, Description, " +
+ "SitName, TouchName, ObjectFlags, " +
+ "OwnerMask, NextOwnerMask, GroupMask, " +
+ "EveryoneMask, BaseMask, PositionX, " +
+ "PositionY, PositionZ, GroupPositionX, " +
+ "GroupPositionY, GroupPositionZ, VelocityX, " +
+ "VelocityY, VelocityZ, AngularVelocityX, " +
+ "AngularVelocityY, AngularVelocityZ, " +
+ "AccelerationX, AccelerationY, " +
+ "AccelerationZ, RotationX, " +
+ "RotationY, RotationZ, " +
+ "RotationW, SitTargetOffsetX, " +
+ "SitTargetOffsetY, SitTargetOffsetZ, " +
+ "SitTargetOrientW, SitTargetOrientX, " +
+ "SitTargetOrientY, SitTargetOrientZ, " +
+ "RegionUUID, CreatorID, " +
+ "OwnerID, GroupID, " +
+ "LastOwnerID, SceneGroupID, " +
+ "PayPrice, PayButton1, " +
+ "PayButton2, PayButton3, " +
+ "PayButton4, LoopedSound, " +
+ "LoopedSoundGain, TextureAnimation, " +
+ "OmegaX, OmegaY, OmegaZ, " +
+ "CameraEyeOffsetX, CameraEyeOffsetY, " +
+ "CameraEyeOffsetZ, CameraAtOffsetX, " +
+ "CameraAtOffsetY, CameraAtOffsetZ, " +
+ "ForceMouselook, ScriptAccessPin, " +
+ "AllowedDrop, DieAtEdge, " +
+ "SalePrice, SaleType, " +
+ "ColorR, ColorG, ColorB, ColorA, " +
+ "ParticleSystem, ClickAction, Material, " +
+ "CollisionSound, CollisionSoundVolume, " +
+ "PassTouches, " +
+ "LinkNumber, MediaURL) values (" + "?UUID, " +
+ "?CreationDate, ?Name, ?Text, " +
+ "?Description, ?SitName, ?TouchName, " +
+ "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
+ "?GroupMask, ?EveryoneMask, ?BaseMask, " +
+ "?PositionX, ?PositionY, ?PositionZ, " +
+ "?GroupPositionX, ?GroupPositionY, " +
+ "?GroupPositionZ, ?VelocityX, " +
+ "?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
+ "?AngularVelocityY, ?AngularVelocityZ, " +
+ "?AccelerationX, ?AccelerationY, " +
+ "?AccelerationZ, ?RotationX, " +
+ "?RotationY, ?RotationZ, " +
+ "?RotationW, ?SitTargetOffsetX, " +
+ "?SitTargetOffsetY, ?SitTargetOffsetZ, " +
+ "?SitTargetOrientW, ?SitTargetOrientX, " +
+ "?SitTargetOrientY, ?SitTargetOrientZ, " +
+ "?RegionUUID, ?CreatorID, ?OwnerID, " +
+ "?GroupID, ?LastOwnerID, ?SceneGroupID, " +
+ "?PayPrice, ?PayButton1, ?PayButton2, " +
+ "?PayButton3, ?PayButton4, ?LoopedSound, " +
+ "?LoopedSoundGain, ?TextureAnimation, " +
+ "?OmegaX, ?OmegaY, ?OmegaZ, " +
+ "?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
+ "?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
+ "?CameraAtOffsetY, ?CameraAtOffsetZ, " +
+ "?ForceMouselook, ?ScriptAccessPin, " +
+ "?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
+ "?SaleType, ?ColorR, ?ColorG, " +
+ "?ColorB, ?ColorA, ?ParticleSystem, " +
+ "?ClickAction, ?Material, ?CollisionSound, " +
+ "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
+
+ FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
+
+ ExecuteNonQuery(cmd);
+
+ cmd.Parameters.Clear();
+
+ cmd.CommandText = "replace into primshapes (" +
+ "UUID, Shape, ScaleX, ScaleY, " +
+ "ScaleZ, PCode, PathBegin, PathEnd, " +
+ "PathScaleX, PathScaleY, PathShearX, " +
+ "PathShearY, PathSkew, PathCurve, " +
+ "PathRadiusOffset, PathRevolutions, " +
+ "PathTaperX, PathTaperY, PathTwist, " +
+ "PathTwistBegin, ProfileBegin, ProfileEnd, " +
+ "ProfileCurve, ProfileHollow, Texture, " +
+ "ExtraParams, State, Media) values (?UUID, " +
+ "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
+ "?PCode, ?PathBegin, ?PathEnd, " +
+ "?PathScaleX, ?PathScaleY, " +
+ "?PathShearX, ?PathShearY, " +
+ "?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
+ "?PathRevolutions, ?PathTaperX, " +
+ "?PathTaperY, ?PathTwist, " +
+ "?PathTwistBegin, ?ProfileBegin, " +
+ "?ProfileEnd, ?ProfileCurve, " +
+ "?ProfileHollow, ?Texture, ?ExtraParams, " +
+ "?State, ?Media)";
+
+ FillShapeCommand(cmd, prim);
+
+ ExecuteNonQuery(cmd);
+ }
+
+ cmd.Dispose();
+ }
+ }
+ }
+
+ public void RemoveObject(UUID obj, UUID regionUUID)
+ {
+// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
+
+ List uuids = new List();
+
+ // Formerly, this used to check the region UUID.
+ // That makes no sense, as we remove the contents of a prim
+ // unconditionally, but the prim dependent on the region ID.
+ // So, we would destroy an object and cause hard to detect
+ // issues if we delete the contents only. Deleting it all may
+ // cause the loss of a prim, but is cleaner.
+ // It's also faster because it uses the primary key.
+ //
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "select UUID from prims where SceneGroupID= ?UUID";
+ cmd.Parameters.AddWithValue("UUID", obj.ToString());
+
+ using (IDataReader reader = ExecuteReader(cmd))
+ {
+ while (reader.Read())
+ uuids.Add(DBGuid.FromDB(reader["UUID"].ToString()));
+ }
+
+ // delete the main prims
+ cmd.CommandText = "delete from prims where SceneGroupID= ?UUID";
+ ExecuteNonQuery(cmd);
+ }
+ }
+ }
+
+ // there is no way this should be < 1 unless there is
+ // a very corrupt database, but in that case be extra
+ // safe anyway.
+ if (uuids.Count > 0)
+ {
+ RemoveShapes(uuids);
+ RemoveItems(uuids);
+ }
+ }
+
+ ///
+ /// Remove all persisted items of the given prim.
+ /// The caller must acquire the necessrary synchronization locks
+ ///
+ /// the Item UUID
+ private void RemoveItems(UUID uuid)
+ {
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "delete from primitems where PrimID = ?PrimID";
+ cmd.Parameters.AddWithValue("PrimID", uuid.ToString());
+
+ ExecuteNonQuery(cmd);
+ }
+ }
+ }
+ }
+
+ ///
+ /// Remove all persisted shapes for a list of prims
+ /// The caller must acquire the necessrary synchronization locks
+ ///
+ /// the list of UUIDs
+ private void RemoveShapes(List uuids)
+ {
+ lock (m_dbLock)
+ {
+ string sql = "delete from primshapes where ";
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ for (int i = 0; i < uuids.Count; i++)
+ {
+ if ((i + 1) == uuids.Count)
+ {// end of the list
+ sql += "(UUID = ?UUID" + i + ")";
+ }
+ else
+ {
+ sql += "(UUID = ?UUID" + i + ") or ";
+ }
+ }
+ cmd.CommandText = sql;
+
+ for (int i = 0; i < uuids.Count; i++)
+ cmd.Parameters.AddWithValue("UUID" + i, uuids[i].ToString());
+
+ ExecuteNonQuery(cmd);
+ }
+ }
+ }
+ }
+
+ ///
+ /// Remove all persisted items for a list of prims
+ /// The caller must acquire the necessrary synchronization locks
+ ///
+ /// the list of UUIDs
+ private void RemoveItems(List uuids)
+ {
+ lock (m_dbLock)
+ {
+ string sql = "delete from primitems where ";
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ for (int i = 0; i < uuids.Count; i++)
+ {
+ if ((i + 1) == uuids.Count)
+ {
+ // end of the list
+ sql += "(PrimID = ?PrimID" + i + ")";
+ }
+ else
+ {
+ sql += "(PrimID = ?PrimID" + i + ") or ";
+ }
+ }
+ cmd.CommandText = sql;
+
+ for (int i = 0; i < uuids.Count; i++)
+ cmd.Parameters.AddWithValue("PrimID" + i, uuids[i].ToString());
+
+ ExecuteNonQuery(cmd);
+ }
+ }
+ }
+ }
+
+ public List LoadObjects(UUID regionID)
+ {
+ const int ROWS_PER_QUERY = 5000;
+
+ Dictionary prims = new Dictionary(ROWS_PER_QUERY);
+ Dictionary objects = new Dictionary();
+ int count = 0;
+
+ #region Prim Loading
+
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText =
+ "SELECT * FROM prims LEFT JOIN primshapes ON prims.UUID = primshapes.UUID WHERE RegionUUID = ?RegionUUID";
+ cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
+
+ using (IDataReader reader = ExecuteReader(cmd))
+ {
+ while (reader.Read())
+ {
+ SceneObjectPart prim = BuildPrim(reader);
+ if (reader["Shape"] is DBNull)
+ prim.Shape = PrimitiveBaseShape.Default;
+ else
+ prim.Shape = BuildShape(reader);
+
+ UUID parentID = DBGuid.FromDB(reader["SceneGroupID"].ToString());
+ if (parentID != prim.UUID)
+ prim.ParentUUID = parentID;
+
+ prims[prim.UUID] = prim;
+
+ ++count;
+ if (count % ROWS_PER_QUERY == 0)
+ m_log.Debug("[REGION DB]: Loaded " + count + " prims...");
+ }
+ }
+ }
+ }
+ }
+
+ #endregion Prim Loading
+
+ #region SceneObjectGroup Creation
+
+ // Create all of the SOGs from the root prims first
+ foreach (SceneObjectPart prim in prims.Values)
+ {
+ if (prim.ParentUUID == UUID.Zero)
+ objects[prim.UUID] = new SceneObjectGroup(prim);
+ }
+
+ // Add all of the children objects to the SOGs
+ foreach (SceneObjectPart prim in prims.Values)
+ {
+ SceneObjectGroup sog;
+ if (prim.UUID != prim.ParentUUID)
+ {
+ if (objects.TryGetValue(prim.ParentUUID, out sog))
+ {
+ int originalLinkNum = prim.LinkNum;
+
+ sog.AddPart(prim);
+
+ // SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum.
+ // We override that here
+ if (originalLinkNum != 0)
+ prim.LinkNum = originalLinkNum;
+ }
+ else
+ {
+ m_log.WarnFormat(
+ "[REGION DB]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.",
+ prim.Name, prim.UUID, regionID, prim.ParentUUID);
+ }
+ }
+ }
+
+ #endregion SceneObjectGroup Creation
+
+ m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count);
+
+ #region Prim Inventory Loading
+
+ // Instead of attempting to LoadItems on every prim,
+ // most of which probably have no items... get a
+ // list from DB of all prims which have items and
+ // LoadItems only on those
+ List primsWithInventory = new List();
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand itemCmd = dbcon.CreateCommand())
+ {
+ itemCmd.CommandText = "SELECT DISTINCT primID FROM primitems";
+ using (IDataReader itemReader = ExecuteReader(itemCmd))
+ {
+ while (itemReader.Read())
+ {
+ if (!(itemReader["primID"] is DBNull))
+ {
+ UUID primID = DBGuid.FromDB(itemReader["primID"].ToString());
+ if (prims.ContainsKey(primID))
+ primsWithInventory.Add(prims[primID]);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ foreach (SceneObjectPart prim in primsWithInventory)
+ {
+ LoadItems(prim);
+ }
+
+ #endregion Prim Inventory Loading
+
+ m_log.DebugFormat("[REGION DB]: Loaded inventory from {0} objects", primsWithInventory.Count);
+
+ return new List(objects.Values);
+ }
+
+ ///
+ /// Load in a prim's persisted inventory.
+ ///
+ /// The prim
+ private void LoadItems(SceneObjectPart prim)
+ {
+ lock (m_dbLock)
+ {
+ List inventory = new List();
+
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "select * from primitems where PrimID = ?PrimID";
+ cmd.Parameters.AddWithValue("PrimID", prim.UUID.ToString());
+
+ using (IDataReader reader = ExecuteReader(cmd))
+ {
+ while (reader.Read())
+ {
+ TaskInventoryItem item = BuildItem(reader);
+
+ item.ParentID = prim.UUID; // Values in database are often wrong
+ inventory.Add(item);
+ }
+ }
+ }
+ }
+
+ prim.Inventory.RestoreInventoryItems(inventory);
+ }
+ }
+
+ public void StoreTerrain(double[,] ter, UUID regionID)
+ {
+ m_log.Info("[REGION DB]: Storing terrain");
+
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
+ cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
+
+ ExecuteNonQuery(cmd);
+
+ cmd.CommandText = "insert into terrain (RegionUUID, " +
+ "Revision, Heightfield) values (?RegionUUID, " +
+ "1, ?Heightfield)";
+
+ cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter));
+
+ ExecuteNonQuery(cmd);
+ }
+ }
+ }
+ }
+
+ public double[,] LoadTerrain(UUID regionID)
+ {
+ double[,] terrain = null;
+
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "select RegionUUID, Revision, Heightfield " +
+ "from terrain where RegionUUID = ?RegionUUID " +
+ "order by Revision desc limit 1";
+ cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
+
+ using (IDataReader reader = ExecuteReader(cmd))
+ {
+ while (reader.Read())
+ {
+ int rev = Convert.ToInt32(reader["Revision"]);
+
+ terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
+ terrain.Initialize();
+
+ using (MemoryStream mstr = new MemoryStream((byte[])reader["Heightfield"]))
+ {
+ using (BinaryReader br = new BinaryReader(mstr))
+ {
+ for (int x = 0; x < (int)Constants.RegionSize; x++)
+ {
+ for (int y = 0; y < (int)Constants.RegionSize; y++)
+ {
+ terrain[x, y] = br.ReadDouble();
+ }
+ }
+ }
+
+ m_log.InfoFormat("[REGION DB]: Loaded terrain revision r{0}", rev);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return terrain;
+ }
+
+ public void RemoveLandObject(UUID globalID)
+ {
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "delete from land where UUID = ?UUID";
+ cmd.Parameters.AddWithValue("UUID", globalID.ToString());
+
+ ExecuteNonQuery(cmd);
+ }
+ }
+ }
+ }
+
+ public void StoreLandObject(ILandObject parcel)
+ {
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "replace into land (UUID, RegionUUID, " +
+ "LocalLandID, Bitmap, Name, Description, " +
+ "OwnerUUID, IsGroupOwned, Area, AuctionID, " +
+ "Category, ClaimDate, ClaimPrice, GroupUUID, " +
+ "SalePrice, LandStatus, LandFlags, LandingType, " +
+ "MediaAutoScale, MediaTextureUUID, MediaURL, " +
+ "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
+ "UserLocationX, UserLocationY, UserLocationZ, " +
+ "UserLookAtX, UserLookAtY, UserLookAtZ, " +
+ "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
+ "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
+ "?UUID, ?RegionUUID, " +
+ "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
+ "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
+ "?Category, ?ClaimDate, ?ClaimPrice, ?GroupUUID, " +
+ "?SalePrice, ?LandStatus, ?LandFlags, ?LandingType, " +
+ "?MediaAutoScale, ?MediaTextureUUID, ?MediaURL, " +
+ "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
+ "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
+ "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
+ "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
+ "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
+
+ FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
+
+ ExecuteNonQuery(cmd);
+
+ cmd.CommandText = "delete from landaccesslist where LandUUID = ?UUID";
+
+ ExecuteNonQuery(cmd);
+
+ cmd.Parameters.Clear();
+ cmd.CommandText = "insert into landaccesslist (LandUUID, " +
+ "AccessUUID, Flags) values (?LandUUID, ?AccessUUID, " +
+ "?Flags)";
+
+ foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList)
+ {
+ FillLandAccessCommand(cmd, entry, parcel.LandData.GlobalID);
+ ExecuteNonQuery(cmd);
+ cmd.Parameters.Clear();
+ }
+ }
+ }
+ }
+ }
+
+ public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
+ {
+ RegionLightShareData nWP = new RegionLightShareData();
+ nWP.OnSave += StoreRegionWindlightSettings;
+
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ string command = "select * from `regionwindlight` where region_id = ?regionID";
+
+ using(MySqlCommand cmd = new MySqlCommand(command))
+ {
+ cmd.Connection = dbcon;
+
+ cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
+
+ IDataReader result = ExecuteReader(cmd);
+ if (!result.Read())
+ {
+ //No result, so store our default windlight profile and return it
+ nWP.regionID = regionUUID;
+ StoreRegionWindlightSettings(nWP);
+ return nWP;
+ }
+ else
+ {
+ nWP.regionID = DBGuid.FromDB(result["region_id"]);
+ nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
+ nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
+ nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
+ nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
+ nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
+ nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
+ nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
+ nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
+ nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
+ nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
+ nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
+ nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
+ nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
+ nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
+ nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
+ nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
+ nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
+ UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
+ nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
+ nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
+ nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
+ nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
+ nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
+ nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
+ nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
+ nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
+ nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
+ nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
+ nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
+ nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
+ nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
+ nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
+ nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
+ nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
+ nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
+ nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
+ nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
+ nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
+ nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
+ nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
+ nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
+ nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
+ nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
+ nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
+ nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
+ nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
+ nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
+ nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
+ nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
+ nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
+ nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
+ nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
+ nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
+ nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
+ nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
+ nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
+ nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
+ nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
+ nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
+ nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
+ nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
+ nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
+ }
+ }
+ }
+ return nWP;
+ }
+
+ public RegionSettings LoadRegionSettings(UUID regionUUID)
+ {
+ RegionSettings rs = null;
+
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "select * from regionsettings where regionUUID = ?RegionUUID";
+ cmd.Parameters.AddWithValue("regionUUID", regionUUID);
+
+ using (IDataReader reader = ExecuteReader(cmd))
+ {
+ if (reader.Read())
+ {
+ rs = BuildRegionSettings(reader);
+ rs.OnSave += StoreRegionSettings;
+ }
+ else
+ {
+ rs = new RegionSettings();
+ rs.RegionUUID = regionUUID;
+ rs.OnSave += StoreRegionSettings;
+
+ StoreRegionSettings(rs);
+ }
+ }
+ }
+ }
+ }
+
+ return rs;
+ }
+
+ public void StoreRegionWindlightSettings(RegionLightShareData wl)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
+ cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
+ cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
+ cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
+ cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
+ cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
+ cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
+ cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
+ cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
+ cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
+ cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
+ cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
+ cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
+ cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
+ cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
+ cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
+ cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
+ cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
+ cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
+ cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
+ cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
+ cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
+ cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
+ cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
+ cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
+
+ cmd.Parameters.AddWithValue("region_id", wl.regionID);
+ cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
+ cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
+ cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
+ cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
+ cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
+ cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
+ cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
+ cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
+ cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
+ cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
+ cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
+ cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
+ cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
+ cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
+ cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
+ cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
+ cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
+ cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
+ cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
+ cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
+ cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
+ cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
+ cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
+ cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
+ cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
+ cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
+ cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
+ cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
+ cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
+ cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
+ cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
+ cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
+ cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
+ cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
+ cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
+ cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
+ cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
+ cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
+ cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
+ cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
+ cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
+ cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
+ cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
+ cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
+ cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
+ cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
+ cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
+ cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
+ cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
+ cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
+ cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
+ cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
+ cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
+ cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
+ cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
+ cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
+ cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
+ cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
+ cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
+ cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
+ cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
+ cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
+
+ ExecuteNonQuery(cmd);
+ }
+ }
+ }
+
+ public void StoreRegionSettings(RegionSettings rs)
+ {
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "replace into regionsettings (regionUUID, " +
+ "block_terraform, block_fly, allow_damage, " +
+ "restrict_pushing, allow_land_resell, " +
+ "allow_land_join_divide, block_show_in_search, " +
+ "agent_limit, object_bonus, maturity, " +
+ "disable_scripts, disable_collisions, " +
+ "disable_physics, terrain_texture_1, " +
+ "terrain_texture_2, terrain_texture_3, " +
+ "terrain_texture_4, elevation_1_nw, " +
+ "elevation_2_nw, elevation_1_ne, " +
+ "elevation_2_ne, elevation_1_se, " +
+ "elevation_2_se, elevation_1_sw, " +
+ "elevation_2_sw, water_height, " +
+ "terrain_raise_limit, terrain_lower_limit, " +
+ "use_estate_sun, fixed_sun, sun_position, " +
+ "covenant, Sandbox, sunvectorx, sunvectory, " +
+ "sunvectorz, loaded_creation_datetime, " +
+ "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " +
+ "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
+ "?AllowLandResell, ?AllowLandJoinDivide, " +
+ "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
+ "?Maturity, ?DisableScripts, ?DisableCollisions, " +
+ "?DisablePhysics, ?TerrainTexture1, " +
+ "?TerrainTexture2, ?TerrainTexture3, " +
+ "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
+ "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
+ "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
+ "?WaterHeight, ?TerrainRaiseLimit, " +
+ "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
+ "?SunPosition, ?Covenant, ?Sandbox, " +
+ "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
+ "?LoadedCreationDateTime, ?LoadedCreationID, " +
+ "?TerrainImageID)";
+
+ FillRegionSettingsCommand(cmd, rs);
+
+ ExecuteNonQuery(cmd);
+ }
+ }
+ }
+ }
+
+ public List LoadLandObjects(UUID regionUUID)
+ {
+ List landData = new List();
+
+ lock (m_dbLock)
+ {
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ cmd.CommandText = "select * from land where RegionUUID = ?RegionUUID";
+ cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
+
+ using (IDataReader reader = ExecuteReader(cmd))
+ {
+ while (reader.Read())
+ {
+ LandData newLand = BuildLandData(reader);
+ landData.Add(newLand);
+ }
+ }
+ }
+
+ using (MySqlCommand cmd = dbcon.CreateCommand())
+ {
+ foreach (LandData land in landData)
+ {
+ cmd.Parameters.Clear();
+ cmd.CommandText = "select * from landaccesslist where LandUUID = ?LandUUID";
+ cmd.Parameters.AddWithValue("LandUUID", land.GlobalID.ToString());
+
+ using (IDataReader reader = ExecuteReader(cmd))
+ {
+ while (reader.Read())
+ {
+ land.ParcelAccessList.Add(BuildLandAccessData(reader));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return landData;
+ }
+
+ public void Shutdown()
+ {
+ }
+
+ private SceneObjectPart BuildPrim(IDataReader row)
+ {
+ SceneObjectPart prim = new SceneObjectPart();
+
+ // depending on the MySQL connector version, CHAR(36) may be already converted to Guid!
+ prim.UUID = DBGuid.FromDB(row["UUID"]);
+ prim.CreatorID = DBGuid.FromDB(row["CreatorID"]);
+ prim.OwnerID = DBGuid.FromDB(row["OwnerID"]);
+ prim.GroupID = DBGuid.FromDB(row["GroupID"]);
+ prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]);
+
+ // explicit conversion of integers is required, which sort
+ // of sucks. No idea if there is a shortcut here or not.
+ prim.CreationDate = (int)row["CreationDate"];
+ if (row["Name"] != DBNull.Value)
+ prim.Name = (string)row["Name"];
+ else
+ prim.Name = String.Empty;
+ // Various text fields
+ prim.Text = (string)row["Text"];
+ prim.Color = Color.FromArgb((int)row["ColorA"],
+ (int)row["ColorR"],
+ (int)row["ColorG"],
+ (int)row["ColorB"]);
+ prim.Description = (string)row["Description"];
+ prim.SitName = (string)row["SitName"];
+ prim.TouchName = (string)row["TouchName"];
+ // Permissions
+ prim.Flags = (PrimFlags)(int)row["ObjectFlags"];
+ prim.OwnerMask = (uint)(int)row["OwnerMask"];
+ prim.NextOwnerMask = (uint)(int)row["NextOwnerMask"];
+ prim.GroupMask = (uint)(int)row["GroupMask"];
+ prim.EveryoneMask = (uint)(int)row["EveryoneMask"];
+ prim.BaseMask = (uint)(int)row["BaseMask"];
+
+ // Vectors
+ prim.OffsetPosition = new Vector3(
+ (float)(double)row["PositionX"],
+ (float)(double)row["PositionY"],
+ (float)(double)row["PositionZ"]
+ );
+ prim.GroupPosition = new Vector3(
+ (float)(double)row["GroupPositionX"],
+ (float)(double)row["GroupPositionY"],
+ (float)(double)row["GroupPositionZ"]
+ );
+ prim.Velocity = new Vector3(
+ (float)(double)row["VelocityX"],
+ (float)(double)row["VelocityY"],
+ (float)(double)row["VelocityZ"]
+ );
+ prim.AngularVelocity = new Vector3(
+ (float)(double)row["AngularVelocityX"],
+ (float)(double)row["AngularVelocityY"],
+ (float)(double)row["AngularVelocityZ"]
+ );
+ prim.Acceleration = new Vector3(
+ (float)(double)row["AccelerationX"],
+ (float)(double)row["AccelerationY"],
+ (float)(double)row["AccelerationZ"]
+ );
+ // quaternions
+ prim.RotationOffset = new Quaternion(
+ (float)(double)row["RotationX"],
+ (float)(double)row["RotationY"],
+ (float)(double)row["RotationZ"],
+ (float)(double)row["RotationW"]
+ );
+ prim.SitTargetPositionLL = new Vector3(
+ (float)(double)row["SitTargetOffsetX"],
+ (float)(double)row["SitTargetOffsetY"],
+ (float)(double)row["SitTargetOffsetZ"]
+ );
+ prim.SitTargetOrientationLL = new Quaternion(
+ (float)(double)row["SitTargetOrientX"],
+ (float)(double)row["SitTargetOrientY"],
+ (float)(double)row["SitTargetOrientZ"],
+ (float)(double)row["SitTargetOrientW"]
+ );
+
+ prim.PayPrice[0] = (int)row["PayPrice"];
+ prim.PayPrice[1] = (int)row["PayButton1"];
+ prim.PayPrice[2] = (int)row["PayButton2"];
+ prim.PayPrice[3] = (int)row["PayButton3"];
+ prim.PayPrice[4] = (int)row["PayButton4"];
+
+ prim.Sound = DBGuid.FromDB(row["LoopedSound"].ToString());
+ prim.SoundGain = (float)(double)row["LoopedSoundGain"];
+ prim.SoundFlags = 1; // If it's persisted at all, it's looped
+
+ if (!(row["TextureAnimation"] is DBNull))
+ prim.TextureAnimation = (byte[])row["TextureAnimation"];
+ if (!(row["ParticleSystem"] is DBNull))
+ prim.ParticleSystem = (byte[])row["ParticleSystem"];
+
+ prim.AngularVelocity = new Vector3(
+ (float)(double)row["OmegaX"],
+ (float)(double)row["OmegaY"],
+ (float)(double)row["OmegaZ"]
+ );
+
+ prim.SetCameraEyeOffset(new Vector3(
+ (float)(double)row["CameraEyeOffsetX"],
+ (float)(double)row["CameraEyeOffsetY"],
+ (float)(double)row["CameraEyeOffsetZ"]
+ ));
+
+ prim.SetCameraAtOffset(new Vector3(
+ (float)(double)row["CameraAtOffsetX"],
+ (float)(double)row["CameraAtOffsetY"],
+ (float)(double)row["CameraAtOffsetZ"]
+ ));
+
+ prim.SetForceMouselook((sbyte)row["ForceMouselook"] != 0);
+ prim.ScriptAccessPin = (int)row["ScriptAccessPin"];
+ prim.AllowedDrop = ((sbyte)row["AllowedDrop"] != 0);
+ prim.DIE_AT_EDGE = ((sbyte)row["DieAtEdge"] != 0);
+
+ prim.SalePrice = (int)row["SalePrice"];
+ prim.ObjectSaleType = unchecked((byte)(sbyte)row["SaleType"]);
+
+ prim.Material = unchecked((byte)(sbyte)row["Material"]);
+
+ if (!(row["ClickAction"] is DBNull))
+ prim.ClickAction = unchecked((byte)(sbyte)row["ClickAction"]);
+
+ prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]);
+ prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
+
+ prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
+ prim.LinkNum = (int)row["LinkNumber"];
+
+ if (!(row["MediaURL"] is System.DBNull))
+ prim.MediaUrl = (string)row["MediaURL"];
+
+ return prim;
+ }
+
+
+ ///
+ /// Build a prim inventory item from the persisted data.
+ ///
+ ///
+ ///
+ private static TaskInventoryItem BuildItem(IDataReader row)
+ {
+ TaskInventoryItem taskItem = new TaskInventoryItem();
+
+ taskItem.ItemID = DBGuid.FromDB(row["itemID"]);
+ taskItem.ParentPartID = DBGuid.FromDB(row["primID"]);
+ taskItem.AssetID = DBGuid.FromDB(row["assetID"]);
+ taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]);
+
+ taskItem.InvType = Convert.ToInt32(row["invType"]);
+ taskItem.Type = Convert.ToInt32(row["assetType"]);
+
+ taskItem.Name = (String)row["name"];
+ taskItem.Description = (String)row["description"];
+ taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
+ taskItem.CreatorID = DBGuid.FromDB(row["creatorID"]);
+ taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]);
+ taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]);
+ taskItem.GroupID = DBGuid.FromDB(row["groupID"]);
+
+ taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
+ taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
+ taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
+ taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
+ taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
+ taskItem.Flags = Convert.ToUInt32(row["flags"]);
+
+ return taskItem;
+ }
+
+ private static RegionSettings BuildRegionSettings(IDataReader row)
+ {
+ RegionSettings newSettings = new RegionSettings();
+
+ newSettings.RegionUUID = DBGuid.FromDB(row["regionUUID"]);
+ newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
+ newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
+ newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
+ newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
+ newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
+ newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
+ newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
+ newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
+ newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
+ newSettings.Maturity = Convert.ToInt32(row["maturity"]);
+ newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
+ newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
+ newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
+ newSettings.TerrainTexture1 = DBGuid.FromDB(row["terrain_texture_1"]);
+ newSettings.TerrainTexture2 = DBGuid.FromDB(row["terrain_texture_2"]);
+ newSettings.TerrainTexture3 = DBGuid.FromDB(row["terrain_texture_3"]);
+ newSettings.TerrainTexture4 = DBGuid.FromDB(row["terrain_texture_4"]);
+ newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
+ newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
+ newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
+ newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
+ newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
+ newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
+ newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
+ newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
+ newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
+ newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
+ newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
+ newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
+ newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
+ newSettings.SunVector = new Vector3 (
+ Convert.ToSingle(row["sunvectorx"]),
+ Convert.ToSingle(row["sunvectory"]),
+ Convert.ToSingle(row["sunvectorz"])
+ );
+ newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
+ newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
+ newSettings.Covenant = DBGuid.FromDB(row["covenant"]);
+
+ newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
+
+ if (row["loaded_creation_id"] is DBNull)
+ newSettings.LoadedCreationID = "";
+ else
+ newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
+
+ newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]);
+
+ return newSettings;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static LandData BuildLandData(IDataReader row)
+ {
+ LandData newData = new LandData();
+
+ newData.GlobalID = DBGuid.FromDB(row["UUID"]);
+ newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
+
+ // Bitmap is a byte[512]
+ newData.Bitmap = (Byte[]) row["Bitmap"];
+
+ newData.Name = (String) row["Name"];
+ newData.Description = (String) row["Description"];
+ newData.OwnerID = DBGuid.FromDB(row["OwnerUUID"]);
+ newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
+ newData.Area = Convert.ToInt32(row["Area"]);
+ newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unimplemented
+ newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]);
+ //Enum libsecondlife.Parcel.ParcelCategory
+ newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
+ newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
+ newData.GroupID = DBGuid.FromDB(row["GroupUUID"]);
+ newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
+ newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]);
+ //Enum. libsecondlife.Parcel.ParcelStatus
+ newData.Flags = Convert.ToUInt32(row["LandFlags"]);
+ newData.LandingType = Convert.ToByte(row["LandingType"]);
+ newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
+ newData.MediaID = DBGuid.FromDB(row["MediaTextureUUID"]);
+ newData.MediaURL = (String) row["MediaURL"];
+ newData.MusicURL = (String) row["MusicURL"];
+ newData.PassHours = Convert.ToSingle(row["PassHours"]);
+ newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
+ UUID authedbuyer = UUID.Zero;
+ UUID snapshotID = UUID.Zero;
+
+ UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer);
+ UUID.TryParse((string)row["SnapshotUUID"], out snapshotID);
+ newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
+
+ newData.AuthBuyerID = authedbuyer;
+ newData.SnapshotID = snapshotID;
+ try
+ {
+ newData.UserLocation =
+ new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
+ Convert.ToSingle(row["UserLocationZ"]));
+ newData.UserLookAt =
+ new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
+ Convert.ToSingle(row["UserLookAtZ"]));
+ }
+ catch (InvalidCastException)
+ {
+ newData.UserLocation = Vector3.Zero;
+ newData.UserLookAt = Vector3.Zero;
+ m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
+ }
+
+ newData.MediaDescription = (string) row["MediaDescription"];
+ newData.MediaType = (string) row["MediaType"];
+ newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
+ newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
+ newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
+ newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
+ newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
+
+ newData.ParcelAccessList = new List();
+
+ return newData;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row)
+ {
+ ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
+ entry.AgentID = DBGuid.FromDB(row["AccessUUID"]);
+ entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]);
+ entry.Time = new DateTime();
+ return entry;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static Array SerializeTerrain(double[,] val)
+ {
+ MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
+ BinaryWriter bw = new BinaryWriter(str);
+
+ // TODO: COMPATIBILITY - Add byte-order conversions
+ for (int x = 0; x < (int)Constants.RegionSize; x++)
+ for (int y = 0; y < (int)Constants.RegionSize; y++)
+ {
+ double height = val[x, y];
+ if (height == 0.0)
+ height = double.Epsilon;
+
+ bw.Write(height);
+ }
+
+ return str.ToArray();
+ }
+
+ ///
+ /// Fill the prim command with prim values
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void FillPrimCommand(MySqlCommand cmd, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
+ {
+ cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString());
+ cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
+ cmd.Parameters.AddWithValue("CreationDate", prim.CreationDate);
+ cmd.Parameters.AddWithValue("Name", prim.Name);
+ cmd.Parameters.AddWithValue("SceneGroupID", sceneGroupID.ToString());
+ // the UUID of the root part for this SceneObjectGroup
+ // various text fields
+ cmd.Parameters.AddWithValue("Text", prim.Text);
+ cmd.Parameters.AddWithValue("ColorR", prim.Color.R);
+ cmd.Parameters.AddWithValue("ColorG", prim.Color.G);
+ cmd.Parameters.AddWithValue("ColorB", prim.Color.B);
+ cmd.Parameters.AddWithValue("ColorA", prim.Color.A);
+ cmd.Parameters.AddWithValue("Description", prim.Description);
+ cmd.Parameters.AddWithValue("SitName", prim.SitName);
+ cmd.Parameters.AddWithValue("TouchName", prim.TouchName);
+ // permissions
+ cmd.Parameters.AddWithValue("ObjectFlags", (uint)prim.Flags);
+ cmd.Parameters.AddWithValue("CreatorID", prim.CreatorID.ToString());
+ cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString());
+ cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString());
+ cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString());
+ cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask);
+ cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask);
+ cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask);
+ cmd.Parameters.AddWithValue("EveryoneMask", prim.EveryoneMask);
+ cmd.Parameters.AddWithValue("BaseMask", prim.BaseMask);
+ // vectors
+ cmd.Parameters.AddWithValue("PositionX", (double)prim.OffsetPosition.X);
+ cmd.Parameters.AddWithValue("PositionY", (double)prim.OffsetPosition.Y);
+ cmd.Parameters.AddWithValue("PositionZ", (double)prim.OffsetPosition.Z);
+ cmd.Parameters.AddWithValue("GroupPositionX", (double)prim.GroupPosition.X);
+ cmd.Parameters.AddWithValue("GroupPositionY", (double)prim.GroupPosition.Y);
+ cmd.Parameters.AddWithValue("GroupPositionZ", (double)prim.GroupPosition.Z);
+ cmd.Parameters.AddWithValue("VelocityX", (double)prim.Velocity.X);
+ cmd.Parameters.AddWithValue("VelocityY", (double)prim.Velocity.Y);
+ cmd.Parameters.AddWithValue("VelocityZ", (double)prim.Velocity.Z);
+ cmd.Parameters.AddWithValue("AngularVelocityX", (double)prim.AngularVelocity.X);
+ cmd.Parameters.AddWithValue("AngularVelocityY", (double)prim.AngularVelocity.Y);
+ cmd.Parameters.AddWithValue("AngularVelocityZ", (double)prim.AngularVelocity.Z);
+ cmd.Parameters.AddWithValue("AccelerationX", (double)prim.Acceleration.X);
+ cmd.Parameters.AddWithValue("AccelerationY", (double)prim.Acceleration.Y);
+ cmd.Parameters.AddWithValue("AccelerationZ", (double)prim.Acceleration.Z);
+ // quaternions
+ cmd.Parameters.AddWithValue("RotationX", (double)prim.RotationOffset.X);
+ cmd.Parameters.AddWithValue("RotationY", (double)prim.RotationOffset.Y);
+ cmd.Parameters.AddWithValue("RotationZ", (double)prim.RotationOffset.Z);
+ cmd.Parameters.AddWithValue("RotationW", (double)prim.RotationOffset.W);
+
+ // Sit target
+ Vector3 sitTargetPos = prim.SitTargetPositionLL;
+ cmd.Parameters.AddWithValue("SitTargetOffsetX", (double)sitTargetPos.X);
+ cmd.Parameters.AddWithValue("SitTargetOffsetY", (double)sitTargetPos.Y);
+ cmd.Parameters.AddWithValue("SitTargetOffsetZ", (double)sitTargetPos.Z);
+
+ Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
+ cmd.Parameters.AddWithValue("SitTargetOrientW", (double)sitTargetOrient.W);
+ cmd.Parameters.AddWithValue("SitTargetOrientX", (double)sitTargetOrient.X);
+ cmd.Parameters.AddWithValue("SitTargetOrientY", (double)sitTargetOrient.Y);
+ cmd.Parameters.AddWithValue("SitTargetOrientZ", (double)sitTargetOrient.Z);
+
+ cmd.Parameters.AddWithValue("PayPrice", prim.PayPrice[0]);
+ cmd.Parameters.AddWithValue("PayButton1", prim.PayPrice[1]);
+ cmd.Parameters.AddWithValue("PayButton2", prim.PayPrice[2]);
+ cmd.Parameters.AddWithValue("PayButton3", prim.PayPrice[3]);
+ cmd.Parameters.AddWithValue("PayButton4", prim.PayPrice[4]);
+
+ if ((prim.SoundFlags & 1) != 0) // Looped
+ {
+ cmd.Parameters.AddWithValue("LoopedSound", prim.Sound.ToString());
+ cmd.Parameters.AddWithValue("LoopedSoundGain", prim.SoundGain);
+ }
+ else
+ {
+ cmd.Parameters.AddWithValue("LoopedSound", UUID.Zero);
+ cmd.Parameters.AddWithValue("LoopedSoundGain", 0.0f);
+ }
+
+ cmd.Parameters.AddWithValue("TextureAnimation", prim.TextureAnimation);
+ cmd.Parameters.AddWithValue("ParticleSystem", prim.ParticleSystem);
+
+ cmd.Parameters.AddWithValue("OmegaX", (double)prim.AngularVelocity.X);
+ cmd.Parameters.AddWithValue("OmegaY", (double)prim.AngularVelocity.Y);
+ cmd.Parameters.AddWithValue("OmegaZ", (double)prim.AngularVelocity.Z);
+
+ cmd.Parameters.AddWithValue("CameraEyeOffsetX", (double)prim.GetCameraEyeOffset().X);
+ cmd.Parameters.AddWithValue("CameraEyeOffsetY", (double)prim.GetCameraEyeOffset().Y);
+ cmd.Parameters.AddWithValue("CameraEyeOffsetZ", (double)prim.GetCameraEyeOffset().Z);
+
+ cmd.Parameters.AddWithValue("CameraAtOffsetX", (double)prim.GetCameraAtOffset().X);
+ cmd.Parameters.AddWithValue("CameraAtOffsetY", (double)prim.GetCameraAtOffset().Y);
+ cmd.Parameters.AddWithValue("CameraAtOffsetZ", (double)prim.GetCameraAtOffset().Z);
+
+ if (prim.GetForceMouselook())
+ cmd.Parameters.AddWithValue("ForceMouselook", 1);
+ else
+ cmd.Parameters.AddWithValue("ForceMouselook", 0);
+
+ cmd.Parameters.AddWithValue("ScriptAccessPin", prim.ScriptAccessPin);
+
+ if (prim.AllowedDrop)
+ cmd.Parameters.AddWithValue("AllowedDrop", 1);
+ else
+ cmd.Parameters.AddWithValue("AllowedDrop", 0);
+
+ if (prim.DIE_AT_EDGE)
+ cmd.Parameters.AddWithValue("DieAtEdge", 1);
+ else
+ cmd.Parameters.AddWithValue("DieAtEdge", 0);
+
+ cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice);
+ cmd.Parameters.AddWithValue("SaleType", unchecked((sbyte)(prim.ObjectSaleType)));
+
+ byte clickAction = prim.ClickAction;
+ cmd.Parameters.AddWithValue("ClickAction", unchecked((sbyte)(clickAction)));
+
+ cmd.Parameters.AddWithValue("Material", unchecked((sbyte)(prim.Material)));
+
+ cmd.Parameters.AddWithValue("CollisionSound", prim.CollisionSound.ToString());
+ cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume);
+
+ if (prim.PassTouches)
+ cmd.Parameters.AddWithValue("PassTouches", 1);
+ else
+ cmd.Parameters.AddWithValue("PassTouches", 0);
+
+ cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
+ cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void FillItemCommand(MySqlCommand cmd, TaskInventoryItem taskItem)
+ {
+ cmd.Parameters.AddWithValue("itemID", taskItem.ItemID);
+ cmd.Parameters.AddWithValue("primID", taskItem.ParentPartID);
+ cmd.Parameters.AddWithValue("assetID", taskItem.AssetID);
+ cmd.Parameters.AddWithValue("parentFolderID", taskItem.ParentID);
+
+ cmd.Parameters.AddWithValue("invType", taskItem.InvType);
+ cmd.Parameters.AddWithValue("assetType", taskItem.Type);
+
+ cmd.Parameters.AddWithValue("name", taskItem.Name);
+ cmd.Parameters.AddWithValue("description", taskItem.Description);
+ cmd.Parameters.AddWithValue("creationDate", taskItem.CreationDate);
+ cmd.Parameters.AddWithValue("creatorID", taskItem.CreatorID);
+ cmd.Parameters.AddWithValue("ownerID", taskItem.OwnerID);
+ cmd.Parameters.AddWithValue("lastOwnerID", taskItem.LastOwnerID);
+ cmd.Parameters.AddWithValue("groupID", taskItem.GroupID);
+ cmd.Parameters.AddWithValue("nextPermissions", taskItem.NextPermissions);
+ cmd.Parameters.AddWithValue("currentPermissions", taskItem.CurrentPermissions);
+ cmd.Parameters.AddWithValue("basePermissions", taskItem.BasePermissions);
+ cmd.Parameters.AddWithValue("everyonePermissions", taskItem.EveryonePermissions);
+ cmd.Parameters.AddWithValue("groupPermissions", taskItem.GroupPermissions);
+ cmd.Parameters.AddWithValue("flags", taskItem.Flags);
+ }
+
+ ///
+ ///
+ ///
+ private static void FillRegionSettingsCommand(MySqlCommand cmd, RegionSettings settings)
+ {
+ cmd.Parameters.AddWithValue("RegionUUID", settings.RegionUUID.ToString());
+ cmd.Parameters.AddWithValue("BlockTerraform", settings.BlockTerraform);
+ cmd.Parameters.AddWithValue("BlockFly", settings.BlockFly);
+ cmd.Parameters.AddWithValue("AllowDamage", settings.AllowDamage);
+ cmd.Parameters.AddWithValue("RestrictPushing", settings.RestrictPushing);
+ cmd.Parameters.AddWithValue("AllowLandResell", settings.AllowLandResell);
+ cmd.Parameters.AddWithValue("AllowLandJoinDivide", settings.AllowLandJoinDivide);
+ cmd.Parameters.AddWithValue("BlockShowInSearch", settings.BlockShowInSearch);
+ cmd.Parameters.AddWithValue("AgentLimit", settings.AgentLimit);
+ cmd.Parameters.AddWithValue("ObjectBonus", settings.ObjectBonus);
+ cmd.Parameters.AddWithValue("Maturity", settings.Maturity);
+ cmd.Parameters.AddWithValue("DisableScripts", settings.DisableScripts);
+ cmd.Parameters.AddWithValue("DisableCollisions", settings.DisableCollisions);
+ cmd.Parameters.AddWithValue("DisablePhysics", settings.DisablePhysics);
+ cmd.Parameters.AddWithValue("TerrainTexture1", settings.TerrainTexture1.ToString());
+ cmd.Parameters.AddWithValue("TerrainTexture2", settings.TerrainTexture2.ToString());
+ cmd.Parameters.AddWithValue("TerrainTexture3", settings.TerrainTexture3.ToString());
+ cmd.Parameters.AddWithValue("TerrainTexture4", settings.TerrainTexture4.ToString());
+ cmd.Parameters.AddWithValue("Elevation1NW", settings.Elevation1NW);
+ cmd.Parameters.AddWithValue("Elevation2NW", settings.Elevation2NW);
+ cmd.Parameters.AddWithValue("Elevation1NE", settings.Elevation1NE);
+ cmd.Parameters.AddWithValue("Elevation2NE", settings.Elevation2NE);
+ cmd.Parameters.AddWithValue("Elevation1SE", settings.Elevation1SE);
+ cmd.Parameters.AddWithValue("Elevation2SE", settings.Elevation2SE);
+ cmd.Parameters.AddWithValue("Elevation1SW", settings.Elevation1SW);
+ cmd.Parameters.AddWithValue("Elevation2SW", settings.Elevation2SW);
+ cmd.Parameters.AddWithValue("WaterHeight", settings.WaterHeight);
+ cmd.Parameters.AddWithValue("TerrainRaiseLimit", settings.TerrainRaiseLimit);
+ cmd.Parameters.AddWithValue("TerrainLowerLimit", settings.TerrainLowerLimit);
+ cmd.Parameters.AddWithValue("UseEstateSun", settings.UseEstateSun);
+ cmd.Parameters.AddWithValue("Sandbox", settings.Sandbox);
+ cmd.Parameters.AddWithValue("SunVectorX", settings.SunVector.X);
+ cmd.Parameters.AddWithValue("SunVectorY", settings.SunVector.Y);
+ cmd.Parameters.AddWithValue("SunVectorZ", settings.SunVector.Z);
+ cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun);
+ cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition);
+ cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
+ cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
+ cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
+ cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
+
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void FillLandCommand(MySqlCommand cmd, LandData land, UUID regionUUID)
+ {
+ cmd.Parameters.AddWithValue("UUID", land.GlobalID.ToString());
+ cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
+ cmd.Parameters.AddWithValue("LocalLandID", land.LocalID);
+
+ // Bitmap is a byte[512]
+ cmd.Parameters.AddWithValue("Bitmap", land.Bitmap);
+
+ cmd.Parameters.AddWithValue("Name", land.Name);
+ cmd.Parameters.AddWithValue("Description", land.Description);
+ cmd.Parameters.AddWithValue("OwnerUUID", land.OwnerID.ToString());
+ cmd.Parameters.AddWithValue("IsGroupOwned", land.IsGroupOwned);
+ cmd.Parameters.AddWithValue("Area", land.Area);
+ cmd.Parameters.AddWithValue("AuctionID", land.AuctionID); //Unemplemented
+ cmd.Parameters.AddWithValue("Category", land.Category); //Enum libsecondlife.Parcel.ParcelCategory
+ cmd.Parameters.AddWithValue("ClaimDate", land.ClaimDate);
+ cmd.Parameters.AddWithValue("ClaimPrice", land.ClaimPrice);
+ cmd.Parameters.AddWithValue("GroupUUID", land.GroupID.ToString());
+ cmd.Parameters.AddWithValue("SalePrice", land.SalePrice);
+ cmd.Parameters.AddWithValue("LandStatus", land.Status); //Enum. libsecondlife.Parcel.ParcelStatus
+ cmd.Parameters.AddWithValue("LandFlags", land.Flags);
+ cmd.Parameters.AddWithValue("LandingType", land.LandingType);
+ cmd.Parameters.AddWithValue("MediaAutoScale", land.MediaAutoScale);
+ cmd.Parameters.AddWithValue("MediaTextureUUID", land.MediaID.ToString());
+ cmd.Parameters.AddWithValue("MediaURL", land.MediaURL);
+ cmd.Parameters.AddWithValue("MusicURL", land.MusicURL);
+ cmd.Parameters.AddWithValue("PassHours", land.PassHours);
+ cmd.Parameters.AddWithValue("PassPrice", land.PassPrice);
+ cmd.Parameters.AddWithValue("SnapshotUUID", land.SnapshotID.ToString());
+ cmd.Parameters.AddWithValue("UserLocationX", land.UserLocation.X);
+ cmd.Parameters.AddWithValue("UserLocationY", land.UserLocation.Y);
+ cmd.Parameters.AddWithValue("UserLocationZ", land.UserLocation.Z);
+ cmd.Parameters.AddWithValue("UserLookAtX", land.UserLookAt.X);
+ cmd.Parameters.AddWithValue("UserLookAtY", land.UserLookAt.Y);
+ cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z);
+ cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
+ cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
+ cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
+ cmd.Parameters.AddWithValue("MediaType", land.MediaType);
+ cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);
+ cmd.Parameters.AddWithValue("MediaHeight", land.MediaHeight);
+ cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop);
+ cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic);
+ cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia);
+
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void FillLandAccessCommand(MySqlCommand cmd, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
+ {
+ cmd.Parameters.AddWithValue("LandUUID", parcelID.ToString());
+ cmd.Parameters.AddWithValue("AccessUUID", entry.AgentID.ToString());
+ cmd.Parameters.AddWithValue("Flags", entry.Flags);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private PrimitiveBaseShape BuildShape(IDataReader row)
+ {
+ PrimitiveBaseShape s = new PrimitiveBaseShape();
+ s.Scale = new Vector3(
+ (float)(double)row["ScaleX"],
+ (float)(double)row["ScaleY"],
+ (float)(double)row["ScaleZ"]
+ );
+ // paths
+ s.PCode = (byte)(int)row["PCode"];
+ s.PathBegin = (ushort)(int)row["PathBegin"];
+ s.PathEnd = (ushort)(int)row["PathEnd"];
+ s.PathScaleX = (byte)(int)row["PathScaleX"];
+ s.PathScaleY = (byte)(int)row["PathScaleY"];
+ s.PathShearX = (byte)(int)row["PathShearX"];
+ s.PathShearY = (byte)(int)row["PathShearY"];
+ s.PathSkew = (sbyte)(int)row["PathSkew"];
+ s.PathCurve = (byte)(int)row["PathCurve"];
+ s.PathRadiusOffset = (sbyte)(int)row["PathRadiusOffset"];
+ s.PathRevolutions = (byte)(int)row["PathRevolutions"];
+ s.PathTaperX = (sbyte)(int)row["PathTaperX"];
+ s.PathTaperY = (sbyte)(int)row["PathTaperY"];
+ s.PathTwist = (sbyte)(int)row["PathTwist"];
+ s.PathTwistBegin = (sbyte)(int)row["PathTwistBegin"];
+ // profile
+ s.ProfileBegin = (ushort)(int)row["ProfileBegin"];
+ s.ProfileEnd = (ushort)(int)row["ProfileEnd"];
+ s.ProfileCurve = (byte)(int)row["ProfileCurve"];
+ s.ProfileHollow = (ushort)(int)row["ProfileHollow"];
+ s.TextureEntry = (byte[])row["Texture"];
+
+ s.ExtraParams = (byte[])row["ExtraParams"];
+
+ s.State = (byte)(int)row["State"];
+
+ if (!(row["Media"] is System.DBNull))
+ s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
+
+ return s;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void FillShapeCommand(MySqlCommand cmd, SceneObjectPart prim)
+ {
+ PrimitiveBaseShape s = prim.Shape;
+ cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString());
+ // shape is an enum
+ cmd.Parameters.AddWithValue("Shape", 0);
+ // vectors
+ cmd.Parameters.AddWithValue("ScaleX", (double)s.Scale.X);
+ cmd.Parameters.AddWithValue("ScaleY", (double)s.Scale.Y);
+ cmd.Parameters.AddWithValue("ScaleZ", (double)s.Scale.Z);
+ // paths
+ cmd.Parameters.AddWithValue("PCode", s.PCode);
+ cmd.Parameters.AddWithValue("PathBegin", s.PathBegin);
+ cmd.Parameters.AddWithValue("PathEnd", s.PathEnd);
+ cmd.Parameters.AddWithValue("PathScaleX", s.PathScaleX);
+ cmd.Parameters.AddWithValue("PathScaleY", s.PathScaleY);
+ cmd.Parameters.AddWithValue("PathShearX", s.PathShearX);
+ cmd.Parameters.AddWithValue("PathShearY", s.PathShearY);
+ cmd.Parameters.AddWithValue("PathSkew", s.PathSkew);
+ cmd.Parameters.AddWithValue("PathCurve", s.PathCurve);
+ cmd.Parameters.AddWithValue("PathRadiusOffset", s.PathRadiusOffset);
+ cmd.Parameters.AddWithValue("PathRevolutions", s.PathRevolutions);
+ cmd.Parameters.AddWithValue("PathTaperX", s.PathTaperX);
+ cmd.Parameters.AddWithValue("PathTaperY", s.PathTaperY);
+ cmd.Parameters.AddWithValue("PathTwist", s.PathTwist);
+ cmd.Parameters.AddWithValue("PathTwistBegin", s.PathTwistBegin);
+ // profile
+ cmd.Parameters.AddWithValue("ProfileBegin", s.ProfileBegin);
+ cmd.Parameters.AddWithValue("ProfileEnd", s.ProfileEnd);
+ cmd.Parameters.AddWithValue("ProfileCurve", s.ProfileCurve);
+ cmd.Parameters.AddWithValue("ProfileHollow", s.ProfileHollow);
+ cmd.Parameters.AddWithValue("Texture", s.TextureEntry);
+ cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams);
+ cmd.Parameters.AddWithValue("State", s.State);
+ cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
+ }
+
+ public void StorePrimInventory(UUID primID, ICollection items)
+ {
+ lock (m_dbLock)
+ {
+ RemoveItems(primID);
+
+ using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
+ {
+ dbcon.Open();
+
+ MySqlCommand cmd = dbcon.CreateCommand();
+
+ if (items.Count == 0)
+ return;
+
+ cmd.CommandText = "insert into primitems (" +
+ "invType, assetType, name, " +
+ "description, creationDate, nextPermissions, " +
+ "currentPermissions, basePermissions, " +
+ "everyonePermissions, groupPermissions, " +
+ "flags, itemID, primID, assetID, " +
+ "parentFolderID, creatorID, ownerID, " +
+ "groupID, lastOwnerID) values (?invType, " +
+ "?assetType, ?name, ?description, " +
+ "?creationDate, ?nextPermissions, " +
+ "?currentPermissions, ?basePermissions, " +
+ "?everyonePermissions, ?groupPermissions, " +
+ "?flags, ?itemID, ?primID, ?assetID, " +
+ "?parentFolderID, ?creatorID, ?ownerID, " +
+ "?groupID, ?lastOwnerID)";
+
+ foreach (TaskInventoryItem item in items)
+ {
+ cmd.Parameters.Clear();
+
+ FillItemCommand(cmd, item);
+
+ ExecuteNonQuery(cmd);
+ }
+
+ cmd.Dispose();
+ }
+ }
+ }
+ }
+}
diff --git a/OpenSim/Data/Null/NullDataStore.cs b/OpenSim/Data/Null/NullDataStore.cs
deleted file mode 100644
index 3ba44bb..0000000
--- a/OpenSim/Data/Null/NullDataStore.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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 OpenSimulator 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.Collections.Generic;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Data.Null
-{
- ///
- /// NULL DataStore, do not store anything
- ///
- public class NullDataStore : IRegionDataStore
- {
- public void Initialise(string dbfile)
- {
- return;
- }
-
- public void Dispose()
- {
- }
-
- public void StoreRegionSettings(RegionSettings rs)
- {
- }
- public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
- {
- //This connector doesn't support the windlight module yet
- //Return default LL windlight settings
- return new RegionLightShareData();
- }
- public void StoreRegionWindlightSettings(RegionLightShareData wl)
- {
- //This connector doesn't support the windlight module yet
- }
- public RegionSettings LoadRegionSettings(UUID regionUUID)
- {
- return null;
- }
-
- public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
- {
- }
-
- public void RemoveObject(UUID obj, UUID regionUUID)
- {
- }
-
- // see IRegionDatastore
- public void StorePrimInventory(UUID primID, ICollection items)
- {
- }
-
- public List LoadObjects(UUID regionUUID)
- {
- return new List();
- }
-
- public void StoreTerrain(double[,] ter, UUID regionID)
- {
- }
-
- public double[,] LoadTerrain(UUID regionID)
- {
- return null;
- }
-
- public void RemoveLandObject(UUID globalID)
- {
- }
-
- public void StoreLandObject(ILandObject land)
- {
- }
-
- public List LoadLandObjects(UUID regionUUID)
- {
- return new List();
- }
-
- public void Shutdown()
- {
- }
- }
-}
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs
new file mode 100644
index 0000000..9c7da8e
--- /dev/null
+++ b/OpenSim/Data/Null/NullSimulationData.cs
@@ -0,0 +1,112 @@
+/*
+ * 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 OpenSimulator 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.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Data.Null
+{
+ ///
+ /// NULL DataStore, do not store anything
+ ///
+ public class NullSimulationData : ISimulationDataStore
+ {
+ public void Initialise(string dbfile)
+ {
+ return;
+ }
+
+ public void Dispose()
+ {
+ }
+
+ public void StoreRegionSettings(RegionSettings rs)
+ {
+ }
+ public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
+ {
+ //This connector doesn't support the windlight module yet
+ //Return default LL windlight settings
+ return new RegionLightShareData();
+ }
+ public void StoreRegionWindlightSettings(RegionLightShareData wl)
+ {
+ //This connector doesn't support the windlight module yet
+ }
+ public RegionSettings LoadRegionSettings(UUID regionUUID)
+ {
+ return null;
+ }
+
+ public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
+ {
+ }
+
+ public void RemoveObject(UUID obj, UUID regionUUID)
+ {
+ }
+
+ // see IRegionDatastore
+ public void StorePrimInventory(UUID primID, ICollection items)
+ {
+ }
+
+ public List LoadObjects(UUID regionUUID)
+ {
+ return new List();
+ }
+
+ public void StoreTerrain(double[,] ter, UUID regionID)
+ {
+ }
+
+ public double[,] LoadTerrain(UUID regionID)
+ {
+ return null;
+ }
+
+ public void RemoveLandObject(UUID globalID)
+ {
+ }
+
+ public void StoreLandObject(ILandObject land)
+ {
+ }
+
+ public List LoadLandObjects(UUID regionUUID)
+ {
+ return new List();
+ }
+
+ public void Shutdown()
+ {
+ }
+ }
+}
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
deleted file mode 100644
index 88699a7..0000000
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ /dev/null
@@ -1,2355 +0,0 @@
-/*
- * 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 OpenSimulator 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;
-using System.Collections.Generic;
-using System.Data;
-using System.Drawing;
-using System.IO;
-using System.Reflection;
-using log4net;
-using Mono.Data.Sqlite;
-using OpenMetaverse;
-using OpenMetaverse.StructuredData;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Data.SQLite
-{
- ///
- /// A RegionData Interface to the SQLite database
- ///
- public class SQLiteRegionData : IRegionDataStore
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private const string primSelect = "select * from prims";
- private const string shapeSelect = "select * from primshapes";
- private const string itemsSelect = "select * from primitems";
- private const string terrainSelect = "select * from terrain limit 1";
- private const string landSelect = "select * from land";
- private const string landAccessListSelect = "select distinct * from landaccesslist";
- private const string regionbanListSelect = "select * from regionban";
- private const string regionSettingsSelect = "select * from regionsettings";
-
- private DataSet ds;
- private SqliteDataAdapter primDa;
- private SqliteDataAdapter shapeDa;
- private SqliteDataAdapter itemsDa;
- private SqliteDataAdapter terrainDa;
- private SqliteDataAdapter landDa;
- private SqliteDataAdapter landAccessListDa;
- private SqliteDataAdapter regionSettingsDa;
-
- private SqliteConnection m_conn;
-
- private String m_connectionString;
-
- // Temporary attribute while this is experimental
-
- /***********************************************************************
- *
- * Public Interface Functions
- *
- **********************************************************************/
-
- ///
- /// See IRegionDataStore
- ///
- /// - Initialises RegionData Interface
- /// - Loads and initialises a new SQLite connection and maintains it.
- ///
- ///
- /// the connection string
- public void Initialise(string connectionString)
- {
- try
- {
- m_connectionString = connectionString;
-
- ds = new DataSet("Region");
-
- m_log.Info("[SQLITE REGION DB]: Sqlite - connecting: " + connectionString);
- m_conn = new SqliteConnection(m_connectionString);
- m_conn.Open();
-
- SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
- primDa = new SqliteDataAdapter(primSelectCmd);
-
- SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
- shapeDa = new SqliteDataAdapter(shapeSelectCmd);
- // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
-
- SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
- itemsDa = new SqliteDataAdapter(itemsSelectCmd);
-
- SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
- terrainDa = new SqliteDataAdapter(terrainSelectCmd);
-
- SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
- landDa = new SqliteDataAdapter(landSelectCmd);
-
- SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
- landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
-
- SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
- regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
- // This actually does the roll forward assembly stuff
- Assembly assem = GetType().Assembly;
- Migration m = new Migration(m_conn, assem, "RegionStore");
- m.Update();
-
- lock (ds)
- {
- ds.Tables.Add(createPrimTable());
- setupPrimCommands(primDa, m_conn);
-
- ds.Tables.Add(createShapeTable());
- setupShapeCommands(shapeDa, m_conn);
-
- ds.Tables.Add(createItemsTable());
- setupItemsCommands(itemsDa, m_conn);
-
- ds.Tables.Add(createTerrainTable());
- setupTerrainCommands(terrainDa, m_conn);
-
- ds.Tables.Add(createLandTable());
- setupLandCommands(landDa, m_conn);
-
- ds.Tables.Add(createLandAccessListTable());
- setupLandAccessCommands(landAccessListDa, m_conn);
-
- ds.Tables.Add(createRegionSettingsTable());
- setupRegionSettingsCommands(regionSettingsDa, m_conn);
-
- // WORKAROUND: This is a work around for sqlite on
- // windows, which gets really unhappy with blob columns
- // that have no sample data in them. At some point we
- // need to actually find a proper way to handle this.
- try
- {
- primDa.Fill(ds.Tables["prims"]);
- }
- catch (Exception)
- {
- m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table");
- }
-
- try
- {
- shapeDa.Fill(ds.Tables["primshapes"]);
- }
- catch (Exception)
- {
- m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table");
- }
-
- try
- {
- itemsDa.Fill(ds.Tables["primitems"]);
- }
- catch (Exception)
- {
- m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
- }
-
- try
- {
- terrainDa.Fill(ds.Tables["terrain"]);
- }
- catch (Exception)
- {
- m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table");
- }
-
- try
- {
- landDa.Fill(ds.Tables["land"]);
- }
- catch (Exception)
- {
- m_log.Info("[SQLITE REGION DB]: Caught fill error on land table");
- }
-
- try
- {
- landAccessListDa.Fill(ds.Tables["landaccesslist"]);
- }
- catch (Exception)
- {
- m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table");
- }
-
- try
- {
- regionSettingsDa.Fill(ds.Tables["regionsettings"]);
- }
- catch (Exception)
- {
- m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table");
- }
-
- // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
- // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409
- // Possibly because we manually set up our own DataTables before connecting to the database
- CreateDataSetMapping(primDa, "prims");
- CreateDataSetMapping(shapeDa, "primshapes");
- CreateDataSetMapping(itemsDa, "primitems");
- CreateDataSetMapping(terrainDa, "terrain");
- CreateDataSetMapping(landDa, "land");
- CreateDataSetMapping(landAccessListDa, "landaccesslist");
- CreateDataSetMapping(regionSettingsDa, "regionsettings");
- }
- }
- catch (Exception e)
- {
- m_log.Error(e);
- Environment.Exit(23);
- }
-
- return;
- }
-
- public void Dispose()
- {
- if (m_conn != null)
- {
- m_conn.Close();
- m_conn = null;
- }
- if (ds != null)
- {
- ds.Dispose();
- ds = null;
- }
- if (primDa != null)
- {
- primDa.Dispose();
- primDa = null;
- }
- if (shapeDa != null)
- {
- shapeDa.Dispose();
- shapeDa = null;
- }
- if (itemsDa != null)
- {
- itemsDa.Dispose();
- itemsDa = null;
- }
- if (terrainDa != null)
- {
- terrainDa.Dispose();
- terrainDa = null;
- }
- if (landDa != null)
- {
- landDa.Dispose();
- landDa = null;
- }
- if (landAccessListDa != null)
- {
- landAccessListDa.Dispose();
- landAccessListDa = null;
- }
- if (regionSettingsDa != null)
- {
- regionSettingsDa.Dispose();
- regionSettingsDa = null;
- }
- }
-
- public void StoreRegionSettings(RegionSettings rs)
- {
- lock (ds)
- {
- DataTable regionsettings = ds.Tables["regionsettings"];
-
- DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString());
- if (settingsRow == null)
- {
- settingsRow = regionsettings.NewRow();
- fillRegionSettingsRow(settingsRow, rs);
- regionsettings.Rows.Add(settingsRow);
- }
- else
- {
- fillRegionSettingsRow(settingsRow, rs);
- }
-
- Commit();
- }
- }
- public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
- {
- //This connector doesn't support the windlight module yet
- //Return default LL windlight settings
- return new RegionLightShareData();
- }
- public void StoreRegionWindlightSettings(RegionLightShareData wl)
- {
- //This connector doesn't support the windlight module yet
- }
- public RegionSettings LoadRegionSettings(UUID regionUUID)
- {
- lock (ds)
- {
- DataTable regionsettings = ds.Tables["regionsettings"];
-
- string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
- DataRow[] rawsettings = regionsettings.Select(searchExp);
- if (rawsettings.Length == 0)
- {
- RegionSettings rs = new RegionSettings();
- rs.RegionUUID = regionUUID;
- rs.OnSave += StoreRegionSettings;
-
- StoreRegionSettings(rs);
-
- return rs;
- }
- DataRow row = rawsettings[0];
-
- RegionSettings newSettings = buildRegionSettings(row);
- newSettings.OnSave += StoreRegionSettings;
-
- return newSettings;
- }
- }
-
- ///
- /// Adds an object into region storage
- ///
- /// the object
- /// the region UUID
- public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
- {
- uint flags = obj.RootPart.GetEffectiveObjectFlags();
-
- // Eligibility check
- //
- if ((flags & (uint)PrimFlags.Temporary) != 0)
- return;
- if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
- return;
-
- lock (ds)
- {
- foreach (SceneObjectPart prim in obj.Children.Values)
- {
-// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
- addPrim(prim, obj.UUID, regionUUID);
- }
- }
-
- Commit();
- // m_log.Info("[Dump of prims]: " + ds.GetXml());
- }
-
- ///
- /// Removes an object from region storage
- ///
- /// the object
- /// the region UUID
- public void RemoveObject(UUID obj, UUID regionUUID)
- {
- // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID);
-
- DataTable prims = ds.Tables["prims"];
- DataTable shapes = ds.Tables["primshapes"];
-
- string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'";
- lock (ds)
- {
- DataRow[] primRows = prims.Select(selectExp);
- foreach (DataRow row in primRows)
- {
- // Remove shape rows
- UUID uuid = new UUID((string) row["UUID"]);
- DataRow shapeRow = shapes.Rows.Find(uuid.ToString());
- if (shapeRow != null)
- {
- shapeRow.Delete();
- }
-
- RemoveItems(uuid);
-
- // Remove prim row
- row.Delete();
- }
- }
-
- Commit();
- }
-
- ///
- /// Remove all persisted items of the given prim.
- /// The caller must acquire the necessrary synchronization locks and commit or rollback changes.
- ///
- /// The item UUID
- private void RemoveItems(UUID uuid)
- {
- DataTable items = ds.Tables["primitems"];
-
- String sql = String.Format("primID = '{0}'", uuid);
- DataRow[] itemRows = items.Select(sql);
-
- foreach (DataRow itemRow in itemRows)
- {
- itemRow.Delete();
- }
- }
-
- ///
- /// Load persisted objects from region storage.
- ///
- /// The region UUID
- /// List of loaded groups
- public List LoadObjects(UUID regionUUID)
- {
- Dictionary createdObjects = new Dictionary();
-
- List retvals = new List();
-
- DataTable prims = ds.Tables["prims"];
- DataTable shapes = ds.Tables["primshapes"];
-
- string byRegion = "RegionUUID = '" + regionUUID + "'";
-
- lock (ds)
- {
- DataRow[] primsForRegion = prims.Select(byRegion);
-// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
-
- // First, create all groups
- foreach (DataRow primRow in primsForRegion)
- {
- try
- {
- SceneObjectPart prim = null;
-
- string uuid = (string) primRow["UUID"];
- string objID = (string) primRow["SceneGroupID"];
-
- if (uuid == objID) //is new SceneObjectGroup ?
- {
- prim = buildPrim(primRow);
- DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
- if (shapeRow != null)
- {
- prim.Shape = buildShape(shapeRow);
- }
- else
- {
- m_log.Warn(
- "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
- prim.Shape = PrimitiveBaseShape.Default;
- }
-
- SceneObjectGroup group = new SceneObjectGroup(prim);
- createdObjects.Add(group.UUID, group);
- retvals.Add(group);
- LoadItems(prim);
- }
- }
- catch (Exception e)
- {
- m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows");
- m_log.Error("[SQLITE REGION DB]: ", e);
- foreach (DataColumn col in prims.Columns)
- {
- m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
- }
- }
- }
-
- // Now fill the groups with part data
- foreach (DataRow primRow in primsForRegion)
- {
- try
- {
- SceneObjectPart prim = null;
-
- string uuid = (string) primRow["UUID"];
- string objID = (string) primRow["SceneGroupID"];
- if (uuid != objID) //is new SceneObjectGroup ?
- {
- prim = buildPrim(primRow);
- DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
- if (shapeRow != null)
- {
- prim.Shape = buildShape(shapeRow);
- }
- else
- {
- m_log.Warn(
- "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
- prim.Shape = PrimitiveBaseShape.Default;
- }
-
- createdObjects[new UUID(objID)].AddPart(prim);
- LoadItems(prim);
- }
- }
- catch (Exception e)
- {
- m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows");
- m_log.Error("[SQLITE REGION DB]: ", e);
- foreach (DataColumn col in prims.Columns)
- {
- m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
- }
- }
- }
- }
- return retvals;
- }
-
- ///
- /// Load in a prim's persisted inventory.
- ///
- /// the prim
- private void LoadItems(SceneObjectPart prim)
- {
-// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
-
- DataTable dbItems = ds.Tables["primitems"];
- String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
- DataRow[] dbItemRows = dbItems.Select(sql);
- IList inventory = new List();
-
-// m_log.DebugFormat(
-// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
-
- foreach (DataRow row in dbItemRows)
- {
- TaskInventoryItem item = buildItem(row);
- inventory.Add(item);
-
-// m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID);
- }
-
- prim.Inventory.RestoreInventoryItems(inventory);
- }
-
- ///
- /// Store a terrain revision in region storage
- ///
- /// terrain heightfield
- /// region UUID
- public void StoreTerrain(double[,] ter, UUID regionID)
- {
- lock (ds)
- {
- int revision = Util.UnixTimeSinceEpoch();
-
- // This is added to get rid of the infinitely growing
- // terrain databases which negatively impact on SQLite
- // over time. Before reenabling this feature there
- // needs to be a limitter put on the number of
- // revisions in the database, as this old
- // implementation is a DOS attack waiting to happen.
-
- using (
- SqliteCommand cmd =
- new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision",
- m_conn))
- {
- cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
- cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
- cmd.ExecuteNonQuery();
- }
-
- // the following is an work around for .NET. The perf
- // issues associated with it aren't as bad as you think.
- m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString());
- String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
- " values(:RegionUUID, :Revision, :Heightfield)";
-
- using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
- {
- cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
- cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
- cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter)));
- cmd.ExecuteNonQuery();
- }
- }
- }
-
- ///
- /// Load the latest terrain revision from region storage
- ///
- /// the region UUID
- /// Heightfield data
- public double[,] LoadTerrain(UUID regionID)
- {
- lock (ds)
- {
- double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
- terret.Initialize();
-
- String sql = "select RegionUUID, Revision, Heightfield from terrain" +
- " where RegionUUID=:RegionUUID order by Revision desc";
-
- using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
- {
- cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
-
- using (IDataReader row = cmd.ExecuteReader())
- {
- int rev = 0;
- if (row.Read())
- {
- // TODO: put this into a function
- using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"]))
- {
- using (BinaryReader br = new BinaryReader(str))
- {
- for (int x = 0; x < (int)Constants.RegionSize; x++)
- {
- for (int y = 0; y < (int)Constants.RegionSize; y++)
- {
- terret[x, y] = br.ReadDouble();
- }
- }
- }
- }
- rev = Convert.ToInt32(row["Revision"]);
- }
- else
- {
- m_log.Warn("[SQLITE REGION DB]: No terrain found for region");
- return null;
- }
-
- m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString());
- }
- }
- return terret;
- }
- }
-
- ///
- ///
- ///
- ///
- public void RemoveLandObject(UUID globalID)
- {
- lock (ds)
- {
- // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter
- // after you're done.
- // replaced below code with the SqliteAdapter version.
- //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn))
- //{
- // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
- // cmd.ExecuteNonQuery();
- //}
-
- //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn))
- //{
- // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
- // cmd.ExecuteNonQuery();
- //}
-
- DataTable land = ds.Tables["land"];
- DataTable landaccesslist = ds.Tables["landaccesslist"];
- DataRow landRow = land.Rows.Find(globalID.ToString());
- if (landRow != null)
- {
- land.Rows.Remove(landRow);
- }
- List rowsToDelete = new List();
- foreach (DataRow rowToCheck in landaccesslist.Rows)
- {
- if (rowToCheck["LandUUID"].ToString() == globalID.ToString())
- rowsToDelete.Add(rowToCheck);
- }
- for (int iter = 0; iter < rowsToDelete.Count; iter++)
- {
- landaccesslist.Rows.Remove(rowsToDelete[iter]);
- }
-
-
- }
- Commit();
- }
-
- ///
- ///
- ///
- ///
- public void StoreLandObject(ILandObject parcel)
- {
- lock (ds)
- {
- DataTable land = ds.Tables["land"];
- DataTable landaccesslist = ds.Tables["landaccesslist"];
-
- DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString());
- if (landRow == null)
- {
- landRow = land.NewRow();
- fillLandRow(landRow, parcel.LandData, parcel.RegionUUID);
- land.Rows.Add(landRow);
- }
- else
- {
- fillLandRow(landRow, parcel.LandData, parcel.RegionUUID);
- }
-
- // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around
- //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn))
- //{
- // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString()));
- // cmd.ExecuteNonQuery();
-
-// }
-
- // This is the slower.. but more appropriate thing to do
-
- // We can't modify the table with direct queries before calling Commit() and re-filling them.
- List rowsToDelete = new List();
- foreach (DataRow rowToCheck in landaccesslist.Rows)
- {
- if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString())
- rowsToDelete.Add(rowToCheck);
- }
- for (int iter = 0; iter < rowsToDelete.Count; iter++)
- {
- landaccesslist.Rows.Remove(rowsToDelete[iter]);
- }
- rowsToDelete.Clear();
- foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList)
- {
- DataRow newAccessRow = landaccesslist.NewRow();
- fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID);
- landaccesslist.Rows.Add(newAccessRow);
- }
- }
-
- Commit();
- }
-
- ///
- ///
- ///
- ///
- ///
- public List LoadLandObjects(UUID regionUUID)
- {
- List landDataForRegion = new List();
- lock (ds)
- {
- DataTable land = ds.Tables["land"];
- DataTable landaccesslist = ds.Tables["landaccesslist"];
- string searchExp = "RegionUUID = '" + regionUUID + "'";
- DataRow[] rawDataForRegion = land.Select(searchExp);
- foreach (DataRow rawDataLand in rawDataForRegion)
- {
- LandData newLand = buildLandData(rawDataLand);
- string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'";
- DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp);
- foreach (DataRow rawDataLandAccess in rawDataForLandAccessList)
- {
- newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess));
- }
-
- landDataForRegion.Add(newLand);
- }
- }
- return landDataForRegion;
- }
-
- ///
- ///
- ///
- public void Commit()
- {
- //m_log.Debug("[SQLITE]: Starting commit");
- lock (ds)
- {
- primDa.Update(ds, "prims");
- shapeDa.Update(ds, "primshapes");
-
- itemsDa.Update(ds, "primitems");
-
- terrainDa.Update(ds, "terrain");
- landDa.Update(ds, "land");
- landAccessListDa.Update(ds, "landaccesslist");
- try
- {
- regionSettingsDa.Update(ds, "regionsettings");
- }
- catch (SqliteException SqlEx)
- {
- throw new Exception(
- "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
- SqlEx);
- }
- ds.AcceptChanges();
- }
- }
-
- ///
- /// See
- ///
- public void Shutdown()
- {
- Commit();
- }
-
- /***********************************************************************
- *
- * Database Definition Functions
- *
- * This should be db agnostic as we define them in ADO.NET terms
- *
- **********************************************************************/
-
- protected void CreateDataSetMapping(IDataAdapter da, string tableName)
- {
- ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
- foreach (DataColumn col in ds.Tables[tableName].Columns)
- {
- dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- private static void createCol(DataTable dt, string name, Type type)
- {
- DataColumn col = new DataColumn(name, type);
- dt.Columns.Add(col);
- }
-
- ///
- /// Creates the "terrain" table
- ///
- /// terrain table DataTable
- private static DataTable createTerrainTable()
- {
- DataTable terrain = new DataTable("terrain");
-
- createCol(terrain, "RegionUUID", typeof (String));
- createCol(terrain, "Revision", typeof (Int32));
- createCol(terrain, "Heightfield", typeof (Byte[]));
-
- return terrain;
- }
-
- ///
- /// Creates the "prims" table
- ///
- /// prim table DataTable
- private static DataTable createPrimTable()
- {
- DataTable prims = new DataTable("prims");
-
- createCol(prims, "UUID", typeof (String));
- createCol(prims, "RegionUUID", typeof (String));
- createCol(prims, "CreationDate", typeof (Int32));
- createCol(prims, "Name", typeof (String));
- createCol(prims, "SceneGroupID", typeof (String));
- // various text fields
- createCol(prims, "Text", typeof (String));
- createCol(prims, "ColorR", typeof (Int32));
- createCol(prims, "ColorG", typeof (Int32));
- createCol(prims, "ColorB", typeof (Int32));
- createCol(prims, "ColorA", typeof (Int32));
- createCol(prims, "Description", typeof (String));
- createCol(prims, "SitName", typeof (String));
- createCol(prims, "TouchName", typeof (String));
- // permissions
- createCol(prims, "ObjectFlags", typeof (Int32));
- createCol(prims, "CreatorID", typeof (String));
- createCol(prims, "OwnerID", typeof (String));
- createCol(prims, "GroupID", typeof (String));
- createCol(prims, "LastOwnerID", typeof (String));
- createCol(prims, "OwnerMask", typeof (Int32));
- createCol(prims, "NextOwnerMask", typeof (Int32));
- createCol(prims, "GroupMask", typeof (Int32));
- createCol(prims, "EveryoneMask", typeof (Int32));
- createCol(prims, "BaseMask", typeof (Int32));
- // vectors
- createCol(prims, "PositionX", typeof (Double));
- createCol(prims, "PositionY", typeof (Double));
- createCol(prims, "PositionZ", typeof (Double));
- createCol(prims, "GroupPositionX", typeof (Double));
- createCol(prims, "GroupPositionY", typeof (Double));
- createCol(prims, "GroupPositionZ", typeof (Double));
- createCol(prims, "VelocityX", typeof (Double));
- createCol(prims, "VelocityY", typeof (Double));
- createCol(prims, "VelocityZ", typeof (Double));
- createCol(prims, "AngularVelocityX", typeof (Double));
- createCol(prims, "AngularVelocityY", typeof (Double));
- createCol(prims, "AngularVelocityZ", typeof (Double));
- createCol(prims, "AccelerationX", typeof (Double));
- createCol(prims, "AccelerationY", typeof (Double));
- createCol(prims, "AccelerationZ", typeof (Double));
- // quaternions
- createCol(prims, "RotationX", typeof (Double));
- createCol(prims, "RotationY", typeof (Double));
- createCol(prims, "RotationZ", typeof (Double));
- createCol(prims, "RotationW", typeof (Double));
-
- // sit target
- createCol(prims, "SitTargetOffsetX", typeof (Double));
- createCol(prims, "SitTargetOffsetY", typeof (Double));
- createCol(prims, "SitTargetOffsetZ", typeof (Double));
-
- createCol(prims, "SitTargetOrientW", typeof (Double));
- createCol(prims, "SitTargetOrientX", typeof (Double));
- createCol(prims, "SitTargetOrientY", typeof (Double));
- createCol(prims, "SitTargetOrientZ", typeof (Double));
-
- createCol(prims, "PayPrice", typeof(Int32));
- createCol(prims, "PayButton1", typeof(Int32));
- createCol(prims, "PayButton2", typeof(Int32));
- createCol(prims, "PayButton3", typeof(Int32));
- createCol(prims, "PayButton4", typeof(Int32));
-
- createCol(prims, "LoopedSound", typeof(String));
- createCol(prims, "LoopedSoundGain", typeof(Double));
- createCol(prims, "TextureAnimation", typeof(String));
- createCol(prims, "ParticleSystem", typeof(String));
-
- createCol(prims, "OmegaX", typeof(Double));
- createCol(prims, "OmegaY", typeof(Double));
- createCol(prims, "OmegaZ", typeof(Double));
-
- createCol(prims, "CameraEyeOffsetX", typeof(Double));
- createCol(prims, "CameraEyeOffsetY", typeof(Double));
- createCol(prims, "CameraEyeOffsetZ", typeof(Double));
-
- createCol(prims, "CameraAtOffsetX", typeof(Double));
- createCol(prims, "CameraAtOffsetY", typeof(Double));
- createCol(prims, "CameraAtOffsetZ", typeof(Double));
-
- createCol(prims, "ForceMouselook", typeof(Int16));
-
- createCol(prims, "ScriptAccessPin", typeof(Int32));
-
- createCol(prims, "AllowedDrop", typeof(Int16));
- createCol(prims, "DieAtEdge", typeof(Int16));
-
- createCol(prims, "SalePrice", typeof(Int32));
- createCol(prims, "SaleType", typeof(Int16));
-
- // click action
- createCol(prims, "ClickAction", typeof (Byte));
-
- createCol(prims, "Material", typeof(Byte));
-
- createCol(prims, "CollisionSound", typeof(String));
- createCol(prims, "CollisionSoundVolume", typeof(Double));
-
- createCol(prims, "VolumeDetect", typeof(Int16));
-
- createCol(prims, "MediaURL", typeof(String));
-
- // Add in contraints
- prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
-
- return prims;
- }
-
- ///
- /// Creates "primshapes" table
- ///
- /// shape table DataTable
- private static DataTable createShapeTable()
- {
- DataTable shapes = new DataTable("primshapes");
- createCol(shapes, "UUID", typeof (String));
- // shape is an enum
- createCol(shapes, "Shape", typeof (Int32));
- // vectors
- createCol(shapes, "ScaleX", typeof (Double));
- createCol(shapes, "ScaleY", typeof (Double));
- createCol(shapes, "ScaleZ", typeof (Double));
- // paths
- createCol(shapes, "PCode", typeof (Int32));
- createCol(shapes, "PathBegin", typeof (Int32));
- createCol(shapes, "PathEnd", typeof (Int32));
- createCol(shapes, "PathScaleX", typeof (Int32));
- createCol(shapes, "PathScaleY", typeof (Int32));
- createCol(shapes, "PathShearX", typeof (Int32));
- createCol(shapes, "PathShearY", typeof (Int32));
- createCol(shapes, "PathSkew", typeof (Int32));
- createCol(shapes, "PathCurve", typeof (Int32));
- createCol(shapes, "PathRadiusOffset", typeof (Int32));
- createCol(shapes, "PathRevolutions", typeof (Int32));
- createCol(shapes, "PathTaperX", typeof (Int32));
- createCol(shapes, "PathTaperY", typeof (Int32));
- createCol(shapes, "PathTwist", typeof (Int32));
- createCol(shapes, "PathTwistBegin", typeof (Int32));
- // profile
- createCol(shapes, "ProfileBegin", typeof (Int32));
- createCol(shapes, "ProfileEnd", typeof (Int32));
- createCol(shapes, "ProfileCurve", typeof (Int32));
- createCol(shapes, "ProfileHollow", typeof (Int32));
- createCol(shapes, "State", typeof(Int32));
- // text TODO: this isn't right, but I'm not sure the right
- // way to specify this as a blob atm
- createCol(shapes, "Texture", typeof (Byte[]));
- createCol(shapes, "ExtraParams", typeof (Byte[]));
- createCol(shapes, "Media", typeof(String));
-
- shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
-
- return shapes;
- }
-
- ///
- /// creates "primitems" table
- ///
- /// item table DataTable
- private static DataTable createItemsTable()
- {
- DataTable items = new DataTable("primitems");
-
- createCol(items, "itemID", typeof (String));
- createCol(items, "primID", typeof (String));
- createCol(items, "assetID", typeof (String));
- createCol(items, "parentFolderID", typeof (String));
-
- createCol(items, "invType", typeof (Int32));
- createCol(items, "assetType", typeof (Int32));
-
- createCol(items, "name", typeof (String));
- createCol(items, "description", typeof (String));
-
- createCol(items, "creationDate", typeof (Int64));
- createCol(items, "creatorID", typeof (String));
- createCol(items, "ownerID", typeof (String));
- createCol(items, "lastOwnerID", typeof (String));
- createCol(items, "groupID", typeof (String));
-
- createCol(items, "nextPermissions", typeof (UInt32));
- createCol(items, "currentPermissions", typeof (UInt32));
- createCol(items, "basePermissions", typeof (UInt32));
- createCol(items, "everyonePermissions", typeof (UInt32));
- createCol(items, "groupPermissions", typeof (UInt32));
- createCol(items, "flags", typeof (UInt32));
-
- items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] };
-
- return items;
- }
-
- ///
- /// Creates "land" table
- ///
- /// land table DataTable
- private static DataTable createLandTable()
- {
- DataTable land = new DataTable("land");
- createCol(land, "UUID", typeof (String));
- createCol(land, "RegionUUID", typeof (String));
- createCol(land, "LocalLandID", typeof (UInt32));
-
- // Bitmap is a byte[512]
- createCol(land, "Bitmap", typeof (Byte[]));
-
- createCol(land, "Name", typeof (String));
- createCol(land, "Desc", typeof (String));
- createCol(land, "OwnerUUID", typeof (String));
- createCol(land, "IsGroupOwned", typeof (Boolean));
- createCol(land, "Area", typeof (Int32));
- createCol(land, "AuctionID", typeof (Int32)); //Unemplemented
- createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
- createCol(land, "ClaimDate", typeof (Int32));
- createCol(land, "ClaimPrice", typeof (Int32));
- createCol(land, "GroupUUID", typeof (string));
- createCol(land, "SalePrice", typeof (Int32));
- createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus
- createCol(land, "LandFlags", typeof (UInt32));
- createCol(land, "LandingType", typeof (Byte));
- createCol(land, "MediaAutoScale", typeof (Byte));
- createCol(land, "MediaTextureUUID", typeof (String));
- createCol(land, "MediaURL", typeof (String));
- createCol(land, "MusicURL", typeof (String));
- createCol(land, "PassHours", typeof (Double));
- createCol(land, "PassPrice", typeof (UInt32));
- createCol(land, "SnapshotUUID", typeof (String));
- createCol(land, "UserLocationX", typeof (Double));
- createCol(land, "UserLocationY", typeof (Double));
- createCol(land, "UserLocationZ", typeof (Double));
- createCol(land, "UserLookAtX", typeof (Double));
- createCol(land, "UserLookAtY", typeof (Double));
- createCol(land, "UserLookAtZ", typeof (Double));
- createCol(land, "AuthbuyerID", typeof(String));
- createCol(land, "OtherCleanTime", typeof(Int32));
-
- land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
-
- return land;
- }
-
- ///
- /// create "landaccesslist" table
- ///
- /// Landacceslist DataTable
- private static DataTable createLandAccessListTable()
- {
- DataTable landaccess = new DataTable("landaccesslist");
- createCol(landaccess, "LandUUID", typeof (String));
- createCol(landaccess, "AccessUUID", typeof (String));
- createCol(landaccess, "Flags", typeof (UInt32));
-
- return landaccess;
- }
-
- private static DataTable createRegionSettingsTable()
- {
- DataTable regionsettings = new DataTable("regionsettings");
- createCol(regionsettings, "regionUUID", typeof(String));
- createCol(regionsettings, "block_terraform", typeof (Int32));
- createCol(regionsettings, "block_fly", typeof (Int32));
- createCol(regionsettings, "allow_damage", typeof (Int32));
- createCol(regionsettings, "restrict_pushing", typeof (Int32));
- createCol(regionsettings, "allow_land_resell", typeof (Int32));
- createCol(regionsettings, "allow_land_join_divide", typeof (Int32));
- createCol(regionsettings, "block_show_in_search", typeof (Int32));
- createCol(regionsettings, "agent_limit", typeof (Int32));
- createCol(regionsettings, "object_bonus", typeof (Double));
- createCol(regionsettings, "maturity", typeof (Int32));
- createCol(regionsettings, "disable_scripts", typeof (Int32));
- createCol(regionsettings, "disable_collisions", typeof (Int32));
- createCol(regionsettings, "disable_physics", typeof (Int32));
- createCol(regionsettings, "terrain_texture_1", typeof(String));
- createCol(regionsettings, "terrain_texture_2", typeof(String));
- createCol(regionsettings, "terrain_texture_3", typeof(String));
- createCol(regionsettings, "terrain_texture_4", typeof(String));
- createCol(regionsettings, "elevation_1_nw", typeof (Double));
- createCol(regionsettings, "elevation_2_nw", typeof (Double));
- createCol(regionsettings, "elevation_1_ne", typeof (Double));
- createCol(regionsettings, "elevation_2_ne", typeof (Double));
- createCol(regionsettings, "elevation_1_se", typeof (Double));
- createCol(regionsettings, "elevation_2_se", typeof (Double));
- createCol(regionsettings, "elevation_1_sw", typeof (Double));
- createCol(regionsettings, "elevation_2_sw", typeof (Double));
- createCol(regionsettings, "water_height", typeof (Double));
- createCol(regionsettings, "terrain_raise_limit", typeof (Double));
- createCol(regionsettings, "terrain_lower_limit", typeof (Double));
- createCol(regionsettings, "use_estate_sun", typeof (Int32));
- createCol(regionsettings, "sandbox", typeof (Int32));
- createCol(regionsettings, "sunvectorx",typeof (Double));
- createCol(regionsettings, "sunvectory",typeof (Double));
- createCol(regionsettings, "sunvectorz",typeof (Double));
- createCol(regionsettings, "fixed_sun", typeof (Int32));
- createCol(regionsettings, "sun_position", typeof (Double));
- createCol(regionsettings, "covenant", typeof(String));
- createCol(regionsettings, "map_tile_ID", typeof(String));
- regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
- return regionsettings;
- }
-
- /***********************************************************************
- *
- * Convert between ADO.NET <=> OpenSim Objects
- *
- * These should be database independant
- *
- **********************************************************************/
-
- ///
- ///
- ///
- ///
- ///
- private SceneObjectPart buildPrim(DataRow row)
- {
- // Code commented. Uncomment to test the unit test inline.
-
- // The unit test mentions this commented code for the purposes
- // of debugging a unit test failure
-
- // SceneObjectGroup sog = new SceneObjectGroup();
- // SceneObjectPart sop = new SceneObjectPart();
- // sop.LocalId = 1;
- // sop.Name = "object1";
- // sop.Description = "object1";
- // sop.Text = "";
- // sop.SitName = "";
- // sop.TouchName = "";
- // sop.UUID = UUID.Random();
- // sop.Shape = PrimitiveBaseShape.Default;
- // sog.SetRootPart(sop);
- // Add breakpoint in above line. Check sop fields.
-
- // TODO: this doesn't work yet because something more
- // interesting has to be done to actually get these values
- // back out. Not enough time to figure it out yet.
-
- SceneObjectPart prim = new SceneObjectPart();
- prim.UUID = new UUID((String) row["UUID"]);
- // explicit conversion of integers is required, which sort
- // of sucks. No idea if there is a shortcut here or not.
- prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
- prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"];
- // various text fields
- prim.Text = (String) row["Text"];
- prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
- Convert.ToInt32(row["ColorR"]),
- Convert.ToInt32(row["ColorG"]),
- Convert.ToInt32(row["ColorB"]));
- prim.Description = (String) row["Description"];
- prim.SitName = (String) row["SitName"];
- prim.TouchName = (String) row["TouchName"];
- // permissions
- prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
- prim.CreatorID = new UUID((String) row["CreatorID"]);
- prim.OwnerID = new UUID((String) row["OwnerID"]);
- prim.GroupID = new UUID((String) row["GroupID"]);
- prim.LastOwnerID = new UUID((String) row["LastOwnerID"]);
- prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
- prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
- prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
- prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]);
- prim.BaseMask = Convert.ToUInt32(row["BaseMask"]);
- // vectors
- prim.OffsetPosition = new Vector3(
- Convert.ToSingle(row["PositionX"]),
- Convert.ToSingle(row["PositionY"]),
- Convert.ToSingle(row["PositionZ"])
- );
- prim.GroupPosition = new Vector3(
- Convert.ToSingle(row["GroupPositionX"]),
- Convert.ToSingle(row["GroupPositionY"]),
- Convert.ToSingle(row["GroupPositionZ"])
- );
- prim.Velocity = new Vector3(
- Convert.ToSingle(row["VelocityX"]),
- Convert.ToSingle(row["VelocityY"]),
- Convert.ToSingle(row["VelocityZ"])
- );
- prim.AngularVelocity = new Vector3(
- Convert.ToSingle(row["AngularVelocityX"]),
- Convert.ToSingle(row["AngularVelocityY"]),
- Convert.ToSingle(row["AngularVelocityZ"])
- );
- prim.Acceleration = new Vector3(
- Convert.ToSingle(row["AccelerationX"]),
- Convert.ToSingle(row["AccelerationY"]),
- Convert.ToSingle(row["AccelerationZ"])
- );
- // quaternions
- prim.RotationOffset = new Quaternion(
- Convert.ToSingle(row["RotationX"]),
- Convert.ToSingle(row["RotationY"]),
- Convert.ToSingle(row["RotationZ"]),
- Convert.ToSingle(row["RotationW"])
- );
-
- prim.SitTargetPositionLL = new Vector3(
- Convert.ToSingle(row["SitTargetOffsetX"]),
- Convert.ToSingle(row["SitTargetOffsetY"]),
- Convert.ToSingle(row["SitTargetOffsetZ"]));
- prim.SitTargetOrientationLL = new Quaternion(
- Convert.ToSingle(
- row["SitTargetOrientX"]),
- Convert.ToSingle(
- row["SitTargetOrientY"]),
- Convert.ToSingle(
- row["SitTargetOrientZ"]),
- Convert.ToSingle(
- row["SitTargetOrientW"]));
-
- prim.ClickAction = Convert.ToByte(row["ClickAction"]);
- prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
- prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]);
- prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]);
- prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]);
- prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]);
-
- prim.Sound = new UUID(row["LoopedSound"].ToString());
- prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]);
- prim.SoundFlags = 1; // If it's persisted at all, it's looped
-
- if (!row.IsNull("TextureAnimation"))
- prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString());
- if (!row.IsNull("ParticleSystem"))
- prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString());
-
- prim.AngularVelocity = new Vector3(
- Convert.ToSingle(row["OmegaX"]),
- Convert.ToSingle(row["OmegaY"]),
- Convert.ToSingle(row["OmegaZ"])
- );
-
- prim.SetCameraEyeOffset(new Vector3(
- Convert.ToSingle(row["CameraEyeOffsetX"]),
- Convert.ToSingle(row["CameraEyeOffsetY"]),
- Convert.ToSingle(row["CameraEyeOffsetZ"])
- ));
-
- prim.SetCameraAtOffset(new Vector3(
- Convert.ToSingle(row["CameraAtOffsetX"]),
- Convert.ToSingle(row["CameraAtOffsetY"]),
- Convert.ToSingle(row["CameraAtOffsetZ"])
- ));
-
- if (Convert.ToInt16(row["ForceMouselook"]) != 0)
- prim.SetForceMouselook(true);
-
- prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]);
-
- if (Convert.ToInt16(row["AllowedDrop"]) != 0)
- prim.AllowedDrop = true;
-
- if (Convert.ToInt16(row["DieAtEdge"]) != 0)
- prim.DIE_AT_EDGE = true;
-
- prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
- prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
-
- prim.Material = Convert.ToByte(row["Material"]);
-
- prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
- prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
-
- if (Convert.ToInt16(row["VolumeDetect"]) != 0)
- prim.VolumeDetectActive = true;
-
- if (!(row["MediaURL"] is System.DBNull))
- {
- //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
- prim.MediaUrl = (string)row["MediaURL"];
- }
-
- return prim;
- }
-
- ///
- /// Build a prim inventory item from the persisted data.
- ///
- ///
- ///
- private static TaskInventoryItem buildItem(DataRow row)
- {
- TaskInventoryItem taskItem = new TaskInventoryItem();
-
- taskItem.ItemID = new UUID((String)row["itemID"]);
- taskItem.ParentPartID = new UUID((String)row["primID"]);
- taskItem.AssetID = new UUID((String)row["assetID"]);
- taskItem.ParentID = new UUID((String)row["parentFolderID"]);
-
- taskItem.InvType = Convert.ToInt32(row["invType"]);
- taskItem.Type = Convert.ToInt32(row["assetType"]);
-
- taskItem.Name = (String)row["name"];
- taskItem.Description = (String)row["description"];
- taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
- taskItem.CreatorID = new UUID((String)row["creatorID"]);
- taskItem.OwnerID = new UUID((String)row["ownerID"]);
- taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]);
- taskItem.GroupID = new UUID((String)row["groupID"]);
-
- taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
- taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
- taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
- taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
- taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
- taskItem.Flags = Convert.ToUInt32(row["flags"]);
-
- return taskItem;
- }
-
- ///
- /// Build a Land Data from the persisted data.
- ///
- ///
- ///
- private LandData buildLandData(DataRow row)
- {
- LandData newData = new LandData();
-
- newData.GlobalID = new UUID((String) row["UUID"]);
- newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
-
- // Bitmap is a byte[512]
- newData.Bitmap = (Byte[]) row["Bitmap"];
-
- newData.Name = (String) row["Name"];
- newData.Description = (String) row["Desc"];
- newData.OwnerID = (UUID)(String) row["OwnerUUID"];
- newData.IsGroupOwned = (Boolean) row["IsGroupOwned"];
- newData.Area = Convert.ToInt32(row["Area"]);
- newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
- newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]);
- //Enum OpenMetaverse.Parcel.ParcelCategory
- newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
- newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
- newData.GroupID = new UUID((String) row["GroupUUID"]);
- newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
- newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]);
- //Enum. OpenMetaverse.Parcel.ParcelStatus
- newData.Flags = Convert.ToUInt32(row["LandFlags"]);
- newData.LandingType = (Byte) row["LandingType"];
- newData.MediaAutoScale = (Byte) row["MediaAutoScale"];
- newData.MediaID = new UUID((String) row["MediaTextureUUID"]);
- newData.MediaURL = (String) row["MediaURL"];
- newData.MusicURL = (String) row["MusicURL"];
- newData.PassHours = Convert.ToSingle(row["PassHours"]);
- newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
- newData.SnapshotID = (UUID)(String) row["SnapshotUUID"];
- try
- {
-
- newData.UserLocation =
- new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
- Convert.ToSingle(row["UserLocationZ"]));
- newData.UserLookAt =
- new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
- Convert.ToSingle(row["UserLookAtZ"]));
-
- }
- catch (InvalidCastException)
- {
- m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name);
- newData.UserLocation = Vector3.Zero;
- newData.UserLookAt = Vector3.Zero;
- }
- newData.ParcelAccessList = new List();
- UUID authBuyerID = UUID.Zero;
-
- UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
-
- newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
-
- return newData;
- }
-
- private RegionSettings buildRegionSettings(DataRow row)
- {
- RegionSettings newSettings = new RegionSettings();
-
- newSettings.RegionUUID = new UUID((string) row["regionUUID"]);
- newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
- newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
- newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
- newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
- newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
- newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
- newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
- newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
- newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
- newSettings.Maturity = Convert.ToInt32(row["maturity"]);
- newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
- newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
- newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
- newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]);
- newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]);
- newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]);
- newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]);
- newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
- newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
- newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
- newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
- newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
- newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
- newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
- newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
- newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
- newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
- newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
- newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
- newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
- newSettings.SunVector = new Vector3 (
- Convert.ToSingle(row["sunvectorx"]),
- Convert.ToSingle(row["sunvectory"]),
- Convert.ToSingle(row["sunvectorz"])
- );
- newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
- newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
- newSettings.Covenant = new UUID((String) row["covenant"]);
- newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
-
- return newSettings;
- }
-
- ///
- /// Build a land access entry from the persisted data.
- ///
- ///
- ///
- private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
- {
- ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
- entry.AgentID = new UUID((string) row["AccessUUID"]);
- entry.Flags = (AccessList) row["Flags"];
- entry.Time = new DateTime();
- return entry;
- }
-
- ///
- ///
- ///
- ///
- ///
- private static Array serializeTerrain(double[,] val)
- {
- MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
- BinaryWriter bw = new BinaryWriter(str);
-
- // TODO: COMPATIBILITY - Add byte-order conversions
- for (int x = 0; x < (int)Constants.RegionSize; x++)
- for (int y = 0; y < (int)Constants.RegionSize; y++)
- bw.Write(val[x, y]);
-
- return str.ToArray();
- }
-
-// private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val)
-// {
-// row["RegionUUID"] = regionUUID;
-// row["Revision"] = rev;
-
- // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double));
-// BinaryWriter bw = new BinaryWriter(str);
-
-// // TODO: COMPATIBILITY - Add byte-order conversions
- // for (int x = 0; x < (int)Constants.RegionSize; x++)
- // for (int y = 0; y < (int)Constants.RegionSize; y++)
-// bw.Write(val[x, y]);
-
-// row["Heightfield"] = str.ToArray();
-// }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
- {
- row["UUID"] = prim.UUID.ToString();
- row["RegionUUID"] = regionUUID.ToString();
- row["CreationDate"] = prim.CreationDate;
- row["Name"] = prim.Name;
- row["SceneGroupID"] = sceneGroupID.ToString();
- // the UUID of the root part for this SceneObjectGroup
- // various text fields
- row["Text"] = prim.Text;
- row["Description"] = prim.Description;
- row["SitName"] = prim.SitName;
- row["TouchName"] = prim.TouchName;
- // permissions
- row["ObjectFlags"] = prim.ObjectFlags;
- row["CreatorID"] = prim.CreatorID.ToString();
- row["OwnerID"] = prim.OwnerID.ToString();
- row["GroupID"] = prim.GroupID.ToString();
- row["LastOwnerID"] = prim.LastOwnerID.ToString();
- row["OwnerMask"] = prim.OwnerMask;
- row["NextOwnerMask"] = prim.NextOwnerMask;
- row["GroupMask"] = prim.GroupMask;
- row["EveryoneMask"] = prim.EveryoneMask;
- row["BaseMask"] = prim.BaseMask;
- // vectors
- row["PositionX"] = prim.OffsetPosition.X;
- row["PositionY"] = prim.OffsetPosition.Y;
- row["PositionZ"] = prim.OffsetPosition.Z;
- row["GroupPositionX"] = prim.GroupPosition.X;
- row["GroupPositionY"] = prim.GroupPosition.Y;
- row["GroupPositionZ"] = prim.GroupPosition.Z;
- row["VelocityX"] = prim.Velocity.X;
- row["VelocityY"] = prim.Velocity.Y;
- row["VelocityZ"] = prim.Velocity.Z;
- row["AngularVelocityX"] = prim.AngularVelocity.X;
- row["AngularVelocityY"] = prim.AngularVelocity.Y;
- row["AngularVelocityZ"] = prim.AngularVelocity.Z;
- row["AccelerationX"] = prim.Acceleration.X;
- row["AccelerationY"] = prim.Acceleration.Y;
- row["AccelerationZ"] = prim.Acceleration.Z;
- // quaternions
- row["RotationX"] = prim.RotationOffset.X;
- row["RotationY"] = prim.RotationOffset.Y;
- row["RotationZ"] = prim.RotationOffset.Z;
- row["RotationW"] = prim.RotationOffset.W;
-
- // Sit target
- Vector3 sitTargetPos = prim.SitTargetPositionLL;
- row["SitTargetOffsetX"] = sitTargetPos.X;
- row["SitTargetOffsetY"] = sitTargetPos.Y;
- row["SitTargetOffsetZ"] = sitTargetPos.Z;
-
- Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
- row["SitTargetOrientW"] = sitTargetOrient.W;
- row["SitTargetOrientX"] = sitTargetOrient.X;
- row["SitTargetOrientY"] = sitTargetOrient.Y;
- row["SitTargetOrientZ"] = sitTargetOrient.Z;
- row["ColorR"] = Convert.ToInt32(prim.Color.R);
- row["ColorG"] = Convert.ToInt32(prim.Color.G);
- row["ColorB"] = Convert.ToInt32(prim.Color.B);
- row["ColorA"] = Convert.ToInt32(prim.Color.A);
- row["PayPrice"] = prim.PayPrice[0];
- row["PayButton1"] = prim.PayPrice[1];
- row["PayButton2"] = prim.PayPrice[2];
- row["PayButton3"] = prim.PayPrice[3];
- row["PayButton4"] = prim.PayPrice[4];
-
- row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation);
- row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem);
-
- row["OmegaX"] = prim.AngularVelocity.X;
- row["OmegaY"] = prim.AngularVelocity.Y;
- row["OmegaZ"] = prim.AngularVelocity.Z;
-
- row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X;
- row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y;
- row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z;
-
- row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X;
- row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y;
- row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z;
-
-
- if ((prim.SoundFlags & 1) != 0) // Looped
- {
- row["LoopedSound"] = prim.Sound.ToString();
- row["LoopedSoundGain"] = prim.SoundGain;
- }
- else
- {
- row["LoopedSound"] = UUID.Zero.ToString();
- row["LoopedSoundGain"] = 0.0f;
- }
-
- if (prim.GetForceMouselook())
- row["ForceMouselook"] = 1;
- else
- row["ForceMouselook"] = 0;
-
- row["ScriptAccessPin"] = prim.ScriptAccessPin;
-
- if (prim.AllowedDrop)
- row["AllowedDrop"] = 1;
- else
- row["AllowedDrop"] = 0;
-
- if (prim.DIE_AT_EDGE)
- row["DieAtEdge"] = 1;
- else
- row["DieAtEdge"] = 0;
-
- row["SalePrice"] = prim.SalePrice;
- row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType);
-
- // click action
- row["ClickAction"] = prim.ClickAction;
-
- row["SalePrice"] = prim.SalePrice;
- row["Material"] = prim.Material;
-
- row["CollisionSound"] = prim.CollisionSound.ToString();
- row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
- if (prim.VolumeDetectActive)
- row["VolumeDetect"] = 1;
- else
- row["VolumeDetect"] = 0;
-
- row["MediaURL"] = prim.MediaUrl;
- }
-
- ///
- ///
- ///
- ///
- ///
- private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
- {
- row["itemID"] = taskItem.ItemID.ToString();
- row["primID"] = taskItem.ParentPartID.ToString();
- row["assetID"] = taskItem.AssetID.ToString();
- row["parentFolderID"] = taskItem.ParentID.ToString();
-
- row["invType"] = taskItem.InvType;
- row["assetType"] = taskItem.Type;
-
- row["name"] = taskItem.Name;
- row["description"] = taskItem.Description;
- row["creationDate"] = taskItem.CreationDate;
- row["creatorID"] = taskItem.CreatorID.ToString();
- row["ownerID"] = taskItem.OwnerID.ToString();
- row["lastOwnerID"] = taskItem.LastOwnerID.ToString();
- row["groupID"] = taskItem.GroupID.ToString();
- row["nextPermissions"] = taskItem.NextPermissions;
- row["currentPermissions"] = taskItem.CurrentPermissions;
- row["basePermissions"] = taskItem.BasePermissions;
- row["everyonePermissions"] = taskItem.EveryonePermissions;
- row["groupPermissions"] = taskItem.GroupPermissions;
- row["flags"] = taskItem.Flags;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- private static void fillLandRow(DataRow row, LandData land, UUID regionUUID)
- {
- row["UUID"] = land.GlobalID.ToString();
- row["RegionUUID"] = regionUUID.ToString();
- row["LocalLandID"] = land.LocalID;
-
- // Bitmap is a byte[512]
- row["Bitmap"] = land.Bitmap;
-
- row["Name"] = land.Name;
- row["Desc"] = land.Description;
- row["OwnerUUID"] = land.OwnerID.ToString();
- row["IsGroupOwned"] = land.IsGroupOwned;
- row["Area"] = land.Area;
- row["AuctionID"] = land.AuctionID; //Unemplemented
- row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
- row["ClaimDate"] = land.ClaimDate;
- row["ClaimPrice"] = land.ClaimPrice;
- row["GroupUUID"] = land.GroupID.ToString();
- row["SalePrice"] = land.SalePrice;
- row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus
- row["LandFlags"] = land.Flags;
- row["LandingType"] = land.LandingType;
- row["MediaAutoScale"] = land.MediaAutoScale;
- row["MediaTextureUUID"] = land.MediaID.ToString();
- row["MediaURL"] = land.MediaURL;
- row["MusicURL"] = land.MusicURL;
- row["PassHours"] = land.PassHours;
- row["PassPrice"] = land.PassPrice;
- row["SnapshotUUID"] = land.SnapshotID.ToString();
- row["UserLocationX"] = land.UserLocation.X;
- row["UserLocationY"] = land.UserLocation.Y;
- row["UserLocationZ"] = land.UserLocation.Z;
- row["UserLookAtX"] = land.UserLookAt.X;
- row["UserLookAtY"] = land.UserLookAt.Y;
- row["UserLookAtZ"] = land.UserLookAt.Z;
- row["AuthbuyerID"] = land.AuthBuyerID.ToString();
- row["OtherCleanTime"] = land.OtherCleanTime;
- row["MediaType"] = land.MediaType;
- row["MediaDescription"] = land.MediaDescription;
- row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
- row["MediaLoop"] = land.MediaLoop.ToString();
- row["ObscureMusic"] = land.ObscureMusic.ToString();
- row["ObscureMedia"] = land.ObscureMedia.ToString();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
- {
- row["LandUUID"] = parcelID.ToString();
- row["AccessUUID"] = entry.AgentID.ToString();
- row["Flags"] = entry.Flags;
- }
-
- private static void fillRegionSettingsRow(DataRow row, RegionSettings settings)
- {
- row["regionUUID"] = settings.RegionUUID.ToString();
- row["block_terraform"] = settings.BlockTerraform;
- row["block_fly"] = settings.BlockFly;
- row["allow_damage"] = settings.AllowDamage;
- row["restrict_pushing"] = settings.RestrictPushing;
- row["allow_land_resell"] = settings.AllowLandResell;
- row["allow_land_join_divide"] = settings.AllowLandJoinDivide;
- row["block_show_in_search"] = settings.BlockShowInSearch;
- row["agent_limit"] = settings.AgentLimit;
- row["object_bonus"] = settings.ObjectBonus;
- row["maturity"] = settings.Maturity;
- row["disable_scripts"] = settings.DisableScripts;
- row["disable_collisions"] = settings.DisableCollisions;
- row["disable_physics"] = settings.DisablePhysics;
- row["terrain_texture_1"] = settings.TerrainTexture1.ToString();
- row["terrain_texture_2"] = settings.TerrainTexture2.ToString();
- row["terrain_texture_3"] = settings.TerrainTexture3.ToString();
- row["terrain_texture_4"] = settings.TerrainTexture4.ToString();
- row["elevation_1_nw"] = settings.Elevation1NW;
- row["elevation_2_nw"] = settings.Elevation2NW;
- row["elevation_1_ne"] = settings.Elevation1NE;
- row["elevation_2_ne"] = settings.Elevation2NE;
- row["elevation_1_se"] = settings.Elevation1SE;
- row["elevation_2_se"] = settings.Elevation2SE;
- row["elevation_1_sw"] = settings.Elevation1SW;
- row["elevation_2_sw"] = settings.Elevation2SW;
- row["water_height"] = settings.WaterHeight;
- row["terrain_raise_limit"] = settings.TerrainRaiseLimit;
- row["terrain_lower_limit"] = settings.TerrainLowerLimit;
- row["use_estate_sun"] = settings.UseEstateSun;
- row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox
- row["sunvectorx"] = settings.SunVector.X;
- row["sunvectory"] = settings.SunVector.Y;
- row["sunvectorz"] = settings.SunVector.Z;
- row["fixed_sun"] = settings.FixedSun;
- row["sun_position"] = settings.SunPosition;
- row["covenant"] = settings.Covenant.ToString();
- row["map_tile_ID"] = settings.TerrainImageID.ToString();
- }
-
- ///
- ///
- ///
- ///
- ///
- private PrimitiveBaseShape buildShape(DataRow row)
- {
- PrimitiveBaseShape s = new PrimitiveBaseShape();
- s.Scale = new Vector3(
- Convert.ToSingle(row["ScaleX"]),
- Convert.ToSingle(row["ScaleY"]),
- Convert.ToSingle(row["ScaleZ"])
- );
- // paths
- s.PCode = Convert.ToByte(row["PCode"]);
- s.PathBegin = Convert.ToUInt16(row["PathBegin"]);
- s.PathEnd = Convert.ToUInt16(row["PathEnd"]);
- s.PathScaleX = Convert.ToByte(row["PathScaleX"]);
- s.PathScaleY = Convert.ToByte(row["PathScaleY"]);
- s.PathShearX = Convert.ToByte(row["PathShearX"]);
- s.PathShearY = Convert.ToByte(row["PathShearY"]);
- s.PathSkew = Convert.ToSByte(row["PathSkew"]);
- s.PathCurve = Convert.ToByte(row["PathCurve"]);
- s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]);
- s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]);
- s.PathTaperX = Convert.ToSByte(row["PathTaperX"]);
- s.PathTaperY = Convert.ToSByte(row["PathTaperY"]);
- s.PathTwist = Convert.ToSByte(row["PathTwist"]);
- s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]);
- // profile
- s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]);
- s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
- s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
- s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
- s.State = Convert.ToByte(row["State"]);
-
- byte[] textureEntry = (byte[])row["Texture"];
- s.TextureEntry = textureEntry;
-
- s.ExtraParams = (byte[]) row["ExtraParams"];
-
- if (!(row["Media"] is System.DBNull))
- s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
-
- return s;
- }
-
- ///
- ///
- ///
- ///
- ///
- private static void fillShapeRow(DataRow row, SceneObjectPart prim)
- {
- PrimitiveBaseShape s = prim.Shape;
- row["UUID"] = prim.UUID.ToString();
- // shape is an enum
- row["Shape"] = 0;
- // vectors
- row["ScaleX"] = s.Scale.X;
- row["ScaleY"] = s.Scale.Y;
- row["ScaleZ"] = s.Scale.Z;
- // paths
- row["PCode"] = s.PCode;
- row["PathBegin"] = s.PathBegin;
- row["PathEnd"] = s.PathEnd;
- row["PathScaleX"] = s.PathScaleX;
- row["PathScaleY"] = s.PathScaleY;
- row["PathShearX"] = s.PathShearX;
- row["PathShearY"] = s.PathShearY;
- row["PathSkew"] = s.PathSkew;
- row["PathCurve"] = s.PathCurve;
- row["PathRadiusOffset"] = s.PathRadiusOffset;
- row["PathRevolutions"] = s.PathRevolutions;
- row["PathTaperX"] = s.PathTaperX;
- row["PathTaperY"] = s.PathTaperY;
- row["PathTwist"] = s.PathTwist;
- row["PathTwistBegin"] = s.PathTwistBegin;
- // profile
- row["ProfileBegin"] = s.ProfileBegin;
- row["ProfileEnd"] = s.ProfileEnd;
- row["ProfileCurve"] = s.ProfileCurve;
- row["ProfileHollow"] = s.ProfileHollow;
- row["State"] = s.State;
-
- row["Texture"] = s.TextureEntry;
- row["ExtraParams"] = s.ExtraParams;
-
- if (s.Media != null)
- row["Media"] = s.Media.ToXml();
- }
-
- ///
- /// Persistently store a prim.
- ///
- ///
- ///
- ///
- private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
- {
- DataTable prims = ds.Tables["prims"];
- DataTable shapes = ds.Tables["primshapes"];
-
- DataRow primRow = prims.Rows.Find(prim.UUID.ToString());
- if (primRow == null)
- {
- primRow = prims.NewRow();
- fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
- prims.Rows.Add(primRow);
- }
- else
- {
- fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
- }
-
- DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
- if (shapeRow == null)
- {
- shapeRow = shapes.NewRow();
- fillShapeRow(shapeRow, prim);
- shapes.Rows.Add(shapeRow);
- }
- else
- {
- fillShapeRow(shapeRow, prim);
- }
- }
-
- ///
- /// see IRegionDatastore
- ///
- ///
- ///
- public void StorePrimInventory(UUID primID, ICollection items)
- {
-// m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
-
- DataTable dbItems = ds.Tables["primitems"];
-
- // For now, we're just going to crudely remove all the previous inventory items
- // no matter whether they have changed or not, and replace them with the current set.
- lock (ds)
- {
- RemoveItems(primID);
-
- // repalce with current inventory details
- foreach (TaskInventoryItem newItem in items)
- {
-// m_log.InfoFormat(
-// "[DATASTORE]: ",
-// "Adding item {0}, {1} to prim ID {2}",
-// newItem.Name, newItem.ItemID, newItem.ParentPartID);
-
- DataRow newItemRow = dbItems.NewRow();
- fillItemRow(newItemRow, newItem);
- dbItems.Rows.Add(newItemRow);
- }
- }
-
- Commit();
- }
-
- /***********************************************************************
- *
- * SQL Statement Creation Functions
- *
- * These functions create SQL statements for update, insert, and create.
- * They can probably be factored later to have a db independant
- * portion and a db specific portion
- *
- **********************************************************************/
-
- ///
- /// Create an insert command
- ///
- /// table name
- /// data table
- /// the created command
- ///
- /// This is subtle enough to deserve some commentary.
- /// Instead of doing *lots* and *lots of hardcoded strings
- /// for database definitions we'll use the fact that
- /// realistically all insert statements look like "insert
- /// into A(b, c) values(:b, :c) on the parameterized query
- /// front. If we just have a list of b, c, etc... we can
- /// generate these strings instead of typing them out.
- ///
- private static SqliteCommand createInsertCommand(string table, DataTable dt)
- {
- string[] cols = new string[dt.Columns.Count];
- for (int i = 0; i < dt.Columns.Count; i++)
- {
- DataColumn col = dt.Columns[i];
- cols[i] = col.ColumnName;
- }
-
- string sql = "insert into " + table + "(";
- sql += String.Join(", ", cols);
- // important, the first ':' needs to be here, the rest get added in the join
- sql += ") values (:";
- sql += String.Join(", :", cols);
- sql += ")";
- //m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
- SqliteCommand cmd = new SqliteCommand(sql);
-
- // this provides the binding for all our parameters, so
- // much less code than it used to be
- foreach (DataColumn col in dt.Columns)
- {
- cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
- }
- return cmd;
- }
-
-
- ///
- /// create an update command
- ///
- /// table name
- ///
- ///
- /// the created command
- private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
- {
- string sql = "update " + table + " set ";
- string subsql = String.Empty;
- foreach (DataColumn col in dt.Columns)
- {
- if (subsql.Length > 0)
- {
- // a map function would rock so much here
- subsql += ", ";
- }
- subsql += col.ColumnName + "= :" + col.ColumnName;
- }
- sql += subsql;
- sql += " where " + pk;
- SqliteCommand cmd = new SqliteCommand(sql);
-
- // this provides the binding for all our parameters, so
- // much less code than it used to be
-
- foreach (DataColumn col in dt.Columns)
- {
- cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
- }
- return cmd;
- }
-
- ///
- /// create an update command
- ///
- /// table name
- ///
- ///
- /// the created command
- private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt)
- {
- string sql = "update " + table + " set ";
- string subsql = String.Empty;
- foreach (DataColumn col in dt.Columns)
- {
- if (subsql.Length > 0)
- {
- // a map function would rock so much here
- subsql += ", ";
- }
- subsql += col.ColumnName + "= :" + col.ColumnName;
- }
- sql += subsql;
- sql += " where " + pk1 + " and " + pk2;
- SqliteCommand cmd = new SqliteCommand(sql);
-
- // this provides the binding for all our parameters, so
- // much less code than it used to be
-
- foreach (DataColumn col in dt.Columns)
- {
- cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
- }
- return cmd;
- }
-
- ///
- ///
- ///
- /// Data Table
- ///
- // private static string defineTable(DataTable dt)
- // {
- // string sql = "create table " + dt.TableName + "(";
- // string subsql = String.Empty;
- // foreach (DataColumn col in dt.Columns)
- // {
- // if (subsql.Length > 0)
- // {
- // // a map function would rock so much here
- // subsql += ",\n";
- // }
- // subsql += col.ColumnName + " " + sqliteType(col.DataType);
- // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0])
- // {
- // subsql += " primary key";
- // }
- // }
- // sql += subsql;
- // sql += ")";
- // return sql;
- // }
-
- /***********************************************************************
- *
- * Database Binding functions
- *
- * These will be db specific due to typing, and minor differences
- * in databases.
- *
- **********************************************************************/
-
- ///
- /// This is a convenience function that collapses 5 repetitive
- /// lines for defining SqliteParameters to 2 parameters:
- /// column name and database type.
- ///
- /// It assumes certain conventions like :param as the param
- /// name to replace in parametrized queries, and that source
- /// version is always current version, both of which are fine
- /// for us.
- ///
- ///a built sqlite parameter
- private static SqliteParameter createSqliteParameter(string name, Type type)
- {
- SqliteParameter param = new SqliteParameter();
- param.ParameterName = ":" + name;
- param.DbType = dbtypeFromType(type);
- param.SourceColumn = name;
- param.SourceVersion = DataRowVersion.Current;
- return param;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID");
- delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
- delete.Connection = conn;
- da.DeleteCommand = delete;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("primitems", "itemID = :itemID", ds.Tables["primitems"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID");
- delete.Parameters.Add(createSqliteParameter("itemID", typeof (String)));
- delete.Connection = conn;
- da.DeleteCommand = delete;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]);
- da.InsertCommand.Connection = conn;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("land", ds.Tables["land"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID");
- delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
- da.DeleteCommand = delete;
- da.DeleteCommand.Connection = conn;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID");
- delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String)));
- delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
- da.DeleteCommand = delete;
- da.DeleteCommand.Connection = conn;
-
- }
-
- private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("regionsettings", ds.Tables["regionsettings"]);
- da.InsertCommand.Connection = conn;
- da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID=:regionUUID", ds.Tables["regionsettings"]);
- da.UpdateCommand.Connection = conn;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", ds.Tables["primshapes"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID");
- delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
- delete.Connection = conn;
- da.DeleteCommand = delete;
- }
-
- /***********************************************************************
- *
- * Type conversion functions
- *
- **********************************************************************/
-
- ///
- /// Type conversion function
- ///
- ///
- ///
- private static DbType dbtypeFromType(Type type)
- {
- if (type == typeof (String))
- {
- return DbType.String;
- }
- else if (type == typeof (Int32))
- {
- return DbType.Int32;
- }
- else if (type == typeof (Double))
- {
- return DbType.Double;
- }
- else if (type == typeof (Byte))
- {
- return DbType.Byte;
- }
- else if (type == typeof (Double))
- {
- return DbType.Double;
- }
- else if (type == typeof (Byte[]))
- {
- return DbType.Binary;
- }
- else
- {
- return DbType.String;
- }
- }
-
- static void PrintDataSet(DataSet ds)
- {
- // Print out any name and extended properties.
- Console.WriteLine("DataSet is named: {0}", ds.DataSetName);
- foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
- {
- Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
- }
- Console.WriteLine();
- foreach (DataTable dt in ds.Tables)
- {
- Console.WriteLine("=> {0} Table:", dt.TableName);
- // Print out the column names.
- for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
- {
- Console.Write(dt.Columns[curCol].ColumnName + "\t");
- }
- Console.WriteLine("\n----------------------------------");
- // Print the DataTable.
- for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
- {
- for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
- {
- Console.Write(dt.Rows[curRow][curCol].ToString() + "\t");
- }
- Console.WriteLine();
- }
- }
- }
-
- }
-}
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
new file mode 100644
index 0000000..55c27b2
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -0,0 +1,2355 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using System.Data;
+using System.Drawing;
+using System.IO;
+using System.Reflection;
+using log4net;
+using Mono.Data.Sqlite;
+using OpenMetaverse;
+using OpenMetaverse.StructuredData;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Data.SQLite
+{
+ ///
+ /// A RegionData Interface to the SQLite database
+ ///
+ public class SQLiteSimulationData : ISimulationDataStore
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private const string primSelect = "select * from prims";
+ private const string shapeSelect = "select * from primshapes";
+ private const string itemsSelect = "select * from primitems";
+ private const string terrainSelect = "select * from terrain limit 1";
+ private const string landSelect = "select * from land";
+ private const string landAccessListSelect = "select distinct * from landaccesslist";
+ private const string regionbanListSelect = "select * from regionban";
+ private const string regionSettingsSelect = "select * from regionsettings";
+
+ private DataSet ds;
+ private SqliteDataAdapter primDa;
+ private SqliteDataAdapter shapeDa;
+ private SqliteDataAdapter itemsDa;
+ private SqliteDataAdapter terrainDa;
+ private SqliteDataAdapter landDa;
+ private SqliteDataAdapter landAccessListDa;
+ private SqliteDataAdapter regionSettingsDa;
+
+ private SqliteConnection m_conn;
+
+ private String m_connectionString;
+
+ // Temporary attribute while this is experimental
+
+ /***********************************************************************
+ *
+ * Public Interface Functions
+ *
+ **********************************************************************/
+
+ ///
+ /// See IRegionDataStore
+ ///
+ /// - Initialises RegionData Interface
+ /// - Loads and initialises a new SQLite connection and maintains it.
+ ///
+ ///
+ /// the connection string
+ public void Initialise(string connectionString)
+ {
+ try
+ {
+ m_connectionString = connectionString;
+
+ ds = new DataSet("Region");
+
+ m_log.Info("[SQLITE REGION DB]: Sqlite - connecting: " + connectionString);
+ m_conn = new SqliteConnection(m_connectionString);
+ m_conn.Open();
+
+ SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
+ primDa = new SqliteDataAdapter(primSelectCmd);
+
+ SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
+ shapeDa = new SqliteDataAdapter(shapeSelectCmd);
+ // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
+
+ SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
+ itemsDa = new SqliteDataAdapter(itemsSelectCmd);
+
+ SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
+ terrainDa = new SqliteDataAdapter(terrainSelectCmd);
+
+ SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
+ landDa = new SqliteDataAdapter(landSelectCmd);
+
+ SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
+ landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
+
+ SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
+ regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
+ // This actually does the roll forward assembly stuff
+ Assembly assem = GetType().Assembly;
+ Migration m = new Migration(m_conn, assem, "RegionStore");
+ m.Update();
+
+ lock (ds)
+ {
+ ds.Tables.Add(createPrimTable());
+ setupPrimCommands(primDa, m_conn);
+
+ ds.Tables.Add(createShapeTable());
+ setupShapeCommands(shapeDa, m_conn);
+
+ ds.Tables.Add(createItemsTable());
+ setupItemsCommands(itemsDa, m_conn);
+
+ ds.Tables.Add(createTerrainTable());
+ setupTerrainCommands(terrainDa, m_conn);
+
+ ds.Tables.Add(createLandTable());
+ setupLandCommands(landDa, m_conn);
+
+ ds.Tables.Add(createLandAccessListTable());
+ setupLandAccessCommands(landAccessListDa, m_conn);
+
+ ds.Tables.Add(createRegionSettingsTable());
+ setupRegionSettingsCommands(regionSettingsDa, m_conn);
+
+ // WORKAROUND: This is a work around for sqlite on
+ // windows, which gets really unhappy with blob columns
+ // that have no sample data in them. At some point we
+ // need to actually find a proper way to handle this.
+ try
+ {
+ primDa.Fill(ds.Tables["prims"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table");
+ }
+
+ try
+ {
+ shapeDa.Fill(ds.Tables["primshapes"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table");
+ }
+
+ try
+ {
+ itemsDa.Fill(ds.Tables["primitems"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
+ }
+
+ try
+ {
+ terrainDa.Fill(ds.Tables["terrain"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table");
+ }
+
+ try
+ {
+ landDa.Fill(ds.Tables["land"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[SQLITE REGION DB]: Caught fill error on land table");
+ }
+
+ try
+ {
+ landAccessListDa.Fill(ds.Tables["landaccesslist"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table");
+ }
+
+ try
+ {
+ regionSettingsDa.Fill(ds.Tables["regionsettings"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table");
+ }
+
+ // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
+ // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409
+ // Possibly because we manually set up our own DataTables before connecting to the database
+ CreateDataSetMapping(primDa, "prims");
+ CreateDataSetMapping(shapeDa, "primshapes");
+ CreateDataSetMapping(itemsDa, "primitems");
+ CreateDataSetMapping(terrainDa, "terrain");
+ CreateDataSetMapping(landDa, "land");
+ CreateDataSetMapping(landAccessListDa, "landaccesslist");
+ CreateDataSetMapping(regionSettingsDa, "regionsettings");
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.Error(e);
+ Environment.Exit(23);
+ }
+
+ return;
+ }
+
+ public void Dispose()
+ {
+ if (m_conn != null)
+ {
+ m_conn.Close();
+ m_conn = null;
+ }
+ if (ds != null)
+ {
+ ds.Dispose();
+ ds = null;
+ }
+ if (primDa != null)
+ {
+ primDa.Dispose();
+ primDa = null;
+ }
+ if (shapeDa != null)
+ {
+ shapeDa.Dispose();
+ shapeDa = null;
+ }
+ if (itemsDa != null)
+ {
+ itemsDa.Dispose();
+ itemsDa = null;
+ }
+ if (terrainDa != null)
+ {
+ terrainDa.Dispose();
+ terrainDa = null;
+ }
+ if (landDa != null)
+ {
+ landDa.Dispose();
+ landDa = null;
+ }
+ if (landAccessListDa != null)
+ {
+ landAccessListDa.Dispose();
+ landAccessListDa = null;
+ }
+ if (regionSettingsDa != null)
+ {
+ regionSettingsDa.Dispose();
+ regionSettingsDa = null;
+ }
+ }
+
+ public void StoreRegionSettings(RegionSettings rs)
+ {
+ lock (ds)
+ {
+ DataTable regionsettings = ds.Tables["regionsettings"];
+
+ DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString());
+ if (settingsRow == null)
+ {
+ settingsRow = regionsettings.NewRow();
+ fillRegionSettingsRow(settingsRow, rs);
+ regionsettings.Rows.Add(settingsRow);
+ }
+ else
+ {
+ fillRegionSettingsRow(settingsRow, rs);
+ }
+
+ Commit();
+ }
+ }
+ public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
+ {
+ //This connector doesn't support the windlight module yet
+ //Return default LL windlight settings
+ return new RegionLightShareData();
+ }
+ public void StoreRegionWindlightSettings(RegionLightShareData wl)
+ {
+ //This connector doesn't support the windlight module yet
+ }
+ public RegionSettings LoadRegionSettings(UUID regionUUID)
+ {
+ lock (ds)
+ {
+ DataTable regionsettings = ds.Tables["regionsettings"];
+
+ string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
+ DataRow[] rawsettings = regionsettings.Select(searchExp);
+ if (rawsettings.Length == 0)
+ {
+ RegionSettings rs = new RegionSettings();
+ rs.RegionUUID = regionUUID;
+ rs.OnSave += StoreRegionSettings;
+
+ StoreRegionSettings(rs);
+
+ return rs;
+ }
+ DataRow row = rawsettings[0];
+
+ RegionSettings newSettings = buildRegionSettings(row);
+ newSettings.OnSave += StoreRegionSettings;
+
+ return newSettings;
+ }
+ }
+
+ ///
+ /// Adds an object into region storage
+ ///
+ /// the object
+ /// the region UUID
+ public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
+ {
+ uint flags = obj.RootPart.GetEffectiveObjectFlags();
+
+ // Eligibility check
+ //
+ if ((flags & (uint)PrimFlags.Temporary) != 0)
+ return;
+ if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
+ return;
+
+ lock (ds)
+ {
+ foreach (SceneObjectPart prim in obj.Children.Values)
+ {
+// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
+ addPrim(prim, obj.UUID, regionUUID);
+ }
+ }
+
+ Commit();
+ // m_log.Info("[Dump of prims]: " + ds.GetXml());
+ }
+
+ ///
+ /// Removes an object from region storage
+ ///
+ /// the object
+ /// the region UUID
+ public void RemoveObject(UUID obj, UUID regionUUID)
+ {
+ // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID);
+
+ DataTable prims = ds.Tables["prims"];
+ DataTable shapes = ds.Tables["primshapes"];
+
+ string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'";
+ lock (ds)
+ {
+ DataRow[] primRows = prims.Select(selectExp);
+ foreach (DataRow row in primRows)
+ {
+ // Remove shape rows
+ UUID uuid = new UUID((string) row["UUID"]);
+ DataRow shapeRow = shapes.Rows.Find(uuid.ToString());
+ if (shapeRow != null)
+ {
+ shapeRow.Delete();
+ }
+
+ RemoveItems(uuid);
+
+ // Remove prim row
+ row.Delete();
+ }
+ }
+
+ Commit();
+ }
+
+ ///
+ /// Remove all persisted items of the given prim.
+ /// The caller must acquire the necessrary synchronization locks and commit or rollback changes.
+ ///
+ /// The item UUID
+ private void RemoveItems(UUID uuid)
+ {
+ DataTable items = ds.Tables["primitems"];
+
+ String sql = String.Format("primID = '{0}'", uuid);
+ DataRow[] itemRows = items.Select(sql);
+
+ foreach (DataRow itemRow in itemRows)
+ {
+ itemRow.Delete();
+ }
+ }
+
+ ///
+ /// Load persisted objects from region storage.
+ ///
+ /// The region UUID
+ /// List of loaded groups
+ public List LoadObjects(UUID regionUUID)
+ {
+ Dictionary createdObjects = new Dictionary();
+
+ List retvals = new List();
+
+ DataTable prims = ds.Tables["prims"];
+ DataTable shapes = ds.Tables["primshapes"];
+
+ string byRegion = "RegionUUID = '" + regionUUID + "'";
+
+ lock (ds)
+ {
+ DataRow[] primsForRegion = prims.Select(byRegion);
+// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
+
+ // First, create all groups
+ foreach (DataRow primRow in primsForRegion)
+ {
+ try
+ {
+ SceneObjectPart prim = null;
+
+ string uuid = (string) primRow["UUID"];
+ string objID = (string) primRow["SceneGroupID"];
+
+ if (uuid == objID) //is new SceneObjectGroup ?
+ {
+ prim = buildPrim(primRow);
+ DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
+ if (shapeRow != null)
+ {
+ prim.Shape = buildShape(shapeRow);
+ }
+ else
+ {
+ m_log.Warn(
+ "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
+ prim.Shape = PrimitiveBaseShape.Default;
+ }
+
+ SceneObjectGroup group = new SceneObjectGroup(prim);
+ createdObjects.Add(group.UUID, group);
+ retvals.Add(group);
+ LoadItems(prim);
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows");
+ m_log.Error("[SQLITE REGION DB]: ", e);
+ foreach (DataColumn col in prims.Columns)
+ {
+ m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
+ }
+ }
+ }
+
+ // Now fill the groups with part data
+ foreach (DataRow primRow in primsForRegion)
+ {
+ try
+ {
+ SceneObjectPart prim = null;
+
+ string uuid = (string) primRow["UUID"];
+ string objID = (string) primRow["SceneGroupID"];
+ if (uuid != objID) //is new SceneObjectGroup ?
+ {
+ prim = buildPrim(primRow);
+ DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
+ if (shapeRow != null)
+ {
+ prim.Shape = buildShape(shapeRow);
+ }
+ else
+ {
+ m_log.Warn(
+ "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
+ prim.Shape = PrimitiveBaseShape.Default;
+ }
+
+ createdObjects[new UUID(objID)].AddPart(prim);
+ LoadItems(prim);
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows");
+ m_log.Error("[SQLITE REGION DB]: ", e);
+ foreach (DataColumn col in prims.Columns)
+ {
+ m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
+ }
+ }
+ }
+ }
+ return retvals;
+ }
+
+ ///
+ /// Load in a prim's persisted inventory.
+ ///
+ /// the prim
+ private void LoadItems(SceneObjectPart prim)
+ {
+// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
+
+ DataTable dbItems = ds.Tables["primitems"];
+ String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
+ DataRow[] dbItemRows = dbItems.Select(sql);
+ IList inventory = new List();
+
+// m_log.DebugFormat(
+// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
+
+ foreach (DataRow row in dbItemRows)
+ {
+ TaskInventoryItem item = buildItem(row);
+ inventory.Add(item);
+
+// m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID);
+ }
+
+ prim.Inventory.RestoreInventoryItems(inventory);
+ }
+
+ ///
+ /// Store a terrain revision in region storage
+ ///
+ /// terrain heightfield
+ /// region UUID
+ public void StoreTerrain(double[,] ter, UUID regionID)
+ {
+ lock (ds)
+ {
+ int revision = Util.UnixTimeSinceEpoch();
+
+ // This is added to get rid of the infinitely growing
+ // terrain databases which negatively impact on SQLite
+ // over time. Before reenabling this feature there
+ // needs to be a limitter put on the number of
+ // revisions in the database, as this old
+ // implementation is a DOS attack waiting to happen.
+
+ using (
+ SqliteCommand cmd =
+ new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision",
+ m_conn))
+ {
+ cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
+ cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
+ cmd.ExecuteNonQuery();
+ }
+
+ // the following is an work around for .NET. The perf
+ // issues associated with it aren't as bad as you think.
+ m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString());
+ String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
+ " values(:RegionUUID, :Revision, :Heightfield)";
+
+ using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
+ {
+ cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
+ cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
+ cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter)));
+ cmd.ExecuteNonQuery();
+ }
+ }
+ }
+
+ ///
+ /// Load the latest terrain revision from region storage
+ ///
+ /// the region UUID
+ /// Heightfield data
+ public double[,] LoadTerrain(UUID regionID)
+ {
+ lock (ds)
+ {
+ double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
+ terret.Initialize();
+
+ String sql = "select RegionUUID, Revision, Heightfield from terrain" +
+ " where RegionUUID=:RegionUUID order by Revision desc";
+
+ using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
+ {
+ cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
+
+ using (IDataReader row = cmd.ExecuteReader())
+ {
+ int rev = 0;
+ if (row.Read())
+ {
+ // TODO: put this into a function
+ using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"]))
+ {
+ using (BinaryReader br = new BinaryReader(str))
+ {
+ for (int x = 0; x < (int)Constants.RegionSize; x++)
+ {
+ for (int y = 0; y < (int)Constants.RegionSize; y++)
+ {
+ terret[x, y] = br.ReadDouble();
+ }
+ }
+ }
+ }
+ rev = Convert.ToInt32(row["Revision"]);
+ }
+ else
+ {
+ m_log.Warn("[SQLITE REGION DB]: No terrain found for region");
+ return null;
+ }
+
+ m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString());
+ }
+ }
+ return terret;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void RemoveLandObject(UUID globalID)
+ {
+ lock (ds)
+ {
+ // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter
+ // after you're done.
+ // replaced below code with the SqliteAdapter version.
+ //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn))
+ //{
+ // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
+ // cmd.ExecuteNonQuery();
+ //}
+
+ //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn))
+ //{
+ // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
+ // cmd.ExecuteNonQuery();
+ //}
+
+ DataTable land = ds.Tables["land"];
+ DataTable landaccesslist = ds.Tables["landaccesslist"];
+ DataRow landRow = land.Rows.Find(globalID.ToString());
+ if (landRow != null)
+ {
+ land.Rows.Remove(landRow);
+ }
+ List rowsToDelete = new List();
+ foreach (DataRow rowToCheck in landaccesslist.Rows)
+ {
+ if (rowToCheck["LandUUID"].ToString() == globalID.ToString())
+ rowsToDelete.Add(rowToCheck);
+ }
+ for (int iter = 0; iter < rowsToDelete.Count; iter++)
+ {
+ landaccesslist.Rows.Remove(rowsToDelete[iter]);
+ }
+
+
+ }
+ Commit();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void StoreLandObject(ILandObject parcel)
+ {
+ lock (ds)
+ {
+ DataTable land = ds.Tables["land"];
+ DataTable landaccesslist = ds.Tables["landaccesslist"];
+
+ DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString());
+ if (landRow == null)
+ {
+ landRow = land.NewRow();
+ fillLandRow(landRow, parcel.LandData, parcel.RegionUUID);
+ land.Rows.Add(landRow);
+ }
+ else
+ {
+ fillLandRow(landRow, parcel.LandData, parcel.RegionUUID);
+ }
+
+ // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around
+ //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn))
+ //{
+ // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString()));
+ // cmd.ExecuteNonQuery();
+
+// }
+
+ // This is the slower.. but more appropriate thing to do
+
+ // We can't modify the table with direct queries before calling Commit() and re-filling them.
+ List rowsToDelete = new List();
+ foreach (DataRow rowToCheck in landaccesslist.Rows)
+ {
+ if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString())
+ rowsToDelete.Add(rowToCheck);
+ }
+ for (int iter = 0; iter < rowsToDelete.Count; iter++)
+ {
+ landaccesslist.Rows.Remove(rowsToDelete[iter]);
+ }
+ rowsToDelete.Clear();
+ foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList)
+ {
+ DataRow newAccessRow = landaccesslist.NewRow();
+ fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID);
+ landaccesslist.Rows.Add(newAccessRow);
+ }
+ }
+
+ Commit();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public List LoadLandObjects(UUID regionUUID)
+ {
+ List landDataForRegion = new List();
+ lock (ds)
+ {
+ DataTable land = ds.Tables["land"];
+ DataTable landaccesslist = ds.Tables["landaccesslist"];
+ string searchExp = "RegionUUID = '" + regionUUID + "'";
+ DataRow[] rawDataForRegion = land.Select(searchExp);
+ foreach (DataRow rawDataLand in rawDataForRegion)
+ {
+ LandData newLand = buildLandData(rawDataLand);
+ string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'";
+ DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp);
+ foreach (DataRow rawDataLandAccess in rawDataForLandAccessList)
+ {
+ newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess));
+ }
+
+ landDataForRegion.Add(newLand);
+ }
+ }
+ return landDataForRegion;
+ }
+
+ ///
+ ///
+ ///
+ public void Commit()
+ {
+ //m_log.Debug("[SQLITE]: Starting commit");
+ lock (ds)
+ {
+ primDa.Update(ds, "prims");
+ shapeDa.Update(ds, "primshapes");
+
+ itemsDa.Update(ds, "primitems");
+
+ terrainDa.Update(ds, "terrain");
+ landDa.Update(ds, "land");
+ landAccessListDa.Update(ds, "landaccesslist");
+ try
+ {
+ regionSettingsDa.Update(ds, "regionsettings");
+ }
+ catch (SqliteException SqlEx)
+ {
+ throw new Exception(
+ "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
+ SqlEx);
+ }
+ ds.AcceptChanges();
+ }
+ }
+
+ ///
+ /// See
+ ///
+ public void Shutdown()
+ {
+ Commit();
+ }
+
+ /***********************************************************************
+ *
+ * Database Definition Functions
+ *
+ * This should be db agnostic as we define them in ADO.NET terms
+ *
+ **********************************************************************/
+
+ protected void CreateDataSetMapping(IDataAdapter da, string tableName)
+ {
+ ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
+ foreach (DataColumn col in ds.Tables[tableName].Columns)
+ {
+ dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void createCol(DataTable dt, string name, Type type)
+ {
+ DataColumn col = new DataColumn(name, type);
+ dt.Columns.Add(col);
+ }
+
+ ///
+ /// Creates the "terrain" table
+ ///
+ /// terrain table DataTable
+ private static DataTable createTerrainTable()
+ {
+ DataTable terrain = new DataTable("terrain");
+
+ createCol(terrain, "RegionUUID", typeof (String));
+ createCol(terrain, "Revision", typeof (Int32));
+ createCol(terrain, "Heightfield", typeof (Byte[]));
+
+ return terrain;
+ }
+
+ ///
+ /// Creates the "prims" table
+ ///
+ /// prim table DataTable
+ private static DataTable createPrimTable()
+ {
+ DataTable prims = new DataTable("prims");
+
+ createCol(prims, "UUID", typeof (String));
+ createCol(prims, "RegionUUID", typeof (String));
+ createCol(prims, "CreationDate", typeof (Int32));
+ createCol(prims, "Name", typeof (String));
+ createCol(prims, "SceneGroupID", typeof (String));
+ // various text fields
+ createCol(prims, "Text", typeof (String));
+ createCol(prims, "ColorR", typeof (Int32));
+ createCol(prims, "ColorG", typeof (Int32));
+ createCol(prims, "ColorB", typeof (Int32));
+ createCol(prims, "ColorA", typeof (Int32));
+ createCol(prims, "Description", typeof (String));
+ createCol(prims, "SitName", typeof (String));
+ createCol(prims, "TouchName", typeof (String));
+ // permissions
+ createCol(prims, "ObjectFlags", typeof (Int32));
+ createCol(prims, "CreatorID", typeof (String));
+ createCol(prims, "OwnerID", typeof (String));
+ createCol(prims, "GroupID", typeof (String));
+ createCol(prims, "LastOwnerID", typeof (String));
+ createCol(prims, "OwnerMask", typeof (Int32));
+ createCol(prims, "NextOwnerMask", typeof (Int32));
+ createCol(prims, "GroupMask", typeof (Int32));
+ createCol(prims, "EveryoneMask", typeof (Int32));
+ createCol(prims, "BaseMask", typeof (Int32));
+ // vectors
+ createCol(prims, "PositionX", typeof (Double));
+ createCol(prims, "PositionY", typeof (Double));
+ createCol(prims, "PositionZ", typeof (Double));
+ createCol(prims, "GroupPositionX", typeof (Double));
+ createCol(prims, "GroupPositionY", typeof (Double));
+ createCol(prims, "GroupPositionZ", typeof (Double));
+ createCol(prims, "VelocityX", typeof (Double));
+ createCol(prims, "VelocityY", typeof (Double));
+ createCol(prims, "VelocityZ", typeof (Double));
+ createCol(prims, "AngularVelocityX", typeof (Double));
+ createCol(prims, "AngularVelocityY", typeof (Double));
+ createCol(prims, "AngularVelocityZ", typeof (Double));
+ createCol(prims, "AccelerationX", typeof (Double));
+ createCol(prims, "AccelerationY", typeof (Double));
+ createCol(prims, "AccelerationZ", typeof (Double));
+ // quaternions
+ createCol(prims, "RotationX", typeof (Double));
+ createCol(prims, "RotationY", typeof (Double));
+ createCol(prims, "RotationZ", typeof (Double));
+ createCol(prims, "RotationW", typeof (Double));
+
+ // sit target
+ createCol(prims, "SitTargetOffsetX", typeof (Double));
+ createCol(prims, "SitTargetOffsetY", typeof (Double));
+ createCol(prims, "SitTargetOffsetZ", typeof (Double));
+
+ createCol(prims, "SitTargetOrientW", typeof (Double));
+ createCol(prims, "SitTargetOrientX", typeof (Double));
+ createCol(prims, "SitTargetOrientY", typeof (Double));
+ createCol(prims, "SitTargetOrientZ", typeof (Double));
+
+ createCol(prims, "PayPrice", typeof(Int32));
+ createCol(prims, "PayButton1", typeof(Int32));
+ createCol(prims, "PayButton2", typeof(Int32));
+ createCol(prims, "PayButton3", typeof(Int32));
+ createCol(prims, "PayButton4", typeof(Int32));
+
+ createCol(prims, "LoopedSound", typeof(String));
+ createCol(prims, "LoopedSoundGain", typeof(Double));
+ createCol(prims, "TextureAnimation", typeof(String));
+ createCol(prims, "ParticleSystem", typeof(String));
+
+ createCol(prims, "OmegaX", typeof(Double));
+ createCol(prims, "OmegaY", typeof(Double));
+ createCol(prims, "OmegaZ", typeof(Double));
+
+ createCol(prims, "CameraEyeOffsetX", typeof(Double));
+ createCol(prims, "CameraEyeOffsetY", typeof(Double));
+ createCol(prims, "CameraEyeOffsetZ", typeof(Double));
+
+ createCol(prims, "CameraAtOffsetX", typeof(Double));
+ createCol(prims, "CameraAtOffsetY", typeof(Double));
+ createCol(prims, "CameraAtOffsetZ", typeof(Double));
+
+ createCol(prims, "ForceMouselook", typeof(Int16));
+
+ createCol(prims, "ScriptAccessPin", typeof(Int32));
+
+ createCol(prims, "AllowedDrop", typeof(Int16));
+ createCol(prims, "DieAtEdge", typeof(Int16));
+
+ createCol(prims, "SalePrice", typeof(Int32));
+ createCol(prims, "SaleType", typeof(Int16));
+
+ // click action
+ createCol(prims, "ClickAction", typeof (Byte));
+
+ createCol(prims, "Material", typeof(Byte));
+
+ createCol(prims, "CollisionSound", typeof(String));
+ createCol(prims, "CollisionSoundVolume", typeof(Double));
+
+ createCol(prims, "VolumeDetect", typeof(Int16));
+
+ createCol(prims, "MediaURL", typeof(String));
+
+ // Add in contraints
+ prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
+
+ return prims;
+ }
+
+ ///
+ /// Creates "primshapes" table
+ ///
+ /// shape table DataTable
+ private static DataTable createShapeTable()
+ {
+ DataTable shapes = new DataTable("primshapes");
+ createCol(shapes, "UUID", typeof (String));
+ // shape is an enum
+ createCol(shapes, "Shape", typeof (Int32));
+ // vectors
+ createCol(shapes, "ScaleX", typeof (Double));
+ createCol(shapes, "ScaleY", typeof (Double));
+ createCol(shapes, "ScaleZ", typeof (Double));
+ // paths
+ createCol(shapes, "PCode", typeof (Int32));
+ createCol(shapes, "PathBegin", typeof (Int32));
+ createCol(shapes, "PathEnd", typeof (Int32));
+ createCol(shapes, "PathScaleX", typeof (Int32));
+ createCol(shapes, "PathScaleY", typeof (Int32));
+ createCol(shapes, "PathShearX", typeof (Int32));
+ createCol(shapes, "PathShearY", typeof (Int32));
+ createCol(shapes, "PathSkew", typeof (Int32));
+ createCol(shapes, "PathCurve", typeof (Int32));
+ createCol(shapes, "PathRadiusOffset", typeof (Int32));
+ createCol(shapes, "PathRevolutions", typeof (Int32));
+ createCol(shapes, "PathTaperX", typeof (Int32));
+ createCol(shapes, "PathTaperY", typeof (Int32));
+ createCol(shapes, "PathTwist", typeof (Int32));
+ createCol(shapes, "PathTwistBegin", typeof (Int32));
+ // profile
+ createCol(shapes, "ProfileBegin", typeof (Int32));
+ createCol(shapes, "ProfileEnd", typeof (Int32));
+ createCol(shapes, "ProfileCurve", typeof (Int32));
+ createCol(shapes, "ProfileHollow", typeof (Int32));
+ createCol(shapes, "State", typeof(Int32));
+ // text TODO: this isn't right, but I'm not sure the right
+ // way to specify this as a blob atm
+ createCol(shapes, "Texture", typeof (Byte[]));
+ createCol(shapes, "ExtraParams", typeof (Byte[]));
+ createCol(shapes, "Media", typeof(String));
+
+ shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
+
+ return shapes;
+ }
+
+ ///
+ /// creates "primitems" table
+ ///
+ /// item table DataTable
+ private static DataTable createItemsTable()
+ {
+ DataTable items = new DataTable("primitems");
+
+ createCol(items, "itemID", typeof (String));
+ createCol(items, "primID", typeof (String));
+ createCol(items, "assetID", typeof (String));
+ createCol(items, "parentFolderID", typeof (String));
+
+ createCol(items, "invType", typeof (Int32));
+ createCol(items, "assetType", typeof (Int32));
+
+ createCol(items, "name", typeof (String));
+ createCol(items, "description", typeof (String));
+
+ createCol(items, "creationDate", typeof (Int64));
+ createCol(items, "creatorID", typeof (String));
+ createCol(items, "ownerID", typeof (String));
+ createCol(items, "lastOwnerID", typeof (String));
+ createCol(items, "groupID", typeof (String));
+
+ createCol(items, "nextPermissions", typeof (UInt32));
+ createCol(items, "currentPermissions", typeof (UInt32));
+ createCol(items, "basePermissions", typeof (UInt32));
+ createCol(items, "everyonePermissions", typeof (UInt32));
+ createCol(items, "groupPermissions", typeof (UInt32));
+ createCol(items, "flags", typeof (UInt32));
+
+ items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] };
+
+ return items;
+ }
+
+ ///
+ /// Creates "land" table
+ ///
+ /// land table DataTable
+ private static DataTable createLandTable()
+ {
+ DataTable land = new DataTable("land");
+ createCol(land, "UUID", typeof (String));
+ createCol(land, "RegionUUID", typeof (String));
+ createCol(land, "LocalLandID", typeof (UInt32));
+
+ // Bitmap is a byte[512]
+ createCol(land, "Bitmap", typeof (Byte[]));
+
+ createCol(land, "Name", typeof (String));
+ createCol(land, "Desc", typeof (String));
+ createCol(land, "OwnerUUID", typeof (String));
+ createCol(land, "IsGroupOwned", typeof (Boolean));
+ createCol(land, "Area", typeof (Int32));
+ createCol(land, "AuctionID", typeof (Int32)); //Unemplemented
+ createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
+ createCol(land, "ClaimDate", typeof (Int32));
+ createCol(land, "ClaimPrice", typeof (Int32));
+ createCol(land, "GroupUUID", typeof (string));
+ createCol(land, "SalePrice", typeof (Int32));
+ createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus
+ createCol(land, "LandFlags", typeof (UInt32));
+ createCol(land, "LandingType", typeof (Byte));
+ createCol(land, "MediaAutoScale", typeof (Byte));
+ createCol(land, "MediaTextureUUID", typeof (String));
+ createCol(land, "MediaURL", typeof (String));
+ createCol(land, "MusicURL", typeof (String));
+ createCol(land, "PassHours", typeof (Double));
+ createCol(land, "PassPrice", typeof (UInt32));
+ createCol(land, "SnapshotUUID", typeof (String));
+ createCol(land, "UserLocationX", typeof (Double));
+ createCol(land, "UserLocationY", typeof (Double));
+ createCol(land, "UserLocationZ", typeof (Double));
+ createCol(land, "UserLookAtX", typeof (Double));
+ createCol(land, "UserLookAtY", typeof (Double));
+ createCol(land, "UserLookAtZ", typeof (Double));
+ createCol(land, "AuthbuyerID", typeof(String));
+ createCol(land, "OtherCleanTime", typeof(Int32));
+
+ land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
+
+ return land;
+ }
+
+ ///
+ /// create "landaccesslist" table
+ ///
+ /// Landacceslist DataTable
+ private static DataTable createLandAccessListTable()
+ {
+ DataTable landaccess = new DataTable("landaccesslist");
+ createCol(landaccess, "LandUUID", typeof (String));
+ createCol(landaccess, "AccessUUID", typeof (String));
+ createCol(landaccess, "Flags", typeof (UInt32));
+
+ return landaccess;
+ }
+
+ private static DataTable createRegionSettingsTable()
+ {
+ DataTable regionsettings = new DataTable("regionsettings");
+ createCol(regionsettings, "regionUUID", typeof(String));
+ createCol(regionsettings, "block_terraform", typeof (Int32));
+ createCol(regionsettings, "block_fly", typeof (Int32));
+ createCol(regionsettings, "allow_damage", typeof (Int32));
+ createCol(regionsettings, "restrict_pushing", typeof (Int32));
+ createCol(regionsettings, "allow_land_resell", typeof (Int32));
+ createCol(regionsettings, "allow_land_join_divide", typeof (Int32));
+ createCol(regionsettings, "block_show_in_search", typeof (Int32));
+ createCol(regionsettings, "agent_limit", typeof (Int32));
+ createCol(regionsettings, "object_bonus", typeof (Double));
+ createCol(regionsettings, "maturity", typeof (Int32));
+ createCol(regionsettings, "disable_scripts", typeof (Int32));
+ createCol(regionsettings, "disable_collisions", typeof (Int32));
+ createCol(regionsettings, "disable_physics", typeof (Int32));
+ createCol(regionsettings, "terrain_texture_1", typeof(String));
+ createCol(regionsettings, "terrain_texture_2", typeof(String));
+ createCol(regionsettings, "terrain_texture_3", typeof(String));
+ createCol(regionsettings, "terrain_texture_4", typeof(String));
+ createCol(regionsettings, "elevation_1_nw", typeof (Double));
+ createCol(regionsettings, "elevation_2_nw", typeof (Double));
+ createCol(regionsettings, "elevation_1_ne", typeof (Double));
+ createCol(regionsettings, "elevation_2_ne", typeof (Double));
+ createCol(regionsettings, "elevation_1_se", typeof (Double));
+ createCol(regionsettings, "elevation_2_se", typeof (Double));
+ createCol(regionsettings, "elevation_1_sw", typeof (Double));
+ createCol(regionsettings, "elevation_2_sw", typeof (Double));
+ createCol(regionsettings, "water_height", typeof (Double));
+ createCol(regionsettings, "terrain_raise_limit", typeof (Double));
+ createCol(regionsettings, "terrain_lower_limit", typeof (Double));
+ createCol(regionsettings, "use_estate_sun", typeof (Int32));
+ createCol(regionsettings, "sandbox", typeof (Int32));
+ createCol(regionsettings, "sunvectorx",typeof (Double));
+ createCol(regionsettings, "sunvectory",typeof (Double));
+ createCol(regionsettings, "sunvectorz",typeof (Double));
+ createCol(regionsettings, "fixed_sun", typeof (Int32));
+ createCol(regionsettings, "sun_position", typeof (Double));
+ createCol(regionsettings, "covenant", typeof(String));
+ createCol(regionsettings, "map_tile_ID", typeof(String));
+ regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
+ return regionsettings;
+ }
+
+ /***********************************************************************
+ *
+ * Convert between ADO.NET <=> OpenSim Objects
+ *
+ * These should be database independant
+ *
+ **********************************************************************/
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private SceneObjectPart buildPrim(DataRow row)
+ {
+ // Code commented. Uncomment to test the unit test inline.
+
+ // The unit test mentions this commented code for the purposes
+ // of debugging a unit test failure
+
+ // SceneObjectGroup sog = new SceneObjectGroup();
+ // SceneObjectPart sop = new SceneObjectPart();
+ // sop.LocalId = 1;
+ // sop.Name = "object1";
+ // sop.Description = "object1";
+ // sop.Text = "";
+ // sop.SitName = "";
+ // sop.TouchName = "";
+ // sop.UUID = UUID.Random();
+ // sop.Shape = PrimitiveBaseShape.Default;
+ // sog.SetRootPart(sop);
+ // Add breakpoint in above line. Check sop fields.
+
+ // TODO: this doesn't work yet because something more
+ // interesting has to be done to actually get these values
+ // back out. Not enough time to figure it out yet.
+
+ SceneObjectPart prim = new SceneObjectPart();
+ prim.UUID = new UUID((String) row["UUID"]);
+ // explicit conversion of integers is required, which sort
+ // of sucks. No idea if there is a shortcut here or not.
+ prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
+ prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"];
+ // various text fields
+ prim.Text = (String) row["Text"];
+ prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
+ Convert.ToInt32(row["ColorR"]),
+ Convert.ToInt32(row["ColorG"]),
+ Convert.ToInt32(row["ColorB"]));
+ prim.Description = (String) row["Description"];
+ prim.SitName = (String) row["SitName"];
+ prim.TouchName = (String) row["TouchName"];
+ // permissions
+ prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
+ prim.CreatorID = new UUID((String) row["CreatorID"]);
+ prim.OwnerID = new UUID((String) row["OwnerID"]);
+ prim.GroupID = new UUID((String) row["GroupID"]);
+ prim.LastOwnerID = new UUID((String) row["LastOwnerID"]);
+ prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
+ prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
+ prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
+ prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]);
+ prim.BaseMask = Convert.ToUInt32(row["BaseMask"]);
+ // vectors
+ prim.OffsetPosition = new Vector3(
+ Convert.ToSingle(row["PositionX"]),
+ Convert.ToSingle(row["PositionY"]),
+ Convert.ToSingle(row["PositionZ"])
+ );
+ prim.GroupPosition = new Vector3(
+ Convert.ToSingle(row["GroupPositionX"]),
+ Convert.ToSingle(row["GroupPositionY"]),
+ Convert.ToSingle(row["GroupPositionZ"])
+ );
+ prim.Velocity = new Vector3(
+ Convert.ToSingle(row["VelocityX"]),
+ Convert.ToSingle(row["VelocityY"]),
+ Convert.ToSingle(row["VelocityZ"])
+ );
+ prim.AngularVelocity = new Vector3(
+ Convert.ToSingle(row["AngularVelocityX"]),
+ Convert.ToSingle(row["AngularVelocityY"]),
+ Convert.ToSingle(row["AngularVelocityZ"])
+ );
+ prim.Acceleration = new Vector3(
+ Convert.ToSingle(row["AccelerationX"]),
+ Convert.ToSingle(row["AccelerationY"]),
+ Convert.ToSingle(row["AccelerationZ"])
+ );
+ // quaternions
+ prim.RotationOffset = new Quaternion(
+ Convert.ToSingle(row["RotationX"]),
+ Convert.ToSingle(row["RotationY"]),
+ Convert.ToSingle(row["RotationZ"]),
+ Convert.ToSingle(row["RotationW"])
+ );
+
+ prim.SitTargetPositionLL = new Vector3(
+ Convert.ToSingle(row["SitTargetOffsetX"]),
+ Convert.ToSingle(row["SitTargetOffsetY"]),
+ Convert.ToSingle(row["SitTargetOffsetZ"]));
+ prim.SitTargetOrientationLL = new Quaternion(
+ Convert.ToSingle(
+ row["SitTargetOrientX"]),
+ Convert.ToSingle(
+ row["SitTargetOrientY"]),
+ Convert.ToSingle(
+ row["SitTargetOrientZ"]),
+ Convert.ToSingle(
+ row["SitTargetOrientW"]));
+
+ prim.ClickAction = Convert.ToByte(row["ClickAction"]);
+ prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
+ prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]);
+ prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]);
+ prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]);
+ prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]);
+
+ prim.Sound = new UUID(row["LoopedSound"].ToString());
+ prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]);
+ prim.SoundFlags = 1; // If it's persisted at all, it's looped
+
+ if (!row.IsNull("TextureAnimation"))
+ prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString());
+ if (!row.IsNull("ParticleSystem"))
+ prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString());
+
+ prim.AngularVelocity = new Vector3(
+ Convert.ToSingle(row["OmegaX"]),
+ Convert.ToSingle(row["OmegaY"]),
+ Convert.ToSingle(row["OmegaZ"])
+ );
+
+ prim.SetCameraEyeOffset(new Vector3(
+ Convert.ToSingle(row["CameraEyeOffsetX"]),
+ Convert.ToSingle(row["CameraEyeOffsetY"]),
+ Convert.ToSingle(row["CameraEyeOffsetZ"])
+ ));
+
+ prim.SetCameraAtOffset(new Vector3(
+ Convert.ToSingle(row["CameraAtOffsetX"]),
+ Convert.ToSingle(row["CameraAtOffsetY"]),
+ Convert.ToSingle(row["CameraAtOffsetZ"])
+ ));
+
+ if (Convert.ToInt16(row["ForceMouselook"]) != 0)
+ prim.SetForceMouselook(true);
+
+ prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]);
+
+ if (Convert.ToInt16(row["AllowedDrop"]) != 0)
+ prim.AllowedDrop = true;
+
+ if (Convert.ToInt16(row["DieAtEdge"]) != 0)
+ prim.DIE_AT_EDGE = true;
+
+ prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
+ prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
+
+ prim.Material = Convert.ToByte(row["Material"]);
+
+ prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
+ prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
+
+ if (Convert.ToInt16(row["VolumeDetect"]) != 0)
+ prim.VolumeDetectActive = true;
+
+ if (!(row["MediaURL"] is System.DBNull))
+ {
+ //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
+ prim.MediaUrl = (string)row["MediaURL"];
+ }
+
+ return prim;
+ }
+
+ ///
+ /// Build a prim inventory item from the persisted data.
+ ///
+ ///
+ ///
+ private static TaskInventoryItem buildItem(DataRow row)
+ {
+ TaskInventoryItem taskItem = new TaskInventoryItem();
+
+ taskItem.ItemID = new UUID((String)row["itemID"]);
+ taskItem.ParentPartID = new UUID((String)row["primID"]);
+ taskItem.AssetID = new UUID((String)row["assetID"]);
+ taskItem.ParentID = new UUID((String)row["parentFolderID"]);
+
+ taskItem.InvType = Convert.ToInt32(row["invType"]);
+ taskItem.Type = Convert.ToInt32(row["assetType"]);
+
+ taskItem.Name = (String)row["name"];
+ taskItem.Description = (String)row["description"];
+ taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
+ taskItem.CreatorID = new UUID((String)row["creatorID"]);
+ taskItem.OwnerID = new UUID((String)row["ownerID"]);
+ taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]);
+ taskItem.GroupID = new UUID((String)row["groupID"]);
+
+ taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
+ taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
+ taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
+ taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
+ taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
+ taskItem.Flags = Convert.ToUInt32(row["flags"]);
+
+ return taskItem;
+ }
+
+ ///
+ /// Build a Land Data from the persisted data.
+ ///
+ ///
+ ///
+ private LandData buildLandData(DataRow row)
+ {
+ LandData newData = new LandData();
+
+ newData.GlobalID = new UUID((String) row["UUID"]);
+ newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
+
+ // Bitmap is a byte[512]
+ newData.Bitmap = (Byte[]) row["Bitmap"];
+
+ newData.Name = (String) row["Name"];
+ newData.Description = (String) row["Desc"];
+ newData.OwnerID = (UUID)(String) row["OwnerUUID"];
+ newData.IsGroupOwned = (Boolean) row["IsGroupOwned"];
+ newData.Area = Convert.ToInt32(row["Area"]);
+ newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
+ newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]);
+ //Enum OpenMetaverse.Parcel.ParcelCategory
+ newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
+ newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
+ newData.GroupID = new UUID((String) row["GroupUUID"]);
+ newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
+ newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]);
+ //Enum. OpenMetaverse.Parcel.ParcelStatus
+ newData.Flags = Convert.ToUInt32(row["LandFlags"]);
+ newData.LandingType = (Byte) row["LandingType"];
+ newData.MediaAutoScale = (Byte) row["MediaAutoScale"];
+ newData.MediaID = new UUID((String) row["MediaTextureUUID"]);
+ newData.MediaURL = (String) row["MediaURL"];
+ newData.MusicURL = (String) row["MusicURL"];
+ newData.PassHours = Convert.ToSingle(row["PassHours"]);
+ newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
+ newData.SnapshotID = (UUID)(String) row["SnapshotUUID"];
+ try
+ {
+
+ newData.UserLocation =
+ new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
+ Convert.ToSingle(row["UserLocationZ"]));
+ newData.UserLookAt =
+ new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
+ Convert.ToSingle(row["UserLookAtZ"]));
+
+ }
+ catch (InvalidCastException)
+ {
+ m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name);
+ newData.UserLocation = Vector3.Zero;
+ newData.UserLookAt = Vector3.Zero;
+ }
+ newData.ParcelAccessList = new List();
+ UUID authBuyerID = UUID.Zero;
+
+ UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
+
+ newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
+
+ return newData;
+ }
+
+ private RegionSettings buildRegionSettings(DataRow row)
+ {
+ RegionSettings newSettings = new RegionSettings();
+
+ newSettings.RegionUUID = new UUID((string) row["regionUUID"]);
+ newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
+ newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
+ newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
+ newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
+ newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
+ newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
+ newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
+ newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
+ newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
+ newSettings.Maturity = Convert.ToInt32(row["maturity"]);
+ newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
+ newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
+ newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
+ newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]);
+ newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]);
+ newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]);
+ newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]);
+ newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
+ newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
+ newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
+ newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
+ newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
+ newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
+ newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
+ newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
+ newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
+ newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
+ newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
+ newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
+ newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
+ newSettings.SunVector = new Vector3 (
+ Convert.ToSingle(row["sunvectorx"]),
+ Convert.ToSingle(row["sunvectory"]),
+ Convert.ToSingle(row["sunvectorz"])
+ );
+ newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
+ newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
+ newSettings.Covenant = new UUID((String) row["covenant"]);
+ newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
+
+ return newSettings;
+ }
+
+ ///
+ /// Build a land access entry from the persisted data.
+ ///
+ ///
+ ///
+ private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
+ {
+ ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
+ entry.AgentID = new UUID((string) row["AccessUUID"]);
+ entry.Flags = (AccessList) row["Flags"];
+ entry.Time = new DateTime();
+ return entry;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static Array serializeTerrain(double[,] val)
+ {
+ MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
+ BinaryWriter bw = new BinaryWriter(str);
+
+ // TODO: COMPATIBILITY - Add byte-order conversions
+ for (int x = 0; x < (int)Constants.RegionSize; x++)
+ for (int y = 0; y < (int)Constants.RegionSize; y++)
+ bw.Write(val[x, y]);
+
+ return str.ToArray();
+ }
+
+// private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val)
+// {
+// row["RegionUUID"] = regionUUID;
+// row["Revision"] = rev;
+
+ // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double));
+// BinaryWriter bw = new BinaryWriter(str);
+
+// // TODO: COMPATIBILITY - Add byte-order conversions
+ // for (int x = 0; x < (int)Constants.RegionSize; x++)
+ // for (int y = 0; y < (int)Constants.RegionSize; y++)
+// bw.Write(val[x, y]);
+
+// row["Heightfield"] = str.ToArray();
+// }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
+ {
+ row["UUID"] = prim.UUID.ToString();
+ row["RegionUUID"] = regionUUID.ToString();
+ row["CreationDate"] = prim.CreationDate;
+ row["Name"] = prim.Name;
+ row["SceneGroupID"] = sceneGroupID.ToString();
+ // the UUID of the root part for this SceneObjectGroup
+ // various text fields
+ row["Text"] = prim.Text;
+ row["Description"] = prim.Description;
+ row["SitName"] = prim.SitName;
+ row["TouchName"] = prim.TouchName;
+ // permissions
+ row["ObjectFlags"] = prim.ObjectFlags;
+ row["CreatorID"] = prim.CreatorID.ToString();
+ row["OwnerID"] = prim.OwnerID.ToString();
+ row["GroupID"] = prim.GroupID.ToString();
+ row["LastOwnerID"] = prim.LastOwnerID.ToString();
+ row["OwnerMask"] = prim.OwnerMask;
+ row["NextOwnerMask"] = prim.NextOwnerMask;
+ row["GroupMask"] = prim.GroupMask;
+ row["EveryoneMask"] = prim.EveryoneMask;
+ row["BaseMask"] = prim.BaseMask;
+ // vectors
+ row["PositionX"] = prim.OffsetPosition.X;
+ row["PositionY"] = prim.OffsetPosition.Y;
+ row["PositionZ"] = prim.OffsetPosition.Z;
+ row["GroupPositionX"] = prim.GroupPosition.X;
+ row["GroupPositionY"] = prim.GroupPosition.Y;
+ row["GroupPositionZ"] = prim.GroupPosition.Z;
+ row["VelocityX"] = prim.Velocity.X;
+ row["VelocityY"] = prim.Velocity.Y;
+ row["VelocityZ"] = prim.Velocity.Z;
+ row["AngularVelocityX"] = prim.AngularVelocity.X;
+ row["AngularVelocityY"] = prim.AngularVelocity.Y;
+ row["AngularVelocityZ"] = prim.AngularVelocity.Z;
+ row["AccelerationX"] = prim.Acceleration.X;
+ row["AccelerationY"] = prim.Acceleration.Y;
+ row["AccelerationZ"] = prim.Acceleration.Z;
+ // quaternions
+ row["RotationX"] = prim.RotationOffset.X;
+ row["RotationY"] = prim.RotationOffset.Y;
+ row["RotationZ"] = prim.RotationOffset.Z;
+ row["RotationW"] = prim.RotationOffset.W;
+
+ // Sit target
+ Vector3 sitTargetPos = prim.SitTargetPositionLL;
+ row["SitTargetOffsetX"] = sitTargetPos.X;
+ row["SitTargetOffsetY"] = sitTargetPos.Y;
+ row["SitTargetOffsetZ"] = sitTargetPos.Z;
+
+ Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
+ row["SitTargetOrientW"] = sitTargetOrient.W;
+ row["SitTargetOrientX"] = sitTargetOrient.X;
+ row["SitTargetOrientY"] = sitTargetOrient.Y;
+ row["SitTargetOrientZ"] = sitTargetOrient.Z;
+ row["ColorR"] = Convert.ToInt32(prim.Color.R);
+ row["ColorG"] = Convert.ToInt32(prim.Color.G);
+ row["ColorB"] = Convert.ToInt32(prim.Color.B);
+ row["ColorA"] = Convert.ToInt32(prim.Color.A);
+ row["PayPrice"] = prim.PayPrice[0];
+ row["PayButton1"] = prim.PayPrice[1];
+ row["PayButton2"] = prim.PayPrice[2];
+ row["PayButton3"] = prim.PayPrice[3];
+ row["PayButton4"] = prim.PayPrice[4];
+
+ row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation);
+ row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem);
+
+ row["OmegaX"] = prim.AngularVelocity.X;
+ row["OmegaY"] = prim.AngularVelocity.Y;
+ row["OmegaZ"] = prim.AngularVelocity.Z;
+
+ row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X;
+ row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y;
+ row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z;
+
+ row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X;
+ row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y;
+ row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z;
+
+
+ if ((prim.SoundFlags & 1) != 0) // Looped
+ {
+ row["LoopedSound"] = prim.Sound.ToString();
+ row["LoopedSoundGain"] = prim.SoundGain;
+ }
+ else
+ {
+ row["LoopedSound"] = UUID.Zero.ToString();
+ row["LoopedSoundGain"] = 0.0f;
+ }
+
+ if (prim.GetForceMouselook())
+ row["ForceMouselook"] = 1;
+ else
+ row["ForceMouselook"] = 0;
+
+ row["ScriptAccessPin"] = prim.ScriptAccessPin;
+
+ if (prim.AllowedDrop)
+ row["AllowedDrop"] = 1;
+ else
+ row["AllowedDrop"] = 0;
+
+ if (prim.DIE_AT_EDGE)
+ row["DieAtEdge"] = 1;
+ else
+ row["DieAtEdge"] = 0;
+
+ row["SalePrice"] = prim.SalePrice;
+ row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType);
+
+ // click action
+ row["ClickAction"] = prim.ClickAction;
+
+ row["SalePrice"] = prim.SalePrice;
+ row["Material"] = prim.Material;
+
+ row["CollisionSound"] = prim.CollisionSound.ToString();
+ row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
+ if (prim.VolumeDetectActive)
+ row["VolumeDetect"] = 1;
+ else
+ row["VolumeDetect"] = 0;
+
+ row["MediaURL"] = prim.MediaUrl;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
+ {
+ row["itemID"] = taskItem.ItemID.ToString();
+ row["primID"] = taskItem.ParentPartID.ToString();
+ row["assetID"] = taskItem.AssetID.ToString();
+ row["parentFolderID"] = taskItem.ParentID.ToString();
+
+ row["invType"] = taskItem.InvType;
+ row["assetType"] = taskItem.Type;
+
+ row["name"] = taskItem.Name;
+ row["description"] = taskItem.Description;
+ row["creationDate"] = taskItem.CreationDate;
+ row["creatorID"] = taskItem.CreatorID.ToString();
+ row["ownerID"] = taskItem.OwnerID.ToString();
+ row["lastOwnerID"] = taskItem.LastOwnerID.ToString();
+ row["groupID"] = taskItem.GroupID.ToString();
+ row["nextPermissions"] = taskItem.NextPermissions;
+ row["currentPermissions"] = taskItem.CurrentPermissions;
+ row["basePermissions"] = taskItem.BasePermissions;
+ row["everyonePermissions"] = taskItem.EveryonePermissions;
+ row["groupPermissions"] = taskItem.GroupPermissions;
+ row["flags"] = taskItem.Flags;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillLandRow(DataRow row, LandData land, UUID regionUUID)
+ {
+ row["UUID"] = land.GlobalID.ToString();
+ row["RegionUUID"] = regionUUID.ToString();
+ row["LocalLandID"] = land.LocalID;
+
+ // Bitmap is a byte[512]
+ row["Bitmap"] = land.Bitmap;
+
+ row["Name"] = land.Name;
+ row["Desc"] = land.Description;
+ row["OwnerUUID"] = land.OwnerID.ToString();
+ row["IsGroupOwned"] = land.IsGroupOwned;
+ row["Area"] = land.Area;
+ row["AuctionID"] = land.AuctionID; //Unemplemented
+ row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
+ row["ClaimDate"] = land.ClaimDate;
+ row["ClaimPrice"] = land.ClaimPrice;
+ row["GroupUUID"] = land.GroupID.ToString();
+ row["SalePrice"] = land.SalePrice;
+ row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus
+ row["LandFlags"] = land.Flags;
+ row["LandingType"] = land.LandingType;
+ row["MediaAutoScale"] = land.MediaAutoScale;
+ row["MediaTextureUUID"] = land.MediaID.ToString();
+ row["MediaURL"] = land.MediaURL;
+ row["MusicURL"] = land.MusicURL;
+ row["PassHours"] = land.PassHours;
+ row["PassPrice"] = land.PassPrice;
+ row["SnapshotUUID"] = land.SnapshotID.ToString();
+ row["UserLocationX"] = land.UserLocation.X;
+ row["UserLocationY"] = land.UserLocation.Y;
+ row["UserLocationZ"] = land.UserLocation.Z;
+ row["UserLookAtX"] = land.UserLookAt.X;
+ row["UserLookAtY"] = land.UserLookAt.Y;
+ row["UserLookAtZ"] = land.UserLookAt.Z;
+ row["AuthbuyerID"] = land.AuthBuyerID.ToString();
+ row["OtherCleanTime"] = land.OtherCleanTime;
+ row["MediaType"] = land.MediaType;
+ row["MediaDescription"] = land.MediaDescription;
+ row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
+ row["MediaLoop"] = land.MediaLoop.ToString();
+ row["ObscureMusic"] = land.ObscureMusic.ToString();
+ row["ObscureMedia"] = land.ObscureMedia.ToString();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
+ {
+ row["LandUUID"] = parcelID.ToString();
+ row["AccessUUID"] = entry.AgentID.ToString();
+ row["Flags"] = entry.Flags;
+ }
+
+ private static void fillRegionSettingsRow(DataRow row, RegionSettings settings)
+ {
+ row["regionUUID"] = settings.RegionUUID.ToString();
+ row["block_terraform"] = settings.BlockTerraform;
+ row["block_fly"] = settings.BlockFly;
+ row["allow_damage"] = settings.AllowDamage;
+ row["restrict_pushing"] = settings.RestrictPushing;
+ row["allow_land_resell"] = settings.AllowLandResell;
+ row["allow_land_join_divide"] = settings.AllowLandJoinDivide;
+ row["block_show_in_search"] = settings.BlockShowInSearch;
+ row["agent_limit"] = settings.AgentLimit;
+ row["object_bonus"] = settings.ObjectBonus;
+ row["maturity"] = settings.Maturity;
+ row["disable_scripts"] = settings.DisableScripts;
+ row["disable_collisions"] = settings.DisableCollisions;
+ row["disable_physics"] = settings.DisablePhysics;
+ row["terrain_texture_1"] = settings.TerrainTexture1.ToString();
+ row["terrain_texture_2"] = settings.TerrainTexture2.ToString();
+ row["terrain_texture_3"] = settings.TerrainTexture3.ToString();
+ row["terrain_texture_4"] = settings.TerrainTexture4.ToString();
+ row["elevation_1_nw"] = settings.Elevation1NW;
+ row["elevation_2_nw"] = settings.Elevation2NW;
+ row["elevation_1_ne"] = settings.Elevation1NE;
+ row["elevation_2_ne"] = settings.Elevation2NE;
+ row["elevation_1_se"] = settings.Elevation1SE;
+ row["elevation_2_se"] = settings.Elevation2SE;
+ row["elevation_1_sw"] = settings.Elevation1SW;
+ row["elevation_2_sw"] = settings.Elevation2SW;
+ row["water_height"] = settings.WaterHeight;
+ row["terrain_raise_limit"] = settings.TerrainRaiseLimit;
+ row["terrain_lower_limit"] = settings.TerrainLowerLimit;
+ row["use_estate_sun"] = settings.UseEstateSun;
+ row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox
+ row["sunvectorx"] = settings.SunVector.X;
+ row["sunvectory"] = settings.SunVector.Y;
+ row["sunvectorz"] = settings.SunVector.Z;
+ row["fixed_sun"] = settings.FixedSun;
+ row["sun_position"] = settings.SunPosition;
+ row["covenant"] = settings.Covenant.ToString();
+ row["map_tile_ID"] = settings.TerrainImageID.ToString();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private PrimitiveBaseShape buildShape(DataRow row)
+ {
+ PrimitiveBaseShape s = new PrimitiveBaseShape();
+ s.Scale = new Vector3(
+ Convert.ToSingle(row["ScaleX"]),
+ Convert.ToSingle(row["ScaleY"]),
+ Convert.ToSingle(row["ScaleZ"])
+ );
+ // paths
+ s.PCode = Convert.ToByte(row["PCode"]);
+ s.PathBegin = Convert.ToUInt16(row["PathBegin"]);
+ s.PathEnd = Convert.ToUInt16(row["PathEnd"]);
+ s.PathScaleX = Convert.ToByte(row["PathScaleX"]);
+ s.PathScaleY = Convert.ToByte(row["PathScaleY"]);
+ s.PathShearX = Convert.ToByte(row["PathShearX"]);
+ s.PathShearY = Convert.ToByte(row["PathShearY"]);
+ s.PathSkew = Convert.ToSByte(row["PathSkew"]);
+ s.PathCurve = Convert.ToByte(row["PathCurve"]);
+ s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]);
+ s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]);
+ s.PathTaperX = Convert.ToSByte(row["PathTaperX"]);
+ s.PathTaperY = Convert.ToSByte(row["PathTaperY"]);
+ s.PathTwist = Convert.ToSByte(row["PathTwist"]);
+ s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]);
+ // profile
+ s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]);
+ s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
+ s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
+ s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
+ s.State = Convert.ToByte(row["State"]);
+
+ byte[] textureEntry = (byte[])row["Texture"];
+ s.TextureEntry = textureEntry;
+
+ s.ExtraParams = (byte[]) row["ExtraParams"];
+
+ if (!(row["Media"] is System.DBNull))
+ s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
+
+ return s;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillShapeRow(DataRow row, SceneObjectPart prim)
+ {
+ PrimitiveBaseShape s = prim.Shape;
+ row["UUID"] = prim.UUID.ToString();
+ // shape is an enum
+ row["Shape"] = 0;
+ // vectors
+ row["ScaleX"] = s.Scale.X;
+ row["ScaleY"] = s.Scale.Y;
+ row["ScaleZ"] = s.Scale.Z;
+ // paths
+ row["PCode"] = s.PCode;
+ row["PathBegin"] = s.PathBegin;
+ row["PathEnd"] = s.PathEnd;
+ row["PathScaleX"] = s.PathScaleX;
+ row["PathScaleY"] = s.PathScaleY;
+ row["PathShearX"] = s.PathShearX;
+ row["PathShearY"] = s.PathShearY;
+ row["PathSkew"] = s.PathSkew;
+ row["PathCurve"] = s.PathCurve;
+ row["PathRadiusOffset"] = s.PathRadiusOffset;
+ row["PathRevolutions"] = s.PathRevolutions;
+ row["PathTaperX"] = s.PathTaperX;
+ row["PathTaperY"] = s.PathTaperY;
+ row["PathTwist"] = s.PathTwist;
+ row["PathTwistBegin"] = s.PathTwistBegin;
+ // profile
+ row["ProfileBegin"] = s.ProfileBegin;
+ row["ProfileEnd"] = s.ProfileEnd;
+ row["ProfileCurve"] = s.ProfileCurve;
+ row["ProfileHollow"] = s.ProfileHollow;
+ row["State"] = s.State;
+
+ row["Texture"] = s.TextureEntry;
+ row["ExtraParams"] = s.ExtraParams;
+
+ if (s.Media != null)
+ row["Media"] = s.Media.ToXml();
+ }
+
+ ///
+ /// Persistently store a prim.
+ ///
+ ///
+ ///
+ ///
+ private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
+ {
+ DataTable prims = ds.Tables["prims"];
+ DataTable shapes = ds.Tables["primshapes"];
+
+ DataRow primRow = prims.Rows.Find(prim.UUID.ToString());
+ if (primRow == null)
+ {
+ primRow = prims.NewRow();
+ fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
+ prims.Rows.Add(primRow);
+ }
+ else
+ {
+ fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
+ }
+
+ DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
+ if (shapeRow == null)
+ {
+ shapeRow = shapes.NewRow();
+ fillShapeRow(shapeRow, prim);
+ shapes.Rows.Add(shapeRow);
+ }
+ else
+ {
+ fillShapeRow(shapeRow, prim);
+ }
+ }
+
+ ///
+ /// see IRegionDatastore
+ ///
+ ///
+ ///
+ public void StorePrimInventory(UUID primID, ICollection items)
+ {
+// m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
+
+ DataTable dbItems = ds.Tables["primitems"];
+
+ // For now, we're just going to crudely remove all the previous inventory items
+ // no matter whether they have changed or not, and replace them with the current set.
+ lock (ds)
+ {
+ RemoveItems(primID);
+
+ // repalce with current inventory details
+ foreach (TaskInventoryItem newItem in items)
+ {
+// m_log.InfoFormat(
+// "[DATASTORE]: ",
+// "Adding item {0}, {1} to prim ID {2}",
+// newItem.Name, newItem.ItemID, newItem.ParentPartID);
+
+ DataRow newItemRow = dbItems.NewRow();
+ fillItemRow(newItemRow, newItem);
+ dbItems.Rows.Add(newItemRow);
+ }
+ }
+
+ Commit();
+ }
+
+ /***********************************************************************
+ *
+ * SQL Statement Creation Functions
+ *
+ * These functions create SQL statements for update, insert, and create.
+ * They can probably be factored later to have a db independant
+ * portion and a db specific portion
+ *
+ **********************************************************************/
+
+ ///
+ /// Create an insert command
+ ///
+ /// table name
+ /// data table
+ /// the created command
+ ///
+ /// This is subtle enough to deserve some commentary.
+ /// Instead of doing *lots* and *lots of hardcoded strings
+ /// for database definitions we'll use the fact that
+ /// realistically all insert statements look like "insert
+ /// into A(b, c) values(:b, :c) on the parameterized query
+ /// front. If we just have a list of b, c, etc... we can
+ /// generate these strings instead of typing them out.
+ ///
+ private static SqliteCommand createInsertCommand(string table, DataTable dt)
+ {
+ string[] cols = new string[dt.Columns.Count];
+ for (int i = 0; i < dt.Columns.Count; i++)
+ {
+ DataColumn col = dt.Columns[i];
+ cols[i] = col.ColumnName;
+ }
+
+ string sql = "insert into " + table + "(";
+ sql += String.Join(", ", cols);
+ // important, the first ':' needs to be here, the rest get added in the join
+ sql += ") values (:";
+ sql += String.Join(", :", cols);
+ sql += ")";
+ //m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
+ SqliteCommand cmd = new SqliteCommand(sql);
+
+ // this provides the binding for all our parameters, so
+ // much less code than it used to be
+ foreach (DataColumn col in dt.Columns)
+ {
+ cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
+ }
+ return cmd;
+ }
+
+
+ ///
+ /// create an update command
+ ///
+ /// table name
+ ///
+ ///
+ /// the created command
+ private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
+ {
+ string sql = "update " + table + " set ";
+ string subsql = String.Empty;
+ foreach (DataColumn col in dt.Columns)
+ {
+ if (subsql.Length > 0)
+ {
+ // a map function would rock so much here
+ subsql += ", ";
+ }
+ subsql += col.ColumnName + "= :" + col.ColumnName;
+ }
+ sql += subsql;
+ sql += " where " + pk;
+ SqliteCommand cmd = new SqliteCommand(sql);
+
+ // this provides the binding for all our parameters, so
+ // much less code than it used to be
+
+ foreach (DataColumn col in dt.Columns)
+ {
+ cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
+ }
+ return cmd;
+ }
+
+ ///
+ /// create an update command
+ ///
+ /// table name
+ ///
+ ///
+ /// the created command
+ private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt)
+ {
+ string sql = "update " + table + " set ";
+ string subsql = String.Empty;
+ foreach (DataColumn col in dt.Columns)
+ {
+ if (subsql.Length > 0)
+ {
+ // a map function would rock so much here
+ subsql += ", ";
+ }
+ subsql += col.ColumnName + "= :" + col.ColumnName;
+ }
+ sql += subsql;
+ sql += " where " + pk1 + " and " + pk2;
+ SqliteCommand cmd = new SqliteCommand(sql);
+
+ // this provides the binding for all our parameters, so
+ // much less code than it used to be
+
+ foreach (DataColumn col in dt.Columns)
+ {
+ cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
+ }
+ return cmd;
+ }
+
+ ///
+ ///
+ ///
+ /// Data Table
+ ///
+ // private static string defineTable(DataTable dt)
+ // {
+ // string sql = "create table " + dt.TableName + "(";
+ // string subsql = String.Empty;
+ // foreach (DataColumn col in dt.Columns)
+ // {
+ // if (subsql.Length > 0)
+ // {
+ // // a map function would rock so much here
+ // subsql += ",\n";
+ // }
+ // subsql += col.ColumnName + " " + sqliteType(col.DataType);
+ // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0])
+ // {
+ // subsql += " primary key";
+ // }
+ // }
+ // sql += subsql;
+ // sql += ")";
+ // return sql;
+ // }
+
+ /***********************************************************************
+ *
+ * Database Binding functions
+ *
+ * These will be db specific due to typing, and minor differences
+ * in databases.
+ *
+ **********************************************************************/
+
+ ///
+ /// This is a convenience function that collapses 5 repetitive
+ /// lines for defining SqliteParameters to 2 parameters:
+ /// column name and database type.
+ ///
+ /// It assumes certain conventions like :param as the param
+ /// name to replace in parametrized queries, and that source
+ /// version is always current version, both of which are fine
+ /// for us.
+ ///
+ ///a built sqlite parameter
+ private static SqliteParameter createSqliteParameter(string name, Type type)
+ {
+ SqliteParameter param = new SqliteParameter();
+ param.ParameterName = ":" + name;
+ param.DbType = dbtypeFromType(type);
+ param.SourceColumn = name;
+ param.SourceVersion = DataRowVersion.Current;
+ return param;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID");
+ delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
+ delete.Connection = conn;
+ da.DeleteCommand = delete;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("primitems", "itemID = :itemID", ds.Tables["primitems"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID");
+ delete.Parameters.Add(createSqliteParameter("itemID", typeof (String)));
+ delete.Connection = conn;
+ da.DeleteCommand = delete;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]);
+ da.InsertCommand.Connection = conn;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("land", ds.Tables["land"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID");
+ delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
+ da.DeleteCommand = delete;
+ da.DeleteCommand.Connection = conn;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID");
+ delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String)));
+ delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
+ da.DeleteCommand = delete;
+ da.DeleteCommand.Connection = conn;
+
+ }
+
+ private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("regionsettings", ds.Tables["regionsettings"]);
+ da.InsertCommand.Connection = conn;
+ da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID=:regionUUID", ds.Tables["regionsettings"]);
+ da.UpdateCommand.Connection = conn;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", ds.Tables["primshapes"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID");
+ delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
+ delete.Connection = conn;
+ da.DeleteCommand = delete;
+ }
+
+ /***********************************************************************
+ *
+ * Type conversion functions
+ *
+ **********************************************************************/
+
+ ///
+ /// Type conversion function
+ ///
+ ///
+ ///
+ private static DbType dbtypeFromType(Type type)
+ {
+ if (type == typeof (String))
+ {
+ return DbType.String;
+ }
+ else if (type == typeof (Int32))
+ {
+ return DbType.Int32;
+ }
+ else if (type == typeof (Double))
+ {
+ return DbType.Double;
+ }
+ else if (type == typeof (Byte))
+ {
+ return DbType.Byte;
+ }
+ else if (type == typeof (Double))
+ {
+ return DbType.Double;
+ }
+ else if (type == typeof (Byte[]))
+ {
+ return DbType.Binary;
+ }
+ else
+ {
+ return DbType.String;
+ }
+ }
+
+ static void PrintDataSet(DataSet ds)
+ {
+ // Print out any name and extended properties.
+ Console.WriteLine("DataSet is named: {0}", ds.DataSetName);
+ foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
+ {
+ Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
+ }
+ Console.WriteLine();
+ foreach (DataTable dt in ds.Tables)
+ {
+ Console.WriteLine("=> {0} Table:", dt.TableName);
+ // Print out the column names.
+ for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
+ {
+ Console.Write(dt.Columns[curCol].ColumnName + "\t");
+ }
+ Console.WriteLine("\n----------------------------------");
+ // Print the DataTable.
+ for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
+ {
+ for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
+ {
+ Console.Write(dt.Rows[curRow][curCol].ToString() + "\t");
+ }
+ Console.WriteLine();
+ }
+ }
+ }
+
+ }
+}
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
deleted file mode 100644
index b5ce4c0..0000000
--- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
+++ /dev/null
@@ -1,2261 +0,0 @@
-/*
- * 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 OpenSimulator 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;
-using System.Collections.Generic;
-using System.Data;
-using System.Drawing;
-using System.IO;
-using System.Reflection;
-using log4net;
-using Mono.Data.SqliteClient;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Data.SQLiteLegacy
-{
- ///
- /// A RegionData Interface to the SQLite database
- ///
- public class SQLiteRegionData : IRegionDataStore
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private const string primSelect = "select * from prims";
- private const string shapeSelect = "select * from primshapes";
- private const string itemsSelect = "select * from primitems";
- private const string terrainSelect = "select * from terrain limit 1";
- private const string landSelect = "select * from land";
- private const string landAccessListSelect = "select distinct * from landaccesslist";
- private const string regionbanListSelect = "select * from regionban";
- private const string regionSettingsSelect = "select * from regionsettings";
-
- private DataSet ds;
- private SqliteDataAdapter primDa;
- private SqliteDataAdapter shapeDa;
- private SqliteDataAdapter itemsDa;
- private SqliteDataAdapter terrainDa;
- private SqliteDataAdapter landDa;
- private SqliteDataAdapter landAccessListDa;
- private SqliteDataAdapter regionSettingsDa;
-
- private SqliteConnection m_conn;
-
- private String m_connectionString;
-
- // Temporary attribute while this is experimental
-
- /***********************************************************************
- *
- * Public Interface Functions
- *
- **********************************************************************/
-
- ///
- /// See IRegionDataStore
- ///
- /// - Initialises RegionData Interface
- /// - Loads and initialises a new SQLite connection and maintains it.
- ///
- ///
- /// the connection string
- public void Initialise(string connectionString)
- {
- m_connectionString = connectionString;
-
- ds = new DataSet();
-
- m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
- m_conn = new SqliteConnection(m_connectionString);
- m_conn.Open();
-
-
-
- SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
- primDa = new SqliteDataAdapter(primSelectCmd);
- // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
-
- SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
- shapeDa = new SqliteDataAdapter(shapeSelectCmd);
- // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
-
- SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
- itemsDa = new SqliteDataAdapter(itemsSelectCmd);
-
- SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
- terrainDa = new SqliteDataAdapter(terrainSelectCmd);
-
- SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
- landDa = new SqliteDataAdapter(landSelectCmd);
-
- SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
- landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
-
- SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
- regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
- // This actually does the roll forward assembly stuff
- Assembly assem = GetType().Assembly;
- Migration m = new Migration(m_conn, assem, "RegionStore");
- m.Update();
-
- lock (ds)
- {
- ds.Tables.Add(createPrimTable());
- setupPrimCommands(primDa, m_conn);
- primDa.Fill(ds.Tables["prims"]);
-
- ds.Tables.Add(createShapeTable());
- setupShapeCommands(shapeDa, m_conn);
-
- ds.Tables.Add(createItemsTable());
- setupItemsCommands(itemsDa, m_conn);
- itemsDa.Fill(ds.Tables["primitems"]);
-
- ds.Tables.Add(createTerrainTable());
- setupTerrainCommands(terrainDa, m_conn);
-
- ds.Tables.Add(createLandTable());
- setupLandCommands(landDa, m_conn);
-
- ds.Tables.Add(createLandAccessListTable());
- setupLandAccessCommands(landAccessListDa, m_conn);
-
- ds.Tables.Add(createRegionSettingsTable());
-
- setupRegionSettingsCommands(regionSettingsDa, m_conn);
-
- // WORKAROUND: This is a work around for sqlite on
- // windows, which gets really unhappy with blob columns
- // that have no sample data in them. At some point we
- // need to actually find a proper way to handle this.
- try
- {
- shapeDa.Fill(ds.Tables["primshapes"]);
- }
- catch (Exception)
- {
- m_log.Info("[REGION DB]: Caught fill error on primshapes table");
- }
-
- try
- {
- terrainDa.Fill(ds.Tables["terrain"]);
- }
- catch (Exception)
- {
- m_log.Info("[REGION DB]: Caught fill error on terrain table");
- }
-
- try
- {
- landDa.Fill(ds.Tables["land"]);
- }
- catch (Exception)
- {
- m_log.Info("[REGION DB]: Caught fill error on land table");
- }
-
- try
- {
- landAccessListDa.Fill(ds.Tables["landaccesslist"]);
- }
- catch (Exception)
- {
- m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
- }
-
- try
- {
- regionSettingsDa.Fill(ds.Tables["regionsettings"]);
- }
- catch (Exception)
- {
- m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
- }
- return;
- }
- }
-
- public void Dispose()
- {
- if (m_conn != null)
- {
- m_conn.Close();
- m_conn = null;
- }
- if (ds != null)
- {
- ds.Dispose();
- ds = null;
- }
- if (primDa != null)
- {
- primDa.Dispose();
- primDa = null;
- }
- if (shapeDa != null)
- {
- shapeDa.Dispose();
- shapeDa = null;
- }
- if (itemsDa != null)
- {
- itemsDa.Dispose();
- itemsDa = null;
- }
- if (terrainDa != null)
- {
- terrainDa.Dispose();
- terrainDa = null;
- }
- if (landDa != null)
- {
- landDa.Dispose();
- landDa = null;
- }
- if (landAccessListDa != null)
- {
- landAccessListDa.Dispose();
- landAccessListDa = null;
- }
- if (regionSettingsDa != null)
- {
- regionSettingsDa.Dispose();
- regionSettingsDa = null;
- }
- }
-
- public void StoreRegionSettings(RegionSettings rs)
- {
- lock (ds)
- {
- DataTable regionsettings = ds.Tables["regionsettings"];
-
- DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString());
- if (settingsRow == null)
- {
- settingsRow = regionsettings.NewRow();
- fillRegionSettingsRow(settingsRow, rs);
- regionsettings.Rows.Add(settingsRow);
- }
- else
- {
- fillRegionSettingsRow(settingsRow, rs);
- }
-
- Commit();
- }
- }
- public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
- {
- //This connector doesn't support the windlight module yet
- //Return default LL windlight settings
- return new RegionLightShareData();
- }
- public void StoreRegionWindlightSettings(RegionLightShareData wl)
- {
- //This connector doesn't support the windlight module yet
- }
- public RegionSettings LoadRegionSettings(UUID regionUUID)
- {
- lock (ds)
- {
- DataTable regionsettings = ds.Tables["regionsettings"];
-
- string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
- DataRow[] rawsettings = regionsettings.Select(searchExp);
- if (rawsettings.Length == 0)
- {
- RegionSettings rs = new RegionSettings();
- rs.RegionUUID = regionUUID;
- rs.OnSave += StoreRegionSettings;
-
- StoreRegionSettings(rs);
-
- return rs;
- }
- DataRow row = rawsettings[0];
-
- RegionSettings newSettings = buildRegionSettings(row);
- newSettings.OnSave += StoreRegionSettings;
-
- return newSettings;
- }
- }
-
- ///
- /// Adds an object into region storage
- ///
- /// the object
- /// the region UUID
- public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
- {
- uint flags = obj.RootPart.GetEffectiveObjectFlags();
-
- // Eligibility check
- //
- if ((flags & (uint)PrimFlags.Temporary) != 0)
- return;
- if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
- return;
-
- lock (ds)
- {
- foreach (SceneObjectPart prim in obj.Children.Values)
- {
-// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
- addPrim(prim, obj.UUID, regionUUID);
- }
- }
-
- Commit();
- // m_log.Info("[Dump of prims]: " + ds.GetXml());
- }
-
- ///
- /// Removes an object from region storage
- ///
- /// the object
- /// the region UUID
- public void RemoveObject(UUID obj, UUID regionUUID)
- {
- // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID);
-
- DataTable prims = ds.Tables["prims"];
- DataTable shapes = ds.Tables["primshapes"];
-
- string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'";
- lock (ds)
- {
- DataRow[] primRows = prims.Select(selectExp);
- foreach (DataRow row in primRows)
- {
- // Remove shape rows
- UUID uuid = new UUID((string) row["UUID"]);
- DataRow shapeRow = shapes.Rows.Find(uuid.ToString());
- if (shapeRow != null)
- {
- shapeRow.Delete();
- }
-
- RemoveItems(uuid);
-
- // Remove prim row
- row.Delete();
- }
- }
-
- Commit();
- }
-
- ///
- /// Remove all persisted items of the given prim.
- /// The caller must acquire the necessrary synchronization locks and commit or rollback changes.
- ///
- /// The item UUID
- private void RemoveItems(UUID uuid)
- {
- DataTable items = ds.Tables["primitems"];
-
- String sql = String.Format("primID = '{0}'", uuid);
- DataRow[] itemRows = items.Select(sql);
-
- foreach (DataRow itemRow in itemRows)
- {
- itemRow.Delete();
- }
- }
-
- ///
- /// Load persisted objects from region storage.
- ///
- /// The region UUID
- /// List of loaded groups
- public List LoadObjects(UUID regionUUID)
- {
- Dictionary createdObjects = new Dictionary();
-
- List retvals = new List();
-
- DataTable prims = ds.Tables["prims"];
- DataTable shapes = ds.Tables["primshapes"];
-
- string byRegion = "RegionUUID = '" + regionUUID + "'";
-
- lock (ds)
- {
- DataRow[] primsForRegion = prims.Select(byRegion);
- m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
-
- // First, create all groups
- foreach (DataRow primRow in primsForRegion)
- {
- try
- {
- SceneObjectPart prim = null;
-
- string uuid = (string) primRow["UUID"];
- string objID = (string) primRow["SceneGroupID"];
-
- if (uuid == objID) //is new SceneObjectGroup ?
- {
- prim = buildPrim(primRow);
- DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
- if (shapeRow != null)
- {
- prim.Shape = buildShape(shapeRow);
- }
- else
- {
- m_log.Info(
- "[REGION DB]: No shape found for prim in storage, so setting default box shape");
- prim.Shape = PrimitiveBaseShape.Default;
- }
-
- SceneObjectGroup group = new SceneObjectGroup(prim);
- createdObjects.Add(group.UUID, group);
- retvals.Add(group);
- LoadItems(prim);
- }
- }
- catch (Exception e)
- {
- m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows");
- m_log.Info("[REGION DB]: " + e.ToString());
- foreach (DataColumn col in prims.Columns)
- {
- m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
- }
- }
- }
-
- // Now fill the groups with part data
- foreach (DataRow primRow in primsForRegion)
- {
- try
- {
- SceneObjectPart prim = null;
-
- string uuid = (string) primRow["UUID"];
- string objID = (string) primRow["SceneGroupID"];
- if (uuid != objID) //is new SceneObjectGroup ?
- {
- prim = buildPrim(primRow);
- DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
- if (shapeRow != null)
- {
- prim.Shape = buildShape(shapeRow);
- }
- else
- {
- m_log.Warn(
- "[REGION DB]: No shape found for prim in storage, so setting default box shape");
- prim.Shape = PrimitiveBaseShape.Default;
- }
-
- createdObjects[new UUID(objID)].AddPart(prim);
- LoadItems(prim);
- }
- }
- catch (Exception e)
- {
- m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows");
- m_log.Info("[REGION DB]: " + e.ToString());
- foreach (DataColumn col in prims.Columns)
- {
- m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
- }
- }
- }
- }
- return retvals;
- }
-
- ///
- /// Load in a prim's persisted inventory.
- ///
- /// the prim
- private void LoadItems(SceneObjectPart prim)
- {
- //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
-
- DataTable dbItems = ds.Tables["primitems"];
- String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
- DataRow[] dbItemRows = dbItems.Select(sql);
- IList inventory = new List();
-
- foreach (DataRow row in dbItemRows)
- {
- TaskInventoryItem item = buildItem(row);
- inventory.Add(item);
-
- //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
- }
-
- prim.Inventory.RestoreInventoryItems(inventory);
- }
-
- ///
- /// Store a terrain revision in region storage
- ///
- /// terrain heightfield
- /// region UUID
- public void StoreTerrain(double[,] ter, UUID regionID)
- {
- lock (ds)
- {
- int revision = Util.UnixTimeSinceEpoch();
-
- // This is added to get rid of the infinitely growing
- // terrain databases which negatively impact on SQLite
- // over time. Before reenabling this feature there
- // needs to be a limitter put on the number of
- // revisions in the database, as this old
- // implementation is a DOS attack waiting to happen.
-
- using (
- SqliteCommand cmd =
- new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision",
- m_conn))
- {
- cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
- cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
- cmd.ExecuteNonQuery();
- }
-
- // the following is an work around for .NET. The perf
- // issues associated with it aren't as bad as you think.
- m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString());
- String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
- " values(:RegionUUID, :Revision, :Heightfield)";
-
- using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
- {
- cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
- cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
- cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter)));
- cmd.ExecuteNonQuery();
- }
- }
- }
-
- ///
- /// Load the latest terrain revision from region storage
- ///
- /// the region UUID
- /// Heightfield data
- public double[,] LoadTerrain(UUID regionID)
- {
- lock (ds)
- {
- double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
- terret.Initialize();
-
- String sql = "select RegionUUID, Revision, Heightfield from terrain" +
- " where RegionUUID=:RegionUUID order by Revision desc";
-
- using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
- {
- cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
-
- using (IDataReader row = cmd.ExecuteReader())
- {
- int rev = 0;
- if (row.Read())
- {
- // TODO: put this into a function
- using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"]))
- {
- using (BinaryReader br = new BinaryReader(str))
- {
- for (int x = 0; x < (int)Constants.RegionSize; x++)
- {
- for (int y = 0; y < (int)Constants.RegionSize; y++)
- {
- terret[x, y] = br.ReadDouble();
- }
- }
- }
- }
- rev = (int) row["Revision"];
- }
- else
- {
- m_log.Info("[REGION DB]: No terrain found for region");
- return null;
- }
-
- m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString());
- }
- }
- return terret;
- }
- }
-
- ///
- ///
- ///
- ///
- public void RemoveLandObject(UUID globalID)
- {
- lock (ds)
- {
- // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter
- // after you're done.
- // replaced below code with the SqliteAdapter version.
- //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn))
- //{
- // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
- // cmd.ExecuteNonQuery();
- //}
-
- //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn))
- //{
- // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
- // cmd.ExecuteNonQuery();
- //}
-
- DataTable land = ds.Tables["land"];
- DataTable landaccesslist = ds.Tables["landaccesslist"];
- DataRow landRow = land.Rows.Find(globalID.ToString());
- if (landRow != null)
- {
- land.Rows.Remove(landRow);
- }
- List rowsToDelete = new List();
- foreach (DataRow rowToCheck in landaccesslist.Rows)
- {
- if (rowToCheck["LandUUID"].ToString() == globalID.ToString())
- rowsToDelete.Add(rowToCheck);
- }
- for (int iter = 0; iter < rowsToDelete.Count; iter++)
- {
- landaccesslist.Rows.Remove(rowsToDelete[iter]);
- }
-
-
- }
- Commit();
- }
-
- ///
- ///
- ///
- ///
- public void StoreLandObject(ILandObject parcel)
- {
- lock (ds)
- {
- DataTable land = ds.Tables["land"];
- DataTable landaccesslist = ds.Tables["landaccesslist"];
-
- DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString());
- if (landRow == null)
- {
- landRow = land.NewRow();
- fillLandRow(landRow, parcel.LandData, parcel.RegionUUID);
- land.Rows.Add(landRow);
- }
- else
- {
- fillLandRow(landRow, parcel.LandData, parcel.RegionUUID);
- }
-
- // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around
- //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn))
- //{
- // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString()));
- // cmd.ExecuteNonQuery();
-
-// }
-
- // This is the slower.. but more appropriate thing to do
-
- // We can't modify the table with direct queries before calling Commit() and re-filling them.
- List rowsToDelete = new List();
- foreach (DataRow rowToCheck in landaccesslist.Rows)
- {
- if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString())
- rowsToDelete.Add(rowToCheck);
- }
- for (int iter = 0; iter < rowsToDelete.Count; iter++)
- {
- landaccesslist.Rows.Remove(rowsToDelete[iter]);
- }
- rowsToDelete.Clear();
- foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList)
- {
- DataRow newAccessRow = landaccesslist.NewRow();
- fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID);
- landaccesslist.Rows.Add(newAccessRow);
- }
- }
-
- Commit();
- }
-
- ///
- ///
- ///
- ///
- ///
- public List LoadLandObjects(UUID regionUUID)
- {
- List landDataForRegion = new List();
- lock (ds)
- {
- DataTable land = ds.Tables["land"];
- DataTable landaccesslist = ds.Tables["landaccesslist"];
- string searchExp = "RegionUUID = '" + regionUUID + "'";
- DataRow[] rawDataForRegion = land.Select(searchExp);
- foreach (DataRow rawDataLand in rawDataForRegion)
- {
- LandData newLand = buildLandData(rawDataLand);
- string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'";
- DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp);
- foreach (DataRow rawDataLandAccess in rawDataForLandAccessList)
- {
- newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess));
- }
-
- landDataForRegion.Add(newLand);
- }
- }
- return landDataForRegion;
- }
-
- ///
- ///
- ///
- public void Commit()
- {
- lock (ds)
- {
- primDa.Update(ds, "prims");
- shapeDa.Update(ds, "primshapes");
-
- itemsDa.Update(ds, "primitems");
-
- terrainDa.Update(ds, "terrain");
- landDa.Update(ds, "land");
- landAccessListDa.Update(ds, "landaccesslist");
- try
- {
- regionSettingsDa.Update(ds, "regionsettings");
- }
- catch (SqliteExecutionException SqlEx)
- {
- if (SqlEx.Message.Contains("logic error"))
- {
- throw new Exception(
- "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
- SqlEx);
- }
- else
- {
- throw SqlEx;
- }
- }
- ds.AcceptChanges();
- }
- }
-
- ///
- /// See
- ///
- public void Shutdown()
- {
- Commit();
- }
-
- /***********************************************************************
- *
- * Database Definition Functions
- *
- * This should be db agnostic as we define them in ADO.NET terms
- *
- **********************************************************************/
-
- ///
- ///
- ///
- ///
- ///
- ///
- private static void createCol(DataTable dt, string name, Type type)
- {
- DataColumn col = new DataColumn(name, type);
- dt.Columns.Add(col);
- }
-
- ///
- /// Creates the "terrain" table
- ///
- /// terrain table DataTable
- private static DataTable createTerrainTable()
- {
- DataTable terrain = new DataTable("terrain");
-
- createCol(terrain, "RegionUUID", typeof (String));
- createCol(terrain, "Revision", typeof (Int32));
- createCol(terrain, "Heightfield", typeof (Byte[]));
-
- return terrain;
- }
-
- ///
- /// Creates the "prims" table
- ///
- /// prim table DataTable
- private static DataTable createPrimTable()
- {
- DataTable prims = new DataTable("prims");
-
- createCol(prims, "UUID", typeof (String));
- createCol(prims, "RegionUUID", typeof (String));
- createCol(prims, "CreationDate", typeof (Int32));
- createCol(prims, "Name", typeof (String));
- createCol(prims, "SceneGroupID", typeof (String));
- // various text fields
- createCol(prims, "Text", typeof (String));
- createCol(prims, "ColorR", typeof (Int32));
- createCol(prims, "ColorG", typeof (Int32));
- createCol(prims, "ColorB", typeof (Int32));
- createCol(prims, "ColorA", typeof (Int32));
- createCol(prims, "Description", typeof (String));
- createCol(prims, "SitName", typeof (String));
- createCol(prims, "TouchName", typeof (String));
- // permissions
- createCol(prims, "ObjectFlags", typeof (Int32));
- createCol(prims, "CreatorID", typeof (String));
- createCol(prims, "OwnerID", typeof (String));
- createCol(prims, "GroupID", typeof (String));
- createCol(prims, "LastOwnerID", typeof (String));
- createCol(prims, "OwnerMask", typeof (Int32));
- createCol(prims, "NextOwnerMask", typeof (Int32));
- createCol(prims, "GroupMask", typeof (Int32));
- createCol(prims, "EveryoneMask", typeof (Int32));
- createCol(prims, "BaseMask", typeof (Int32));
- // vectors
- createCol(prims, "PositionX", typeof (Double));
- createCol(prims, "PositionY", typeof (Double));
- createCol(prims, "PositionZ", typeof (Double));
- createCol(prims, "GroupPositionX", typeof (Double));
- createCol(prims, "GroupPositionY", typeof (Double));
- createCol(prims, "GroupPositionZ", typeof (Double));
- createCol(prims, "VelocityX", typeof (Double));
- createCol(prims, "VelocityY", typeof (Double));
- createCol(prims, "VelocityZ", typeof (Double));
- createCol(prims, "AngularVelocityX", typeof (Double));
- createCol(prims, "AngularVelocityY", typeof (Double));
- createCol(prims, "AngularVelocityZ", typeof (Double));
- createCol(prims, "AccelerationX", typeof (Double));
- createCol(prims, "AccelerationY", typeof (Double));
- createCol(prims, "AccelerationZ", typeof (Double));
- // quaternions
- createCol(prims, "RotationX", typeof (Double));
- createCol(prims, "RotationY", typeof (Double));
- createCol(prims, "RotationZ", typeof (Double));
- createCol(prims, "RotationW", typeof (Double));
-
- // sit target
- createCol(prims, "SitTargetOffsetX", typeof (Double));
- createCol(prims, "SitTargetOffsetY", typeof (Double));
- createCol(prims, "SitTargetOffsetZ", typeof (Double));
-
- createCol(prims, "SitTargetOrientW", typeof (Double));
- createCol(prims, "SitTargetOrientX", typeof (Double));
- createCol(prims, "SitTargetOrientY", typeof (Double));
- createCol(prims, "SitTargetOrientZ", typeof (Double));
-
- createCol(prims, "PayPrice", typeof(Int32));
- createCol(prims, "PayButton1", typeof(Int32));
- createCol(prims, "PayButton2", typeof(Int32));
- createCol(prims, "PayButton3", typeof(Int32));
- createCol(prims, "PayButton4", typeof(Int32));
-
- createCol(prims, "LoopedSound", typeof(String));
- createCol(prims, "LoopedSoundGain", typeof(Double));
- createCol(prims, "TextureAnimation", typeof(String));
- createCol(prims, "ParticleSystem", typeof(String));
-
- createCol(prims, "OmegaX", typeof(Double));
- createCol(prims, "OmegaY", typeof(Double));
- createCol(prims, "OmegaZ", typeof(Double));
-
- createCol(prims, "CameraEyeOffsetX", typeof(Double));
- createCol(prims, "CameraEyeOffsetY", typeof(Double));
- createCol(prims, "CameraEyeOffsetZ", typeof(Double));
-
- createCol(prims, "CameraAtOffsetX", typeof(Double));
- createCol(prims, "CameraAtOffsetY", typeof(Double));
- createCol(prims, "CameraAtOffsetZ", typeof(Double));
-
- createCol(prims, "ForceMouselook", typeof(Int16));
-
- createCol(prims, "ScriptAccessPin", typeof(Int32));
-
- createCol(prims, "AllowedDrop", typeof(Int16));
- createCol(prims, "DieAtEdge", typeof(Int16));
-
- createCol(prims, "SalePrice", typeof(Int32));
- createCol(prims, "SaleType", typeof(Int16));
-
- // click action
- createCol(prims, "ClickAction", typeof (Byte));
-
- createCol(prims, "Material", typeof(Byte));
-
- createCol(prims, "CollisionSound", typeof(String));
- createCol(prims, "CollisionSoundVolume", typeof(Double));
-
- createCol(prims, "VolumeDetect", typeof(Int16));
-
- // Add in contraints
- prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
-
- return prims;
- }
-
- ///
- /// Creates "primshapes" table
- ///
- /// shape table DataTable
- private static DataTable createShapeTable()
- {
- DataTable shapes = new DataTable("primshapes");
- createCol(shapes, "UUID", typeof (String));
- // shape is an enum
- createCol(shapes, "Shape", typeof (Int32));
- // vectors
- createCol(shapes, "ScaleX", typeof (Double));
- createCol(shapes, "ScaleY", typeof (Double));
- createCol(shapes, "ScaleZ", typeof (Double));
- // paths
- createCol(shapes, "PCode", typeof (Int32));
- createCol(shapes, "PathBegin", typeof (Int32));
- createCol(shapes, "PathEnd", typeof (Int32));
- createCol(shapes, "PathScaleX", typeof (Int32));
- createCol(shapes, "PathScaleY", typeof (Int32));
- createCol(shapes, "PathShearX", typeof (Int32));
- createCol(shapes, "PathShearY", typeof (Int32));
- createCol(shapes, "PathSkew", typeof (Int32));
- createCol(shapes, "PathCurve", typeof (Int32));
- createCol(shapes, "PathRadiusOffset", typeof (Int32));
- createCol(shapes, "PathRevolutions", typeof (Int32));
- createCol(shapes, "PathTaperX", typeof (Int32));
- createCol(shapes, "PathTaperY", typeof (Int32));
- createCol(shapes, "PathTwist", typeof (Int32));
- createCol(shapes, "PathTwistBegin", typeof (Int32));
- // profile
- createCol(shapes, "ProfileBegin", typeof (Int32));
- createCol(shapes, "ProfileEnd", typeof (Int32));
- createCol(shapes, "ProfileCurve", typeof (Int32));
- createCol(shapes, "ProfileHollow", typeof (Int32));
- createCol(shapes, "State", typeof(Int32));
- // text TODO: this isn't right, but I'm not sure the right
- // way to specify this as a blob atm
- createCol(shapes, "Texture", typeof (Byte[]));
- createCol(shapes, "ExtraParams", typeof (Byte[]));
-
- shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
-
- return shapes;
- }
-
- ///
- /// creates "primitems" table
- ///
- /// item table DataTable
- private static DataTable createItemsTable()
- {
- DataTable items = new DataTable("primitems");
-
- createCol(items, "itemID", typeof (String));
- createCol(items, "primID", typeof (String));
- createCol(items, "assetID", typeof (String));
- createCol(items, "parentFolderID", typeof (String));
-
- createCol(items, "invType", typeof (Int32));
- createCol(items, "assetType", typeof (Int32));
-
- createCol(items, "name", typeof (String));
- createCol(items, "description", typeof (String));
-
- createCol(items, "creationDate", typeof (Int64));
- createCol(items, "creatorID", typeof (String));
- createCol(items, "ownerID", typeof (String));
- createCol(items, "lastOwnerID", typeof (String));
- createCol(items, "groupID", typeof (String));
-
- createCol(items, "nextPermissions", typeof (UInt32));
- createCol(items, "currentPermissions", typeof (UInt32));
- createCol(items, "basePermissions", typeof (UInt32));
- createCol(items, "everyonePermissions", typeof (UInt32));
- createCol(items, "groupPermissions", typeof (UInt32));
- createCol(items, "flags", typeof (UInt32));
-
- items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] };
-
- return items;
- }
-
- ///
- /// Creates "land" table
- ///
- /// land table DataTable
- private static DataTable createLandTable()
- {
- DataTable land = new DataTable("land");
- createCol(land, "UUID", typeof (String));
- createCol(land, "RegionUUID", typeof (String));
- createCol(land, "LocalLandID", typeof (UInt32));
-
- // Bitmap is a byte[512]
- createCol(land, "Bitmap", typeof (Byte[]));
-
- createCol(land, "Name", typeof (String));
- createCol(land, "Desc", typeof (String));
- createCol(land, "OwnerUUID", typeof (String));
- createCol(land, "IsGroupOwned", typeof (Boolean));
- createCol(land, "Area", typeof (Int32));
- createCol(land, "AuctionID", typeof (Int32)); //Unemplemented
- createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
- createCol(land, "ClaimDate", typeof (Int32));
- createCol(land, "ClaimPrice", typeof (Int32));
- createCol(land, "GroupUUID", typeof (string));
- createCol(land, "SalePrice", typeof (Int32));
- createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus
- createCol(land, "LandFlags", typeof (UInt32));
- createCol(land, "LandingType", typeof (Byte));
- createCol(land, "MediaAutoScale", typeof (Byte));
- createCol(land, "MediaTextureUUID", typeof (String));
- createCol(land, "MediaURL", typeof (String));
- createCol(land, "MusicURL", typeof (String));
- createCol(land, "PassHours", typeof (Double));
- createCol(land, "PassPrice", typeof (UInt32));
- createCol(land, "SnapshotUUID", typeof (String));
- createCol(land, "UserLocationX", typeof (Double));
- createCol(land, "UserLocationY", typeof (Double));
- createCol(land, "UserLocationZ", typeof (Double));
- createCol(land, "UserLookAtX", typeof (Double));
- createCol(land, "UserLookAtY", typeof (Double));
- createCol(land, "UserLookAtZ", typeof (Double));
- createCol(land, "AuthbuyerID", typeof(String));
- createCol(land, "OtherCleanTime", typeof(Int32));
-
- land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
-
- return land;
- }
-
- ///
- /// create "landaccesslist" table
- ///
- /// Landacceslist DataTable
- private static DataTable createLandAccessListTable()
- {
- DataTable landaccess = new DataTable("landaccesslist");
- createCol(landaccess, "LandUUID", typeof (String));
- createCol(landaccess, "AccessUUID", typeof (String));
- createCol(landaccess, "Flags", typeof (UInt32));
-
- return landaccess;
- }
-
- private static DataTable createRegionSettingsTable()
- {
- DataTable regionsettings = new DataTable("regionsettings");
- createCol(regionsettings, "regionUUID", typeof(String));
- createCol(regionsettings, "block_terraform", typeof (Int32));
- createCol(regionsettings, "block_fly", typeof (Int32));
- createCol(regionsettings, "allow_damage", typeof (Int32));
- createCol(regionsettings, "restrict_pushing", typeof (Int32));
- createCol(regionsettings, "allow_land_resell", typeof (Int32));
- createCol(regionsettings, "allow_land_join_divide", typeof (Int32));
- createCol(regionsettings, "block_show_in_search", typeof (Int32));
- createCol(regionsettings, "agent_limit", typeof (Int32));
- createCol(regionsettings, "object_bonus", typeof (Double));
- createCol(regionsettings, "maturity", typeof (Int32));
- createCol(regionsettings, "disable_scripts", typeof (Int32));
- createCol(regionsettings, "disable_collisions", typeof (Int32));
- createCol(regionsettings, "disable_physics", typeof (Int32));
- createCol(regionsettings, "terrain_texture_1", typeof(String));
- createCol(regionsettings, "terrain_texture_2", typeof(String));
- createCol(regionsettings, "terrain_texture_3", typeof(String));
- createCol(regionsettings, "terrain_texture_4", typeof(String));
- createCol(regionsettings, "elevation_1_nw", typeof (Double));
- createCol(regionsettings, "elevation_2_nw", typeof (Double));
- createCol(regionsettings, "elevation_1_ne", typeof (Double));
- createCol(regionsettings, "elevation_2_ne", typeof (Double));
- createCol(regionsettings, "elevation_1_se", typeof (Double));
- createCol(regionsettings, "elevation_2_se", typeof (Double));
- createCol(regionsettings, "elevation_1_sw", typeof (Double));
- createCol(regionsettings, "elevation_2_sw", typeof (Double));
- createCol(regionsettings, "water_height", typeof (Double));
- createCol(regionsettings, "terrain_raise_limit", typeof (Double));
- createCol(regionsettings, "terrain_lower_limit", typeof (Double));
- createCol(regionsettings, "use_estate_sun", typeof (Int32));
- createCol(regionsettings, "sandbox", typeof (Int32));
- createCol(regionsettings, "sunvectorx",typeof (Double));
- createCol(regionsettings, "sunvectory",typeof (Double));
- createCol(regionsettings, "sunvectorz",typeof (Double));
- createCol(regionsettings, "fixed_sun", typeof (Int32));
- createCol(regionsettings, "sun_position", typeof (Double));
- createCol(regionsettings, "covenant", typeof(String));
- regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
- return regionsettings;
- }
-
- /***********************************************************************
- *
- * Convert between ADO.NET <=> OpenSim Objects
- *
- * These should be database independant
- *
- **********************************************************************/
-
- ///
- ///
- ///
- ///
- ///
- private SceneObjectPart buildPrim(DataRow row)
- {
- // Code commented. Uncomment to test the unit test inline.
-
- // The unit test mentions this commented code for the purposes
- // of debugging a unit test failure
-
- // SceneObjectGroup sog = new SceneObjectGroup();
- // SceneObjectPart sop = new SceneObjectPart();
- // sop.LocalId = 1;
- // sop.Name = "object1";
- // sop.Description = "object1";
- // sop.Text = "";
- // sop.SitName = "";
- // sop.TouchName = "";
- // sop.UUID = UUID.Random();
- // sop.Shape = PrimitiveBaseShape.Default;
- // sog.SetRootPart(sop);
- // Add breakpoint in above line. Check sop fields.
-
- // TODO: this doesn't work yet because something more
- // interesting has to be done to actually get these values
- // back out. Not enough time to figure it out yet.
-
- SceneObjectPart prim = new SceneObjectPart();
- prim.UUID = new UUID((String) row["UUID"]);
- // explicit conversion of integers is required, which sort
- // of sucks. No idea if there is a shortcut here or not.
- prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
- prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"];
- // various text fields
- prim.Text = (String) row["Text"];
- prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
- Convert.ToInt32(row["ColorR"]),
- Convert.ToInt32(row["ColorG"]),
- Convert.ToInt32(row["ColorB"]));
- prim.Description = (String) row["Description"];
- prim.SitName = (String) row["SitName"];
- prim.TouchName = (String) row["TouchName"];
- // permissions
- prim.Flags = (PrimFlags)Convert.ToUInt32(row["ObjectFlags"]);
- prim.CreatorID = new UUID((String) row["CreatorID"]);
- prim.OwnerID = new UUID((String) row["OwnerID"]);
- prim.GroupID = new UUID((String) row["GroupID"]);
- prim.LastOwnerID = new UUID((String) row["LastOwnerID"]);
- prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
- prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
- prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
- prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]);
- prim.BaseMask = Convert.ToUInt32(row["BaseMask"]);
- // vectors
- prim.OffsetPosition = new Vector3(
- Convert.ToSingle(row["PositionX"]),
- Convert.ToSingle(row["PositionY"]),
- Convert.ToSingle(row["PositionZ"])
- );
- prim.GroupPosition = new Vector3(
- Convert.ToSingle(row["GroupPositionX"]),
- Convert.ToSingle(row["GroupPositionY"]),
- Convert.ToSingle(row["GroupPositionZ"])
- );
- prim.Velocity = new Vector3(
- Convert.ToSingle(row["VelocityX"]),
- Convert.ToSingle(row["VelocityY"]),
- Convert.ToSingle(row["VelocityZ"])
- );
- prim.AngularVelocity = new Vector3(
- Convert.ToSingle(row["AngularVelocityX"]),
- Convert.ToSingle(row["AngularVelocityY"]),
- Convert.ToSingle(row["AngularVelocityZ"])
- );
- prim.Acceleration = new Vector3(
- Convert.ToSingle(row["AccelerationX"]),
- Convert.ToSingle(row["AccelerationY"]),
- Convert.ToSingle(row["AccelerationZ"])
- );
- // quaternions
- prim.RotationOffset = new Quaternion(
- Convert.ToSingle(row["RotationX"]),
- Convert.ToSingle(row["RotationY"]),
- Convert.ToSingle(row["RotationZ"]),
- Convert.ToSingle(row["RotationW"])
- );
-
- prim.SitTargetPositionLL = new Vector3(
- Convert.ToSingle(row["SitTargetOffsetX"]),
- Convert.ToSingle(row["SitTargetOffsetY"]),
- Convert.ToSingle(row["SitTargetOffsetZ"]));
- prim.SitTargetOrientationLL = new Quaternion(
- Convert.ToSingle(
- row["SitTargetOrientX"]),
- Convert.ToSingle(
- row["SitTargetOrientY"]),
- Convert.ToSingle(
- row["SitTargetOrientZ"]),
- Convert.ToSingle(
- row["SitTargetOrientW"]));
-
- prim.ClickAction = Convert.ToByte(row["ClickAction"]);
- prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
- prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]);
- prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]);
- prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]);
- prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]);
-
- prim.Sound = new UUID(row["LoopedSound"].ToString());
- prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]);
- prim.SoundFlags = 1; // If it's persisted at all, it's looped
-
- if (!row.IsNull("TextureAnimation"))
- prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString());
- if (!row.IsNull("ParticleSystem"))
- prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString());
-
- prim.AngularVelocity = new Vector3(
- Convert.ToSingle(row["OmegaX"]),
- Convert.ToSingle(row["OmegaY"]),
- Convert.ToSingle(row["OmegaZ"])
- );
-
- prim.SetCameraEyeOffset(new Vector3(
- Convert.ToSingle(row["CameraEyeOffsetX"]),
- Convert.ToSingle(row["CameraEyeOffsetY"]),
- Convert.ToSingle(row["CameraEyeOffsetZ"])
- ));
-
- prim.SetCameraAtOffset(new Vector3(
- Convert.ToSingle(row["CameraAtOffsetX"]),
- Convert.ToSingle(row["CameraAtOffsetY"]),
- Convert.ToSingle(row["CameraAtOffsetZ"])
- ));
-
- if (Convert.ToInt16(row["ForceMouselook"]) != 0)
- prim.SetForceMouselook(true);
-
- prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]);
-
- if (Convert.ToInt16(row["AllowedDrop"]) != 0)
- prim.AllowedDrop = true;
-
- if (Convert.ToInt16(row["DieAtEdge"]) != 0)
- prim.DIE_AT_EDGE = true;
-
- prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
- prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
-
- prim.Material = Convert.ToByte(row["Material"]);
-
- prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
- prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
-
- if (Convert.ToInt16(row["VolumeDetect"]) != 0)
- prim.VolumeDetectActive = true;
-
- return prim;
- }
-
- ///
- /// Build a prim inventory item from the persisted data.
- ///
- ///
- ///
- private static TaskInventoryItem buildItem(DataRow row)
- {
- TaskInventoryItem taskItem = new TaskInventoryItem();
-
- taskItem.ItemID = new UUID((String)row["itemID"]);
- taskItem.ParentPartID = new UUID((String)row["primID"]);
- taskItem.AssetID = new UUID((String)row["assetID"]);
- taskItem.ParentID = new UUID((String)row["parentFolderID"]);
-
- taskItem.InvType = Convert.ToInt32(row["invType"]);
- taskItem.Type = Convert.ToInt32(row["assetType"]);
-
- taskItem.Name = (String)row["name"];
- taskItem.Description = (String)row["description"];
- taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
- taskItem.CreatorID = new UUID((String)row["creatorID"]);
- taskItem.OwnerID = new UUID((String)row["ownerID"]);
- taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]);
- taskItem.GroupID = new UUID((String)row["groupID"]);
-
- taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
- taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
- taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
- taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
- taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
- taskItem.Flags = Convert.ToUInt32(row["flags"]);
-
- return taskItem;
- }
-
- ///
- /// Build a Land Data from the persisted data.
- ///
- ///
- ///
- private LandData buildLandData(DataRow row)
- {
- LandData newData = new LandData();
-
- newData.GlobalID = new UUID((String) row["UUID"]);
- newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
-
- // Bitmap is a byte[512]
- newData.Bitmap = (Byte[]) row["Bitmap"];
-
- newData.Name = (String) row["Name"];
- newData.Description = (String) row["Desc"];
- newData.OwnerID = (UUID)(String) row["OwnerUUID"];
- newData.IsGroupOwned = (Boolean) row["IsGroupOwned"];
- newData.Area = Convert.ToInt32(row["Area"]);
- newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
- newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]);
- //Enum OpenMetaverse.Parcel.ParcelCategory
- newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
- newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
- newData.GroupID = new UUID((String) row["GroupUUID"]);
- newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
- newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]);
- //Enum. OpenMetaverse.Parcel.ParcelStatus
- newData.Flags = Convert.ToUInt32(row["LandFlags"]);
- newData.LandingType = (Byte) row["LandingType"];
- newData.MediaAutoScale = (Byte) row["MediaAutoScale"];
- newData.MediaID = new UUID((String) row["MediaTextureUUID"]);
- newData.MediaURL = (String) row["MediaURL"];
- newData.MusicURL = (String) row["MusicURL"];
- newData.PassHours = Convert.ToSingle(row["PassHours"]);
- newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
- newData.SnapshotID = (UUID)(String) row["SnapshotUUID"];
- try
- {
-
- newData.UserLocation =
- new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
- Convert.ToSingle(row["UserLocationZ"]));
- newData.UserLookAt =
- new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
- Convert.ToSingle(row["UserLookAtZ"]));
-
- }
- catch (InvalidCastException)
- {
- m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
- newData.UserLocation = Vector3.Zero;
- newData.UserLookAt = Vector3.Zero;
- }
- newData.ParcelAccessList = new List();
- UUID authBuyerID = UUID.Zero;
-
- UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
-
- newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
-
- return newData;
- }
-
- private RegionSettings buildRegionSettings(DataRow row)
- {
- RegionSettings newSettings = new RegionSettings();
-
- newSettings.RegionUUID = new UUID((string) row["regionUUID"]);
- newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
- newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
- newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
- newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
- newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
- newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
- newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
- newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
- newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
- newSettings.Maturity = Convert.ToInt32(row["maturity"]);
- newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
- newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
- newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
- newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]);
- newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]);
- newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]);
- newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]);
- newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
- newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
- newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
- newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
- newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
- newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
- newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
- newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
- newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
- newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
- newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
- newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
- newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
- newSettings.SunVector = new Vector3 (
- Convert.ToSingle(row["sunvectorx"]),
- Convert.ToSingle(row["sunvectory"]),
- Convert.ToSingle(row["sunvectorz"])
- );
- newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
- newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
- newSettings.Covenant = new UUID((String) row["covenant"]);
-
- return newSettings;
- }
-
- ///
- /// Build a land access entry from the persisted data.
- ///
- ///
- ///
- private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
- {
- ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
- entry.AgentID = new UUID((string) row["AccessUUID"]);
- entry.Flags = (AccessList) row["Flags"];
- entry.Time = new DateTime();
- return entry;
- }
-
- ///
- ///
- ///
- ///
- ///
- private static Array serializeTerrain(double[,] val)
- {
- MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
- BinaryWriter bw = new BinaryWriter(str);
-
- // TODO: COMPATIBILITY - Add byte-order conversions
- for (int x = 0; x < (int)Constants.RegionSize; x++)
- for (int y = 0; y < (int)Constants.RegionSize; y++)
- bw.Write(val[x, y]);
-
- return str.ToArray();
- }
-
-// private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val)
-// {
-// row["RegionUUID"] = regionUUID;
-// row["Revision"] = rev;
-
- // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double));
-// BinaryWriter bw = new BinaryWriter(str);
-
-// // TODO: COMPATIBILITY - Add byte-order conversions
- // for (int x = 0; x < (int)Constants.RegionSize; x++)
- // for (int y = 0; y < (int)Constants.RegionSize; y++)
-// bw.Write(val[x, y]);
-
-// row["Heightfield"] = str.ToArray();
-// }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
- {
- row["UUID"] = prim.UUID.ToString();
- row["RegionUUID"] = regionUUID.ToString();
- row["CreationDate"] = prim.CreationDate;
- row["Name"] = prim.Name;
- row["SceneGroupID"] = sceneGroupID.ToString();
- // the UUID of the root part for this SceneObjectGroup
- // various text fields
- row["Text"] = prim.Text;
- row["Description"] = prim.Description;
- row["SitName"] = prim.SitName;
- row["TouchName"] = prim.TouchName;
- // permissions
- row["ObjectFlags"] = (uint)prim.Flags;
- row["CreatorID"] = prim.CreatorID.ToString();
- row["OwnerID"] = prim.OwnerID.ToString();
- row["GroupID"] = prim.GroupID.ToString();
- row["LastOwnerID"] = prim.LastOwnerID.ToString();
- row["OwnerMask"] = prim.OwnerMask;
- row["NextOwnerMask"] = prim.NextOwnerMask;
- row["GroupMask"] = prim.GroupMask;
- row["EveryoneMask"] = prim.EveryoneMask;
- row["BaseMask"] = prim.BaseMask;
- // vectors
- row["PositionX"] = prim.OffsetPosition.X;
- row["PositionY"] = prim.OffsetPosition.Y;
- row["PositionZ"] = prim.OffsetPosition.Z;
- row["GroupPositionX"] = prim.GroupPosition.X;
- row["GroupPositionY"] = prim.GroupPosition.Y;
- row["GroupPositionZ"] = prim.GroupPosition.Z;
- row["VelocityX"] = prim.Velocity.X;
- row["VelocityY"] = prim.Velocity.Y;
- row["VelocityZ"] = prim.Velocity.Z;
- row["AngularVelocityX"] = prim.AngularVelocity.X;
- row["AngularVelocityY"] = prim.AngularVelocity.Y;
- row["AngularVelocityZ"] = prim.AngularVelocity.Z;
- row["AccelerationX"] = prim.Acceleration.X;
- row["AccelerationY"] = prim.Acceleration.Y;
- row["AccelerationZ"] = prim.Acceleration.Z;
- // quaternions
- row["RotationX"] = prim.RotationOffset.X;
- row["RotationY"] = prim.RotationOffset.Y;
- row["RotationZ"] = prim.RotationOffset.Z;
- row["RotationW"] = prim.RotationOffset.W;
-
- // Sit target
- Vector3 sitTargetPos = prim.SitTargetPositionLL;
- row["SitTargetOffsetX"] = sitTargetPos.X;
- row["SitTargetOffsetY"] = sitTargetPos.Y;
- row["SitTargetOffsetZ"] = sitTargetPos.Z;
-
- Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
- row["SitTargetOrientW"] = sitTargetOrient.W;
- row["SitTargetOrientX"] = sitTargetOrient.X;
- row["SitTargetOrientY"] = sitTargetOrient.Y;
- row["SitTargetOrientZ"] = sitTargetOrient.Z;
- row["ColorR"] = Convert.ToInt32(prim.Color.R);
- row["ColorG"] = Convert.ToInt32(prim.Color.G);
- row["ColorB"] = Convert.ToInt32(prim.Color.B);
- row["ColorA"] = Convert.ToInt32(prim.Color.A);
- row["PayPrice"] = prim.PayPrice[0];
- row["PayButton1"] = prim.PayPrice[1];
- row["PayButton2"] = prim.PayPrice[2];
- row["PayButton3"] = prim.PayPrice[3];
- row["PayButton4"] = prim.PayPrice[4];
-
-
- row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation);
- row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem);
-
- row["OmegaX"] = prim.AngularVelocity.X;
- row["OmegaY"] = prim.AngularVelocity.Y;
- row["OmegaZ"] = prim.AngularVelocity.Z;
-
- row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X;
- row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y;
- row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z;
-
- row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X;
- row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y;
- row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z;
-
-
- if ((prim.SoundFlags & 1) != 0) // Looped
- {
- row["LoopedSound"] = prim.Sound.ToString();
- row["LoopedSoundGain"] = prim.SoundGain;
- }
- else
- {
- row["LoopedSound"] = UUID.Zero.ToString();
- row["LoopedSoundGain"] = 0.0f;
- }
-
- if (prim.GetForceMouselook())
- row["ForceMouselook"] = 1;
- else
- row["ForceMouselook"] = 0;
-
- row["ScriptAccessPin"] = prim.ScriptAccessPin;
-
- if (prim.AllowedDrop)
- row["AllowedDrop"] = 1;
- else
- row["AllowedDrop"] = 0;
-
- if (prim.DIE_AT_EDGE)
- row["DieAtEdge"] = 1;
- else
- row["DieAtEdge"] = 0;
-
- row["SalePrice"] = prim.SalePrice;
- row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType);
-
- // click action
- row["ClickAction"] = prim.ClickAction;
-
- row["SalePrice"] = prim.SalePrice;
- row["Material"] = prim.Material;
-
- row["CollisionSound"] = prim.CollisionSound.ToString();
- row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
- if (prim.VolumeDetectActive)
- row["VolumeDetect"] = 1;
- else
- row["VolumeDetect"] = 0;
-
- }
-
- ///
- ///
- ///
- ///
- ///
- private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
- {
- row["itemID"] = taskItem.ItemID.ToString();
- row["primID"] = taskItem.ParentPartID.ToString();
- row["assetID"] = taskItem.AssetID.ToString();
- row["parentFolderID"] = taskItem.ParentID.ToString();
-
- row["invType"] = taskItem.InvType;
- row["assetType"] = taskItem.Type;
-
- row["name"] = taskItem.Name;
- row["description"] = taskItem.Description;
- row["creationDate"] = taskItem.CreationDate;
- row["creatorID"] = taskItem.CreatorID.ToString();
- row["ownerID"] = taskItem.OwnerID.ToString();
- row["lastOwnerID"] = taskItem.LastOwnerID.ToString();
- row["groupID"] = taskItem.GroupID.ToString();
- row["nextPermissions"] = taskItem.NextPermissions;
- row["currentPermissions"] = taskItem.CurrentPermissions;
- row["basePermissions"] = taskItem.BasePermissions;
- row["everyonePermissions"] = taskItem.EveryonePermissions;
- row["groupPermissions"] = taskItem.GroupPermissions;
- row["flags"] = taskItem.Flags;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- private static void fillLandRow(DataRow row, LandData land, UUID regionUUID)
- {
- row["UUID"] = land.GlobalID.ToString();
- row["RegionUUID"] = regionUUID.ToString();
- row["LocalLandID"] = land.LocalID;
-
- // Bitmap is a byte[512]
- row["Bitmap"] = land.Bitmap;
-
- row["Name"] = land.Name;
- row["Desc"] = land.Description;
- row["OwnerUUID"] = land.OwnerID.ToString();
- row["IsGroupOwned"] = land.IsGroupOwned;
- row["Area"] = land.Area;
- row["AuctionID"] = land.AuctionID; //Unemplemented
- row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
- row["ClaimDate"] = land.ClaimDate;
- row["ClaimPrice"] = land.ClaimPrice;
- row["GroupUUID"] = land.GroupID.ToString();
- row["SalePrice"] = land.SalePrice;
- row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus
- row["LandFlags"] = land.Flags;
- row["LandingType"] = land.LandingType;
- row["MediaAutoScale"] = land.MediaAutoScale;
- row["MediaTextureUUID"] = land.MediaID.ToString();
- row["MediaURL"] = land.MediaURL;
- row["MusicURL"] = land.MusicURL;
- row["PassHours"] = land.PassHours;
- row["PassPrice"] = land.PassPrice;
- row["SnapshotUUID"] = land.SnapshotID.ToString();
- row["UserLocationX"] = land.UserLocation.X;
- row["UserLocationY"] = land.UserLocation.Y;
- row["UserLocationZ"] = land.UserLocation.Z;
- row["UserLookAtX"] = land.UserLookAt.X;
- row["UserLookAtY"] = land.UserLookAt.Y;
- row["UserLookAtZ"] = land.UserLookAt.Z;
- row["AuthbuyerID"] = land.AuthBuyerID.ToString();
- row["OtherCleanTime"] = land.OtherCleanTime;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
- {
- row["LandUUID"] = parcelID.ToString();
- row["AccessUUID"] = entry.AgentID.ToString();
- row["Flags"] = entry.Flags;
- }
-
- private static void fillRegionSettingsRow(DataRow row, RegionSettings settings)
- {
- row["regionUUID"] = settings.RegionUUID.ToString();
- row["block_terraform"] = settings.BlockTerraform;
- row["block_fly"] = settings.BlockFly;
- row["allow_damage"] = settings.AllowDamage;
- row["restrict_pushing"] = settings.RestrictPushing;
- row["allow_land_resell"] = settings.AllowLandResell;
- row["allow_land_join_divide"] = settings.AllowLandJoinDivide;
- row["block_show_in_search"] = settings.BlockShowInSearch;
- row["agent_limit"] = settings.AgentLimit;
- row["object_bonus"] = settings.ObjectBonus;
- row["maturity"] = settings.Maturity;
- row["disable_scripts"] = settings.DisableScripts;
- row["disable_collisions"] = settings.DisableCollisions;
- row["disable_physics"] = settings.DisablePhysics;
- row["terrain_texture_1"] = settings.TerrainTexture1.ToString();
- row["terrain_texture_2"] = settings.TerrainTexture2.ToString();
- row["terrain_texture_3"] = settings.TerrainTexture3.ToString();
- row["terrain_texture_4"] = settings.TerrainTexture4.ToString();
- row["elevation_1_nw"] = settings.Elevation1NW;
- row["elevation_2_nw"] = settings.Elevation2NW;
- row["elevation_1_ne"] = settings.Elevation1NE;
- row["elevation_2_ne"] = settings.Elevation2NE;
- row["elevation_1_se"] = settings.Elevation1SE;
- row["elevation_2_se"] = settings.Elevation2SE;
- row["elevation_1_sw"] = settings.Elevation1SW;
- row["elevation_2_sw"] = settings.Elevation2SW;
- row["water_height"] = settings.WaterHeight;
- row["terrain_raise_limit"] = settings.TerrainRaiseLimit;
- row["terrain_lower_limit"] = settings.TerrainLowerLimit;
- row["use_estate_sun"] = settings.UseEstateSun;
- row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox
- row["sunvectorx"] = settings.SunVector.X;
- row["sunvectory"] = settings.SunVector.Y;
- row["sunvectorz"] = settings.SunVector.Z;
- row["fixed_sun"] = settings.FixedSun;
- row["sun_position"] = settings.SunPosition;
- row["covenant"] = settings.Covenant.ToString();
- }
-
- ///
- ///
- ///
- ///
- ///
- private PrimitiveBaseShape buildShape(DataRow row)
- {
- PrimitiveBaseShape s = new PrimitiveBaseShape();
- s.Scale = new Vector3(
- Convert.ToSingle(row["ScaleX"]),
- Convert.ToSingle(row["ScaleY"]),
- Convert.ToSingle(row["ScaleZ"])
- );
- // paths
- s.PCode = Convert.ToByte(row["PCode"]);
- s.PathBegin = Convert.ToUInt16(row["PathBegin"]);
- s.PathEnd = Convert.ToUInt16(row["PathEnd"]);
- s.PathScaleX = Convert.ToByte(row["PathScaleX"]);
- s.PathScaleY = Convert.ToByte(row["PathScaleY"]);
- s.PathShearX = Convert.ToByte(row["PathShearX"]);
- s.PathShearY = Convert.ToByte(row["PathShearY"]);
- s.PathSkew = Convert.ToSByte(row["PathSkew"]);
- s.PathCurve = Convert.ToByte(row["PathCurve"]);
- s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]);
- s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]);
- s.PathTaperX = Convert.ToSByte(row["PathTaperX"]);
- s.PathTaperY = Convert.ToSByte(row["PathTaperY"]);
- s.PathTwist = Convert.ToSByte(row["PathTwist"]);
- s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]);
- // profile
- s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]);
- s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
- s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
- s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
- s.State = Convert.ToByte(row["State"]);
-
- byte[] textureEntry = (byte[])row["Texture"];
- s.TextureEntry = textureEntry;
-
- s.ExtraParams = (byte[]) row["ExtraParams"];
- return s;
- }
-
- ///
- ///
- ///
- ///
- ///
- private static void fillShapeRow(DataRow row, SceneObjectPart prim)
- {
- PrimitiveBaseShape s = prim.Shape;
- row["UUID"] = prim.UUID.ToString();
- // shape is an enum
- row["Shape"] = 0;
- // vectors
- row["ScaleX"] = s.Scale.X;
- row["ScaleY"] = s.Scale.Y;
- row["ScaleZ"] = s.Scale.Z;
- // paths
- row["PCode"] = s.PCode;
- row["PathBegin"] = s.PathBegin;
- row["PathEnd"] = s.PathEnd;
- row["PathScaleX"] = s.PathScaleX;
- row["PathScaleY"] = s.PathScaleY;
- row["PathShearX"] = s.PathShearX;
- row["PathShearY"] = s.PathShearY;
- row["PathSkew"] = s.PathSkew;
- row["PathCurve"] = s.PathCurve;
- row["PathRadiusOffset"] = s.PathRadiusOffset;
- row["PathRevolutions"] = s.PathRevolutions;
- row["PathTaperX"] = s.PathTaperX;
- row["PathTaperY"] = s.PathTaperY;
- row["PathTwist"] = s.PathTwist;
- row["PathTwistBegin"] = s.PathTwistBegin;
- // profile
- row["ProfileBegin"] = s.ProfileBegin;
- row["ProfileEnd"] = s.ProfileEnd;
- row["ProfileCurve"] = s.ProfileCurve;
- row["ProfileHollow"] = s.ProfileHollow;
- row["State"] = s.State;
-
- row["Texture"] = s.TextureEntry;
- row["ExtraParams"] = s.ExtraParams;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
- {
-
- DataTable prims = ds.Tables["prims"];
- DataTable shapes = ds.Tables["primshapes"];
-
- DataRow primRow = prims.Rows.Find(prim.UUID.ToString());
- if (primRow == null)
- {
- primRow = prims.NewRow();
- fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
- prims.Rows.Add(primRow);
- }
- else
- {
- fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
- }
-
- DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
- if (shapeRow == null)
- {
- shapeRow = shapes.NewRow();
- fillShapeRow(shapeRow, prim);
- shapes.Rows.Add(shapeRow);
- }
- else
- {
- fillShapeRow(shapeRow, prim);
- }
- }
-
- ///
- /// see IRegionDatastore
- ///
- ///
- ///
- public void StorePrimInventory(UUID primID, ICollection items)
- {
- m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
-
- DataTable dbItems = ds.Tables["primitems"];
-
- // For now, we're just going to crudely remove all the previous inventory items
- // no matter whether they have changed or not, and replace them with the current set.
- lock (ds)
- {
- RemoveItems(primID);
-
- // repalce with current inventory details
- foreach (TaskInventoryItem newItem in items)
- {
-// m_log.InfoFormat(
-// "[DATASTORE]: ",
-// "Adding item {0}, {1} to prim ID {2}",
-// newItem.Name, newItem.ItemID, newItem.ParentPartID);
-
- DataRow newItemRow = dbItems.NewRow();
- fillItemRow(newItemRow, newItem);
- dbItems.Rows.Add(newItemRow);
- }
- }
-
- Commit();
- }
-
- /***********************************************************************
- *
- * SQL Statement Creation Functions
- *
- * These functions create SQL statements for update, insert, and create.
- * They can probably be factored later to have a db independant
- * portion and a db specific portion
- *
- **********************************************************************/
-
- ///
- /// Create an insert command
- ///
- /// table name
- /// data table
- /// the created command
- ///
- /// This is subtle enough to deserve some commentary.
- /// Instead of doing *lots* and *lots of hardcoded strings
- /// for database definitions we'll use the fact that
- /// realistically all insert statements look like "insert
- /// into A(b, c) values(:b, :c) on the parameterized query
- /// front. If we just have a list of b, c, etc... we can
- /// generate these strings instead of typing them out.
- ///
- private static SqliteCommand createInsertCommand(string table, DataTable dt)
- {
- string[] cols = new string[dt.Columns.Count];
- for (int i = 0; i < dt.Columns.Count; i++)
- {
- DataColumn col = dt.Columns[i];
- cols[i] = col.ColumnName;
- }
-
- string sql = "insert into " + table + "(";
- sql += String.Join(", ", cols);
- // important, the first ':' needs to be here, the rest get added in the join
- sql += ") values (:";
- sql += String.Join(", :", cols);
- sql += ")";
- SqliteCommand cmd = new SqliteCommand(sql);
-
- // this provides the binding for all our parameters, so
- // much less code than it used to be
- foreach (DataColumn col in dt.Columns)
- {
- cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
- }
- return cmd;
- }
-
-
- ///
- /// create an update command
- ///
- /// table name
- ///
- ///
- /// the created command
- private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
- {
- string sql = "update " + table + " set ";
- string subsql = String.Empty;
- foreach (DataColumn col in dt.Columns)
- {
- if (subsql.Length > 0)
- {
- // a map function would rock so much here
- subsql += ", ";
- }
- subsql += col.ColumnName + "= :" + col.ColumnName;
- }
- sql += subsql;
- sql += " where " + pk;
- SqliteCommand cmd = new SqliteCommand(sql);
-
- // this provides the binding for all our parameters, so
- // much less code than it used to be
-
- foreach (DataColumn col in dt.Columns)
- {
- cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
- }
- return cmd;
- }
-
- ///
- /// create an update command
- ///
- /// table name
- ///
- ///
- /// the created command
- private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt)
- {
- string sql = "update " + table + " set ";
- string subsql = String.Empty;
- foreach (DataColumn col in dt.Columns)
- {
- if (subsql.Length > 0)
- {
- // a map function would rock so much here
- subsql += ", ";
- }
- subsql += col.ColumnName + "= :" + col.ColumnName;
- }
- sql += subsql;
- sql += " where " + pk1 + " and " + pk2;
- SqliteCommand cmd = new SqliteCommand(sql);
-
- // this provides the binding for all our parameters, so
- // much less code than it used to be
-
- foreach (DataColumn col in dt.Columns)
- {
- cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
- }
- return cmd;
- }
-
- ///
- ///
- ///
- /// Data Table
- ///
- // private static string defineTable(DataTable dt)
- // {
- // string sql = "create table " + dt.TableName + "(";
- // string subsql = String.Empty;
- // foreach (DataColumn col in dt.Columns)
- // {
- // if (subsql.Length > 0)
- // {
- // // a map function would rock so much here
- // subsql += ",\n";
- // }
- // subsql += col.ColumnName + " " + sqliteType(col.DataType);
- // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0])
- // {
- // subsql += " primary key";
- // }
- // }
- // sql += subsql;
- // sql += ")";
- // return sql;
- // }
-
- /***********************************************************************
- *
- * Database Binding functions
- *
- * These will be db specific due to typing, and minor differences
- * in databases.
- *
- **********************************************************************/
-
- ///
- /// This is a convenience function that collapses 5 repetitive
- /// lines for defining SqliteParameters to 2 parameters:
- /// column name and database type.
- ///
- /// It assumes certain conventions like :param as the param
- /// name to replace in parametrized queries, and that source
- /// version is always current version, both of which are fine
- /// for us.
- ///
- ///a built sqlite parameter
- private static SqliteParameter createSqliteParameter(string name, Type type)
- {
- SqliteParameter param = new SqliteParameter();
- param.ParameterName = ":" + name;
- param.DbType = dbtypeFromType(type);
- param.SourceColumn = name;
- param.SourceVersion = DataRowVersion.Current;
- return param;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID");
- delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
- delete.Connection = conn;
- da.DeleteCommand = delete;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("primitems", "itemID = :itemID", ds.Tables["primitems"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID");
- delete.Parameters.Add(createSqliteParameter("itemID", typeof (String)));
- delete.Connection = conn;
- da.DeleteCommand = delete;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]);
- da.InsertCommand.Connection = conn;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("land", ds.Tables["land"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID");
- delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
- da.DeleteCommand = delete;
- da.DeleteCommand.Connection = conn;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID");
- delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String)));
- delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
- da.DeleteCommand = delete;
- da.DeleteCommand.Connection = conn;
-
- }
-
- private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("regionsettings", ds.Tables["regionsettings"]);
- da.InsertCommand.Connection = conn;
- da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID=:regionUUID", ds.Tables["regionsettings"]);
- da.UpdateCommand.Connection = conn;
- }
-
- ///
- ///
- ///
- ///
- ///
- private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
- {
- da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]);
- da.InsertCommand.Connection = conn;
-
- da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", ds.Tables["primshapes"]);
- da.UpdateCommand.Connection = conn;
-
- SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID");
- delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
- delete.Connection = conn;
- da.DeleteCommand = delete;
- }
-
- /***********************************************************************
- *
- * Type conversion functions
- *
- **********************************************************************/
-
- ///
- /// Type conversion function
- ///
- ///
- ///
- private static DbType dbtypeFromType(Type type)
- {
- if (type == typeof (String))
- {
- return DbType.String;
- }
- else if (type == typeof (Int32))
- {
- return DbType.Int32;
- }
- else if (type == typeof (Double))
- {
- return DbType.Double;
- }
- else if (type == typeof (Byte))
- {
- return DbType.Byte;
- }
- else if (type == typeof (Double))
- {
- return DbType.Double;
- }
- else if (type == typeof (Byte[]))
- {
- return DbType.Binary;
- }
- else
- {
- return DbType.String;
- }
- }
-
- }
-}
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
new file mode 100644
index 0000000..878117e
--- /dev/null
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
@@ -0,0 +1,2261 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using System.Data;
+using System.Drawing;
+using System.IO;
+using System.Reflection;
+using log4net;
+using Mono.Data.SqliteClient;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Data.SQLiteLegacy
+{
+ ///
+ /// A RegionData Interface to the SQLite database
+ ///
+ public class SQLiteSimulationData : ISimulationDataStore
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private const string primSelect = "select * from prims";
+ private const string shapeSelect = "select * from primshapes";
+ private const string itemsSelect = "select * from primitems";
+ private const string terrainSelect = "select * from terrain limit 1";
+ private const string landSelect = "select * from land";
+ private const string landAccessListSelect = "select distinct * from landaccesslist";
+ private const string regionbanListSelect = "select * from regionban";
+ private const string regionSettingsSelect = "select * from regionsettings";
+
+ private DataSet ds;
+ private SqliteDataAdapter primDa;
+ private SqliteDataAdapter shapeDa;
+ private SqliteDataAdapter itemsDa;
+ private SqliteDataAdapter terrainDa;
+ private SqliteDataAdapter landDa;
+ private SqliteDataAdapter landAccessListDa;
+ private SqliteDataAdapter regionSettingsDa;
+
+ private SqliteConnection m_conn;
+
+ private String m_connectionString;
+
+ // Temporary attribute while this is experimental
+
+ /***********************************************************************
+ *
+ * Public Interface Functions
+ *
+ **********************************************************************/
+
+ ///
+ /// See IRegionDataStore
+ ///
+ /// - Initialises RegionData Interface
+ /// - Loads and initialises a new SQLite connection and maintains it.
+ ///
+ ///
+ /// the connection string
+ public void Initialise(string connectionString)
+ {
+ m_connectionString = connectionString;
+
+ ds = new DataSet();
+
+ m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
+ m_conn = new SqliteConnection(m_connectionString);
+ m_conn.Open();
+
+
+
+ SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
+ primDa = new SqliteDataAdapter(primSelectCmd);
+ // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
+
+ SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
+ shapeDa = new SqliteDataAdapter(shapeSelectCmd);
+ // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
+
+ SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
+ itemsDa = new SqliteDataAdapter(itemsSelectCmd);
+
+ SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
+ terrainDa = new SqliteDataAdapter(terrainSelectCmd);
+
+ SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
+ landDa = new SqliteDataAdapter(landSelectCmd);
+
+ SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
+ landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
+
+ SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
+ regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
+ // This actually does the roll forward assembly stuff
+ Assembly assem = GetType().Assembly;
+ Migration m = new Migration(m_conn, assem, "RegionStore");
+ m.Update();
+
+ lock (ds)
+ {
+ ds.Tables.Add(createPrimTable());
+ setupPrimCommands(primDa, m_conn);
+ primDa.Fill(ds.Tables["prims"]);
+
+ ds.Tables.Add(createShapeTable());
+ setupShapeCommands(shapeDa, m_conn);
+
+ ds.Tables.Add(createItemsTable());
+ setupItemsCommands(itemsDa, m_conn);
+ itemsDa.Fill(ds.Tables["primitems"]);
+
+ ds.Tables.Add(createTerrainTable());
+ setupTerrainCommands(terrainDa, m_conn);
+
+ ds.Tables.Add(createLandTable());
+ setupLandCommands(landDa, m_conn);
+
+ ds.Tables.Add(createLandAccessListTable());
+ setupLandAccessCommands(landAccessListDa, m_conn);
+
+ ds.Tables.Add(createRegionSettingsTable());
+
+ setupRegionSettingsCommands(regionSettingsDa, m_conn);
+
+ // WORKAROUND: This is a work around for sqlite on
+ // windows, which gets really unhappy with blob columns
+ // that have no sample data in them. At some point we
+ // need to actually find a proper way to handle this.
+ try
+ {
+ shapeDa.Fill(ds.Tables["primshapes"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[REGION DB]: Caught fill error on primshapes table");
+ }
+
+ try
+ {
+ terrainDa.Fill(ds.Tables["terrain"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[REGION DB]: Caught fill error on terrain table");
+ }
+
+ try
+ {
+ landDa.Fill(ds.Tables["land"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[REGION DB]: Caught fill error on land table");
+ }
+
+ try
+ {
+ landAccessListDa.Fill(ds.Tables["landaccesslist"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
+ }
+
+ try
+ {
+ regionSettingsDa.Fill(ds.Tables["regionsettings"]);
+ }
+ catch (Exception)
+ {
+ m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
+ }
+ return;
+ }
+ }
+
+ public void Dispose()
+ {
+ if (m_conn != null)
+ {
+ m_conn.Close();
+ m_conn = null;
+ }
+ if (ds != null)
+ {
+ ds.Dispose();
+ ds = null;
+ }
+ if (primDa != null)
+ {
+ primDa.Dispose();
+ primDa = null;
+ }
+ if (shapeDa != null)
+ {
+ shapeDa.Dispose();
+ shapeDa = null;
+ }
+ if (itemsDa != null)
+ {
+ itemsDa.Dispose();
+ itemsDa = null;
+ }
+ if (terrainDa != null)
+ {
+ terrainDa.Dispose();
+ terrainDa = null;
+ }
+ if (landDa != null)
+ {
+ landDa.Dispose();
+ landDa = null;
+ }
+ if (landAccessListDa != null)
+ {
+ landAccessListDa.Dispose();
+ landAccessListDa = null;
+ }
+ if (regionSettingsDa != null)
+ {
+ regionSettingsDa.Dispose();
+ regionSettingsDa = null;
+ }
+ }
+
+ public void StoreRegionSettings(RegionSettings rs)
+ {
+ lock (ds)
+ {
+ DataTable regionsettings = ds.Tables["regionsettings"];
+
+ DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString());
+ if (settingsRow == null)
+ {
+ settingsRow = regionsettings.NewRow();
+ fillRegionSettingsRow(settingsRow, rs);
+ regionsettings.Rows.Add(settingsRow);
+ }
+ else
+ {
+ fillRegionSettingsRow(settingsRow, rs);
+ }
+
+ Commit();
+ }
+ }
+ public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
+ {
+ //This connector doesn't support the windlight module yet
+ //Return default LL windlight settings
+ return new RegionLightShareData();
+ }
+ public void StoreRegionWindlightSettings(RegionLightShareData wl)
+ {
+ //This connector doesn't support the windlight module yet
+ }
+ public RegionSettings LoadRegionSettings(UUID regionUUID)
+ {
+ lock (ds)
+ {
+ DataTable regionsettings = ds.Tables["regionsettings"];
+
+ string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
+ DataRow[] rawsettings = regionsettings.Select(searchExp);
+ if (rawsettings.Length == 0)
+ {
+ RegionSettings rs = new RegionSettings();
+ rs.RegionUUID = regionUUID;
+ rs.OnSave += StoreRegionSettings;
+
+ StoreRegionSettings(rs);
+
+ return rs;
+ }
+ DataRow row = rawsettings[0];
+
+ RegionSettings newSettings = buildRegionSettings(row);
+ newSettings.OnSave += StoreRegionSettings;
+
+ return newSettings;
+ }
+ }
+
+ ///
+ /// Adds an object into region storage
+ ///
+ /// the object
+ /// the region UUID
+ public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
+ {
+ uint flags = obj.RootPart.GetEffectiveObjectFlags();
+
+ // Eligibility check
+ //
+ if ((flags & (uint)PrimFlags.Temporary) != 0)
+ return;
+ if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
+ return;
+
+ lock (ds)
+ {
+ foreach (SceneObjectPart prim in obj.Children.Values)
+ {
+// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
+ addPrim(prim, obj.UUID, regionUUID);
+ }
+ }
+
+ Commit();
+ // m_log.Info("[Dump of prims]: " + ds.GetXml());
+ }
+
+ ///
+ /// Removes an object from region storage
+ ///
+ /// the object
+ /// the region UUID
+ public void RemoveObject(UUID obj, UUID regionUUID)
+ {
+ // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID);
+
+ DataTable prims = ds.Tables["prims"];
+ DataTable shapes = ds.Tables["primshapes"];
+
+ string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'";
+ lock (ds)
+ {
+ DataRow[] primRows = prims.Select(selectExp);
+ foreach (DataRow row in primRows)
+ {
+ // Remove shape rows
+ UUID uuid = new UUID((string) row["UUID"]);
+ DataRow shapeRow = shapes.Rows.Find(uuid.ToString());
+ if (shapeRow != null)
+ {
+ shapeRow.Delete();
+ }
+
+ RemoveItems(uuid);
+
+ // Remove prim row
+ row.Delete();
+ }
+ }
+
+ Commit();
+ }
+
+ ///
+ /// Remove all persisted items of the given prim.
+ /// The caller must acquire the necessrary synchronization locks and commit or rollback changes.
+ ///
+ /// The item UUID
+ private void RemoveItems(UUID uuid)
+ {
+ DataTable items = ds.Tables["primitems"];
+
+ String sql = String.Format("primID = '{0}'", uuid);
+ DataRow[] itemRows = items.Select(sql);
+
+ foreach (DataRow itemRow in itemRows)
+ {
+ itemRow.Delete();
+ }
+ }
+
+ ///
+ /// Load persisted objects from region storage.
+ ///
+ /// The region UUID
+ /// List of loaded groups
+ public List LoadObjects(UUID regionUUID)
+ {
+ Dictionary createdObjects = new Dictionary();
+
+ List retvals = new List();
+
+ DataTable prims = ds.Tables["prims"];
+ DataTable shapes = ds.Tables["primshapes"];
+
+ string byRegion = "RegionUUID = '" + regionUUID + "'";
+
+ lock (ds)
+ {
+ DataRow[] primsForRegion = prims.Select(byRegion);
+ m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
+
+ // First, create all groups
+ foreach (DataRow primRow in primsForRegion)
+ {
+ try
+ {
+ SceneObjectPart prim = null;
+
+ string uuid = (string) primRow["UUID"];
+ string objID = (string) primRow["SceneGroupID"];
+
+ if (uuid == objID) //is new SceneObjectGroup ?
+ {
+ prim = buildPrim(primRow);
+ DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
+ if (shapeRow != null)
+ {
+ prim.Shape = buildShape(shapeRow);
+ }
+ else
+ {
+ m_log.Info(
+ "[REGION DB]: No shape found for prim in storage, so setting default box shape");
+ prim.Shape = PrimitiveBaseShape.Default;
+ }
+
+ SceneObjectGroup group = new SceneObjectGroup(prim);
+ createdObjects.Add(group.UUID, group);
+ retvals.Add(group);
+ LoadItems(prim);
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows");
+ m_log.Info("[REGION DB]: " + e.ToString());
+ foreach (DataColumn col in prims.Columns)
+ {
+ m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
+ }
+ }
+ }
+
+ // Now fill the groups with part data
+ foreach (DataRow primRow in primsForRegion)
+ {
+ try
+ {
+ SceneObjectPart prim = null;
+
+ string uuid = (string) primRow["UUID"];
+ string objID = (string) primRow["SceneGroupID"];
+ if (uuid != objID) //is new SceneObjectGroup ?
+ {
+ prim = buildPrim(primRow);
+ DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
+ if (shapeRow != null)
+ {
+ prim.Shape = buildShape(shapeRow);
+ }
+ else
+ {
+ m_log.Warn(
+ "[REGION DB]: No shape found for prim in storage, so setting default box shape");
+ prim.Shape = PrimitiveBaseShape.Default;
+ }
+
+ createdObjects[new UUID(objID)].AddPart(prim);
+ LoadItems(prim);
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows");
+ m_log.Info("[REGION DB]: " + e.ToString());
+ foreach (DataColumn col in prims.Columns)
+ {
+ m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
+ }
+ }
+ }
+ }
+ return retvals;
+ }
+
+ ///
+ /// Load in a prim's persisted inventory.
+ ///
+ /// the prim
+ private void LoadItems(SceneObjectPart prim)
+ {
+ //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
+
+ DataTable dbItems = ds.Tables["primitems"];
+ String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
+ DataRow[] dbItemRows = dbItems.Select(sql);
+ IList inventory = new List();
+
+ foreach (DataRow row in dbItemRows)
+ {
+ TaskInventoryItem item = buildItem(row);
+ inventory.Add(item);
+
+ //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
+ }
+
+ prim.Inventory.RestoreInventoryItems(inventory);
+ }
+
+ ///
+ /// Store a terrain revision in region storage
+ ///
+ /// terrain heightfield
+ /// region UUID
+ public void StoreTerrain(double[,] ter, UUID regionID)
+ {
+ lock (ds)
+ {
+ int revision = Util.UnixTimeSinceEpoch();
+
+ // This is added to get rid of the infinitely growing
+ // terrain databases which negatively impact on SQLite
+ // over time. Before reenabling this feature there
+ // needs to be a limitter put on the number of
+ // revisions in the database, as this old
+ // implementation is a DOS attack waiting to happen.
+
+ using (
+ SqliteCommand cmd =
+ new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision",
+ m_conn))
+ {
+ cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
+ cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
+ cmd.ExecuteNonQuery();
+ }
+
+ // the following is an work around for .NET. The perf
+ // issues associated with it aren't as bad as you think.
+ m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString());
+ String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
+ " values(:RegionUUID, :Revision, :Heightfield)";
+
+ using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
+ {
+ cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
+ cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
+ cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter)));
+ cmd.ExecuteNonQuery();
+ }
+ }
+ }
+
+ ///
+ /// Load the latest terrain revision from region storage
+ ///
+ /// the region UUID
+ /// Heightfield data
+ public double[,] LoadTerrain(UUID regionID)
+ {
+ lock (ds)
+ {
+ double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
+ terret.Initialize();
+
+ String sql = "select RegionUUID, Revision, Heightfield from terrain" +
+ " where RegionUUID=:RegionUUID order by Revision desc";
+
+ using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
+ {
+ cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
+
+ using (IDataReader row = cmd.ExecuteReader())
+ {
+ int rev = 0;
+ if (row.Read())
+ {
+ // TODO: put this into a function
+ using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"]))
+ {
+ using (BinaryReader br = new BinaryReader(str))
+ {
+ for (int x = 0; x < (int)Constants.RegionSize; x++)
+ {
+ for (int y = 0; y < (int)Constants.RegionSize; y++)
+ {
+ terret[x, y] = br.ReadDouble();
+ }
+ }
+ }
+ }
+ rev = (int) row["Revision"];
+ }
+ else
+ {
+ m_log.Info("[REGION DB]: No terrain found for region");
+ return null;
+ }
+
+ m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString());
+ }
+ }
+ return terret;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void RemoveLandObject(UUID globalID)
+ {
+ lock (ds)
+ {
+ // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter
+ // after you're done.
+ // replaced below code with the SqliteAdapter version.
+ //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn))
+ //{
+ // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
+ // cmd.ExecuteNonQuery();
+ //}
+
+ //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn))
+ //{
+ // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString()));
+ // cmd.ExecuteNonQuery();
+ //}
+
+ DataTable land = ds.Tables["land"];
+ DataTable landaccesslist = ds.Tables["landaccesslist"];
+ DataRow landRow = land.Rows.Find(globalID.ToString());
+ if (landRow != null)
+ {
+ land.Rows.Remove(landRow);
+ }
+ List rowsToDelete = new List();
+ foreach (DataRow rowToCheck in landaccesslist.Rows)
+ {
+ if (rowToCheck["LandUUID"].ToString() == globalID.ToString())
+ rowsToDelete.Add(rowToCheck);
+ }
+ for (int iter = 0; iter < rowsToDelete.Count; iter++)
+ {
+ landaccesslist.Rows.Remove(rowsToDelete[iter]);
+ }
+
+
+ }
+ Commit();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void StoreLandObject(ILandObject parcel)
+ {
+ lock (ds)
+ {
+ DataTable land = ds.Tables["land"];
+ DataTable landaccesslist = ds.Tables["landaccesslist"];
+
+ DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString());
+ if (landRow == null)
+ {
+ landRow = land.NewRow();
+ fillLandRow(landRow, parcel.LandData, parcel.RegionUUID);
+ land.Rows.Add(landRow);
+ }
+ else
+ {
+ fillLandRow(landRow, parcel.LandData, parcel.RegionUUID);
+ }
+
+ // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around
+ //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn))
+ //{
+ // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString()));
+ // cmd.ExecuteNonQuery();
+
+// }
+
+ // This is the slower.. but more appropriate thing to do
+
+ // We can't modify the table with direct queries before calling Commit() and re-filling them.
+ List rowsToDelete = new List();
+ foreach (DataRow rowToCheck in landaccesslist.Rows)
+ {
+ if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString())
+ rowsToDelete.Add(rowToCheck);
+ }
+ for (int iter = 0; iter < rowsToDelete.Count; iter++)
+ {
+ landaccesslist.Rows.Remove(rowsToDelete[iter]);
+ }
+ rowsToDelete.Clear();
+ foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList)
+ {
+ DataRow newAccessRow = landaccesslist.NewRow();
+ fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID);
+ landaccesslist.Rows.Add(newAccessRow);
+ }
+ }
+
+ Commit();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public List LoadLandObjects(UUID regionUUID)
+ {
+ List landDataForRegion = new List();
+ lock (ds)
+ {
+ DataTable land = ds.Tables["land"];
+ DataTable landaccesslist = ds.Tables["landaccesslist"];
+ string searchExp = "RegionUUID = '" + regionUUID + "'";
+ DataRow[] rawDataForRegion = land.Select(searchExp);
+ foreach (DataRow rawDataLand in rawDataForRegion)
+ {
+ LandData newLand = buildLandData(rawDataLand);
+ string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'";
+ DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp);
+ foreach (DataRow rawDataLandAccess in rawDataForLandAccessList)
+ {
+ newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess));
+ }
+
+ landDataForRegion.Add(newLand);
+ }
+ }
+ return landDataForRegion;
+ }
+
+ ///
+ ///
+ ///
+ public void Commit()
+ {
+ lock (ds)
+ {
+ primDa.Update(ds, "prims");
+ shapeDa.Update(ds, "primshapes");
+
+ itemsDa.Update(ds, "primitems");
+
+ terrainDa.Update(ds, "terrain");
+ landDa.Update(ds, "land");
+ landAccessListDa.Update(ds, "landaccesslist");
+ try
+ {
+ regionSettingsDa.Update(ds, "regionsettings");
+ }
+ catch (SqliteExecutionException SqlEx)
+ {
+ if (SqlEx.Message.Contains("logic error"))
+ {
+ throw new Exception(
+ "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
+ SqlEx);
+ }
+ else
+ {
+ throw SqlEx;
+ }
+ }
+ ds.AcceptChanges();
+ }
+ }
+
+ ///
+ /// See
+ ///
+ public void Shutdown()
+ {
+ Commit();
+ }
+
+ /***********************************************************************
+ *
+ * Database Definition Functions
+ *
+ * This should be db agnostic as we define them in ADO.NET terms
+ *
+ **********************************************************************/
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void createCol(DataTable dt, string name, Type type)
+ {
+ DataColumn col = new DataColumn(name, type);
+ dt.Columns.Add(col);
+ }
+
+ ///
+ /// Creates the "terrain" table
+ ///
+ /// terrain table DataTable
+ private static DataTable createTerrainTable()
+ {
+ DataTable terrain = new DataTable("terrain");
+
+ createCol(terrain, "RegionUUID", typeof (String));
+ createCol(terrain, "Revision", typeof (Int32));
+ createCol(terrain, "Heightfield", typeof (Byte[]));
+
+ return terrain;
+ }
+
+ ///
+ /// Creates the "prims" table
+ ///
+ /// prim table DataTable
+ private static DataTable createPrimTable()
+ {
+ DataTable prims = new DataTable("prims");
+
+ createCol(prims, "UUID", typeof (String));
+ createCol(prims, "RegionUUID", typeof (String));
+ createCol(prims, "CreationDate", typeof (Int32));
+ createCol(prims, "Name", typeof (String));
+ createCol(prims, "SceneGroupID", typeof (String));
+ // various text fields
+ createCol(prims, "Text", typeof (String));
+ createCol(prims, "ColorR", typeof (Int32));
+ createCol(prims, "ColorG", typeof (Int32));
+ createCol(prims, "ColorB", typeof (Int32));
+ createCol(prims, "ColorA", typeof (Int32));
+ createCol(prims, "Description", typeof (String));
+ createCol(prims, "SitName", typeof (String));
+ createCol(prims, "TouchName", typeof (String));
+ // permissions
+ createCol(prims, "ObjectFlags", typeof (Int32));
+ createCol(prims, "CreatorID", typeof (String));
+ createCol(prims, "OwnerID", typeof (String));
+ createCol(prims, "GroupID", typeof (String));
+ createCol(prims, "LastOwnerID", typeof (String));
+ createCol(prims, "OwnerMask", typeof (Int32));
+ createCol(prims, "NextOwnerMask", typeof (Int32));
+ createCol(prims, "GroupMask", typeof (Int32));
+ createCol(prims, "EveryoneMask", typeof (Int32));
+ createCol(prims, "BaseMask", typeof (Int32));
+ // vectors
+ createCol(prims, "PositionX", typeof (Double));
+ createCol(prims, "PositionY", typeof (Double));
+ createCol(prims, "PositionZ", typeof (Double));
+ createCol(prims, "GroupPositionX", typeof (Double));
+ createCol(prims, "GroupPositionY", typeof (Double));
+ createCol(prims, "GroupPositionZ", typeof (Double));
+ createCol(prims, "VelocityX", typeof (Double));
+ createCol(prims, "VelocityY", typeof (Double));
+ createCol(prims, "VelocityZ", typeof (Double));
+ createCol(prims, "AngularVelocityX", typeof (Double));
+ createCol(prims, "AngularVelocityY", typeof (Double));
+ createCol(prims, "AngularVelocityZ", typeof (Double));
+ createCol(prims, "AccelerationX", typeof (Double));
+ createCol(prims, "AccelerationY", typeof (Double));
+ createCol(prims, "AccelerationZ", typeof (Double));
+ // quaternions
+ createCol(prims, "RotationX", typeof (Double));
+ createCol(prims, "RotationY", typeof (Double));
+ createCol(prims, "RotationZ", typeof (Double));
+ createCol(prims, "RotationW", typeof (Double));
+
+ // sit target
+ createCol(prims, "SitTargetOffsetX", typeof (Double));
+ createCol(prims, "SitTargetOffsetY", typeof (Double));
+ createCol(prims, "SitTargetOffsetZ", typeof (Double));
+
+ createCol(prims, "SitTargetOrientW", typeof (Double));
+ createCol(prims, "SitTargetOrientX", typeof (Double));
+ createCol(prims, "SitTargetOrientY", typeof (Double));
+ createCol(prims, "SitTargetOrientZ", typeof (Double));
+
+ createCol(prims, "PayPrice", typeof(Int32));
+ createCol(prims, "PayButton1", typeof(Int32));
+ createCol(prims, "PayButton2", typeof(Int32));
+ createCol(prims, "PayButton3", typeof(Int32));
+ createCol(prims, "PayButton4", typeof(Int32));
+
+ createCol(prims, "LoopedSound", typeof(String));
+ createCol(prims, "LoopedSoundGain", typeof(Double));
+ createCol(prims, "TextureAnimation", typeof(String));
+ createCol(prims, "ParticleSystem", typeof(String));
+
+ createCol(prims, "OmegaX", typeof(Double));
+ createCol(prims, "OmegaY", typeof(Double));
+ createCol(prims, "OmegaZ", typeof(Double));
+
+ createCol(prims, "CameraEyeOffsetX", typeof(Double));
+ createCol(prims, "CameraEyeOffsetY", typeof(Double));
+ createCol(prims, "CameraEyeOffsetZ", typeof(Double));
+
+ createCol(prims, "CameraAtOffsetX", typeof(Double));
+ createCol(prims, "CameraAtOffsetY", typeof(Double));
+ createCol(prims, "CameraAtOffsetZ", typeof(Double));
+
+ createCol(prims, "ForceMouselook", typeof(Int16));
+
+ createCol(prims, "ScriptAccessPin", typeof(Int32));
+
+ createCol(prims, "AllowedDrop", typeof(Int16));
+ createCol(prims, "DieAtEdge", typeof(Int16));
+
+ createCol(prims, "SalePrice", typeof(Int32));
+ createCol(prims, "SaleType", typeof(Int16));
+
+ // click action
+ createCol(prims, "ClickAction", typeof (Byte));
+
+ createCol(prims, "Material", typeof(Byte));
+
+ createCol(prims, "CollisionSound", typeof(String));
+ createCol(prims, "CollisionSoundVolume", typeof(Double));
+
+ createCol(prims, "VolumeDetect", typeof(Int16));
+
+ // Add in contraints
+ prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
+
+ return prims;
+ }
+
+ ///
+ /// Creates "primshapes" table
+ ///
+ /// shape table DataTable
+ private static DataTable createShapeTable()
+ {
+ DataTable shapes = new DataTable("primshapes");
+ createCol(shapes, "UUID", typeof (String));
+ // shape is an enum
+ createCol(shapes, "Shape", typeof (Int32));
+ // vectors
+ createCol(shapes, "ScaleX", typeof (Double));
+ createCol(shapes, "ScaleY", typeof (Double));
+ createCol(shapes, "ScaleZ", typeof (Double));
+ // paths
+ createCol(shapes, "PCode", typeof (Int32));
+ createCol(shapes, "PathBegin", typeof (Int32));
+ createCol(shapes, "PathEnd", typeof (Int32));
+ createCol(shapes, "PathScaleX", typeof (Int32));
+ createCol(shapes, "PathScaleY", typeof (Int32));
+ createCol(shapes, "PathShearX", typeof (Int32));
+ createCol(shapes, "PathShearY", typeof (Int32));
+ createCol(shapes, "PathSkew", typeof (Int32));
+ createCol(shapes, "PathCurve", typeof (Int32));
+ createCol(shapes, "PathRadiusOffset", typeof (Int32));
+ createCol(shapes, "PathRevolutions", typeof (Int32));
+ createCol(shapes, "PathTaperX", typeof (Int32));
+ createCol(shapes, "PathTaperY", typeof (Int32));
+ createCol(shapes, "PathTwist", typeof (Int32));
+ createCol(shapes, "PathTwistBegin", typeof (Int32));
+ // profile
+ createCol(shapes, "ProfileBegin", typeof (Int32));
+ createCol(shapes, "ProfileEnd", typeof (Int32));
+ createCol(shapes, "ProfileCurve", typeof (Int32));
+ createCol(shapes, "ProfileHollow", typeof (Int32));
+ createCol(shapes, "State", typeof(Int32));
+ // text TODO: this isn't right, but I'm not sure the right
+ // way to specify this as a blob atm
+ createCol(shapes, "Texture", typeof (Byte[]));
+ createCol(shapes, "ExtraParams", typeof (Byte[]));
+
+ shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
+
+ return shapes;
+ }
+
+ ///
+ /// creates "primitems" table
+ ///
+ /// item table DataTable
+ private static DataTable createItemsTable()
+ {
+ DataTable items = new DataTable("primitems");
+
+ createCol(items, "itemID", typeof (String));
+ createCol(items, "primID", typeof (String));
+ createCol(items, "assetID", typeof (String));
+ createCol(items, "parentFolderID", typeof (String));
+
+ createCol(items, "invType", typeof (Int32));
+ createCol(items, "assetType", typeof (Int32));
+
+ createCol(items, "name", typeof (String));
+ createCol(items, "description", typeof (String));
+
+ createCol(items, "creationDate", typeof (Int64));
+ createCol(items, "creatorID", typeof (String));
+ createCol(items, "ownerID", typeof (String));
+ createCol(items, "lastOwnerID", typeof (String));
+ createCol(items, "groupID", typeof (String));
+
+ createCol(items, "nextPermissions", typeof (UInt32));
+ createCol(items, "currentPermissions", typeof (UInt32));
+ createCol(items, "basePermissions", typeof (UInt32));
+ createCol(items, "everyonePermissions", typeof (UInt32));
+ createCol(items, "groupPermissions", typeof (UInt32));
+ createCol(items, "flags", typeof (UInt32));
+
+ items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] };
+
+ return items;
+ }
+
+ ///
+ /// Creates "land" table
+ ///
+ /// land table DataTable
+ private static DataTable createLandTable()
+ {
+ DataTable land = new DataTable("land");
+ createCol(land, "UUID", typeof (String));
+ createCol(land, "RegionUUID", typeof (String));
+ createCol(land, "LocalLandID", typeof (UInt32));
+
+ // Bitmap is a byte[512]
+ createCol(land, "Bitmap", typeof (Byte[]));
+
+ createCol(land, "Name", typeof (String));
+ createCol(land, "Desc", typeof (String));
+ createCol(land, "OwnerUUID", typeof (String));
+ createCol(land, "IsGroupOwned", typeof (Boolean));
+ createCol(land, "Area", typeof (Int32));
+ createCol(land, "AuctionID", typeof (Int32)); //Unemplemented
+ createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
+ createCol(land, "ClaimDate", typeof (Int32));
+ createCol(land, "ClaimPrice", typeof (Int32));
+ createCol(land, "GroupUUID", typeof (string));
+ createCol(land, "SalePrice", typeof (Int32));
+ createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus
+ createCol(land, "LandFlags", typeof (UInt32));
+ createCol(land, "LandingType", typeof (Byte));
+ createCol(land, "MediaAutoScale", typeof (Byte));
+ createCol(land, "MediaTextureUUID", typeof (String));
+ createCol(land, "MediaURL", typeof (String));
+ createCol(land, "MusicURL", typeof (String));
+ createCol(land, "PassHours", typeof (Double));
+ createCol(land, "PassPrice", typeof (UInt32));
+ createCol(land, "SnapshotUUID", typeof (String));
+ createCol(land, "UserLocationX", typeof (Double));
+ createCol(land, "UserLocationY", typeof (Double));
+ createCol(land, "UserLocationZ", typeof (Double));
+ createCol(land, "UserLookAtX", typeof (Double));
+ createCol(land, "UserLookAtY", typeof (Double));
+ createCol(land, "UserLookAtZ", typeof (Double));
+ createCol(land, "AuthbuyerID", typeof(String));
+ createCol(land, "OtherCleanTime", typeof(Int32));
+
+ land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
+
+ return land;
+ }
+
+ ///
+ /// create "landaccesslist" table
+ ///
+ /// Landacceslist DataTable
+ private static DataTable createLandAccessListTable()
+ {
+ DataTable landaccess = new DataTable("landaccesslist");
+ createCol(landaccess, "LandUUID", typeof (String));
+ createCol(landaccess, "AccessUUID", typeof (String));
+ createCol(landaccess, "Flags", typeof (UInt32));
+
+ return landaccess;
+ }
+
+ private static DataTable createRegionSettingsTable()
+ {
+ DataTable regionsettings = new DataTable("regionsettings");
+ createCol(regionsettings, "regionUUID", typeof(String));
+ createCol(regionsettings, "block_terraform", typeof (Int32));
+ createCol(regionsettings, "block_fly", typeof (Int32));
+ createCol(regionsettings, "allow_damage", typeof (Int32));
+ createCol(regionsettings, "restrict_pushing", typeof (Int32));
+ createCol(regionsettings, "allow_land_resell", typeof (Int32));
+ createCol(regionsettings, "allow_land_join_divide", typeof (Int32));
+ createCol(regionsettings, "block_show_in_search", typeof (Int32));
+ createCol(regionsettings, "agent_limit", typeof (Int32));
+ createCol(regionsettings, "object_bonus", typeof (Double));
+ createCol(regionsettings, "maturity", typeof (Int32));
+ createCol(regionsettings, "disable_scripts", typeof (Int32));
+ createCol(regionsettings, "disable_collisions", typeof (Int32));
+ createCol(regionsettings, "disable_physics", typeof (Int32));
+ createCol(regionsettings, "terrain_texture_1", typeof(String));
+ createCol(regionsettings, "terrain_texture_2", typeof(String));
+ createCol(regionsettings, "terrain_texture_3", typeof(String));
+ createCol(regionsettings, "terrain_texture_4", typeof(String));
+ createCol(regionsettings, "elevation_1_nw", typeof (Double));
+ createCol(regionsettings, "elevation_2_nw", typeof (Double));
+ createCol(regionsettings, "elevation_1_ne", typeof (Double));
+ createCol(regionsettings, "elevation_2_ne", typeof (Double));
+ createCol(regionsettings, "elevation_1_se", typeof (Double));
+ createCol(regionsettings, "elevation_2_se", typeof (Double));
+ createCol(regionsettings, "elevation_1_sw", typeof (Double));
+ createCol(regionsettings, "elevation_2_sw", typeof (Double));
+ createCol(regionsettings, "water_height", typeof (Double));
+ createCol(regionsettings, "terrain_raise_limit", typeof (Double));
+ createCol(regionsettings, "terrain_lower_limit", typeof (Double));
+ createCol(regionsettings, "use_estate_sun", typeof (Int32));
+ createCol(regionsettings, "sandbox", typeof (Int32));
+ createCol(regionsettings, "sunvectorx",typeof (Double));
+ createCol(regionsettings, "sunvectory",typeof (Double));
+ createCol(regionsettings, "sunvectorz",typeof (Double));
+ createCol(regionsettings, "fixed_sun", typeof (Int32));
+ createCol(regionsettings, "sun_position", typeof (Double));
+ createCol(regionsettings, "covenant", typeof(String));
+ regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
+ return regionsettings;
+ }
+
+ /***********************************************************************
+ *
+ * Convert between ADO.NET <=> OpenSim Objects
+ *
+ * These should be database independant
+ *
+ **********************************************************************/
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private SceneObjectPart buildPrim(DataRow row)
+ {
+ // Code commented. Uncomment to test the unit test inline.
+
+ // The unit test mentions this commented code for the purposes
+ // of debugging a unit test failure
+
+ // SceneObjectGroup sog = new SceneObjectGroup();
+ // SceneObjectPart sop = new SceneObjectPart();
+ // sop.LocalId = 1;
+ // sop.Name = "object1";
+ // sop.Description = "object1";
+ // sop.Text = "";
+ // sop.SitName = "";
+ // sop.TouchName = "";
+ // sop.UUID = UUID.Random();
+ // sop.Shape = PrimitiveBaseShape.Default;
+ // sog.SetRootPart(sop);
+ // Add breakpoint in above line. Check sop fields.
+
+ // TODO: this doesn't work yet because something more
+ // interesting has to be done to actually get these values
+ // back out. Not enough time to figure it out yet.
+
+ SceneObjectPart prim = new SceneObjectPart();
+ prim.UUID = new UUID((String) row["UUID"]);
+ // explicit conversion of integers is required, which sort
+ // of sucks. No idea if there is a shortcut here or not.
+ prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
+ prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"];
+ // various text fields
+ prim.Text = (String) row["Text"];
+ prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
+ Convert.ToInt32(row["ColorR"]),
+ Convert.ToInt32(row["ColorG"]),
+ Convert.ToInt32(row["ColorB"]));
+ prim.Description = (String) row["Description"];
+ prim.SitName = (String) row["SitName"];
+ prim.TouchName = (String) row["TouchName"];
+ // permissions
+ prim.Flags = (PrimFlags)Convert.ToUInt32(row["ObjectFlags"]);
+ prim.CreatorID = new UUID((String) row["CreatorID"]);
+ prim.OwnerID = new UUID((String) row["OwnerID"]);
+ prim.GroupID = new UUID((String) row["GroupID"]);
+ prim.LastOwnerID = new UUID((String) row["LastOwnerID"]);
+ prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
+ prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
+ prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
+ prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]);
+ prim.BaseMask = Convert.ToUInt32(row["BaseMask"]);
+ // vectors
+ prim.OffsetPosition = new Vector3(
+ Convert.ToSingle(row["PositionX"]),
+ Convert.ToSingle(row["PositionY"]),
+ Convert.ToSingle(row["PositionZ"])
+ );
+ prim.GroupPosition = new Vector3(
+ Convert.ToSingle(row["GroupPositionX"]),
+ Convert.ToSingle(row["GroupPositionY"]),
+ Convert.ToSingle(row["GroupPositionZ"])
+ );
+ prim.Velocity = new Vector3(
+ Convert.ToSingle(row["VelocityX"]),
+ Convert.ToSingle(row["VelocityY"]),
+ Convert.ToSingle(row["VelocityZ"])
+ );
+ prim.AngularVelocity = new Vector3(
+ Convert.ToSingle(row["AngularVelocityX"]),
+ Convert.ToSingle(row["AngularVelocityY"]),
+ Convert.ToSingle(row["AngularVelocityZ"])
+ );
+ prim.Acceleration = new Vector3(
+ Convert.ToSingle(row["AccelerationX"]),
+ Convert.ToSingle(row["AccelerationY"]),
+ Convert.ToSingle(row["AccelerationZ"])
+ );
+ // quaternions
+ prim.RotationOffset = new Quaternion(
+ Convert.ToSingle(row["RotationX"]),
+ Convert.ToSingle(row["RotationY"]),
+ Convert.ToSingle(row["RotationZ"]),
+ Convert.ToSingle(row["RotationW"])
+ );
+
+ prim.SitTargetPositionLL = new Vector3(
+ Convert.ToSingle(row["SitTargetOffsetX"]),
+ Convert.ToSingle(row["SitTargetOffsetY"]),
+ Convert.ToSingle(row["SitTargetOffsetZ"]));
+ prim.SitTargetOrientationLL = new Quaternion(
+ Convert.ToSingle(
+ row["SitTargetOrientX"]),
+ Convert.ToSingle(
+ row["SitTargetOrientY"]),
+ Convert.ToSingle(
+ row["SitTargetOrientZ"]),
+ Convert.ToSingle(
+ row["SitTargetOrientW"]));
+
+ prim.ClickAction = Convert.ToByte(row["ClickAction"]);
+ prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
+ prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]);
+ prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]);
+ prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]);
+ prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]);
+
+ prim.Sound = new UUID(row["LoopedSound"].ToString());
+ prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]);
+ prim.SoundFlags = 1; // If it's persisted at all, it's looped
+
+ if (!row.IsNull("TextureAnimation"))
+ prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString());
+ if (!row.IsNull("ParticleSystem"))
+ prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString());
+
+ prim.AngularVelocity = new Vector3(
+ Convert.ToSingle(row["OmegaX"]),
+ Convert.ToSingle(row["OmegaY"]),
+ Convert.ToSingle(row["OmegaZ"])
+ );
+
+ prim.SetCameraEyeOffset(new Vector3(
+ Convert.ToSingle(row["CameraEyeOffsetX"]),
+ Convert.ToSingle(row["CameraEyeOffsetY"]),
+ Convert.ToSingle(row["CameraEyeOffsetZ"])
+ ));
+
+ prim.SetCameraAtOffset(new Vector3(
+ Convert.ToSingle(row["CameraAtOffsetX"]),
+ Convert.ToSingle(row["CameraAtOffsetY"]),
+ Convert.ToSingle(row["CameraAtOffsetZ"])
+ ));
+
+ if (Convert.ToInt16(row["ForceMouselook"]) != 0)
+ prim.SetForceMouselook(true);
+
+ prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]);
+
+ if (Convert.ToInt16(row["AllowedDrop"]) != 0)
+ prim.AllowedDrop = true;
+
+ if (Convert.ToInt16(row["DieAtEdge"]) != 0)
+ prim.DIE_AT_EDGE = true;
+
+ prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
+ prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
+
+ prim.Material = Convert.ToByte(row["Material"]);
+
+ prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
+ prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
+
+ if (Convert.ToInt16(row["VolumeDetect"]) != 0)
+ prim.VolumeDetectActive = true;
+
+ return prim;
+ }
+
+ ///
+ /// Build a prim inventory item from the persisted data.
+ ///
+ ///
+ ///
+ private static TaskInventoryItem buildItem(DataRow row)
+ {
+ TaskInventoryItem taskItem = new TaskInventoryItem();
+
+ taskItem.ItemID = new UUID((String)row["itemID"]);
+ taskItem.ParentPartID = new UUID((String)row["primID"]);
+ taskItem.AssetID = new UUID((String)row["assetID"]);
+ taskItem.ParentID = new UUID((String)row["parentFolderID"]);
+
+ taskItem.InvType = Convert.ToInt32(row["invType"]);
+ taskItem.Type = Convert.ToInt32(row["assetType"]);
+
+ taskItem.Name = (String)row["name"];
+ taskItem.Description = (String)row["description"];
+ taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
+ taskItem.CreatorID = new UUID((String)row["creatorID"]);
+ taskItem.OwnerID = new UUID((String)row["ownerID"]);
+ taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]);
+ taskItem.GroupID = new UUID((String)row["groupID"]);
+
+ taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
+ taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
+ taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
+ taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
+ taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
+ taskItem.Flags = Convert.ToUInt32(row["flags"]);
+
+ return taskItem;
+ }
+
+ ///
+ /// Build a Land Data from the persisted data.
+ ///
+ ///
+ ///
+ private LandData buildLandData(DataRow row)
+ {
+ LandData newData = new LandData();
+
+ newData.GlobalID = new UUID((String) row["UUID"]);
+ newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
+
+ // Bitmap is a byte[512]
+ newData.Bitmap = (Byte[]) row["Bitmap"];
+
+ newData.Name = (String) row["Name"];
+ newData.Description = (String) row["Desc"];
+ newData.OwnerID = (UUID)(String) row["OwnerUUID"];
+ newData.IsGroupOwned = (Boolean) row["IsGroupOwned"];
+ newData.Area = Convert.ToInt32(row["Area"]);
+ newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
+ newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]);
+ //Enum OpenMetaverse.Parcel.ParcelCategory
+ newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
+ newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
+ newData.GroupID = new UUID((String) row["GroupUUID"]);
+ newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
+ newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]);
+ //Enum. OpenMetaverse.Parcel.ParcelStatus
+ newData.Flags = Convert.ToUInt32(row["LandFlags"]);
+ newData.LandingType = (Byte) row["LandingType"];
+ newData.MediaAutoScale = (Byte) row["MediaAutoScale"];
+ newData.MediaID = new UUID((String) row["MediaTextureUUID"]);
+ newData.MediaURL = (String) row["MediaURL"];
+ newData.MusicURL = (String) row["MusicURL"];
+ newData.PassHours = Convert.ToSingle(row["PassHours"]);
+ newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
+ newData.SnapshotID = (UUID)(String) row["SnapshotUUID"];
+ try
+ {
+
+ newData.UserLocation =
+ new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
+ Convert.ToSingle(row["UserLocationZ"]));
+ newData.UserLookAt =
+ new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
+ Convert.ToSingle(row["UserLookAtZ"]));
+
+ }
+ catch (InvalidCastException)
+ {
+ m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
+ newData.UserLocation = Vector3.Zero;
+ newData.UserLookAt = Vector3.Zero;
+ }
+ newData.ParcelAccessList = new List();
+ UUID authBuyerID = UUID.Zero;
+
+ UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
+
+ newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
+
+ return newData;
+ }
+
+ private RegionSettings buildRegionSettings(DataRow row)
+ {
+ RegionSettings newSettings = new RegionSettings();
+
+ newSettings.RegionUUID = new UUID((string) row["regionUUID"]);
+ newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
+ newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
+ newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
+ newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
+ newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
+ newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
+ newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
+ newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
+ newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
+ newSettings.Maturity = Convert.ToInt32(row["maturity"]);
+ newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
+ newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
+ newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
+ newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]);
+ newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]);
+ newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]);
+ newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]);
+ newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
+ newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
+ newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
+ newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
+ newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
+ newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
+ newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
+ newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
+ newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
+ newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
+ newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
+ newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
+ newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
+ newSettings.SunVector = new Vector3 (
+ Convert.ToSingle(row["sunvectorx"]),
+ Convert.ToSingle(row["sunvectory"]),
+ Convert.ToSingle(row["sunvectorz"])
+ );
+ newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
+ newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
+ newSettings.Covenant = new UUID((String) row["covenant"]);
+
+ return newSettings;
+ }
+
+ ///
+ /// Build a land access entry from the persisted data.
+ ///
+ ///
+ ///
+ private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
+ {
+ ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
+ entry.AgentID = new UUID((string) row["AccessUUID"]);
+ entry.Flags = (AccessList) row["Flags"];
+ entry.Time = new DateTime();
+ return entry;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static Array serializeTerrain(double[,] val)
+ {
+ MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
+ BinaryWriter bw = new BinaryWriter(str);
+
+ // TODO: COMPATIBILITY - Add byte-order conversions
+ for (int x = 0; x < (int)Constants.RegionSize; x++)
+ for (int y = 0; y < (int)Constants.RegionSize; y++)
+ bw.Write(val[x, y]);
+
+ return str.ToArray();
+ }
+
+// private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val)
+// {
+// row["RegionUUID"] = regionUUID;
+// row["Revision"] = rev;
+
+ // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double));
+// BinaryWriter bw = new BinaryWriter(str);
+
+// // TODO: COMPATIBILITY - Add byte-order conversions
+ // for (int x = 0; x < (int)Constants.RegionSize; x++)
+ // for (int y = 0; y < (int)Constants.RegionSize; y++)
+// bw.Write(val[x, y]);
+
+// row["Heightfield"] = str.ToArray();
+// }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
+ {
+ row["UUID"] = prim.UUID.ToString();
+ row["RegionUUID"] = regionUUID.ToString();
+ row["CreationDate"] = prim.CreationDate;
+ row["Name"] = prim.Name;
+ row["SceneGroupID"] = sceneGroupID.ToString();
+ // the UUID of the root part for this SceneObjectGroup
+ // various text fields
+ row["Text"] = prim.Text;
+ row["Description"] = prim.Description;
+ row["SitName"] = prim.SitName;
+ row["TouchName"] = prim.TouchName;
+ // permissions
+ row["ObjectFlags"] = (uint)prim.Flags;
+ row["CreatorID"] = prim.CreatorID.ToString();
+ row["OwnerID"] = prim.OwnerID.ToString();
+ row["GroupID"] = prim.GroupID.ToString();
+ row["LastOwnerID"] = prim.LastOwnerID.ToString();
+ row["OwnerMask"] = prim.OwnerMask;
+ row["NextOwnerMask"] = prim.NextOwnerMask;
+ row["GroupMask"] = prim.GroupMask;
+ row["EveryoneMask"] = prim.EveryoneMask;
+ row["BaseMask"] = prim.BaseMask;
+ // vectors
+ row["PositionX"] = prim.OffsetPosition.X;
+ row["PositionY"] = prim.OffsetPosition.Y;
+ row["PositionZ"] = prim.OffsetPosition.Z;
+ row["GroupPositionX"] = prim.GroupPosition.X;
+ row["GroupPositionY"] = prim.GroupPosition.Y;
+ row["GroupPositionZ"] = prim.GroupPosition.Z;
+ row["VelocityX"] = prim.Velocity.X;
+ row["VelocityY"] = prim.Velocity.Y;
+ row["VelocityZ"] = prim.Velocity.Z;
+ row["AngularVelocityX"] = prim.AngularVelocity.X;
+ row["AngularVelocityY"] = prim.AngularVelocity.Y;
+ row["AngularVelocityZ"] = prim.AngularVelocity.Z;
+ row["AccelerationX"] = prim.Acceleration.X;
+ row["AccelerationY"] = prim.Acceleration.Y;
+ row["AccelerationZ"] = prim.Acceleration.Z;
+ // quaternions
+ row["RotationX"] = prim.RotationOffset.X;
+ row["RotationY"] = prim.RotationOffset.Y;
+ row["RotationZ"] = prim.RotationOffset.Z;
+ row["RotationW"] = prim.RotationOffset.W;
+
+ // Sit target
+ Vector3 sitTargetPos = prim.SitTargetPositionLL;
+ row["SitTargetOffsetX"] = sitTargetPos.X;
+ row["SitTargetOffsetY"] = sitTargetPos.Y;
+ row["SitTargetOffsetZ"] = sitTargetPos.Z;
+
+ Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
+ row["SitTargetOrientW"] = sitTargetOrient.W;
+ row["SitTargetOrientX"] = sitTargetOrient.X;
+ row["SitTargetOrientY"] = sitTargetOrient.Y;
+ row["SitTargetOrientZ"] = sitTargetOrient.Z;
+ row["ColorR"] = Convert.ToInt32(prim.Color.R);
+ row["ColorG"] = Convert.ToInt32(prim.Color.G);
+ row["ColorB"] = Convert.ToInt32(prim.Color.B);
+ row["ColorA"] = Convert.ToInt32(prim.Color.A);
+ row["PayPrice"] = prim.PayPrice[0];
+ row["PayButton1"] = prim.PayPrice[1];
+ row["PayButton2"] = prim.PayPrice[2];
+ row["PayButton3"] = prim.PayPrice[3];
+ row["PayButton4"] = prim.PayPrice[4];
+
+
+ row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation);
+ row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem);
+
+ row["OmegaX"] = prim.AngularVelocity.X;
+ row["OmegaY"] = prim.AngularVelocity.Y;
+ row["OmegaZ"] = prim.AngularVelocity.Z;
+
+ row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X;
+ row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y;
+ row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z;
+
+ row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X;
+ row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y;
+ row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z;
+
+
+ if ((prim.SoundFlags & 1) != 0) // Looped
+ {
+ row["LoopedSound"] = prim.Sound.ToString();
+ row["LoopedSoundGain"] = prim.SoundGain;
+ }
+ else
+ {
+ row["LoopedSound"] = UUID.Zero.ToString();
+ row["LoopedSoundGain"] = 0.0f;
+ }
+
+ if (prim.GetForceMouselook())
+ row["ForceMouselook"] = 1;
+ else
+ row["ForceMouselook"] = 0;
+
+ row["ScriptAccessPin"] = prim.ScriptAccessPin;
+
+ if (prim.AllowedDrop)
+ row["AllowedDrop"] = 1;
+ else
+ row["AllowedDrop"] = 0;
+
+ if (prim.DIE_AT_EDGE)
+ row["DieAtEdge"] = 1;
+ else
+ row["DieAtEdge"] = 0;
+
+ row["SalePrice"] = prim.SalePrice;
+ row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType);
+
+ // click action
+ row["ClickAction"] = prim.ClickAction;
+
+ row["SalePrice"] = prim.SalePrice;
+ row["Material"] = prim.Material;
+
+ row["CollisionSound"] = prim.CollisionSound.ToString();
+ row["CollisionSoundVolume"] = prim.CollisionSoundVolume;
+ if (prim.VolumeDetectActive)
+ row["VolumeDetect"] = 1;
+ else
+ row["VolumeDetect"] = 0;
+
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
+ {
+ row["itemID"] = taskItem.ItemID.ToString();
+ row["primID"] = taskItem.ParentPartID.ToString();
+ row["assetID"] = taskItem.AssetID.ToString();
+ row["parentFolderID"] = taskItem.ParentID.ToString();
+
+ row["invType"] = taskItem.InvType;
+ row["assetType"] = taskItem.Type;
+
+ row["name"] = taskItem.Name;
+ row["description"] = taskItem.Description;
+ row["creationDate"] = taskItem.CreationDate;
+ row["creatorID"] = taskItem.CreatorID.ToString();
+ row["ownerID"] = taskItem.OwnerID.ToString();
+ row["lastOwnerID"] = taskItem.LastOwnerID.ToString();
+ row["groupID"] = taskItem.GroupID.ToString();
+ row["nextPermissions"] = taskItem.NextPermissions;
+ row["currentPermissions"] = taskItem.CurrentPermissions;
+ row["basePermissions"] = taskItem.BasePermissions;
+ row["everyonePermissions"] = taskItem.EveryonePermissions;
+ row["groupPermissions"] = taskItem.GroupPermissions;
+ row["flags"] = taskItem.Flags;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillLandRow(DataRow row, LandData land, UUID regionUUID)
+ {
+ row["UUID"] = land.GlobalID.ToString();
+ row["RegionUUID"] = regionUUID.ToString();
+ row["LocalLandID"] = land.LocalID;
+
+ // Bitmap is a byte[512]
+ row["Bitmap"] = land.Bitmap;
+
+ row["Name"] = land.Name;
+ row["Desc"] = land.Description;
+ row["OwnerUUID"] = land.OwnerID.ToString();
+ row["IsGroupOwned"] = land.IsGroupOwned;
+ row["Area"] = land.Area;
+ row["AuctionID"] = land.AuctionID; //Unemplemented
+ row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
+ row["ClaimDate"] = land.ClaimDate;
+ row["ClaimPrice"] = land.ClaimPrice;
+ row["GroupUUID"] = land.GroupID.ToString();
+ row["SalePrice"] = land.SalePrice;
+ row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus
+ row["LandFlags"] = land.Flags;
+ row["LandingType"] = land.LandingType;
+ row["MediaAutoScale"] = land.MediaAutoScale;
+ row["MediaTextureUUID"] = land.MediaID.ToString();
+ row["MediaURL"] = land.MediaURL;
+ row["MusicURL"] = land.MusicURL;
+ row["PassHours"] = land.PassHours;
+ row["PassPrice"] = land.PassPrice;
+ row["SnapshotUUID"] = land.SnapshotID.ToString();
+ row["UserLocationX"] = land.UserLocation.X;
+ row["UserLocationY"] = land.UserLocation.Y;
+ row["UserLocationZ"] = land.UserLocation.Z;
+ row["UserLookAtX"] = land.UserLookAt.X;
+ row["UserLookAtY"] = land.UserLookAt.Y;
+ row["UserLookAtZ"] = land.UserLookAt.Z;
+ row["AuthbuyerID"] = land.AuthBuyerID.ToString();
+ row["OtherCleanTime"] = land.OtherCleanTime;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
+ {
+ row["LandUUID"] = parcelID.ToString();
+ row["AccessUUID"] = entry.AgentID.ToString();
+ row["Flags"] = entry.Flags;
+ }
+
+ private static void fillRegionSettingsRow(DataRow row, RegionSettings settings)
+ {
+ row["regionUUID"] = settings.RegionUUID.ToString();
+ row["block_terraform"] = settings.BlockTerraform;
+ row["block_fly"] = settings.BlockFly;
+ row["allow_damage"] = settings.AllowDamage;
+ row["restrict_pushing"] = settings.RestrictPushing;
+ row["allow_land_resell"] = settings.AllowLandResell;
+ row["allow_land_join_divide"] = settings.AllowLandJoinDivide;
+ row["block_show_in_search"] = settings.BlockShowInSearch;
+ row["agent_limit"] = settings.AgentLimit;
+ row["object_bonus"] = settings.ObjectBonus;
+ row["maturity"] = settings.Maturity;
+ row["disable_scripts"] = settings.DisableScripts;
+ row["disable_collisions"] = settings.DisableCollisions;
+ row["disable_physics"] = settings.DisablePhysics;
+ row["terrain_texture_1"] = settings.TerrainTexture1.ToString();
+ row["terrain_texture_2"] = settings.TerrainTexture2.ToString();
+ row["terrain_texture_3"] = settings.TerrainTexture3.ToString();
+ row["terrain_texture_4"] = settings.TerrainTexture4.ToString();
+ row["elevation_1_nw"] = settings.Elevation1NW;
+ row["elevation_2_nw"] = settings.Elevation2NW;
+ row["elevation_1_ne"] = settings.Elevation1NE;
+ row["elevation_2_ne"] = settings.Elevation2NE;
+ row["elevation_1_se"] = settings.Elevation1SE;
+ row["elevation_2_se"] = settings.Elevation2SE;
+ row["elevation_1_sw"] = settings.Elevation1SW;
+ row["elevation_2_sw"] = settings.Elevation2SW;
+ row["water_height"] = settings.WaterHeight;
+ row["terrain_raise_limit"] = settings.TerrainRaiseLimit;
+ row["terrain_lower_limit"] = settings.TerrainLowerLimit;
+ row["use_estate_sun"] = settings.UseEstateSun;
+ row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox
+ row["sunvectorx"] = settings.SunVector.X;
+ row["sunvectory"] = settings.SunVector.Y;
+ row["sunvectorz"] = settings.SunVector.Z;
+ row["fixed_sun"] = settings.FixedSun;
+ row["sun_position"] = settings.SunPosition;
+ row["covenant"] = settings.Covenant.ToString();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private PrimitiveBaseShape buildShape(DataRow row)
+ {
+ PrimitiveBaseShape s = new PrimitiveBaseShape();
+ s.Scale = new Vector3(
+ Convert.ToSingle(row["ScaleX"]),
+ Convert.ToSingle(row["ScaleY"]),
+ Convert.ToSingle(row["ScaleZ"])
+ );
+ // paths
+ s.PCode = Convert.ToByte(row["PCode"]);
+ s.PathBegin = Convert.ToUInt16(row["PathBegin"]);
+ s.PathEnd = Convert.ToUInt16(row["PathEnd"]);
+ s.PathScaleX = Convert.ToByte(row["PathScaleX"]);
+ s.PathScaleY = Convert.ToByte(row["PathScaleY"]);
+ s.PathShearX = Convert.ToByte(row["PathShearX"]);
+ s.PathShearY = Convert.ToByte(row["PathShearY"]);
+ s.PathSkew = Convert.ToSByte(row["PathSkew"]);
+ s.PathCurve = Convert.ToByte(row["PathCurve"]);
+ s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]);
+ s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]);
+ s.PathTaperX = Convert.ToSByte(row["PathTaperX"]);
+ s.PathTaperY = Convert.ToSByte(row["PathTaperY"]);
+ s.PathTwist = Convert.ToSByte(row["PathTwist"]);
+ s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]);
+ // profile
+ s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]);
+ s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
+ s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
+ s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
+ s.State = Convert.ToByte(row["State"]);
+
+ byte[] textureEntry = (byte[])row["Texture"];
+ s.TextureEntry = textureEntry;
+
+ s.ExtraParams = (byte[]) row["ExtraParams"];
+ return s;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void fillShapeRow(DataRow row, SceneObjectPart prim)
+ {
+ PrimitiveBaseShape s = prim.Shape;
+ row["UUID"] = prim.UUID.ToString();
+ // shape is an enum
+ row["Shape"] = 0;
+ // vectors
+ row["ScaleX"] = s.Scale.X;
+ row["ScaleY"] = s.Scale.Y;
+ row["ScaleZ"] = s.Scale.Z;
+ // paths
+ row["PCode"] = s.PCode;
+ row["PathBegin"] = s.PathBegin;
+ row["PathEnd"] = s.PathEnd;
+ row["PathScaleX"] = s.PathScaleX;
+ row["PathScaleY"] = s.PathScaleY;
+ row["PathShearX"] = s.PathShearX;
+ row["PathShearY"] = s.PathShearY;
+ row["PathSkew"] = s.PathSkew;
+ row["PathCurve"] = s.PathCurve;
+ row["PathRadiusOffset"] = s.PathRadiusOffset;
+ row["PathRevolutions"] = s.PathRevolutions;
+ row["PathTaperX"] = s.PathTaperX;
+ row["PathTaperY"] = s.PathTaperY;
+ row["PathTwist"] = s.PathTwist;
+ row["PathTwistBegin"] = s.PathTwistBegin;
+ // profile
+ row["ProfileBegin"] = s.ProfileBegin;
+ row["ProfileEnd"] = s.ProfileEnd;
+ row["ProfileCurve"] = s.ProfileCurve;
+ row["ProfileHollow"] = s.ProfileHollow;
+ row["State"] = s.State;
+
+ row["Texture"] = s.TextureEntry;
+ row["ExtraParams"] = s.ExtraParams;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
+ {
+
+ DataTable prims = ds.Tables["prims"];
+ DataTable shapes = ds.Tables["primshapes"];
+
+ DataRow primRow = prims.Rows.Find(prim.UUID.ToString());
+ if (primRow == null)
+ {
+ primRow = prims.NewRow();
+ fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
+ prims.Rows.Add(primRow);
+ }
+ else
+ {
+ fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
+ }
+
+ DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
+ if (shapeRow == null)
+ {
+ shapeRow = shapes.NewRow();
+ fillShapeRow(shapeRow, prim);
+ shapes.Rows.Add(shapeRow);
+ }
+ else
+ {
+ fillShapeRow(shapeRow, prim);
+ }
+ }
+
+ ///
+ /// see IRegionDatastore
+ ///
+ ///
+ ///
+ public void StorePrimInventory(UUID primID, ICollection items)
+ {
+ m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
+
+ DataTable dbItems = ds.Tables["primitems"];
+
+ // For now, we're just going to crudely remove all the previous inventory items
+ // no matter whether they have changed or not, and replace them with the current set.
+ lock (ds)
+ {
+ RemoveItems(primID);
+
+ // repalce with current inventory details
+ foreach (TaskInventoryItem newItem in items)
+ {
+// m_log.InfoFormat(
+// "[DATASTORE]: ",
+// "Adding item {0}, {1} to prim ID {2}",
+// newItem.Name, newItem.ItemID, newItem.ParentPartID);
+
+ DataRow newItemRow = dbItems.NewRow();
+ fillItemRow(newItemRow, newItem);
+ dbItems.Rows.Add(newItemRow);
+ }
+ }
+
+ Commit();
+ }
+
+ /***********************************************************************
+ *
+ * SQL Statement Creation Functions
+ *
+ * These functions create SQL statements for update, insert, and create.
+ * They can probably be factored later to have a db independant
+ * portion and a db specific portion
+ *
+ **********************************************************************/
+
+ ///
+ /// Create an insert command
+ ///
+ /// table name
+ /// data table
+ /// the created command
+ ///
+ /// This is subtle enough to deserve some commentary.
+ /// Instead of doing *lots* and *lots of hardcoded strings
+ /// for database definitions we'll use the fact that
+ /// realistically all insert statements look like "insert
+ /// into A(b, c) values(:b, :c) on the parameterized query
+ /// front. If we just have a list of b, c, etc... we can
+ /// generate these strings instead of typing them out.
+ ///
+ private static SqliteCommand createInsertCommand(string table, DataTable dt)
+ {
+ string[] cols = new string[dt.Columns.Count];
+ for (int i = 0; i < dt.Columns.Count; i++)
+ {
+ DataColumn col = dt.Columns[i];
+ cols[i] = col.ColumnName;
+ }
+
+ string sql = "insert into " + table + "(";
+ sql += String.Join(", ", cols);
+ // important, the first ':' needs to be here, the rest get added in the join
+ sql += ") values (:";
+ sql += String.Join(", :", cols);
+ sql += ")";
+ SqliteCommand cmd = new SqliteCommand(sql);
+
+ // this provides the binding for all our parameters, so
+ // much less code than it used to be
+ foreach (DataColumn col in dt.Columns)
+ {
+ cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
+ }
+ return cmd;
+ }
+
+
+ ///
+ /// create an update command
+ ///
+ /// table name
+ ///
+ ///
+ /// the created command
+ private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
+ {
+ string sql = "update " + table + " set ";
+ string subsql = String.Empty;
+ foreach (DataColumn col in dt.Columns)
+ {
+ if (subsql.Length > 0)
+ {
+ // a map function would rock so much here
+ subsql += ", ";
+ }
+ subsql += col.ColumnName + "= :" + col.ColumnName;
+ }
+ sql += subsql;
+ sql += " where " + pk;
+ SqliteCommand cmd = new SqliteCommand(sql);
+
+ // this provides the binding for all our parameters, so
+ // much less code than it used to be
+
+ foreach (DataColumn col in dt.Columns)
+ {
+ cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
+ }
+ return cmd;
+ }
+
+ ///
+ /// create an update command
+ ///
+ /// table name
+ ///
+ ///
+ /// the created command
+ private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt)
+ {
+ string sql = "update " + table + " set ";
+ string subsql = String.Empty;
+ foreach (DataColumn col in dt.Columns)
+ {
+ if (subsql.Length > 0)
+ {
+ // a map function would rock so much here
+ subsql += ", ";
+ }
+ subsql += col.ColumnName + "= :" + col.ColumnName;
+ }
+ sql += subsql;
+ sql += " where " + pk1 + " and " + pk2;
+ SqliteCommand cmd = new SqliteCommand(sql);
+
+ // this provides the binding for all our parameters, so
+ // much less code than it used to be
+
+ foreach (DataColumn col in dt.Columns)
+ {
+ cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
+ }
+ return cmd;
+ }
+
+ ///
+ ///
+ ///
+ /// Data Table
+ ///
+ // private static string defineTable(DataTable dt)
+ // {
+ // string sql = "create table " + dt.TableName + "(";
+ // string subsql = String.Empty;
+ // foreach (DataColumn col in dt.Columns)
+ // {
+ // if (subsql.Length > 0)
+ // {
+ // // a map function would rock so much here
+ // subsql += ",\n";
+ // }
+ // subsql += col.ColumnName + " " + sqliteType(col.DataType);
+ // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0])
+ // {
+ // subsql += " primary key";
+ // }
+ // }
+ // sql += subsql;
+ // sql += ")";
+ // return sql;
+ // }
+
+ /***********************************************************************
+ *
+ * Database Binding functions
+ *
+ * These will be db specific due to typing, and minor differences
+ * in databases.
+ *
+ **********************************************************************/
+
+ ///
+ /// This is a convenience function that collapses 5 repetitive
+ /// lines for defining SqliteParameters to 2 parameters:
+ /// column name and database type.
+ ///
+ /// It assumes certain conventions like :param as the param
+ /// name to replace in parametrized queries, and that source
+ /// version is always current version, both of which are fine
+ /// for us.
+ ///
+ ///a built sqlite parameter
+ private static SqliteParameter createSqliteParameter(string name, Type type)
+ {
+ SqliteParameter param = new SqliteParameter();
+ param.ParameterName = ":" + name;
+ param.DbType = dbtypeFromType(type);
+ param.SourceColumn = name;
+ param.SourceVersion = DataRowVersion.Current;
+ return param;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID");
+ delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
+ delete.Connection = conn;
+ da.DeleteCommand = delete;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("primitems", "itemID = :itemID", ds.Tables["primitems"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID");
+ delete.Parameters.Add(createSqliteParameter("itemID", typeof (String)));
+ delete.Connection = conn;
+ da.DeleteCommand = delete;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]);
+ da.InsertCommand.Connection = conn;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("land", ds.Tables["land"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID");
+ delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
+ da.DeleteCommand = delete;
+ da.DeleteCommand.Connection = conn;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID");
+ delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String)));
+ delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
+ da.DeleteCommand = delete;
+ da.DeleteCommand.Connection = conn;
+
+ }
+
+ private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("regionsettings", ds.Tables["regionsettings"]);
+ da.InsertCommand.Connection = conn;
+ da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID=:regionUUID", ds.Tables["regionsettings"]);
+ da.UpdateCommand.Connection = conn;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
+ {
+ da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]);
+ da.InsertCommand.Connection = conn;
+
+ da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", ds.Tables["primshapes"]);
+ da.UpdateCommand.Connection = conn;
+
+ SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID");
+ delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
+ delete.Connection = conn;
+ da.DeleteCommand = delete;
+ }
+
+ /***********************************************************************
+ *
+ * Type conversion functions
+ *
+ **********************************************************************/
+
+ ///
+ /// Type conversion function
+ ///
+ ///
+ ///
+ private static DbType dbtypeFromType(Type type)
+ {
+ if (type == typeof (String))
+ {
+ return DbType.String;
+ }
+ else if (type == typeof (Int32))
+ {
+ return DbType.Int32;
+ }
+ else if (type == typeof (Double))
+ {
+ return DbType.Double;
+ }
+ else if (type == typeof (Byte))
+ {
+ return DbType.Byte;
+ }
+ else if (type == typeof (Double))
+ {
+ return DbType.Double;
+ }
+ else if (type == typeof (Byte[]))
+ {
+ return DbType.Binary;
+ }
+ else
+ {
+ return DbType.String;
+ }
+ }
+
+ }
+}
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 29bf5a3..a081462 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests
#else
[TestFixture(Description = "Region store tests (SQLite)")]
- public class SQLiteRegionTests : RegionTests
+ public class SQLiteRegionTests : RegionTests
{
}
[TestFixture(Description = "Region store tests (MySQL)")]
- public class MySqlRegionTests : RegionTests
+ public class MySqlRegionTests : RegionTests
{
}
[TestFixture(Description = "Region store tests (MS SQL Server)")]
- public class MSSQLRegionTests : RegionTests
+ public class MSSQLRegionTests : RegionTests
{
}
@@ -79,11 +79,11 @@ namespace OpenSim.Data.Tests
public class RegionTests : BasicDataServiceTest
where TConn : DbConnection, new()
- where TRegStore : class, IRegionDataStore, new()
+ where TRegStore : class, ISimulationDataStore, new()
{
bool m_rebuildDB;
- public IRegionDataStore db;
+ public ISimulationDataStore db;
public UUID zero = UUID.Zero;
public UUID region1 = UUID.Random();
public UUID region2 = UUID.Random();
@@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests
protected override void InitService(object service)
{
ClearDB();
- db = (IRegionDataStore)service;
+ db = (ISimulationDataStore)service;
db.Initialise(m_connStr);
}
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index ae2e844..54845fd 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// Backup the inventory to the given data store
///
///
- void ProcessInventoryBackup(IRegionDataStore datastore);
+ void ProcessInventoryBackup(ISimulationDataStore datastore);
uint MaskEffectivePermissions();
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
deleted file mode 100644
index 3e8e196..0000000
--- a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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 OpenSimulator 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.Collections.Generic;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.Framework.Interfaces
-{
- public interface IRegionDataStore
- {
- ///
- /// Initialises the data storage engine
- ///
- /// The file to save the database to (may not be applicable). Alternatively,
- /// a connection string for the database
- void Initialise(string filename);
-
- ///
- /// Dispose the database
- ///
- void Dispose();
-
- ///
- /// Stores all object's details apart from inventory
- ///
- ///
- ///
- void StoreObject(SceneObjectGroup obj, UUID regionUUID);
-
- ///
- /// Entirely removes the object, including inventory
- ///
- ///
- ///
- ///
- void RemoveObject(UUID uuid, UUID regionUUID);
-
- ///
- /// Store a prim's inventory
- ///
- ///
- void StorePrimInventory(UUID primID, ICollection items);
-
- ///
- /// Load persisted objects from region storage.
- ///
- /// the Region UUID
- /// List of loaded groups
- List LoadObjects(UUID regionUUID);
-
- ///
- /// Store a terrain revision in region storage
- ///
- /// HeightField data
- /// region UUID
- void StoreTerrain(double[,] terrain, UUID regionID);
-
- ///
- /// Load the latest terrain revision from region storage
- ///
- /// the region UUID
- /// Heightfield data
- double[,] LoadTerrain(UUID regionID);
-
- void StoreLandObject(ILandObject Parcel);
-
- ///
- ///
- /// - delete from land where UUID=globalID
- /// - delete from landaccesslist where LandUUID=globalID
- ///
- ///
- ///
- void RemoveLandObject(UUID globalID);
-
- List LoadLandObjects(UUID regionUUID);
-
- void StoreRegionSettings(RegionSettings rs);
- RegionSettings LoadRegionSettings(UUID regionUUID);
- RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
- void StoreRegionWindlightSettings(RegionLightShareData wl);
-
- void Shutdown();
- }
-}
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs
new file mode 100644
index 0000000..0a4d531
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs
@@ -0,0 +1,111 @@
+/*
+ * 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 OpenSimulator 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.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.Framework.Interfaces
+{
+ public interface ISimulationDataStore
+ {
+ ///
+ /// Initialises the data storage engine
+ ///
+ /// The file to save the database to (may not be applicable). Alternatively,
+ /// a connection string for the database
+ void Initialise(string filename);
+
+ ///
+ /// Dispose the database
+ ///
+ void Dispose();
+
+ ///
+ /// Stores all object's details apart from inventory
+ ///
+ ///
+ ///
+ void StoreObject(SceneObjectGroup obj, UUID regionUUID);
+
+ ///
+ /// Entirely removes the object, including inventory
+ ///
+ ///
+ ///
+ ///
+ void RemoveObject(UUID uuid, UUID regionUUID);
+
+ ///
+ /// Store a prim's inventory
+ ///
+ ///
+ void StorePrimInventory(UUID primID, ICollection items);
+
+ ///
+ /// Load persisted objects from region storage.
+ ///
+ /// the Region UUID
+ /// List of loaded groups
+ List LoadObjects(UUID regionUUID);
+
+ ///
+ /// Store a terrain revision in region storage
+ ///
+ /// HeightField data
+ /// region UUID
+ void StoreTerrain(double[,] terrain, UUID regionID);
+
+ ///
+ /// Load the latest terrain revision from region storage
+ ///
+ /// the region UUID
+ /// Heightfield data
+ double[,] LoadTerrain(UUID regionID);
+
+ void StoreLandObject(ILandObject Parcel);
+
+ ///
+ ///
+ /// - delete from land where UUID=globalID
+ /// - delete from landaccesslist where LandUUID=globalID
+ ///
+ ///
+ ///
+ void RemoveLandObject(UUID globalID);
+
+ List LoadLandObjects(UUID regionUUID);
+
+ void StoreRegionSettings(RegionSettings rs);
+ RegionSettings LoadRegionSettings(UUID regionUUID);
+ RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
+ void StoreRegionWindlightSettings(RegionLightShareData wl);
+
+ void Shutdown();
+ }
+}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index c434e4f..6b2e03e 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Scenes
public event OnTerrainTickDelegate OnTerrainTick;
- public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup);
+ public delegate void OnBackupDelegate(ISimulationDataStore datastore, bool forceBackup);
public event OnBackupDelegate OnBackup;
@@ -684,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void TriggerOnBackup(IRegionDataStore dstore, bool forced)
+ public void TriggerOnBackup(ISimulationDataStore dstore, bool forced)
{
OnBackupDelegate handlerOnAttach = OnBackup;
if (handlerOnAttach != null)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index ba5e33c..4024328 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Processes backup.
///
///
- public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup)
+ public virtual void ProcessBackup(ISimulationDataStore datastore, bool forcedBackup)
{
if (!m_isBackedUp)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 87c4860..1984d45 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Process inventory backup
///
///
- public void ProcessInventoryBackup(IRegionDataStore datastore)
+ public void ProcessInventoryBackup(ISimulationDataStore datastore)
{
if (HasInventoryChanged)
{
diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs
index 9375b4a..06caa18 100644
--- a/OpenSim/Region/Framework/StorageManager.cs
+++ b/OpenSim/Region/Framework/StorageManager.cs
@@ -36,9 +36,9 @@ namespace OpenSim.Region.Framework
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- protected IRegionDataStore m_dataStore;
+ protected ISimulationDataStore m_dataStore;
- public IRegionDataStore DataStore
+ public ISimulationDataStore DataStore
{
get { return m_dataStore; }
}
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework
get { return m_estateDataStore; }
}
- public StorageManager(IRegionDataStore storage)
+ public StorageManager(ISimulationDataStore storage)
{
m_dataStore = storage;
}
@@ -68,8 +68,8 @@ namespace OpenSim.Region.Framework
if (typeInterface != null)
{
- IRegionDataStore plug =
- (IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ ISimulationDataStore plug =
+ (ISimulationDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(connectionstring);
m_dataStore = plug;
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
index 2a055cc..e95d26a 100644
--- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Data.Null
/// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that
/// tests can check correct persistence.
///
- public class NullDataStore : IRegionDataStore
+ public class NullDataStore : ISimulationDataStore
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
--
cgit v1.1
From e2544584ad57a30def4f6b13eeaafe90eb81fe9e Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sat, 11 Sep 2010 22:02:34 -0700
Subject: Changed all string references of "IRegionDataStore" to
"ISimulationDataStore"
---
OpenSim/Data/Null/NullSimulationData.cs | 1 -
OpenSim/Data/SQLite/SQLiteSimulationData.cs | 2 --
OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs | 2 --
OpenSim/Region/Framework/StorageManager.cs | 4 ++--
OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 1 -
5 files changed, 2 insertions(+), 8 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs
index 9c7da8e..34d3a4e 100644
--- a/OpenSim/Data/Null/NullSimulationData.cs
+++ b/OpenSim/Data/Null/NullSimulationData.cs
@@ -73,7 +73,6 @@ namespace OpenSim.Data.Null
{
}
- // see IRegionDatastore
public void StorePrimInventory(UUID primID, ICollection items)
{
}
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 55c27b2..1820f78 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -79,7 +79,6 @@ namespace OpenSim.Data.SQLite
**********************************************************************/
///
- /// See IRegionDataStore
///
/// - Initialises RegionData Interface
/// - Loads and initialises a new SQLite connection and maintains it.
@@ -1951,7 +1950,6 @@ namespace OpenSim.Data.SQLite
}
///
- /// see IRegionDatastore
///
///
///
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
index 878117e..e9c6aa5 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
@@ -78,7 +78,6 @@ namespace OpenSim.Data.SQLiteLegacy
**********************************************************************/
///
- /// See IRegionDataStore
///
/// - Initialises RegionData Interface
/// - Loads and initialises a new SQLite connection and maintains it.
@@ -1888,7 +1887,6 @@ namespace OpenSim.Data.SQLiteLegacy
}
///
- /// see IRegionDatastore
///
///
///
diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs
index 06caa18..47db2b3 100644
--- a/OpenSim/Region/Framework/StorageManager.cs
+++ b/OpenSim/Region/Framework/StorageManager.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework
{
if (pluginType.IsPublic)
{
- Type typeInterface = pluginType.GetInterface("IRegionDataStore", true);
+ Type typeInterface = pluginType.GetInterface("ISimulationDataStore", true);
if (typeInterface != null)
{
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Framework
m_dataStore = plug;
- m_log.Info("[DATASTORE]: Added IRegionDataStore Interface");
+ m_log.Info("[DATASTORE]: Added ISimulationDataStore Interface");
}
typeInterface = pluginType.GetInterface("IEstateDataStore", true);
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
index e95d26a..315d405 100644
--- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -114,7 +114,6 @@ namespace OpenSim.Data.Null
}
}
- // see IRegionDatastore
public void StorePrimInventory(UUID primID, ICollection items)
{
m_primItems[primID] = items;
--
cgit v1.1
From 007912d6f4810192853c4aeee5f9834de748f2b2 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sat, 11 Sep 2010 23:41:48 -0700
Subject: Shuffling fields and properties around in Scene to make Scene.cs more
readable
---
OpenSim/Region/Framework/Scenes/Scene.cs | 262 +++++++++++++++----------------
1 file changed, 124 insertions(+), 138 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 6fa78e0..46b84bb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes
public partial class Scene : SceneBase
{
- public delegate void SynchronizeSceneHandler(Scene scene);
- public SynchronizeSceneHandler SynchronizeScene = null;
-
- /* Used by the loadbalancer plugin on GForge */
- protected int m_splitRegionID = 0;
- public int SplitRegionID
- {
- get { return m_splitRegionID; }
- set { m_splitRegionID = value; }
- }
-
private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L;
private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
- #region Fields
+ public delegate void SynchronizeSceneHandler(Scene scene);
- protected Timer m_restartWaitTimer = new Timer();
+ #region Fields
+ public SynchronizeSceneHandler SynchronizeScene;
public SimStatsReporter StatsReporter;
-
- protected List m_regionRestartNotifyList = new List();
- protected List m_neighbours = new List();
-
- private volatile int m_bordersLocked = 0;
- public bool BordersLocked
- {
- get { return m_bordersLocked == 1; }
- set
- {
- if (value == true)
- m_bordersLocked = 1;
- else
- m_bordersLocked = 0;
- }
- }
public List NorthBorders = new List();
public List EastBorders = new List();
public List SouthBorders = new List();
public List WestBorders = new List();
- ///
- /// The scene graph for this scene
- ///
- /// TODO: Possibly stop other classes being able to manipulate this directly.
- private SceneGraph m_sceneGraph;
-
- ///
- /// Are we applying physics to any of the prims in this scene?
- ///
+ /// Are we applying physics to any of the prims in this scene?
public bool m_physicalPrim;
public float m_maxNonphys = 256;
public float m_maxPhys = 10;
@@ -119,24 +85,127 @@ namespace OpenSim.Region.Framework.Scenes
// root agents when ACL denies access to root agent
public bool m_strictAccessControl = true;
public int MaxUndoCount = 5;
+ public bool LoginsDisabled = true;
+ public bool LoadingPrims;
+ public IXfer XferManager;
+
+ // the minimum time that must elapse before a changed object will be considered for persisted
+ public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
+ // the maximum time that must elapse before a changed object will be considered for persisted
+ public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
+
+ protected int m_splitRegionID;
+ protected Timer m_restartWaitTimer = new Timer();
+ protected List m_regionRestartNotifyList = new List();
+ protected List m_neighbours = new List();
+ protected string m_simulatorVersion = "OpenSimulator Server";
+ protected ModuleLoader m_moduleLoader;
+ protected StorageManager m_storageManager;
+ protected AgentCircuitManager m_authenticateHandler;
+ protected SceneCommunicationService m_sceneGridService;
+
+ protected IAssetService m_AssetService;
+ protected IAuthorizationService m_AuthorizationService;
+ protected IInventoryService m_InventoryService;
+ protected IGridService m_GridService;
+ protected ILibraryService m_LibraryService;
+ protected ISimulationService m_simulationService;
+ protected IAuthenticationService m_AuthenticationService;
+ protected IPresenceService m_PresenceService;
+ protected IUserAccountService m_UserAccountService;
+ protected IAvatarService m_AvatarService;
+ protected IGridUserService m_GridUserService;
+
+ protected IXMLRPC m_xmlrpcModule;
+ protected IWorldComm m_worldCommModule;
+ protected IAvatarFactory m_AvatarFactory;
+ protected IConfigSource m_config;
+ protected IRegionSerialiserModule m_serialiser;
+ protected IDialogModule m_dialogModule;
+ protected IEntityTransferModule m_teleportModule;
+ protected ICapabilitiesModule m_capsModule;
+ // Central Update Loop
+ protected int m_fps = 10;
+ protected uint m_frame;
+ protected float m_timespan = 0.089f;
+ protected DateTime m_lastupdate = DateTime.UtcNow;
+
+ // TODO: Possibly stop other classes being able to manipulate this directly.
+ private SceneGraph m_sceneGraph;
+ private volatile int m_bordersLocked;
private int m_RestartTimerCounter;
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private int m_incrementsof15seconds;
private volatile bool m_backingup;
-
private Dictionary m_returns = new Dictionary();
private Dictionary m_groupsWithTargets = new Dictionary();
+ private Object m_heartbeatLock = new Object();
- protected string m_simulatorVersion = "OpenSimulator Server";
+ private int m_update_physics = 1;
+ private int m_update_entitymovement = 1;
+ private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
+ private int m_update_presences = 1; // Update scene presence movements
+ private int m_update_events = 1;
+ private int m_update_backup = 200;
+ private int m_update_terrain = 50;
+ private int m_update_land = 1;
+ private int m_update_coarse_locations = 50;
- protected ModuleLoader m_moduleLoader;
- protected StorageManager m_storageManager;
- protected AgentCircuitManager m_authenticateHandler;
+ private int frameMS;
+ private int physicsMS2;
+ private int physicsMS;
+ private int otherMS;
+ private int tempOnRezMS;
+ private int eventMS;
+ private int backupMS;
+ private int terrainMS;
+ private int landMS;
+ private int lastCompletedFrame;
- protected SceneCommunicationService m_sceneGridService;
- public bool LoginsDisabled = true;
- public bool LoadingPrims = false;
+ private bool m_physics_enabled = true;
+ private bool m_scripts_enabled = true;
+ private string m_defaultScriptEngine;
+ private int m_LastLogin;
+ private Thread HeartbeatThread;
+ private volatile bool shuttingdown;
+
+ private int m_lastUpdate;
+ private bool m_firstHeartbeat = true;
+ private object m_deleting_scene_object = new object();
+
+ private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
+ private bool m_reprioritizationEnabled = true;
+ private double m_reprioritizationInterval = 5000.0;
+ private double m_rootReprioritizationDistance = 10.0;
+ private double m_childReprioritizationDistance = 20.0;
+
+ private Timer m_mapGenerationTimer = new Timer();
+ private bool m_generateMaptiles;
+
+ #endregion Fields
+
+ #region Properties
+
+ /* Used by the loadbalancer plugin on GForge */
+ public int SplitRegionID
+ {
+ get { return m_splitRegionID; }
+ set { m_splitRegionID = value; }
+ }
+
+ public bool BordersLocked
+ {
+ get { return m_bordersLocked == 1; }
+ set
+ {
+ if (value == true)
+ m_bordersLocked = 1;
+ else
+ m_bordersLocked = 0;
+ }
+ }
+
public new float TimeDilation
{
get { return m_sceneGraph.PhysicsScene.TimeDilation; }
@@ -147,13 +216,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGridService; }
}
- public IXfer XferManager;
-
- protected IAssetService m_AssetService;
- protected IAuthorizationService m_AuthorizationService;
-
- private Object m_heartbeatLock = new Object();
-
public IAssetService AssetService
{
get
@@ -191,8 +253,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected IInventoryService m_InventoryService;
-
public IInventoryService InventoryService
{
get
@@ -211,8 +271,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected IGridService m_GridService;
-
public IGridService GridService
{
get
@@ -231,8 +289,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected ILibraryService m_LibraryService;
-
public ILibraryService LibraryService
{
get
@@ -244,7 +300,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected ISimulationService m_simulationService;
public ISimulationService SimulationService
{
get
@@ -255,7 +310,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected IAuthenticationService m_AuthenticationService;
public IAuthenticationService AuthenticationService
{
get
@@ -266,7 +320,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected IPresenceService m_PresenceService;
public IPresenceService PresenceService
{
get
@@ -276,7 +329,7 @@ namespace OpenSim.Region.Framework.Scenes
return m_PresenceService;
}
}
- protected IUserAccountService m_UserAccountService;
+
public IUserAccountService UserAccountService
{
get
@@ -287,8 +340,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService;
- public OpenSim.Services.Interfaces.IAvatarService AvatarService
+ public IAvatarService AvatarService
{
get
{
@@ -298,7 +350,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected IGridUserService m_GridUserService;
public IGridUserService GridUserService
{
get
@@ -309,58 +360,18 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected IXMLRPC m_xmlrpcModule;
- protected IWorldComm m_worldCommModule;
public IAttachmentsModule AttachmentsModule { get; set; }
- protected IAvatarFactory m_AvatarFactory;
+
public IAvatarFactory AvatarFactory
{
get { return m_AvatarFactory; }
}
- protected IConfigSource m_config;
- protected IRegionSerialiserModule m_serialiser;
- protected IDialogModule m_dialogModule;
- protected IEntityTransferModule m_teleportModule;
- protected ICapabilitiesModule m_capsModule;
public ICapabilitiesModule CapsModule
{
get { return m_capsModule; }
}
- protected override IConfigSource GetConfig()
- {
- return m_config;
- }
-
- // Central Update Loop
-
- protected int m_fps = 10;
- protected uint m_frame;
- protected float m_timespan = 0.089f;
- protected DateTime m_lastupdate = DateTime.UtcNow;
-
- private int m_update_physics = 1;
- private int m_update_entitymovement = 1;
- private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
- private int m_update_presences = 1; // Update scene presence movements
- private int m_update_events = 1;
- private int m_update_backup = 200;
- private int m_update_terrain = 50;
- private int m_update_land = 1;
- private int m_update_coarse_locations = 50;
-
- private int frameMS;
- private int physicsMS2;
- private int physicsMS;
- private int otherMS;
- private int tempOnRezMS;
- private int eventMS;
- private int backupMS;
- private int terrainMS;
- private int landMS;
- private int lastCompletedFrame;
-
public int MonitorFrameTime { get { return frameMS; } }
public int MonitorPhysicsUpdateTime { get { return physicsMS; } }
public int MonitorPhysicsSyncTime { get { return physicsMS2; } }
@@ -372,36 +383,6 @@ namespace OpenSim.Region.Framework.Scenes
public int MonitorLandTime { get { return landMS; } }
public int MonitorLastFrameTick { get { return lastCompletedFrame; } }
- private bool m_physics_enabled = true;
- private bool m_scripts_enabled = true;
- private string m_defaultScriptEngine;
- private int m_LastLogin;
- private Thread HeartbeatThread;
- private volatile bool shuttingdown;
-
- private int m_lastUpdate;
- private bool m_firstHeartbeat = true;
-
- private object m_deleting_scene_object = new object();
-
- // the minimum time that must elapse before a changed object will be considered for persisted
- public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
- // the maximum time that must elapse before a changed object will be considered for persisted
- public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
-
- private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
- private bool m_reprioritizationEnabled = true;
- private double m_reprioritizationInterval = 5000.0;
- private double m_rootReprioritizationDistance = 10.0;
- private double m_childReprioritizationDistance = 20.0;
-
- private Timer m_mapGenerationTimer = new Timer();
- bool m_generateMaptiles = false;
-
- #endregion
-
- #region Properties
-
public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } }
public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } }
public double ReprioritizationInterval { get { return m_reprioritizationInterval; } }
@@ -481,7 +462,7 @@ namespace OpenSim.Region.Framework.Scenes
set { m_sceneGraph.RestorePresences = value; }
}
- #endregion
+ #endregion Properties
#region Constructors
@@ -3954,6 +3935,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Other Methods
+ protected override IConfigSource GetConfig()
+ {
+ return m_config;
+ }
+
#endregion
public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
--
cgit v1.1
From 16d782eaa25e73e39b8aaa02383592ac4813a109 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sun, 12 Sep 2010 00:30:13 -0700
Subject: Added a stub for
OpenSim.Services.Connectors.Simulation.SimulationDataServiceConnector
---
.../Framework/Interfaces/ISimulationDataService.cs | 98 ++++++++++++++++
OpenSim/Region/Framework/StorageManager.cs | 24 +---
.../Simulation/SimulationDataServiceConnector.cs | 125 +++++++++++++++++++++
3 files changed, 227 insertions(+), 20 deletions(-)
create mode 100644 OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
create mode 100644 OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
new file mode 100644
index 0000000..edaa07c
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
@@ -0,0 +1,98 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.Framework.Interfaces
+{
+ public interface ISimulationDataService
+ {
+ ///
+ /// Stores all object's details apart from inventory
+ ///
+ ///
+ ///
+ void StoreObject(SceneObjectGroup obj, UUID regionUUID);
+
+ ///
+ /// Entirely removes the object, including inventory
+ ///
+ ///
+ ///
+ ///
+ void RemoveObject(UUID uuid, UUID regionUUID);
+
+ ///
+ /// Store a prim's inventory
+ ///
+ ///
+ void StorePrimInventory(UUID primID, ICollection items);
+
+ ///
+ /// Load persisted objects from region storage.
+ ///
+ /// the Region UUID
+ /// List of loaded groups
+ List LoadObjects(UUID regionUUID);
+
+ ///
+ /// Store a terrain revision in region storage
+ ///
+ /// HeightField data
+ /// region UUID
+ void StoreTerrain(double[,] terrain, UUID regionID);
+
+ ///
+ /// Load the latest terrain revision from region storage
+ ///
+ /// the region UUID
+ /// Heightfield data
+ double[,] LoadTerrain(UUID regionID);
+
+ void StoreLandObject(ILandObject Parcel);
+
+ ///
+ ///
+ /// - delete from land where UUID=globalID
+ /// - delete from landaccesslist where LandUUID=globalID
+ ///
+ ///
+ ///
+ void RemoveLandObject(UUID globalID);
+
+ List LoadLandObjects(UUID regionUUID);
+
+ void StoreRegionSettings(RegionSettings rs);
+ RegionSettings LoadRegionSettings(UUID regionUUID);
+ RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
+ void StoreRegionWindlightSettings(RegionLightShareData wl);
+ }
+}
diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs
index 47db2b3..c858d56 100644
--- a/OpenSim/Region/Framework/StorageManager.cs
+++ b/OpenSim/Region/Framework/StorageManager.cs
@@ -36,24 +36,8 @@ namespace OpenSim.Region.Framework
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- protected ISimulationDataStore m_dataStore;
-
- public ISimulationDataStore DataStore
- {
- get { return m_dataStore; }
- }
-
- private IEstateDataStore m_estateDataStore;
-
- public IEstateDataStore EstateDataStore
- {
- get { return m_estateDataStore; }
- }
-
- public StorageManager(ISimulationDataStore storage)
- {
- m_dataStore = storage;
- }
+ public readonly ISimulationDataStore DataStore;
+ public readonly IEstateDataStore EstateDataStore;
public StorageManager(string dllName, string connectionstring, string estateconnectionstring)
{
@@ -72,7 +56,7 @@ namespace OpenSim.Region.Framework
(ISimulationDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(connectionstring);
- m_dataStore = plug;
+ DataStore = plug;
m_log.Info("[DATASTORE]: Added ISimulationDataStore Interface");
}
@@ -85,7 +69,7 @@ namespace OpenSim.Region.Framework
(IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
estPlug.Initialise(estateconnectionstring);
- m_estateDataStore = estPlug;
+ EstateDataStore = estPlug;
}
}
}
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs
new file mode 100644
index 0000000..93147d4
--- /dev/null
+++ b/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs
@@ -0,0 +1,125 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using System.Reflection;
+using log4net;
+using Nini.Config;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Server.Base;
+
+namespace OpenSim.Services.Connectors.Simulation
+{
+ public class SimulationDataServiceConnector : ISimulationDataService
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private ISimulationDataStore m_simDataStore;
+
+ public SimulationDataServiceConnector()
+ {
+ }
+
+ public SimulationDataServiceConnector(IConfigSource config)
+ {
+ Initialise(config);
+ }
+
+ public virtual void Initialise(IConfigSource config)
+ {
+ IConfig serverConfig = config.Configs["SimulationDataStore"];
+ if (serverConfig == null)
+ throw new Exception("No section 'SimulationDataStore' in config file");
+
+ string simDataStore = serverConfig.GetString("StoreModule", String.Empty);
+
+ Object[] args = new Object[] { config };
+ m_simDataStore = ServerUtils.LoadPlugin(simDataStore, args);
+ }
+
+ public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
+ {
+ }
+
+ public void RemoveObject(UUID uuid, UUID regionUUID)
+ {
+ }
+
+ public void StorePrimInventory(UUID primID, ICollection items)
+ {
+ }
+
+ public List LoadObjects(UUID regionUUID)
+ {
+ return new List(0);
+ }
+
+ public void StoreTerrain(double[,] terrain, UUID regionID)
+ {
+ }
+
+ public double[,] LoadTerrain(UUID regionID)
+ {
+ return new double[Constants.RegionSize, Constants.RegionSize];
+ }
+
+ public void StoreLandObject(ILandObject Parcel)
+ {
+ }
+
+ public void RemoveLandObject(UUID globalID)
+ {
+ }
+
+ public List LoadLandObjects(UUID regionUUID)
+ {
+ return new List(0);
+ }
+
+ public void StoreRegionSettings(RegionSettings rs)
+ {
+ }
+
+ public RegionSettings LoadRegionSettings(UUID regionUUID)
+ {
+ return null;
+ }
+
+ public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
+ {
+ return null;
+ }
+
+ public void StoreRegionWindlightSettings(RegionLightShareData wl)
+ {
+ }
+ }
+}
--
cgit v1.1
From 20cd1da6bf6118352af1f1f206bcd2303f098d6d Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Sun, 12 Sep 2010 12:54:31 -0400
Subject: Add copyright headers.
---
OpenSim/Data/DBGuids.cs | 29 +++++++++++++++++++++++++-
OpenSim/Data/Null/NullInventoryData.cs | 29 +++++++++++++++++++++++++-
OpenSim/Data/Tests/BasicDataServiceTest.cs | 29 +++++++++++++++++++++++++-
OpenSim/Data/Tests/DefaultTestConns.cs | 29 +++++++++++++++++++++++++-
OpenSim/Framework/Console/MockConsole.cs | 29 +++++++++++++++++++++++++-
OpenSim/Framework/Lazy.cs | 2 +-
OpenSim/Region/Framework/Scenes/Prioritizer.cs | 27 ++++++++++++++++++++++++
7 files changed, 168 insertions(+), 6 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs
index fb6832b..c40e8bb 100644
--- a/OpenSim/Data/DBGuids.cs
+++ b/OpenSim/Data/DBGuids.cs
@@ -1,4 +1,31 @@
-using System;
+/*
+ * 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 OpenSimulator 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;
using System.Collections.Generic;
using System.Text;
using OpenMetaverse;
diff --git a/OpenSim/Data/Null/NullInventoryData.cs b/OpenSim/Data/Null/NullInventoryData.cs
index 8f196e2..fe9ed01 100644
--- a/OpenSim/Data/Null/NullInventoryData.cs
+++ b/OpenSim/Data/Null/NullInventoryData.cs
@@ -1,4 +1,31 @@
-using System;
+/*
+ * 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 OpenSimulator 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;
using System.Collections.Generic;
using OpenMetaverse;
diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs
index c261126..272a2ca 100644
--- a/OpenSim/Data/Tests/BasicDataServiceTest.cs
+++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs
@@ -1,4 +1,31 @@
-using System;
+/*
+ * 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 OpenSimulator 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;
using System.IO;
using System.Collections.Generic;
using log4net.Config;
diff --git a/OpenSim/Data/Tests/DefaultTestConns.cs b/OpenSim/Data/Tests/DefaultTestConns.cs
index 7b52af5..7c47bdd 100644
--- a/OpenSim/Data/Tests/DefaultTestConns.cs
+++ b/OpenSim/Data/Tests/DefaultTestConns.cs
@@ -1,4 +1,31 @@
-using System;
+/*
+ * 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 OpenSimulator 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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs
index 9eb1977..a29b370 100644
--- a/OpenSim/Framework/Console/MockConsole.cs
+++ b/OpenSim/Framework/Console/MockConsole.cs
@@ -1,4 +1,31 @@
-using System;
+/*
+ * 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 OpenSimulator 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;
using System.Threading;
using System.Collections.Generic;
using System.Text;
diff --git a/OpenSim/Framework/Lazy.cs b/OpenSim/Framework/Lazy.cs
index 8a417ac..91de4bd 100644
--- a/OpenSim/Framework/Lazy.cs
+++ b/OpenSim/Framework/Lazy.cs
@@ -1,4 +1,4 @@
-//
+//
// Lazy.cs
//
// Authors:
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 272f718..581b11c 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -1,3 +1,30 @@
+/*
+ * 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 OpenSimulator 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;
using System.Collections.Generic;
using log4net;
--
cgit v1.1
From f1f0bc23f4501ba99035283d3407ddad2b21b785 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Sun, 12 Sep 2010 13:43:49 -0400
Subject: Formatting cleanup.
---
.../Rest/Inventory/RestAppearanceServices.cs | 4 +-
OpenSim/Data/DBGuids.cs | 2 +-
OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 6 +-
OpenSim/Data/Migration.cs | 14 +-
OpenSim/Data/MySQL/MySQLInventoryData.cs | 2 +-
OpenSim/Data/MySQL/MySQLSimulationData.cs | 22 +-
OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 6 +-
OpenSim/Data/SQLite/SQLiteSimulationData.cs | 57 +++--
OpenSim/Data/Tests/BasicDataServiceTest.cs | 10 +-
OpenSim/Framework/Capabilities/Caps.cs | 2 +-
OpenSim/Framework/Console/CommandConsole.cs | 2 +-
OpenSim/Framework/Console/LocalConsole.cs | 18 +-
OpenSim/Framework/LandData.cs | 28 +--
OpenSim/Framework/LandUpdateArgs.cs | 14 +-
OpenSim/Framework/PrimitiveBaseShape.cs | 74 +++---
OpenSim/Framework/RegionInfo.cs | 28 +--
.../Framework/Serialization/ArchiveConstants.cs | 20 +-
.../Framework/Servers/HttpServer/BaseHttpServer.cs | 121 +++++-----
OpenSim/Region/Application/Application.cs | 2 +-
OpenSim/Region/Application/OpenSim.cs | 16 +-
.../Region/ClientStack/LindenUDP/LLClientView.cs | 261 ++++++++++-----------
.../Avatar/Attachments/AttachmentsModule.cs | 24 +-
.../CoreModules/Avatar/Combat/CombatModule.cs | 4 +-
.../Region/CoreModules/Avatar/Gods/GodsModule.cs | 6 +-
.../Avatar/InstantMessage/MessageTransferModule.cs | 2 +-
.../Archiver/InventoryArchiveReadRequest.cs | 18 +-
.../Archiver/InventoryArchiveWriteRequest.cs | 10 +-
.../Archiver/InventoryArchiverException.cs | 2 +-
.../Inventory/Archiver/InventoryArchiverModule.cs | 28 +--
.../Archiver/Tests/InventoryArchiverTests.cs | 54 ++---
.../Framework/EventQueue/EventQueueGetModule.cs | 4 +-
.../Framework/EventQueue/EventQueueHelper.cs | 18 +-
.../InventoryAccess/InventoryAccessModule.cs | 2 +-
.../Statistics/Logging/BinaryLoggingModule.cs | 12 +-
.../Inventory/InventoryCache.cs | 2 +-
.../Inventory/LocalInventoryServiceConnector.cs | 2 +-
.../Inventory/RemoteXInventoryServiceConnector.cs | 2 +-
.../CoreModules/World/Archiver/ArchiveHelpers.cs | 8 +-
.../CoreModules/World/Land/LandManagementModule.cs | 115 +++++----
.../Region/CoreModules/World/Land/LandObject.cs | 14 +-
.../CoreModules/World/Media/Moap/MoapModule.cs | 98 ++++----
.../World/Objects/BuySell/BuySellModule.cs | 14 +-
.../World/Permissions/PermissionsModule.cs | 22 +-
.../CoreModules/World/Terrain/TerrainModule.cs | 2 +-
.../Region/CoreModules/World/Wind/WindModule.cs | 2 +-
.../CoreModules/World/WorldMap/MapImageModule.cs | 2 +-
.../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +-
.../Framework/Interfaces/IAttachmentsModule.cs | 2 +-
.../Region/Framework/Interfaces/IGroupsModule.cs | 6 +-
.../Interfaces/IInventoryArchiverModule.cs | 16 +-
OpenSim/Region/Framework/Interfaces/IMoapModule.cs | 2 +-
.../Region/Framework/Interfaces/IWorldMapModule.cs | 2 +-
OpenSim/Region/Framework/Scenes/EventManager.cs | 12 +-
OpenSim/Region/Framework/Scenes/Prioritizer.cs | 10 +-
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 +-
.../Framework/Scenes/Scene.PacketHandlers.cs | 2 +-
.../Region/Framework/Scenes/Scene.Permissions.cs | 2 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 18 +-
OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +-
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 +-
.../Region/Framework/Scenes/SceneObjectGroup.cs | 18 +-
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 +-
.../Framework/Scenes/SceneObjectPartInventory.cs | 2 +-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
OpenSim/Region/Framework/Scenes/SceneViewer.cs | 4 +-
.../Framework/Scenes/Tests/SceneGraphTests.cs | 4 +-
.../Scenes/Tests/SceneObjectLinkingTests.cs | 18 +-
.../Framework/Scenes/Tests/TaskInventoryTests.cs | 14 +-
.../Avatar/XmlRpcGroups/GroupsModule.cs | 2 +-
.../SimianGroupsServicesConnectorModule.cs | 39 ++-
.../XmlRpcGroupsServicesConnectorModule.cs | 4 +-
.../ContentManagementSystem/MetaEntity.cs | 2 +-
.../Scripting/Minimodule/SOPObject.cs | 4 +-
.../World/MoneyModule/SampleMoneyModule.cs | 2 +-
.../RegionCombinerIndividualEventForwarder.cs | 4 +-
.../RegionCombinerLargeLandChannel.cs | 6 +-
.../Shared/Api/Implementation/LSL_Api.cs | 8 +-
.../Shared/Api/Implementation/OSSL_Api.cs | 6 +-
.../Api/Implementation/Plugins/SensorRepeat.cs | 4 +-
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 2 +-
OpenSim/Server/Base/ServerUtils.cs | 2 +-
.../Hypergrid/GatekeeperServiceConnector.cs | 2 +-
.../Connectors/Inventory/XInventoryConnector.cs | 2 +-
.../Services/InventoryService/InventoryService.cs | 4 +-
OpenSim/Services/LLLoginService/LLLoginService.cs | 2 +-
.../UserAccountService/UserAccountService.cs | 20 +-
OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 6 +-
OpenSim/Tests/Common/Mock/TestScene.cs | 2 +-
OpenSim/Tests/Common/Setup/AssetHelpers.cs | 4 +-
OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 37 ++-
.../Tests/Common/Setup/UserInventoryTestUtils.cs | 4 +-
OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 8 +-
92 files changed, 756 insertions(+), 774 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
index 4369216..8271d76 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
@@ -384,7 +384,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// }
//
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
-//
+//
// }
///
@@ -449,7 +449,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// rdata.userAppearance = new AvatarAppearance();
// rdata.userAppearance.Owner = old.Owner;
// adata = new AvatarData(rdata.userAppearance);
-//
+//
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
//
// rdata.Complete();
diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs
index c40e8bb..ad1c19c 100644
--- a/OpenSim/Data/DBGuids.cs
+++ b/OpenSim/Data/DBGuids.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Data
///
public static UUID FromDB(object id)
{
- if( (id == null) || (id == DBNull.Value))
+ if ((id == null) || (id == DBNull.Value))
return UUID.Zero;
if (id.GetType() == typeof(Guid))
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index ae105d5..e4bfc28 100644
--- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -1126,7 +1126,7 @@ VALUES
prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]);
if (!(primRow["MediaURL"] is System.DBNull))
- prim.MediaUrl = (string)primRow["MediaURL"];
+ prim.MediaUrl = (string)primRow["MediaURL"];
return prim;
}
@@ -1180,7 +1180,7 @@ VALUES
{
}
- if (!(shapeRow["Media"] is System.DBNull))
+ if (!(shapeRow["Media"] is System.DBNull))
baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
return baseShape;
@@ -1511,7 +1511,7 @@ VALUES
parameters.Add(_Database.CreateParameter("PassTouches", 1));
else
parameters.Add(_Database.CreateParameter("PassTouches", 0));
- parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
+ parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
return parameters.ToArray();
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs
index 86531d9..fc9a142 100644
--- a/OpenSim/Data/Migration.cs
+++ b/OpenSim/Data/Migration.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Data
int ver = FindVersion(_conn, "migrations");
if (ver <= 0) // -1 = no table, 0 = no version record
{
- if( ver < 0 )
+ if (ver < 0)
ExecuteScript("create table migrations(name varchar(100), version int)");
InsertVersion("migrations", 1);
}
@@ -288,7 +288,7 @@ namespace OpenSim.Data
SortedList migrations = new SortedList();
string[] names = _assem.GetManifestResourceNames();
- if( names.Length == 0 ) // should never happen
+ if (names.Length == 0) // should never happen
return migrations;
Array.Sort(names); // we want all the migrations ordered
@@ -297,7 +297,7 @@ namespace OpenSim.Data
Match m = null;
string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase
- if( (m != null) && !String.IsNullOrEmpty(sFile) )
+ if ((m != null) && !String.IsNullOrEmpty(sFile))
{
/* The filename should be '.migrations[.NNN]' where NNN
* is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip
@@ -312,7 +312,7 @@ namespace OpenSim.Data
if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound))
{
- if( nLastVerFound <= after )
+ if (nLastVerFound <= after)
goto scan_old_style;
}
@@ -329,7 +329,7 @@ namespace OpenSim.Data
sb.Length = 0;
}
- if ( (nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list
+ if ((nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list
{
migrations[nVersion] = script.ToArray();
}
@@ -345,7 +345,7 @@ namespace OpenSim.Data
string sLine = resourceReader.ReadLine();
nLineNo++;
- if( String.IsNullOrEmpty(sLine) || sLine.StartsWith("#") ) // ignore a comment or empty line
+ if (String.IsNullOrEmpty(sLine) || sLine.StartsWith("#")) // ignore a comment or empty line
continue;
if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase))
@@ -392,7 +392,7 @@ scan_old_style:
if (m.Success)
{
int version = int.Parse(m.Groups[1].ToString());
- if ( (version > after) && !migrations.ContainsKey(version) )
+ if ((version > after) && !migrations.ContainsKey(version))
{
using (Stream resource = _assem.GetManifestResourceStream(s))
{
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 0aea30f..2dca3eb 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Data.MySQL
InventoryItemBase item = new InventoryItemBase();
// TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these.
- // ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero )
+ // (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero)
item.CreatorId = reader["creatorID"].ToString();
// Be a bit safer in parsing these because the
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 36f73ef..8201cef 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -680,7 +680,7 @@ namespace OpenSim.Data.MySQL
"UserLocationX, UserLocationY, UserLocationZ, " +
"UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
- "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
+ "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
"?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " +
"?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@@ -691,7 +691,7 @@ namespace OpenSim.Data.MySQL
"?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
"?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
- "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
+ "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@@ -728,7 +728,7 @@ namespace OpenSim.Data.MySQL
string command = "select * from `regionwindlight` where region_id = ?regionID";
- using(MySqlCommand cmd = new MySqlCommand(command))
+ using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Connection = dbcon;
@@ -1350,13 +1350,13 @@ namespace OpenSim.Data.MySQL
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
}
- newData.MediaDescription = (string) row["MediaDescription"];
- newData.MediaType = (string) row["MediaType"];
- newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
- newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
- newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
- newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
- newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
+ newData.MediaDescription = (string) row["MediaDescription"];
+ newData.MediaType = (string) row["MediaType"];
+ newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
+ newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
+ newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
+ newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
+ newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
newData.ParcelAccessList = new List();
@@ -1724,7 +1724,7 @@ namespace OpenSim.Data.MySQL
s.State = (byte)(int)row["State"];
- if (!(row["Media"] is System.DBNull))
+ if (!(row["Media"] is System.DBNull))
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
return s;
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index ece2495..ecf8e02 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -731,12 +731,12 @@ namespace OpenSim.Data.SQLite
**********************************************************************/
protected void CreateDataSetMapping(IDataAdapter da, string tableName)
- {
+ {
ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
foreach (DataColumn col in ds.Tables[tableName].Columns)
- {
+ {
dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
- }
+ }
}
///
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 1820f78..7460961 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -176,7 +176,7 @@ namespace OpenSim.Data.SQLite
{
m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
}
-
+
try
{
terrainDa.Fill(ds.Tables["terrain"]);
@@ -510,7 +510,7 @@ namespace OpenSim.Data.SQLite
"[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default;
}
-
+
createdObjects[new UUID(objID)].AddPart(prim);
LoadItems(prim);
}
@@ -534,17 +534,17 @@ namespace OpenSim.Data.SQLite
///
/// the prim
private void LoadItems(SceneObjectPart prim)
- {
-// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
-
+ {
+// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
+
DataTable dbItems = ds.Tables["primitems"];
- String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
+ String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
DataRow[] dbItemRows = dbItems.Select(sql);
IList inventory = new List();
-// m_log.DebugFormat(
-// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
-
+// m_log.DebugFormat(
+// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
+
foreach (DataRow row in dbItemRows)
{
TaskInventoryItem item = buildItem(row);
@@ -693,8 +693,6 @@ namespace OpenSim.Data.SQLite
{
landaccesslist.Rows.Remove(rowsToDelete[iter]);
}
-
-
}
Commit();
}
@@ -804,7 +802,7 @@ namespace OpenSim.Data.SQLite
try
{
regionSettingsDa.Update(ds, "regionsettings");
- }
+ }
catch (SqliteException SqlEx)
{
throw new Exception(
@@ -974,7 +972,7 @@ namespace OpenSim.Data.SQLite
createCol(prims, "CollisionSoundVolume", typeof(Double));
createCol(prims, "VolumeDetect", typeof(Int16));
-
+
createCol(prims, "MediaURL", typeof(String));
// Add in contraints
@@ -1191,10 +1189,10 @@ namespace OpenSim.Data.SQLite
private SceneObjectPart buildPrim(DataRow row)
{
// Code commented. Uncomment to test the unit test inline.
-
- // The unit test mentions this commented code for the purposes
+
+ // The unit test mentions this commented code for the purposes
// of debugging a unit test failure
-
+
// SceneObjectGroup sog = new SceneObjectGroup();
// SceneObjectPart sop = new SceneObjectPart();
// sop.LocalId = 1;
@@ -1211,7 +1209,7 @@ namespace OpenSim.Data.SQLite
// TODO: this doesn't work yet because something more
// interesting has to be done to actually get these values
// back out. Not enough time to figure it out yet.
-
+
SceneObjectPart prim = new SceneObjectPart();
prim.UUID = new UUID((String) row["UUID"]);
// explicit conversion of integers is required, which sort
@@ -1341,7 +1339,7 @@ namespace OpenSim.Data.SQLite
if (Convert.ToInt16(row["VolumeDetect"]) != 0)
prim.VolumeDetectActive = true;
-
+
if (!(row["MediaURL"] is System.DBNull))
{
//m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
@@ -1680,7 +1678,7 @@ namespace OpenSim.Data.SQLite
row["VolumeDetect"] = 1;
else
row["VolumeDetect"] = 0;
-
+
row["MediaURL"] = prim.MediaUrl;
}
@@ -1758,12 +1756,12 @@ namespace OpenSim.Data.SQLite
row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime;
- row["MediaType"] = land.MediaType;
- row["MediaDescription"] = land.MediaDescription;
- row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
- row["MediaLoop"] = land.MediaLoop.ToString();
- row["ObscureMusic"] = land.ObscureMusic.ToString();
- row["ObscureMedia"] = land.ObscureMedia.ToString();
+ row["MediaType"] = land.MediaType;
+ row["MediaDescription"] = land.MediaDescription;
+ row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
+ row["MediaLoop"] = land.MediaLoop.ToString();
+ row["ObscureMusic"] = land.ObscureMusic.ToString();
+ row["ObscureMedia"] = land.ObscureMedia.ToString();
}
///
@@ -1861,10 +1859,10 @@ namespace OpenSim.Data.SQLite
s.TextureEntry = textureEntry;
s.ExtraParams = (byte[]) row["ExtraParams"];
-
+
if (!(row["Media"] is System.DBNull))
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
-
+
return s;
}
@@ -1908,7 +1906,7 @@ namespace OpenSim.Data.SQLite
row["Texture"] = s.TextureEntry;
row["ExtraParams"] = s.ExtraParams;
-
+
if (s.Media != null)
row["Media"] = s.Media.ToXml();
}
@@ -2246,7 +2244,6 @@ namespace OpenSim.Data.SQLite
delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
da.DeleteCommand = delete;
da.DeleteCommand.Connection = conn;
-
}
private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)
@@ -2318,7 +2315,7 @@ namespace OpenSim.Data.SQLite
return DbType.String;
}
}
-
+
static void PrintDataSet(DataSet ds)
{
// Print out any name and extended properties.
diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs
index 272a2ca..7d85f0c 100644
--- a/OpenSim/Data/Tests/BasicDataServiceTest.cs
+++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs
@@ -68,13 +68,13 @@ namespace OpenSim.Data.Tests
{
m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn));
- m_log = LogManager.GetLogger(this.GetType());
+ m_log = LogManager.GetLogger(this.GetType());
OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right?
}
///
/// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it.
- /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var.
+ /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var.
/// This framework takes care of disposing it, if it's disposable.
///
/// The service being tested
@@ -145,12 +145,12 @@ namespace OpenSim.Data.Tests
{
if (m_service != null)
{
- if( m_service is IDisposable)
+ if (m_service is IDisposable)
((IDisposable)m_service).Dispose();
m_service = null;
}
- if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) )
+ if (!String.IsNullOrEmpty(m_file) && File.Exists(m_file))
File.Delete(m_file);
}
@@ -231,7 +231,7 @@ namespace OpenSim.Data.Tests
lst += ", " + s;
}
- string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
+ string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
try
{
ExecuteSql("DELETE FROM migrations where name " + sCond);
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index 8a339fe..6f32adf 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -760,7 +760,7 @@ namespace OpenSim.Framework.Capabilities
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
BakedTextureUploader uploader =
- new BakedTextureUploader( capsBase + uploaderPath,
+ new BakedTextureUploader(capsBase + uploaderPath,
m_httpListener);
uploader.OnUpLoad += BakedTextureUploaded;
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index b17dbc0..52bcd55 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -151,7 +151,7 @@ namespace OpenSim.Framework.Console
help.Add(commandInfo.descriptive_help);
if (descriptiveHelp != string.Empty)
- help.Add(string.Empty);
+ help.Add(string.Empty);
}
else
{
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs
index c968031..6043094 100644
--- a/OpenSim/Framework/Console/LocalConsole.cs
+++ b/OpenSim/Framework/Console/LocalConsole.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console
{
///
/// A console that uses cursor control and color
- ///
+ ///
public class LocalConsole : CommandConsole
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -100,8 +100,8 @@ namespace OpenSim.Framework.Console
private int SetCursorTop(int top)
{
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
- // to set a cursor row position with a currently invalid column, mono will throw an exception.
- // Therefore, we need to make sure that the column position is valid first.
+ // to set a cursor row position with a currently invalid column, mono will throw an exception.
+ // Therefore, we need to make sure that the column position is valid first.
int left = System.Console.CursorLeft;
if (left < 0)
@@ -121,7 +121,7 @@ namespace OpenSim.Framework.Console
{
top = 0;
}
- else
+ else
{
int bh = System.Console.BufferHeight;
@@ -133,7 +133,7 @@ namespace OpenSim.Framework.Console
System.Console.CursorTop = top;
return top;
- }
+ }
///
/// Set the cursor column.
@@ -145,12 +145,12 @@ namespace OpenSim.Framework.Console
///
///
/// The new cursor column.
- ///
+ ///
private int SetCursorLeft(int left)
{
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
- // to set a cursor column position with a currently invalid row, mono will throw an exception.
- // Therefore, we need to make sure that the row position is valid first.
+ // to set a cursor column position with a currently invalid row, mono will throw an exception.
+ // Therefore, we need to make sure that the row position is valid first.
int top = System.Console.CursorTop;
if (top < 0)
@@ -214,7 +214,7 @@ namespace OpenSim.Framework.Console
System.Console.Write("{0}", prompt);
SetCursorTop(new_y);
- SetCursorLeft(new_x);
+ SetCursorLeft(new_x);
}
}
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 8d3266b..accf52e 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -89,13 +89,13 @@ namespace OpenSim.Framework
private Vector3 _userLocation = new Vector3();
private Vector3 _userLookAt = new Vector3();
private int _otherCleanTime = 0;
- private string _mediaType = "none/none";
- private string _mediaDescription = "";
- private int _mediaHeight = 0;
- private int _mediaWidth = 0;
- private bool _mediaLoop = false;
- private bool _obscureMusic = false;
- private bool _obscureMedia = false;
+ private string _mediaType = "none/none";
+ private string _mediaDescription = "";
+ private int _mediaHeight = 0;
+ private int _mediaWidth = 0;
+ private bool _mediaLoop = false;
+ private bool _obscureMusic = false;
+ private bool _obscureMedia = false;
///
/// Whether to obscure parcel media URL
@@ -690,13 +690,13 @@ namespace OpenSim.Framework
landData._userLocation = _userLocation;
landData._userLookAt = _userLookAt;
landData._otherCleanTime = _otherCleanTime;
- landData._mediaType = _mediaType;
- landData._mediaDescription = _mediaDescription;
- landData._mediaWidth = _mediaWidth;
- landData._mediaHeight = _mediaHeight;
- landData._mediaLoop = _mediaLoop;
- landData._obscureMusic = _obscureMusic;
- landData._obscureMedia = _obscureMedia;
+ landData._mediaType = _mediaType;
+ landData._mediaDescription = _mediaDescription;
+ landData._mediaWidth = _mediaWidth;
+ landData._mediaHeight = _mediaHeight;
+ landData._mediaLoop = _mediaLoop;
+ landData._obscureMusic = _obscureMusic;
+ landData._obscureMedia = _obscureMedia;
landData._parcelAccessList.Clear();
foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
diff --git a/OpenSim/Framework/LandUpdateArgs.cs b/OpenSim/Framework/LandUpdateArgs.cs
index ed496a1..7d6c4f2 100644
--- a/OpenSim/Framework/LandUpdateArgs.cs
+++ b/OpenSim/Framework/LandUpdateArgs.cs
@@ -49,12 +49,12 @@ namespace OpenSim.Framework
public UUID SnapshotID;
public Vector3 UserLocation;
public Vector3 UserLookAt;
- public string MediaType;
- public string MediaDescription;
- public int MediaHeight;
- public int MediaWidth;
- public bool MediaLoop;
- public bool ObscureMusic;
- public bool ObscureMedia;
+ public string MediaType;
+ public string MediaDescription;
+ public int MediaHeight;
+ public int MediaWidth;
+ public bool MediaLoop;
+ public bool ObscureMusic;
+ public bool ObscureMedia;
}
}
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 70a61cc..0a81363 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -175,7 +175,7 @@ namespace OpenSim.Framework
}
}
}
-
+
///
/// Entries to store media textures on each face
///
@@ -1216,28 +1216,28 @@ namespace OpenSim.Framework
prim.Properties.Permissions = new Permissions();
prim.Properties.SalePrice = 10;
prim.Properties.SaleType = new SaleType();
-
+
return prim;
}
-
+
///
/// Encapsulates a list of media entries.
///
- /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more
+ /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more
/// OSD like and less vulnerable to change.
public class MediaList : List, IXmlSerializable
- {
+ {
public const string MEDIA_TEXTURE_TYPE = "sl";
-
+
public MediaList() : base() {}
public MediaList(IEnumerable collection) : base(collection) {}
public MediaList(int capacity) : base(capacity) {}
-
+
public XmlSchema GetSchema()
{
return null;
}
-
+
public string ToXml()
{
lock (this)
@@ -1245,78 +1245,78 @@ namespace OpenSim.Framework
using (StringWriter sw = new StringWriter())
{
using (XmlTextWriter xtw = new XmlTextWriter(sw))
- {
+ {
xtw.WriteStartElement("OSMedia");
xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE);
xtw.WriteAttributeString("version", "0.1");
-
+
OSDArray meArray = new OSDArray();
foreach (MediaEntry me in this)
{
OSD osd = (null == me ? new OSD() : me.GetOSD());
meArray.Add(osd);
- }
-
+ }
+
xtw.WriteStartElement("OSData");
xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray));
xtw.WriteEndElement();
-
+
xtw.WriteEndElement();
-
- xtw.Flush();
+
+ xtw.Flush();
return sw.ToString();
}
- }
- }
+ }
+ }
}
-
+
public void WriteXml(XmlWriter writer)
- {
+ {
writer.WriteRaw(ToXml());
}
-
+
public static MediaList FromXml(string rawXml)
{
MediaList ml = new MediaList();
ml.ReadXml(rawXml);
return ml;
}
-
+
public void ReadXml(string rawXml)
- {
+ {
using (StringReader sr = new StringReader(rawXml))
{
using (XmlTextReader xtr = new XmlTextReader(sr))
- {
+ {
xtr.MoveToContent();
-
+
string type = xtr.GetAttribute("type");
//m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type);
-
+
if (type != MEDIA_TEXTURE_TYPE)
- return;
-
- xtr.ReadStartElement("OSMedia");
-
+ return;
+
+ xtr.ReadStartElement("OSMedia");
+
OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
foreach (OSD osdMe in osdMeArray)
{
MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry());
Add(me);
}
-
- xtr.ReadEndElement();
+
+ xtr.ReadEndElement();
}
}
- }
-
+ }
+
public void ReadXml(XmlReader reader)
{
if (reader.IsEmptyElement)
return;
-
+
ReadXml(reader.ReadInnerXml());
- }
+ }
}
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 12c58c3..08d5398 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -97,9 +97,9 @@ namespace OpenSim.Framework
[Serializable]
public class SimpleRegionInfo
- {
+ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
+
///
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
///
@@ -344,7 +344,7 @@ namespace OpenSim.Framework
public string proxyUrl = "";
public int ProxyOffset = 0;
public string regionSecret = UUID.Random().ToString();
-
+
public string osSecret;
public UUID lastMapUUID = UUID.Zero;
@@ -699,7 +699,7 @@ namespace OpenSim.Framework
RegionID = new UUID(regionUUID);
originRegionID = RegionID; // What IS this?!
-
+
RegionName = name;
string location = config.GetString("Location", String.Empty);
@@ -720,7 +720,7 @@ namespace OpenSim.Framework
// Internal IP
IPAddress address;
-
+
if (config.Contains("InternalAddress"))
{
address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
@@ -774,7 +774,7 @@ namespace OpenSim.Framework
{
m_externalHostName = Util.GetLocalHost().ToString();
m_log.InfoFormat(
- "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
+ "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
m_externalHostName, name);
}
else
@@ -909,16 +909,16 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
-
+
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for physical prims", m_physPrimMax.ToString(), true);
-
+
configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Clamp prims to max size", m_clampPrimSize.ToString(), true);
-
+
configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Max objects this sim will hold", m_objectCapacity.ToString(), true);
-
+
configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
"Scope ID for this region", ScopeID.ToString(), true);
@@ -956,16 +956,16 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
-
+
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for nonphysical prims", "0", true);
-
+
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for physical prims", "0", true);
-
+
configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Clamp prims to max size", "false", true);
-
+
configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Max objects this sim will hold", "0", true);
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index 3143e3b..7a9b33d 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -157,9 +157,9 @@ namespace OpenSim.Framework.Serialization
public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos)
{
return string.Format(
- OAR_OBJECT_FILENAME_TEMPLATE, objectName,
+ OAR_OBJECT_FILENAME_TEMPLATE, objectName,
Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z),
- uuid);
+ uuid);
}
///
@@ -171,9 +171,9 @@ namespace OpenSim.Framework.Serialization
///
public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos)
{
- return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
- }
-
+ return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
+ }
+
///
/// Extract a plain path from an IAR path
///
@@ -184,18 +184,18 @@ namespace OpenSim.Framework.Serialization
List plainDirs = new List();
string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
-
+
foreach (string iarDir in iarDirs)
{
if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR))
plainDirs.Add(iarDir);
-
+
int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
plainDirs.Add(iarDir.Remove(i));
}
-
- return string.Join("/", plainDirs.ToArray());
+
+ return string.Join("/", plainDirs.ToArray());
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index d20f8c9..452df38 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
-
+
private volatile int NotSocketErrors = 0;
public volatile bool HTTPDRunning = false;
@@ -160,7 +160,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_rpcHandlers[method] = handler;
m_rpcHandlersKeepAlive[method] = keepAlive; // default
}
-
+
return true;
}
@@ -182,7 +182,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
{
//m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);
-
+
lock (m_HTTPHandlers)
{
if (!m_HTTPHandlers.ContainsKey(methodName))
@@ -204,14 +204,14 @@ namespace OpenSim.Framework.Servers.HttpServer
if (!m_pollHandlers.ContainsKey(methodName))
{
m_pollHandlers.Add(methodName,args);
- pollHandlerResult = true;
+ pollHandlerResult = true;
}
}
-
+
if (pollHandlerResult)
return AddHTTPHandler(methodName, handler);
- return false;
+ return false;
}
// Note that the agent string is provided simply to differentiate
@@ -257,51 +257,51 @@ namespace OpenSim.Framework.Servers.HttpServer
{
IHttpClientContext context = (IHttpClientContext)source;
IHttpRequest request = args.Request;
-
+
PollServiceEventArgs psEvArgs;
-
+
if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs))
{
PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request);
-
+
if (psEvArgs.Request != null)
{
OSHttpRequest req = new OSHttpRequest(context, request);
-
+
Stream requestStream = req.InputStream;
-
+
Encoding encoding = Encoding.UTF8;
StreamReader reader = new StreamReader(requestStream, encoding);
-
+
string requestBody = reader.ReadToEnd();
-
+
Hashtable keysvals = new Hashtable();
Hashtable headervals = new Hashtable();
-
+
string[] querystringkeys = req.QueryString.AllKeys;
string[] rHeaders = req.Headers.AllKeys;
-
+
keysvals.Add("body", requestBody);
keysvals.Add("uri", req.RawUrl);
keysvals.Add("content-type", req.ContentType);
keysvals.Add("http-method", req.HttpMethod);
-
+
foreach (string queryname in querystringkeys)
{
keysvals.Add(queryname, req.QueryString[queryname]);
}
-
+
foreach (string headername in rHeaders)
{
headervals[headername] = req.Headers[headername];
}
-
+
keysvals.Add("headers", headervals);
keysvals.Add("querystringkeys", querystringkeys);
-
+
psEvArgs.Request(psreq.RequestID, keysvals);
}
-
+
m_PollServiceManager.Enqueue(psreq);
}
else
@@ -348,10 +348,10 @@ namespace OpenSim.Framework.Servers.HttpServer
{
try
{
-// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
-
+// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
+
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
-
+
// This is the REST agent interface. We require an agent to properly identify
// itself. If the REST handler recognizes the prefix it will attempt to
// satisfy the request. If it is not recognizable, and no damage has occurred
@@ -456,7 +456,7 @@ namespace OpenSim.Framework.Servers.HttpServer
}
request.InputStream.Close();
-
+
// HTTP IN support. The script engine taes it from here
// Nothing to worry about for us.
//
@@ -540,7 +540,7 @@ namespace OpenSim.Framework.Servers.HttpServer
HandleLLSDRequests(request, response);
return;
}
-
+
// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
if (DoWeHaveAHTTPHandler(request.RawUrl))
{
@@ -594,7 +594,7 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
}
-
+
if (String.IsNullOrEmpty(bestMatch))
{
streamHandler = null;
@@ -641,7 +641,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler)
{
// m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey);
-
+
string bestMatch = null;
lock (m_HTTPHandlers)
@@ -727,14 +727,14 @@ namespace OpenSim.Framework.Servers.HttpServer
{
xmlRprcRequest.Params.Add(request.RemoteIPEndPoint); // Param[1]
XmlRpcResponse xmlRpcResponse;
-
+
XmlRpcMethod method;
bool methodWasFound;
lock (m_rpcHandlers)
{
methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method);
}
-
+
if (methodWasFound)
{
xmlRprcRequest.Params.Add(request.Url); // Param[2]
@@ -766,10 +766,10 @@ namespace OpenSim.Framework.Servers.HttpServer
else
{
xmlRpcResponse = new XmlRpcResponse();
-
+
// Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
xmlRpcResponse.SetFault(
- XmlRpcErrorCodes.SERVER_ERROR_METHOD,
+ XmlRpcErrorCodes.SERVER_ERROR_METHOD,
String.Format("Requested method [{0}] not found", methodName));
}
@@ -786,11 +786,11 @@ namespace OpenSim.Framework.Servers.HttpServer
response.KeepAlive = false;
m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl);
-
+
response.SendChunked = false;
response.ContentLength64 = buf.Length;
response.ContentEncoding = Encoding.UTF8;
-
+
try
{
response.OutputStream.Write(buf, 0, buf.Length);
@@ -872,13 +872,13 @@ namespace OpenSim.Framework.Servers.HttpServer
OSD llsdRequest = null;
OSD llsdResponse = null;
-
+
bool LegacyLLSDLoginLibOMV = (requestBody.Contains("passwd") && requestBody.Contains("mac") && requestBody.Contains("viewer_digest"));
-
+
if (requestBody.Length == 0)
// Get Request
{
- requestBody = "";
+ requestBody = "";
}
try
{
@@ -1090,7 +1090,7 @@ namespace OpenSim.Framework.Servers.HttpServer
string bestMatch = null;
//m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery);
-
+
lock (m_HTTPHandlers)
{
foreach (string pattern in m_HTTPHandlers.Keys)
@@ -1156,7 +1156,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// You have to specifically register for '/' and to get it, you must specificaly request it
//
if (pattern == "/" && searchquery == "/" || pattern != "/")
- bestMatch = pattern;
+ bestMatch = pattern;
}
}
}
@@ -1236,11 +1236,11 @@ namespace OpenSim.Framework.Servers.HttpServer
}
public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
- {
+ {
// m_log.DebugFormat(
-// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}",
+// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}",
// request.RawUrl, request.HttpMethod);
-
+
switch (request.HttpMethod)
{
case "OPTIONS":
@@ -1256,7 +1256,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response)
{
// m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl);
-
+
// This is a test. There's a workable alternative.. as this way sucks.
// We'd like to put this into a text file parhaps that's easily editable.
//
@@ -1391,7 +1391,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// m_log.DebugFormat(
// "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery);
-
+
lock (m_HTTPHandlers)
{
foreach (string pattern in m_HTTPHandlers.Keys)
@@ -1452,7 +1452,7 @@ namespace OpenSim.Framework.Servers.HttpServer
//Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
//and should check for NullReferenceExceptions
-
+
if (string.IsNullOrEmpty(contentType))
{
contentType = "text/html";
@@ -1472,8 +1472,8 @@ namespace OpenSim.Framework.Servers.HttpServer
byte[] buffer;
- if (!(contentType.Contains("image")
- || contentType.Contains("x-shockwave-flash")
+ if (!(contentType.Contains("image")
+ || contentType.Contains("x-shockwave-flash")
|| contentType.Contains("application/x-oar")))
{
// Text
@@ -1504,7 +1504,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
response.OutputStream.Flush();
response.Send();
-
+
//if (!response.KeepAlive && response.ReuseContext)
// response.FreeContext();
}
@@ -1611,11 +1611,11 @@ namespace OpenSim.Framework.Servers.HttpServer
m_httpListener2 = CoolHTTPListener.Create(m_listenIPAddress, (int)m_port);
m_httpListener2.ExceptionThrown += httpServerException;
m_httpListener2.LogWriter = httpserverlog;
-
- // Uncomment this line in addition to those in HttpServerLogWriter
+
+ // Uncomment this line in addition to those in HttpServerLogWriter
// if you want more detailed trace information from the HttpServer
//m_httpListener2.UseTraceLogs = true;
-
+
//m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor;
}
else
@@ -1643,8 +1643,8 @@ namespace OpenSim.Framework.Servers.HttpServer
{
m_log.Error("[BASE HTTP SERVER]: Error - " + e.Message);
m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?");
-
- // We want this exception to halt the entire server since in current configurations we aren't too
+
+ // We want this exception to halt the entire server since in current configurations we aren't too
// useful without inbound HTTP.
throw e;
}
@@ -1656,7 +1656,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
case SocketError.NotSocket:
NotSocketErrors++;
-
+
break;
}
}
@@ -1686,12 +1686,11 @@ namespace OpenSim.Framework.Servers.HttpServer
m_httpListener2.LogWriter = null;
m_httpListener2.RequestReceived -= OnRequest;
m_httpListener2.Stop();
- }
+ }
catch (NullReferenceException)
{
m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer.");
}
-
}
public void RemoveStreamHandler(string httpMethod, string path)
@@ -1712,7 +1711,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_HTTPHandlers.Remove(path);
return;
}
-
+
m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
}
}
@@ -1728,7 +1727,6 @@ namespace OpenSim.Framework.Servers.HttpServer
}
RemoveHTTPHandler(httpMethod, path);
-
}
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
@@ -1759,7 +1757,6 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
-
public bool RemoveLLSDHandler(string path, LLSDMethod handler)
{
try
@@ -1833,7 +1830,7 @@ namespace OpenSim.Framework.Servers.HttpServer
oresp = osresp;
}
}
-
+
///
/// Relays HttpServer log messages to our own logging mechanism.
///
@@ -1852,7 +1849,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
case LogPrio.Trace:
m_log.DebugFormat("[{0}]: {1}", source, message);
- break;
+ break;
case LogPrio.Debug:
m_log.DebugFormat("[{0}]: {1}", source, message);
break;
@@ -1872,8 +1869,8 @@ namespace OpenSim.Framework.Servers.HttpServer
break;
}
*/
-
+
return;
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index b860cf6..d120f03 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -225,7 +225,7 @@ namespace OpenSim
}
}
MainConsole.Instance = null;
- }
+ }
*/
configSource.Alias.AddAlias("On", true);
configSource.Alias.AddAlias("Off", false);
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 4f2d223..c85ff82 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -152,7 +152,7 @@ namespace OpenSim
RegisterConsoleCommands();
base.StartupSpecific();
-
+
MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler());
MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this));
if (userStatsURI != String.Empty)
@@ -192,7 +192,7 @@ namespace OpenSim
// Hook up to the watchdog timer
Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
- PrintFileToConsole("startuplogo.txt");
+ PrintFileToConsole("startuplogo.txt");
// For now, start at the 'root' level by default
if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
@@ -218,8 +218,8 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "debug packet",
"debug packet ",
- "Turn on packet debugging",
- "If level > 255 then all incoming and outgoing packets are logged.\n"
+ "Turn on packet debugging",
+ "If level > 255 then all incoming and outgoing packets are logged.\n"
+ "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
+ "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
+ "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
@@ -561,11 +561,11 @@ namespace OpenSim
{
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
}
-
+
IScene scene;
PopulateRegionEstateInfo(regInfo);
- CreateRegion(regInfo, true, out scene);
- regInfo.EstateSettings.Save();
+ CreateRegion(regInfo, true, out scene);
+ regInfo.EstateSettings.Save();
}
///
@@ -943,7 +943,7 @@ namespace OpenSim
delegate(Scene scene)
{
MainConsole.Instance.Output(String.Format(
- "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}",
+ "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}",
scene.RegionInfo.RegionName,
scene.RegionInfo.RegionLocX,
scene.RegionInfo.RegionLocY,
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index a6315a9..f35691a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details.
///
protected int m_debugPacketLevel = 0;
-
+
#region Events
public event GenericMessage OnGenericMessage;
@@ -287,7 +287,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event MuteListEntryRemove OnRemoveMuteListEntry;
public event GodlikeMessage onGodlikeMessage;
public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
-
#endregion Events
@@ -329,12 +328,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// ownerless phantom.
///
/// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
- ///
+ ///
///
protected HashSet m_killRecord;
-
-// protected HashSet m_attachmentsSent;
-
+
+// protected HashSet m_attachmentsSent;
+
private int m_moneyBalance;
private int m_animationSequenceNumber = 1;
private bool m_SendLogoutPacketWhenClosing = true;
@@ -383,22 +382,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public string ActiveGroupName { get { return m_activeGroupName; } }
public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
-
+
///
/// First name of the agent/avatar represented by the client
///
public string FirstName { get { return m_firstName; } }
-
+
///
/// Last name of the agent/avatar represented by the client
///
public string LastName { get { return m_lastName; } }
-
+
///
/// Full name of the client (first name and last name)
///
public string Name { get { return FirstName + " " + LastName; } }
-
+
public uint CircuitCode { get { return m_circuitCode; } }
public int MoneyBalance { get { return m_moneyBalance; } }
public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
@@ -440,7 +439,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
m_fullUpdateDataBlocksBuilder = new List();
m_killRecord = new HashSet();
-// m_attachmentsSent = new HashSet();
+// m_attachmentsSent = new HashSet();
m_assetService = m_scene.RequestModuleInterface();
m_GroupsModule = scene.RequestModuleInterface();
@@ -654,7 +653,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Make sure that we see any exception caused by the asynchronous operation.
m_log.Error(
string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e);
- }
+ }
}
#endregion Packet Handling
@@ -865,7 +864,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
foreach (GroupActiveProposals Proposal in Proposals)
{
GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
-
+
GAPIRP.AgentData.AgentID = AgentId;
GAPIRP.AgentData.GroupID = groupID;
GAPIRP.TransactionData.TransactionID = transactionID;
@@ -889,7 +888,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (Proposals.Length == 0)
{
GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
-
+
GAPIRP.AgentData.AgentID = AgentId;
GAPIRP.AgentData.GroupID = groupID;
GAPIRP.TransactionData.TransactionID = transactionID;
@@ -944,7 +943,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (Votes.Length == 0)
{
GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
-
+
GVHIRP.AgentData.AgentID = AgentId;
GVHIRP.AgentData.GroupID = groupID;
GVHIRP.TransactionData.TransactionID = transactionID;
@@ -968,7 +967,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(GVHIRP, ThrottleOutPacketType.Task);
}
}
-
+
public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
{
GroupAccountDetailsReplyPacket GADRP = new GroupAccountDetailsReplyPacket();
@@ -987,13 +986,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
GADRP.HistoryData[0] = History;
OutPacket(GADRP, ThrottleOutPacketType.Task);
}
-
+
public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
{
GroupAccountSummaryReplyPacket GASRP =
(GroupAccountSummaryReplyPacket)PacketPool.Instance.GetPacket(
PacketType.GroupAccountSummaryReply);
-
+
GASRP.AgentData = new GroupAccountSummaryReplyPacket.AgentDataBlock();
GASRP.AgentData.AgentID = sender.AgentId;
GASRP.AgentData.GroupID = groupID;
@@ -1020,13 +1019,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
GASRP.MoneyData.LightTaxEstimate = 0;
OutPacket(GASRP, ThrottleOutPacketType.Task);
}
-
+
public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
{
GroupAccountTransactionsReplyPacket GATRP =
(GroupAccountTransactionsReplyPacket)PacketPool.Instance.GetPacket(
PacketType.GroupAccountTransactionsReply);
-
+
GATRP.AgentData = new GroupAccountTransactionsReplyPacket.AgentDataBlock();
GATRP.AgentData.AgentID = sender.AgentId;
GATRP.AgentData.GroupID = groupID;
@@ -1510,7 +1509,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendKillObject(ulong regionHandle, uint localID)
{
// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle);
-
+
KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
// TODO: don't create new blocks if recycling an old packet
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
@@ -3469,9 +3468,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
OutPacket(objupdate, ThrottleOutPacketType.Task);
-
+
// We need to record the avatar local id since the root prim of an attachment points to this.
-// m_attachmentsSent.Add(avatar.LocalId);
+// m_attachmentsSent.Add(avatar.LocalId);
}
public void SendCoarseLocationUpdate(List users, List CoarseLocations)
@@ -3519,7 +3518,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Primitive Packet/Data Sending Methods
///
- /// Generate one of the object update packets based on PrimUpdateFlags
+ /// Generate one of the object update packets based on PrimUpdateFlags
/// and broadcast the packet to clients
///
public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
@@ -3527,7 +3526,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
double priority = m_prioritizer.GetUpdatePriority(this, entity);
lock (m_entityUpdates.SyncRoot)
- m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
+ m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
}
private void ProcessEntityUpdates(int maxUpdates)
@@ -3544,20 +3543,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
EntityUpdate update;
while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update))
{
- // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
+ // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
// will never receive an update after a prim kill. Even then, keeping the kill record may be a good
// safety measure.
//
- // Receiving updates after kills results in undeleteable prims that persist until relog and
+ // Receiving updates after kills results in undeleteable prims that persist until relog and
// currently occurs because prims can be deleted before all queued updates are sent.
if (m_killRecord.Contains(update.Entity.LocalId))
{
// m_log.WarnFormat(
-// "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted",
-// update.Entity.LocalId, Name);
+// "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted",
+// update.Entity.LocalId, Name);
continue;
}
-
+
if (update.Entity is SceneObjectPart)
{
SceneObjectPart part = (SceneObjectPart)update.Entity;
@@ -3642,28 +3641,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// string text = sop.Text;
// if (text.IndexOf("\n") >= 0)
// text = text.Remove(text.IndexOf("\n"));
-//
+//
// if (m_attachmentsSent.Contains(sop.ParentID))
// {
//// m_log.DebugFormat(
//// "[CLIENT]: Sending full info about attached prim {0} text {1}",
//// sop.LocalId, text);
-//
+//
// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId));
-//
+//
// m_attachmentsSent.Add(sop.LocalId);
// }
// else
// {
// m_log.DebugFormat(
-// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
+// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
// sop.LocalId, text, sop.ParentID);
-//
-// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
+//
+// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
// }
// }
// else
-// {
+// {
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
// }
}
@@ -3977,7 +3976,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_propertiesPacketTimer.Stop();
return;
}
-
+
m_propertiesPacketTimer.Stop();
m_propertiesPacketTimer.Start();
}
@@ -4208,7 +4207,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
- ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
+ ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
updateMessage.AABBMax = landData.AABBMax;
updateMessage.AABBMin = landData.AABBMin;
@@ -4252,7 +4251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.PassHours = landData.PassHours;
updateMessage.PassPrice = landData.PassPrice;
updateMessage.PublicCount = 0; //TODO: Unimplemented
-
+
updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0;
updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0;
@@ -4282,13 +4281,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt;
- updateMessage.MediaType = landData.MediaType;
- updateMessage.MediaDesc = landData.MediaDescription;
- updateMessage.MediaWidth = landData.MediaWidth;
- updateMessage.MediaHeight = landData.MediaHeight;
- updateMessage.MediaLoop = landData.MediaLoop;
- updateMessage.ObscureMusic = landData.ObscureMusic;
- updateMessage.ObscureMedia = landData.ObscureMedia;
+ updateMessage.MediaType = landData.MediaType;
+ updateMessage.MediaDesc = landData.MediaDescription;
+ updateMessage.MediaWidth = landData.MediaWidth;
+ updateMessage.MediaHeight = landData.MediaHeight;
+ updateMessage.MediaLoop = landData.MediaLoop;
+ updateMessage.ObscureMusic = landData.ObscureMusic;
+ updateMessage.ObscureMedia = landData.ObscureMedia;
try
{
@@ -4297,8 +4296,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
eq.ParcelProperties(updateMessage, this.AgentId);
} else {
- m_log.Warn("No EQ Interface when sending parcel data.");
- }
+ m_log.Warn("No EQ Interface when sending parcel data.");
+ }
}
catch (Exception ex)
{
@@ -4671,9 +4670,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// m_log.DebugFormat(
-// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}",
+// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}",
// data.Name, update.FullID, flags, update.ID);
-
+
update.UpdateFlags = (uint)flags;
#endregion PrimFlags
@@ -4806,11 +4805,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale);
AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation);
AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate);
-
+
// Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once,
// some clients will send out a separate ObjectImage packet for each face
AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false);
-
+
AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false);
AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false);
AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab);
@@ -5065,12 +5064,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return false;
}
-
+
private bool HandleParcelGodMarkAsContent(IClientAPI client, Packet Packet)
{
ParcelGodMarkAsContentPacket ParcelGodMarkAsContent =
(ParcelGodMarkAsContentPacket)Packet;
-
+
ParcelGodMark ParcelGodMarkAsContentHandler = OnParcelGodMark;
if (ParcelGodMarkAsContentHandler != null)
{
@@ -5081,11 +5080,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleFreezeUser(IClientAPI client, Packet Packet)
{
FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet;
-
+
FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser;
if (FreezeUserHandler != null)
{
@@ -5097,12 +5096,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleEjectUser(IClientAPI client, Packet Packet)
{
EjectUserPacket EjectUser =
(EjectUserPacket)Packet;
-
+
EjectUserUpdate EjectUserHandler = OnParcelEjectUser;
if (EjectUserHandler != null)
{
@@ -5114,12 +5113,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleParcelBuyPass(IClientAPI client, Packet Packet)
{
ParcelBuyPassPacket ParcelBuyPass =
(ParcelBuyPassPacket)Packet;
-
+
ParcelBuyPass ParcelBuyPassHandler = OnParcelBuyPass;
if (ParcelBuyPassHandler != null)
{
@@ -5130,7 +5129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack)
{
ParcelBuyPacket parcel = (ParcelBuyPacket)Pack;
@@ -5352,7 +5351,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
//m_log.DebugFormat("[CLIENT]: Received ScriptDialogReply from {0}", rdialog.Data.ObjectID);
-
+
#region Packet Session and User Check
if (m_checkPackets)
{
@@ -5498,12 +5497,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return true;
}
-
+
private bool HandleFindAgent(IClientAPI client, Packet Packet)
{
FindAgentPacket FindAgent =
(FindAgentPacket)Packet;
-
+
FindAgentUpdate FindAgentHandler = OnFindAgent;
if (FindAgentHandler != null)
{
@@ -5512,12 +5511,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleTrackAgent(IClientAPI client, Packet Packet)
{
TrackAgentPacket TrackAgent =
(TrackAgentPacket)Packet;
-
+
TrackAgentUpdate TrackAgentHandler = OnTrackAgent;
if (TrackAgentHandler != null)
{
@@ -5528,7 +5527,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandlerRezObject(IClientAPI sender, Packet Pack)
{
RezObjectPacket rezPacket = (RezObjectPacket)Pack;
@@ -7184,19 +7183,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
// m_log.DebugFormat(
-// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
+// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
// requestID, itemID, taskID, Name);
-
+
if (!(((Scene)m_scene).Permissions.BypassPermissions()))
{
if (taskID != UUID.Zero) // Prim
{
SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
-
+
if (part == null)
{
m_log.WarnFormat(
- "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
+ "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
Name, requestID, itemID, taskID);
return true;
}
@@ -7205,11 +7204,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (tii == null)
{
m_log.WarnFormat(
- "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
- Name, requestID, itemID, taskID);
+ "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
+ Name, requestID, itemID, taskID);
return true;
- }
-
+ }
+
if (tii.Type == (int)AssetType.LSLText)
{
if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
@@ -7228,41 +7227,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
- Name, requestID, itemID, taskID, part.OwnerID);
+ Name, requestID, itemID, taskID, part.OwnerID);
return true;
}
-
+
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
{
m_log.WarnFormat(
- "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
- Name, requestID, itemID, taskID);
+ "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
+ Name, requestID, itemID, taskID);
return true;
}
-
+
if (tii.OwnerID != AgentId)
{
m_log.WarnFormat(
- "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
- Name, requestID, itemID, taskID, tii.OwnerID);
+ "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
+ Name, requestID, itemID, taskID, tii.OwnerID);
return true;
}
-
+
if ((
- tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
+ tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
!= ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
{
m_log.WarnFormat(
- "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
- Name, requestID, itemID, taskID);
+ "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
+ Name, requestID, itemID, taskID);
return true;
}
-
+
if (tii.AssetID != requestID)
{
m_log.WarnFormat(
- "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
- Name, requestID, itemID, taskID, tii.AssetID);
+ "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
+ Name, requestID, itemID, taskID, tii.AssetID);
return true;
}
}
@@ -7866,7 +7865,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
newTaskItem, updatetask.UpdateData.LocalID);
}
}
- }
+ }
return true;
}
@@ -8861,7 +8860,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// return true;
}
-
+
private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)
{
RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
@@ -8882,7 +8881,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return true;
}
-
+
private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack)
{
@@ -8919,7 +8918,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
-
+
private bool HandleGodUpdateRegionInfoUpdate(IClientAPI client, Packet Packet)
{
GodUpdateRegionInfoPacket GodUpdateRegionInfo =
@@ -8939,7 +8938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleSimWideDeletes(IClientAPI client, Packet Packet)
{
SimWideDeletesPacket SimWideDeletesRequest =
@@ -8952,7 +8951,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleGodlikeMessage(IClientAPI client, Packet Packet)
{
GodlikeMessagePacket GodlikeMessage =
@@ -8969,7 +8968,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleSaveStatePacket(IClientAPI client, Packet Packet)
{
StateSavePacket SaveStateMessage =
@@ -8982,7 +8981,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleGodKickUser(IClientAPI sender, Packet Pack)
{
GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
@@ -9120,7 +9119,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return true;
}
-
+
#endregion Economy/Transaction Packets
#region Script Packets
@@ -9333,7 +9332,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return true;
}
-
+
private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet)
{
UpdateMuteListEntryPacket UpdateMuteListEntry =
@@ -9349,7 +9348,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleRemoveMuteListEntry(IClientAPI client, Packet Packet)
{
RemoveMuteListEntryPacket RemoveMuteListEntry =
@@ -9365,7 +9364,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleUserReport(IClientAPI client, Packet Packet)
{
UserReportPacket UserReport =
@@ -9390,7 +9389,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleSendPostcard(IClientAPI client, Packet packet)
{
// SendPostcardPacket SendPostcard =
@@ -9672,7 +9671,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
-
+
private bool HandleGroupVoteHistoryRequest(IClientAPI client, Packet Packet)
{
GroupVoteHistoryRequestPacket GroupVoteHistoryRequest =
@@ -9685,7 +9684,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleGroupActiveProposalsRequest(IClientAPI client, Packet Packet)
{
GroupActiveProposalsRequestPacket GroupActiveProposalsRequest =
@@ -9698,7 +9697,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleGroupAccountDetailsRequest(IClientAPI client, Packet Packet)
{
GroupAccountDetailsRequestPacket GroupAccountDetailsRequest =
@@ -9711,7 +9710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleGroupAccountSummaryRequest(IClientAPI client, Packet Packet)
{
GroupAccountSummaryRequestPacket GroupAccountSummaryRequest =
@@ -9724,7 +9723,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleGroupTransactionsDetailsRequest(IClientAPI client, Packet Packet)
{
GroupAccountTransactionsRequestPacket GroupAccountTransactionsRequest =
@@ -9737,7 +9736,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
-
+
private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack)
{
GroupTitlesRequestPacket groupTitlesRequest =
@@ -11185,26 +11184,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_debugPacketLevel > 0)
{
bool outputPacket = true;
-
- if (m_debugPacketLevel <= 255
+
+ if (m_debugPacketLevel <= 255
&& (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage))
outputPacket = false;
-
- if (m_debugPacketLevel <= 200
- &&
- (packet.Type == PacketType.ImagePacket
+
+ if (m_debugPacketLevel <= 200
+ && (packet.Type == PacketType.ImagePacket
|| packet.Type == PacketType.ImageData
|| packet.Type == PacketType.LayerData
- || packet.Type == PacketType.CoarseLocationUpdate))
+ || packet.Type == PacketType.CoarseLocationUpdate))
outputPacket = false;
-
+
if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect))
- outputPacket = false;
-
+ outputPacket = false;
+
if (outputPacket)
m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
}
-
+
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
}
@@ -11279,16 +11277,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_debugPacketLevel > 0)
{
bool outputPacket = true;
-
+
if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate)
outputPacket = false;
-
+
if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage)
outputPacket = false;
-
+
if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
outputPacket = false;
-
+
if (outputPacket)
m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type);
}
@@ -11551,12 +11549,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
UUID requestID = UUID.Zero;
byte source = (byte)SourceType.Asset;
-
- if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
+
+ if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
{
requestID = new UUID(transferRequest.TransferInfo.Params, 0);
}
- else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
+ else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
{
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
source = (byte)SourceType.SimInventoryItem;
@@ -11802,7 +11800,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public PacketMethod method;
public bool Async;
}
-
+
public class AsyncPacketProcess
{
public bool result = false;
@@ -11871,8 +11869,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName);
dialog.Data.LastName = Util.StringToBytes256(ownerLastName);
dialog.Data.Message = Util.StringToBytes256(message);
-
-
+
ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1];
buttons[0] = new ScriptDialogPacket.ButtonsBlock();
buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!");
@@ -11886,7 +11883,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
ScenePresence presence = p as ScenePresence;
// It turns out to get the agent to stop flying, you have to feed it stop flying velocities
- // There's no explicit message to send the client to tell it to stop flying.. it relies on the
+ // There's no explicit message to send the client to tell it to stop flying.. it relies on the
// velocity, collision plane and avatar height
// Add 1/6 the avatar's height to it's position so it doesn't shoot into the air
@@ -11903,7 +11900,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// attach a suitable collision plane regardless of the actual situation to force the LLClient to land.
// Collision plane below the avatar's position a 6th of the avatar's height is suitable.
- // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a
+ // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a
// certain amount.. because the LLClient wouldn't land in that situation anyway.
// why are we still testing for this really old height value default???
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 7270304..5604f49 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -48,8 +48,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
protected Scene m_scene = null;
- public string Name { get { return "Attachments Module"; } }
- public Type ReplaceableInterface { get { return null; } }
+ public string Name { get { return "Attachments Module"; } }
+ public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source) {}
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
client.OnObjectAttach += AttachObject;
client.OnObjectDetach += DetachObject;
- client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
+ client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
}
public void UnsubscribeFromClientEvents(IClientAPI client)
@@ -89,7 +89,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
client.OnObjectAttach -= AttachObject;
client.OnObjectDetach -= DetachObject;
- client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
+ client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
}
///
@@ -173,12 +173,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
UUID itemID = UUID.Zero;
if (sp != null)
{
- foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
+ foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
{
itemID = grp.GetFromItemID();
if (itemID != UUID.Zero)
DetachSingleAttachmentToInv(itemID, remoteClient);
- }
+ }
}
if (group.GetFromItemID() == UUID.Zero)
@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
- {
+ {
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt);
if (updateInventoryStatus)
@@ -241,8 +241,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (null == att)
return UUID.Zero;
else
- return att.UUID;
- }
+ return att.UUID;
+ }
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
@@ -298,7 +298,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
return null;
- }
+ }
public UUID SetAttachmentInventoryStatus(
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
@@ -473,7 +473,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
sog.RootPart.IsAttachment = false;
sog.AbsolutePosition = sog.RootPart.AttachedPos;
UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
- sog.SetAttachmentPoint(attachmentPoint);
+ sog.SetAttachmentPoint(attachmentPoint);
}
///
@@ -600,7 +600,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// In case it is later dropped again, don't let
// it get cleaned up
so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
- so.HasGroupChanged = false;
+ so.HasGroupChanged = false;
}
}
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 032e55a..25322a1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
try
{
deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
- if(killingAvatar != null)
+ if (killingAvatar != null)
killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname);
}
catch (InvalidOperationException)
@@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
}
private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
- {
+ {
try
{
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 4b30b0d..5ec64d5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -58,13 +58,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
public void SubscribeToClientEvents(IClientAPI client)
{
client.OnGodKickUser += KickUser;
- client.OnRequestGodlikePowers += RequestGodlikePowers;
- }
+ client.OnRequestGodlikePowers += RequestGodlikePowers;
+ }
public void UnsubscribeFromClientEvents(IClientAPI client)
{
client.OnGodKickUser -= KickUser;
- client.OnRequestGodlikePowers -= RequestGodlikePowers;
+ client.OnRequestGodlikePowers -= RequestGodlikePowers;
}
public void RequestGodlikePowers(
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 13bae2e..43bbf0d 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -137,7 +137,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
if (scene.Entities.ContainsKey(toAgentID) &&
scene.Entities[toAgentID] is ScenePresence)
- {
+ {
// m_log.DebugFormat(
// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
// toAgentID.ToString(), scene.RegionInfo.RegionName);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 52342ec..c1df827 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -179,14 +179,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
successfulAssetRestores, failedAssetRestores);
- m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
+ m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
return loadedNodes;
}
finally
{
m_loadStream.Close();
- }
+ }
}
public void Close()
@@ -201,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// The item archive path to replicate
/// The root folder for the inventory load
///
- /// The folders that we have resolved so far for a given archive path.
+ /// The folders that we have resolved so far for a given archive path.
/// This method will add more folders if necessary
///
///
@@ -246,17 +246,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// The root folder for the inventory load
///
///
- /// The folders that we have resolved so far for a given archive path.
+ /// The folders that we have resolved so far for a given archive path.
///
///
/// The folder in the user's inventory that matches best the archive path given. If no such folder was found
/// then the passed in root destination folder is returned.
- ///
+ ///
protected InventoryFolderBase ResolveDestinationFolder(
- InventoryFolderBase rootDestFolder,
- ref string archivePath,
+ InventoryFolderBase rootDestFolder,
+ ref string archivePath,
Dictionary resolvedFolders)
- {
+ {
// string originalArchivePath = archivePath;
while (archivePath.Length > 0)
@@ -370,7 +370,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (0 == i)
loadedNodes.Add(destFolder);
- }
+ }
}
///
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 9908018..bae5a7a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids)
{
Exception reportedException = null;
- bool succeeded = true;
+ bool succeeded = true;
try
{
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
finally
{
m_saveStream.Close();
- }
+ }
m_module.TriggerInventoryArchiveSaved(
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
@@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
// We couldn't find the path indicated
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
- Exception e = new InventoryArchiverException(errorMessage);
+ Exception e = new InventoryArchiverException(errorMessage);
m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
throw e;
}
@@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
inventoryFolder.Name,
inventoryFolder.ID,
- m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath );
+ m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
//recurse through all dirs getting dirs and files
SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
@@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
//SaveUsers();
new AssetsRequest(
- new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
+ new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
}
catch (Exception)
{
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
index e07e2ca..5fd1a7e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// Signals an inventory archiving problem
///
public class InventoryArchiverException : Exception
- {
+ {
public InventoryArchiverException(string message) : base(message) {}
public InventoryArchiverException(string message, Exception e) : base(message, e) {}
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index f03f2a1..2eaca49 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene.AddCommand(
this, "load iar",
- "load iar []",
+ "load iar []",
//"load iar [--merge] []",
"Load user inventory archive (IAR).",
//"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
//+ " is user's first name." + Environment.NewLine
- " is user's first name." + Environment.NewLine
+ " is user's first name." + Environment.NewLine
+ " is user's last name." + Environment.NewLine
+ " is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
+ " is the user's password." + Environment.NewLine
@@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (CheckPresence(userInfo.PrincipalID))
{
InventoryArchiveReadRequest request;
- bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
+ bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
try
{
@@ -286,10 +286,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (CheckPresence(userInfo.PrincipalID))
{
InventoryArchiveReadRequest request;
- bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
+ bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
try
- {
+ {
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge);
}
catch (EntryPointNotFoundException e)
@@ -325,20 +325,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
{
try
- {
- m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
-
- Dictionary options = new Dictionary();
+ {
+ m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
+
+ Dictionary options = new Dictionary();
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
List mainParams = optionSet.Parse(cmdparams);
-
+
if (mainParams.Count < 6)
{
m_log.Error(
"[INVENTORY ARCHIVER]: usage is load iar [--merge] []");
return;
- }
+ }
string firstName = mainParams[2];
string lastName = mainParams[3];
@@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
m_log.InfoFormat(
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
- loadPath, firstName, lastName);
+ loadPath, firstName, lastName);
}
catch (InventoryArchiverException e)
{
@@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
savePath, invPath, firstName, lastName);
- ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary());
+ ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary());
}
catch (InventoryArchiverException e)
{
@@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
lock (m_pendingConsoleSaves)
- m_pendingConsoleSaves.Add(id);
+ m_pendingConsoleSaves.Add(id);
}
private void SaveInvConsoleCommandCompleted(
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d66a1d0..938886b2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -58,18 +58,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
///
/// Stream of data representing a common IAR that can be reused in load tests.
///
- protected MemoryStream m_iarStream;
+ protected MemoryStream m_iarStream;
protected UserAccount m_ua1
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
FirstName = "Mr",
- LastName = "Tiddles" };
+ LastName = "Tiddles" };
protected UserAccount m_ua2
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
FirstName = "Lord",
- LastName = "Lucan" };
+ LastName = "Lucan" };
string m_item1Name = "b.lsl";
private void SaveCompleted(
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
}
protected void ConstructDefaultIarForTestLoad()
- {
+ {
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
MemoryStream archiveWriteStream = new MemoryStream();
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string item1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
- tar.Close();
+ tar.Close();
m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
}
@@ -341,7 +341,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
// TODO: Test presence of more files and contents of files.
- }
+ }
///
/// Test that things work when the load path specified starts with a slash
@@ -349,22 +349,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
[Test]
public void TestLoadIarPathStartsWithSlash()
{
- TestHelper.InMethod();
+ TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule();
- InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
- Scene scene = SceneSetupHelpers.SetupScene("inventory");
+ InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
+ Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
- UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
+ UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
- Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
+ Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
}
///
@@ -376,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
[Test]
public void TestLoadIarV0_1ExistingUsers()
{
- TestHelper.InMethod();
+ TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule();
@@ -386,9 +386,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
-
- UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
- UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
+
+ UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
+ UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
@@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userFirstName = "Jock";
string userLastName = "Stirrup";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
- UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
+ UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
// Create asset
SceneObjectGroup object1;
@@ -524,7 +524,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
[Test]
public void TestLoadIarV0_1AbsentUsers()
{
- TestHelper.InMethod();
+ TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Charlie";
@@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
- UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
+ UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
@@ -680,8 +680,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
- string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
- string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
+ string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
+ string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
{
// Test replication of path1
@@ -694,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
- InventoryFolderBase folder1 = folder1Candidates[0];
+ InventoryFolderBase folder1 = folder1Candidates[0];
List folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
@@ -715,11 +715,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
List folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
- Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
+ Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
List folder2bCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
- Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
+ Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
}
}
@@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder(
- scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
+ scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@@ -772,7 +772,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
List folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
- }
+ }
///
/// Test replication of a partly existing archive path to the user's inventory. This should create
@@ -792,7 +792,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder(
- scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
+ scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@@ -812,6 +812,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
List folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
- }
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 35b70de..05fe3ee 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
{
if (!queues.ContainsKey(agentId))
{
- /*
+ /*
m_log.DebugFormat(
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
agentId, m_scene.RegionInfo.RegionName);
@@ -701,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
{
- OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
+ OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
Enqueue(item, avatarID);
}
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
index b62df18..0d7d16a 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
}
// private static byte[] uintToByteArray(uint uIntValue)
-// {
+// {
// byte[] result = new byte[4];
// Utils.UIntToBytesBig(uIntValue, result, 0);
// return result;
@@ -386,14 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
return placesReply;
}
- public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
- {
- OSDMap message = new OSDMap();
- message.Add("message", OSD.FromString("ParcelProperties"));
- OSD message_body = parcelPropertiesMessage.Serialize();
- message.Add("body", message_body);
- return message;
- }
+ public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
+ {
+ OSDMap message = new OSDMap();
+ message.Add("message", OSD.FromString("ParcelProperties"));
+ OSD message_body = parcelPropertiesMessage.Serialize();
+ message.Add("body", message_body);
+ return message;
+ }
}
}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index d87f7f1..4c4eeff 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -594,7 +594,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
rootPart.Name = item.Name;
rootPart.Description = item.Description;
- List partList = null;
+ List partList = null;
lock (group.Children)
partList = new List(group.Children.Values);
diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs
index b75a700..a75ff62 100644
--- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
protected bool m_collectStats;
protected Scene m_scene = null;
- public string Name { get { return "Binary Statistics Logging Module"; } }
- public Type ReplaceableInterface { get { return null; } }
+ public string Name { get { return "Binary Statistics Logging Module"; } }
+ public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source)
{
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
catch
{
// if it doesn't work, we don't collect anything
- }
+ }
}
public void AddRegion(Scene scene)
@@ -94,12 +94,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void RegionLoaded(Scene scene)
{
if (m_collectStats)
- m_scene.StatsReporter.OnSendStatsResult += LogSimStats;
+ m_scene.StatsReporter.OnSendStatsResult += LogSimStats;
}
public void Close()
{
- }
+ }
public class StatLogger
{
@@ -164,6 +164,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
}
return;
- }
+ }
}
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index 4e2f602..2322d7c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return folders[type];
}
- m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
+ m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
return null;
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index cbd9e05..ab6be50 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{
// m_log.DebugFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
-// item.Name, item.Owner, item.Folder);
+// item.Name, item.Owner, item.Folder);
return m_InventoryService.AddItem(item);
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 4ab6947..34205e3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public bool AddItem(InventoryItemBase item)
{
if (item == null)
- return false;
+ return false;
return m_RemoteConnector.AddItem(item);
}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
index ddc3dd7..c72acc3 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
@@ -33,7 +33,7 @@ using OpenSim.Framework.Serialization;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.World.Archiver
-{
+{
///
/// Helper methods for archive manipulation
///
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public static string CreateObjectFilename(SceneObjectGroup sog)
{
return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition);
- }
+ }
///
/// Create the path used to store an object in an OpenSim Archive.
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public static string CreateObjectPath(SceneObjectGroup sog)
{
return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
- }
+ }
///
/// Resolve path to a working FileStream
@@ -123,6 +123,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// return new BufferedStream(file, (int) response.ContentLength);
return new BufferedStream(file, 1000000);
- }
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index ea71fd9..634685a 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -72,12 +72,12 @@ namespace OpenSim.Region.CoreModules.World.Land
#pragma warning restore 0429
///
- /// Local land ids at specified region co-ordinates (region size / 4)
+ /// Local land ids at specified region co-ordinates (region size / 4)
///
private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax];
///
- /// Land objects keyed by local id
+ /// Land objects keyed by local id
///
private readonly Dictionary m_landList = new Dictionary();
@@ -92,8 +92,8 @@ namespace OpenSim.Region.CoreModules.World.Land
#region INonSharedRegionModule Members
- public Type ReplaceableInterface
- {
+ public Type ReplaceableInterface
+ {
get { return null; }
}
@@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.World.Land
Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition));
forcedPosition = null;
}
- //if we are far away, teleport
+ //if we are far away, teleport
else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3)
{
Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition));
@@ -321,8 +321,6 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
-
-
private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
{
if (m_scene.Permissions.IsGod(avatar.UUID)) return;
@@ -336,7 +334,6 @@ namespace OpenSim.Region.CoreModules.World.Land
{
avatar.ControllingClient.SendAlertMessage(
"You are not allowed on this parcel because the land owner has restricted access.");
-
}
public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
@@ -448,7 +445,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
{
- EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
+ EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
m_scene.RegionInfo.RegionID);
//They are going under the safety line!
if (!parcel.IsBannedFromLand(clientAvatar.UUID))
@@ -652,7 +649,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0)
return null;
-
+
try
{
x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0));
@@ -667,7 +664,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
return null;
}
-
+
lock (m_landList)
{
// Corner case. If an autoreturn happens during sim startup
@@ -687,7 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Land
// they happen every time at border crossings
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
}
-
+
lock (m_landIDList)
{
try
@@ -741,7 +738,6 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
{
-
lock (m_landList)
{
foreach (LandObject p in m_landList.Values)
@@ -936,7 +932,7 @@ namespace OpenSim.Region.CoreModules.World.Land
return;
}
}
-
+
lock (m_landList)
{
foreach (ILandObject slaveLandObject in selectedLandObjects)
@@ -1078,7 +1074,6 @@ namespace OpenSim.Region.CoreModules.World.Land
temp.Add(currentParcel);
}
}
-
}
}
@@ -1121,7 +1116,7 @@ namespace OpenSim.Region.CoreModules.World.Land
join(west, south, east, north, remote_client.AgentId);
}
- public void ClientOnParcelSelectObjects(int local_id, int request_type,
+ public void ClientOnParcelSelectObjects(int local_id, int request_type,
List returnIDs, IClientAPI remote_client)
{
m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client);
@@ -1358,31 +1353,31 @@ namespace OpenSim.Region.CoreModules.World.Land
{
return RemoteParcelRequest(request, path, param, agentID, caps);
}));
- UUID parcelCapID = UUID.Random();
- caps.RegisterHandler("ParcelPropertiesUpdate",
- new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
- delegate(string request, string path, string param,
- OSHttpRequest httpRequest, OSHttpResponse httpResponse)
- {
- return ProcessPropertiesUpdate(request, path, param, agentID, caps);
- }));
- }
- private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
- {
- IClientAPI client;
- if ( ! m_scene.TryGetClient(agentID, out client) ) {
- m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() );
- return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
- }
-
- ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
- OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
-
- properties.Deserialize(args);
-
- LandUpdateArgs land_update = new LandUpdateArgs();
- int parcelID = properties.LocalID;
- land_update.AuthBuyerID = properties.AuthBuyerID;
+ UUID parcelCapID = UUID.Random();
+ caps.RegisterHandler("ParcelPropertiesUpdate",
+ new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
+ delegate(string request, string path, string param,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ return ProcessPropertiesUpdate(request, path, param, agentID, caps);
+ }));
+ }
+ private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
+ {
+ IClientAPI client;
+ if (! m_scene.TryGetClient(agentID, out client)) {
+ m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString());
+ return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
+ }
+
+ ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
+ OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
+
+ properties.Deserialize(args);
+
+ LandUpdateArgs land_update = new LandUpdateArgs();
+ int parcelID = properties.LocalID;
+ land_update.AuthBuyerID = properties.AuthBuyerID;
land_update.Category = properties.Category;
land_update.Desc = properties.Desc;
land_update.GroupID = properties.GroupID;
@@ -1399,15 +1394,15 @@ namespace OpenSim.Region.CoreModules.World.Land
land_update.SnapshotID = properties.SnapshotID;
land_update.UserLocation = properties.UserLocation;
land_update.UserLookAt = properties.UserLookAt;
- land_update.MediaDescription = properties.MediaDesc;
- land_update.MediaType = properties.MediaType;
- land_update.MediaWidth = properties.MediaWidth;
- land_update.MediaHeight = properties.MediaHeight;
- land_update.MediaLoop = properties.MediaLoop;
- land_update.ObscureMusic = properties.ObscureMusic;
- land_update.ObscureMedia = properties.ObscureMedia;
-
- ILandObject land;
+ land_update.MediaDescription = properties.MediaDesc;
+ land_update.MediaType = properties.MediaType;
+ land_update.MediaWidth = properties.MediaWidth;
+ land_update.MediaHeight = properties.MediaHeight;
+ land_update.MediaLoop = properties.MediaLoop;
+ land_update.ObscureMusic = properties.ObscureMusic;
+ land_update.ObscureMedia = properties.ObscureMedia;
+
+ ILandObject land;
lock (m_landList)
{
m_landList.TryGetValue(parcelID, out land);
@@ -1415,15 +1410,15 @@ namespace OpenSim.Region.CoreModules.World.Land
if (land != null)
{
- land.UpdateLandProperties(land_update, client);
+ land.UpdateLandProperties(land_update, client);
m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
- }
+ }
else
{
- m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
- }
+ m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
+ }
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
- }
+ }
// we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
// "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
// So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x
@@ -1500,19 +1495,19 @@ namespace OpenSim.Region.CoreModules.World.Land
if (parcelID == UUID.Zero)
return;
- ExtendedLandData data =
- (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
- delegate(string id)
+ ExtendedLandData data =
+ (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
+ delegate(string id)
{
UUID parcel = UUID.Zero;
UUID.TryParse(id, out parcel);
// assume we've got the parcelID we just computed in RemoteParcelRequest
ExtendedLandData extLandData = new ExtendedLandData();
- Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
+ Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
out extLandData.X, out extLandData.Y);
m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
extLandData.RegionHandle, extLandData.X, extLandData.Y);
-
+
// for this region or for somewhere else?
if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
{
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 499b60c..d87352f 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.SnapshotID = args.SnapshotID;
newData.UserLocation = args.UserLocation;
newData.UserLookAt = args.UserLookAt;
- newData.MediaType = args.MediaType;
- newData.MediaDescription = args.MediaDescription;
- newData.MediaWidth = args.MediaWidth;
- newData.MediaHeight = args.MediaHeight;
- newData.MediaLoop = args.MediaLoop;
- newData.ObscureMusic = args.ObscureMusic;
- newData.ObscureMedia = args.ObscureMedia;
+ newData.MediaType = args.MediaType;
+ newData.MediaDescription = args.MediaDescription;
+ newData.MediaWidth = args.MediaWidth;
+ newData.MediaHeight = args.MediaHeight;
+ newData.MediaLoop = args.MediaLoop;
+ newData.ObscureMusic = args.ObscureMusic;
+ newData.ObscureMedia = args.ObscureMedia;
m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 82ad109..7c5d044 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -54,11 +54,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")]
public class MoapModule : INonSharedRegionModule, IMoapModule
- {
+ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- public string Name { get { return "MoapModule"; } }
- public Type ReplaceableInterface { get { return null; } }
+ public string Name { get { return "MoapModule"; } }
+ public Type ReplaceableInterface { get { return null; } }
///
/// Is this module enabled?
@@ -78,17 +78,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
///
/// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate.
///
- protected Dictionary m_omCapUrls = new Dictionary();
+ protected Dictionary m_omCapUrls = new Dictionary();
///
/// Track the ObjectMediaUpdate capabilities given to users keyed by path
- ///
+ ///
protected Dictionary m_omuCapUsers = new Dictionary();
///
/// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate
- ///
- protected Dictionary m_omuCapUrls = new Dictionary();
+ ///
+ protected Dictionary m_omuCapUrls = new Dictionary();
public void Initialise(IConfigSource configSource)
{
@@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy;
- }
+ }
public void OnRegisterCaps(UUID agentID, Caps caps)
{
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
caps.RegisterHandler(
"ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage));
}
- }
+ }
public void OnDeregisterCaps(UUID agentID, Caps caps)
{
@@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
}
protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
- {
+ {
if (original.Shape.Media != null)
{
PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList();
@@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
}
copy.Shape.Media = dupeMedia;
- }
+ }
}
public MediaEntry GetMediaEntry(SceneObjectPart part, int face)
@@ -211,9 +211,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
me = null;
}
else
- {
+ {
lock (media)
- me = media[face];
+ me = media[face];
// TODO: Really need a proper copy constructor down in libopenmetaverse
if (me != null)
@@ -227,17 +227,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
{
- CheckFaceParam(part, face);
+ CheckFaceParam(part, face);
if (null == part.Shape.Media)
part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
- lock (part.Shape.Media)
+ lock (part.Shape.Media)
part.Shape.Media[face] = me;
- UpdateMediaUrl(part, UUID.Zero);
+ UpdateMediaUrl(part, UUID.Zero);
part.ScheduleFullUpdate();
- part.TriggerScriptChangedEvent(Changed.MEDIA);
+ part.TriggerScriptChangedEvent(Changed.MEDIA);
}
public void ClearMediaEntry(SceneObjectPart part, int face)
@@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
///
protected string HandleObjectMediaMessage(
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
- {
+ {
// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request);
OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
@@ -266,12 +266,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
if (omm.Request is ObjectMediaRequest)
return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest);
else if (omm.Request is ObjectMediaUpdate)
- return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate);
+ return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate);
throw new Exception(
string.Format(
"[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}",
- omm.Request.GetType()));
+ omm.Request.GetType()));
}
///
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
///
///
///
- protected string HandleObjectMediaRequest(ObjectMediaRequest omr)
+ protected string HandleObjectMediaRequest(ObjectMediaRequest omr)
{
UUID primId = omr.PrimID;
@@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// Path on which this request was made
/// /param>
///
- protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu)
+ protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu)
{
UUID primId = omu.PrimID;
@@ -330,9 +330,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
"[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}",
primId, m_scene.RegionInfo.RegionName);
return string.Empty;
- }
+ }
-// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
+// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
// for (int i = 0; i < omu.FaceMedia.Length; i++)
// {
@@ -374,14 +374,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap
part.Shape.Textures = te;
// m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}",
-// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
+// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
}
}
}
else
- {
+ {
// We need to go through the media textures one at a time to make sure that we have permission
- // to change them
+ // to change them
// FIXME: Race condition here since some other texture entry manipulator may overwrite/get
// overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
@@ -391,18 +391,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
lock (media)
{
for (int i = 0; i < media.Count; i++)
- {
+ {
if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i))
- {
+ {
media[i] = omu.FaceMedia[i];
// When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal
// texture update, so we don't need to worry about clearing MediaFlags here.
if (null == media[i])
- continue;
+ continue;
Primitive.TextureEntryFace face = te.CreateFace((uint)i);
- face.MediaFlags = true;
+ face.MediaFlags = true;
// m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}",
@@ -414,11 +414,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
part.Shape.Textures = te;
-// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++)
-// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]);
+// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++)
+// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]);
}
- UpdateMediaUrl(part, agentId);
+ UpdateMediaUrl(part, agentId);
// Arguably, we could avoid sending a full update to the avatar that just changed the texture.
part.ScheduleFullUpdate();
@@ -439,16 +439,16 @@ namespace OpenSim.Region.CoreModules.Media.Moap
///
protected string HandleObjectMediaNavigateMessage(
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
- {
+ {
// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request);
OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage();
- omn.Deserialize(osd);
+ omn.Deserialize(osd);
UUID primId = omn.PrimID;
- SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
+ SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
if (null == part)
{
@@ -456,12 +456,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
"[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}",
primId, m_scene.RegionInfo.RegionName);
return string.Empty;
- }
+ }
UUID agentId = default(UUID);
lock (m_omuCapUsers)
- agentId = m_omuCapUsers[path];
+ agentId = m_omuCapUsers[path];
if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face))
return string.Empty;
@@ -484,7 +484,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return string.Empty;
if (me.EnableWhiteList)
- {
+ {
if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList))
{
// m_log.DebugFormat(
@@ -493,18 +493,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return string.Empty;
}
- }
+ }
me.CurrentURL = omn.URL;
UpdateMediaUrl(part, agentId);
- part.ScheduleFullUpdate();
+ part.ScheduleFullUpdate();
part.TriggerScriptChangedEvent(Changed.MEDIA);
return OSDParser.SerializeLLSDXmlString(new OSD());
- }
+ }
///
/// Check that the face number is valid for the given prim.
@@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
int maxFaces = part.GetNumberOfSides() - 1;
if (face > maxFaces)
throw new ArgumentException(
- string.Format("Face argument was {0} but max is {1}", face, maxFaces));
+ string.Format("Face argument was {0} but max is {1}", face, maxFaces));
}
///
@@ -542,9 +542,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
string rawVersion = part.MediaUrl.Substring(5, 10);
int version = int.Parse(rawVersion);
part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId);
- }
+ }
-// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
+// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
}
///
@@ -554,7 +554,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
///
/// true if the url matches an entry on the whitelist, false otherwise
protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist)
- {
+ {
Uri url = new Uri(rawUrl);
foreach (string origWlUrl in whitelist)
@@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
if (url.Host.Contains(wlUrl))
{
// m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
- return true;
+ return true;
}
}
else
@@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return true;
}
}
- }
+ }
return false;
}
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 12750c5..db50339 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
protected Scene m_scene = null;
protected IDialogModule m_dialogModule;
- public string Name { get { return "Object BuySell Module"; } }
- public Type ReplaceableInterface { get { return null; } }
+ public string Name { get { return "Object BuySell Module"; } }
+ public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source) {}
@@ -78,8 +78,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
public void SubscribeToClientEvents(IClientAPI client)
{
- client.OnObjectSaleInfo += ObjectSaleInfo;
- }
+ client.OnObjectSaleInfo += ObjectSaleInfo;
+ }
protected void ObjectSaleInfo(
IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice)
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
part.ParentGroup.HasGroupChanged = true;
part.GetProperties(client);
- }
+ }
public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType)
{
@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
}
else
{
- if (m_dialogModule != null)
+ if (m_dialogModule != null)
m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
return false;
}
@@ -261,6 +261,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
}
return true;
- }
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index bc54997..573a22a 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -397,13 +397,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_groupsModule = m_scene.RequestModuleInterface();
if (m_groupsModule == null)
- m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
+ m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
m_moapModule = m_scene.RequestModuleInterface();
// This log line will be commented out when no longer required for debugging
// if (m_moapModule == null)
-// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
+// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
}
public void Close()
@@ -1906,7 +1906,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
private bool CanControlPrimMedia(UUID agentID, UUID primID, int face)
- {
+ {
// m_log.DebugFormat(
// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}",
// agentID, primID, face);
@@ -1918,7 +1918,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (null == part)
return false;
- MediaEntry me = m_moapModule.GetMediaEntry(part, face);
+ MediaEntry me = m_moapModule.GetMediaEntry(part, face);
// If there is no existing media entry then it can be controlled (in this context, created).
if (null == me)
@@ -1929,7 +1929,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// agentID, primID, face, me.ControlPermissions);
return GenericPrimMediaPermission(part, agentID, me.ControlPermissions);
- }
+ }
private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)
{
@@ -1952,15 +1952,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// m_log.DebugFormat(
// "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}",
-// agentID, primID, face, me.InteractPermissions);
+// agentID, primID, face, me.InteractPermissions);
return GenericPrimMediaPermission(part, agentID, me.InteractPermissions);
- }
+ }
private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms)
{
// if (IsAdministrator(agentID))
-// return true;
+// return true;
if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone)
return true;
@@ -1969,15 +1969,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
{
if (agentID == part.OwnerID)
return true;
- }
+ }
if ((perms & MediaPermission.Group) == MediaPermission.Group)
{
if (IsGroupMember(part.GroupID, agentID, 0))
return true;
- }
+ }
- return false;
+ return false;
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index cb80111..25d73c2 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -814,7 +814,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{
//m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised());
- }
+ }
private void StoreUndoState()
{
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index 9736b73..6bac555 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules
{
if (m_ready)
{
- if(m_scene.GetRootAgentCount() > 0)
+ if (m_scene.GetRootAgentCount() > 0)
{
// Ask wind plugin to generate a LL wind array to be cached locally
// Try not to update this too often, as it may involve array copies
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 1d9c2bd..1bd1371 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
SceneObjectGroup mapdot = (SceneObjectGroup)obj;
Color mapdotspot = Color.Gray; // Default color when prim color is white
- // Loop over prim in group
+ // Loop over prim in group
List partList = null;
lock (mapdot.Children)
partList = new List(mapdot.Children.Values);
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index f036d85..fbc8a50 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
lock (m_rootAgents)
{
m_rootAgents.Remove(AgentId);
- if(m_rootAgents.Count == 0)
+ if (m_rootAgents.Count == 0)
StopThread();
}
}
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 05c1e00..1140b9b 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Interfaces
///
///
///
- /// true if the object was successfully attached, false otherwise
+ /// true if the object was successfully attached, false otherwise
bool AttachObject(
IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent);
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
index 2c091e7..4c501f6 100644
--- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// Get a group
///
/// ID of the group
- /// The group's data. Null if there is no such group.
+ /// The group's data. Null if there is no such group.
GroupRecord GetGroupRecord(UUID GroupID);
void ActivateGroup(IClientAPI remoteClient, UUID groupID);
@@ -74,14 +74,14 @@ namespace OpenSim.Region.Framework.Interfaces
List GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID);
List GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID);
GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID);
- GroupMembershipData[] GetMembershipData(UUID UserID);
+ GroupMembershipData[] GetMembershipData(UUID UserID);
GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID);
void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile);
- void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID);
+ void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID);
GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID);
string GetGroupTitle(UUID avatarID);
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
index 01066e6..ddf7565 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
@@ -43,14 +43,14 @@ namespace OpenSim.Region.Framework.Interfaces
/// Contains the exception generated if the save did not succeed
public delegate void InventoryArchiveSaved(
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException);
-
+
public interface IInventoryArchiverModule
{
///
/// Fired when an archive inventory save has been completed.
///
event InventoryArchiveSaved OnInventoryArchiveSaved;
-
+
///
/// Dearchive a user's inventory folder from the given stream
///
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// The stream from which the inventory archive will be loaded
/// true if the first stage of the operation succeeded, false otherwise
bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream);
-
+
///
/// Dearchive a user's inventory folder from the given stream
///
@@ -72,8 +72,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// the loaded IAR with existing folders where possible.
/// true if the first stage of the operation succeeded, false otherwise
bool DearchiveInventory(
- string firstName, string lastName, string invPath, string pass, Stream loadStream,
- Dictionary options);
+ string firstName, string lastName, string invPath, string pass, Stream loadStream,
+ Dictionary options);
///
/// Archive a user's inventory folder to the given stream
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// The stream to which the inventory archive will be saved
/// true if the first stage of the operation succeeded, false otherwise
bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream);
-
+
///
/// Archive a user's inventory folder to the given stream
///
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// Archiving options. Currently, there are none.
/// true if the first stage of the operation succeeded, false otherwise
bool ArchiveInventory(
- Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
- Dictionary options);
+ Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
+ Dictionary options);
}
}
diff --git a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs
index 24b6860..1d3d240 100644
--- a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs
@@ -63,5 +63,5 @@ namespace OpenSim.Region.Framework.Interfaces
///
/// /param>
void ClearMediaEntry(SceneObjectPart part, int face);
- }
+ }
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
index d6e31f4..65c57a6 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
@@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Interfaces
{
///
/// Generate a map tile for the scene. a terrain texture for this scene
- ///
+ ///
void GenerateMaptile();
}
}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 6b2e03e..ff4595e 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -332,7 +332,7 @@ namespace OpenSim.Region.Framework.Scenes
/// If the object is being attached, then the avatarID will be present. If the object is being detached then
/// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
- public event Attach OnAttach;
+ public event Attach OnAttach;
///
/// Called immediately after an object is loaded from storage.
@@ -344,7 +344,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Called immediately before an object is saved to storage.
///
///
- /// The scene object being persisted.
+ /// The scene object being persisted.
/// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory.
///
///
@@ -363,7 +363,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
public delegate void RegionUp(GridRegion region);
- public event RegionUp OnRegionUp;
+ public event RegionUp OnRegionUp;
public class MoneyTransferArgs : EventArgs
{
@@ -2063,7 +2063,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
- }
+ }
public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
{
@@ -2105,7 +2105,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
- }
+ }
public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
int local_id, IClientAPI remote_client)
@@ -2127,6 +2127,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
- }
+ }
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 581b11c..19f8180 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
- /// viewer before child prim updates.
+ /// viewer before child prim updates.
/// The adjustment is added to child prims and subtracted from root prims, so the gap ends up
/// being double. We do it both ways so that there is a still a priority delta even if the priority is already
/// double.MinValue or double.MaxValue.
@@ -150,9 +150,9 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectPart)
{
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
- // before its scheduled update was triggered
+ // before its scheduled update was triggered
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
- entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
+ entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else
{
@@ -177,11 +177,11 @@ namespace OpenSim.Region.Framework.Scenes
// Use group position for child prims
Vector3 entityPos = entity.AbsolutePosition;
if (entity is SceneObjectPart)
- {
+ {
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
// before its scheduled update was triggered
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
- entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
+ entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else
{
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index a439eb9..838c648 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -145,7 +145,7 @@ namespace OpenSim.Region.Framework.Scenes
item.Owner, item.Name, item.ID);
return false;
- }
+ }
}
///
@@ -253,7 +253,7 @@ namespace OpenSim.Region.Framework.Scenes
// Update item with new asset
item.AssetID = asset.FullID;
if (group.UpdateInventoryItem(item))
- remoteClient.SendAgentAlertMessage("Script saved", false);
+ remoteClient.SendAgentAlertMessage("Script saved", false);
part.GetProperties(remoteClient);
@@ -1975,7 +1975,7 @@ namespace OpenSim.Region.Framework.Scenes
return null;
if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos))
- return null;
+ return null;
if (!Permissions.BypassPermissions())
{
@@ -2053,7 +2053,7 @@ namespace OpenSim.Region.Framework.Scenes
List partList = null;
lock (sog.Children)
- partList = new List(sog.Children.Values);
+ partList = new List(sog.Children.Values);
foreach (SceneObjectPart child in partList)
child.Inventory.ChangeInventoryOwner(ownerID);
@@ -2068,7 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes
List partList = null;
lock (sog.Children)
- partList = new List(sog.Children.Values);
+ partList = new List(sog.Children.Values);
foreach (SceneObjectPart child in partList)
{
@@ -2078,7 +2078,7 @@ namespace OpenSim.Region.Framework.Scenes
sog.SetOwnerId(groupID);
sog.ApplyNextOwnerPermissions();
- }
+ }
}
foreach (uint localID in localIDs)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 2f69476..7788e43 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -164,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes
List partList = null;
lock (sog.Children)
- partList = new List(sog.Children.Values);
+ partList = new List(sog.Children.Values);
foreach (SceneObjectPart part in partList)
{
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 4e80bf2..06890a0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -997,6 +997,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
return true;
- }
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 46b84bb..f8877e4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1916,7 +1916,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.ScheduleGroupForFullUpdate();
return sceneObject;
- }
+ }
///
/// Add an object into the scene that has come from storage
@@ -2009,7 +2009,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
- {
+ {
return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel);
}
@@ -2102,12 +2102,12 @@ namespace OpenSim.Region.Framework.Scenes
// group has recently been delinked from another group but that this change has not been persisted
// to the DB.
ForceSceneObjectBackup(so);
- so.DetachFromBackup();
+ so.DetachFromBackup();
m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
}
// We need to keep track of this state in case this group is still queued for further backup.
- so.IsDeleted = true;
+ so.IsDeleted = true;
return true;
}
@@ -2394,7 +2394,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence sp = GetScenePresence(userID);
if (sp != null && AttachmentsModule != null)
{
- uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
+ uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
}
@@ -2437,7 +2437,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
// Don't sent a full update here because this will cause full updates to be sent twice for
- // attachments on region crossings, resulting in viewer glitches.
+ // attachments on region crossings, resulting in viewer glitches.
AddRestoredSceneObject(sceneObject, false, false, false);
// Handle attachment special case
@@ -2681,7 +2681,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public virtual void SubscribeToClientPrimEvents(IClientAPI client)
- {
+ {
client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition;
client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
@@ -2717,7 +2717,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnUndo += m_sceneGraph.HandleUndo;
client.OnRedo += m_sceneGraph.HandleRedo;
client.OnObjectDescription += m_sceneGraph.PrimDescription;
- client.OnObjectDrop += m_sceneGraph.DropObject;
+ client.OnObjectDrop += m_sceneGraph.DropObject;
client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
client.OnObjectOwner += ObjectOwner;
}
@@ -3669,7 +3669,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{
ScenePresence presence = GetScenePresence(agentID);
- if(presence != null)
+ if (presence != null)
{
try
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index f8591ba..c71aefa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
- ///
+ ///
public void AddCommand(
object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f779a6d..5ac8ff5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -298,7 +298,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Position of the object
/// Rotation of the object
/// Velocity of the object. This parameter only has an effect if the object is physical
- ///
+ ///
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
{
@@ -322,7 +322,7 @@ namespace OpenSim.Region.Framework.Scenes
}
return true;
- }
+ }
///
/// Add an object to the scene. This will both update the scene, and send information about the
@@ -1284,7 +1284,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
- {
+ {
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
{
if (m_parentScene.AttachmentsModule != null)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4024328..4caa439 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -677,7 +677,7 @@ namespace OpenSim.Region.Framework.Scenes
minY = 256f;
minZ = 8192f;
- lock(m_parts)
+ lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
@@ -1005,7 +1005,7 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = detachedpos;
m_rootPart.AttachedAvatar = UUID.Zero;
- //Anakin Lohner bug #3839
+ //Anakin Lohner bug #3839
lock (m_parts)
{
foreach (SceneObjectPart p in m_parts.Values)
@@ -1226,7 +1226,7 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Delete this group from its scene.
+ /// Delete this group from its scene.
///
///
/// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood
@@ -1383,7 +1383,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!m_isBackedUp)
{
// m_log.DebugFormat(
-// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID);
+// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID);
return;
}
@@ -1395,7 +1395,7 @@ namespace OpenSim.Region.Framework.Scenes
}
// Since this is the top of the section of call stack for backing up a particular scene object, don't let
- // any exception propogate upwards.
+ // any exception propogate upwards.
try
{
if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart
@@ -1546,7 +1546,7 @@ namespace OpenSim.Region.Framework.Scenes
newPart.LinkNum = part.LinkNum;
}
- // Need to duplicate the physics actor as well
+ // Need to duplicate the physics actor as well
if (part.PhysActor != null && userExposed)
{
PrimitiveBaseShape pbs = part.Shape;
@@ -1562,7 +1562,7 @@ namespace OpenSim.Region.Framework.Scenes
part.PhysActor.LocalID = part.LocalId;
part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
- }
+ }
}
if (userExposed)
@@ -1838,7 +1838,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart newPart = null;
lock (m_parts)
- {
+ {
newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed);
newPart.SetParent(this);
m_parts.Add(newPart.UUID, newPart);
@@ -2337,7 +2337,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p.LinkNum > linkPart.LinkNum)
p.LinkNum--;
}
- }
+ }
}
linkPart.ParentID = 0;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 3753dcb..024bdc9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1010,12 +1010,12 @@ namespace OpenSim.Region.Framework.Scenes
return m_mediaUrl;
}
- set
- {
+ set
+ {
m_mediaUrl = value;
if (ParentGroup != null)
- ParentGroup.HasGroupChanged = true;
+ ParentGroup.HasGroupChanged = true;
}
}
@@ -1028,7 +1028,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID);
m_createSelected = value;
}
- }
+ }
#endregion
@@ -1189,7 +1189,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Property flags. See OpenMetaverse.PrimFlags
- ///
+ ///
/// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge
public PrimFlags Flags
{
@@ -1355,7 +1355,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Tell the scene presence that it should send updates for this part to its client
- ///
+ ///
public void AddFullUpdateToAvatar(ScenePresence presence)
{
presence.SceneViewer.QueuePartForUpdate(this);
@@ -1414,7 +1414,7 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
{
- if(!sp.IsChildAgent)
+ if (!sp.IsChildAgent)
sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
});
}
@@ -1659,7 +1659,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID);
- return dupe;
+ return dupe;
}
protected void AssetReceived(string id, Object sender, AssetBase asset)
@@ -1969,10 +1969,10 @@ namespace OpenSim.Region.Framework.Scenes
}
public uint GetEffectiveObjectFlags()
- {
+ {
// Commenting this section of code out since it doesn't actually do anything, as enums are handled by
// value rather than reference
-// PrimFlags f = _flags;
+// PrimFlags f = _flags;
// if (m_parentGroup == null || m_parentGroup.RootPart == this)
// f &= ~(PrimFlags.Touch | PrimFlags.Money);
@@ -4733,7 +4733,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null || ParentGroup.IsDeleted)
return;
- if (IsAttachment && ParentGroup.RootPart != this)
+ if (IsAttachment && ParentGroup.RootPart != this)
return;
// Causes this thread to dig into the Client Thread Data.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 1984d45..4affdef 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1094,7 +1094,7 @@ namespace OpenSim.Region.Framework.Scenes
item.OwnerChanged = false;
engine.ResumeScript(item.ItemID);
}
- }
+ }
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index cc9355e..177cf1e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1287,7 +1287,7 @@ namespace OpenSim.Region.Framework.Scenes
// Setting parent ID would fix this, if we knew what value
// to use. Or we could add a m_isSitting variable.
//Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
- SitGround = true;
+ SitGround = true;
}
// In the future, these values might need to go global.
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index 7aa5a93..b45291f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_pendingObjects = new Queue();
- lock(m_pendingObjects)
+ lock (m_pendingObjects)
{
EntityBase[] entities = m_presence.Scene.Entities.GetEntities();
foreach (EntityBase e in entities)
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- lock(m_pendingObjects)
+ lock (m_pendingObjects)
{
while (m_pendingObjects != null && m_pendingObjects.Count > 0)
{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index c9662ef..7d9a6a9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(dupeSo.Children.Count, Is.EqualTo(2));
SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1);
- SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2);
+ SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2);
Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId));
Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId));
@@ -84,6 +84,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(dupePart1.PhysActor, Is.Not.Null);
Assert.That(dupePart2.PhysActor, Is.Not.Null);
*/
- }
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index e3ef263..9f787c9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -270,7 +270,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
- TestScene scene = SceneSetupHelpers.SetupScene();
+ TestScene scene = SceneSetupHelpers.SetupScene();
string rootPartName = "rootpart";
UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -282,11 +282,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{ Name = rootPartName, UUID = rootPartUuid };
SceneObjectPart linkPart
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
- { Name = linkPartName, UUID = linkPartUuid };
+ { Name = linkPartName, UUID = linkPartUuid };
SceneObjectGroup sog = new SceneObjectGroup(rootPart);
- sog.AddPart(linkPart);
- scene.AddNewSceneObject(sog, true);
+ sog.AddPart(linkPart);
+ scene.AddNewSceneObject(sog, true);
// In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
// scene backup thread.
@@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
- TestScene scene = SceneSetupHelpers.SetupScene();
+ TestScene scene = SceneSetupHelpers.SetupScene();
string rootPartName = "rootpart";
UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -321,11 +321,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{ Name = rootPartName, UUID = rootPartUuid };
SceneObjectPart linkPart
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
- { Name = linkPartName, UUID = linkPartUuid };
+ { Name = linkPartName, UUID = linkPartUuid };
SceneObjectGroup sog = new SceneObjectGroup(rootPart);
- sog.AddPart(linkPart);
- scene.AddNewSceneObject(sog, true);
+ sog.AddPart(linkPart);
+ scene.AddNewSceneObject(sog, true);
// In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
// scene backup thread.
@@ -333,7 +333,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// These changes should occur immediately without waiting for a backup pass
SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
- scene.DeleteSceneObject(groupToDelete, false);
+ scene.DeleteSceneObject(groupToDelete, false);
List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 5e491c2..fe59d4f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -59,8 +59,8 @@ namespace OpenSim.Region.Framework.Tests
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
- UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
- return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
+ UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
+ return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
}
protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId)
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Tests
SceneObjectPart part1
= new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = part1Name, UUID = part1Id };
- return new SceneObjectGroup(part1);
+ return new SceneObjectGroup(part1);
}
protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part)
@@ -79,7 +79,7 @@ namespace OpenSim.Region.Framework.Tests
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
- UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
+ UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
scene.AssetService.Store(ncAsset);
@@ -114,9 +114,9 @@ namespace OpenSim.Region.Framework.Tests
scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID);
InventoryItemBase ncUserItem
- = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem");
+ = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem");
Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found");
- }
+ }
///
/// Test MoveTaskInventoryItem where the item has no parent folder assigned.
@@ -138,7 +138,7 @@ namespace OpenSim.Region.Framework.Tests
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);
InventoryItemBase ncUserItem
- = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem");
+ = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem");
Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found");
}
}
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 2969503..6f044e0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -962,7 +962,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if ((groupInfo == null) || (account == null))
{
return;
- }
+ }
// Send Message to Ejectee
GridInstantMessage msg = new GridInstantMessage();
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 9363205..0d265f2 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -91,11 +91,11 @@ using OpenSim.Services.Interfaces;
* + RoleID
*
* GroupID -> GroupNotice -> NoticeID
- * + TimeStamp [uint]
- * + FromName [string]
- * + Subject [string]
- * + Message [string]
- * + BinaryBucket [byte[]]
+ * + TimeStamp [uint]
+ * + FromName [string]
+ * + Subject [string]
+ * + Message [string]
+ * + BinaryBucket [byte[]]
*
* */
@@ -309,7 +309,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
GroupInfoMap["OwnerRoleID"] = OSD.FromUUID(OwnerRoleID);
GroupInfoMap["OwnersPowers"] = OSD.FromULong((ulong)m_DefaultOwnerPowers);
- if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap))
+ if (SimianAddGeneric(GroupID, "Group", name, GroupInfoMap))
{
AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers);
AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers);
@@ -334,7 +334,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
string GroupName;
OSDMap GroupInfoMap;
- if( SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap) )
+ if (SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap))
{
GroupInfoMap["Charter"] = OSD.FromString(charter);
GroupInfoMap["ShowInList"] = OSD.FromBoolean(showInList);
@@ -379,7 +379,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
string GroupRoleMemberType = "GroupRole" + groupID.ToString();
if (SimianGetGenericEntries(GroupRoleMemberType, roleID.ToString(), out GroupRoleMembers))
{
- foreach(UUID UserID in GroupRoleMembers.Keys)
+ foreach (UUID UserID in GroupRoleMembers.Keys)
{
EnsureRoleNotSelectedByMember(groupID, roleID, UserID);
@@ -724,7 +724,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
OSDMap UserGroupMemberInfo;
- if( SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo) )
+ if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo))
{
data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean();
data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger();
@@ -736,7 +736,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
//
OSDMap GroupRoleInfo;
- if( SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo) )
+ if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo))
{
data.GroupTitle = GroupRoleInfo["Title"].AsString();
data.GroupPowers = GroupRoleInfo["Powers"].AsULong();
@@ -748,7 +748,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
//
OSDMap GroupInfo;
string GroupName;
- if( SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo) )
+ if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo))
{
data.GroupID = groupID;
data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean();
@@ -928,12 +928,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
Dictionary GroupRoles;
if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles))
{
- foreach( KeyValuePair Role in GroupRoles )
+ foreach (KeyValuePair Role in GroupRoles)
{
Dictionary GroupRoleMembers;
- if( SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers) )
+ if (SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers))
{
- foreach( KeyValuePair GroupRoleMember in GroupRoleMembers )
+ foreach (KeyValuePair GroupRoleMember in GroupRoleMembers)
{
GroupRoleMembersData data = new GroupRoleMembersData();
@@ -1264,7 +1264,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
}
- if(maps.Count == 0)
+ if (maps.Count == 0)
{
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
}
@@ -1352,17 +1352,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
// Check if this is an update or a request
- if ( requestArgs["RequestMethod"] == "RemoveGeneric"
- || requestArgs["RequestMethod"] == "AddGeneric"
- )
-
+ if (requestArgs["RequestMethod"] == "RemoveGeneric"
+ || requestArgs["RequestMethod"] == "AddGeneric")
{
// Any and all updates cause the cache to clear
m_memoryCache.Clear();
// Send update to server, return the response without caching it
return WebUtil.PostToService(m_groupsServerURI, requestArgs);
-
}
// If we're not doing an update, we must be requesting data
@@ -1372,7 +1369,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
OSDMap response = null;
if (!m_memoryCache.TryGetValue(CacheKey, out response))
{
- // if it wasn't in the cache, pass the request to the Simian Grid Services
+ // if it wasn't in the cache, pass the request to the Simian Grid Services
response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
// and cache the response
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 79b9a16..a88c5e2 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -960,7 +960,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
- if( resp == null )
+ if (resp == null)
{
string UserService;
UUID SessionID;
@@ -1065,7 +1065,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
///
/// Group Request Tokens are an attempt to allow the groups service to authenticate
- /// requests.
+ /// requests.
/// TODO: This broke after the big grid refactor, either find a better way, or discard this
///
///
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
index 796f437..d7838c5 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
@@ -161,7 +161,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
//finalize
m_Entity.RootPart.PhysActor = null;
- m_Entity.Children = parts;
+ m_Entity.Children = parts;
}
}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index c439e3e..59ad9d8 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -432,7 +432,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
return;
}
- foreach(string button in buttons)
+ foreach (string button in buttons)
{
if (button == String.Empty)
{
@@ -448,7 +448,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
dm.SendDialogToUser(
avatar, GetSOP().Name, GetSOP().UUID, GetSOP().OwnerID,
- message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons);
+ message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons);
}
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
index 61cbb90..cc51c3b 100644
--- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
+++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
@@ -824,5 +824,5 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
RegionMoneyRequest = 1,
Gift = 2,
Purchase = 3
- }
+ }
}
\ No newline at end of file
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
index a0d6197..f424e7f 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.RegionCombinerModule
public void ClientConnect(IClientAPI client)
{
m_virtScene.UnSubscribeToClientPrimEvents(client);
- m_virtScene.UnSubscribeToClientPrimRezEvents(client);
+ m_virtScene.UnSubscribeToClientPrimRezEvents(client);
m_virtScene.UnSubscribeToClientInventoryEvents(client);
((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
//m_virtScene.UnSubscribeToClientTeleportEvents(client);
@@ -66,7 +66,7 @@ namespace OpenSim.Region.RegionCombinerModule
client.OnRezObject += LocalRezObject;
m_rootScene.SubscribeToClientInventoryEvents(client);
- ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
+ ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
//m_rootScene.SubscribeToClientTeleportEvents(client);
m_rootScene.SubscribeToClientScriptEvents(client);
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
index 33ff707..be5411a 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
@@ -118,7 +118,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel
return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
}
}
-
+
ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
obj.LandData.Name = "NO LAND";
return obj;
@@ -142,14 +142,14 @@ public class RegionCombinerLargeLandChannel : ILandChannel
public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
{
- RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id);
+ RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id);
}
public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
{
RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id);
}
-
+
public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
{
RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a9c5d10..0692fdb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7977,7 +7977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Integer((int)me.ControlPermissions));
break;
}
- }
+ }
return res;
}
@@ -7993,7 +7993,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
return ScriptBaseClass.LSL_STATUS_OK;
- return SetPrimMediaParams(face, rules);
+ return SetPrimMediaParams(face, rules);
}
private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
@@ -8082,7 +8082,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
break;
}
- }
+ }
module.SetMediaEntry(m_host, face, me);
@@ -8102,7 +8102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface();
if (null == module)
- throw new Exception("Media on a prim functions not available");
+ throw new Exception("Media on a prim functions not available");
module.ClearMediaEntry(m_host, face);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a529a94..477c52d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1190,7 +1190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.LandChannel.Join(startx,starty,endx,endy,m_host.OwnerID);
}
-
+
public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2)
{
CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide");
@@ -1213,7 +1213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// can modify it
ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y);
- if (startLandObject == null)
+ if (startLandObject == null)
{
OSSLShoutError("There is no land at that location");
return;
@@ -1230,7 +1230,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID uuid;
// Process the rules, not sure what the impact would be of changing owner or group
- for (int idx = 0; idx < rules.Length; )
+ for (int idx = 0; idx < rules.Length;)
{
int code = rules.GetLSLIntegerItem(idx++);
string arg = rules.GetLSLStringItem(idx++);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 2b67e84..fefbb35 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -416,7 +416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
List sensedEntities = new List();
// If nobody about quit fast
- if(m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0)
+ if (m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0)
return sensedEntities;
SceneObjectPart SensePoint = ts.host;
@@ -485,7 +485,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
{
ScenePresence sp;
// Try direct lookup by UUID
- if(!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp))
+ if (!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp))
return sensedEntities;
senseEntity(sp);
}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 8102acd..427d4e5 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -564,7 +564,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
bool postOnRez = (bool)p[4];
StateSource stateSource = (StateSource)p[5];
- lock(m_CompileDict)
+ lock (m_CompileDict)
{
if (!m_CompileDict.ContainsKey(itemID))
return false;
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index e7a8294..f4472c7 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Server.Base
///
///
/// The arguments which control which constructor is invoked on the plugin
- ///
+ ///
public static T LoadPlugin(string dllName, Object[] args) where T:class
{
string[] parts = dllName.Split(new char[] {':'});
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index f5b5982..479a80e 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
- string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" );
+ string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/");
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
XmlRpcResponse response = null;
try
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index e25e7eb..403ee15 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -526,7 +526,7 @@ namespace OpenSim.Services.Connectors
InventoryFolderBase folder = new InventoryFolderBase();
try
- {
+ {
folder.ParentID = new UUID(data["ParentID"].ToString());
folder.Type = short.Parse(data["Type"].ToString());
folder.Version = ushort.Parse(data["Version"].ToString());
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index 86bca79..e543337 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -276,11 +276,11 @@ namespace OpenSim.Services.InventoryService
List folders = RequestSubFolders(root.ID);
foreach (InventoryFolderBase folder in folders)
- {
+ {
if (folder.Type == (short)type)
{
// m_log.DebugFormat(
-// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type);
+// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type);
return folder;
}
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 3f9bc19..d30c149 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -308,7 +308,7 @@ namespace OpenSim.Services.LLLoginService
{
// something went wrong, make something up, so that we don't have to test this anywhere else
guinfo = new GridUserInfo();
- guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30);
+ guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30);
}
//
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 65c247f..f376cf8 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -97,10 +97,10 @@ namespace OpenSim.Services.UserAccountService
public UserAccount GetUserAccount(UUID scopeID, string firstName,
string lastName)
{
-// m_log.DebugFormat(
-// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}",
-// firstName, lastName, scopeID);
-
+// m_log.DebugFormat(
+// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}",
+// firstName, lastName, scopeID);
+
UserAccountData[] d;
if (scopeID != UUID.Zero)
@@ -235,10 +235,10 @@ namespace OpenSim.Services.UserAccountService
public bool StoreUserAccount(UserAccount data)
{
-// m_log.DebugFormat(
-// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}",
-// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID);
-
+// m_log.DebugFormat(
+// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}",
+// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID);
+
UserAccountData d = new UserAccountData();
d.FirstName = data.FirstName;
@@ -285,7 +285,7 @@ namespace OpenSim.Services.UserAccountService
#endregion
#region Console commands
-
+
///
/// Handle the create user command from the console.
///
@@ -296,7 +296,7 @@ namespace OpenSim.Services.UserAccountService
string lastName;
string password;
string email;
-
+
List excluded = new List(new char[]{' '});
if (cmdparams.Length < 3)
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
index 315d405..f453a4b 100644
--- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Data.Null
}
public void RemoveObject(UUID obj, UUID regionUUID)
- {
+ {
// All parts belonging to the object with the uuid are removed.
List parts = new List(m_sceneObjectParts.Values);
foreach (SceneObjectPart part in parts)
@@ -108,7 +108,7 @@ namespace OpenSim.Data.Null
{
m_log.DebugFormat(
"[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}",
- part.Name, part.UUID, obj, regionUUID);
+ part.Name, part.UUID, obj, regionUUID);
m_sceneObjectParts.Remove(part.UUID);
}
}
@@ -129,7 +129,7 @@ namespace OpenSim.Data.Null
if (prim.IsRoot)
{
m_log.DebugFormat(
- "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID);
+ "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID);
objects[prim.UUID] = new SceneObjectGroup(prim);
}
}
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 615e519..13f364b 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -69,6 +69,6 @@ namespace OpenSim.Tests.Common.Mock
public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter
{
get { return m_asyncSceneObjectDeleter; }
- }
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index f9a80b0..8647cfe 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -54,8 +54,8 @@ namespace OpenSim.Tests.Common
{
AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
scene.AssetService.Store(asset);
- return asset;
- }
+ return asset;
+ }
///
/// Create an asset from the given scene object.
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 9318a27..889389b 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Tests.Common.Setup
public class SceneSetupHelpers
{
// These static variables in order to allow regions to be linked by shared modules and same
- // CommunicationsManager.
+ // CommunicationsManager.
private static ISharedRegionModule m_assetService = null;
// private static ISharedRegionModule m_authenticationService = null;
private static ISharedRegionModule m_inventoryService = null;
@@ -69,19 +69,19 @@ namespace OpenSim.Tests.Common.Setup
///
/// Set up a test scene
///
- ///
+ ///
/// Automatically starts service threads, as would the normal runtime.
- ///
+ ///
///
public static TestScene SetupScene()
{
return SetupScene("");
}
-
+
///
/// Set up a test scene
///
- ///
+ ///
/// Starts real inventory and asset services, as opposed to mock ones, if true
///
public static TestScene SetupScene(String realServices)
@@ -94,7 +94,7 @@ namespace OpenSim.Tests.Common.Setup
/////
///// Set up a test scene
/////
- /////
+ /////
///// Starts real inventory and asset services, as opposed to mock ones, if true
///// This should be the same if simulating two scenes within a standalone
/////
@@ -167,13 +167,13 @@ namespace OpenSim.Tests.Common.Setup
capsModule.Initialise(new IniConfigSource());
testScene.AddRegionModule(capsModule.Name, capsModule);
capsModule.AddRegion(testScene);
-
+
IRegionModule godsModule = new GodsModule();
godsModule.Initialise(testScene, new IniConfigSource());
testScene.AddModule(godsModule.Name, godsModule);
realServices = realServices.ToLower();
// IConfigSource config = new IniConfigSource();
-
+
// If we have a brand new scene, need to initialize shared region modules
if ((m_assetService == null && m_inventoryService == null) || newScene)
{
@@ -184,13 +184,13 @@ namespace OpenSim.Tests.Common.Setup
// For now, always started a 'real' authentication service
StartAuthenticationService(testScene, true);
-
+
if (realServices.Contains("inventory"))
StartInventoryService(testScene, true);
else
StartInventoryService(testScene, false);
-
- StartGridService(testScene, true);
+
+ StartGridService(testScene, true);
StartUserAccountService(testScene);
StartPresenceService(testScene);
}
@@ -207,7 +207,7 @@ namespace OpenSim.Tests.Common.Setup
m_presenceService.RegionLoaded(testScene);
}
-
+
m_inventoryService.PostInitialise();
m_assetService.PostInitialise();
m_userAccountService.PostInitialise();
@@ -250,7 +250,7 @@ namespace OpenSim.Tests.Common.Setup
else
config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
- assetService.Initialise(config);
+ assetService.Initialise(config);
assetService.AddRegion(testScene);
assetService.RegionLoaded(testScene);
testScene.AddRegionModule(assetService.Name, assetService);
@@ -277,7 +277,7 @@ namespace OpenSim.Tests.Common.Setup
testScene.AddRegionModule(service.Name, service);
//m_authenticationService = service;
}
-
+
private static void StartInventoryService(Scene testScene, bool real)
{
ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
@@ -285,7 +285,7 @@ namespace OpenSim.Tests.Common.Setup
config.AddConfig("Modules");
config.AddConfig("InventoryService");
config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
-
+
if (real)
{
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
@@ -294,7 +294,7 @@ namespace OpenSim.Tests.Common.Setup
{
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService");
}
-
+
config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
inventoryService.Initialise(config);
inventoryService.AddRegion(testScene);
@@ -338,14 +338,14 @@ namespace OpenSim.Tests.Common.Setup
config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
config.Configs["UserAccountService"].Set(
"LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
-
+
if (m_userAccountService == null)
{
ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
userAccountService.Initialise(config);
m_userAccountService = userAccountService;
}
-
+
m_userAccountService.AddRegion(testScene);
m_userAccountService.RegionLoaded(testScene);
testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
@@ -559,5 +559,4 @@ namespace OpenSim.Tests.Common.Setup
sogd.InventoryDeQueueAndDelete();
}
}
-
}
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
index 915af7e..135c50e 100644
--- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common
public static InventoryItemBase CreateInventoryItem(
Scene scene, string itemName, UUID itemId, string folderPath, UUID userId)
- {
+ {
InventoryItemBase item = new InventoryItemBase();
item.Name = itemName;
item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID;
@@ -52,7 +52,7 @@ namespace OpenSim.Tests.Common
InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
item.Folder = objsFolder.ID;
- scene.AddInventoryItem(item);
+ scene.AddInventoryItem(item);
return item;
}
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index 26156f3..d01521d 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Tests.Common.Setup
// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
// return CreateUserWithInventory(commsManager, userId, callback);
// }
-//
+//
// ///
// /// Create a test user with a standard inventory
// ///
@@ -108,11 +108,11 @@ namespace OpenSim.Tests.Common.Setup
// {
// LocalUserServices lus = (LocalUserServices)commsManager.UserService;
// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
-//
+//
// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
// userInfo.OnInventoryReceived += callback;
// userInfo.FetchInventory();
-//
+//
// return userInfo;
// }
@@ -140,6 +140,6 @@ namespace OpenSim.Tests.Common.Setup
scene.UserAccountService.StoreUserAccount(ua);
scene.InventoryService.CreateUserInventory(ua.PrincipalID);
scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
- }
+ }
}
}
\ No newline at end of file
--
cgit v1.1
From 0db1ed0b5a6f5bd104c6008f142d173c84263ce5 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sun, 12 Sep 2010 14:20:26 -0700
Subject: * Added ISimulationDataService and IEstateDataService * Removed
StorageManager * CONFIG CHANGE: There are no more database settings in
OpenSim.ini. Check the config-include configuration files for region store
and estate store database settings
---
.../RemoteController/RemoteAdminPlugin.cs | 12 +-
OpenSim/Data/MSSQL/MSSQLEstateData.cs | 9 ++
OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 10 ++
OpenSim/Data/MySQL/MySQLEstateData.cs | 9 ++
OpenSim/Data/MySQL/MySQLSimulationData.cs | 9 ++
OpenSim/Data/SQLite/SQLiteEstateData.cs | 9 ++
OpenSim/Data/SQLite/SQLiteSimulationData.cs | 9 ++
OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs | 9 ++
OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs | 9 ++
OpenSim/Framework/ConfigSettings.cs | 16 ---
OpenSim/Region/Application/ConfigurationLoader.cs | 4 -
OpenSim/Region/Application/OpenSimBase.cs | 56 +++++----
.../Region/ClientStack/RegionApplicationBase.cs | 33 ++---
.../Framework/Interfaces/IEntityInventory.cs | 2 +-
.../Framework/Interfaces/IEstateDataService.cs | 45 +++++++
OpenSim/Region/Framework/Scenes/EventManager.cs | 4 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 102 ++++++++++-----
.../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
.../Framework/Scenes/SceneObjectPartInventory.cs | 2 +-
.../Scenes/Tests/SceneObjectLinkingTests.cs | 4 +-
OpenSim/Region/Framework/StorageManager.cs | 80 ------------
.../Connectors/Simulation/EstateDataService.cs | 112 +++++++++++++++++
.../Connectors/Simulation/SimulationDataService.cs | 140 +++++++++++++++++++++
.../Simulation/SimulationDataServiceConnector.cs | 125 ------------------
OpenSim/Tests/Common/Mock/TestScene.cs | 10 +-
OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 5 +-
26 files changed, 502 insertions(+), 325 deletions(-)
create mode 100644 OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
delete mode 100644 OpenSim/Region/Framework/StorageManager.cs
create mode 100644 OpenSim/Services/Connectors/Simulation/EstateDataService.cs
create mode 100644 OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
delete mode 100644 OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs
(limited to 'OpenSim')
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 4b5710a..bb0a5b5 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -638,7 +638,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Set the estate
// Check for an existing estate
- List estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]);
+ List estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]);
if (estateIDs.Count < 1)
{
UUID userID = UUID.Zero;
@@ -666,7 +666,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
// Create a new estate with the name provided
- region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true);
+ region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, true);
region.EstateSettings.EstateName = (string) requestData["estate_name"];
region.EstateSettings.EstateOwner = userID;
@@ -676,10 +676,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
else
{
int estateID = estateIDs[0];
-
- region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID);
-
- if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID))
+
+ region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID);
+
+ if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID))
throw new Exception("Failed to join estate.");
}
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
index 80bf106..e9a0935 100644
--- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
@@ -50,6 +50,15 @@ namespace OpenSim.Data.MSSQL
#region Public methods
+ public MSSQLEstateStore()
+ {
+ }
+
+ public MSSQLEstateStore(string connectionString)
+ {
+ Initialise(connectionString);
+ }
+
///
/// Initialises the estatedata class.
///
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index ae105d5..8532af4 100644
--- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -55,6 +55,16 @@ namespace OpenSim.Data.MSSQL
///
private MSSQLManager _Database;
private string m_connectionString;
+
+ public MSSQLSimulationData()
+ {
+ }
+
+ public MSSQLSimulationData(string connectionString)
+ {
+ Initialise(connectionString);
+ }
+
///
/// Initialises the region datastore
///
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index 9158f7a..c42c687 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -54,6 +54,15 @@ namespace OpenSim.Data.MySQL
private Dictionary m_FieldMap =
new Dictionary();
+ public MySQLEstateStore()
+ {
+ }
+
+ public MySQLEstateStore(string connectionString)
+ {
+ Initialise(connectionString);
+ }
+
public void Initialise(string connectionString)
{
m_connectionString = connectionString;
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 36f73ef..ac752f6 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -52,6 +52,15 @@ namespace OpenSim.Data.MySQL
private string m_connectionString;
private object m_dbLock = new object();
+ public MySQLSimulationData()
+ {
+ }
+
+ public MySQLSimulationData(string connectionString)
+ {
+ Initialise(connectionString);
+ }
+
public void Initialise(string connectionString)
{
m_connectionString = connectionString;
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index fcf041e..d1d67eb 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLite
private Dictionary m_FieldMap =
new Dictionary();
+ public SQLiteEstateStore()
+ {
+ }
+
+ public SQLiteEstateStore(string connectionString)
+ {
+ Initialise(connectionString);
+ }
+
public void Initialise(string connectionString)
{
m_connectionString = connectionString;
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 1820f78..7e62e84 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -70,6 +70,15 @@ namespace OpenSim.Data.SQLite
private String m_connectionString;
+ public SQLiteSimulationData()
+ {
+ }
+
+ public SQLiteSimulationData(string connectionString)
+ {
+ Initialise(connectionString);
+ }
+
// Temporary attribute while this is experimental
/***********************************************************************
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
index bf8ee14..547ea6b 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
@@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLiteLegacy
private Dictionary m_FieldMap =
new Dictionary();
+ public SQLiteEstateStore()
+ {
+ }
+
+ public SQLiteEstateStore(string connectionString)
+ {
+ Initialise(connectionString);
+ }
+
public void Initialise(string connectionString)
{
m_connectionString = connectionString;
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
index e9c6aa5..2dde926 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
@@ -69,6 +69,15 @@ namespace OpenSim.Data.SQLiteLegacy
private String m_connectionString;
+ public SQLiteSimulationData()
+ {
+ }
+
+ public SQLiteSimulationData(string connectionString)
+ {
+ Initialise(connectionString);
+ }
+
// Temporary attribute while this is experimental
/***********************************************************************
diff --git a/OpenSim/Framework/ConfigSettings.cs b/OpenSim/Framework/ConfigSettings.cs
index 8feaa37..be77341 100644
--- a/OpenSim/Framework/ConfigSettings.cs
+++ b/OpenSim/Framework/ConfigSettings.cs
@@ -124,22 +124,6 @@ namespace OpenSim.Framework
set { m_standaloneUserSource = value; }
}
- protected string m_storageConnectionString;
-
- public string StorageConnectionString
- {
- get { return m_storageConnectionString; }
- set { m_storageConnectionString = value; }
- }
-
- protected string m_estateConnectionString;
-
- public string EstateConnectionString
- {
- get { return m_estateConnectionString; }
- set { m_estateConnectionString = value; }
- }
-
protected string m_librariesXMLFile;
public string LibrariesXMLFile
{
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index e69e3fc..e2e0640 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -345,10 +345,6 @@ namespace OpenSim
m_configSettings.StorageDll = startupConfig.GetString("storage_plugin");
- m_configSettings.StorageConnectionString
- = startupConfig.GetString("storage_connection_string");
- m_configSettings.EstateConnectionString
- = startupConfig.GetString("estate_connection_string", m_configSettings.StorageConnectionString);
m_configSettings.ClientstackDll
= startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
}
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index d2d2607..74ad168 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager;
+using OpenSim.Server.Base;
namespace OpenSim
{
@@ -186,6 +187,24 @@ namespace OpenSim
userStatsURI = startupConfig.GetString("Stats_URI", String.Empty);
}
+ // Load the simulation data service
+ IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"];
+ if (simDataConfig == null)
+ throw new Exception("Configuration file is missing the [SimulationDataStore] section");
+ string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
+ if (String.IsNullOrEmpty(module))
+ throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section");
+ m_simulationDataService = ServerUtils.LoadPlugin(module, new object[] { m_config.Source });
+
+ // Load the estate data service
+ IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"];
+ if (estateDataConfig == null)
+ throw new Exception("Configuration file is missing the [EstateDataStore] section");
+ module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
+ if (String.IsNullOrEmpty(module))
+ throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
+ m_estateDataService = ServerUtils.LoadPlugin(module, new object[] { m_config.Source });
+
base.StartupSpecific();
m_stats = StatsManager.StartCollectingSimExtraStats();
@@ -536,7 +555,7 @@ namespace OpenSim
regionInfo.InternalEndPoint.Port = (int) port;
- Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
+ Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager);
if (m_autoCreateClientStack)
{
@@ -552,30 +571,19 @@ namespace OpenSim
return scene;
}
- protected override StorageManager CreateStorageManager()
- {
- return
- CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);
- }
-
- protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
- {
- return new StorageManager(m_configSettings.StorageDll, connectionstring, estateconnectionstring);
- }
-
protected override ClientStackManager CreateClientStackManager()
{
return new ClientStackManager(m_configSettings.ClientstackDll);
}
- protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
- AgentCircuitManager circuitManager)
+ protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService,
+ IEstateDataService estateDataService, AgentCircuitManager circuitManager)
{
SceneCommunicationService sceneGridService = new SceneCommunicationService();
return new Scene(
regionInfo, circuitManager, sceneGridService,
- storageManager, m_moduleLoader, false, m_configSettings.PhysicalPrim,
+ simDataService, estateDataService, m_moduleLoader, false, m_configSettings.PhysicalPrim,
m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
}
@@ -792,21 +800,23 @@ namespace OpenSim
///
public void PopulateRegionEstateInfo(RegionInfo regInfo)
{
- if (m_storageManager.EstateDataStore != null)
+ IEstateDataService estateDataService = EstateDataService;
+
+ if (estateDataService != null)
{
- regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, false);
+ regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false);
}
-
+
if (regInfo.EstateSettings.EstateID == 0) // No record at all
{
MainConsole.Instance.Output("Your region is not part of an estate.");
while (true)
{
- string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() {"yes", "no"});
+ string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() { "yes", "no" });
if (response == "no")
{
// Create a new estate
- regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, true);
+ regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
//regInfo.EstateSettings.Save();
@@ -818,7 +828,7 @@ namespace OpenSim
if (response == "None")
continue;
- List estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
+ List estateIDs = estateDataService.GetEstates(response);
if (estateIDs.Count < 1)
{
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
@@ -827,9 +837,9 @@ namespace OpenSim
int estateID = estateIDs[0];
- regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID);
+ regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID);
- if (m_storageManager.EstateDataStore.LinkRegion(regInfo.RegionID, estateID))
+ if (estateDataService.LinkRegion(regInfo.RegionID, estateID))
break;
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 46b68ec..ea1317a 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework;
+using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager;
@@ -48,28 +49,16 @@ namespace OpenSim.Region.ClientStack
protected Dictionary m_clientCircuits = new Dictionary();
protected NetworkServersInfo m_networkServersInfo;
-
- public NetworkServersInfo NetServersInfo
- {
- get { return m_networkServersInfo; }
- }
-
protected uint m_httpServerPort;
-
- protected StorageManager m_storageManager;
-
- public StorageManager StorageManager
- {
- get { return m_storageManager; }
- }
-
+ protected ISimulationDataService m_simulationDataService;
+ protected IEstateDataService m_estateDataService;
protected ClientStackManager m_clientStackManager;
-
- public SceneManager SceneManager
- {
- get { return m_sceneManager; }
- }
protected SceneManager m_sceneManager = new SceneManager();
+
+ public SceneManager SceneManager { get { return m_sceneManager; } }
+ public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } }
+ public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } }
+ public IEstateDataService EstateDataService { get { return m_estateDataService; } }
protected abstract void Initialize();
@@ -83,15 +72,11 @@ namespace OpenSim.Region.ClientStack
///
protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier);
- protected abstract StorageManager CreateStorageManager();
protected abstract ClientStackManager CreateClientStackManager();
- protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
- AgentCircuitManager circuitManager);
+ protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
protected override void StartupSpecific()
{
- m_storageManager = CreateStorageManager();
-
m_clientStackManager = CreateClientStackManager();
Initialize();
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 54845fd..7edb43e 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// Backup the inventory to the given data store
///
///
- void ProcessInventoryBackup(ISimulationDataStore datastore);
+ void ProcessInventoryBackup(ISimulationDataService datastore);
uint MaskEffectivePermissions();
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
new file mode 100644
index 0000000..95c9659
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
@@ -0,0 +1,45 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using OpenSim.Framework;
+using OpenMetaverse;
+
+namespace OpenSim.Region.Framework.Interfaces
+{
+ public interface IEstateDataService
+ {
+ EstateSettings LoadEstateSettings(UUID regionID, bool create);
+ EstateSettings LoadEstateSettings(int estateID);
+ void StoreEstateSettings(EstateSettings es);
+ List GetEstates(string search);
+ bool LinkRegion(UUID regionID, int estateID);
+ List GetRegions(int estateID);
+ bool DeleteEstate(int estateID);
+ }
+}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 6b2e03e..72b8de8 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Scenes
public event OnTerrainTickDelegate OnTerrainTick;
- public delegate void OnBackupDelegate(ISimulationDataStore datastore, bool forceBackup);
+ public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
public event OnBackupDelegate OnBackup;
@@ -684,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void TriggerOnBackup(ISimulationDataStore dstore, bool forced)
+ public void TriggerOnBackup(ISimulationDataService dstore, bool forced)
{
OnBackupDelegate handlerOnAttach = OnBackup;
if (handlerOnAttach != null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 46b84bb..9a9ef5f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -100,10 +100,11 @@ namespace OpenSim.Region.Framework.Scenes
protected List m_neighbours = new List();
protected string m_simulatorVersion = "OpenSimulator Server";
protected ModuleLoader m_moduleLoader;
- protected StorageManager m_storageManager;
protected AgentCircuitManager m_authenticateHandler;
protected SceneCommunicationService m_sceneGridService;
+ protected ISimulationDataService m_SimulationDataService;
+ protected IEstateDataService m_EstateDataService;
protected IAssetService m_AssetService;
protected IAuthorizationService m_AuthorizationService;
protected IInventoryService m_InventoryService;
@@ -216,6 +217,42 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGridService; }
}
+ public ISimulationDataService SimulationDataService
+ {
+ get
+ {
+ if (m_SimulationDataService == null)
+ {
+ m_SimulationDataService = RequestModuleInterface();
+
+ if (m_SimulationDataService == null)
+ {
+ throw new Exception("No ISimulationDataService available.");
+ }
+ }
+
+ return m_SimulationDataService;
+ }
+ }
+
+ public IEstateDataService EstateDataService
+ {
+ get
+ {
+ if (m_EstateDataService == null)
+ {
+ m_EstateDataService = RequestModuleInterface();
+
+ if (m_EstateDataService == null)
+ {
+ throw new Exception("No IEstateDataService available.");
+ }
+ }
+
+ return m_EstateDataService;
+ }
+ }
+
public IAssetService AssetService
{
get
@@ -468,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes
public Scene(RegionInfo regInfo, AgentCircuitManager authen,
SceneCommunicationService sceneGridService,
- StorageManager storeManager,
+ ISimulationDataService simDataService, IEstateDataService estateDataService,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
{
@@ -504,7 +541,8 @@ namespace OpenSim.Region.Framework.Scenes
m_moduleLoader = moduleLoader;
m_authenticateHandler = authen;
m_sceneGridService = sceneGridService;
- m_storageManager = storeManager;
+ m_SimulationDataService = simDataService;
+ m_EstateDataService = estateDataService;
m_regInfo = regInfo;
m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName;
@@ -523,11 +561,9 @@ namespace OpenSim.Region.Framework.Scenes
#region Region Settings
// Load region settings
- m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
- if (m_storageManager.EstateDataStore != null)
- {
- m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
- }
+ m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
+ if (estateDataService != null)
+ m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
#endregion Region Settings
@@ -537,9 +573,9 @@ namespace OpenSim.Region.Framework.Scenes
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
- new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
+ new EventManager.LandObjectAdded(simDataService.StoreLandObject);
EventManager.OnLandObjectRemoved +=
- new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
+ new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
m_sceneGraph = new SceneGraph(this, m_regInfo);
@@ -1085,7 +1121,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
{
- ((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false);
+ ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
}
}
@@ -1526,7 +1562,7 @@ namespace OpenSim.Region.Framework.Scenes
{
lock (m_returns)
{
- EventManager.TriggerOnBackup(m_storageManager.DataStore, forced);
+ EventManager.TriggerOnBackup(SimulationDataService, forced);
m_backingup = false;
foreach (KeyValuePair ret in m_returns)
@@ -1567,7 +1603,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (group != null)
{
- group.ProcessBackup(m_storageManager.DataStore, true);
+ group.ProcessBackup(SimulationDataService, true);
}
}
@@ -1609,19 +1645,19 @@ namespace OpenSim.Region.Framework.Scenes
///
public void SaveTerrain()
{
- m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
+ SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
public void StoreWindlightProfile(RegionLightShareData wl)
{
m_regInfo.WindlightSettings = wl;
- m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
+ SimulationDataService.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
public void LoadWindlightProfile()
{
- m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID);
+ m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
@@ -1632,13 +1668,13 @@ namespace OpenSim.Region.Framework.Scenes
{
try
{
- double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID);
+ double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
if (map == null)
{
m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
Heightmap = new TerrainChannel();
- m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
+ SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
else
{
@@ -1655,7 +1691,7 @@ namespace OpenSim.Region.Framework.Scenes
{
Heightmap = new TerrainChannel();
- m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
+ SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
}
catch (Exception e)
@@ -1702,7 +1738,7 @@ namespace OpenSim.Region.Framework.Scenes
public void loadAllLandObjectsFromStorage(UUID regionID)
{
m_log.Info("[SCENE]: Loading land objects from storage");
- List landData = m_storageManager.DataStore.LoadLandObjects(regionID);
+ List landData = SimulationDataService.LoadLandObjects(regionID);
if (LandChannel != null)
{
@@ -1733,7 +1769,7 @@ namespace OpenSim.Region.Framework.Scenes
LoadingPrims = true;
m_log.Info("[SCENE]: Loading objects from datastore");
- List PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID);
+ List PrimsFromDB = SimulationDataService.LoadObjects(regionID);
m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore");
@@ -2102,12 +2138,12 @@ namespace OpenSim.Region.Framework.Scenes
// group has recently been delinked from another group but that this change has not been persisted
// to the DB.
ForceSceneObjectBackup(so);
- so.DetachFromBackup();
- m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
+ so.DetachFromBackup();
+ SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
}
// We need to keep track of this state in case this group is still queued for further backup.
- so.IsDeleted = true;
+ so.IsDeleted = true;
return true;
}
@@ -4408,7 +4444,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteFromStorage(UUID uuid)
{
- m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID);
+ SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID);
}
public int GetHealth()
@@ -4817,17 +4853,21 @@ namespace OpenSim.Region.Framework.Scenes
public List GetEstateRegions(int estateID)
{
- if (m_storageManager.EstateDataStore == null)
- return new List();
+ IEstateDataService estateDataService = EstateDataService;
+ if (estateDataService == null)
+ return new List(0);
- return m_storageManager.EstateDataStore.GetRegions(estateID);
+ return estateDataService.GetRegions(estateID);
}
public void ReloadEstateData()
{
- m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
-
- TriggerEstateSunUpdate();
+ IEstateDataService estateDataService = EstateDataService;
+ if (estateDataService != null)
+ {
+ m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
+ TriggerEstateSunUpdate();
+ }
}
public void TriggerEstateSunUpdate()
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4024328..454f031 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Processes backup.
///
///
- public virtual void ProcessBackup(ISimulationDataStore datastore, bool forcedBackup)
+ public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup)
{
if (!m_isBackedUp)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 1984d45..e45d488 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Process inventory backup
///
///
- public void ProcessInventoryBackup(ISimulationDataStore datastore)
+ public void ProcessInventoryBackup(ISimulationDataService datastore)
{
if (HasInventoryChanged)
{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index e3ef263..d634840 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -292,7 +292,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// scene backup thread.
scene.Backup(true);
- List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
+ List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
Assert.That(storedObjects.Count, Is.EqualTo(1));
Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2));
@@ -335,7 +335,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
scene.DeleteSceneObject(groupToDelete, false);
- List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
+ List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
Assert.That(storedObjects.Count, Is.EqualTo(1));
Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1));
diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs
deleted file mode 100644
index c858d56..0000000
--- a/OpenSim/Region/Framework/StorageManager.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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 OpenSimulator 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;
-using System.Reflection;
-using log4net;
-using OpenSim.Region.Framework.Interfaces;
-
-namespace OpenSim.Region.Framework
-{
- public class StorageManager
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- public readonly ISimulationDataStore DataStore;
- public readonly IEstateDataStore EstateDataStore;
-
- public StorageManager(string dllName, string connectionstring, string estateconnectionstring)
- {
- m_log.Info("[DATASTORE]: Attempting to load " + dllName);
- Assembly pluginAssembly = Assembly.LoadFrom(dllName);
-
- foreach (Type pluginType in pluginAssembly.GetTypes())
- {
- if (pluginType.IsPublic)
- {
- Type typeInterface = pluginType.GetInterface("ISimulationDataStore", true);
-
- if (typeInterface != null)
- {
- ISimulationDataStore plug =
- (ISimulationDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- plug.Initialise(connectionstring);
-
- DataStore = plug;
-
- m_log.Info("[DATASTORE]: Added ISimulationDataStore Interface");
- }
-
- typeInterface = pluginType.GetInterface("IEstateDataStore", true);
-
- if (typeInterface != null)
- {
- IEstateDataStore estPlug =
- (IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
- estPlug.Initialise(estateconnectionstring);
-
- EstateDataStore = estPlug;
- }
- }
- }
-
- //TODO: Add checking and warning to make sure it initialised.
- }
- }
-}
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
new file mode 100644
index 0000000..87c49d3
--- /dev/null
+++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
@@ -0,0 +1,112 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using OpenMetaverse;
+using log4net;
+using Mono.Addins;
+using Nini.Config;
+using System.Reflection;
+using OpenSim.Services.Base;
+using OpenSim.Services.Interfaces;
+using OpenSim.Data;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Services.Connectors
+{
+ public class EstateDataService : ServiceBase, IEstateDataService
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+
+ protected IEstateDataStore m_database;
+
+ public EstateDataService(IConfigSource config)
+ : base(config)
+ {
+ string dllName = String.Empty;
+ string connString = String.Empty;
+
+ // Try reading the [DatabaseService] section, if it exists
+ IConfig dbConfig = config.Configs["DatabaseService"];
+ if (dbConfig != null)
+ {
+ dllName = dbConfig.GetString("StorageProvider", String.Empty);
+ connString = dbConfig.GetString("EstateConnectionString", String.Empty);
+ if (String.IsNullOrEmpty(connString))
+ connString = dbConfig.GetString("ConnectionString", String.Empty);
+ }
+
+ // We tried, but this doesn't exist. We can't proceed
+ if (dllName == String.Empty)
+ throw new Exception("No StorageProvider configured");
+
+ m_database = LoadPlugin(dllName, new Object[] { connString });
+ if (m_database == null)
+ throw new Exception("Could not find a storage interface in the given module");
+ }
+
+ public EstateSettings LoadEstateSettings(UUID regionID, bool create)
+ {
+ return m_database.LoadEstateSettings(regionID, create);
+ }
+
+ public EstateSettings LoadEstateSettings(int estateID)
+ {
+ return m_database.LoadEstateSettings(estateID);
+ }
+
+ public void StoreEstateSettings(EstateSettings es)
+ {
+ m_database.StoreEstateSettings(es);
+ }
+
+ public List GetEstates(string search)
+ {
+ return m_database.GetEstates(search);
+ }
+
+ public bool LinkRegion(UUID regionID, int estateID)
+ {
+ return m_database.LinkRegion(regionID, estateID);
+ }
+
+ public List GetRegions(int estateID)
+ {
+ return m_database.GetRegions(estateID);
+ }
+
+ public bool DeleteEstate(int estateID)
+ {
+ return m_database.DeleteEstate(estateID);
+ }
+ }
+}
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
new file mode 100644
index 0000000..946f7e4
--- /dev/null
+++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
@@ -0,0 +1,140 @@
+/*
+ * 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 OpenSimulator 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;
+using System.Collections.Generic;
+using OpenMetaverse;
+using log4net;
+using Mono.Addins;
+using Nini.Config;
+using System.Reflection;
+using OpenSim.Services.Base;
+using OpenSim.Services.Interfaces;
+using OpenSim.Data;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Services.Connectors
+{
+ public class SimulationDataService : ServiceBase, ISimulationDataService
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+
+ protected ISimulationDataStore m_database;
+
+ public SimulationDataService(IConfigSource config)
+ : base(config)
+ {
+ string dllName = String.Empty;
+ string connString = String.Empty;
+
+ // Try reading the [DatabaseService] section, if it exists
+ IConfig dbConfig = config.Configs["DatabaseService"];
+ if (dbConfig != null)
+ {
+ dllName = dbConfig.GetString("StorageProvider", String.Empty);
+ connString = dbConfig.GetString("ConnectionString", String.Empty);
+ }
+
+ // We tried, but this doesn't exist. We can't proceed
+ if (dllName == String.Empty)
+ throw new Exception("No StorageProvider configured");
+
+ m_database = LoadPlugin(dllName, new Object[] { connString });
+ if (m_database == null)
+ throw new Exception("Could not find a storage interface in the given module");
+ }
+
+ public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
+ {
+ m_database.StoreObject(obj, regionUUID);
+ }
+
+ public void RemoveObject(UUID uuid, UUID regionUUID)
+ {
+ m_database.RemoveObject(uuid, regionUUID);
+ }
+
+ public void StorePrimInventory(UUID primID, ICollection items)
+ {
+ m_database.StorePrimInventory(primID, items);
+ }
+
+ public List LoadObjects(UUID regionUUID)
+ {
+ return m_database.LoadObjects(regionUUID);
+ }
+
+ public void StoreTerrain(double[,] terrain, UUID regionID)
+ {
+ m_database.StoreTerrain(terrain, regionID);
+ }
+
+ public double[,] LoadTerrain(UUID regionID)
+ {
+ return m_database.LoadTerrain(regionID);
+ }
+
+ public void StoreLandObject(ILandObject Parcel)
+ {
+ m_database.StoreLandObject(Parcel);
+ }
+
+ public void RemoveLandObject(UUID globalID)
+ {
+ m_database.RemoveLandObject(globalID);
+ }
+
+ public List LoadLandObjects(UUID regionUUID)
+ {
+ return m_database.LoadLandObjects(regionUUID);
+ }
+
+ public void StoreRegionSettings(RegionSettings rs)
+ {
+ m_database.StoreRegionSettings(rs);
+ }
+
+ public RegionSettings LoadRegionSettings(UUID regionUUID)
+ {
+ return m_database.LoadRegionSettings(regionUUID);
+ }
+
+ public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
+ {
+ return m_database.LoadRegionWindlightSettings(regionUUID);
+ }
+
+ public void StoreRegionWindlightSettings(RegionLightShareData wl)
+ {
+ m_database.StoreRegionWindlightSettings(wl);
+ }
+ }
+}
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs
deleted file mode 100644
index 93147d4..0000000
--- a/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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 OpenSimulator 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;
-using System.Collections.Generic;
-using System.Reflection;
-using log4net;
-using Nini.Config;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Server.Base;
-
-namespace OpenSim.Services.Connectors.Simulation
-{
- public class SimulationDataServiceConnector : ISimulationDataService
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private ISimulationDataStore m_simDataStore;
-
- public SimulationDataServiceConnector()
- {
- }
-
- public SimulationDataServiceConnector(IConfigSource config)
- {
- Initialise(config);
- }
-
- public virtual void Initialise(IConfigSource config)
- {
- IConfig serverConfig = config.Configs["SimulationDataStore"];
- if (serverConfig == null)
- throw new Exception("No section 'SimulationDataStore' in config file");
-
- string simDataStore = serverConfig.GetString("StoreModule", String.Empty);
-
- Object[] args = new Object[] { config };
- m_simDataStore = ServerUtils.LoadPlugin(simDataStore, args);
- }
-
- public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
- {
- }
-
- public void RemoveObject(UUID uuid, UUID regionUUID)
- {
- }
-
- public void StorePrimInventory(UUID primID, ICollection items)
- {
- }
-
- public List LoadObjects(UUID regionUUID)
- {
- return new List(0);
- }
-
- public void StoreTerrain(double[,] terrain, UUID regionID)
- {
- }
-
- public double[,] LoadTerrain(UUID regionID)
- {
- return new double[Constants.RegionSize, Constants.RegionSize];
- }
-
- public void StoreLandObject(ILandObject Parcel)
- {
- }
-
- public void RemoveLandObject(UUID globalID)
- {
- }
-
- public List LoadLandObjects(UUID regionUUID)
- {
- return new List(0);
- }
-
- public void StoreRegionSettings(RegionSettings rs)
- {
- }
-
- public RegionSettings LoadRegionSettings(UUID regionUUID)
- {
- return null;
- }
-
- public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
- {
- return null;
- }
-
- public void StoreRegionWindlightSettings(RegionLightShareData wl)
- {
- }
- }
-}
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 615e519..4511228 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -31,6 +31,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Region.Framework;
+using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Tests.Common.Mock
@@ -39,20 +40,15 @@ namespace OpenSim.Tests.Common.Mock
{
public TestScene(
RegionInfo regInfo, AgentCircuitManager authen,
- SceneCommunicationService sceneGridService, StorageManager storeManager,
+ SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
- : base(regInfo, authen, sceneGridService, storeManager, moduleLoader,
+ : base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader,
dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion)
{
}
///
- /// Allow retrieval for test check purposes
- ///
- public StorageManager StorageManager { get { return m_storageManager; } }
-
- ///
/// Temporarily override session authentication for tests (namely teleport).
///
///
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 9318a27..ffd0078 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -157,11 +157,12 @@ namespace OpenSim.Tests.Common.Setup
AgentCircuitManager acm = new AgentCircuitManager();
SceneCommunicationService scs = new SceneCommunicationService();
- StorageManager sm = new StorageManager("OpenSim.Tests.Common.dll", "", "");
+ ISimulationDataService simDataService = null;
+ IEstateDataService estateDataService = null;
IConfigSource configSource = new IniConfigSource();
TestScene testScene = new TestScene(
- regInfo, acm, scs, sm, null, false, false, false, configSource, null);
+ regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null);
INonSharedRegionModule capsModule = new CapabilitiesModule();
capsModule.Initialise(new IniConfigSource());
--
cgit v1.1
From 18a9ac6b39b91865c33eeffa1ef8ff3e8a847c1b Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sun, 12 Sep 2010 15:04:51 -0700
Subject: Fix unit test SceneSetupHelpers to load the mock simulation data
store
---
OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 75 +++++++++++++++++++++++
OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 2 +-
2 files changed, 76 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
index f453a4b..de6e815 100644
--- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -35,6 +35,81 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Data.Null
{
+ public class NullDataService : ISimulationDataService
+ {
+ private NullDataStore m_store;
+
+ public NullDataService()
+ {
+ m_store = new NullDataStore();
+ }
+
+ public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
+ {
+ m_store.StoreObject(obj, regionUUID);
+ }
+
+ public void RemoveObject(UUID uuid, UUID regionUUID)
+ {
+ m_store.RemoveObject(uuid, regionUUID);
+ }
+
+ public void StorePrimInventory(UUID primID, ICollection items)
+ {
+ m_store.StorePrimInventory(primID, items);
+ }
+
+ public List LoadObjects(UUID regionUUID)
+ {
+ return m_store.LoadObjects(regionUUID);
+ }
+
+ public void StoreTerrain(double[,] terrain, UUID regionID)
+ {
+ m_store.StoreTerrain(terrain, regionID);
+ }
+
+ public double[,] LoadTerrain(UUID regionID)
+ {
+ return m_store.LoadTerrain(regionID);
+ }
+
+ public void StoreLandObject(ILandObject Parcel)
+ {
+ m_store.StoreLandObject(Parcel);
+ }
+
+ public void RemoveLandObject(UUID globalID)
+ {
+ m_store.RemoveLandObject(globalID);
+ }
+
+ public List LoadLandObjects(UUID regionUUID)
+ {
+ return m_store.LoadLandObjects(regionUUID);
+ }
+
+ public void StoreRegionSettings(RegionSettings rs)
+ {
+ m_store.StoreRegionSettings(rs);
+ }
+
+ public RegionSettings LoadRegionSettings(UUID regionUUID)
+ {
+ return m_store.LoadRegionSettings(regionUUID);
+ }
+
+ public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
+ {
+ return m_store.LoadRegionWindlightSettings(regionUUID);
+ }
+
+ public void StoreRegionWindlightSettings(RegionLightShareData wl)
+ {
+ m_store.StoreRegionWindlightSettings(wl);
+ }
+ }
+
///
/// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that
/// tests can check correct persistence.
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index ee76db4..fc9db03 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -157,7 +157,7 @@ namespace OpenSim.Tests.Common.Setup
AgentCircuitManager acm = new AgentCircuitManager();
SceneCommunicationService scs = new SceneCommunicationService();
- ISimulationDataService simDataService = null;
+ ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null);
IEstateDataService estateDataService = null;
IConfigSource configSource = new IniConfigSource();
--
cgit v1.1