Started Grid Server connection manager

zircon^2
gareth 2007-05-17 01:06:02 +00:00
parent 3b53f7c3f0
commit 2f4d484702
6 changed files with 305 additions and 91 deletions

View File

@ -14,7 +14,7 @@ namespace OpenGridServices.Manager {
{ {
switch(args.ResponseId) { switch(args.ResponseId) {
case Gtk.ResponseType.Ok: case Gtk.ResponseType.Ok:
MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text); MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text + " " + this.entry2.Text + " " + this.entry3.Text);
break; break;
case Gtk.ResponseType.Cancel: case Gtk.ResponseType.Cancel:

View File

@ -0,0 +1,29 @@
using Nwc.XmlRpc;
using System;
using System.Collections;
using System.Collections.Generic;
namespace OpenGridServices.Manager
{
public class GridServerConnectionManager
{
private string ServerURL;
public bool Connect(string GridServerURL, string username, string password)
{
this.ServerURL=GridServerURL;
Hashtable LoginParamsHT = new Hashtable();
LoginParamsHT["username"]=username;
LoginParamsHT["password"]=password;
ArrayList LoginParams = new ArrayList();
LoginParams.Add(LoginParamsHT);
XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams);
XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000);
if(GridResp.IsFault) {
return false;
} else {
return true;
}
}
}
}

View File

@ -12,6 +12,9 @@ namespace OpenGridServices.Manager
public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>(); public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>();
private static Thread OperationsRunner; private static Thread OperationsRunner;
private static GridServerConnectionManager gridserverConn;
private static MainWindow win; private static MainWindow win;
public static void DoMainLoop() public static void DoMainLoop()
@ -36,7 +39,7 @@ namespace OpenGridServices.Manager
switch(cmd) { switch(cmd) {
case "connect_to_gridserver": case "connect_to_gridserver":
win.SetStatus("Connecting to grid server..."); win.SetStatus("Connecting to grid server...");
gridserverConn.Connect(operation.Split(sep)[1],operation.Split(sep)[2],operation.Split(sep)[3]);
break; break;
} }
} }
@ -44,6 +47,7 @@ namespace OpenGridServices.Manager
public static void Main (string[] args) public static void Main (string[] args)
{ {
gridserverConn = new GridServerConnectionManager();
Application.Init (); Application.Init ();
win = new MainWindow (); win = new MainWindow ();
win.Show (); win.Show ();

View File

@ -24,6 +24,7 @@
<File name="./gtk-gui/OpenGridServices.Manager.MainWindow.cs" subtype="Code" buildaction="Compile" /> <File name="./gtk-gui/OpenGridServices.Manager.MainWindow.cs" subtype="Code" buildaction="Compile" />
<File name="./BlockingQueue.cs" subtype="Code" buildaction="Compile" /> <File name="./BlockingQueue.cs" subtype="Code" buildaction="Compile" />
<File name="./gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs" subtype="Code" buildaction="Compile" /> <File name="./gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs" subtype="Code" buildaction="Compile" />
<File name="./GridServerConnectionManager.cs" subtype="Code" buildaction="Compile" />
</Contents> </Contents>
<References> <References>
<ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />

View File

@ -15,10 +15,26 @@ namespace OpenGridServices.Manager {
private Gtk.VBox vbox2; private Gtk.VBox vbox2;
private Gtk.VBox vbox3;
private Gtk.HBox hbox1;
private Gtk.Label label1; private Gtk.Label label1;
private Gtk.Entry entry1; private Gtk.Entry entry1;
private Gtk.HBox hbox2;
private Gtk.Label label2;
private Gtk.Entry entry2;
private Gtk.HBox hbox3;
private Gtk.Label label3;
private Gtk.Entry entry3;
private Gtk.Button button2; private Gtk.Button button2;
private Gtk.Button button8; private Gtk.Button button8;
@ -38,17 +54,21 @@ namespace OpenGridServices.Manager {
this.vbox2 = new Gtk.VBox(); this.vbox2 = new Gtk.VBox();
this.vbox2.Name = "vbox2"; this.vbox2.Name = "vbox2";
// Container child vbox2.Gtk.Box+BoxChild // Container child vbox2.Gtk.Box+BoxChild
this.vbox3 = new Gtk.VBox();
this.vbox3.Name = "vbox3";
// Container child vbox3.Gtk.Box+BoxChild
this.hbox1 = new Gtk.HBox();
this.hbox1.Name = "hbox1";
// Container child hbox1.Gtk.Box+BoxChild
this.label1 = new Gtk.Label(); this.label1 = new Gtk.Label();
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.LabelProp = Mono.Unix.Catalog.GetString("Please type in the grid server management interface URL:"); this.label1.Xalign = 1F;
this.label1.Wrap = true; this.label1.LabelProp = Mono.Unix.Catalog.GetString("Grid server URL: ");
this.label1.Justify = ((Gtk.Justification)(2)); this.label1.Justify = ((Gtk.Justification)(1));
this.vbox2.Add(this.label1); this.hbox1.Add(this.label1);
Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.vbox2[this.label1])); Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.label1]));
w2.Position = 0; w2.Position = 0;
w2.Expand = false; // Container child hbox1.Gtk.Box+BoxChild
w2.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.entry1 = new Gtk.Entry(); this.entry1 = new Gtk.Entry();
this.entry1.CanFocus = true; this.entry1.CanFocus = true;
this.entry1.Name = "entry1"; this.entry1.Name = "entry1";
@ -56,21 +76,81 @@ namespace OpenGridServices.Manager {
this.entry1.IsEditable = true; this.entry1.IsEditable = true;
this.entry1.MaxLength = 255; this.entry1.MaxLength = 255;
this.entry1.InvisibleChar = '•'; this.entry1.InvisibleChar = '•';
this.vbox2.Add(this.entry1); this.hbox1.Add(this.entry1);
Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox2[this.entry1])); Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.entry1]));
w3.Position = 1; w3.Position = 1;
w3.Expand = false; this.vbox3.Add(this.hbox1);
w3.Fill = false; Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox1]));
w1.Add(this.vbox2);
Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(w1[this.vbox2]));
w4.Position = 0; w4.Position = 0;
w4.Expand = false;
w4.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.hbox2 = new Gtk.HBox();
this.hbox2.Name = "hbox2";
// Container child hbox2.Gtk.Box+BoxChild
this.label2 = new Gtk.Label();
this.label2.Name = "label2";
this.label2.Xalign = 1F;
this.label2.LabelProp = Mono.Unix.Catalog.GetString("Username:");
this.label2.Justify = ((Gtk.Justification)(1));
this.hbox2.Add(this.label2);
Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox2[this.label2]));
w5.Position = 0;
// Container child hbox2.Gtk.Box+BoxChild
this.entry2 = new Gtk.Entry();
this.entry2.CanFocus = true;
this.entry2.Name = "entry2";
this.entry2.IsEditable = true;
this.entry2.InvisibleChar = '•';
this.hbox2.Add(this.entry2);
Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.hbox2[this.entry2]));
w6.Position = 1;
this.vbox3.Add(this.hbox2);
Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox2]));
w7.Position = 1;
w7.Expand = false;
w7.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.hbox3 = new Gtk.HBox();
this.hbox3.Name = "hbox3";
// Container child hbox3.Gtk.Box+BoxChild
this.label3 = new Gtk.Label();
this.label3.Name = "label3";
this.label3.Xalign = 1F;
this.label3.LabelProp = Mono.Unix.Catalog.GetString("Password:");
this.label3.Justify = ((Gtk.Justification)(1));
this.hbox3.Add(this.label3);
Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox3[this.label3]));
w8.Position = 0;
// Container child hbox3.Gtk.Box+BoxChild
this.entry3 = new Gtk.Entry();
this.entry3.CanFocus = true;
this.entry3.Name = "entry3";
this.entry3.IsEditable = true;
this.entry3.InvisibleChar = '•';
this.hbox3.Add(this.entry3);
Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox3[this.entry3]));
w9.Position = 1;
this.vbox3.Add(this.hbox3);
Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox3]));
w10.Position = 2;
w10.Expand = false;
w10.Fill = false;
this.vbox2.Add(this.vbox3);
Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox2[this.vbox3]));
w11.Position = 2;
w11.Expand = false;
w11.Fill = false;
w1.Add(this.vbox2);
Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(w1[this.vbox2]));
w12.Position = 0;
// Internal child OpenGridServices.Manager.ConnectToGridServerDialog.ActionArea // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.ActionArea
Gtk.HButtonBox w5 = this.ActionArea; Gtk.HButtonBox w13 = this.ActionArea;
w5.Events = ((Gdk.EventMask)(256)); w13.Events = ((Gdk.EventMask)(256));
w5.Name = "OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea"; w13.Name = "OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea";
w5.Spacing = 6; w13.Spacing = 6;
w5.BorderWidth = ((uint)(5)); w13.BorderWidth = ((uint)(5));
w5.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); w13.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
// Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.button2 = new Gtk.Button(); this.button2 = new Gtk.Button();
this.button2.CanDefault = true; this.button2.CanDefault = true;
@ -78,29 +158,29 @@ namespace OpenGridServices.Manager {
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.UseUnderline = true; this.button2.UseUnderline = true;
// Container child button2.Gtk.Container+ContainerChild // Container child button2.Gtk.Container+ContainerChild
Gtk.Alignment w6 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F); Gtk.Alignment w14 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
w6.Name = "GtkAlignment"; w14.Name = "GtkAlignment";
// Container child GtkAlignment.Gtk.Container+ContainerChild // Container child GtkAlignment.Gtk.Container+ContainerChild
Gtk.HBox w7 = new Gtk.HBox(); Gtk.HBox w15 = new Gtk.HBox();
w7.Name = "GtkHBox"; w15.Name = "GtkHBox";
w7.Spacing = 2; w15.Spacing = 2;
// Container child GtkHBox.Gtk.Container+ContainerChild // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Image w8 = new Gtk.Image(); Gtk.Image w16 = new Gtk.Image();
w8.Name = "image37"; w16.Name = "image39";
w8.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-apply", 16, 0); w16.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-apply", 16, 0);
w7.Add(w8); w15.Add(w16);
// Container child GtkHBox.Gtk.Container+ContainerChild // Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Label w10 = new Gtk.Label(); Gtk.Label w18 = new Gtk.Label();
w10.Name = "GtkLabel"; w18.Name = "GtkLabel";
w10.LabelProp = Mono.Unix.Catalog.GetString("Connect"); w18.LabelProp = Mono.Unix.Catalog.GetString("Connect");
w10.UseUnderline = true; w18.UseUnderline = true;
w7.Add(w10); w15.Add(w18);
w6.Add(w7); w14.Add(w15);
this.button2.Add(w6); this.button2.Add(w14);
this.AddActionWidget(this.button2, -5); this.AddActionWidget(this.button2, -5);
Gtk.ButtonBox.ButtonBoxChild w14 = ((Gtk.ButtonBox.ButtonBoxChild)(w5[this.button2])); Gtk.ButtonBox.ButtonBoxChild w22 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button2]));
w14.Expand = false; w22.Expand = false;
w14.Fill = false; w22.Fill = false;
// Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.button8 = new Gtk.Button(); this.button8 = new Gtk.Button();
this.button8.CanDefault = true; this.button8.CanDefault = true;
@ -108,35 +188,35 @@ namespace OpenGridServices.Manager {
this.button8.Name = "button8"; this.button8.Name = "button8";
this.button8.UseUnderline = true; this.button8.UseUnderline = true;
// Container child button8.Gtk.Container+ContainerChild // Container child button8.Gtk.Container+ContainerChild
Gtk.Alignment w15 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F); Gtk.Alignment w23 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
w15.Name = "GtkAlignment1"; w23.Name = "GtkAlignment1";
// Container child GtkAlignment1.Gtk.Container+ContainerChild // Container child GtkAlignment1.Gtk.Container+ContainerChild
Gtk.HBox w16 = new Gtk.HBox(); Gtk.HBox w24 = new Gtk.HBox();
w16.Name = "GtkHBox1"; w24.Name = "GtkHBox1";
w16.Spacing = 2; w24.Spacing = 2;
// Container child GtkHBox1.Gtk.Container+ContainerChild // Container child GtkHBox1.Gtk.Container+ContainerChild
Gtk.Image w17 = new Gtk.Image(); Gtk.Image w25 = new Gtk.Image();
w17.Name = "image38"; w25.Name = "image40";
w17.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-cancel", 16, 0); w25.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-cancel", 16, 0);
w16.Add(w17); w24.Add(w25);
// Container child GtkHBox1.Gtk.Container+ContainerChild // Container child GtkHBox1.Gtk.Container+ContainerChild
Gtk.Label w19 = new Gtk.Label(); Gtk.Label w27 = new Gtk.Label();
w19.Name = "GtkLabel1"; w27.Name = "GtkLabel1";
w19.LabelProp = Mono.Unix.Catalog.GetString("Cancel"); w27.LabelProp = Mono.Unix.Catalog.GetString("Cancel");
w19.UseUnderline = true; w27.UseUnderline = true;
w16.Add(w19); w24.Add(w27);
w15.Add(w16); w23.Add(w24);
this.button8.Add(w15); this.button8.Add(w23);
this.AddActionWidget(this.button8, -6); this.AddActionWidget(this.button8, -6);
Gtk.ButtonBox.ButtonBoxChild w23 = ((Gtk.ButtonBox.ButtonBoxChild)(w5[this.button8])); Gtk.ButtonBox.ButtonBoxChild w31 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button8]));
w23.Position = 1; w31.Position = 1;
w23.Expand = false; w31.Expand = false;
w23.Fill = false; w31.Fill = false;
if ((this.Child != null)) { if ((this.Child != null)) {
this.Child.ShowAll(); this.Child.ShowAll();
} }
this.DefaultWidth = 476; this.DefaultWidth = 476;
this.DefaultHeight = 107; this.DefaultHeight = 137;
this.Show(); this.Show();
this.Response += new Gtk.ResponseHandler(this.OnResponse); this.Response += new Gtk.ResponseHandler(this.OnResponse);
} }

