aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/MessagingServer/Main.cs
diff options
context:
space:
mode:
authorMelanie2009-08-19 05:40:23 +0100
committerMelanie2009-08-19 05:40:23 +0100
commit2111c66f89033b3426ceedba6a3ec6ed8fb3363f (patch)
treee29ff3ccb6d99d63164db25772115fa8b176ed3c /OpenSim/Grid/MessagingServer/Main.cs
parentGraft the REST console onto the grid server. Same procedure as with (diff)
downloadopensim-SC_OLD-2111c66f89033b3426ceedba6a3ec6ed8fb3363f.zip
opensim-SC_OLD-2111c66f89033b3426ceedba6a3ec6ed8fb3363f.tar.gz
opensim-SC_OLD-2111c66f89033b3426ceedba6a3ec6ed8fb3363f.tar.bz2
opensim-SC_OLD-2111c66f89033b3426ceedba6a3ec6ed8fb3363f.tar.xz
Graft the REST console onto the message server as well. What a dirty hack!
Works the same as the others.
Diffstat (limited to 'OpenSim/Grid/MessagingServer/Main.cs')
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs79
1 files changed, 59 insertions, 20 deletions
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index dcefeea..654e770 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Nini.Config;
33using log4net.Config; 34using log4net.Config;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
@@ -56,8 +57,22 @@ namespace OpenSim.Grid.MessagingServer
56 57
57 // private UUID m_lastCreatedUser = UUID.Random(); 58 // private UUID m_lastCreatedUser = UUID.Random();
58 59
60 protected static string m_consoleType = "local";
61 protected static IConfigSource m_config = null;
62
59 public static void Main(string[] args) 63 public static void Main(string[] args)
60 { 64 {
65 ArgvConfigSource argvSource = new ArgvConfigSource(args);
66 argvSource.AddSwitch("Startup", "console", "c");
67
68 IConfig startupConfig = argvSource.Configs["Startup"];
69 if (startupConfig != null)
70 {
71 m_consoleType = startupConfig.GetString("console", "local");
72 }
73
74 m_config = argvSource;
75
61 XmlConfigurator.Configure(); 76 XmlConfigurator.Configure();
62 77
63 m_log.Info("[SERVER]: Launching MessagingServer..."); 78 m_log.Info("[SERVER]: Launching MessagingServer...");
@@ -70,7 +85,18 @@ namespace OpenSim.Grid.MessagingServer
70 85
71 public OpenMessage_Main() 86 public OpenMessage_Main()
72 { 87 {
73 m_console = new LocalConsole("Messaging"); 88 switch (m_consoleType)
89 {
90 case "rest":
91 m_console = new RemoteConsole("Messaging");
92 break;
93 case "basic":
94 m_console = new CommandConsole("Messaging");
95 break;
96 default:
97 m_console = new LocalConsole("Messaging");
98 break;
99 }
74 MainConsole.Instance = m_console; 100 MainConsole.Instance = m_console;
75 } 101 }
76 102
@@ -88,20 +114,33 @@ namespace OpenSim.Grid.MessagingServer
88 { 114 {
89 if (m_userServerModule.registerWithUserServer()) 115 if (m_userServerModule.registerWithUserServer())
90 { 116 {
91 m_log.Info("[SERVER]: Starting HTTP process"); 117 if (m_httpServer == null)
92 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 118 {
93 119 m_log.Info("[SERVER]: Starting HTTP process");
94 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); 120 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
95 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); 121
96 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); 122 if (m_console is RemoteConsole)
97 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown); 123 {
98 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); 124 RemoteConsole c = (RemoteConsole)m_console;
99 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); 125 c.SetServer(m_httpServer);
100 126 IConfig netConfig = m_config.AddConfig("Network");
101 m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup); 127 netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
102 m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown); 128 netConfig.Set("ConsolePass", Cfg.ConsolePass);
103 129 c.ReadConfig(m_config);
104 m_httpServer.Start(); 130 }
131
132 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
133 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
134 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
135 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown);
136 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
137 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);
138
139 m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup);
140 m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown);
141
142 m_httpServer.Start();
143 }
105 m_log.Info("[SERVER]: Userserver registration was successful"); 144 m_log.Info("[SERVER]: Userserver registration was successful");
106 } 145 }
107 else 146 else
@@ -114,12 +153,12 @@ namespace OpenSim.Grid.MessagingServer
114 private void deregisterFromUserServer() 153 private void deregisterFromUserServer()
115 { 154 {
116 m_userServerModule.deregisterWithUserServer(); 155 m_userServerModule.deregisterWithUserServer();
117 if (m_httpServer != null) 156// if (m_httpServer != null)
118 { 157// {
119 // try a completely fresh registration, with fresh handlers, too 158 // try a completely fresh registration, with fresh handlers, too
120 m_httpServer.Stop(); 159// m_httpServer.Stop();
121 m_httpServer = null; 160// m_httpServer = null;
122 } 161// }
123 m_console.Output("[SERVER]: Deregistered from userserver."); 162 m_console.Output("[SERVER]: Deregistered from userserver.");
124 } 163 }
125 164