diff options
author | lbsa71 | 2008-03-28 21:43:46 +0000 |
---|---|---|
committer | lbsa71 | 2008-03-28 21:43:46 +0000 |
commit | 7f11079f57faacedc2dc8e3f2005b483e7314726 (patch) | |
tree | 3df97ace353d92cea53fbaaf4063fa9b53c93730 /OpenSim/Grid/GridServer/GridServerBase.cs | |
parent | * Introduced common abstract UserDataBase provider (diff) | |
download | opensim-SC_OLD-7f11079f57faacedc2dc8e3f2005b483e7314726.zip opensim-SC_OLD-7f11079f57faacedc2dc8e3f2005b483e7314726.tar.gz opensim-SC_OLD-7f11079f57faacedc2dc8e3f2005b483e7314726.tar.bz2 opensim-SC_OLD-7f11079f57faacedc2dc8e3f2005b483e7314726.tar.xz |
* Refactored out common http handler operations
Diffstat (limited to 'OpenSim/Grid/GridServer/GridServerBase.cs')
-rw-r--r-- | OpenSim/Grid/GridServer/GridServerBase.cs | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index 884ba4f..3be98d8 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs | |||
@@ -45,14 +45,8 @@ namespace OpenSim.Grid.GridServer | |||
45 | { | 45 | { |
46 | protected GridConfig m_config; | 46 | protected GridConfig m_config; |
47 | protected GridManager m_gridManager; | 47 | protected GridManager m_gridManager; |
48 | protected BaseHttpServer httpServer; | ||
49 | protected List<IGridPlugin> m_plugins = new List<IGridPlugin>(); | 48 | protected List<IGridPlugin> m_plugins = new List<IGridPlugin>(); |
50 | 49 | ||
51 | public BaseHttpServer HttpServer | ||
52 | { | ||
53 | get { return httpServer; } | ||
54 | } | ||
55 | |||
56 | public void Work() | 50 | public void Work() |
57 | { | 51 | { |
58 | m_console.Notice("Enter help for a list of commands\n"); | 52 | m_console.Notice("Enter help for a list of commands\n"); |
@@ -88,38 +82,37 @@ namespace OpenSim.Grid.GridServer | |||
88 | SetupGridManager(); | 82 | SetupGridManager(); |
89 | 83 | ||
90 | m_console.Status("[GRID]: Starting HTTP process"); | 84 | m_console.Status("[GRID]: Starting HTTP process"); |
91 | httpServer = new BaseHttpServer(m_config.HttpPort); | 85 | m_httpServer = new BaseHttpServer(m_config.HttpPort); |
92 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", m_config.SimSendKey, m_config.SimRecvKey, managercallback); | ||
93 | 86 | ||
94 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); | 87 | AddHttpHandlers(); |
95 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); | ||
96 | httpServer.AddXmlRPCHandler("simulator_after_region_moved", m_gridManager.XmlRpcDeleteRegionMethod); | ||
97 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | ||
98 | 88 | ||
99 | // Message Server ---> Grid Server | 89 | LoadGridPlugins( ); |
100 | httpServer.AddXmlRPCHandler("register_messageserver", m_gridManager.XmlRPCRegisterMessageServer); | ||
101 | httpServer.AddXmlRPCHandler("deregister_messageserver", m_gridManager.XmlRPCDeRegisterMessageServer); | ||
102 | 90 | ||
103 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod)); | 91 | m_httpServer.Start(); |
104 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod)); | ||
105 | 92 | ||
106 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod)); | 93 | m_console.Status("[GRID]: Starting sim status checker"); |
107 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod)); | ||
108 | 94 | ||
109 | //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); | 95 | Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. |
110 | //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); | 96 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); |
111 | //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); | 97 | simCheckTimer.Enabled = true; |
112 | //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); | 98 | } |
113 | 99 | ||
114 | LoadGridPlugins(); | 100 | protected void AddHttpHandlers() |
101 | { | ||
102 | m_httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); | ||
103 | m_httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); | ||
104 | m_httpServer.AddXmlRPCHandler("simulator_after_region_moved", m_gridManager.XmlRpcDeleteRegionMethod); | ||
105 | m_httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | ||
115 | 106 | ||
116 | httpServer.Start(); | 107 | // Message Server ---> Grid Server |
108 | m_httpServer.AddXmlRPCHandler("register_messageserver", m_gridManager.XmlRPCRegisterMessageServer); | ||
109 | m_httpServer.AddXmlRPCHandler("deregister_messageserver", m_gridManager.XmlRPCDeRegisterMessageServer); | ||
117 | 110 | ||
118 | m_console.Status("[GRID]: Starting sim status checker"); | 111 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod)); |
112 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod)); | ||
119 | 113 | ||
120 | Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates. | 114 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod)); |
121 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); | 115 | m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod)); |
122 | simCheckTimer.Enabled = true; | ||
123 | } | 116 | } |
124 | 117 | ||
125 | protected void LoadGridPlugins() | 118 | protected void LoadGridPlugins() |
@@ -131,8 +124,8 @@ namespace OpenSim.Grid.GridServer | |||
131 | ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/GridServer"); | 124 | ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/GridServer"); |
132 | foreach (TypeExtensionNode node in nodes) | 125 | foreach (TypeExtensionNode node in nodes) |
133 | { | 126 | { |
134 | m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin "+node.Path); | 127 | m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path); |
135 | IGridPlugin plugin = (IGridPlugin) node.CreateInstance(); | 128 | IGridPlugin plugin = (IGridPlugin)node.CreateInstance(); |
136 | plugin.Initialise(this); | 129 | plugin.Initialise(this); |
137 | m_plugins.Add(plugin); | 130 | m_plugins.Add(plugin); |
138 | } | 131 | } |
@@ -191,15 +184,15 @@ namespace OpenSim.Grid.GridServer | |||
191 | public override void RunCmd(string cmd, string[] cmdparams) | 184 | public override void RunCmd(string cmd, string[] cmdparams) |
192 | { | 185 | { |
193 | base.RunCmd(cmd, cmdparams); | 186 | base.RunCmd(cmd, cmdparams); |
194 | 187 | ||
195 | switch (cmd) | 188 | switch (cmd) |
196 | { | 189 | { |
197 | case "help": | 190 | case "help": |
198 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | 191 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); |
199 | break; | 192 | break; |
200 | 193 | ||
201 | case "shutdown": | 194 | case "shutdown": |
202 | foreach(IGridPlugin plugin in m_plugins) plugin.Close(); | 195 | foreach (IGridPlugin plugin in m_plugins) plugin.Close(); |
203 | m_console.Close(); | 196 | m_console.Close(); |
204 | Environment.Exit(0); | 197 | Environment.Exit(0); |
205 | break; | 198 | break; |