Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 186162 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/tptp/platform/iac/administrator/internal/startstop/AutoStartStop.java (-14 / +20 lines)
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))
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) {
(-)src/org/eclipse/tptp/platform/iac/administrator/internal/preference/VMChangeListener.java (-1 / +1 lines)
Lines 44-50 Link Here
44
			/* Indicates whether it's necessary to restart IAC */
44
			/* Indicates whether it's necessary to restart IAC */
45
			boolean restartIAC = false;
45
			boolean restartIAC = false;
46
			
46
			
47
			if (AutoStartStop.isIACRunning())
47
			if (AutoStartStop.getIACStarted())
48
			{	
48
			{	
49
				/* Confirm whether the user wants to restart IAC */
49
				/* Confirm whether the user wants to restart IAC */
50
				final Display currentDisplay = adminPlugin.getWorkbench().getDisplay();
50
				final Display currentDisplay = adminPlugin.getWorkbench().getDisplay();
(-)src/org/eclipse/tptp/platform/iac/administrator/internal/common/AdminUtil.java (-7 / +55 lines)
Lines 445-464 Link Here
445
	}
445
	}
446
	
446
	
447
	/**
447
	/**
448
	 * @return Absolute location of IAC's executable (i.e. RAServer.exe)
448
	 * @return Absolute location of IAC's executable (e.g. RAServer.exe).  Null if IAC executable can't be resolved
449
	 */
449
	 */
450
	public static String getIACExecutable()
450
	public static String getIACExecutable()
451
	{
451
	{
452
		// TODO: Not sure if RAServer on Linux will work. Might have to pass in RAStart.sh
452
		String iacExecutable = getIACBinFolder();
453
		String iacHome = getIACHome();
453
		if (iacExecutable == null)
454
		if (iacHome == null)
454
			return iacExecutable;
455
			return iacHome;
455
		
456
		if (CommonConstants.OPERATING_SYSTEM.indexOf("linux") != -1)
457
			iacExecutable = iacExecutable + CommonConstants.FILE_SEPARATOR + "ACStart.sh";
458
		else if (CommonConstants.OPERATING_SYSTEM.indexOf("windows") != -1)
459
			iacExecutable = iacExecutable + CommonConstants.FILE_SEPARATOR + "ACServer";
460
		else
461
		{
462
			Status status = new Status(Status.ERROR, AdminPlugin.PLUGIN_ID, "Unrecognizable operating system " + CommonConstants.OPERATING_SYSTEM);
463
			AdminPlugin.getDefault().getLog().log(status);
464
			iacExecutable = null;
465
		}
466
		
456
		
467
		
457
		String iacExecutable = iacHome + CommonConstants.FILE_SEPARATOR + "bin" + CommonConstants.FILE_SEPARATOR + "RAServer";
458
		return iacExecutable;
468
		return iacExecutable;
459
	}
469
	}
460
	
470
	
461
	/**
471
	/**
472
	 * @return  The shutdown command that should be used to terminate IAC
473
	 */
474
	public static String getShutdownCommand()
475
	{
476
		String command = getIACBinFolder();
477
		if (command == null)
478
			return command;
479
		
480
		if (CommonConstants.OPERATING_SYSTEM.indexOf("linux") != -1)
481
			command = command + CommonConstants.FILE_SEPARATOR + "ACStop.sh";
482
		else if (CommonConstants.OPERATING_SYSTEM.indexOf("windows") != -1)
483
			command = command + CommonConstants.FILE_SEPARATOR + "ACServer -shutdown";
484
		else
485
		{
486
			Status status = new Status(Status.ERROR, AdminPlugin.PLUGIN_ID, "Unrecognizable operating system " + CommonConstants.OPERATING_SYSTEM);
487
			AdminPlugin.getDefault().getLog().log(status);
488
			command = null;
489
		}
490
		
491
		return command;
492
		
493
	}
494
	
495
	/**
462
	 * @return Absolute location of IAC's config file
496
	 * @return Absolute location of IAC's config file
463
	 */
497
	 */
464
	public static String getIACConfigFile()
498
	public static String getIACConfigFile()
Lines 572-578 Link Here
572
	}
606
	}
573
	
607
	
574
	/**
608
	/**
575
	 * @return  True iff the main config file as well as the config file of the execution framework are valid; false otherwise
609
	 * This function checks to see whether the main config file and the config file for the execution framework are valid.
610
	 * It also checks to see whether the Workbench JVM matches the JVM specified in IAC's config file.  This is done to make
611
	 * sure that IAC's config file is never in an invalid state.
612
	 * 
613
	 * @return  True iff the main config file and the config file for the execution framework are valid AND 
614
	 *          workbench JVM matches the JVM specified in IAC's config file; false otherwise
576
	 */
615
	 */
577
	public static boolean isConfigurationValid()
616
	public static boolean isConfigurationValid()
578
	{
617
	{
Lines 597-604 Link Here
597
		{
636
		{
598
			Status status = new Status(Status.WARNING, AdminPlugin.PLUGIN_ID, "Execution framework config file is invalid");
637
			Status status = new Status(Status.WARNING, AdminPlugin.PLUGIN_ID, "Execution framework config file is invalid");
599
        	AdminPlugin.getDefault().getLog().log(status);
638
        	AdminPlugin.getDefault().getLog().log(status);
639
        	return false;
600
		}
640
		}
601
		
641
		
642
		/* Now see if worbench JVM matches the JVM in IAC's config file */
643
		Document document = AdminUtil.parseFile(getIACConfigFile(), false);
644
		String iacJVM = AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "JAVA_PATH", "value");
645
		String workbenchJVM = getJVMExecutable();
646
		
647
		if (!iacJVM.equals(workbenchJVM))
648
			return false;
649
		
602
		return valid;
650
		return valid;
603
	}
651
	}
604
	
652
	

Return to bug 186162