1 /*
2 LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
3
4
5 Copyright (C) 2003 Together
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22
23 package org.webdocwf.util.loader.wizard;
24
25 import java.io.*;
26
27 /***
28 * Octopus class sets the input parameters and start the process (Loader)
29 * @author Radoslav Dutina
30 * @version 1.0
31 */
32 public class OctopusLoader {
33 protected WizardFrame wizard = null;
34 private OctopusLoaderData initData;
35
36 /***
37 * Construct the object of Octopus class with associated parameter
38 * @param initData is object of LoaderOctopusEntry which contain input parameters
39 */
40 public OctopusLoader(OctopusLoaderData initData) {
41 this.initData=initData;
42 }
43
44 /***
45 * This method start the process (Loaderp)
46 * @return process
47 * @throws java.lang.Exception
48 */
49 public String[] generateAll() throws Exception {
50 int exit = 0;
51 Process process = null;
52 String tmp[] = new String[27];
53 String as[]=null;
54 try{
55 ErrorReader errorReader;
56 BufferedReader buffer;
57 BufferedReader error;
58 String s;
59 int param = 0;
60
61 if (!initData.getLogMode().equalsIgnoreCase("")) {
62 tmp[param] = "-m";
63 param++;
64 tmp[param] = initData.getLogMode();
65 param++;
66 }
67 if (!initData.getLogFileDir().equalsIgnoreCase("")) {
68 tmp[param] = "-l";
69 param++;
70 tmp[param] = initData.getLogFileDir();
71 param++;
72 }
73 if (!initData.getLogFileName().equalsIgnoreCase("")) {
74 tmp[param] = "-f";
75 param++;
76 tmp[param] = initData.getLogFileName();
77 param++;
78 }
79 if (!initData.getRestartIndicator().equalsIgnoreCase("")) {
80 tmp[param] = "-r";
81 param++;
82 tmp[param] = initData.getRestartIndicator();
83 param++;
84 }
85 if (!initData.getUserId().equalsIgnoreCase("")) {
86 tmp[param] = "-u";
87 param++;
88 tmp[param] = initData.getUserId();
89 param++;
90 }
91
92 if (!initData.getVariables().equalsIgnoreCase("")) {
93 tmp[param] = "-v";
94 param++;
95 tmp[param] = initData.getVariables();
96 param++;
97 }
98 if (!initData.getVendorConf().equalsIgnoreCase("")) {
99 tmp[param] = "-d";
100 param++;
101 tmp[param] = initData.getVendorConf();
102 param++;
103 }
104 if (!initData.getOnErrorCon().equalsIgnoreCase("")) {
105 tmp[param] = "-e";
106 param++;
107 tmp[param] = initData.getOnErrorCon();
108 param++;
109 }
110
111 if (!initData.getAdditionalPaths().equalsIgnoreCase("")) {
112 tmp[param] = "-p";
113 param++;
114 tmp[param] = initData.getAdditionalPaths();
115 param++;
116 }
117
118 if (!initData.getCommitCount().equalsIgnoreCase("")) {
119 tmp[param] = "-c";
120 param++;
121 tmp[param] = initData.getCommitCount();
122 param++;
123 }
124 if (!initData.getReturnCode().equalsIgnoreCase("")) {
125 tmp[param] = "-rc";
126 param++;
127 tmp[param] = initData.getReturnCode();
128 param++;
129 }
130 if (!initData.getIncludeTables().equalsIgnoreCase("")) {
131 tmp[param] = "-it";
132 param++;
133 tmp[param] = initData.getIncludeTables();
134 param++;
135 }
136 if (!initData.getConfJarStructure().equalsIgnoreCase("")) {
137 tmp[param] = "-cjs";
138 param++;
139 tmp[param] = initData.getConfJarStructure();
140 param++;
141 }
142 if (!initData.getPathToXml().equalsIgnoreCase("")) {
143 tmp[param] = " ";
144 param++;
145 tmp[param] = initData.getPathToXml();
146 param++;
147 }
148
149
150 as=new String[param];
151 for (int i=0;i<param;i++){
152 if(!tmp[i].equalsIgnoreCase("null"))
153 as[i] = tmp[i];
154 }
155 } catch (Exception e) {
156 e.printStackTrace();
157 System.out.println(e.getMessage());
158 throw new Exception(e.getMessage());
159 }
160 return as;
161 }
162
163 }
This page was automatically generated by Maven