From 79f0ac82e328e325df28f3af3d4c98a7885a44f5 Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 10 Aug 2007 17:22:54 +0000 Subject: Some cleaning up and removed a few old files no longer in use. Temporary have had to rename the OpenSim.DataStore.MonoSqlite project to OpenSim.DataStore.MonoSqlite1, as I'm not sure what was done to stop the old project name being included in the VS2005 solution. Also some config changes: OpenSim now has a INI (OpenSim.ini) file that it will read some config settings from (if the ini file exists). Added Mono.Data.SqliteClient.dll so that we can use the same code for sqlite on Windows and mono/linux. (from what I can tell Mono class libraries have a MIT license so there should be no problems with us including this dll). So now to get the basic prim storage working , you need to first create the sqlite database file from the sqlite3-prims.sql in share directory. Then in the OpenSim.ini file, change the storage_plugin so it points to OpenSim.DataStore.MonoSqlite1.dll (storage_plugin = OpenSim.DataStore.MonoSqlite1.dll). Then in your region.xml files change the DataStore value so it is the name of your database file (at the moment you need a different sqlite3 database file for each region). --- .../Framework/General/Interfaces/ILocalStorage.cs | 71 ---------------------- .../Framework/General/Interfaces/IUserServer.cs | 39 ------------ OpenSim/Framework/General/Types/RegionInfo.cs | 49 ++++++++++++++- OpenSim/Framework/General/Util.cs | 25 ++++++++ 4 files changed, 73 insertions(+), 111 deletions(-) delete mode 100644 OpenSim/Framework/General/Interfaces/ILocalStorage.cs delete mode 100644 OpenSim/Framework/General/Interfaces/IUserServer.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/General/Interfaces/ILocalStorage.cs b/OpenSim/Framework/General/Interfaces/ILocalStorage.cs deleted file mode 100644 index 1b7b01e..0000000 --- a/OpenSim/Framework/General/Interfaces/ILocalStorage.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 libsecondlife; -using OpenSim.Framework.Types; - -namespace OpenSim.Framework.Interfaces -{ - /// - /// ILocalStorage. Really hacked together right now needs cleaning up - /// - [System.Obsolete("Redundant, use IRegionDataStore instead")] - public interface ILocalStorage - { - void Initialise(string datastore); - - void StorePrim(PrimData prim); - void RemovePrim(LLUUID primID); - void LoadPrimitives(ILocalStorageReceiver receiver); - - [System.Obsolete("Use DataStorage instead")] - float[] LoadScene(); - [System.Obsolete("Use DataStorage instead")] - void SaveMap(float[] heightmap); - - void SaveLandObjects(LandData[] lands); - void SaveLandObject(LandData land); - void RemoveLandObject(LandData land); - void RemoveAllLandObjects(); - void LoadLandObjects(ILocalStorageLandObjectReceiver recv); - - void ShutDown(); - } - - public interface ILocalStorageReceiver - { - void PrimFromStorage(PrimData prim); - } - - public interface ILocalStorageLandObjectReceiver - { - void LandFromStorage(LandData data); - void NoLandDataFromStorage(); - } -} - diff --git a/OpenSim/Framework/General/Interfaces/IUserServer.cs b/OpenSim/Framework/General/Interfaces/IUserServer.cs deleted file mode 100644 index ca5816d..0000000 --- a/OpenSim/Framework/General/Interfaces/IUserServer.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 libsecondlife; -using OpenSim.Framework.Inventory; - -namespace OpenSim.Framework.Interfaces -{ - public interface IUserServer - { - AgentInventory RequestAgentsInventory(LLUUID agentID); - void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); - bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory); - } -} diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs index b9ed8d2..aa391c0 100644 --- a/OpenSim/Framework/General/Types/RegionInfo.cs +++ b/OpenSim/Framework/General/Types/RegionInfo.cs @@ -29,6 +29,7 @@ using System; using System.Globalization; using System.Net; using System.Net.Sockets; +using Nini.Config; using libsecondlife; using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; @@ -163,9 +164,55 @@ namespace OpenSim.Framework.Types m_externalHostName = externalUri; } + public void LoadFromNiniSource(IConfigSource source) + { + this.LoadFromNiniSource(source, "RegionInfo"); + } + + public void LoadFromNiniSource(IConfigSource source, string sectionName) + { + string errorMessage = ""; + this.SimUUID = new LLUUID(source.Configs[sectionName].GetString("sim_UUID", LLUUID.Random().ToStringHyphenated())); + this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); + this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); + this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); + this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); + + string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); + IPAddress ipAddressResult; + if (IPAddress.TryParse(ipAddress, out ipAddressResult)) + { + this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); + } + else + { + errorMessage = "needs an IP Address (IPAddress)"; + } + this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port",(int) 9000); + + string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); + if (externalHost != "SYSTEMIP") + { + this.m_externalHostName = externalHost; + } + else + { + this.m_externalHostName = Util.GetLocalHost().ToString(); + } + + this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); + this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); + this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); + + if (errorMessage != "") + { + // a error + } + } + public void loadConfigurationOptions() { - configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Simulator (Default is recommended, random UUID)", LLUUID.Random().ToString(),true); + configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Simulator (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Simulator Name", "OpenSim Test", false); configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs index f3e2a01..f3a8c73 100644 --- a/OpenSim/Framework/General/Util.cs +++ b/OpenSim/Framework/General/Util.cs @@ -32,6 +32,8 @@ using System.Net; using System.Text; using libsecondlife; +using Nini.Config; + namespace OpenSim.Framework.Utilities { public class Util @@ -313,5 +315,28 @@ namespace OpenSim.Framework.Utilities { } + + // Nini (config) related Methods + public static IConfigSource ConvertDataRowToXMLConfig(System.Data.DataRow row, string fileName) + { + if(!File.Exists(fileName)) + { + //create new file + } + XmlConfigSource config = new XmlConfigSource(fileName); + AddDataRowToConfig(config, row); + config.Save(); + + return config; + } + + public static void AddDataRowToConfig(IConfigSource config, System.Data.DataRow row) + { + config.Configs.Add((string)row[0]); + for (int i = 0; i < row.Table.Columns.Count; i++) + { + config.Configs[(string)row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); + } + } } } -- cgit v1.1