View File

@ -463,7 +463,7 @@
</widget> </widget>
</child> </child>
</widget> </widget>
<widget class="Gtk.Dialog" id="OpenGridServices.Manager.ConnectToGridServerDialog" design-size="476 107"> <widget class="Gtk.Dialog" id="OpenGridServices.Manager.ConnectToGridServerDialog" design-size="476 137">
<property name="MemberName" /> <property name="MemberName" />
<property name="Events">ButtonPressMask</property> <property name="Events">ButtonPressMask</property>
<property name="Title" translatable="yes">Connect to Grid server</property> <property name="Title" translatable="yes">Connect to Grid server</property>
@ -479,38 +479,138 @@
<widget class="Gtk.VBox" id="vbox2"> <widget class="Gtk.VBox" id="vbox2">
<property name="MemberName" /> <property name="MemberName" />
<child> <child>
<widget class="Gtk.Label" id="label1"> <placeholder />
<property name="MemberName" />
<property name="LabelProp" translatable="yes">Please type in the grid server management interface URL:</property>
<property name="Wrap">True</property>
<property name="Justify">Center</property>
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Entry" id="entry1">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Text" translatable="yes">http://gridserver:8001</property>
<property name="IsEditable">True</property>
<property name="MaxLength">255</property>
<property name="InvisibleChar">•</property>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child> </child>
<child> <child>
<placeholder /> <placeholder />
</child> </child>
<child>
<widget class="Gtk.VBox" id="vbox3">
<property name="MemberName" />
<child>
<widget class="Gtk.HBox" id="hbox1">
<property name="MemberName" />
<child>
<widget class="Gtk.Label" id="label1">
<property name="MemberName" />
<property name="Xalign">1</property>
<property name="LabelProp" translatable="yes">Grid server URL: </property>
<property name="Justify">Right</property>
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Entry" id="entry1">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Text" translatable="yes">http://gridserver:8001</property>
<property name="IsEditable">True</property>
<property name="MaxLength">255</property>
<property name="InvisibleChar">•</property>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">False</property>
</packing>
</child>
<child>
<placeholder />
</child>
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.HBox" id="hbox2">
<property name="MemberName" />
<child>
<widget class="Gtk.Label" id="label2">
<property name="MemberName" />
<property name="Xalign">1</property>
<property name="LabelProp" translatable="yes">Username:</property>
<property name="Justify">Right</property>
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Entry" id="entry2">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="IsEditable">True</property>
<property name="InvisibleChar">•</property>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">True</property>
</packing>
</child>
<child>
<placeholder />
</child>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">False</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.HBox" id="hbox3">
<property name="MemberName" />
<child>
<widget class="Gtk.Label" id="label3">
<property name="MemberName" />
<property name="Xalign">1</property>
<property name="LabelProp" translatable="yes">Password:</property>
<property name="Justify">Right</property>
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Entry" id="entry3">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="IsEditable">True</property>
<property name="InvisibleChar">•</property>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">True</property>
</packing>
</child>
<child>
<placeholder />
</child>
</widget>
<packing>
<property name="Position">2</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="Position">2</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="Position">0</property> <property name="Position">0</property>