* 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
viewer-2-initial-appearance
John Hurliman 2010-09-12 14:20:26 -07:00
parent 16d782eaa2
commit 0db1ed0b5a
34 changed files with 461 additions and 256 deletions

View File

@ -638,7 +638,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Set the estate
// Check for an existing estate
List<int> estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]);
List<int> 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.");
}

View File

@ -50,6 +50,15 @@ namespace OpenSim.Data.MSSQL
#region Public methods
public MSSQLEstateStore()
{
}
public MSSQLEstateStore(string connectionString)
{
Initialise(connectionString);
}
/// <summary>
/// Initialises the estatedata class.
/// </summary>

View File

@ -55,6 +55,16 @@ namespace OpenSim.Data.MSSQL
/// </summary>
private MSSQLManager _Database;
private string m_connectionString;
public MSSQLSimulationData()
{
}
public MSSQLSimulationData(string connectionString)
{
Initialise(connectionString);
}
/// <summary>
/// Initialises the region datastore
/// </summary>

View File

@ -54,6 +54,15 @@ namespace OpenSim.Data.MySQL
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
public MySQLEstateStore()
{
}
public MySQLEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString)
{
m_connectionString = connectionString;

View File

@ -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;

View File

@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLite
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
public SQLiteEstateStore()
{
}
public SQLiteEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString)
{
m_connectionString = connectionString;

View File

@ -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
/***********************************************************************

View File

@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLiteLegacy
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
public SQLiteEstateStore()
{
}
public SQLiteEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString)
{
m_connectionString = connectionString;

View File

@ -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
/***********************************************************************

View File

@ -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
{

View File

@ -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");
}

View File

@ -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<ISimulationDataService>(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<IEstateDataService>(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
/// </param>
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<string>() {"yes", "no"});
string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "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<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
List<int> 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.");

View File

@ -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<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>();
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
/// <returns></returns>
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();

View File

@ -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();

View 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);
}
}

View File

@ -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)

View File

@ -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()

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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));

View File

@ -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.
}
}
}

View File

@ -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<IEstateDataStore>(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<int> GetEstates(string search)
{
return m_database.GetEstates(search);
}
public bool LinkRegion(UUID regionID, int estateID)
{
return m_database.LinkRegion(regionID, estateID);
}
public List<UUID> GetRegions(int estateID)
{
return m_database.GetRegions(estateID);
}
public bool DeleteEstate(int estateID)
{
return m_database.DeleteEstate(estateID);
}
}
}

View File

@ -27,99 +27,114 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
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;
using OpenSim.Server.Base;
namespace OpenSim.Services.Connectors.Simulation
namespace OpenSim.Services.Connectors
{
public class SimulationDataServiceConnector : ISimulationDataService
public class SimulationDataService : ServiceBase, ISimulationDataService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private ISimulationDataStore m_simDataStore;
protected ISimulationDataStore m_database;
public SimulationDataServiceConnector()
public SimulationDataService(IConfigSource config)
: base(config)
{
}
string dllName = String.Empty;
string connString = String.Empty;
public SimulationDataServiceConnector(IConfigSource config)
{
Initialise(config);
}
// 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);
}
public virtual void Initialise(IConfigSource config)
{
IConfig serverConfig = config.Configs["SimulationDataStore"];
if (serverConfig == null)
throw new Exception("No section 'SimulationDataStore' in config file");
// We tried, but this doesn't exist. We can't proceed
if (dllName == String.Empty)
throw new Exception("No StorageProvider configured");
string simDataStore = serverConfig.GetString("StoreModule", String.Empty);
Object[] args = new Object[] { config };
m_simDataStore = ServerUtils.LoadPlugin<ISimulationDataStore>(simDataStore, args);
m_database = LoadPlugin<ISimulationDataStore>(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<TaskInventoryItem> items)
{
m_database.StorePrimInventory(primID, items);
}
public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
{
return new List<SceneObjectGroup>(0);
return m_database.LoadObjects(regionUUID);
}
public void StoreTerrain(double[,] terrain, UUID regionID)
{
m_database.StoreTerrain(terrain, regionID);
}
public double[,] LoadTerrain(UUID regionID)
{
return new double[Constants.RegionSize, Constants.RegionSize];
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<LandData> LoadLandObjects(UUID regionUUID)
{
return new List<LandData>(0);
return m_database.LoadLandObjects(regionUUID);
}
public void StoreRegionSettings(RegionSettings rs)
{
m_database.StoreRegionSettings(rs);
}
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
return null;
return m_database.LoadRegionSettings(regionUUID);
}
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
{
return null;
return m_database.LoadRegionWindlightSettings(regionUUID);
}
public void StoreRegionWindlightSettings(RegionLightShareData wl)
{
m_database.StoreRegionWindlightSettings(wl);
}
}
}

View File

@ -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,19 +40,14 @@ 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)
{
}
/// <summary>
/// Allow retrieval for test check purposes
/// </summary>
public StorageManager StorageManager { get { return m_storageManager; } }
/// <summary>
/// Temporarily override session authentication for tests (namely teleport).
/// </summary>

View File

@ -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());

View File

@ -106,33 +106,6 @@
; ## PRIM STORAGE
; ##
; *** Prim Storage - only leave one storage_plugin uncommented ***
; --- Null stores nothing - effectively disabling persistence:
;storage_plugin = "OpenSim.Data.Null.dll"
; --- To use sqlite as region storage:
;
; PLEASE NOTE: Unfortunately, the current SQLite database plugin (necessary to use SQLite with Mono on Linux) is
; not compatible with the sqlite3 library installed on Mac OSX. If you're using Mono 2.4 you can still use the old sqlite
; library by uncommenting the SQLiteLegacy.dll storage plugin (and commenting out SQLite.dll). Unfortunately, the older library
; will not work with Mono 2.6 on Mac OSX so you will either need to replace the OSX sqlite3 system library or use MySQL instead
;
; You will also need to do the same thing in config-include/StandaloneCommon.ini if you are running in standalone mode
storage_plugin = "OpenSim.Data.SQLite.dll"
;storage_plugin = "OpenSim.Data.SQLiteLegacy.dll"
storage_connection_string="URI=file:OpenSim.db,version=3";
; --- To use MySQL storage, supply your own connection string (this is only an example):
; note that the supplied account needs create privilegies if you want it to auto-create needed tables.
;
; -->>> There are multiple connection strings defined in several places. Check it carefully!
;
; storage_plugin="OpenSim.Data.MySQL.dll"
; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;";
; If you want to use a different database/server for estate data, then
; uncomment and change this connect string. Defaults to the above if not set
; estate_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;";
; Persistence of changed objects happens during regular sweeps. The following control that behaviour to
; prevent frequently changing objects from heavily loading the region data store.
; If both of these values are set to zero then persistence of all changed objects will happen on every sweep.

View File

@ -27,6 +27,11 @@
SimulationServiceInConnector = true
LibraryModule = true
[SimulationDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService"
[EstateDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService"
[GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"

View File

@ -1,3 +1,24 @@
[DatabaseService]
;
; ### Choose the DB
;
; SQLite
Include-Storage = "config-include/storage/SQLiteStandalone.ini";
; Unfortunately the current SQLite database plugin is not compatible with Mac OSX. You can still use the older
; legacy sqlite library if you are using Mono 2.4. Please see the notes in OpenSim.ini (search for sqlite)
; for more details
;Include-Storage = "config-include/storage/SQLiteLegacyStandalone.ini";
; MySql
; Uncomment these lines if you want to use mysql storage
; Change the connection string to your db details
;StorageProvider = "OpenSim.Data.MySQL.dll"
;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;"
; Uncomment this line if you are using MySQL and want to use a different database for estates
;EstateConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;"
[AssetService]
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"

View File

@ -30,6 +30,12 @@
SimulationServiceInConnector = true
LibraryModule = true
[SimulationDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService"
[EstateDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService"
[AssetService]
LocalGridAssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector"
HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector"

View File

@ -41,6 +41,12 @@
AssetCaching = "FlotsamAssetCache"
[SimulationDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService"
[EstateDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService"
[Friends]
Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector"

View File

@ -41,6 +41,12 @@
AssetCaching = "FlotsamAssetCache"
[SimulationDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService"
[EstateDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService"
[Friends]
Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector"

View File

@ -22,6 +22,12 @@
LLLoginServiceInConnector = true
GridInfoServiceInConnector = true
[SimulationDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService"
[EstateDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService"
[AssetService]
LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"

View File

@ -18,6 +18,8 @@
; Change the connection string to your db details
;StorageProvider = "OpenSim.Data.MySQL.dll"
;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;"
; Uncomment this line if you are using MySQL and want to use a different database for estates
;EstateConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;"
[AssetService]
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"

View File

@ -924,13 +924,15 @@
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Server.Base"/>
<Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
@ -1653,6 +1655,7 @@
<Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.ClientStack"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Server.Base"/>
<Reference name="XMLRPC" path="../../../bin/"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>