|
Lines 13-18
Link Here
|
| 13 |
package org.eclipse.tptp.platform.iac.administrator.internal.startstop; |
13 |
package org.eclipse.tptp.platform.iac.administrator.internal.startstop; |
| 14 |
|
14 |
|
| 15 |
import java.io.BufferedReader; |
15 |
import java.io.BufferedReader; |
|
|
16 |
import java.io.File; |
| 16 |
import java.io.IOException; |
17 |
import java.io.IOException; |
| 17 |
import java.io.InputStream; |
18 |
import java.io.InputStream; |
| 18 |
import java.io.InputStreamReader; |
19 |
import java.io.InputStreamReader; |
|
Lines 78-92
Link Here
|
| 78 |
|
79 |
|
| 79 |
/* Do we need to generate IAC's configuration file? */ |
80 |
/* Do we need to generate IAC's configuration file? */ |
| 80 |
if (!AdminUtil.isConfigurationValid()) |
81 |
if (!AdminUtil.isConfigurationValid()) |
|
|
82 |
{ |
| 81 |
AdminUtil.generateConfigFile(); |
83 |
AdminUtil.generateConfigFile(); |
| 82 |
|
84 |
|
| 83 |
/* If configuration is still invalid, return an error */ |
85 |
/* If configuration is still invalid, return an error */ |
| 84 |
if (!AdminUtil.isConfigurationValid()) |
86 |
if (!AdminUtil.isConfigurationValid()) |
| 85 |
{ |
87 |
{ |
| 86 |
Status status = new Status(Status.ERROR, AdminPlugin.PLUGIN_ID, "IAC could not be started due to invalid configuration files."); |
88 |
Status status = new Status(Status.ERROR, AdminPlugin.PLUGIN_ID, "IAC could not be started due to invalid configuration files."); |
| 87 |
AdminPlugin.getDefault().getLog().log(status); |
89 |
AdminPlugin.getDefault().getLog().log(status); |
| 88 |
return 1; |
90 |
return 1; |
| 89 |
} |
91 |
} |
|
|
92 |
} |
| 90 |
|
93 |
|
| 91 |
Runtime rt = Runtime.getRuntime(); |
94 |
Runtime rt = Runtime.getRuntime(); |
| 92 |
String acExecutable = AdminUtil.getIACExecutable(); |
95 |
String acExecutable = AdminUtil.getIACExecutable(); |
|
Lines 95-101
Link Here
|
| 95 |
{ |
98 |
{ |
| 96 |
/* Run the 'RAServer' command. We can't use the CommandExecutor class here because that class |
99 |
/* Run the 'RAServer' command. We can't use the CommandExecutor class here because that class |
| 97 |
* waits until its error/output threads are terminated */ |
100 |
* waits until its error/output threads are terminated */ |
| 98 |
process = rt.exec(acExecutable); |
101 |
process = rt.exec(acExecutable, null, new File(AdminUtil.getIACBinFolder())); |
| 99 |
|
102 |
|
| 100 |
new AutoStartStop().new ProcessOutputReader(process.getErrorStream(), "Error Stream").start(); |
103 |
new AutoStartStop().new ProcessOutputReader(process.getErrorStream(), "Error Stream").start(); |
| 101 |
new AutoStartStop().new ProcessOutputReader(process.getInputStream(), "Output Stream").start(); |
104 |
new AutoStartStop().new ProcessOutputReader(process.getInputStream(), "Output Stream").start(); |
|
Lines 181-191
Link Here
|
| 181 |
|
184 |
|
| 182 |
/* Use the 'RAServer -shutdown' command to forcibly kill IAC */ |
185 |
/* Use the 'RAServer -shutdown' command to forcibly kill IAC */ |
| 183 |
CommandExecutor commandExecutor = new CommandExecutor(); |
186 |
CommandExecutor commandExecutor = new CommandExecutor(); |
| 184 |
String command = AdminUtil.getIACExecutable() + " -shutdown"; |
187 |
String command = AdminUtil.getShutdownCommand(); |
| 185 |
StringBuffer stdOut = new StringBuffer(); |
188 |
StringBuffer stdOut = new StringBuffer(); |
| 186 |
StringBuffer stdErr = new StringBuffer(); |
189 |
StringBuffer stdErr = new StringBuffer(); |
| 187 |
|
190 |
|
| 188 |
commandExecutor.executeCommand(command, null, null, stdOut, stdErr); |
191 |
commandExecutor.executeCommand(command, null, AdminUtil.getIACBinFolder(), stdOut, stdErr); |
| 189 |
|
192 |
|
| 190 |
if (stdErr.length() != 0) |
193 |
if (stdErr.length() != 0) |
| 191 |
{ |
194 |
{ |
|
Lines 295-303
Link Here
|
| 295 |
try { |
298 |
try { |
| 296 |
|
299 |
|
| 297 |
while ((line = reader.readLine()) != null){ |
300 |
while ((line = reader.readLine()) != null){ |
| 298 |
line = line.trim() + CommonConstants.LINE_SEPARATOR; |
301 |
if ((line.indexOf("started successfully") == -1) && (line.indexOf("Starting Agent Controller") == -1) && (line.indexOf("ACServer stopped") == -1) && (line.indexOf("Shutting down the Agent Controller") == -1)) |
| 299 |
Status status = new Status(Status.ERROR, AdminPlugin.PLUGIN_ID, "[startIAC: " + streamName + "] RAServer generated the following output: " + line); |
302 |
{ |
| 300 |
AdminPlugin.getDefault().getLog().log(status); |
303 |
line = line.trim() + CommonConstants.LINE_SEPARATOR; |
|
|
304 |
Status status = new Status(Status.ERROR, AdminPlugin.PLUGIN_ID, "[startIAC: " + streamName + "] RAServer generated the following output: " + line); |
| 305 |
AdminPlugin.getDefault().getLog().log(status); |
| 306 |
} |
| 301 |
} |
307 |
} |
| 302 |
} |
308 |
} |
| 303 |
catch (IOException e) { |
309 |
catch (IOException e) { |