aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2009-08-19 05:15:25 +0100
committerMelanie2009-08-19 05:15:25 +0100
commitdd0234f5005127c03760c2b9862ed1672f4a2e91 (patch)
treeceb6e9b1c182618063cf0cab5d1e10378eade99b /OpenSim
parentMerge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-dd0234f5005127c03760c2b9862ed1672f4a2e91.zip
opensim-SC_OLD-dd0234f5005127c03760c2b9862ed1672f4a2e91.tar.gz
opensim-SC_OLD-dd0234f5005127c03760c2b9862ed1672f4a2e91.tar.bz2
opensim-SC_OLD-dd0234f5005127c03760c2b9862ed1672f4a2e91.tar.xz
Graft the REST console onto the grid server. Same procedure as with
the user server.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/GridConfig.cs16
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs27
-rw-r--r--OpenSim/Grid/GridServer/Program.cs12
-rw-r--r--OpenSim/Grid/UserServer/Main.cs1
4 files changed, 52 insertions, 4 deletions
diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs
index a3c1032..87fd3f0 100644
--- a/OpenSim/Framework/GridConfig.cs
+++ b/OpenSim/Framework/GridConfig.cs
@@ -45,6 +45,8 @@ namespace OpenSim.Framework
45 public string SimSendKey = String.Empty; 45 public string SimSendKey = String.Empty;
46 public string UserRecvKey = String.Empty; 46 public string UserRecvKey = String.Empty;
47 public string UserSendKey = String.Empty; 47 public string UserSendKey = String.Empty;
48 public string ConsoleUser = String.Empty;
49 public string ConsolePass = String.Empty;
48 50
49 public GridConfig(string description, string filename) 51 public GridConfig(string description, string filename)
50 { 52 {
@@ -95,6 +97,12 @@ namespace OpenSim.Framework
95 "Allow regions to register immediately upon grid server startup? true/false", 97 "Allow regions to register immediately upon grid server startup? true/false",
96 "True", 98 "True",
97 false); 99 false);
100 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
101 "Remote console access user name [Default: disabled]", "0", false);
102
103 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
104 "Remote console access password [Default: disabled]", "0", false);
105
98 } 106 }
99 107
100 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 108 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -140,9 +148,15 @@ namespace OpenSim.Framework
140 case "allow_region_registration": 148 case "allow_region_registration":
141 AllowRegionRegistration = (bool)configuration_result; 149 AllowRegionRegistration = (bool)configuration_result;
142 break; 150 break;
151 case "console_user":
152 ConsoleUser = (string)configuration_result;
153 break;
154 case "console_pass":
155 ConsolePass = (string)configuration_result;
156 break;
143 } 157 }
144 158
145 return true; 159 return true;
146 } 160 }
147 } 161 }
148} \ No newline at end of file 162}
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;
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,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
28using log4net.Config; 28using log4net.Config;
29using Nini.Config;
29 30
30namespace OpenSim.Grid.GridServer 31namespace 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");