aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs330
1 files changed, 165 insertions, 165 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs
index 525dda7..a1306cd 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs
@@ -1,165 +1,165 @@
1/** 1/**
2 * Copyright (c) 2008, Contributors. All rights reserved. 2 * Copyright (c) 2008, Contributors. All rights reserved.
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without modification, 5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met: 6 * are permitted provided that the following conditions are met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright notice, 8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice, 10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation 11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution. 12 * and/or other materials provided with the distribution.
13 * * Neither the name of the Organizations nor the names of Individual 13 * * Neither the name of the Organizations nor the names of Individual
14 * Contributors may be used to endorse or promote products derived from 14 * Contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission. 15 * this software without specific prior written permission.
16 * 16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Data; 36using OpenSim.Data;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Communications.Services; 40using OpenSim.Framework.Communications.Services;
41using Caps = OpenSim.Framework.Communications.Capabilities.Caps; 41using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
42using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; 42using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers;
43using OpenSim.Framework.Servers; 43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.Interfaces; 44using OpenSim.Framework.Servers.Interfaces;
45using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.CoreModules.Communications.REST; 47using OpenSim.Region.CoreModules.Communications.REST;
48 48
49using OpenMetaverse.StructuredData; 49using OpenMetaverse.StructuredData;
50 50
51namespace OpenSim.Region.CoreModules.Hypergrid 51namespace OpenSim.Region.CoreModules.Hypergrid
52{ 52{
53 public class HGStandaloneInventoryModule : IRegionModule 53 public class HGStandaloneInventoryModule : IRegionModule
54 { 54 {
55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56 private static bool initialized = false; 56 private static bool initialized = false;
57 private static bool enabled = false; 57 private static bool enabled = false;
58 58
59 private bool m_doLookup = false; 59 private bool m_doLookup = false;
60 Scene m_scene; 60 Scene m_scene;
61 HGInventoryService m_inventoryService; 61 HGInventoryService m_inventoryService;
62 InventoryServiceBase m_inventoryBase; 62 InventoryServiceBase m_inventoryBase;
63 63
64 public bool DoLookup 64 public bool DoLookup
65 { 65 {
66 get { return m_doLookup; } 66 get { return m_doLookup; }
67 set { m_doLookup = value; } 67 set { m_doLookup = value; }
68 } 68 }
69 69
70 #region IRegionModule interface 70 #region IRegionModule interface
71 71
72 public void Initialise(Scene scene, IConfigSource config) 72 public void Initialise(Scene scene, IConfigSource config)
73 { 73 {
74 if (!initialized) 74 if (!initialized)
75 { 75 {
76 initialized = true; 76 initialized = true;
77 m_scene = scene; 77 m_scene = scene;
78 78
79 // This module is only on for standalones 79 // This module is only on for standalones
80 enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); 80 enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false);
81 } 81 }
82 } 82 }
83 83
84 public void PostInitialise() 84 public void PostInitialise()
85 { 85 {
86 if (enabled) 86 if (enabled)
87 { 87 {
88 m_log.Info("[HGStandaloneInvModule]: Starting..."); 88 m_log.Info("[HGStandaloneInvModule]: Starting...");
89 //m_inventoryService = new InventoryService(m_scene); 89 //m_inventoryService = new InventoryService(m_scene);
90 m_inventoryBase = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; 90 m_inventoryBase = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService;
91 91
92 m_inventoryService = new HGInventoryService(m_inventoryBase, 92 m_inventoryService = new HGInventoryService(m_inventoryBase,
93 ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin, 93 ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin,
94 (UserManagerBase)m_scene.CommsManager.UserService, m_scene.CommsManager.HttpServer, 94 (UserManagerBase)m_scene.CommsManager.UserService, m_scene.CommsManager.HttpServer,
95 m_scene.CommsManager.NetworkServersInfo.InventoryURL); 95 m_scene.CommsManager.NetworkServersInfo.InventoryURL);
96 96
97 AddHttpHandlers(m_scene.CommsManager.HttpServer); 97 AddHttpHandlers(m_scene.CommsManager.HttpServer);
98 m_inventoryService.AddHttpHandlers(); 98 m_inventoryService.AddHttpHandlers();
99 } 99 }
100 } 100 }
101 101
102 public void Close() 102 public void Close()
103 { 103 {
104 } 104 }
105 105
106 public string Name 106 public string Name
107 { 107 {
108 get { return "HGStandaloneInventoryModule"; } 108 get { return "HGStandaloneInventoryModule"; }
109 } 109 }
110 110
111 public bool IsSharedModule 111 public bool IsSharedModule
112 { 112 {
113 get { return true; } 113 get { return true; }
114 } 114 }
115 115
116 #endregion 116 #endregion
117 117
118 public virtual void AddHttpHandlers(IHttpServer httpServer) 118 public virtual void AddHttpHandlers(IHttpServer httpServer)
119 { 119 {
120 120
121 httpServer.AddStreamHandler( 121 httpServer.AddStreamHandler(
122 new RestDeserialiseSecureHandler<Guid, InventoryCollection>( 122 new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
123 "POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession)); 123 "POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession));
124 124
125 httpServer.AddStreamHandler( 125 httpServer.AddStreamHandler(
126 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 126 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
127 "POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession)); 127 "POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession));
128 128
129 httpServer.AddStreamHandler( 129 httpServer.AddStreamHandler(
130 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 130 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
131 "POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession)); 131 "POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession));
132 132
133 httpServer.AddStreamHandler( 133 httpServer.AddStreamHandler(
134 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 134 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
135 "POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession)); 135 "POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession));
136 136
137 httpServer.AddStreamHandler( 137 httpServer.AddStreamHandler(
138 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 138 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
139 "POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession)); 139 "POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession));
140 140
141 httpServer.AddStreamHandler( 141 httpServer.AddStreamHandler(
142 new RestDeserialiseSecureHandler<InventoryItemBase, bool>( 142 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
143 "POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession)); 143 "POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession));
144 144
145 httpServer.AddStreamHandler( 145 httpServer.AddStreamHandler(
146 new RestDeserialiseSecureHandler<InventoryItemBase, bool>( 146 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
147 "POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession)); 147 "POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession));
148 148
149 } 149 }
150 150
151 /// <summary> 151 /// <summary>
152 /// Check that the source of an inventory request for a particular agent is a current session belonging to 152 /// Check that the source of an inventory request for a particular agent is a current session belonging to
153 /// that agent. 153 /// that agent.
154 /// </summary> 154 /// </summary>
155 /// <param name="session_id"></param> 155 /// <param name="session_id"></param>
156 /// <param name="avatar_id"></param> 156 /// <param name="avatar_id"></param>
157 /// <returns></returns> 157 /// <returns></returns>
158 public bool CheckAuthSession(string session_id, string avatar_id) 158 public bool CheckAuthSession(string session_id, string avatar_id)
159 { 159 {
160 return true; 160 return true;
161 } 161 }
162 162
163 } 163 }
164 164
165} 165}