diff options
Diffstat (limited to 'OpenSim/Grid/InventoryServer/Main.cs')
-rw-r--r-- | OpenSim/Grid/InventoryServer/Main.cs | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 453d64d..870997b 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs | |||
@@ -40,38 +40,13 @@ namespace OpenSim.Grid.InventoryServer | |||
40 | { | 40 | { |
41 | public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback | 41 | public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback |
42 | { | 42 | { |
43 | public const string LogName = "INVENTORY"; | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 44 | ||
46 | private InventoryConfig m_config; | ||
47 | private InventoryManager m_inventoryManager; | 45 | private InventoryManager m_inventoryManager; |
46 | private InventoryConfig m_config; | ||
48 | private GridInventoryService m_inventoryService; | 47 | private GridInventoryService m_inventoryService; |
49 | 48 | ||
50 | public OpenInventory_Main() | 49 | public const string LogName = "INVENTORY"; |
51 | { | ||
52 | m_console = new ConsoleBase(LogName, this); | ||
53 | MainConsole.Instance = m_console; | ||
54 | } | ||
55 | |||
56 | #region conscmd_callback Members | ||
57 | |||
58 | public override void RunCmd(string cmd, string[] cmdparams) | ||
59 | { | ||
60 | base.RunCmd(cmd, cmdparams); | ||
61 | |||
62 | switch (cmd) | ||
63 | { | ||
64 | case "add-user": | ||
65 | m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); | ||
66 | break; | ||
67 | case "shutdown": | ||
68 | m_console.Close(); | ||
69 | Environment.Exit(0); | ||
70 | break; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | #endregion | ||
75 | 50 | ||
76 | [STAThread] | 51 | [STAThread] |
77 | public static void Main(string[] args) | 52 | public static void Main(string[] args) |
@@ -84,6 +59,12 @@ namespace OpenSim.Grid.InventoryServer | |||
84 | theServer.Work(); | 59 | theServer.Work(); |
85 | } | 60 | } |
86 | 61 | ||
62 | public OpenInventory_Main() | ||
63 | { | ||
64 | m_console = new ConsoleBase(LogName, this); | ||
65 | MainConsole.Instance = m_console; | ||
66 | } | ||
67 | |||
87 | public void Startup() | 68 | public void Startup() |
88 | { | 69 | { |
89 | m_log.Info("Initialising inventory manager..."); | 70 | m_log.Info("Initialising inventory manager..."); |
@@ -94,7 +75,7 @@ namespace OpenSim.Grid.InventoryServer | |||
94 | m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect); | 75 | m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect); |
95 | 76 | ||
96 | m_log.Info("[" + LogName + "]: Starting HTTP server ..."); | 77 | m_log.Info("[" + LogName + "]: Starting HTTP server ..."); |
97 | 78 | ||
98 | m_httpServer = new BaseHttpServer(m_config.HttpPort); | 79 | m_httpServer = new BaseHttpServer(m_config.HttpPort); |
99 | AddHttpHandlers(); | 80 | AddHttpHandlers(); |
100 | m_httpServer.Start(); | 81 | m_httpServer.Start(); |
@@ -107,11 +88,11 @@ namespace OpenSim.Grid.InventoryServer | |||
107 | m_httpServer.AddStreamHandler( | 88 | m_httpServer.AddStreamHandler( |
108 | new RestDeserialisehandler<Guid, InventoryCollection>( | 89 | new RestDeserialisehandler<Guid, InventoryCollection>( |
109 | "POST", "/GetInventory/", m_inventoryService.GetUserInventory)); | 90 | "POST", "/GetInventory/", m_inventoryService.GetUserInventory)); |
110 | 91 | ||
111 | m_httpServer.AddStreamHandler( | 92 | m_httpServer.AddStreamHandler( |
112 | new RestDeserialisehandler<Guid, bool>( | 93 | new RestDeserialisehandler<Guid, bool>( |
113 | "POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory)); | 94 | "POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory)); |
114 | 95 | ||
115 | m_httpServer.AddStreamHandler( | 96 | m_httpServer.AddStreamHandler( |
116 | new RestDeserialisehandler<InventoryFolderBase, bool>( | 97 | new RestDeserialisehandler<InventoryFolderBase, bool>( |
117 | "POST", "/NewFolder/", m_inventoryService.AddInventoryFolder)); | 98 | "POST", "/NewFolder/", m_inventoryService.AddInventoryFolder)); |
@@ -119,15 +100,15 @@ namespace OpenSim.Grid.InventoryServer | |||
119 | m_httpServer.AddStreamHandler( | 100 | m_httpServer.AddStreamHandler( |
120 | new RestDeserialisehandler<InventoryFolderBase, bool>( | 101 | new RestDeserialisehandler<InventoryFolderBase, bool>( |
121 | "POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder)); | 102 | "POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder)); |
122 | 103 | ||
123 | m_httpServer.AddStreamHandler( | 104 | m_httpServer.AddStreamHandler( |
124 | new RestDeserialisehandler<InventoryFolderBase, bool>( | 105 | new RestDeserialisehandler<InventoryFolderBase, bool>( |
125 | "POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder)); | 106 | "POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder)); |
126 | 107 | ||
127 | m_httpServer.AddStreamHandler( | 108 | m_httpServer.AddStreamHandler( |
128 | new RestDeserialisehandler<InventoryItemBase, bool>( | 109 | new RestDeserialisehandler<InventoryItemBase, bool>( |
129 | "POST", "/NewItem/", m_inventoryService.AddInventoryItem)); | 110 | "POST", "/NewItem/", m_inventoryService.AddInventoryItem)); |
130 | 111 | ||
131 | m_httpServer.AddStreamHandler( | 112 | m_httpServer.AddStreamHandler( |
132 | new RestDeserialisehandler<InventoryItemBase, bool>( | 113 | new RestDeserialisehandler<InventoryItemBase, bool>( |
133 | "POST", "/DeleteItem/", m_inventoryService.DeleteInvItem)); | 114 | "POST", "/DeleteItem/", m_inventoryService.DeleteInvItem)); |
@@ -153,5 +134,21 @@ namespace OpenSim.Grid.InventoryServer | |||
153 | m_console.Prompt(); | 134 | m_console.Prompt(); |
154 | } | 135 | } |
155 | } | 136 | } |
137 | |||
138 | public override void RunCmd(string cmd, string[] cmdparams) | ||
139 | { | ||
140 | base.RunCmd(cmd, cmdparams); | ||
141 | |||
142 | switch (cmd) | ||
143 | { | ||
144 | case "add-user": | ||
145 | m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); | ||
146 | break; | ||
147 | case "shutdown": | ||
148 | m_console.Close(); | ||
149 | Environment.Exit(0); | ||
150 | break; | ||
151 | } | ||
152 | } | ||
156 | } | 153 | } |
157 | } \ No newline at end of file | 154 | } |