aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/GridServer')
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs30
-rw-r--r--OpenSim/Grid/GridServer/Program.cs14
2 files changed, 41 insertions, 3 deletions
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index c41a728..d63ac2e 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Timers; 32using System.Timers;
33using log4net; 33using log4net;
34using Nini.Config;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
@@ -46,6 +47,9 @@ namespace OpenSim.Grid.GridServer
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 48
48 protected GridConfig m_config; 49 protected GridConfig m_config;
50 public string m_consoleType = "local";
51 public IConfigSource m_configSource = null;
52 public string m_configFile = "GridServer_Config.xml";
49 53
50 public GridConfig Config 54 public GridConfig Config
51 { 55 {
@@ -71,16 +75,36 @@ namespace OpenSim.Grid.GridServer
71 75
72 public GridServerBase() 76 public GridServerBase()
73 { 77 {
74 m_console = new LocalConsole("Grid");
75 MainConsole.Instance = m_console;
76 } 78 }
77 79
78 protected override void StartupSpecific() 80 protected override void StartupSpecific()
79 { 81 {
80 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); 82 switch (m_consoleType)
83 {
84 case "rest":
85 m_console = new RemoteConsole("Grid");
86 break;
87 case "basic":
88 m_console = new CommandConsole("Grid");
89 break;
90 default:
91 m_console = new LocalConsole("Grid");
92 break;
93 }
94 MainConsole.Instance = m_console;
95 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), m_configFile)));
81 96
82 m_log.Info("[GRID]: Starting HTTP process"); 97 m_log.Info("[GRID]: Starting HTTP process");
83 m_httpServer = new BaseHttpServer(m_config.HttpPort); 98 m_httpServer = new BaseHttpServer(m_config.HttpPort);
99 if (m_console is RemoteConsole)
100 {
101 RemoteConsole c = (RemoteConsole)m_console;
102 c.SetServer(m_httpServer);
103 IConfig netConfig = m_configSource.AddConfig("Network");
104 netConfig.Set("ConsoleUser", m_config.ConsoleUser);
105 netConfig.Set("ConsolePass", m_config.ConsolePass);
106 c.ReadConfig(m_configSource);
107 }
84 108
85 LoadPlugins(); 109 LoadPlugins();
86 110
diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs
index 9618b85..741a01b 100644
--- a/OpenSim/Grid/GridServer/Program.cs
+++ b/OpenSim/Grid/GridServer/Program.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using log4net.Config; 28using log4net.Config;
29using Nini.Config;
29 30
30namespace OpenSim.Grid.GridServer 31namespace OpenSim.Grid.GridServer
31{ 32{
@@ -33,10 +34,23 @@ namespace OpenSim.Grid.GridServer
33 { 34 {
34 public static void Main(string[] args) 35 public static void Main(string[] args)
35 { 36 {
37 ArgvConfigSource argvSource = new ArgvConfigSource(args);
38 argvSource.AddSwitch("Startup", "console", "c");
39 argvSource.AddSwitch("Startup", "xmlfile", "x");
40
36 XmlConfigurator.Configure(); 41 XmlConfigurator.Configure();
37 42
38 GridServerBase app = new GridServerBase(); 43 GridServerBase app = new GridServerBase();
39 44
45 IConfig startupConfig = argvSource.Configs["Startup"];
46 if (startupConfig != null)
47 {
48 app.m_consoleType = startupConfig.GetString("console", "local");
49 app.m_configFile = startupConfig.GetString("xmlfile", "GridServer_Config.xml");
50 }
51
52 app.m_configSource = argvSource;
53
40// if (args.Length > 0 && args[0] == "-setuponly") 54// if (args.Length > 0 && args[0] == "-setuponly")
41// { 55// {
42// app.Config(); 56// app.Config();