001package ca.bc.webarts.tools; 002import java.io.File; 003import java.io.FileOutputStream; 004import java.io.IOException; 005 006import java.util.Properties; 007 008/** 009 * Description of the Class 010 * 011 * @author unknown 012 * @created June 7, 2001 013 */ 014class TimedAppAdmin 015{ 016 /** 017 * Description of the Field 018 * 019 * @since 020 */ 021 static String propertiesFileName_ = File.separator + "timedApp1.prop"; 022 023 /** 024 * The Properties file that will be produced. 025 * 026 * @since 027 */ 028 static File outFile_ = null; 029 030 /** 031 * The output string that is presented to the user if invalid usage syntax. 032 * 033 * @since 034 */ 035 static String usage_ = "TimedAppAdmin Usage:\n" + 036 "--------------------\n" + 037 "java ca.bc.webarts.widgets.TimedAppAdmin " + 038 "{Properties Filename} {Start Time} {Application Name} " + 039 "{Repeat Interval sec.} {# Repeat Times} " + 040 "{Fully Qualified app path}\n"; 041 042 043 /** 044 * Constructor for the TimedAppAdmin object. 045 * 046 * @since 047 */ 048 public TimedAppAdmin() 049 { 050 } 051 052 053 /** 054 * The main program for the TimedAppAdmin class. 055 * 056 * @param args The command line arguments 057 * @since 058 */ 059 public static void main(String[] args) 060 { 061 if (args.length == 5) 062 { 063 propertiesFileName_ = args[0]; 064 outFile_ = new File(propertiesFileName_); 065 String appName = args[1]; 066 String startTime = args[2]; 067 String appInterval = args[3]; 068 String appRepeatTime = args[4]; 069 String appPath = args[5]; 070 Properties p = new Properties(); 071 p.setProperty("Name", appName); 072 p.setProperty("Start Time", startTime); 073 p.setProperty("Repeat Interval", appInterval); 074 p.setProperty("Repeat Time", appRepeatTime); 075 p.setProperty("Application Path", appPath); 076 077 try 078 { 079 System.out.println("Writing Properties file: " + propertiesFileName_); 080 p.store(new FileOutputStream(outFile_), 081 "Timed Application Property File."); 082 } 083 catch (IOException ex) 084 { 085 System.out.println("IO Exception" + ex.getMessage()); 086 } 087 } 088 else 089 { 090 System.out.println(usage_); 091 } 092 } 093} 094 095