diff options
author | diva | 2009-06-10 13:18:32 +0000 |
---|---|---|
committer | diva | 2009-06-10 13:18:32 +0000 |
commit | 0f367bd7bbc5d22d4834e1eb0f1671381485143e (patch) | |
tree | eeb4290f1146601f8fd97dc164e0a7f247a2fafb /OpenSim/Region/CoreModules/Hypergrid | |
parent | From: Alan Webb <alan_webb@us.ibm.com> (diff) | |
download | opensim-SC-0f367bd7bbc5d22d4834e1eb0f1671381485143e.zip opensim-SC-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.gz opensim-SC-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.bz2 opensim-SC-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.xz |
Heart surgery no.2: the inventory service hooks.
Several improvements in the connectors themselves.
Several improvements in configurations.
Needed to add a hack in IUserService and UserManagerBase, to be removed when that service is refactored.
Diffstat (limited to 'OpenSim/Region/CoreModules/Hypergrid')
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs deleted file mode 100644 index 6149822..0000000 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs +++ /dev/null | |||
@@ -1,167 +0,0 @@ | |||
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; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Data; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Communications; | ||
38 | using OpenSim.Framework.Communications.Cache; | ||
39 | using OpenSim.Framework.Communications.Services; | ||
40 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | ||
41 | using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; | ||
42 | using OpenSim.Framework.Servers; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | ||
44 | using OpenSim.Region.Framework.Interfaces; | ||
45 | using OpenSim.Region.Framework.Scenes; | ||
46 | using OpenSim.Region.CoreModules.ServiceConnectors.Interregion; | ||
47 | |||
48 | using OpenMetaverse.StructuredData; | ||
49 | |||
50 | namespace OpenSim.Region.CoreModules.Hypergrid | ||
51 | { | ||
52 | public class HGStandaloneInventoryModule : IRegionModule | ||
53 | { | ||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | private static bool initialized = false; | ||
56 | private static bool enabled = false; | ||
57 | private static bool safemode = false; | ||
58 | |||
59 | private bool m_doLookup = false; | ||
60 | Scene m_scene; | ||
61 | HGInventoryService m_inventoryService; | ||
62 | InventoryServiceBase m_inventoryBase; | ||
63 | |||
64 | public bool DoLookup | ||
65 | { | ||
66 | get { return m_doLookup; } | ||
67 | set { m_doLookup = value; } | ||
68 | } | ||
69 | |||
70 | #region IRegionModule interface | ||
71 | |||
72 | public void Initialise(Scene scene, IConfigSource config) | ||
73 | { | ||
74 | if (!initialized) | ||
75 | { | ||
76 | initialized = true; | ||
77 | m_scene = scene; | ||
78 | |||
79 | // This module is only on for standalones | ||
80 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); | ||
81 | if (config.Configs["Hypergrid"] != null) | ||
82 | safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | public void PostInitialise() | ||
87 | { | ||
88 | if (enabled) | ||
89 | { | ||
90 | m_log.Info("[HGStandaloneInvModule]: Starting..."); | ||
91 | //m_inventoryService = new InventoryService(m_scene); | ||
92 | m_inventoryBase = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; | ||
93 | |||
94 | m_inventoryService = new HGInventoryService(m_inventoryBase, m_scene.AssetService, | ||
95 | (UserManagerBase)m_scene.CommsManager.UserAdminService, m_scene.CommsManager.HttpServer, | ||
96 | m_scene.CommsManager.NetworkServersInfo.InventoryURL); | ||
97 | |||
98 | AddHttpHandlers(m_scene.CommsManager.HttpServer); | ||
99 | m_inventoryService.AddHttpHandlers(); | ||
100 | } | ||
101 | } | ||
102 | |||
103 | public void Close() | ||
104 | { | ||
105 | } | ||
106 | |||
107 | public string Name | ||
108 | { | ||
109 | get { return "HGStandaloneInventoryModule"; } | ||
110 | } | ||
111 | |||
112 | public bool IsSharedModule | ||
113 | { | ||
114 | get { return true; } | ||
115 | } | ||
116 | |||
117 | #endregion | ||
118 | |||
119 | public virtual void AddHttpHandlers(IHttpServer httpServer) | ||
120 | { | ||
121 | if (!safemode) | ||
122 | { | ||
123 | httpServer.AddStreamHandler( | ||
124 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( | ||
125 | "POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession)); | ||
126 | httpServer.AddStreamHandler( | ||
127 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | ||
128 | "POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession)); | ||
129 | httpServer.AddStreamHandler( | ||
130 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
131 | "POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession)); | ||
132 | |||
133 | httpServer.AddStreamHandler( | ||
134 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
135 | "POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession)); | ||
136 | |||
137 | httpServer.AddStreamHandler( | ||
138 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
139 | "POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession)); | ||
140 | } | ||
141 | |||
142 | httpServer.AddStreamHandler( | ||
143 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
144 | "POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession)); | ||
145 | |||
146 | httpServer.AddStreamHandler( | ||
147 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | ||
148 | "POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession)); | ||
149 | |||
150 | |||
151 | } | ||
152 | |||
153 | /// <summary> | ||
154 | /// Check that the source of an inventory request for a particular agent is a current session belonging to | ||
155 | /// that agent. | ||
156 | /// </summary> | ||
157 | /// <param name="session_id"></param> | ||
158 | /// <param name="avatar_id"></param> | ||
159 | /// <returns></returns> | ||
160 | public bool CheckAuthSession(string session_id, string avatar_id) | ||
161 | { | ||
162 | return true; | ||
163 | } | ||
164 | |||
165 | } | ||
166 | |||
167 | } | ||