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 +- bin/OpenSim.ini.example | 27 ---- bin/config-include/Grid.ini | 5 + bin/config-include/GridCommon.ini.example | 21 ++++ bin/config-include/GridHypergrid.ini | 6 + bin/config-include/HyperSimianGrid.ini | 6 + bin/config-include/SimianGrid.ini | 6 + bin/config-include/Standalone.ini | 6 + bin/config-include/StandaloneCommon.ini.example | 2 + prebuild.xml | 5 +- 35 files changed, 558 insertions(+), 353 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 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()); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 08726ea..8d714ce 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -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. diff --git a/bin/config-include/Grid.ini b/bin/config-include/Grid.ini index 9a75f19..4a6a082 100644 --- a/bin/config-include/Grid.ini +++ b/bin/config-include/Grid.ini @@ -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" diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index a19591b..c2cd5c3 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -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" diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index ab29018..d69a945 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini @@ -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" diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini index 49ba2ca..29b51de 100644 --- a/bin/config-include/HyperSimianGrid.ini +++ b/bin/config-include/HyperSimianGrid.ini @@ -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" diff --git a/bin/config-include/SimianGrid.ini b/bin/config-include/SimianGrid.ini index 9b27cc7..239ce30 100644 --- a/bin/config-include/SimianGrid.ini +++ b/bin/config-include/SimianGrid.ini @@ -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" diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index eae9801..d74b50e 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini @@ -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" diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index f862960..96ef602 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -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" diff --git a/prebuild.xml b/prebuild.xml index 7dec8ba..726991c 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -924,13 +924,15 @@ - + + + @@ -1653,6 +1655,7 @@ + -- cgit v1.1