View Javadoc
1 2 /* 3 LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus. 4 5 6 Copyright (C) 2003 Together 7 8 This library is free software; you can redistribute it and/or 9 modify it under the terms of the GNU Lesser General Public 10 License as published by the Free Software Foundation; either 11 version 2.1 of the License, or (at your option) any later version. 12 13 This library is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 Lesser General Public License for more details. 17 18 You should have received a copy of the GNU Lesser General Public 19 License along with this library; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 22 23 package org.webdocwf.util.loader.wizard; 24 25 import java.io.*; 26 27 /*** 28 * 29 * OctopusGenerator class sets the input parameters and start the process (LoaderGenerator) 30 * @author Radoslav Dutina 31 * @version 1.0 32 */ 33 public class OctopusGenerator { 34 protected WizardFrame wizard = null; 35 private OctopusGeneratorData initData; 36 37 /*** 38 * Construct the object of OctopusGenerator class with associated parameter 39 * @param initData is object of LoaderGeneratorEntry which contain input parameters 40 */ 41 public OctopusGenerator(OctopusGeneratorData initData) { 42 this.initData=initData; 43 } 44 45 /*** 46 * This method start the process (LoaderGenerator) 47 * @return process 48 * @throws Exception 49 */ 50 public String[] generateAll() throws Exception { 51 int exit = 0; 52 Process process = null; 53 String tmp[] = new String[55]; 54 String as[]=null; 55 try { 56 ErrorReader errorReader; 57 58 BufferedReader buffer; 59 BufferedReader error; 60 String s; 61 int param = 0; 62 if (!initData.getAdditionalPaths().equalsIgnoreCase("")) { 63 AddClassPath.setClassPathString(initData.getAdditionalPaths()); 64 } 65 if (!initData.getValueMode().equalsIgnoreCase("")) { 66 tmp[param] = "-m"; 67 param++; 68 tmp[param] = initData.getValueMode(); 69 param++; 70 } 71 if (!initData.getGeneratorOutput().equalsIgnoreCase("")) { 72 tmp[param] = "-o"; 73 param++; 74 tmp[param] = initData.getGeneratorOutput(); 75 param++; 76 } 77 if (!initData.getSourceDatabase().equalsIgnoreCase("")) { 78 tmp[param] = "-sdb"; 79 param++; 80 tmp[param] = initData.getSourceDatabase(); 81 param++; 82 } 83 if (!initData.getSourceType().equalsIgnoreCase("")) { 84 tmp[param] = "-st"; 85 param++; 86 tmp[param] = initData.getSourceType(); 87 param++; 88 } 89 if (!initData.getSourceUser().equalsIgnoreCase("")) { 90 tmp[param] = "-su"; 91 param++; 92 tmp[param] = initData.getSourceUser(); 93 param++; 94 } 95 if (!initData.getSourcePassword().equalsIgnoreCase("")) { 96 tmp[param] = "-sp"; 97 param++; 98 tmp[param] = initData.getSourcePassword(); 99 param++; 100 } 101 if (!initData.getTargetDatabase().equalsIgnoreCase("")) { 102 tmp[param] = "-tdb"; 103 param++; 104 tmp[param] = initData.getTargetDatabase(); 105 param++; 106 } 107 if (!initData.getTargetType().equalsIgnoreCase("")) { 108 tmp[param] = "-tt"; 109 param++; 110 tmp[param] = initData.getTargetType(); 111 param++; 112 } 113 if (!initData.getTargetUser().equalsIgnoreCase("")) { 114 tmp[param] = "-tu"; 115 param++; 116 tmp[param] = initData.getTargetUser(); 117 param++; 118 } 119 if (!initData.getTargetPassword().equalsIgnoreCase("")) { 120 tmp[param] = "-tp"; 121 param++; 122 tmp[param] = initData.getTargetPassword(); 123 param++; 124 } 125 if (!initData.getDomlPath().equalsIgnoreCase("")) { 126 tmp[param] = "-doml"; 127 param++; 128 tmp[param] = initData.getDomlPath(); 129 param++; 130 } 131 if (!initData.getPackageName().equalsIgnoreCase("")) { 132 tmp[param] = "-pack"; 133 param++; 134 tmp[param] = initData.getPackageName(); 135 param++; 136 } 137 if (!initData.getSourceDriverName().equalsIgnoreCase("")) { 138 tmp[param] = "-sdn"; 139 param++; 140 tmp[param] = initData.getSourceDriverName(); 141 param++; 142 } 143 if (!initData.getTargetDriverName().equalsIgnoreCase("")) { 144 tmp[param] = "-tdn"; 145 param++; 146 tmp[param] = initData.getTargetDriverName(); 147 param++; 148 } 149 if (initData.getXmlGenerate().equalsIgnoreCase("true")) { 150 tmp[param] = "-xml"; 151 param++; 152 tmp[param] = initData.getXmlGenerate(); 153 param++; 154 } 155 if (initData.getDomlGenerate().equalsIgnoreCase("true")) { 156 tmp[param] = "-gdoml"; 157 param++; 158 tmp[param] = initData.getDomlGenerate(); 159 param++; 160 } 161 if (initData.getSqlStmtDropTable().equalsIgnoreCase("true")) { 162 tmp[param] = "-sqlDT"; 163 param++; 164 tmp[param] = initData.getSqlStmtDropTable(); 165 param++; 166 } 167 if (initData.getSqlStmtDropIntegrity().equalsIgnoreCase("true")) { 168 tmp[param] = "-sqlDI"; 169 param++; 170 tmp[param] = initData.getSqlStmtDropIntegrity(); 171 param++; 172 } 173 174 if (initData.getSqlStmtCreateTable().equalsIgnoreCase("true")) { 175 tmp[param] = "-sqlCT"; 176 param++; 177 tmp[param] = initData.getSqlStmtCreateTable(); 178 param++; 179 } 180 if (initData.getSqlStmtCreatePK().equalsIgnoreCase("true")) { 181 tmp[param] = "-sqlCPK"; 182 param++; 183 tmp[param] = initData.getSqlStmtCreatePK(); 184 param++; 185 } 186 if (initData.getSqlStmtCreateFK().equalsIgnoreCase("true")) { 187 tmp[param] = "-sqlCFK"; 188 param++; 189 tmp[param] = initData.getSqlStmtCreateFK(); 190 param++; 191 } 192 if (initData.getSqlStmtCreateIndex().equalsIgnoreCase("true")) { 193 tmp[param] = "-sqlCI"; 194 param++; 195 tmp[param] = initData.getSqlStmtCreateIndex(); 196 param++; 197 } 198 if (initData.getSqlStmtForAllVendors().equalsIgnoreCase("true")) { 199 tmp[param] = "-sqlAll"; 200 param++; 201 tmp[param] = initData.getSqlStmtForAllVendors(); 202 param++; 203 } 204 if (initData.getFullMode().equalsIgnoreCase("true")) { 205 tmp[param] = "-fm"; 206 param++; 207 tmp[param] = initData.getFullMode(); 208 param++; 209 }else{ 210 tmp[param] = "-fm"; 211 param++; 212 tmp[param] = initData.getFullMode(); 213 param++; 214 } 215 if (!initData.getIncludeTableList().equalsIgnoreCase("")) { 216 tmp[param] = "-it"; 217 param++; 218 tmp[param] = initData.getIncludeTableList(); 219 param++; 220 } 221 if (!initData.getConfJarStructure().equalsIgnoreCase("")) { 222 tmp[param] = "-cjs"; 223 param++; 224 tmp[param] = initData.getConfJarStructure(); 225 param++; 226 227 } 228 if (!initData.getLogMode().equalsIgnoreCase("")) { 229 tmp[param] = "-lm"; 230 param++; 231 tmp[param] = initData.getLogMode(); 232 param++; 233 234 } 235 if (!initData.getLogFileDir().equalsIgnoreCase("")) { 236 tmp[param] = "-l"; 237 param++; 238 tmp[param] = initData.getLogFileDir(); 239 param++; 240 241 } 242 if (!initData.getLogFileName().equalsIgnoreCase("")) { 243 tmp[param] = "-f"; 244 param++; 245 tmp[param] = initData.getLogFileName(); 246 param++; 247 248 } 249 250 251 252 as=new String[param]; 253 for (int i=0;i<param;i++){ 254 if(!tmp[i].equalsIgnoreCase("null")) 255 as[i] = tmp[i]; 256 } 257 } catch (Exception e) { 258 e.printStackTrace(); 259 System.out.println(e.getMessage()); 260 throw new Exception(e.getMessage()); 261 262 } 263 return as; 264 } 265 266 }

This page was automatically generated by Maven