aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs125
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs50
-rw-r--r--OpenSim/Grid/UserServer/Main.cs4
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs7
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs23
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs4
6 files changed, 158 insertions, 55 deletions
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
index 20ec58a..cb122df 100644
--- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
@@ -26,10 +26,12 @@
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic;
29using System.IO; 30using System.IO;
30using System.Xml; 31using System.Xml;
31using libsecondlife; 32using libsecondlife;
32using Nini.Config; 33using Nini.Config;
34
33using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
34 36
35namespace OpenSim.Framework.Communications.Cache 37namespace OpenSim.Framework.Communications.Cache
@@ -41,44 +43,62 @@ namespace OpenSim.Framework.Communications.Cache
41 public class LibraryRootFolder : InventoryFolderImpl 43 public class LibraryRootFolder : InventoryFolderImpl
42 { 44 {
43 private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 45 private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
44 private InventoryFolderImpl m_textureFolder; 46
47 /// <summary>
48 /// Holds the root library folder and all its descendents. This is really only used during inventory
49 /// setup so that we don't have to repeatedly search the tree of library folders.
50 /// </summary>
51 protected Dictionary<LLUUID, InventoryFolderImpl> libraryFolders
52 = new Dictionary<LLUUID, InventoryFolderImpl>();
45 53
46 public LibraryRootFolder() 54 public LibraryRootFolder()
47 { 55 {
56 MainLog.Instance.Verbose("LIBRARYINVENTORY", "Loading library inventory");
57
48 agentID = libOwner; 58 agentID = libOwner;
49 folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); 59 folderID = new LLUUID("00000112-000f-0000-0000-000100bba000");
50 name = "OpenSim Library"; 60 name = "OpenSim Library";
51 parentID = LLUUID.Zero; 61 parentID = LLUUID.Zero;
52 type = (short) -1; 62 type = (short) 8;
53 version = (ushort) 1; 63 version = (ushort) 1;
54 64
55 InventoryFolderImpl folderInfo = new InventoryFolderImpl(); 65 libraryFolders.Add(folderID, this);
56 folderInfo.agentID = libOwner; 66
57 folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001"); 67 string foldersPath = Path.Combine(Util.configDir(), "inventory/OpenSimLibrary/OpenSimLibraryFolders.xml");
58 folderInfo.name = "Texture Library"; 68 if (File.Exists(foldersPath))
59 folderInfo.parentID = folderID; 69 {
60 folderInfo.type = -1; 70 try
61 folderInfo.version = 1; 71 {
62 SubFolders.Add(folderInfo.folderID, folderInfo); 72 XmlConfigSource source = new XmlConfigSource(foldersPath);
63 m_textureFolder = folderInfo; 73 ReadFoldersFromFile(source);
74 }
75 catch (XmlException e)
76 {
77 MainLog.Instance.Error("AGENTINVENTORY", "Error loading " + foldersPath + ": " + e.ToString());
78 }
79 }
64 80
65 CreateLibraryItems(); 81 CreateLibraryItems();
66 82
67 string filePath = Path.Combine(Util.configDir(), "inventory/OpenSimLibrary/OpenSimLibrary.xml"); 83 string itemsPath = Path.Combine(Util.configDir(), "inventory/OpenSimLibrary/OpenSimLibrary.xml");
68 if (File.Exists(filePath)) 84 if (File.Exists(itemsPath))
69 { 85 {
70 try 86 try
71 { 87 {
72 XmlConfigSource source = new XmlConfigSource(filePath); 88 XmlConfigSource source = new XmlConfigSource(itemsPath);
73 ReadItemsFromFile(source); 89 ReadItemsFromFile(source);
74 } 90 }
75 catch (XmlException e) 91 catch (XmlException e)
76 { 92 {
77 MainLog.Instance.Error("AGENTINVENTORY", "Error loading " + filePath + ": " + e.ToString()); 93 MainLog.Instance.Error("AGENTINVENTORY", "Error loading " + itemsPath + ": " + e.ToString());
78 } 94 }
79 } 95 }
80 } 96 }
81 97
98 /// <summary>
99 /// Hardcoded item creation. Please don't add any more items here - future items should be created
100 /// in the xml in the bin/inventory folder.
101 /// </summary>
82 private void CreateLibraryItems() 102 private void CreateLibraryItems()
83 { 103 {
84 InventoryItemBase item = 104 InventoryItemBase item =
@@ -133,7 +153,51 @@ namespace OpenSim.Framework.Communications.Cache
133 item.inventoryNextPermissions = 0x7FFFFFFF; 153 item.inventoryNextPermissions = 0x7FFFFFFF;
134 return item; 154 return item;
135 } 155 }
156
157 /// <summary>
158 /// Read library inventory folders from an external source
159 /// </summary>
160 /// <param name="source"></param>
161 private void ReadFoldersFromFile(IConfigSource source)
162 {
163 for (int i = 0; i < source.Configs.Count; i++)
164 {
165 IConfig config = source.Configs[i];
166
167 InventoryFolderImpl folderInfo = new InventoryFolderImpl();
168
169 folderInfo.folderID = new LLUUID(config.GetString("folderID", folderID.ToString()));
170 folderInfo.name = config.GetString("name", "unknown");
171 folderInfo.parentID = new LLUUID(config.GetString("parentFolderID", folderID.ToString()));
172 folderInfo.type = (short)config.GetInt("type", 8);
173
174 folderInfo.agentID = libOwner;
175 folderInfo.version = 1;
176
177 if (libraryFolders.ContainsKey(folderInfo.parentID))
178 {
179 InventoryFolderImpl parentFolder = libraryFolders[folderInfo.parentID];
180
181 libraryFolders.Add(folderInfo.folderID, folderInfo);
182 parentFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
183
184// MainLog.Instance.Verbose(
185// "LIBRARYINVENTORY", "Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID);
186 }
187 else
188 {
189 MainLog.Instance.Warn(
190 "LIBRARYINVENTORY",
191 "Couldn't add folder {0} ({1}) since parent folder with ID {2} does not exist!",
192 folderInfo.name, folderInfo.folderID, folderInfo.parentID);
193 }
194 }
195 }
136 196
197 /// <summary>
198 /// Read library inventory items metadata from an external source
199 /// </summary>
200 /// <param name="source"></param>
137 private void ReadItemsFromFile(IConfigSource source) 201 private void ReadItemsFromFile(IConfigSource source)
138 { 202 {
139 for (int i = 0; i < source.Configs.Count; i++) 203 for (int i = 0; i < source.Configs.Count; i++)
@@ -145,7 +209,7 @@ namespace OpenSim.Framework.Communications.Cache
145 new LLUUID(source.Configs[i].GetString("inventoryID", folderID.ToString())); 209 new LLUUID(source.Configs[i].GetString("inventoryID", folderID.ToString()));
146 item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToString())); 210 item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToString()));
147 item.parentFolderID 211 item.parentFolderID
148 = new LLUUID(source.Configs[i].GetString("folderID", LLUUID.Random().ToString())); 212 = new LLUUID(source.Configs[i].GetString("folderID", folderID.ToString()));
149 item.inventoryDescription = source.Configs[i].GetString("description", ""); 213 item.inventoryDescription = source.Configs[i].GetString("description", "");
150 item.inventoryName = source.Configs[i].GetString("name", ""); 214 item.inventoryName = source.Configs[i].GetString("name", "");
151 item.assetType = source.Configs[i].GetInt("assetType", 0); 215 item.assetType = source.Configs[i].GetInt("assetType", 0);
@@ -155,19 +219,30 @@ namespace OpenSim.Framework.Communications.Cache
155 item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); 219 item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF);
156 item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); 220 item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF);
157 221
158 if (item.parentFolderID == folderID) 222 if (libraryFolders.ContainsKey(item.parentFolderID))
159 { 223 {
160 Items.Add(item.inventoryID, item); 224 InventoryFolderImpl parentFolder = libraryFolders[item.parentFolderID];
225
226 parentFolder.Items.Add(item.inventoryID, item);
161 } 227 }
162 else 228 else
163 { 229 {
164 // Very temporary - will only work for immediate child folders 230 MainLog.Instance.Warn(
165 if (SubFolders.ContainsKey(item.parentFolderID)) 231 "LIBRARYINVENTORY",
166 { 232 "Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!",
167 SubFolders[item.parentFolderID].Items.Add(item.inventoryID, item); 233 item.inventoryName, item.inventoryID, item.parentFolderID);
168 } 234 }
169 }
170 } 235 }
171 } 236 }
237
238 /// <summary>
239 /// Looks like a simple getter, but is written like this for some consistency with the other Request
240 /// methods in the superclass
241 /// </summary>
242 /// <returns></returns>
243 public Dictionary<LLUUID, InventoryFolderImpl> RequestSelfAndDescendentFolders()
244 {
245 return libraryFolders;
246 }
172 } 247 }
173} 248}
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index bef20f7..a9d5d8b 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -28,9 +28,12 @@
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic;
31using System.Threading; 32using System.Threading;
32using libsecondlife; 33using libsecondlife;
33using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35
36using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
35 38
36namespace OpenSim.Framework.UserManagement 39namespace OpenSim.Framework.UserManagement
@@ -40,10 +43,18 @@ namespace OpenSim.Framework.UserManagement
40 protected string m_welcomeMessage = "Welcome to OpenSim"; 43 protected string m_welcomeMessage = "Welcome to OpenSim";
41 protected UserManagerBase m_userManager = null; 44 protected UserManagerBase m_userManager = null;
42 protected Mutex m_loginMutex = new Mutex(false); 45 protected Mutex m_loginMutex = new Mutex(false);
46
47 /// <summary>
48 /// Used during login to send the skeleton of the OpenSim Library to the client.
49 /// </summary>
50 protected LibraryRootFolder m_libraryRootFolder;
43 51
44 public LoginService(UserManagerBase userManager, string welcomeMess) 52 public LoginService(
53 UserManagerBase userManager, LibraryRootFolder libraryRootFolder, string welcomeMess)
45 { 54 {
46 m_userManager = userManager; 55 m_userManager = userManager;
56 m_libraryRootFolder = libraryRootFolder;
57
47 if (welcomeMess != "") 58 if (welcomeMess != "")
48 { 59 {
49 m_welcomeMessage = welcomeMess; 60 m_welcomeMessage = welcomeMess;
@@ -255,30 +266,27 @@ namespace OpenSim.Framework.UserManagement
255 } 266 }
256 267
257 /// <summary> 268 /// <summary>
258 /// 269 /// Converts the inventory library skeleton into the form required by the rpc request.
259 /// </summary> 270 /// </summary>
260 /// <returns></returns> 271 /// <returns></returns>
261 protected virtual ArrayList GetInventoryLibrary() 272 protected virtual ArrayList GetInventoryLibrary()
262 { 273 {
263 //return new ArrayList(); 274 Dictionary<LLUUID, InventoryFolderImpl> rootFolders
264 Hashtable TempHash = new Hashtable(); 275 = m_libraryRootFolder.RequestSelfAndDescendentFolders();
265 TempHash["name"] = "OpenSim Library"; 276 ArrayList folderHashes = new ArrayList();
266 TempHash["parent_id"] = LLUUID.Zero.ToString(); 277
267 TempHash["version"] = 1; 278 foreach (InventoryFolderBase folder in rootFolders.Values)
268 TempHash["type_default"] = -1; 279 {
269 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; 280 Hashtable TempHash = new Hashtable();
270 ArrayList temp = new ArrayList(); 281 TempHash["name"] = folder.name;
271 temp.Add(TempHash); 282 TempHash["parent_id"] = folder.parentID.ToString();
272 283 TempHash["version"] = folder.version;
273 TempHash = new Hashtable(); 284 TempHash["type_default"] = folder.type;
274 TempHash["name"] = "Texture Library"; 285 TempHash["folder_id"] = folder.folderID.ToString();
275 TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; 286 folderHashes.Add(TempHash);
276 TempHash["version"] = 1; 287 }
277 TempHash["type_default"] = -1; 288
278 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; 289 return folderHashes;
279 temp.Add(TempHash);
280
281 return temp;
282 } 290 }
283 291
284 /// <summary> 292 /// <summary>
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 6e3ccb7..d50558f 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
35using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
36 37
@@ -89,7 +90,8 @@ namespace OpenSim.Grid.UserServer
89 m_userManager._config = Cfg; 90 m_userManager._config = Cfg;
90 m_userManager.AddPlugin(Cfg.DatabaseProvider); 91 m_userManager.AddPlugin(Cfg.DatabaseProvider);
91 92
92 m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg); 93 m_loginService = new UserLoginService(
94 m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
93 95
94 MainLog.Instance.Verbose("REGION", "Starting HTTP process"); 96 MainLog.Instance.Verbose("REGION", "Starting HTTP process");
95 BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); 97 BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort);
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 0eb2db1..1a3bf2e 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -32,7 +32,9 @@ using System.Collections.Generic;
32using System.Threading; 32using System.Threading;
33using libsecondlife; 33using libsecondlife;
34using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35
35using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications.Cache;
36using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
37using OpenSim.Framework.Data; 39using OpenSim.Framework.Data;
38using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
@@ -45,8 +47,9 @@ namespace OpenSim.Grid.UserServer
45 { 47 {
46 public UserConfig m_config; 48 public UserConfig m_config;
47 49
48 public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess) 50 public UserLoginService(
49 : base(userManager, welcomeMess) 51 UserManagerBase userManager, LibraryRootFolder libraryRootFolder, UserConfig config, string welcomeMess)
52 : base(userManager, libraryRootFolder, welcomeMess)
50 { 53 {
51 m_config = config; 54 m_config = config;
52 } 55 }
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index fa2a989..2a3f947 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -326,12 +326,25 @@ namespace OpenSim
326 326
327 m_moduleLoader = new ModuleLoader(m_log, m_config); 327 m_moduleLoader = new ModuleLoader(m_log, m_config);
328 328
329 MainLog.Instance.Verbose("Plugins", "Loading OpenSim application plugins"); 329 ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup");
330 foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/Startup")) 330 MainLog.Instance.Verbose("PLUGINS", "Loading {0} OpenSim application plugins", nodes.Count);
331 { 331
332 foreach (TypeExtensionNode node in nodes)
333 {
332 IApplicationPlugin plugin = (IApplicationPlugin) node.CreateInstance(); 334 IApplicationPlugin plugin = (IApplicationPlugin) node.CreateInstance();
333 plugin.Initialise(this); 335
334 m_plugins.Add(plugin); 336 // Debug code to try and track down a bizzare ubuntu/mono/linux bug on standalone where we
337 // appear to try and initialize all the plugins twice. Currently disabled
338// MainLog.Instance.Verbose("PLUGINS", "Hitting plugin {0}", plugin.ToString());
339// if (m_plugins.Contains(plugin))
340// {
341// MainLog.Instance.Verbose("PLUGINS", "Skipping {0}", plugin.ToString());
342// }
343// else
344// {
345 plugin.Initialise(this);
346 m_plugins.Add(plugin);
347// }
335 } 348 }
336 349
337 // Start UDP servers 350 // Start UDP servers
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index bf5f205..0fb86af 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -30,7 +30,9 @@ using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using libsecondlife; 32using libsecondlife;
33
33using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
35using OpenSim.Framework.UserManagement; 37using OpenSim.Framework.UserManagement;
36using InventoryFolder=OpenSim.Framework.InventoryFolder; 38using InventoryFolder=OpenSim.Framework.InventoryFolder;
@@ -52,7 +54,7 @@ namespace OpenSim.Region.Communications.Local
52 54
53 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, 55 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent,
54 NetworkServersInfo serversInfo, bool authenticate) 56 NetworkServersInfo serversInfo, bool authenticate)
55 : base(userManager, welcomeMess) 57 : base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess)
56 { 58 {
57 m_Parent = parent; 59 m_Parent = parent;
58 this.serversInfo = serversInfo; 60 this.serversInfo = serversInfo;