diff options
Diffstat (limited to 'OpenSim/Grid/Framework.Manager/GridServerManager.cs')
-rw-r--r-- | OpenSim/Grid/Framework.Manager/GridServerManager.cs | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/OpenSim/Grid/Framework.Manager/GridServerManager.cs b/OpenSim/Grid/Framework.Manager/GridServerManager.cs deleted file mode 100644 index 729e42b..0000000 --- a/OpenSim/Grid/Framework.Manager/GridServerManager.cs +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
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. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections; | ||
31 | using System.Threading; | ||
32 | using libsecondlife; | ||
33 | using Nwc.XmlRpc; | ||
34 | |||
35 | namespace OpenSim.Framework.Manager { | ||
36 | |||
37 | /// <summary> | ||
38 | /// A remote management system for the grid server | ||
39 | /// </summary> | ||
40 | public class GridServerManager | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// Triggers events from the grid manager | ||
44 | /// </summary> | ||
45 | public static GridManagerCallback thecallback; | ||
46 | |||
47 | /// <summary> | ||
48 | /// Security keys | ||
49 | /// </summary> | ||
50 | public static string sendkey; | ||
51 | public static string recvkey; | ||
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> | ||
58 | public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) | ||
59 | { | ||
60 | XmlRpcResponse response = new XmlRpcResponse(); | ||
61 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
62 | Hashtable responseData = new Hashtable(); | ||
63 | |||
64 | if(requestData.ContainsKey("session_id")) { | ||
65 | if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { | ||
66 | responseData["msg"]="Shutdown command accepted"; | ||
67 | (new Thread(new ThreadStart(ShutdownServer))).Start(); | ||
68 | } else { | ||
69 | response.IsFault=true; | ||
70 | responseData["error"]="bad session ID"; | ||
71 | } | ||
72 | } else { | ||
73 | response.IsFault=true; | ||
74 | responseData["error"]="no session ID"; | ||
75 | } | ||
76 | |||
77 | response.Value = responseData; | ||
78 | return response; | ||
79 | } | ||
80 | |||
81 | /// <summary> | ||
82 | /// Shuts down the grid server | ||
83 | /// </summary> | ||
84 | public static void ShutdownServer() | ||
85 | { | ||
86 | Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); | ||
87 | Console.WriteLine("Terminating in three seconds..."); | ||
88 | Thread.Sleep(3000); | ||
89 | thecallback("shutdown"); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | |||