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
---
.../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 ----------------
8 files changed, 123 insertions(+), 118 deletions(-)
create mode 100644 OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
delete mode 100644 OpenSim/Region/Framework/StorageManager.cs
(limited to 'OpenSim/Region/Framework')
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.
- }
- }
-}
--
cgit v1.1