aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/MessagingServer/Main.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/MessagingServer/Main.cs')
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs84
1 files changed, 63 insertions, 21 deletions
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index dcefeea..f2631a7 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,25 @@ 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 protected static string m_configFile = "MessagingServer_Config.xml";
63
59 public static void Main(string[] args) 64 public static void Main(string[] args)
60 { 65 {
66 ArgvConfigSource argvSource = new ArgvConfigSource(args);
67 argvSource.AddSwitch("Startup", "console", "c");
68 argvSource.AddSwitch("Startup", "xmlfile", "x");
69
70 IConfig startupConfig = argvSource.Configs["Startup"];
71 if (startupConfig != null)
72 {
73 m_consoleType = startupConfig.GetString("console", "local");
74 m_configFile = startupConfig.GetString("xmlfile", "MessagingServer_Config.xml");
75 }
76
77 m_config = argvSource;
78
61 XmlConfigurator.Configure(); 79 XmlConfigurator.Configure();
62 80
63 m_log.Info("[SERVER]: Launching MessagingServer..."); 81 m_log.Info("[SERVER]: Launching MessagingServer...");
@@ -70,7 +88,18 @@ namespace OpenSim.Grid.MessagingServer
70 88
71 public OpenMessage_Main() 89 public OpenMessage_Main()
72 { 90 {
73 m_console = new LocalConsole("Messaging"); 91 switch (m_consoleType)
92 {
93 case "rest":
94 m_console = new RemoteConsole("Messaging");
95 break;
96 case "basic":
97 m_console = new CommandConsole("Messaging");
98 break;
99 default:
100 m_console = new LocalConsole("Messaging");
101 break;
102 }
74 MainConsole.Instance = m_console; 103 MainConsole.Instance = m_console;
75 } 104 }
76 105
@@ -88,20 +117,33 @@ namespace OpenSim.Grid.MessagingServer
88 { 117 {
89 if (m_userServerModule.registerWithUserServer()) 118 if (m_userServerModule.registerWithUserServer())
90 { 119 {
91 m_log.Info("[SERVER]: Starting HTTP process"); 120 if (m_httpServer == null)
92 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 121 {
93 122 m_log.Info("[SERVER]: Starting HTTP process");
94 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); 123 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
95 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); 124
96 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); 125 if (m_console is RemoteConsole)
97 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown); 126 {
98 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); 127 RemoteConsole c = (RemoteConsole)m_console;
99 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); 128 c.SetServer(m_httpServer);
100 129 IConfig netConfig = m_config.AddConfig("Network");
101 m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup); 130 netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
102 m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown); 131 netConfig.Set("ConsolePass", Cfg.ConsolePass);
103 132 c.ReadConfig(m_config);
104 m_httpServer.Start(); 133 }
134
135 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
136 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
137 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
138 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown);
139 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
140 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);
141
142 m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup);
143 m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown);
144
145 m_httpServer.Start();
146 }
105 m_log.Info("[SERVER]: Userserver registration was successful"); 147 m_log.Info("[SERVER]: Userserver registration was successful");
106 } 148 }
107 else 149 else
@@ -114,18 +156,18 @@ namespace OpenSim.Grid.MessagingServer
114 private void deregisterFromUserServer() 156 private void deregisterFromUserServer()
115 { 157 {
116 m_userServerModule.deregisterWithUserServer(); 158 m_userServerModule.deregisterWithUserServer();
117 if (m_httpServer != null) 159// if (m_httpServer != null)
118 { 160// {
119 // try a completely fresh registration, with fresh handlers, too 161 // try a completely fresh registration, with fresh handlers, too
120 m_httpServer.Stop(); 162// m_httpServer.Stop();
121 m_httpServer = null; 163// m_httpServer = null;
122 } 164// }
123 m_console.Output("[SERVER]: Deregistered from userserver."); 165 m_console.Output("[SERVER]: Deregistered from userserver.");
124 } 166 }
125 167
126 protected override void StartupSpecific() 168 protected override void StartupSpecific()
127 { 169 {
128 Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); 170 Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), m_configFile)));
129 171
130 m_userDataBaseService = new UserDataBaseService(); 172 m_userDataBaseService = new UserDataBaseService();
131 m_userDataBaseService.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect); 173 m_userDataBaseService.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect);