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). --- OpenSim/Region/Application/OpenSimMain.cs | 61 +++++++++++----------- .../Region/ClientStack/Assets/InventoryCache.cs | 23 -------- OpenSim/Region/ClientStack/ClientView.cs | 2 +- .../Region/ClientStack/RegionApplicationBase.cs | 2 +- .../Environment/LandManagement/LandManager.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 4 +- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 15 +----- .../MonoSqliteDataStore.cs | 7 +-- 8 files changed, 41 insertions(+), 75 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 8e3f558..b052178 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -60,8 +60,8 @@ namespace OpenSim public bool m_sandbox; public bool user_accounts; public bool m_gridLocalAsset; - protected bool m_useConfigFile; - public string m_configFileName; + + protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll"; protected List m_udpServers = new List(); protected List m_regionData = new List(); @@ -74,31 +74,30 @@ namespace OpenSim : base() { IConfigSource startupSource = configSource; - string iniFile = startupSource.Configs["Startup"].GetString("inifile", "NA"); - if (iniFile != "NA") + string iniFile = startupSource.Configs["Startup"].GetString("inifile", "OpenSim.ini"); + + //check for .INI file (either default or name passed in command line) + string iniFilePath = Path.Combine(Util.configDir(), iniFile); + if (File.Exists(iniFilePath)) { - //a INI file is set to be used for startup settings - string iniFilePath = Path.Combine(Util.configDir(), iniFile); - if (File.Exists(iniFilePath)) - { - startupSource = new IniConfigSource(iniFilePath); - - //enable following line, if we want the original config source(normally commandline args) merged with ini file settings. - //in this case we have it so that if both sources have the same named setting, the command line value will overwrite the ini file value. - //(as if someone has bothered to enter a command line arg, we should take notice of it) - //startupSource.Merge(configSource); - } + startupSource = new IniConfigSource(iniFilePath); + + //enable following line, if we want the original config source(normally commandline args) merged with ini file settings. + //in this case we have it so that if both sources have the same named setting, the command line value will overwrite the ini file value. + //(as if someone has bothered to enter a command line arg, we should take notice of it) + startupSource.Merge(configSource); } + ReadConfigSettings(startupSource); } protected void ReadConfigSettings(IConfigSource configSource) { - m_useConfigFile = configSource.Configs["Startup"].GetBoolean("configfile", false); m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false); m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics"); - m_configFileName = configSource.Configs["Startup"].GetString("config", "simconfig.xml"); m_silent = configSource.Configs["Startup"].GetBoolean("noverbose", false); + + m_storageDLL = configSource.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"); } /// @@ -110,7 +109,7 @@ namespace OpenSim { Directory.CreateDirectory(Util.logDir()); } - + m_log = new LogBase(Path.Combine(Util.logDir(), m_logFilename), "Region", this, m_silent); MainLog.Instance = m_log; @@ -131,12 +130,12 @@ namespace OpenSim } string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); - + if (!Directory.Exists(regionConfigPath)) { Directory.CreateDirectory(regionConfigPath); } - + string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); if (configFiles.Length == 0) @@ -175,7 +174,7 @@ namespace OpenSim protected override StorageManager CreateStorageManager(RegionInfo regionInfo) { - return new StorageManager("OpenSim.DataStore.NullStorage.dll", regionInfo.DataStore, regionInfo.RegionName); + return new StorageManager(m_storageDLL, regionInfo.DataStore, regionInfo.RegionName); } protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) @@ -287,7 +286,7 @@ namespace OpenSim case "terrain": string result = ""; - foreach(Scene scene in m_localScenes) + foreach (Scene scene in m_localScenes) { if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) { @@ -296,21 +295,21 @@ namespace OpenSim } break; case "script": - foreach(Scene scene in m_localScenes ) + foreach (Scene scene in m_localScenes) { scene.SendCommandToScripts(cmdparams); } break; case "backup": - foreach(Scene scene in m_localScenes ) + foreach (Scene scene in m_localScenes) { scene.Backup(); } break; case "alert": - foreach(Scene scene in m_localScenes) + foreach (Scene scene in m_localScenes) { scene.HandleAlertCommand(cmdparams); } @@ -344,19 +343,19 @@ namespace OpenSim for (int i = 0; i < m_localScenes.Count; i++) { Scene scene = m_localScenes[i]; - foreach (Entity entity in scene.Entities.Values ) + foreach (Entity entity in scene.Entities.Values) { - if ( entity is ScenePresence ) + if (entity is ScenePresence) { ScenePresence scenePrescence = entity as ScenePresence; m_log.Error( - String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", + String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", scenePrescence.Firstname, scenePrescence.Lastname, - scenePrescence.UUID, + scenePrescence.UUID, scenePrescence.ControllingClient.AgentId, - "Unknown", - "Unknown", + "Unknown", + "Unknown", scene.RegionInfo.RegionName)); } } diff --git a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs index c0609b6..8185502 100644 --- a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs +++ b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs @@ -64,17 +64,6 @@ namespace OpenSim.Assets } } - public AgentInventory FetchAgentsInventory(LLUUID agentID, IUserServer userserver) - { - AgentInventory res = null; - if (!this._agentsInventory.ContainsKey(agentID)) - { - res = userserver.RequestAgentsInventory(agentID); - this._agentsInventory.Add(agentID,res); - } - return res; - } - public AgentInventory GetAgentsInventory(LLUUID agentID) { if (this._agentsInventory.ContainsKey(agentID)) @@ -85,18 +74,6 @@ namespace OpenSim.Assets return null; } - public void ClientLeaving(LLUUID clientID, IUserServer userserver) - { - if (this._agentsInventory.ContainsKey(clientID)) - { - if (userserver != null) - { - userserver.UpdateAgentsInventory(clientID, this._agentsInventory[clientID]); - } - this._agentsInventory.Remove(clientID); - } - } - public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID) { return this.CreateNewInventoryFolder(remoteClient, folderID, 0); diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index e693c64..1375f6c 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -120,7 +120,7 @@ namespace OpenSim.Region.ClientStack public void KillClient() { clientPingTimer.Stop(); - this.m_inventoryCache.ClientLeaving(this.AgentID, null); + m_scene.RemoveClient(this.AgentId); m_clientThreads.Remove(this.CircuitCode); diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 05c970a..d47450a 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.ClientStack Initialize(); - ScenePresence.CreateDefaultTextureEntry("avatar-texture.dat"); + ScenePresence.CreateDefaultTextureEntry(); m_httpServer = new BaseHttpServer( m_httpServerPort ); diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index f67b51a..5bc975c 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.LandManagement /// /// Handles Land objects and operations requiring information from other Land objects (divide, join, etc) /// - public class LandManager : ILocalStorageLandObjectReceiver + public class LandManager { #region Constants diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index cae57a2..d3c7f77 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Environment.Scenes public delegate void ForEachScenePresenceDelegate(ScenePresence presence); - public partial class Scene : SceneBase, ILocalStorageReceiver + public partial class Scene : SceneBase { protected Timer m_heartbeatTimer = new Timer(); protected Dictionary Avatars; @@ -229,7 +229,7 @@ namespace OpenSim.Region.Environment.Scenes //backup scene data storageCount++; - if (storageCount > 1200) //set to how often you want to backup + if (storageCount > 600) //set to how often you want to backup { Backup(); storageCount = 0; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 114623a..1be1e7a 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -665,19 +665,8 @@ namespace OpenSim.Region.Environment.Scenes } } - public static void CreateDefaultTextureEntry(string name) - { - /* FileInfo fInfo = new FileInfo(name); - long numBytes = fInfo.Length; - FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); - BinaryReader br = new BinaryReader(fStream); - byte[] data1 = br.ReadBytes((int)numBytes); - br.Close(); - fStream.Close(); - DefaultTexture = data1; - LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length); - Console.WriteLine("default texture entry: " + textu.ToString());*/ - + public static void CreateDefaultTextureEntry() + { LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); textu.CreateFace(1).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index f85d3b6..45b19e6 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text; -using System.IO; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.LandManagement; @@ -31,9 +30,10 @@ namespace OpenSim.DataStore.MonoSqliteStorage public void Initialise(string dbfile, string dbname) { - // for us, dbfile will be the connect string + string connectionString = "URI=file:" + dbfile + ",version=3"; + MainLog.Instance.Verbose("DATASTORE", "Sqlite - connecting: " + dbfile); - SqliteConnection conn = new SqliteConnection(dbfile); + SqliteConnection conn = new SqliteConnection(connectionString); SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); primDa = new SqliteDataAdapter(primSelectCmd); @@ -301,6 +301,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage Convert.ToSingle(row["RotationZ"]), Convert.ToSingle(row["RotationW"]) ); + return prim; } -- cgit v1.1