/// <summary> /// Process inventory backup /// </summary> /// <param name="datastore"></param> public void ProcessInventoryBackup() { if (HasInventoryChanged) { ISimulationDataStore datastore = ((Scene)m_part.ParentGroup.Scene).SimulationDataService; HasInventoryChanged = false; List <TaskInventoryItem> items = GetInventoryItems(); datastore.StorePrimInventory(m_part.UUID, items); IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces <IScriptModule> (); if (engines != null) { foreach (TaskInventoryItem item in items) { if (item.Type == (int)InventoryType.LSL) { foreach (IScriptModule engine in engines) { if (engine != null) { //NOTE: We will need to save the prim if we do this engine.SaveStateSave(item.ItemID, m_part.UUID); } } } } } } }
public void StartRegions(out bool newRegion) { List <KeyValuePair <ISimulationDataStore, RegionInfo> > regions = new List <KeyValuePair <ISimulationDataStore, RegionInfo> >(); List <string> regionFiles = m_selectedDataService.FindRegionInfos(out newRegion); if (newRegion) { ISimulationDataStore store = m_selectedDataService.Copy(); regions.Add(new KeyValuePair <ISimulationDataStore, RegionInfo>(store, store.CreateNewRegion(m_SimBase))); } else { foreach (string fileName in regionFiles) { ISimulationDataStore store = m_selectedDataService.Copy(); regions.Add(new KeyValuePair <ISimulationDataStore, RegionInfo>(store, store.LoadRegionInfo(fileName, m_SimBase))); } } foreach (KeyValuePair <ISimulationDataStore, RegionInfo> kvp in regions) { StartRegion(kvp.Key, kvp.Value); } }
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); } // Try reading the [SimulationDataStore] section IConfig simConfig = config.Configs["SimulationDataStore"]; if (simConfig != null) { dllName = simConfig.GetString("StorageProvider", dllName); connString = simConfig.GetString("ConnectionString", connString); } // We tried, but this doesn't exist. We can't proceed if (dllName == String.Empty) throw new Exception("No StorageProvider configured"); 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"); }
private void CreateNewRegion(IScene scene, string[] cmd) { ISimulationDataStore store = m_selectedDataService.Copy(); StartRegion(store, store.CreateNewRegion(m_SimBase)); foreach (ISimulationDataStore st in m_simulationDataServices) { st.ForceBackup(); } }
public void Initialize(ISimulationBase openSim) { m_OpenSimBase = openSim; IConfig handlerConfig = openSim.ConfigSource.Configs["ApplicationPlugins"]; if (handlerConfig.GetString("SceneManager", "") != Name) { return; } m_config = openSim.ConfigSource; string name = String.Empty; // Try reading the [SimulationDataStore] section IConfig simConfig = openSim.ConfigSource.Configs["SimulationDataStore"]; if (simConfig != null) { name = simConfig.GetString("DatabaseLoaderName", "FileBasedDatabase"); } ISimulationDataStore[] stores = AuroraModuleLoader.PickupModules <ISimulationDataStore> ().ToArray(); List <string> storeNames = new List <string>(); foreach (ISimulationDataStore store in stores) { if (store.Name.ToLower() == name.ToLower()) { m_simulationDataService = store; break; } storeNames.Add(store.Name); } if (m_simulationDataService == null) { MainConsole.Instance.ErrorFormat("[SceneManager]: FAILED TO LOAD THE SIMULATION SERVICE AT '{0}', ONLY OPTIONS ARE {1}, QUITING...", name, string.Join(", ", storeNames.ToArray())); Console.Read(); //Wait till they see Environment.Exit(0); } m_simulationDataService.Initialise(); AddConsoleCommands(); //Load the startup modules for the region m_startupPlugins = AuroraModuleLoader.PickupModules <ISharedRegionStartupModule>(); //Register us! m_OpenSimBase.ApplicationRegistry.RegisterModuleInterface <SceneManager>(this); m_OpenSimBase.EventManager.RegisterEventHandler("RegionInfoChanged", RegionInfoChanged); }
/// <summary> /// Create a scene and its initial base structures. /// </summary> /// <param name="regionInfo"></param> /// <param name="configSource"></param> /// <returns></returns> public IScene CreateScene(ISimulationDataStore dataStore, RegionInfo regionInfo) { AgentCircuitManager circuitManager = new AgentCircuitManager(); List<IClientNetworkServer> clientServers = AuroraModuleLoader.PickupModules<IClientNetworkServer>(); List<IClientNetworkServer> allClientServers = new List<IClientNetworkServer>(); foreach (IClientNetworkServer clientServer in clientServers) { clientServer.Initialise((uint)regionInfo.RegionPort, m_configSource, circuitManager); allClientServers.Add(clientServer); } AsyncScene scene = new AsyncScene(); scene.AddModuleInterfaces(m_openSimBase.ApplicationRegistry.GetInterfaces()); scene.Initialize(regionInfo, dataStore, circuitManager, allClientServers); return scene; }
/// <summary> /// Create a scene and its initial base structures. /// </summary> /// <param name="regionInfo"></param> /// <param name="configSource"></param> /// <returns></returns> public IScene CreateScene(ISimulationDataStore dataStore, RegionInfo regionInfo) { AgentCircuitManager circuitManager = new AgentCircuitManager(); List <IClientNetworkServer> clientServers = UniverseModuleLoader.PickupModules <IClientNetworkServer>(); List <IClientNetworkServer> allClientServers = new List <IClientNetworkServer>(); foreach (IClientNetworkServer clientServer in clientServers) { clientServer.Initialize((uint)regionInfo.RegionPort, m_configSource, circuitManager); allClientServers.Add(clientServer); } AsyncScene scene = new AsyncScene(); scene.AddModuleInterfaces(m_simBase.ApplicationRegistry.GetInterfaces()); scene.Initialize(regionInfo, dataStore, circuitManager, allClientServers); return(scene); }
public void StartRegion(ISimulationDataStore simData, RegionInfo regionInfo) { MainConsole.Instance.InfoFormat("[SceneManager]: Starting region \"{0}\" at @ {1},{2}", regionInfo.RegionName, regionInfo.RegionLocX / 256, regionInfo.RegionLocY / 256); ISceneLoader sceneLoader = m_SimBase.ApplicationRegistry.RequestModuleInterface <ISceneLoader>(); if (sceneLoader == null) { throw new Exception("No Scene Loader Interface!"); } //Get the new scene from the interface IScene scene = sceneLoader.CreateScene(simData, regionInfo); m_scenes.Add(scene); MainConsole.Instance.ConsoleScenes = m_scenes; simData.SetRegion(scene); m_simulationDataServices.Add(simData); if (OnAddedScene != null) { OnAddedScene(scene); } StartModules(scene); if (OnFinishedAddingScene != null) { OnFinishedAddingScene(scene); } //Start the heartbeats scene.StartHeartbeat(); //Tell the scene that the startup is complete // Note: this event is added in the scene constructor scene.FinishedStartup("Startup", new List <string>()); }
public void Initialize(RegionInfo regionInfo, ISimulationDataStore dataStore, AgentCircuitManager authen, List<IClientNetworkServer> clientServers) { Initialize(regionInfo); //Set up the clientServer m_clientServers = clientServers; foreach (IClientNetworkServer clientServer in clientServers) { clientServer.AddScene(this); } m_sceneManager = RequestModuleInterface<ISceneManager>(); m_simDataStore = dataStore; m_config = m_sceneManager.ConfigSource; m_authenticateHandler = authen; m_AuroraEventManager = new AuroraEventManager(); m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); m_sceneGraph = new SceneGraph(this, m_regInfo); #region Region Config IConfig aurorastartupConfig = m_config.Configs["AuroraStartup"]; if (aurorastartupConfig != null) { //Region specific is still honored here, the RegionInfo checks for it, and if it is 0, it didn't set it if (RegionInfo.ObjectCapacity == 0) RegionInfo.ObjectCapacity = aurorastartupConfig.GetInt("ObjectCapacity", 80000); } IConfig packetConfig = m_config.Configs["PacketPool"]; if (packetConfig != null) { PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); } #endregion Region Config m_basesimfps = 45f; m_basesimphysfps = 45f; m_basesimphysfps = Config.Configs["Physics"].GetFloat("BasePhysicsFPS", 45f); if (m_basesimphysfps > 45f) m_basesimphysfps = 45f; m_basesimfps = Config.Configs["Protection"].GetFloat("BaseRateFramesPerSecond", 45f); if (m_basesimfps > 45f) m_basesimfps = 45f; if (m_basesimphysfps > m_basesimfps) m_basesimphysfps = m_basesimfps; m_updatetimespan = 1000/m_basesimfps; m_physicstimespan = 1000/m_basesimphysfps; #region Startup Complete config EventManager.OnAddToStartupQueue += AddToStartupQueue; EventManager.OnModuleFinishedStartup += FinishedStartup; //EventManager.OnStartupComplete += StartupComplete; AddToStartupQueue("Startup"); #endregion }
public void Initialize(ISimulationBase openSim) { m_OpenSimBase = openSim; IConfig handlerConfig = openSim.ConfigSource.Configs["ApplicationPlugins"]; if (handlerConfig.GetString("SceneManager", "") != Name) return; m_config = openSim.ConfigSource; string name = String.Empty; // Try reading the [SimulationDataStore] section IConfig simConfig = openSim.ConfigSource.Configs["SimulationDataStore"]; if (simConfig != null) { name = simConfig.GetString("DatabaseLoaderName", "FileBasedDatabase"); } ISimulationDataStore[] stores = AuroraModuleLoader.PickupModules<ISimulationDataStore> ().ToArray (); foreach (ISimulationDataStore store in stores) { if (store.Name == name) { m_simulationDataService = store; break; } } if (m_simulationDataService == null) { m_log.ErrorFormat("[SceneManager]: FAILED TO LOAD THE SIMULATION SERVICE AT '{0}', QUITING...", name); Console.Read ();//Wait till they see Environment.Exit(0); } m_simulationDataService.Initialise(); AddConsoleCommands(); //Load the startup modules for the region m_startupPlugins = AuroraModuleLoader.PickupModules<ISharedRegionStartupModule>(); //Register us! m_OpenSimBase.ApplicationRegistry.RegisterModuleInterface<SceneManager>(this); }
public void Initialize(ISimulationBase openSim) { m_OpenSimBase = openSim; IConfig handlerConfig = openSim.ConfigSource.Configs["ApplicationPlugins"]; if (handlerConfig.GetString("SceneManager", "") != Name) { return; } m_localScenes = new List <Scene>(); m_config = openSim.ConfigSource; string StorageDLL = ""; string dllName = String.Empty; string connString = String.Empty; // Try reading the [DatabaseService] section, if it exists IConfig dbConfig = openSim.ConfigSource.Configs["DatabaseService"]; if (dbConfig != null) { dllName = dbConfig.GetString("StorageProvider", String.Empty); connString = dbConfig.GetString("ConnectionString", String.Empty); } // Try reading the [SimulationDataStore] section IConfig simConfig = openSim.ConfigSource.Configs["SimulationDataStore"]; if (simConfig != null) { dllName = simConfig.GetString("StorageProvider", dllName); connString = simConfig.GetString("ConnectionString", connString); } // We tried, but this doesn't exist. We can't proceed if (dllName == String.Empty) { dllName = "OpenSim.Data.Null.dll"; } m_simulationDataService = AuroraModuleLoader.LoadPlugin <ISimulationDataStore>(Util.BasePathCombine(dllName)); if (m_simulationDataService == null) { m_log.ErrorFormat("[SceneManager]: FAILED TO LOAD THE SIMULATION SERVICE AT '{0}', QUITING...", StorageDLL); System.Threading.Thread.Sleep(10000); Environment.Exit(0); } m_simulationDataService.Initialise(connString); AddConsoleCommands(); //Load the startup modules for the region m_startupPlugins = AuroraModuleLoader.PickupModules <ISharedRegionStartupModule>(); //Register us! m_OpenSimBase.ApplicationRegistry.RegisterModuleInterface <SceneManager>(this); }
public void Initialize(RegionInfo regionInfo, ISimulationDataStore dataStore, AgentCircuitManager authen, List <IClientNetworkServer> clientServers) { Initialize(regionInfo); //Set up the clientServer m_clientServers = clientServers; foreach (IClientNetworkServer clientServer in clientServers) { clientServer.AddScene(this); } m_sceneManager = RequestModuleInterface <ISceneManager>(); m_simDataStore = dataStore; m_config = m_sceneManager.ConfigSource; m_authenticateHandler = authen; m_UniverseEventManager = new UniverseEventManager(); m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); m_sceneGraph = new SceneGraph(this, m_regInfo); #region Region Config IConfig universestartupConfig = m_config.Configs["UniverseStartup"]; if (universestartupConfig != null) { //Region specific is still honored here, the RegionInfo checks for it, and if it is 0, it didn't set it if (RegionInfo.ObjectCapacity == 0) { RegionInfo.ObjectCapacity = universestartupConfig.GetInt("ObjectCapacity", 80000); } } IConfig packetConfig = m_config.Configs["PacketPool"]; if (packetConfig != null) { PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); } #endregion Region Config m_basesimfps = 45f; m_basesimphysfps = 45f; m_basesimphysfps = Config.Configs["Physics"].GetFloat("BasePhysicsFPS", 45f); if (m_basesimphysfps > 45f) { m_basesimphysfps = 45f; } m_basesimfps = Config.Configs["Protection"].GetFloat("BaseRateFramesPerSecond", 45f); if (m_basesimfps > 45f) { m_basesimfps = 45f; } if (m_basesimphysfps > m_basesimfps) { m_basesimphysfps = m_basesimfps; } m_updatetimespan = 1000 / m_basesimfps; m_physicstimespan = 1000 / m_basesimphysfps; #region Startup Complete config EventManager.OnAddToStartupQueue += AddToStartupQueue; EventManager.OnModuleFinishedStartup += FinishedStartup; AddToStartupQueue("Startup"); #endregion }
public void Initialize(ISimulationBase openSim) { m_OpenSimBase = openSim; IConfig handlerConfig = openSim.ConfigSource.Configs["ApplicationPlugins"]; if (handlerConfig.GetString("SceneManager", "") != Name) return; m_localScenes = new List<Scene>(); m_config = openSim.ConfigSource; string StorageDLL = ""; string dllName = String.Empty; string connString = String.Empty; // Try reading the [DatabaseService] section, if it exists IConfig dbConfig = openSim.ConfigSource.Configs["DatabaseService"]; if (dbConfig != null) { dllName = dbConfig.GetString("StorageProvider", String.Empty); connString = dbConfig.GetString("ConnectionString", String.Empty); } // Try reading the [SimulationDataStore] section IConfig simConfig = openSim.ConfigSource.Configs["SimulationDataStore"]; if (simConfig != null) { dllName = simConfig.GetString("StorageProvider", dllName); connString = simConfig.GetString("ConnectionString", connString); } // We tried, but this doesn't exist. We can't proceed if (dllName == String.Empty) dllName = "OpenSim.Data.Null.dll"; m_simulationDataService = AuroraModuleLoader.LoadPlugin<ISimulationDataStore>(dllName); if (m_simulationDataService == null) { m_log.ErrorFormat("[SceneManager]: FAILED TO LOAD THE SIMULATION SERVICE AT '{0}', QUITING...", StorageDLL); System.Threading.Thread.Sleep(10000); Environment.Exit(0); } m_simulationDataService.Initialise(connString); AddConsoleCommands(); //Load the startup modules for the region m_startupPlugins = AuroraModuleLoader.PickupModules<ISharedRegionStartupModule>(); //Register us! m_OpenSimBase.ApplicationRegistry.RegisterModuleInterface<SceneManager>(this); }
public void StartRegion(ISimulationDataStore simData, RegionInfo regionInfo) { MainConsole.Instance.InfoFormat("[SceneManager]: Starting region \"{0}\" at @ {1},{2}", regionInfo.RegionName, regionInfo.RegionLocX/256, regionInfo.RegionLocY/256); ISceneLoader sceneLoader = m_SimBase.ApplicationRegistry.RequestModuleInterface<ISceneLoader>(); if (sceneLoader == null) throw new Exception("No Scene Loader Interface!"); //Get the new scene from the interface IScene scene = sceneLoader.CreateScene(simData, regionInfo); m_scenes.Add(scene); MainConsole.Instance.ConsoleScenes = m_scenes; simData.SetRegion(scene); m_simulationDataServices.Add(simData); if (OnAddedScene != null) OnAddedScene(scene); StartModules(scene); if (OnFinishedAddingScene != null) OnFinishedAddingScene(scene); //Start the heartbeats scene.StartHeartbeat(); //Tell the scene that the startup is complete // Note: this event is added in the scene constructor scene.FinishedStartup("Startup", new List<string>()); }
public void Initialize(ISimulationBase simBase) { IConfig handlerConfig = simBase.ConfigSource.Configs["ApplicationPlugins"]; if (handlerConfig.GetString("SceneManager", "") != Name) return; string name = "FileBasedDatabase"; // Try reading the [SimulationDataStore] section IConfig simConfig = simBase.ConfigSource.Configs["SimulationDataStore"]; if (simConfig != null) { name = simConfig.GetString("DatabaseLoaderName", "FileBasedDatabase"); } ISimulationDataStore[] stores = UniverseModuleLoader.PickupModules<ISimulationDataStore>().ToArray(); List<string> storeNames = new List<string>(); foreach (ISimulationDataStore store in stores) { if (store.Name.ToLower() == name.ToLower()) { m_selectedDataService = store; break; } storeNames.Add(store.Name); } if (m_selectedDataService == null) { MainConsole.Instance.ErrorFormat( "[SceneManager]: FAILED TO LOAD THE SIMULATION SERVICE AT '{0}', ONLY OPTIONS ARE {1}, QUITING...", name, string.Join(", ", storeNames.ToArray())); Console.Read(); //Wait till they see Environment.Exit(0); } m_selectedDataService.Initialise(); AddConsoleCommands(); //Load the startup modules for the region m_startupPlugins = UniverseModuleLoader.PickupModules<ISharedRegionStartupModule>(); }
public void Initialize(RegionInfo regionInfo, AgentCircuitManager authen, List <IClientNetworkServer> clientServers) { Initialize(regionInfo); //Set up the clientServer m_clientServers = clientServers; foreach (IClientNetworkServer clientServer in clientServers) { clientServer.AddScene(this); } m_sceneManager = RequestModuleInterface <ISceneManager>(); m_simDataStore = m_sceneManager.GetSimulationDataStore(); m_config = m_sceneManager.ConfigSource; m_authenticateHandler = authen; m_AuroraEventManager = new AuroraEventManager(); m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); m_sceneGraph = new SceneGraph(this, m_regInfo); #region Region Config IConfig packetConfig = m_config.Configs["PacketPool"]; if (packetConfig != null) { PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); } #endregion Region Config m_basesimfps = 45f; m_basesimphysfps = 45f; m_basesimphysfps = Config.Configs["Physics"].GetFloat("BasePhysicsFPS", 45f); m_basesimfps = Config.Configs["Protection"].GetFloat("BaseRateFramesPerSecond", 45f); if (m_basesimphysfps > 45f) { m_basesimphysfps = 45f; } if (m_basesimfps > 45f) { m_basesimfps = 45f; } if (m_basesimphysfps > m_basesimfps) { m_basesimphysfps = m_basesimfps; } m_updatetimespan = 1000 / m_basesimfps; m_physicstimespan = 1000 / m_basesimphysfps; #region Startup Complete config EventManager.OnAddToStartupQueue += AddToStartupQueue; EventManager.OnModuleFinishedStartup += FinishedStartup; //EventManager.OnStartupComplete += StartupComplete; AddToStartupQueue("Startup"); #endregion }
/// <summary> /// Process inventory backup /// </summary> /// <param name="datastore"></param> public void ProcessInventoryBackup(ISimulationDataStore datastore) { if (HasInventoryChanged) { HasInventoryChanged = false; List<TaskInventoryItem> items = GetInventoryItems(); datastore.StorePrimInventory(m_part.UUID, items); IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); if (engines != null) { foreach (TaskInventoryItem item in items) { if (item.Type == (int)InventoryType.LSL) { foreach (IScriptModule engine in engines) { if (engine != null) { engine.SaveStateSave(item.ItemID, m_part.UUID); } } } } } } }