Finished off the shutdown function

Consumed 100mg caffeine
zircon^2
gareth 2007-05-19 00:22:58 +00:00
parent 5bdbe8d916
commit e42c10fee5
5 changed files with 38 additions and 0 deletions

View File

@ -39,5 +39,25 @@ namespace OpenGridServices.Manager
{
return true;
}
public bool ShutdownServer()
{
try {
Hashtable ShutdownParamsHT = new Hashtable();
ArrayList ShutdownParams = new ArrayList();
ShutdownParams.Add(ShutdownParamsHT);
XmlRpcRequest GridShutdownReq = new XmlRpcRequest("shutdown",ShutdownParams);
XmlRpcResponse GridResp = GridShutdownReq.Send(this.ServerURL,3000);
if(GridResp.IsFault) {
return false;
} else {
return true;
}
} catch(Exception e) {
Console.WriteLine(e.ToString());
return false;
}
}
}
}

View File

@ -58,6 +58,17 @@ namespace OpenGridServices.Manager
win.SetStatus("Error restarting grid server!!!");
}
break;
case "shutdown_gridserver":
win.SetStatus("Shutting down grid server...");
if(gridserverConn.ShutdownServer()) {
win.SetStatus("Grid server shutdown");
Thread.Sleep(3000);
win.SetStatus("");
} else {
win.SetStatus("Could not shutdown grid server!!!");
}
break;
}
}
}

View File

@ -40,6 +40,11 @@ namespace OpenGridServices.Manager {
MainClass.PendingOperations.Enqueue("restart_gridserver");
}
protected virtual void ShutdownGridserverMenu(object sender, System.EventArgs e)
{
MainClass.PendingOperations.Enqueue("shutdown_gridserver");
}
}
}

View File

@ -353,6 +353,7 @@ namespace OpenGridServices.Manager {
this.DeleteEvent += new Gtk.DeleteEventHandler(this.OnDeleteEvent);
this.ConnectToGridserver.Activated += new System.EventHandler(this.ConnectToGridServerMenu);
this.ExitGridManager.Activated += new System.EventHandler(this.QuitMenu);
this.ShutdownGridserverOnly.Activated += new System.EventHandler(this.ShutdownGridserverMenu);
this.RestartGridserverOnly.Activated += new System.EventHandler(this.RestartGridserverMenu);
}
}

View File

@ -99,6 +99,7 @@
<property name="Label" translatable="yes">Shutdown gridserver only</property>
<property name="ShortLabel" translatable="yes">Shutdown gridserver only</property>
<property name="StockId">gtk-stop</property>
<signal name="Activated" handler="ShutdownGridserverMenu" after="yes" />
</action>
<action id="RestartGridserverOnly">
<property name="Type">Action</property>