diff options
Diffstat (limited to 'OpenGridServices.Manager')
5 files changed, 34 insertions, 1 deletions
diff --git a/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs b/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs index ad6b97f..668a1b8 100644 --- a/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs +++ b/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs | |||
@@ -10,6 +10,7 @@ namespace OpenGridServices.Manager | |||
10 | { | 10 | { |
11 | private string ServerURL; | 11 | private string ServerURL; |
12 | public LLUUID SessionID; | 12 | public LLUUID SessionID; |
13 | public bool connected=false; | ||
13 | 14 | ||
14 | public bool Connect(string GridServerURL, string username, string password) | 15 | public bool Connect(string GridServerURL, string username, string password) |
15 | { | 16 | { |
@@ -23,14 +24,17 @@ namespace OpenGridServices.Manager | |||
23 | XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams); | 24 | XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams); |
24 | XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000); | 25 | XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000); |
25 | if(GridResp.IsFault) { | 26 | if(GridResp.IsFault) { |
27 | connected=false; | ||
26 | return false; | 28 | return false; |
27 | } else { | 29 | } else { |
28 | Hashtable gridrespData = (Hashtable)GridResp.Value; | 30 | Hashtable gridrespData = (Hashtable)GridResp.Value; |
29 | this.SessionID = new LLUUID((string)gridrespData["session_id"]); | 31 | this.SessionID = new LLUUID((string)gridrespData["session_id"]); |
32 | connected=true; | ||
30 | return true; | 33 | return true; |
31 | } | 34 | } |
32 | } catch(Exception e) { | 35 | } catch(Exception e) { |
33 | Console.WriteLine(e.ToString()); | 36 | Console.WriteLine(e.ToString()); |
37 | connected=false; | ||
34 | return false; | 38 | return false; |
35 | } | 39 | } |
36 | } | 40 | } |
@@ -52,6 +56,7 @@ namespace OpenGridServices.Manager | |||
52 | if(GridResp.IsFault) { | 56 | if(GridResp.IsFault) { |
53 | return false; | 57 | return false; |
54 | } else { | 58 | } else { |
59 | connected=false; | ||
55 | return true; | 60 | return true; |
56 | } | 61 | } |
57 | } catch(Exception e) { | 62 | } catch(Exception e) { |
@@ -60,5 +65,9 @@ namespace OpenGridServices.Manager | |||
60 | } | 65 | } |
61 | } | 66 | } |
62 | 67 | ||
68 | public void DisconnectServer() | ||
69 | { | ||
70 | this.connected=false; | ||
71 | } | ||
63 | } | 72 | } |
64 | } | 73 | } |
diff --git a/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs b/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs index f2e4153..c7c0dd7 100644 --- a/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs +++ b/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs | |||
@@ -41,6 +41,7 @@ namespace OpenGridServices.Manager | |||
41 | win.SetStatus("Connecting to grid server..."); | 41 | win.SetStatus("Connecting to grid server..."); |
42 | if(gridserverConn.Connect(operation.Split(sep)[1],operation.Split(sep)[2],operation.Split(sep)[3])) { | 42 | if(gridserverConn.Connect(operation.Split(sep)[1],operation.Split(sep)[2],operation.Split(sep)[3])) { |
43 | win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID); | 43 | win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID); |
44 | win.SetGridServerConnected(true); | ||
44 | Thread.Sleep(3000); | 45 | Thread.Sleep(3000); |
45 | win.SetStatus(""); | 46 | win.SetStatus(""); |
46 | } else { | 47 | } else { |
@@ -63,12 +64,18 @@ namespace OpenGridServices.Manager | |||
63 | win.SetStatus("Shutting down grid server..."); | 64 | win.SetStatus("Shutting down grid server..."); |
64 | if(gridserverConn.ShutdownServer()) { | 65 | if(gridserverConn.ShutdownServer()) { |
65 | win.SetStatus("Grid server shutdown"); | 66 | win.SetStatus("Grid server shutdown"); |
67 | win.SetGridServerConnected(false); | ||
66 | Thread.Sleep(3000); | 68 | Thread.Sleep(3000); |
67 | win.SetStatus(""); | 69 | win.SetStatus(""); |
68 | } else { | 70 | } else { |
69 | win.SetStatus("Could not shutdown grid server!!!"); | 71 | win.SetStatus("Could not shutdown grid server!!!"); |
70 | } | 72 | } |
71 | break; | 73 | break; |
74 | |||
75 | case "disconnect_gridserver": | ||
76 | gridserverConn.DisconnectServer(); | ||
77 | win.SetGridServerConnected(false); | ||
78 | break; | ||
72 | } | 79 | } |
73 | } | 80 | } |
74 | } | 81 | } |
diff --git a/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs b/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs index ba61eed..bc8d251 100644 --- a/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs +++ b/OpenGridServices.Manager/OpenGridServices.Manager/MainWindow.cs | |||
@@ -15,6 +15,17 @@ namespace OpenGridServices.Manager { | |||
15 | this.statusbar1.Push(0,statustext); | 15 | this.statusbar1.Push(0,statustext); |
16 | } | 16 | } |
17 | 17 | ||
18 | public void SetGridServerConnected(bool connected) | ||
19 | { | ||
20 | if(connected) { | ||
21 | this.ConnectToGridserver.Visible=false; | ||
22 | this.DisconnectFromGridServer.Visible=true; | ||
23 | } else { | ||
24 | this.ConnectToGridserver.Visible=true; | ||
25 | this.DisconnectFromGridServer.Visible=false; | ||
26 | } | ||
27 | } | ||
28 | |||
18 | protected void OnDeleteEvent (object sender, DeleteEventArgs a) | 29 | protected void OnDeleteEvent (object sender, DeleteEventArgs a) |
19 | { | 30 | { |
20 | Application.Quit (); | 31 | Application.Quit (); |
@@ -32,7 +43,6 @@ namespace OpenGridServices.Manager { | |||
32 | { | 43 | { |
33 | ConnectToGridServerDialog griddialog = new ConnectToGridServerDialog (); | 44 | ConnectToGridServerDialog griddialog = new ConnectToGridServerDialog (); |
34 | griddialog.Show(); | 45 | griddialog.Show(); |
35 | |||
36 | } | 46 | } |
37 | 47 | ||
38 | protected virtual void RestartGridserverMenu(object sender, System.EventArgs e) | 48 | protected virtual void RestartGridserverMenu(object sender, System.EventArgs e) |
@@ -45,6 +55,11 @@ namespace OpenGridServices.Manager { | |||
45 | MainClass.PendingOperations.Enqueue("shutdown_gridserver"); | 55 | MainClass.PendingOperations.Enqueue("shutdown_gridserver"); |
46 | } | 56 | } |
47 | 57 | ||
58 | protected virtual void DisconnectGridServerMenu(object sender, System.EventArgs e) | ||
59 | { | ||
60 | MainClass.PendingOperations.Enqueue("disconnect_gridserver"); | ||
61 | } | ||
62 | |||
48 | } | 63 | } |
49 | } | 64 | } |
50 | 65 | ||
diff --git a/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs b/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs index 49b6483..593ee42 100644 --- a/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs +++ b/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs | |||
@@ -355,6 +355,7 @@ namespace OpenGridServices.Manager { | |||
355 | this.ExitGridManager.Activated += new System.EventHandler(this.QuitMenu); | 355 | this.ExitGridManager.Activated += new System.EventHandler(this.QuitMenu); |
356 | this.ShutdownGridserverOnly.Activated += new System.EventHandler(this.ShutdownGridserverMenu); | 356 | this.ShutdownGridserverOnly.Activated += new System.EventHandler(this.ShutdownGridserverMenu); |
357 | this.RestartGridserverOnly.Activated += new System.EventHandler(this.RestartGridserverMenu); | 357 | this.RestartGridserverOnly.Activated += new System.EventHandler(this.RestartGridserverMenu); |
358 | this.DisconnectFromGridServer.Activated += new System.EventHandler(this.DisconnectGridServerMenu); | ||
358 | } | 359 | } |
359 | } | 360 | } |
360 | } | 361 | } |
diff --git a/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic b/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic index 4c6190f..ac677a2 100644 --- a/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic +++ b/OpenGridServices.Manager/OpenGridServices.Manager/gtk-gui/gui.stetic | |||
@@ -129,6 +129,7 @@ | |||
129 | <property name="ShortLabel" translatable="yes">Disconnect from grid server</property> | 129 | <property name="ShortLabel" translatable="yes">Disconnect from grid server</property> |
130 | <property name="StockId">gtk-disconnect</property> | 130 | <property name="StockId">gtk-disconnect</property> |
131 | <property name="Visible">False</property> | 131 | <property name="Visible">False</property> |
132 | <signal name="Activated" handler="DisconnectGridServerMenu" after="yes" /> | ||
132 | </action> | 133 | </action> |
133 | <action id="UploadAsset"> | 134 | <action id="UploadAsset"> |
134 | <property name="Type">Action</property> | 135 | <property name="Type">Action</property> |