1 36 package org.ungoverned.oscar; 37 38 import java.io.BufferedReader ; 39 import java.io.IOException ; 40 import java.io.InputStreamReader ; 41 42 import org.ungoverned.oscar.util.DefaultBundleCache; 43 44 public class Main 45 { 46 private static Oscar m_oscar = null; 47 48 public static void main(String [] argv) throws Exception 49 { 50 Oscar.initializeSystemProperties(); 52 53 String profileName = System.getProperty(DefaultBundleCache.CACHE_PROFILE_PROP); 55 56 String profileDirName = System.getProperty(DefaultBundleCache.CACHE_PROFILE_DIR_PROP); 58 59 System.out.println("\nWelcome to Oscar."); 61 System.out.println("=================\n"); 62 63 if ((profileName == null) && (profileDirName == null)) 66 { 67 System.out.print("Enter profile name: "); 68 BufferedReader in = new BufferedReader (new InputStreamReader (System.in)); 69 try 70 { 71 profileName = in.readLine(); 72 } 73 catch (IOException ex) 74 { 75 System.err.println("Could not read input."); 76 System.exit(-1); 77 } 78 System.out.println(""); 79 if (profileName.length() != 0) 80 { 81 System.setProperty(DefaultBundleCache.CACHE_PROFILE_PROP, profileName); 82 } 83 } 84 85 if ((profileDirName == null) && (profileName.length() == 0)) 87 { 88 System.err.println("You must specify a profile name or directory."); 89 System.exit(-1); 90 } 91 92 try 93 { 94 m_oscar = new Oscar(); 96 } 97 catch (Exception ex) 98 { 99 System.err.println("Could not create Oscar: " + ex); 100 ex.printStackTrace(); 101 System.exit(-1); 102 } 103 } 104 } | Popular Tags |