diff options
Diffstat (limited to 'OpenSim/Grid/InventoryServer/Main.cs')
-rw-r--r-- | OpenSim/Grid/InventoryServer/Main.cs | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 97addb0..1bc396b 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs | |||
@@ -31,48 +31,71 @@ using System.Collections.Generic; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Text; | 33 | using System.Text; |
34 | |||
34 | using libsecondlife; | 35 | using libsecondlife; |
35 | using OpenSim.Framework.User; | 36 | |
36 | using OpenSim.Framework.Sims; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Inventory; | ||
38 | using OpenSim.Framework.Interfaces; | ||
39 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
40 | using OpenSim.Servers; | 39 | using OpenSim.Framework.Servers; |
41 | using OpenSim.Framework.Utilities; | 40 | |
41 | using InventoryManager = OpenSim.Grid.InventoryServer.InventoryManager; | ||
42 | 42 | ||
43 | namespace OpenGridServices.InventoryServer | 43 | namespace OpenSim.Grid.InventoryServer |
44 | { | 44 | { |
45 | public class OpenInventory_Main : BaseServer, conscmd_callback | 45 | public class OpenInventory_Main : conscmd_callback |
46 | { | 46 | { |
47 | ConsoleBase m_console; | 47 | LogBase m_console; |
48 | InventoryManager m_inventoryManager; | 48 | InventoryManager m_inventoryManager; |
49 | InventoryConfig m_config; | ||
49 | 50 | ||
51 | public const string LogName = "INVENTORY"; | ||
52 | |||
53 | [STAThread] | ||
50 | public static void Main(string[] args) | 54 | public static void Main(string[] args) |
51 | { | 55 | { |
56 | OpenInventory_Main theServer = new OpenInventory_Main(); | ||
57 | theServer.Startup(); | ||
58 | |||
59 | theServer.Work(); | ||
52 | } | 60 | } |
53 | 61 | ||
54 | public OpenInventory_Main() | 62 | public OpenInventory_Main() |
55 | { | 63 | { |
56 | m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false); | 64 | m_console = new LogBase("opengrid-inventory-console.log", LogName, this, true); |
57 | MainConsole.Instance = m_console; | 65 | MainLog.Instance = m_console; |
58 | } | 66 | } |
59 | 67 | ||
60 | public void Startup() | 68 | public void Startup() |
61 | { | 69 | { |
62 | MainConsole.Instance.Notice("Initialising inventory manager..."); | 70 | MainLog.Instance.Notice("Initialising inventory manager..."); |
71 | m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); | ||
72 | |||
63 | m_inventoryManager = new InventoryManager(); | 73 | m_inventoryManager = new InventoryManager(); |
74 | m_inventoryManager.AddDatabasePlugin(m_config.DatabaseProvider); | ||
75 | MainLog.Instance.Notice(LogName, "Starting HTTP server ..."); | ||
76 | BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); | ||
64 | 77 | ||
65 | MainConsole.Instance.Notice("Starting HTTP server"); | 78 | httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); |
66 | BaseHttpServer httpServer = new BaseHttpServer(8004); | ||
67 | 79 | ||
68 | httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest); | 80 | httpServer.Start(); |
69 | //httpServer.AddRestHandler("GET","/rootfolders/",Rest | 81 | MainLog.Instance.Notice(LogName, "Started HTTP server"); |
82 | } | ||
83 | |||
84 | private void Work() | ||
85 | { | ||
86 | m_console.Notice("Enter help for a list of commands\n"); | ||
87 | |||
88 | while (true) | ||
89 | { | ||
90 | m_console.MainLogPrompt(); | ||
91 | } | ||
70 | } | 92 | } |
71 | 93 | ||
72 | public void RunCmd(string cmd, string[] cmdparams) | 94 | public void RunCmd(string cmd, string[] cmdparams) |
73 | { | 95 | { |
74 | switch (cmd) | 96 | switch (cmd) |
75 | { | 97 | { |
98 | case "quit": | ||
76 | case "shutdown": | 99 | case "shutdown": |
77 | m_console.Close(); | 100 | m_console.Close(); |
78 | Environment.Exit(0); | 101 | Environment.Exit(0); |