diff options
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r-- | OpenSim/Grid/GridServer/GridServerBase.cs | 3 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/Program.cs | 2 | ||||
-rw-r--r-- | OpenSim/Grid/InventoryServer/AuthedSessionCache.cs | 133 | ||||
-rw-r--r-- | OpenSim/Grid/InventoryServer/InventoryServiceBase.cs | 519 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/Main.cs | 5 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs | 7 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 5 |
7 files changed, 670 insertions, 4 deletions
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index e3ad52a..d63ac2e 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs | |||
@@ -49,6 +49,7 @@ namespace OpenSim.Grid.GridServer | |||
49 | protected GridConfig m_config; | 49 | protected GridConfig m_config; |
50 | public string m_consoleType = "local"; | 50 | public string m_consoleType = "local"; |
51 | public IConfigSource m_configSource = null; | 51 | public IConfigSource m_configSource = null; |
52 | public string m_configFile = "GridServer_Config.xml"; | ||
52 | 53 | ||
53 | public GridConfig Config | 54 | public GridConfig Config |
54 | { | 55 | { |
@@ -91,7 +92,7 @@ namespace OpenSim.Grid.GridServer | |||
91 | break; | 92 | break; |
92 | } | 93 | } |
93 | MainConsole.Instance = m_console; | 94 | MainConsole.Instance = m_console; |
94 | m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); | 95 | m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), m_configFile))); |
95 | 96 | ||
96 | m_log.Info("[GRID]: Starting HTTP process"); | 97 | m_log.Info("[GRID]: Starting HTTP process"); |
97 | m_httpServer = new BaseHttpServer(m_config.HttpPort); | 98 | m_httpServer = new BaseHttpServer(m_config.HttpPort); |
diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs index c7ba897..741a01b 100644 --- a/OpenSim/Grid/GridServer/Program.cs +++ b/OpenSim/Grid/GridServer/Program.cs | |||
@@ -36,6 +36,7 @@ namespace OpenSim.Grid.GridServer | |||
36 | { | 36 | { |
37 | ArgvConfigSource argvSource = new ArgvConfigSource(args); | 37 | ArgvConfigSource argvSource = new ArgvConfigSource(args); |
38 | argvSource.AddSwitch("Startup", "console", "c"); | 38 | argvSource.AddSwitch("Startup", "console", "c"); |
39 | argvSource.AddSwitch("Startup", "xmlfile", "x"); | ||
39 | 40 | ||
40 | XmlConfigurator.Configure(); | 41 | XmlConfigurator.Configure(); |
41 | 42 | ||
@@ -45,6 +46,7 @@ namespace OpenSim.Grid.GridServer | |||
45 | if (startupConfig != null) | 46 | if (startupConfig != null) |
46 | { | 47 | { |
47 | app.m_consoleType = startupConfig.GetString("console", "local"); | 48 | app.m_consoleType = startupConfig.GetString("console", "local"); |
49 | app.m_configFile = startupConfig.GetString("xmlfile", "GridServer_Config.xml"); | ||
48 | } | 50 | } |
49 | 51 | ||
50 | app.m_configSource = argvSource; | 52 | app.m_configSource = argvSource; |
diff --git a/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs b/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs new file mode 100644 index 0000000..dadf34a --- /dev/null +++ b/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | |||
31 | namespace OpenSim.Grid.InventoryServer | ||
32 | { | ||
33 | public class AuthedSessionCache | ||
34 | { | ||
35 | public class CacheData | ||
36 | { | ||
37 | private static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1); | ||
38 | private string m_session_id; | ||
39 | private string m_agent_id; | ||
40 | private int m_expire; | ||
41 | |||
42 | private int get_current_unix_time() | ||
43 | { | ||
44 | return (int)(DateTime.UtcNow - UNIX_EPOCH).TotalSeconds; | ||
45 | } | ||
46 | |||
47 | public CacheData(string sid, string aid) | ||
48 | { | ||
49 | m_session_id = sid; | ||
50 | m_agent_id = aid; | ||
51 | m_expire = get_current_unix_time() + DEFAULT_LIFETIME; | ||
52 | } | ||
53 | |||
54 | public CacheData(string sid, string aid, int time_now) | ||
55 | { | ||
56 | m_session_id = sid; | ||
57 | m_agent_id = aid; | ||
58 | m_expire = time_now + DEFAULT_LIFETIME; | ||
59 | } | ||
60 | |||
61 | public string SessionID | ||
62 | { | ||
63 | get { return m_session_id; } | ||
64 | set { m_session_id = value; } | ||
65 | } | ||
66 | |||
67 | public string AgentID | ||
68 | { | ||
69 | get { return m_agent_id; } | ||
70 | set { m_agent_id = value; } | ||
71 | } | ||
72 | |||
73 | public bool isExpired | ||
74 | { | ||
75 | get { return m_expire < get_current_unix_time(); } | ||
76 | } | ||
77 | |||
78 | public void Renew() | ||
79 | { | ||
80 | m_expire = get_current_unix_time() + DEFAULT_LIFETIME; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | private static readonly int DEFAULT_LIFETIME = 30; | ||
85 | private Dictionary<string, CacheData> m_authed_sessions = new Dictionary<string,CacheData>(); | ||
86 | // private int m_session_lifetime = DEFAULT_LIFETIME; | ||
87 | |||
88 | public AuthedSessionCache() | ||
89 | { | ||
90 | // m_session_lifetime = DEFAULT_LIFETIME; | ||
91 | } | ||
92 | |||
93 | public AuthedSessionCache(int timeout) | ||
94 | { | ||
95 | // m_session_lifetime = timeout; | ||
96 | } | ||
97 | |||
98 | public CacheData getCachedSession(string session_id, string agent_id) | ||
99 | { | ||
100 | CacheData ret = null; | ||
101 | lock (m_authed_sessions) | ||
102 | { | ||
103 | if (m_authed_sessions.ContainsKey(session_id)) | ||
104 | { | ||
105 | CacheData cached_session = m_authed_sessions[session_id]; | ||
106 | if (!cached_session.isExpired && cached_session.AgentID == agent_id) | ||
107 | { | ||
108 | ret = m_authed_sessions[session_id]; | ||
109 | // auto renew | ||
110 | m_authed_sessions[session_id].Renew(); | ||
111 | } | ||
112 | } | ||
113 | } | ||
114 | return ret; | ||
115 | } | ||
116 | |||
117 | public void Add(string session_id, string agent_id) | ||
118 | { | ||
119 | CacheData data = new CacheData(session_id, agent_id); | ||
120 | lock (m_authed_sessions) | ||
121 | { | ||
122 | if (m_authed_sessions.ContainsKey(session_id)) | ||
123 | { | ||
124 | m_authed_sessions[session_id] = data; | ||
125 | } | ||
126 | else | ||
127 | { | ||
128 | m_authed_sessions.Add(session_id, data); | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | } | ||
133 | } | ||
diff --git a/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs b/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs new file mode 100644 index 0000000..f8b4949 --- /dev/null +++ b/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs | |||
@@ -0,0 +1,519 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications; | ||
35 | |||
36 | namespace OpenSim.Grid.InventoryServer | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Abstract base class used by local and grid implementations of an inventory service. | ||
40 | /// </summary> | ||
41 | public abstract class InventoryServiceBase : IInterServiceInventoryServices | ||
42 | { | ||
43 | |||
44 | private static readonly ILog m_log | ||
45 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | protected List<IInventoryDataPlugin> m_plugins = new List<IInventoryDataPlugin>(); | ||
48 | |||
49 | #region Plugin methods | ||
50 | |||
51 | /// <summary> | ||
52 | /// Add a new inventory data plugin - plugins will be requested in the order they were added. | ||
53 | /// </summary> | ||
54 | /// <param name="plugin">The plugin that will provide data</param> | ||
55 | public void AddPlugin(IInventoryDataPlugin plugin) | ||
56 | { | ||
57 | m_plugins.Add(plugin); | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Adds a list of inventory data plugins, as described by `provider' | ||
62 | /// and `connect', to `m_plugins'. | ||
63 | /// </summary> | ||
64 | /// <param name="provider"> | ||
65 | /// The filename of the inventory server plugin DLL. | ||
66 | /// </param> | ||
67 | /// <param name="connect"> | ||
68 | /// The connection string for the storage backend. | ||
69 | /// </param> | ||
70 | public void AddPlugin(string provider, string connect) | ||
71 | { | ||
72 | m_plugins.AddRange(DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(provider, connect)); | ||
73 | } | ||
74 | |||
75 | #endregion | ||
76 | |||
77 | #region IInventoryServices methods | ||
78 | |||
79 | public string Host | ||
80 | { | ||
81 | get { return "default"; } | ||
82 | } | ||
83 | |||
84 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
85 | { | ||
86 | // m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); | ||
87 | |||
88 | InventoryFolderBase rootFolder = RequestRootFolder(userId); | ||
89 | |||
90 | // Agent has no inventory structure yet. | ||
91 | if (null == rootFolder) | ||
92 | { | ||
93 | return null; | ||
94 | } | ||
95 | |||
96 | List<InventoryFolderBase> userFolders = new List<InventoryFolderBase>(); | ||
97 | |||
98 | userFolders.Add(rootFolder); | ||
99 | |||
100 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
101 | { | ||
102 | IList<InventoryFolderBase> folders = plugin.getFolderHierarchy(rootFolder.ID); | ||
103 | userFolders.AddRange(folders); | ||
104 | } | ||
105 | |||
106 | // foreach (InventoryFolderBase folder in userFolders) | ||
107 | // { | ||
108 | // m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID); | ||
109 | // } | ||
110 | |||
111 | return userFolders; | ||
112 | } | ||
113 | |||
114 | // See IInventoryServices | ||
115 | public virtual bool HasInventoryForUser(UUID userID) | ||
116 | { | ||
117 | return false; | ||
118 | } | ||
119 | |||
120 | // See IInventoryServices | ||
121 | public virtual InventoryFolderBase RequestRootFolder(UUID userID) | ||
122 | { | ||
123 | // Retrieve the first root folder we get from the list of plugins. | ||
124 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
125 | { | ||
126 | InventoryFolderBase rootFolder = plugin.getUserRootFolder(userID); | ||
127 | if (rootFolder != null) | ||
128 | return rootFolder; | ||
129 | } | ||
130 | |||
131 | // Return nothing if no plugin was able to supply a root folder | ||
132 | return null; | ||
133 | } | ||
134 | |||
135 | // See IInventoryServices | ||
136 | public bool CreateNewUserInventory(UUID user) | ||
137 | { | ||
138 | InventoryFolderBase existingRootFolder = RequestRootFolder(user); | ||
139 | |||
140 | if (null != existingRootFolder) | ||
141 | { | ||
142 | m_log.WarnFormat( | ||
143 | "[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have " | ||
144 | + "a root inventory folder with id {1}", | ||
145 | user, existingRootFolder.ID); | ||
146 | } | ||
147 | else | ||
148 | { | ||
149 | UsersInventory inven = new UsersInventory(); | ||
150 | inven.CreateNewInventorySet(user); | ||
151 | AddNewInventorySet(inven); | ||
152 | |||
153 | return true; | ||
154 | } | ||
155 | |||
156 | return false; | ||
157 | } | ||
158 | |||
159 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
160 | { | ||
161 | List<InventoryItemBase> activeGestures = new List<InventoryItemBase>(); | ||
162 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
163 | { | ||
164 | activeGestures.AddRange(plugin.fetchActiveGestures(userId)); | ||
165 | } | ||
166 | |||
167 | return activeGestures; | ||
168 | } | ||
169 | |||
170 | #endregion | ||
171 | |||
172 | #region Methods used by GridInventoryService | ||
173 | |||
174 | public List<InventoryFolderBase> RequestSubFolders(UUID parentFolderID) | ||
175 | { | ||
176 | List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); | ||
177 | |||
178 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
179 | { | ||
180 | inventoryList.AddRange(plugin.getInventoryFolders(parentFolderID)); | ||
181 | } | ||
182 | |||
183 | return inventoryList; | ||
184 | } | ||
185 | |||
186 | public List<InventoryItemBase> RequestFolderItems(UUID folderID) | ||
187 | { | ||
188 | List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); | ||
189 | |||
190 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
191 | { | ||
192 | itemsList.AddRange(plugin.getInventoryInFolder(folderID)); | ||
193 | } | ||
194 | |||
195 | return itemsList; | ||
196 | } | ||
197 | |||
198 | #endregion | ||
199 | |||
200 | // See IInventoryServices | ||
201 | public virtual bool AddFolder(InventoryFolderBase folder) | ||
202 | { | ||
203 | m_log.DebugFormat( | ||
204 | "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); | ||
205 | |||
206 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
207 | { | ||
208 | plugin.addInventoryFolder(folder); | ||
209 | } | ||
210 | |||
211 | // FIXME: Should return false on failure | ||
212 | return true; | ||
213 | } | ||
214 | |||
215 | // See IInventoryServices | ||
216 | public virtual bool UpdateFolder(InventoryFolderBase folder) | ||
217 | { | ||
218 | m_log.DebugFormat( | ||
219 | "[AGENT INVENTORY]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); | ||
220 | |||
221 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
222 | { | ||
223 | plugin.updateInventoryFolder(folder); | ||
224 | } | ||
225 | |||
226 | // FIXME: Should return false on failure | ||
227 | return true; | ||
228 | } | ||
229 | |||
230 | // See IInventoryServices | ||
231 | public virtual bool MoveFolder(InventoryFolderBase folder) | ||
232 | { | ||
233 | m_log.DebugFormat( | ||
234 | "[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); | ||
235 | |||
236 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
237 | { | ||
238 | plugin.moveInventoryFolder(folder); | ||
239 | } | ||
240 | |||
241 | // FIXME: Should return false on failure | ||
242 | return true; | ||
243 | } | ||
244 | |||
245 | // See IInventoryServices | ||
246 | public virtual bool AddItem(InventoryItemBase item) | ||
247 | { | ||
248 | m_log.DebugFormat( | ||
249 | "[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); | ||
250 | |||
251 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
252 | { | ||
253 | plugin.addInventoryItem(item); | ||
254 | } | ||
255 | |||
256 | // FIXME: Should return false on failure | ||
257 | return true; | ||
258 | } | ||
259 | |||
260 | // See IInventoryServices | ||
261 | public virtual bool UpdateItem(InventoryItemBase item) | ||
262 | { | ||
263 | m_log.InfoFormat( | ||
264 | "[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); | ||
265 | |||
266 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
267 | { | ||
268 | plugin.updateInventoryItem(item); | ||
269 | } | ||
270 | |||
271 | // FIXME: Should return false on failure | ||
272 | return true; | ||
273 | } | ||
274 | |||
275 | // See IInventoryServices | ||
276 | public virtual bool DeleteItem(InventoryItemBase item) | ||
277 | { | ||
278 | m_log.InfoFormat( | ||
279 | "[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); | ||
280 | |||
281 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
282 | { | ||
283 | plugin.deleteInventoryItem(item.ID); | ||
284 | } | ||
285 | |||
286 | // FIXME: Should return false on failure | ||
287 | return true; | ||
288 | } | ||
289 | |||
290 | public virtual InventoryItemBase QueryItem(InventoryItemBase item) | ||
291 | { | ||
292 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
293 | { | ||
294 | InventoryItemBase result = plugin.queryInventoryItem(item.ID); | ||
295 | if (result != null) | ||
296 | return result; | ||
297 | } | ||
298 | |||
299 | return null; | ||
300 | } | ||
301 | |||
302 | public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item) | ||
303 | { | ||
304 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
305 | { | ||
306 | InventoryFolderBase result = plugin.queryInventoryFolder(item.ID); | ||
307 | if (result != null) | ||
308 | return result; | ||
309 | } | ||
310 | |||
311 | return null; | ||
312 | } | ||
313 | |||
314 | /// <summary> | ||
315 | /// Purge a folder of all items items and subfolders. | ||
316 | /// | ||
317 | /// FIXME: Really nasty in a sense, because we have to query the database to get information we may | ||
318 | /// already know... Needs heavy refactoring. | ||
319 | /// </summary> | ||
320 | /// <param name="folder"></param> | ||
321 | public virtual bool PurgeFolder(InventoryFolderBase folder) | ||
322 | { | ||
323 | m_log.DebugFormat( | ||
324 | "[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); | ||
325 | |||
326 | List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID); | ||
327 | |||
328 | foreach (InventoryFolderBase subFolder in subFolders) | ||
329 | { | ||
330 | // m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); | ||
331 | |||
332 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
333 | { | ||
334 | plugin.deleteInventoryFolder(subFolder.ID); | ||
335 | } | ||
336 | } | ||
337 | |||
338 | List<InventoryItemBase> items = RequestFolderItems(folder.ID); | ||
339 | |||
340 | foreach (InventoryItemBase item in items) | ||
341 | { | ||
342 | DeleteItem(item); | ||
343 | } | ||
344 | |||
345 | // FIXME: Should return false on failure | ||
346 | return true; | ||
347 | } | ||
348 | |||
349 | private void AddNewInventorySet(UsersInventory inventory) | ||
350 | { | ||
351 | foreach (InventoryFolderBase folder in inventory.Folders.Values) | ||
352 | { | ||
353 | AddFolder(folder); | ||
354 | } | ||
355 | } | ||
356 | |||
357 | public InventoryItemBase GetInventoryItem(UUID itemID) | ||
358 | { | ||
359 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
360 | { | ||
361 | InventoryItemBase item = plugin.getInventoryItem(itemID); | ||
362 | if (item != null) | ||
363 | return item; | ||
364 | } | ||
365 | |||
366 | return null; | ||
367 | } | ||
368 | |||
369 | /// <summary> | ||
370 | /// Used to create a new user inventory. | ||
371 | /// </summary> | ||
372 | private class UsersInventory | ||
373 | { | ||
374 | public Dictionary<UUID, InventoryFolderBase> Folders = new Dictionary<UUID, InventoryFolderBase>(); | ||
375 | public Dictionary<UUID, InventoryItemBase> Items = new Dictionary<UUID, InventoryItemBase>(); | ||
376 | |||
377 | public virtual void CreateNewInventorySet(UUID user) | ||
378 | { | ||
379 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
380 | |||
381 | folder.ParentID = UUID.Zero; | ||
382 | folder.Owner = user; | ||
383 | folder.ID = UUID.Random(); | ||
384 | folder.Name = "My Inventory"; | ||
385 | folder.Type = (short)AssetType.Folder; | ||
386 | folder.Version = 1; | ||
387 | Folders.Add(folder.ID, folder); | ||
388 | |||
389 | UUID rootFolder = folder.ID; | ||
390 | |||
391 | folder = new InventoryFolderBase(); | ||
392 | folder.ParentID = rootFolder; | ||
393 | folder.Owner = user; | ||
394 | folder.ID = UUID.Random(); | ||
395 | folder.Name = "Animations"; | ||
396 | folder.Type = (short)AssetType.Animation; | ||
397 | folder.Version = 1; | ||
398 | Folders.Add(folder.ID, folder); | ||
399 | |||
400 | folder = new InventoryFolderBase(); | ||
401 | folder.ParentID = rootFolder; | ||
402 | folder.Owner = user; | ||
403 | folder.ID = UUID.Random(); | ||
404 | folder.Name = "Body Parts"; | ||
405 | folder.Type = (short)AssetType.Bodypart; | ||
406 | folder.Version = 1; | ||
407 | Folders.Add(folder.ID, folder); | ||
408 | |||
409 | folder = new InventoryFolderBase(); | ||
410 | folder.ParentID = rootFolder; | ||
411 | folder.Owner = user; | ||
412 | folder.ID = UUID.Random(); | ||
413 | folder.Name = "Calling Cards"; | ||
414 | folder.Type = (short)AssetType.CallingCard; | ||
415 | folder.Version = 1; | ||
416 | Folders.Add(folder.ID, folder); | ||
417 | |||
418 | folder = new InventoryFolderBase(); | ||
419 | folder.ParentID = rootFolder; | ||
420 | folder.Owner = user; | ||
421 | folder.ID = UUID.Random(); | ||
422 | folder.Name = "Clothing"; | ||
423 | folder.Type = (short)AssetType.Clothing; | ||
424 | folder.Version = 1; | ||
425 | Folders.Add(folder.ID, folder); | ||
426 | |||
427 | folder = new InventoryFolderBase(); | ||
428 | folder.ParentID = rootFolder; | ||
429 | folder.Owner = user; | ||
430 | folder.ID = UUID.Random(); | ||
431 | folder.Name = "Gestures"; | ||
432 | folder.Type = (short)AssetType.Gesture; | ||
433 | folder.Version = 1; | ||
434 | Folders.Add(folder.ID, folder); | ||
435 | |||
436 | folder = new InventoryFolderBase(); | ||
437 | folder.ParentID = rootFolder; | ||
438 | folder.Owner = user; | ||
439 | folder.ID = UUID.Random(); | ||
440 | folder.Name = "Landmarks"; | ||
441 | folder.Type = (short)AssetType.Landmark; | ||
442 | folder.Version = 1; | ||
443 | Folders.Add(folder.ID, folder); | ||
444 | |||
445 | folder = new InventoryFolderBase(); | ||
446 | folder.ParentID = rootFolder; | ||
447 | folder.Owner = user; | ||
448 | folder.ID = UUID.Random(); | ||
449 | folder.Name = "Lost And Found"; | ||
450 | folder.Type = (short)AssetType.LostAndFoundFolder; | ||
451 | folder.Version = 1; | ||
452 | Folders.Add(folder.ID, folder); | ||
453 | |||
454 | folder = new InventoryFolderBase(); | ||
455 | folder.ParentID = rootFolder; | ||
456 | folder.Owner = user; | ||
457 | folder.ID = UUID.Random(); | ||
458 | folder.Name = "Notecards"; | ||
459 | folder.Type = (short)AssetType.Notecard; | ||
460 | folder.Version = 1; | ||
461 | Folders.Add(folder.ID, folder); | ||
462 | |||
463 | folder = new InventoryFolderBase(); | ||
464 | folder.ParentID = rootFolder; | ||
465 | folder.Owner = user; | ||
466 | folder.ID = UUID.Random(); | ||
467 | folder.Name = "Objects"; | ||
468 | folder.Type = (short)AssetType.Object; | ||
469 | folder.Version = 1; | ||
470 | Folders.Add(folder.ID, folder); | ||
471 | |||
472 | folder = new InventoryFolderBase(); | ||
473 | folder.ParentID = rootFolder; | ||
474 | folder.Owner = user; | ||
475 | folder.ID = UUID.Random(); | ||
476 | folder.Name = "Photo Album"; | ||
477 | folder.Type = (short)AssetType.SnapshotFolder; | ||
478 | folder.Version = 1; | ||
479 | Folders.Add(folder.ID, folder); | ||
480 | |||
481 | folder = new InventoryFolderBase(); | ||
482 | folder.ParentID = rootFolder; | ||
483 | folder.Owner = user; | ||
484 | folder.ID = UUID.Random(); | ||
485 | folder.Name = "Scripts"; | ||
486 | folder.Type = (short)AssetType.LSLText; | ||
487 | folder.Version = 1; | ||
488 | Folders.Add(folder.ID, folder); | ||
489 | |||
490 | folder = new InventoryFolderBase(); | ||
491 | folder.ParentID = rootFolder; | ||
492 | folder.Owner = user; | ||
493 | folder.ID = UUID.Random(); | ||
494 | folder.Name = "Sounds"; | ||
495 | folder.Type = (short)AssetType.Sound; | ||
496 | folder.Version = 1; | ||
497 | Folders.Add(folder.ID, folder); | ||
498 | |||
499 | folder = new InventoryFolderBase(); | ||
500 | folder.ParentID = rootFolder; | ||
501 | folder.Owner = user; | ||
502 | folder.ID = UUID.Random(); | ||
503 | folder.Name = "Textures"; | ||
504 | folder.Type = (short)AssetType.Texture; | ||
505 | folder.Version = 1; | ||
506 | Folders.Add(folder.ID, folder); | ||
507 | |||
508 | folder = new InventoryFolderBase(); | ||
509 | folder.ParentID = rootFolder; | ||
510 | folder.Owner = user; | ||
511 | folder.ID = UUID.Random(); | ||
512 | folder.Name = "Trash"; | ||
513 | folder.Type = (short)AssetType.TrashFolder; | ||
514 | folder.Version = 1; | ||
515 | Folders.Add(folder.ID, folder); | ||
516 | } | ||
517 | } | ||
518 | } | ||
519 | } | ||
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index 654e770..f2631a7 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs | |||
@@ -59,16 +59,19 @@ namespace OpenSim.Grid.MessagingServer | |||
59 | 59 | ||
60 | protected static string m_consoleType = "local"; | 60 | protected static string m_consoleType = "local"; |
61 | protected static IConfigSource m_config = null; | 61 | protected static IConfigSource m_config = null; |
62 | protected static string m_configFile = "MessagingServer_Config.xml"; | ||
62 | 63 | ||
63 | public static void Main(string[] args) | 64 | public static void Main(string[] args) |
64 | { | 65 | { |
65 | ArgvConfigSource argvSource = new ArgvConfigSource(args); | 66 | ArgvConfigSource argvSource = new ArgvConfigSource(args); |
66 | argvSource.AddSwitch("Startup", "console", "c"); | 67 | argvSource.AddSwitch("Startup", "console", "c"); |
68 | argvSource.AddSwitch("Startup", "xmlfile", "x"); | ||
67 | 69 | ||
68 | IConfig startupConfig = argvSource.Configs["Startup"]; | 70 | IConfig startupConfig = argvSource.Configs["Startup"]; |
69 | if (startupConfig != null) | 71 | if (startupConfig != null) |
70 | { | 72 | { |
71 | m_consoleType = startupConfig.GetString("console", "local"); | 73 | m_consoleType = startupConfig.GetString("console", "local"); |
74 | m_configFile = startupConfig.GetString("xmlfile", "MessagingServer_Config.xml"); | ||
72 | } | 75 | } |
73 | 76 | ||
74 | m_config = argvSource; | 77 | m_config = argvSource; |
@@ -164,7 +167,7 @@ namespace OpenSim.Grid.MessagingServer | |||
164 | 167 | ||
165 | protected override void StartupSpecific() | 168 | protected override void StartupSpecific() |
166 | { | 169 | { |
167 | Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); | 170 | Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), m_configFile))); |
168 | 171 | ||
169 | m_userDataBaseService = new UserDataBaseService(); | 172 | m_userDataBaseService = new UserDataBaseService(); |
170 | m_userDataBaseService.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect); | 173 | m_userDataBaseService.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect); |
diff --git a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs index 7941679..88918d1 100644 --- a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs +++ b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs | |||
@@ -110,7 +110,12 @@ namespace OpenSim.Grid.UserServer.Modules | |||
110 | if (requestData.Contains("owner")) | 110 | if (requestData.Contains("owner")) |
111 | { | 111 | { |
112 | AvatarAppearance appearance = new AvatarAppearance(requestData); | 112 | AvatarAppearance appearance = new AvatarAppearance(requestData); |
113 | m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); | 113 | |
114 | // TODO: Sometime in the future we may have a database layer that is capable of updating appearance when | ||
115 | // the TextureEntry is null. When that happens, this check can be removed | ||
116 | if (appearance.Texture != null) | ||
117 | m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); | ||
118 | |||
114 | responseData = new Hashtable(); | 119 | responseData = new Hashtable(); |
115 | responseData["returnString"] = "TRUE"; | 120 | responseData["returnString"] = "TRUE"; |
116 | } | 121 | } |
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 1ee53ef..baf0fd3 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -76,16 +76,19 @@ namespace OpenSim.Grid.UserServer | |||
76 | 76 | ||
77 | protected static string m_consoleType = "local"; | 77 | protected static string m_consoleType = "local"; |
78 | protected static IConfigSource m_config = null; | 78 | protected static IConfigSource m_config = null; |
79 | protected static string m_configFile = "UserServer_Config.xml"; | ||
79 | 80 | ||
80 | public static void Main(string[] args) | 81 | public static void Main(string[] args) |
81 | { | 82 | { |
82 | ArgvConfigSource argvSource = new ArgvConfigSource(args); | 83 | ArgvConfigSource argvSource = new ArgvConfigSource(args); |
83 | argvSource.AddSwitch("Startup", "console", "c"); | 84 | argvSource.AddSwitch("Startup", "console", "c"); |
85 | argvSource.AddSwitch("Startup", "xmlfile", "x"); | ||
84 | 86 | ||
85 | IConfig startupConfig = argvSource.Configs["Startup"]; | 87 | IConfig startupConfig = argvSource.Configs["Startup"]; |
86 | if (startupConfig != null) | 88 | if (startupConfig != null) |
87 | { | 89 | { |
88 | m_consoleType = startupConfig.GetString("console", "local"); | 90 | m_consoleType = startupConfig.GetString("console", "local"); |
91 | m_configFile = startupConfig.GetString("xmlfile", "UserServer_Config.xml"); | ||
89 | } | 92 | } |
90 | 93 | ||
91 | m_config = argvSource; | 94 | m_config = argvSource; |
@@ -151,7 +154,7 @@ namespace OpenSim.Grid.UserServer | |||
151 | 154 | ||
152 | protected virtual IInterServiceInventoryServices StartupCoreComponents() | 155 | protected virtual IInterServiceInventoryServices StartupCoreComponents() |
153 | { | 156 | { |
154 | Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); | 157 | Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), m_configFile))); |
155 | 158 | ||
156 | m_httpServer = new BaseHttpServer(Cfg.HttpPort); | 159 | m_httpServer = new BaseHttpServer(Cfg.HttpPort); |
157 | 160 | ||