aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/InventoryServer/Main.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-09-18 19:26:22 +0100
committerJustin Clark-Casey (justincc)2009-09-18 19:26:22 +0100
commita1e688bdf3ab354104545623bb1784213d479e0a (patch)
treed29552ec2f6cb3d3136cdab68e36a9969285e88d /OpenSim/Grid/InventoryServer/Main.cs
parentRemove old OpenSim.Example.xml file that doesn't keep up with OpenSim.ini.exa... (diff)
parentaddition of a new script function osSetParcelSIPAddress(string SIPAddress), n... (diff)
downloadopensim-SC_OLD-a1e688bdf3ab354104545623bb1784213d479e0a.zip
opensim-SC_OLD-a1e688bdf3ab354104545623bb1784213d479e0a.tar.gz
opensim-SC_OLD-a1e688bdf3ab354104545623bb1784213d479e0a.tar.bz2
opensim-SC_OLD-a1e688bdf3ab354104545623bb1784213d479e0a.tar.xz
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Grid/InventoryServer/Main.cs')
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs182
1 files changed, 0 insertions, 182 deletions
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
deleted file mode 100644
index 6106d93..0000000
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ /dev/null
@@ -1,182 +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
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using log4net.Config;
34using OpenMetaverse;
35using OpenSim.Framework;
36using OpenSim.Framework.Communications.Services;
37using OpenSim.Framework.Console;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer;
40
41namespace OpenSim.Grid.InventoryServer
42{
43 public class OpenInventory_Main : BaseOpenSimServer
44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 private GridInventoryService m_inventoryService;
48 //private HGInventoryService m_directInventoryService;
49
50 public const string LogName = "INVENTORY";
51
52 public static void Main(string[] args)
53 {
54 XmlConfigurator.Configure();
55
56 OpenInventory_Main theServer = new OpenInventory_Main();
57 theServer.Startup();
58
59 theServer.Work();
60 }
61
62 public OpenInventory_Main()
63 {
64 m_console = new LocalConsole("Inventory");
65 MainConsole.Instance = m_console;
66 }
67
68 protected override void StartupSpecific()
69 {
70 InventoryConfig config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
71
72 m_inventoryService = new GridInventoryService(config.UserServerURL);
73 m_inventoryService.DoLookup = config.SessionLookUp;
74 m_inventoryService.AddPlugin(config.DatabaseProvider, config.DatabaseConnect);
75
76
77 m_log.Info("[" + LogName + "]: Starting HTTP server ...");
78
79 m_httpServer = new BaseHttpServer(config.HttpPort);
80
81 AddHttpHandlers(config.RegionAccessToAgentsInventory);
82
83 m_httpServer.Start();
84
85 m_log.Info("[" + LogName + "]: Started HTTP server");
86
87 base.StartupSpecific();
88
89 m_console.Commands.AddCommand("inventoryserver", false, "add user",
90 "add user",
91 "Add a random user inventory", HandleAddUser);
92 }
93
94 protected void AddHttpHandlers(bool regionAccess)
95 {
96 if (regionAccess)
97 {
98 m_httpServer.AddStreamHandler(
99 new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
100 "POST", "/GetInventory/", m_inventoryService.GetUserInventory, m_inventoryService.CheckAuthSession));
101
102 m_httpServer.AddStreamHandler(
103 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
104 "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, m_inventoryService.CheckAuthSession));
105
106 m_httpServer.AddStreamHandler(
107 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
108 "POST", "/MoveFolder/", m_inventoryService.MoveFolder, m_inventoryService.CheckAuthSession));
109
110 m_httpServer.AddStreamHandler(
111 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
112 "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, m_inventoryService.CheckAuthSession));
113
114 m_httpServer.AddStreamHandler(
115 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
116 "POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession));
117
118 m_httpServer.AddStreamHandler(
119 new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
120 "POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession));
121
122 m_httpServer.AddStreamHandler(
123 new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>(
124 "POST", "/QueryFolder/", m_inventoryService.QueryFolder, m_inventoryService.CheckAuthSession));
125
126 }
127
128 m_httpServer.AddStreamHandler(
129 new RestDeserialiseTrustedHandler<Guid, bool>(
130 "POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory, m_inventoryService.CheckTrustSource));
131
132 m_httpServer.AddStreamHandler(
133 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
134 "POST", "/NewFolder/", m_inventoryService.AddFolder, m_inventoryService.CheckAuthSession));
135
136 m_httpServer.AddStreamHandler(
137 new RestDeserialiseTrustedHandler<InventoryFolderBase, bool>(
138 "POST", "/CreateFolder/", m_inventoryService.AddFolder, m_inventoryService.CheckTrustSource));
139
140 m_httpServer.AddStreamHandler(
141 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
142 "POST", "/NewItem/", m_inventoryService.AddItem, m_inventoryService.CheckAuthSession));
143
144 m_httpServer.AddStreamHandler(
145 new RestDeserialiseTrustedHandler<InventoryItemBase, bool>(
146 "POST", "/AddNewItem/", m_inventoryService.AddItem, m_inventoryService.CheckTrustSource));
147
148 m_httpServer.AddStreamHandler(
149 new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>(
150 "POST", "/GetItems/", m_inventoryService.GetFolderItems, m_inventoryService.CheckTrustSource));
151
152 // for persistent active gestures
153 m_httpServer.AddStreamHandler(
154 new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>
155 ("POST", "/ActiveGestures/", m_inventoryService.GetActiveGestures, m_inventoryService.CheckTrustSource));
156
157 // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
158 // system folders such as Objects, Textures), but it now returns the entire inventory skeleton.
159 // It would have been better to rename this request, but complexities in the BaseHttpServer
160 // (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier
161 // to do this for now.
162 m_httpServer.AddStreamHandler(
163 new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
164 ("POST", "/RootFolders/", m_inventoryService.GetInventorySkeleton, m_inventoryService.CheckTrustSource));
165 }
166
167 private void Work()
168 {
169 m_console.Output("Enter help for a list of commands\n");
170
171 while (true)
172 {
173 m_console.Prompt();
174 }
175 }
176
177 private void HandleAddUser(string module, string[] args)
178 {
179 m_inventoryService.CreateUsersInventory(UUID.Random().Guid);
180 }
181 }
182}