diff options
author | gareth | 2007-05-17 01:11:36 +0000 |
---|---|---|
committer | gareth | 2007-05-17 01:11:36 +0000 |
commit | ab6d1bd5a63693cc1cd8996c912238572e738356 (patch) | |
tree | 99234192f00a4dad8e86cea9782acc19752b4e81 | |
parent | Started Grid Server connection manager (diff) | |
download | opensim-SC-ab6d1bd5a63693cc1cd8996c912238572e738356.zip opensim-SC-ab6d1bd5a63693cc1cd8996c912238572e738356.tar.gz opensim-SC-ab6d1bd5a63693cc1cd8996c912238572e738356.tar.bz2 opensim-SC-ab6d1bd5a63693cc1cd8996c912238572e738356.tar.xz |
Added some exception handling
-rw-r--r-- | OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs | 27 | ||||
-rw-r--r-- | OpenGridServices.Manager/OpenGridServices.Manager/Main.cs | 6 |
2 files changed, 21 insertions, 12 deletions
diff --git a/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs b/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs index 112487f..8c933e1 100644 --- a/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs +++ b/OpenGridServices.Manager/OpenGridServices.Manager/GridServerConnectionManager.cs | |||
@@ -11,18 +11,23 @@ namespace OpenGridServices.Manager | |||
11 | 11 | ||
12 | public bool Connect(string GridServerURL, string username, string password) | 12 | public bool Connect(string GridServerURL, string username, string password) |
13 | { | 13 | { |
14 | this.ServerURL=GridServerURL; | 14 | try { |
15 | Hashtable LoginParamsHT = new Hashtable(); | 15 | this.ServerURL=GridServerURL; |
16 | LoginParamsHT["username"]=username; | 16 | Hashtable LoginParamsHT = new Hashtable(); |
17 | LoginParamsHT["password"]=password; | 17 | LoginParamsHT["username"]=username; |
18 | ArrayList LoginParams = new ArrayList(); | 18 | LoginParamsHT["password"]=password; |
19 | LoginParams.Add(LoginParamsHT); | 19 | ArrayList LoginParams = new ArrayList(); |
20 | XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams); | 20 | LoginParams.Add(LoginParamsHT); |
21 | XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000); | 21 | XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams); |
22 | if(GridResp.IsFault) { | 22 | XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000); |
23 | if(GridResp.IsFault) { | ||
24 | return false; | ||
25 | } else { | ||
26 | return true; | ||
27 | } | ||
28 | } catch(Exception e) { | ||
29 | Console.WriteLine(e.ToString()); | ||
23 | return false; | 30 | return false; |
24 | } else { | ||
25 | return true; | ||
26 | } | 31 | } |
27 | } | 32 | } |
28 | } | 33 | } |
diff --git a/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs b/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs index b14d10b..0e3f74d 100644 --- a/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs +++ b/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs | |||
@@ -39,7 +39,11 @@ namespace OpenGridServices.Manager | |||
39 | switch(cmd) { | 39 | switch(cmd) { |
40 | case "connect_to_gridserver": | 40 | case "connect_to_gridserver": |
41 | win.SetStatus("Connecting to grid server..."); | 41 | win.SetStatus("Connecting to grid server..."); |
42 | 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"); | ||
44 | } else { | ||
45 | win.SetStatus("Could not connect"); | ||
46 | } | ||
43 | break; | 47 | break; |
44 | } | 48 | } |
45 | } | 49 | } |