| 1 | tdb | 1.2 | /* | 
 
 
 
 
 | 2 |  |  | * i-scream central monitoring system | 
 
 
 
 
 | 3 |  |  | * Copyright (C) 2000-2002 i-scream | 
 
 
 
 
 | 4 |  |  | * | 
 
 
 
 
 | 5 |  |  | * This program is free software; you can redistribute it and/or | 
 
 
 
 
 | 6 |  |  | * modify it under the terms of the GNU General Public License | 
 
 
 
 
 | 7 |  |  | * as published by the Free Software Foundation; either version 2 | 
 
 
 
 
 | 8 |  |  | * of the License, or (at your option) any later version. | 
 
 
 
 
 | 9 |  |  | * | 
 
 
 
 
 | 10 |  |  | * This program is distributed in the hope that it will be useful, | 
 
 
 
 
 | 11 |  |  | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 
 
 
 
 | 12 |  |  | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 
 
 
 
 | 13 |  |  | * GNU General Public License for more details. | 
 
 
 
 
 | 14 |  |  | * | 
 
 
 
 
 | 15 |  |  | * You should have received a copy of the GNU General Public License | 
 
 
 
 
 | 16 |  |  | * along with this program; if not, write to the Free Software | 
 
 
 
 
 | 17 |  |  | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. | 
 
 
 
 
 | 18 |  |  | */ | 
 
 
 
 
 | 19 |  |  |  | 
 
 
 
 
 
 
 
 | 20 | pjm2 | 1.1 | //---PACKAGE DECLARATION--- | 
 
 
 
 
 | 21 |  |  |  | 
 
 
 
 
 | 22 |  |  | //---IMPORTS--- | 
 
 
 
 
 | 23 |  |  |  | 
 
 
 
 
 | 24 |  |  | import java.io.*; | 
 
 
 
 
 | 25 |  |  |  | 
 
 
 
 
 | 26 |  |  | /** | 
 
 
 
 
 | 27 |  |  | * JavaClientMain | 
 
 
 
 
 | 28 |  |  | * | 
 
 
 
 
 
 
 
 | 29 | tdb | 1.2 | * @author  $Author: pjm2 $ | 
 
 
 
 
 | 30 |  |  | * @version $Id: JavaClientMain.java,v 1.1 2001/01/14 21:58:11 pjm2 Exp $ | 
 
 
 
 
 
 
 
 | 31 | pjm2 | 1.1 | */ | 
 
 
 
 
 | 32 |  |  | public class JavaClientMain { | 
 
 
 
 
 | 33 |  |  |  | 
 
 
 
 
 | 34 |  |  | //---FINAL ATTRIBUTES--- | 
 
 
 
 
 | 35 |  |  |  | 
 
 
 
 
 | 36 |  |  | /** | 
 
 
 
 
 | 37 |  |  | * The current CVS revision of this class | 
 
 
 
 
 | 38 |  |  | */ | 
 
 
 
 
 
 
 
 | 39 | tdb | 1.2 | public final String REVISION = "$Revision: 1.1 $"; | 
 
 
 
 
 
 
 
 | 40 | pjm2 | 1.1 |  | 
 
 
 
 
 | 41 |  |  | //---STATIC METHODS--- | 
 
 
 
 
 | 42 |  |  |  | 
 
 
 
 
 | 43 |  |  | //---CONSTRUCTORS--- | 
 
 
 
 
 | 44 |  |  |  | 
 
 
 
 
 | 45 |  |  | //---PUBLIC METHODS--- | 
 
 
 
 
 | 46 |  |  |  | 
 
 
 
 
 | 47 |  |  | public static void main(String[] args) { | 
 
 
 
 
 | 48 |  |  |  | 
 
 
 
 
 | 49 |  |  | if (args.length != 2) { | 
 
 
 
 
 | 50 |  |  | System.out.println("Usage: java JavaClientMain servername port"); | 
 
 
 
 
 | 51 |  |  | System.exit(1); | 
 
 
 
 
 | 52 |  |  | } | 
 
 
 
 
 | 53 |  |  |  | 
 
 
 
 
 | 54 |  |  | String serverName = args[0]; | 
 
 
 
 
 | 55 |  |  | int serverPort = 0; | 
 
 
 
 
 | 56 |  |  | try { | 
 
 
 
 
 | 57 |  |  | serverPort = Integer.parseInt(args[1]); | 
 
 
 
 
 | 58 |  |  | } | 
 
 
 
 
 | 59 |  |  | catch (Exception e){ | 
 
 
 
 
 | 60 |  |  | System.out.println("Unrecognised port number"); | 
 
 
 
 
 | 61 |  |  | } | 
 
 
 
 
 | 62 |  |  |  | 
 
 
 
 
 | 63 |  |  | InputStream nothing = null; | 
 
 
 
 
 | 64 |  |  | System.setIn(nothing); | 
 
 
 
 
 | 65 |  |  |  | 
 
 
 
 
 | 66 |  |  | TerminalScreen screen = new TerminalScreen(); | 
 
 
 
 
 | 67 |  |  | screen.clear(); | 
 
 
 
 
 | 68 |  |  | screen.gotoxy(34, 10); | 
 
 
 
 
 | 69 |  |  | screen.print(" i - s c r e a m ", TerminalScreen.BOLD, TerminalScreen.BLACK_BG); | 
 
 
 
 
 | 70 |  |  | screen.gotoxy(27, 12); | 
 
 
 
 
 | 71 |  |  | screen.print("Central Monitoring System Client", TerminalScreen.BLUE); | 
 
 
 
 
 | 72 |  |  | screen.gotoxy(32,13); | 
 
 
 
 
 | 73 |  |  | screen.print("Unix/Linux version 1.0"); | 
 
 
 
 
 | 74 |  |  |  | 
 
 
 
 
 | 75 |  |  | // Show intro screen for 2 seconds. | 
 
 
 
 
 | 76 |  |  | try { | 
 
 
 
 
 | 77 |  |  | Thread.sleep(2000); | 
 
 
 
 
 | 78 |  |  | } | 
 
 
 
 
 | 79 |  |  | catch (InterruptedException e) { | 
 
 
 
 
 | 80 |  |  | // What a carry on. | 
 
 
 
 
 | 81 |  |  | } | 
 
 
 
 
 | 82 |  |  |  | 
 
 
 
 
 | 83 |  |  | screen.clear(); | 
 
 
 
 
 | 84 |  |  |  | 
 
 
 
 
 | 85 |  |  | XMLStreamReaderThread reader = new XMLStreamReaderThread(serverName, serverPort, screen); | 
 
 
 
 
 | 86 |  |  | reader.start(); | 
 
 
 
 
 | 87 |  |  |  | 
 
 
 
 
 | 88 |  |  | // Handle some keypresses and things here. | 
 
 
 
 
 | 89 |  |  |  | 
 
 
 
 
 | 90 |  |  | } | 
 
 
 
 
 | 91 |  |  |  | 
 
 
 
 
 | 92 |  |  | //---PRIVATE METHODS--- | 
 
 
 
 
 | 93 |  |  |  | 
 
 
 
 
 | 94 |  |  | //---ACCESSOR/MUTATOR METHODS--- | 
 
 
 
 
 | 95 |  |  |  | 
 
 
 
 
 | 96 |  |  | //---ATTRIBUTES--- | 
 
 
 
 
 | 97 |  |  |  | 
 
 
 
 
 | 98 |  |  | //---STATIC ATTRIBUTES--- | 
 
 
 
 
 | 99 |  |  |  | 
 
 
 
 
 | 100 |  |  | } |