diff options
author | Adam Frisby | 2007-06-02 01:15:47 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-02 01:15:47 +0000 |
commit | bad9cdae1e939d2af5baa0164619aa4b8628c319 (patch) | |
tree | 8c059bf091cc84cd982e10aeae63b9d93a81403e /OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs | |
parent | * Documented SQLite grid interfaces (diff) | |
download | opensim-SC-bad9cdae1e939d2af5baa0164619aa4b8628c319.zip opensim-SC-bad9cdae1e939d2af5baa0164619aa4b8628c319.tar.gz opensim-SC-bad9cdae1e939d2af5baa0164619aa4b8628c319.tar.bz2 opensim-SC-bad9cdae1e939d2af5baa0164619aa4b8628c319.tar.xz |
* GridManagementAgent is now documented
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs')
-rw-r--r-- | OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs b/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs index 7ebf66a..e1d25a6 100644 --- a/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs +++ b/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs | |||
@@ -1,3 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
1 | using System; | 28 | using System; |
2 | using System.Collections; | 29 | using System.Collections; |
3 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
@@ -7,13 +34,27 @@ using libsecondlife; | |||
7 | 34 | ||
8 | namespace OpenGrid.Framework.Manager { | 35 | namespace OpenGrid.Framework.Manager { |
9 | 36 | ||
37 | /// <summary> | ||
38 | /// A remote management system for the grid server | ||
39 | /// </summary> | ||
10 | public class GridServerManager | 40 | public class GridServerManager |
11 | { | 41 | { |
42 | /// <summary> | ||
43 | /// Triggers events from the grid manager | ||
44 | /// </summary> | ||
12 | public static GridManagerCallback thecallback; | 45 | public static GridManagerCallback thecallback; |
13 | 46 | ||
47 | /// <summary> | ||
48 | /// Security keys | ||
49 | /// </summary> | ||
14 | public static string sendkey; | 50 | public static string sendkey; |
15 | public static string recvkey; | 51 | public static string recvkey; |
16 | 52 | ||
53 | /// <summary> | ||
54 | /// Disconnects the grid server and shuts it down | ||
55 | /// </summary> | ||
56 | /// <param name="request">XmlRpc Request</param> | ||
57 | /// <returns>An XmlRpc response containing either a "msg" or an "error"</returns> | ||
17 | public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) | 58 | public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) |
18 | { | 59 | { |
19 | XmlRpcResponse response = new XmlRpcResponse(); | 60 | XmlRpcResponse response = new XmlRpcResponse(); |
@@ -23,7 +64,7 @@ namespace OpenGrid.Framework.Manager { | |||
23 | if(requestData.ContainsKey("session_id")) { | 64 | if(requestData.ContainsKey("session_id")) { |
24 | if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { | 65 | if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { |
25 | responseData["msg"]="Shutdown command accepted"; | 66 | responseData["msg"]="Shutdown command accepted"; |
26 | (new Thread(new ThreadStart(ZOMGServerIsNowTerminallyIll))).Start(); | 67 | (new Thread(new ThreadStart(ShutdownServer))).Start(); |
27 | } else { | 68 | } else { |
28 | response.IsFault=true; | 69 | response.IsFault=true; |
29 | responseData["error"]="bad session ID"; | 70 | responseData["error"]="bad session ID"; |
@@ -37,11 +78,13 @@ namespace OpenGrid.Framework.Manager { | |||
37 | return response; | 78 | return response; |
38 | } | 79 | } |
39 | 80 | ||
40 | // Brought to by late-night coding | 81 | /// <summary> |
41 | public static void ZOMGServerIsNowTerminallyIll() | 82 | /// Shuts down the grid server |
83 | /// </summary> | ||
84 | public static void ShutdownServer() | ||
42 | { | 85 | { |
43 | Console.WriteLine("ZOMG! THIS SERVER IS TERMINALLY ILL - WE GOT A SHUTDOWN REQUEST FROM A GRID MANAGER!!!!"); | 86 | Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); |
44 | Console.WriteLine("We have 3 seconds to live..."); | 87 | Console.WriteLine("Terminating in three seconds..."); |
45 | Thread.Sleep(3000); | 88 | Thread.Sleep(3000); |
46 | thecallback("shutdown"); | 89 | thecallback("shutdown"); |
47 | } | 90 | } |