mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
* 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
This commit is contained in:
@@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// Backup the inventory to the given data store
|
||||
/// </summary>
|
||||
/// <param name="datastore"></param>
|
||||
void ProcessInventoryBackup(ISimulationDataStore datastore);
|
||||
void ProcessInventoryBackup(ISimulationDataService datastore);
|
||||
|
||||
uint MaskEffectivePermissions();
|
||||
|
||||
|
||||
45
OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
Normal file
45
OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
Normal file
@@ -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<int> GetEstates(string search);
|
||||
bool LinkRegion(UUID regionID, int estateID);
|
||||
List<UUID> GetRegions(int estateID);
|
||||
bool DeleteEstate(int estateID);
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -100,10 +100,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
|
||||
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<ISimulationDataService>();
|
||||
|
||||
if (m_SimulationDataService == null)
|
||||
{
|
||||
throw new Exception("No ISimulationDataService available.");
|
||||
}
|
||||
}
|
||||
|
||||
return m_SimulationDataService;
|
||||
}
|
||||
}
|
||||
|
||||
public IEstateDataService EstateDataService
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_EstateDataService == null)
|
||||
{
|
||||
m_EstateDataService = RequestModuleInterface<IEstateDataService>();
|
||||
|
||||
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<UUID, ReturnInfo> 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
|
||||
/// </summary>
|
||||
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> landData = m_storageManager.DataStore.LoadLandObjects(regionID);
|
||||
List<LandData> 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<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID);
|
||||
List<SceneObjectGroup> 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<UUID> GetEstateRegions(int estateID)
|
||||
{
|
||||
if (m_storageManager.EstateDataStore == null)
|
||||
return new List<UUID>();
|
||||
IEstateDataService estateDataService = EstateDataService;
|
||||
if (estateDataService == null)
|
||||
return new List<UUID>(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()
|
||||
|
||||
@@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Processes backup.
|
||||
/// </summary>
|
||||
/// <param name="datastore"></param>
|
||||
public virtual void ProcessBackup(ISimulationDataStore datastore, bool forcedBackup)
|
||||
public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup)
|
||||
{
|
||||
if (!m_isBackedUp)
|
||||
{
|
||||
|
||||
@@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Process inventory backup
|
||||
/// </summary>
|
||||
/// <param name="datastore"></param>
|
||||
public void ProcessInventoryBackup(ISimulationDataStore datastore)
|
||||
public void ProcessInventoryBackup(ISimulationDataService datastore)
|
||||
{
|
||||
if (HasInventoryChanged)
|
||||
{
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
// scene backup thread.
|
||||
scene.Backup(true);
|
||||
|
||||
List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
|
||||
List<SceneObjectGroup> 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<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
|
||||
List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
|
||||
|
||||
Assert.That(storedObjects.Count, Is.EqualTo(1));
|
||||
Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1));
|
||||
|
||||
@@ -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.
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user