diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/GridServer/GridServerBase.cs | 27 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/Program.cs | 12 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 1 |
3 files changed, 37 insertions, 3 deletions
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index c41a728..e3ad52a 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs | |||
@@ -31,6 +31,7 @@ using System.IO; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Timers; | 32 | using System.Timers; |
33 | using log4net; | 33 | using log4net; |
34 | using Nini.Config; | ||
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
@@ -46,6 +47,8 @@ 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; | ||
49 | 52 | ||
50 | public GridConfig Config | 53 | public GridConfig Config |
51 | { | 54 | { |
@@ -71,16 +74,36 @@ namespace OpenSim.Grid.GridServer | |||
71 | 74 | ||
72 | public GridServerBase() | 75 | public GridServerBase() |
73 | { | 76 | { |
74 | m_console = new LocalConsole("Grid"); | ||
75 | MainConsole.Instance = m_console; | ||
76 | } | 77 | } |
77 | 78 | ||
78 | protected override void StartupSpecific() | 79 | protected override void StartupSpecific() |
79 | { | 80 | { |
81 | switch (m_consoleType) | ||
82 | { | ||
83 | case "rest": | ||
84 | m_console = new RemoteConsole("Grid"); | ||
85 | break; | ||
86 | case "basic": | ||
87 | m_console = new CommandConsole("Grid"); | ||
88 | break; | ||
89 | default: | ||
90 | m_console = new LocalConsole("Grid"); | ||
91 | break; | ||
92 | } | ||
93 | MainConsole.Instance = m_console; | ||
80 | m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); | 94 | m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); |
81 | 95 | ||
82 | m_log.Info("[GRID]: Starting HTTP process"); | 96 | m_log.Info("[GRID]: Starting HTTP process"); |
83 | m_httpServer = new BaseHttpServer(m_config.HttpPort); | 97 | m_httpServer = new BaseHttpServer(m_config.HttpPort); |
98 | if (m_console is RemoteConsole) | ||
99 | { | ||
100 | RemoteConsole c = (RemoteConsole)m_console; | ||
101 | c.SetServer(m_httpServer); | ||
102 | IConfig netConfig = m_configSource.AddConfig("Network"); | ||
103 | netConfig.Set("ConsoleUser", m_config.ConsoleUser); | ||
104 | netConfig.Set("ConsolePass", m_config.ConsolePass); | ||
105 | c.ReadConfig(m_configSource); | ||
106 | } | ||
84 | 107 | ||
85 | LoadPlugins(); | 108 | LoadPlugins(); |
86 | 109 | ||
diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs index 9618b85..c7ba897 100644 --- a/OpenSim/Grid/GridServer/Program.cs +++ b/OpenSim/Grid/GridServer/Program.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net.Config; | 28 | using log4net.Config; |
29 | using Nini.Config; | ||
29 | 30 | ||
30 | namespace OpenSim.Grid.GridServer | 31 | namespace OpenSim.Grid.GridServer |
31 | { | 32 | { |
@@ -33,10 +34,21 @@ 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 | |||
36 | XmlConfigurator.Configure(); | 40 | XmlConfigurator.Configure(); |
37 | 41 | ||
38 | GridServerBase app = new GridServerBase(); | 42 | GridServerBase app = new GridServerBase(); |
39 | 43 | ||
44 | IConfig startupConfig = argvSource.Configs["Startup"]; | ||
45 | if (startupConfig != null) | ||
46 | { | ||
47 | app.m_consoleType = startupConfig.GetString("console", "local"); | ||
48 | } | ||
49 | |||
50 | app.m_configSource = argvSource; | ||
51 | |||
40 | // if (args.Length > 0 && args[0] == "-setuponly") | 52 | // if (args.Length > 0 && args[0] == "-setuponly") |
41 | // { | 53 | // { |
42 | // app.Config(); | 54 | // app.Config(); |
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index f47a96e..1ee53ef 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -157,7 +157,6 @@ namespace OpenSim.Grid.UserServer | |||
157 | 157 | ||
158 | if (m_console is RemoteConsole) | 158 | if (m_console is RemoteConsole) |
159 | { | 159 | { |
160 | System.Console.WriteLine("Initialized REST console"); | ||
161 | RemoteConsole c = (RemoteConsole)m_console; | 160 | RemoteConsole c = (RemoteConsole)m_console; |
162 | c.SetServer(m_httpServer); | 161 | c.SetServer(m_httpServer); |
163 | IConfig netConfig = m_config.AddConfig("Network"); | 162 | IConfig netConfig = m_config.AddConfig("Network"); |