aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2010-01-01 21:12:46 -0800
committerDiva Canto2010-01-01 21:12:46 -0800
commit8a9677a5319793ff630d0761e204ae8961f375aa (patch)
tree0b92d2c9258383df59866945ebad7ba8479563d0 /OpenSim/Region
parentForgotten modules in prior commit. (diff)
downloadopensim-SC_OLD-8a9677a5319793ff630d0761e204ae8961f375aa.zip
opensim-SC_OLD-8a9677a5319793ff630d0761e204ae8961f375aa.tar.gz
opensim-SC_OLD-8a9677a5319793ff630d0761e204ae8961f375aa.tar.bz2
opensim-SC_OLD-8a9677a5319793ff630d0761e204ae8961f375aa.tar.xz
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.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs29
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs34
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs13
7 files changed, 92 insertions, 37 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 0ec2ed5..25026a6 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -6962,7 +6962,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6962 assetRequestItem = invService.GetItem(assetRequestItem); 6962 assetRequestItem = invService.GetItem(assetRequestItem);
6963 if (assetRequestItem == null) 6963 if (assetRequestItem == null)
6964 { 6964 {
6965 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); 6965 ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>();
6966 if (lib != null)
6967 assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
6966 if (assetRequestItem == null) 6968 if (assetRequestItem == null)
6967 return true; 6969 return true;
6968 } 6970 }
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;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 39using OpenSim.Services.Interfaces;
40using OpenSim.Server.Base;
40 41
41using OpenMetaverse; 42using OpenMetaverse;
42using log4net; 43using log4net;
@@ -53,6 +54,8 @@ namespace OpenSim.Region.CoreModules.Framework.Library
53 private string m_LibraryName = "OpenSim Library"; 54 private string m_LibraryName = "OpenSim Library";
54 private Scene m_Scene; 55 private Scene m_Scene;
55 56
57 private ILibraryService m_Library;
58
56 #region ISharedRegionModule 59 #region ISharedRegionModule
57 60
58 public void Initialise(IConfigSource config) 61 public void Initialise(IConfigSource config)
@@ -60,9 +63,22 @@ namespace OpenSim.Region.CoreModules.Framework.Library
60 m_Enabled = config.Configs["Modules"].GetBoolean("LibraryModule", m_Enabled); 63 m_Enabled = config.Configs["Modules"].GetBoolean("LibraryModule", m_Enabled);
61 if (m_Enabled) 64 if (m_Enabled)
62 { 65 {
63 IConfig libConfig = config.Configs["LibraryModule"]; 66 IConfig libConfig = config.Configs["LibraryService"];
64 if (libConfig != null) 67 if (libConfig != null)
65 m_LibraryName = libConfig.GetString("LibraryName", m_LibraryName); 68 {
69 string dllName = libConfig.GetString("LocalServiceModule", string.Empty);
70 m_log.Debug("[LIBRARY MODULE]: Library service dll is " + dllName);
71 if (dllName != string.Empty)
72 {
73 Object[] args = new Object[] { config };
74 m_Library = ServerUtils.LoadPlugin<ILibraryService>(dllName, args);
75 }
76 }
77 }
78 if (m_Library == null)
79 {
80 m_log.Warn("[LIBRARY MODULE]: No local library service. Module will be disabled.");
81 m_Enabled = false;
66 } 82 }
67 } 83 }
68 84
@@ -91,10 +107,15 @@ namespace OpenSim.Region.CoreModules.Framework.Library
91 { 107 {
92 m_Scene = scene; 108 m_Scene = scene;
93 } 109 }
110 scene.RegisterModuleInterface<ILibraryService>(m_Library);
94 } 111 }
95 112
96 public void RemoveRegion(Scene scene) 113 public void RemoveRegion(Scene scene)
97 { 114 {
115 if (!m_Enabled)
116 return;
117
118 scene.UnregisterModuleInterface<ILibraryService>(m_Library);
98 } 119 }
99 120
100 public void RegionLoaded(Scene scene) 121 public void RegionLoaded(Scene scene)
@@ -127,19 +148,17 @@ namespace OpenSim.Region.CoreModules.Framework.Library
127 148
128 protected void LoadLibrariesFromArchives() 149 protected void LoadLibrariesFromArchives()
129 { 150 {
130 InventoryFolderImpl lib = m_Scene.CommsManager.UserProfileCacheService.LibraryRoot; 151 InventoryFolderImpl lib = m_Library.LibraryRootFolder;
131 if (lib == null) 152 if (lib == null)
132 { 153 {
133 m_log.Debug("[LIBRARY MODULE]: No library. Ignoring Library Module"); 154 m_log.Debug("[LIBRARY MODULE]: No library. Ignoring Library Module");
134 return; 155 return;
135 } 156 }
136 157
137 lib.Name = m_LibraryName;
138
139 RegionInfo regInfo = new RegionInfo(); 158 RegionInfo regInfo = new RegionInfo();
140 Scene m_MockScene = new Scene(regInfo); 159 Scene m_MockScene = new Scene(regInfo);
141 m_MockScene.CommsManager = m_Scene.CommsManager; 160 m_MockScene.CommsManager = m_Scene.CommsManager;
142 LocalInventoryService invService = new LocalInventoryService((LibraryRootFolder)lib); 161 LocalInventoryService invService = new LocalInventoryService(lib);
143 m_MockScene.RegisterModuleInterface<IInventoryService>(invService); 162 m_MockScene.RegisterModuleInterface<IInventoryService>(invService);
144 m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService); 163 m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService);
145 164
@@ -181,7 +200,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
181 200
182 private void DumpLibrary() 201 private void DumpLibrary()
183 { 202 {
184 InventoryFolderImpl lib = m_Scene.CommsManager.UserProfileCacheService.LibraryRoot; 203 InventoryFolderImpl lib = m_Library.LibraryRootFolder;
185 204
186 m_log.DebugFormat(" - folder {0}", lib.Name); 205 m_log.DebugFormat(" - folder {0}", lib.Name);
187 DumpFolder(lib); 206 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
41 { 41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 private LibraryRootFolder m_Library; 44 private InventoryFolderImpl m_Library;
45 45
46 public LocalInventoryService(LibraryRootFolder lib) 46 public LocalInventoryService(InventoryFolderImpl lib)
47 { 47 {
48 m_Library = lib; 48 m_Library = lib;
49 } 49 }
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index c9b3071..91c0a53 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -95,6 +95,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
95 95
96 protected Scene m_scene; 96 protected Scene m_scene;
97 97
98 private InventoryFolderImpl m_libraryRootFolder;
99 protected InventoryFolderImpl LibraryRootFolder
100 {
101 get
102 {
103 if (m_libraryRootFolder != null)
104 return m_libraryRootFolder;
105
106 ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>();
107 if (lib != null)
108 {
109 m_libraryRootFolder = lib.LibraryRootFolder;
110 }
111 return m_libraryRootFolder;
112 }
113 }
114
98 #region Constants 115 #region Constants
99 // These are here for testing. They will be taken out 116 // These are here for testing. They will be taken out
100 117
@@ -1005,9 +1022,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1005 IInventoryService invService = m_scene.InventoryService; 1022 IInventoryService invService = m_scene.InventoryService;
1006 InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); 1023 InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user);
1007 assetRequestItem = invService.GetItem(assetRequestItem); 1024 assetRequestItem = invService.GetItem(assetRequestItem);
1008 if (assetRequestItem == null) // Library item 1025 if (assetRequestItem == null && LibraryRootFolder != null) // Library item
1009 { 1026 {
1010 assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); 1027 assetRequestItem = LibraryRootFolder.FindItem(notecard);
1011 1028
1012 if (assetRequestItem != null) // Implicitly readable 1029 if (assetRequestItem != null) // Implicitly readable
1013 return true; 1030 return true;
@@ -1425,9 +1442,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1425 IInventoryService invService = m_scene.InventoryService; 1442 IInventoryService invService = m_scene.InventoryService;
1426 InventoryItemBase assetRequestItem = new InventoryItemBase(script, user); 1443 InventoryItemBase assetRequestItem = new InventoryItemBase(script, user);
1427 assetRequestItem = invService.GetItem(assetRequestItem); 1444 assetRequestItem = invService.GetItem(assetRequestItem);
1428 if (assetRequestItem == null) // Library item 1445 if (assetRequestItem == null && LibraryRootFolder != null) // Library item
1429 { 1446 {
1430 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); 1447 assetRequestItem = LibraryRootFolder.FindItem(script);
1431 1448
1432 if (assetRequestItem != null) // Implicitly readable 1449 if (assetRequestItem != null) // Implicitly readable
1433 return true; 1450 return true;
@@ -1520,9 +1537,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1520 IInventoryService invService = m_scene.InventoryService; 1537 IInventoryService invService = m_scene.InventoryService;
1521 InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); 1538 InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user);
1522 assetRequestItem = invService.GetItem(assetRequestItem); 1539 assetRequestItem = invService.GetItem(assetRequestItem);
1523 if (assetRequestItem == null) // Library item 1540 if (assetRequestItem == null && LibraryRootFolder != null) // Library item
1524 { 1541 {
1525 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); 1542 assetRequestItem = LibraryRootFolder.FindItem(notecard);
1526 1543
1527 if (assetRequestItem != null) // Implicitly readable 1544 if (assetRequestItem != null) // Implicitly readable
1528 return true; 1545 return true;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 89ce4ae..f322af3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -573,7 +573,9 @@ namespace OpenSim.Region.Framework.Scenes
573 "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}", 573 "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}",
574 remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName); 574 remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName);
575 575
576 InventoryItemBase item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(oldItemID); 576 InventoryItemBase item = null;
577 if (LibraryService != null && LibraryService.LibraryRootFolder != null)
578 item = LibraryService.LibraryRootFolder.FindItem(oldItemID);
577 579
578 if (item == null) 580 if (item == null)
579 { 581 {
@@ -1211,9 +1213,9 @@ namespace OpenSim.Region.Framework.Scenes
1211 item = InventoryService.GetItem(item); 1213 item = InventoryService.GetItem(item);
1212 1214
1213 // Try library 1215 // Try library
1214 if (null == item) 1216 if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
1215 { 1217 {
1216 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); 1218 item = LibraryService.LibraryRootFolder.FindItem(itemID);
1217 } 1219 }
1218 1220
1219 if (item != null) 1221 if (item != null)
@@ -1280,9 +1282,9 @@ namespace OpenSim.Region.Framework.Scenes
1280 1282
1281 // Try library 1283 // Try library
1282 // XXX clumsy, possibly should be one call 1284 // XXX clumsy, possibly should be one call
1283 if (null == item) 1285 if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
1284 { 1286 {
1285 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); 1287 item = LibraryService.LibraryRootFolder.FindItem(itemID);
1286 } 1288 }
1287 1289
1288 if (item != null) 1290 if (item != null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 47fbeb4..022d79d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -424,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes
424 /// <param name="ownerID"></param> 424 /// <param name="ownerID"></param>
425 public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID) 425 public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID)
426 { 426 {
427 if (ownerID == CommsManager.UserProfileCacheService.LibraryRoot.Owner) 427 if (LibraryService != null && LibraryService.LibraryRootFolder != null && ownerID == LibraryService.LibraryRootFolder.Owner)
428 { 428 {
429 //m_log.Debug("request info for library item"); 429 //m_log.Debug("request info for library item");
430 return; 430 return;
@@ -458,13 +458,14 @@ namespace OpenSim.Region.Framework.Scenes
458 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. 458 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
459 // can be handled transparently). 459 // can be handled transparently).
460 InventoryFolderImpl fold = null; 460 InventoryFolderImpl fold = null;
461 if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) 461 if (LibraryService != null && LibraryService.LibraryRootFolder != null)
462 { 462 if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
463 remoteClient.SendInventoryFolderDetails( 463 {
464 fold.Owner, folderID, fold.RequestListOfItems(), 464 remoteClient.SendInventoryFolderDetails(
465 fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems); 465 fold.Owner, folderID, fold.RequestListOfItems(),
466 return; 466 fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
467 } 467 return;
468 }
468 469
469 // We're going to send the reply async, because there may be 470 // We're going to send the reply async, because there may be
470 // an enormous quantity of packets -- basically the entire inventory! 471 // an enormous quantity of packets -- basically the entire inventory!
@@ -512,15 +513,16 @@ namespace OpenSim.Region.Framework.Scenes
512 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. 513 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
513 // can be handled transparently). 514 // can be handled transparently).
514 InventoryFolderImpl fold; 515 InventoryFolderImpl fold;
515 if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) 516 if (LibraryService != null && LibraryService.LibraryRootFolder != null)
516 { 517 if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
517 version = 0; 518 {
518 InventoryCollection ret = new InventoryCollection(); 519 version = 0;
519 ret.Folders = new List<InventoryFolderBase>(); 520 InventoryCollection ret = new InventoryCollection();
520 ret.Items = fold.RequestListOfItems(); 521 ret.Folders = new List<InventoryFolderBase>();
522 ret.Items = fold.RequestListOfItems();
521 523
522 return ret; 524 return ret;
523 } 525 }
524 526
525 InventoryCollection contents = new InventoryCollection(); 527 InventoryCollection contents = new InventoryCollection();
526 528
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 418cfbf..ae189b5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -240,6 +240,19 @@ namespace OpenSim.Region.Framework.Scenes
240 } 240 }
241 } 241 }
242 242
243 protected ILibraryService m_LibraryService;
244
245 public ILibraryService LibraryService
246 {
247 get
248 {
249 if (m_LibraryService == null)
250 m_LibraryService = RequestModuleInterface<ILibraryService>();
251
252 return m_LibraryService;
253 }
254 }
255
243 protected IXMLRPC m_xmlrpcModule; 256 protected IXMLRPC m_xmlrpcModule;
244 protected IWorldComm m_worldCommModule; 257 protected IWorldComm m_worldCommModule;
245 protected IAvatarFactory m_AvatarFactory; 258 protected IAvatarFactory m_AvatarFactory;