aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs')
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs167
1 files changed, 83 insertions, 84 deletions
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs
index 78b9761..a2334e1 100644
--- a/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs
+++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs
@@ -26,99 +26,98 @@
26* 26*
27*/ 27*/
28 28
29// project created on 5/14/2007 at 2:04 PM
30using System; 29using System;
31using System.Threading; 30using System.Threading;
32using Gtk; 31using Gtk;
33 32
34namespace OpenGridServices.Manager 33namespace OpenGridServices.Manager
35{ 34{
36 class MainClass 35 class MainClass
37 { 36 {
38 37
39 public static bool QuitReq=false; 38 public static bool QuitReq=false;
40 public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>(); 39 public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>();
41 40
42 private static Thread OperationsRunner; 41 private static Thread OperationsRunner;
43 42
44 private static GridServerConnectionManager gridserverConn; 43 private static GridServerConnectionManager gridserverConn;
45 44
46 private static MainWindow win; 45 private static MainWindow win;
47 46
48 public static void DoMainLoop() 47 public static void DoMainLoop()
49 { 48 {
50 while(!QuitReq) 49 while(!QuitReq)
51 { 50 {
52 Application.RunIteration(); 51 Application.RunIteration();
53 } 52 }
54 } 53 }
55 54
56 public static void RunOperations() 55 public static void RunOperations()
57 { 56 {
58 string operation; 57 string operation;
59 string cmd; 58 string cmd;
60 char[] sep = new char[1]; 59 char[] sep = new char[1];
61 sep[0]=' '; 60 sep[0]=' ';
62 while(!QuitReq) 61 while(!QuitReq)
63 { 62 {
64 operation=PendingOperations.Dequeue(); 63 operation=PendingOperations.Dequeue();
65 Console.WriteLine(operation); 64 Console.WriteLine(operation);
66 cmd = operation.Split(sep)[0]; 65 cmd = operation.Split(sep)[0];
67 switch(cmd) { 66 switch(cmd) {
68 case "connect_to_gridserver": 67 case "connect_to_gridserver":
69 win.SetStatus("Connecting to grid server..."); 68 win.SetStatus("Connecting to grid server...");
70 if(gridserverConn.Connect(operation.Split(sep)[1],operation.Split(sep)[2],operation.Split(sep)[3])) { 69 if(gridserverConn.Connect(operation.Split(sep)[1],operation.Split(sep)[2],operation.Split(sep)[3])) {
71 win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID); 70 win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID);
72 win.SetGridServerConnected(true); 71 win.SetGridServerConnected(true);
73 Thread.Sleep(3000); 72 Thread.Sleep(3000);
74 win.SetStatus("Downloading region maps..."); 73 win.SetStatus("Downloading region maps...");
75 gridserverConn.DownloadMap(); 74 gridserverConn.DownloadMap();
76 } else { 75 } else {
77 win.SetStatus("Could not connect"); 76 win.SetStatus("Could not connect");
78 } 77 }
79 break; 78 break;
80 79
81 case "restart_gridserver": 80 case "restart_gridserver":
82 win.SetStatus("Restarting grid server..."); 81 win.SetStatus("Restarting grid server...");
83 if(gridserverConn.RestartServer()) { 82 if(gridserverConn.RestartServer()) {
84 win.SetStatus("Restarted server OK"); 83 win.SetStatus("Restarted server OK");
85 Thread.Sleep(3000); 84 Thread.Sleep(3000);
86 win.SetStatus(""); 85 win.SetStatus("");
87 } else { 86 } else {
88 win.SetStatus("Error restarting grid server!!!"); 87 win.SetStatus("Error restarting grid server!!!");
89 } 88 }
90 break; 89 break;
91 90
92 case "shutdown_gridserver": 91 case "shutdown_gridserver":
93 win.SetStatus("Shutting down grid server..."); 92 win.SetStatus("Shutting down grid server...");
94 if(gridserverConn.ShutdownServer()) { 93 if(gridserverConn.ShutdownServer()) {
95 win.SetStatus("Grid server shutdown"); 94 win.SetStatus("Grid server shutdown");
96 win.SetGridServerConnected(false); 95 win.SetGridServerConnected(false);
97 Thread.Sleep(3000); 96 Thread.Sleep(3000);
98 win.SetStatus(""); 97 win.SetStatus("");
99 } else { 98 } else {
100 win.SetStatus("Could not shutdown grid server!!!"); 99 win.SetStatus("Could not shutdown grid server!!!");
101 } 100 }
102 break; 101 break;
103 102
104 case "disconnect_gridserver": 103 case "disconnect_gridserver":
105 gridserverConn.DisconnectServer(); 104 gridserverConn.DisconnectServer();
106 win.SetGridServerConnected(false); 105 win.SetGridServerConnected(false);
107 break; 106 break;
108 } 107 }
109 } 108 }
110 } 109 }
111 110
112 public static void Main (string[] args) 111 public static void Main (string[] args)
113 { 112 {
114 gridserverConn = new GridServerConnectionManager(); 113 gridserverConn = new GridServerConnectionManager();
115 Application.Init (); 114 Application.Init ();
116 win = new MainWindow (); 115 win = new MainWindow ();
117 win.Show (); 116 win.Show ();
118 OperationsRunner = new Thread(new ThreadStart(RunOperations)); 117 OperationsRunner = new Thread(new ThreadStart(RunOperations));
119 OperationsRunner.IsBackground=true; 118 OperationsRunner.IsBackground=true;
120 OperationsRunner.Start(); 119 OperationsRunner.Start();
121 DoMainLoop(); 120 DoMainLoop();
122 } 121 }
123 } 122 }
124} 123}