1 26 27 package org.objectweb.openccm.corba.idl2java; 28 29 import java.util.List ; 31 import java.util.Map ; 32 import java.util.NoSuchElementException ; 33 import java.util.StringTokenizer ; 34 35 42 public abstract class IdlToJavaApplication 43 extends IdlToJavaApplicationBase 44 { 45 51 52 protected String input_file_; 53 54 55 protected String dest_dir_; 56 57 58 protected List includes_; 59 60 61 protected Map package_mappings_; 62 63 69 72 public 73 IdlToJavaApplication() 74 { 75 super(); 77 78 input_file_ = null; 80 dest_dir_ = null; 81 includes_ = new java.util.ArrayList (); 82 package_mappings_ = new java.util.HashMap (); 83 } 84 85 91 97 103 108 public void 109 setInputFile(String file) 110 { 111 input_file_ = file; 112 } 113 114 119 public String 120 getInputFile() 121 { 122 return input_file_; 123 } 124 125 130 public void 131 setDestinationDirectory(String destdir) 132 { 133 dest_dir_ = destdir; 134 } 135 136 141 public String 142 getDestinationDirectory() 143 { 144 return dest_dir_; 145 } 146 147 153 public void 154 addIncludeDirectory(String directory) 155 { 156 includes_.add(directory); 157 } 158 159 165 public String [] 166 getIncludeDirectories() 167 { 168 return (String []) includes_.toArray(new String [0]); 169 } 170 171 177 public void 178 addPackageMapping(String idl_package, String java_package) 179 { 180 package_mappings_.put(idl_package, java_package); 181 } 182 183 188 public Map 189 getPackageMappings() 190 { 191 return package_mappings_; 192 } 193 194 200 205 public void 206 parse_cmdline(String [] args) 207 { 208 String [] mappings = null; 209 StringTokenizer st = null; 210 211 dest_dir_ = destdir_opt_.getArgument(); 212 input_file_ = args[0]; 213 214 mappings = i2jpackage_opt_.getOptionValues(); 215 for (int i=0; i<mappings.length; i++) 216 { 217 st = new StringTokenizer (mappings[i], ":"); 218 try 219 { 220 addPackageMapping(st.nextToken(), st.nextToken()); 221 } catch (NoSuchElementException ex) { 222 getConsole().error("Warning : No mapping defined for " + mappings[i]); 223 } 224 } 225 } 226 } 227 | Popular Tags |