1 18 package org.apache.geronimo.interop.generator; 19 20 import org.apache.geronimo.interop.rmi.iiop.compiler.StubCompiler; 21 22 import java.util.List ; 23 import java.util.LinkedList ; 24 import java.util.Iterator ; 25 26 public class GenOptions { 27 38 private String genSrcDir = "./src"; 39 private String genClassDir = "./classes"; 40 private boolean overwrite = false; 41 private boolean verbose = false; 42 private boolean simpleidl = false; 43 private String classpath = ""; 44 private boolean generate = true; 45 private boolean compile = false; 46 private boolean compileDebug = false; 47 private boolean loadclass = false; 48 49 private List interfaces = new LinkedList (); 50 51 public GenOptions( String defaultSrcDir, String args[] ) 52 throws GenWarning, GenException { 53 genSrcDir = defaultSrcDir; 54 parseOptions( args ); 55 } 56 57 public String getGenSrcDir() { 58 return genSrcDir; 59 } 60 61 public String getGenClassDir() { 62 return genClassDir; 63 } 64 65 public boolean isOverwrite() { 66 return overwrite; 67 } 68 69 public boolean isVerbose() { 70 return verbose; 71 } 72 73 public boolean isSimpleIdl() { 74 return simpleidl; 75 } 76 77 public String getClasspath() { 78 return classpath; 79 } 80 81 public boolean isGenerate() { 82 return generate; 83 } 84 85 public boolean isCompile() { 86 return compile; 87 } 88 89 public boolean isCompileDebug() { 90 return compileDebug; 91 } 92 93 public boolean isLoadclass() { 94 return loadclass; 95 } 96 97 public List getInterfaces() { 98 return interfaces; 99 } 100 101 protected void parseOptions(String args[]) throws GenException, GenWarning { 102 GenWarning genWarning = null; 103 104 for (int i = 0; i < args.length; i++) { 105 if (args[i].equals("-g")) { 106 generate = true; 107 } else if (args[i].equals("-c")) { 108 compile = true; 109 } else if (args[i].equals("-cd")) { 110 compileDebug = true; 111 } else if (args[i].equals("-l")) { 112 loadclass = true; 113 } else if (args[i].equals("-s")) { 114 simpleidl = true; 115 } else if (args[i].equals("-gs")) { 116 if ((i + 1) < args.length) { 117 genSrcDir = args[++i]; 118 } else { 119 throw new GenException( "-gs requires an source output diretory." ); 120 } 121 } else if (args[i].equals("-cp")) { 122 if ((i + 1) < args.length) { 123 classpath = args[++i]; 124 } else { 125 throw new GenException( "-cp requires a classpath directory." ); 126 } 127 } else if (args[i].equals("-gc")) { 128 if ((i + 1) < args.length) { 129 genClassDir = args[++i]; 130 } else { 131 throw new GenException( "-gc requires an class output diretory." ); 132 } 133 } else if (args[i].equals("-v")) { 134 verbose = true; 135 } else if (args[i].equals("-o")) { 136 overwrite = true; 137 } else if (args[i].startsWith("-")) { 138 String msg = "Ignoring unrecognized options: '" + args[i] + "'"; 139 if (genWarning != null) { 140 genWarning = new GenWarning( msg, genWarning); 142 } else { 143 genWarning = new GenWarning( msg ); 144 } 145 } else { 146 interfaces.add(args[i]); 147 } 148 } 149 } 150 } 151 | Popular Tags |