Subversion Repositories XServices

Rev

Rev 6 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6 Rev 12
Line 153... Line 153...
153
            boolean vmlauncher,
153
            boolean vmlauncher,
154
            boolean searchpath,
154
            boolean searchpath,
155
            long timeout) {
155
            long timeout) {
156
        ExecTask exe = new ExecTask();
156
        ExecTask exe = new ExecTask();
157
        RunTask runner = new RunTask(exe);
157
        RunTask runner = new RunTask(exe);
-
 
158
 
-
 
159
        /*
158
        Commandline cmdl = new Commandline();
160
        Commandline cmdl = new Commandline();
159
        cmdl.setExecutable(executable);
161
        cmdl.setExecutable(executable);
160
        cmdl.addArguments(args);
162
        cmdl.addArguments(args);
161
        System.out.println(cmdl.describeCommand());
163
        System.out.println(cmdl.describeCommand());
-
 
164
        */
-
 
165
        
162
        exe.setCommand(cmdl);
166
        exe.setExecutable(executable);
-
 
167
        for (String s : args) {
-
 
168
        exe.createArg().setValue(s);
-
 
169
        }
-
 
170
 
163
        exe.setDir(dir);
171
        exe.setDir(dir);
164
        if (spawn) {
172
        if (spawn) {
165
            exe.setSpawn(spawn);
173
            exe.setSpawn(spawn);
166
        } else {
174
        } else {
167
            exe.setTimeout(timeout);
175
            exe.setTimeout(timeout);
Line 173... Line 181...
173
 
181
 
174
        exe.setNewenvironment(newenvironment);
182
        exe.setNewenvironment(newenvironment);
175
        exe.setVMLauncher(vmlauncher);
183
        exe.setVMLauncher(vmlauncher);
Line 176... Line -...
176
        exe.setSearchPath(searchpath);
-
 
177
 
-
 
178
        Map<String, String> result = runner.postTask();
-
 
179
        ReturnCode res = null;
-
 
180
        if (spawn) {
-
 
181
            res = new ReturnCode(0, null, null);
-
 
182
        } else {
-
 
183
            res = new ReturnCode(Integer.valueOf(result.get("ExecuteService.result")),
-
 
184
                    result.get("ExecuteService.stdout"), result.get("ExecuteService.stderr"));
184
        exe.setSearchPath(searchpath);
185
        }
185
 
Line 186... Line 186...
186
        return res;
186
        return runner.postTask();
187
    }
187
    }
188
 
188
 
Line 201... Line 201...
201
        sshexec.setPort(port);
201
        sshexec.setPort(port);
202
        sshexec.setCommand(command);
202
        sshexec.setCommand(command);
203
        sshexec.setTrust(true);
203
        sshexec.setTrust(true);
204
        sshexec.setTimeout(timeout);
204
        sshexec.setTimeout(timeout);
205
        sshexec.setOutputproperty("SSHExec.stdout");
205
        sshexec.setOutputproperty("SSHExec.stdout");
206
        Map<String, String> result = runner.postTask();
-
 
207
        ReturnCode res = null;
-
 
208
        res = new ReturnCode(0,
-
 
209
                result.get("SSHExec.stdout"), "");
-
 
210
 
-
 
211
        return res;
206
        return runner.postTask();
212
    }
207
    }
Line 213... Line 208...
213
 
208
 
214
    @WebMethod(exclude = true)
209
    @WebMethod(exclude = true)
215
    private ReturnCode sshExecWithCert(String host,
210
    private ReturnCode sshExecWithCert(String host,
Line 228... Line 223...
228
        sshexec.setPort(port);
223
        sshexec.setPort(port);
229
        sshexec.setCommand(command);
224
        sshexec.setCommand(command);
230
        sshexec.setTrust(true);
225
        sshexec.setTrust(true);
231
        sshexec.setTimeout(timeout);
226
        sshexec.setTimeout(timeout);
232
        sshexec.setOutputproperty("SSHExec.stdout");
227
        sshexec.setOutputproperty("SSHExec.stdout");
233
        Map<String, String> result = runner.postTask();
-
 
234
        ReturnCode res = null;
-
 
235
        res = new ReturnCode(0,
-
 
236
                result.get("SSHExec.stdout"), "");
-
 
237
 
-
 
238
        return res;
228
        return runner.postTask();
239
    }
229
    }
Line 240... Line 230...
240
 
230
 
241
    @WebMethod(exclude = true)
231
    @WebMethod(exclude = true)
242
    private ReturnCode rexec(String host,
232
    private ReturnCode rexec(String host,
Line 252... Line 242...
252
        rexec.setUserid(username);
242
        rexec.setUserid(username);
253
        rexec.setPassword(password);
243
        rexec.setPassword(password);
254
        rexec.setCommand(command);
244
        rexec.setCommand(command);
255
        rexec.setTimeout((int) Math.round(timeout));
245
        rexec.setTimeout((int) Math.round(timeout));
Line 256... Line -...
256
 
-
 
257
        Map<String, String> result = runner.postTask();
-
 
258
        ReturnCode res = null;
-
 
259
        res = new ReturnCode(0,
-
 
260
                "", "");
-
 
261
 
246
 
262
        return res;
247
        return runner.postTask();
Line 263... Line 248...
263
    }
248
    }
264
 
249
 
265
    @WebMethod(exclude = true)
250
    @WebMethod(exclude = true)
Line 279... Line 264...
279
        
264
        
280
        rexec.createRead().addText(prompt);
265
        rexec.createRead().addText(prompt);
281
        rexec.createWrite().addText(command);
266
        rexec.createWrite().addText(command);
Line 282... Line -...
282
        rexec.createRead().addText(expect);
-
 
283
 
-
 
284
        Map<String, String> result = runner.postTask();
-
 
285
        ReturnCode res = null;
-
 
286
        res = new ReturnCode(0,
267
        rexec.createRead().addText(expect);
287
                "", "");
268
 
288
        return res;
269
        return runner.postTask();