/* Author: Julie Romm * Course: COM3336 * Professor: Karl Lieberherr * Homework 3, part 2 */ /* File: WebWatch.java * Classes implemented: WebWatch * * Purpose: * This class implements main method of the program. * For each line that is read from the input file, * it starts its own processing thread (instance of * URLCycle class). * All the program's constants are defined in this class. * */ import java.io.*; import java.util.*; public class WebWatch { final static String usage = "\nusage: java WebWatch filename\n" + "filename is a text file containing URLs to be watched,\n" + "one URL per line."; public final static int INTERVAL = 120000; //2 minutes public final static String MAILSERVER = "mail.ccs.neu.edu"; public final static String RECIPIENT = "flan@ccs.neu.edu"; public final static String SENDER = "jromm@ccs.neu.edu"; private static BufferedReader inputFile; public static void main(String argv[]) throws Exception { if (argv.length != 1) throw new Exception(usage); try { inputFile = new BufferedReader(new FileReader(argv[0]));} catch (FileNotFoundException e) { System.err.println(e); System.exit(1); } String line; while ((line = inputFile.readLine()) != null) { //System.out.println(line); URLCycle urlc = new URLCycle(line); urlc.start(); } }//main }//WebWatch