From 8a9677a5319793ff630d0761e204ae8961f375aa Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 1 Jan 2010 21:12:46 -0800 Subject: The Library Service is now working. UserProfileCacheService.LibraryRoot is obsolete. Didn't delete it yet to avoid merge conflicts later -- want to stay out of core as much as possible. --- .../CoreModules/Framework/Library/LibraryModule.cs | 33 +++++++++++++++++----- .../Framework/Library/LocalInventoryService.cs | 4 +-- 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/CoreModules/Framework/Library') diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index 6941e00..f1022fd 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs @@ -37,6 +37,7 @@ using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; +using OpenSim.Server.Base; using OpenMetaverse; using log4net; @@ -53,6 +54,8 @@ namespace OpenSim.Region.CoreModules.Framework.Library private string m_LibraryName = "OpenSim Library"; private Scene m_Scene; + private ILibraryService m_Library; + #region ISharedRegionModule public void Initialise(IConfigSource config) @@ -60,9 +63,22 @@ namespace OpenSim.Region.CoreModules.Framework.Library m_Enabled = config.Configs["Modules"].GetBoolean("LibraryModule", m_Enabled); if (m_Enabled) { - IConfig libConfig = config.Configs["LibraryModule"]; + IConfig libConfig = config.Configs["LibraryService"]; if (libConfig != null) - m_LibraryName = libConfig.GetString("LibraryName", m_LibraryName); + { + string dllName = libConfig.GetString("LocalServiceModule", string.Empty); + m_log.Debug("[LIBRARY MODULE]: Library service dll is " + dllName); + if (dllName != string.Empty) + { + Object[] args = new Object[] { config }; + m_Library = ServerUtils.LoadPlugin(dllName, args); + } + } + } + if (m_Library == null) + { + m_log.Warn("[LIBRARY MODULE]: No local library service. Module will be disabled."); + m_Enabled = false; } } @@ -91,10 +107,15 @@ namespace OpenSim.Region.CoreModules.Framework.Library { m_Scene = scene; } + scene.RegisterModuleInterface(m_Library); } public void RemoveRegion(Scene scene) { + if (!m_Enabled) + return; + + scene.UnregisterModuleInterface(m_Library); } public void RegionLoaded(Scene scene) @@ -127,19 +148,17 @@ namespace OpenSim.Region.CoreModules.Framework.Library protected void LoadLibrariesFromArchives() { - InventoryFolderImpl lib = m_Scene.CommsManager.UserProfileCacheService.LibraryRoot; + InventoryFolderImpl lib = m_Library.LibraryRootFolder; if (lib == null) { m_log.Debug("[LIBRARY MODULE]: No library. Ignoring Library Module"); return; } - lib.Name = m_LibraryName; - RegionInfo regInfo = new RegionInfo(); Scene m_MockScene = new Scene(regInfo); m_MockScene.CommsManager = m_Scene.CommsManager; - LocalInventoryService invService = new LocalInventoryService((LibraryRootFolder)lib); + LocalInventoryService invService = new LocalInventoryService(lib); m_MockScene.RegisterModuleInterface(invService); m_MockScene.RegisterModuleInterface(m_Scene.AssetService); @@ -181,7 +200,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library private void DumpLibrary() { - InventoryFolderImpl lib = m_Scene.CommsManager.UserProfileCacheService.LibraryRoot; + InventoryFolderImpl lib = m_Library.LibraryRootFolder; m_log.DebugFormat(" - folder {0}", lib.Name); DumpFolder(lib); diff --git a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs index 2c95b5a..685c031 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs @@ -41,9 +41,9 @@ namespace OpenSim.Region.CoreModules.Framework.Library { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private LibraryRootFolder m_Library; + private InventoryFolderImpl m_Library; - public LocalInventoryService(LibraryRootFolder lib) + public LocalInventoryService(InventoryFolderImpl lib) { m_Library = lib; } -- cgit v1.1