| 1 |
pjm2 |
1.1 |
//---PACKAGE DECLARATION--- |
| 2 |
|
|
|
| 3 |
|
|
//---IMPORTS--- |
| 4 |
|
|
|
| 5 |
|
|
import java.io.*; |
| 6 |
|
|
|
| 7 |
|
|
/** |
| 8 |
|
|
* JavaClientMain |
| 9 |
|
|
* |
| 10 |
|
|
* @author $Author: $ |
| 11 |
|
|
* @version $Id: $ |
| 12 |
|
|
*/ |
| 13 |
|
|
public class JavaClientMain { |
| 14 |
|
|
|
| 15 |
|
|
//---FINAL ATTRIBUTES--- |
| 16 |
|
|
|
| 17 |
|
|
/** |
| 18 |
|
|
* The current CVS revision of this class |
| 19 |
|
|
*/ |
| 20 |
|
|
public final String REVISION = "$Revision: $"; |
| 21 |
|
|
|
| 22 |
|
|
//---STATIC METHODS--- |
| 23 |
|
|
|
| 24 |
|
|
//---CONSTRUCTORS--- |
| 25 |
|
|
|
| 26 |
|
|
//---PUBLIC METHODS--- |
| 27 |
|
|
|
| 28 |
|
|
public static void main(String[] args) { |
| 29 |
|
|
|
| 30 |
|
|
if (args.length != 2) { |
| 31 |
|
|
System.out.println("Usage: java JavaClientMain servername port"); |
| 32 |
|
|
System.exit(1); |
| 33 |
|
|
} |
| 34 |
|
|
|
| 35 |
|
|
String serverName = args[0]; |
| 36 |
|
|
int serverPort = 0; |
| 37 |
|
|
try { |
| 38 |
|
|
serverPort = Integer.parseInt(args[1]); |
| 39 |
|
|
} |
| 40 |
|
|
catch (Exception e){ |
| 41 |
|
|
System.out.println("Unrecognised port number"); |
| 42 |
|
|
} |
| 43 |
|
|
|
| 44 |
|
|
InputStream nothing = null; |
| 45 |
|
|
System.setIn(nothing); |
| 46 |
|
|
|
| 47 |
|
|
TerminalScreen screen = new TerminalScreen(); |
| 48 |
|
|
screen.clear(); |
| 49 |
|
|
screen.gotoxy(34, 10); |
| 50 |
|
|
screen.print(" i - s c r e a m ", TerminalScreen.BOLD, TerminalScreen.BLACK_BG); |
| 51 |
|
|
screen.gotoxy(27, 12); |
| 52 |
|
|
screen.print("Central Monitoring System Client", TerminalScreen.BLUE); |
| 53 |
|
|
screen.gotoxy(32,13); |
| 54 |
|
|
screen.print("Unix/Linux version 1.0"); |
| 55 |
|
|
|
| 56 |
|
|
// Show intro screen for 2 seconds. |
| 57 |
|
|
try { |
| 58 |
|
|
Thread.sleep(2000); |
| 59 |
|
|
} |
| 60 |
|
|
catch (InterruptedException e) { |
| 61 |
|
|
// What a carry on. |
| 62 |
|
|
} |
| 63 |
|
|
|
| 64 |
|
|
screen.clear(); |
| 65 |
|
|
|
| 66 |
|
|
XMLStreamReaderThread reader = new XMLStreamReaderThread(serverName, serverPort, screen); |
| 67 |
|
|
reader.start(); |
| 68 |
|
|
|
| 69 |
|
|
// Handle some keypresses and things here. |
| 70 |
|
|
|
| 71 |
|
|
} |
| 72 |
|
|
|
| 73 |
|
|
//---PRIVATE METHODS--- |
| 74 |
|
|
|
| 75 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
| 76 |
|
|
|
| 77 |
|
|
//---ATTRIBUTES--- |
| 78 |
|
|
|
| 79 |
|
|
//---STATIC ATTRIBUTES--- |
| 80 |
|
|
|
| 81 |
|
|
} |