aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices
diff options
context:
space:
mode:
Diffstat (limited to 'OpenGridServices')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs110
1 files changed, 55 insertions, 55 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs b/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs
index d665ab4..e276556 100644
--- a/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs
+++ b/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs
@@ -24,71 +24,71 @@
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using Nwc.XmlRpc; 32using Nwc.XmlRpc;
33using System.Threading; 33using System.Threading;
34using libsecondlife; 34using libsecondlife;
35 35
36namespace OpenGrid.Framework.Manager { 36namespace OpenGrid.Framework.Manager {
37 37
38 /// <summary> 38 /// <summary>
39 /// A remote management system for the grid server 39 /// A remote management system for the grid server
40 /// </summary> 40 /// </summary>
41 public class GridServerManager 41 public class GridServerManager
42 { 42 {
43 /// <summary> 43 /// <summary>
44 /// Triggers events from the grid manager 44 /// Triggers events from the grid manager
45 /// </summary> 45 /// </summary>
46 public static GridManagerCallback thecallback; 46 public static GridManagerCallback thecallback;
47 47
48 /// <summary> 48 /// <summary>
49 /// Security keys 49 /// Security keys
50 /// </summary> 50 /// </summary>
51 public static string sendkey; 51 public static string sendkey;
52 public static string recvkey; 52 public static string recvkey;
53 53
54 /// <summary> 54 /// <summary>
55 /// Disconnects the grid server and shuts it down 55 /// Disconnects the grid server and shuts it down
56 /// </summary> 56 /// </summary>
57 /// <param name="request">XmlRpc Request</param> 57 /// <param name="request">XmlRpc Request</param>
58 /// <returns>An XmlRpc response containing either a "msg" or an "error"</returns> 58 /// <returns>An XmlRpc response containing either a "msg" or an "error"</returns>
59 public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) 59 public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request)
60 { 60 {
61 XmlRpcResponse response = new XmlRpcResponse(); 61 XmlRpcResponse response = new XmlRpcResponse();
62 Hashtable requestData = (Hashtable)request.Params[0]; 62 Hashtable requestData = (Hashtable)request.Params[0];
63 Hashtable responseData = new Hashtable(); 63 Hashtable responseData = new Hashtable();
64 64
65 if(requestData.ContainsKey("session_id")) { 65 if(requestData.ContainsKey("session_id")) {
66 if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { 66 if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) {
67 responseData["msg"]="Shutdown command accepted"; 67 responseData["msg"]="Shutdown command accepted";
68 (new Thread(new ThreadStart(ShutdownServer))).Start(); 68 (new Thread(new ThreadStart(ShutdownServer))).Start();
69 } else { 69 } else {
70 response.IsFault=true; 70 response.IsFault=true;
71 responseData["error"]="bad session ID"; 71 responseData["error"]="bad session ID";
72 } 72 }
73 } else { 73 } else {
74 response.IsFault=true; 74 response.IsFault=true;
75 responseData["error"]="no session ID"; 75 responseData["error"]="no session ID";
76 } 76 }
77 77
78 response.Value = responseData; 78 response.Value = responseData;
79 return response; 79 return response;
80 } 80 }
81 81
82 /// <summary> 82 /// <summary>
83 /// Shuts down the grid server 83 /// Shuts down the grid server
84 /// </summary> 84 /// </summary>
85 public static void ShutdownServer() 85 public static void ShutdownServer()
86 { 86 {
87 Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); 87 Console.WriteLine("Shutting down the grid server - recieved a grid manager request");
88 Console.WriteLine("Terminating in three seconds..."); 88 Console.WriteLine("Terminating in three seconds...");
89 Thread.Sleep(3000); 89 Thread.Sleep(3000);
90 thecallback("shutdown"); 90 thecallback("shutdown");
91 } 91 }
92 } 92 }
93} 93}
94 94