diff --git a/msi/VizLauncher/VizLauncher.sln b/msi/VizLauncher/VizLauncher.sln deleted file mode 100644 index b9a96d5c02..0000000000 --- a/msi/VizLauncher/VizLauncher.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C# Express 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VizLauncher", "VizLauncher\VizLauncher.csproj", "{45B15612-0725-479C-8E1B-9B63F2FB45A3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {45B15612-0725-479C-8E1B-9B63F2FB45A3}.Debug|x86.ActiveCfg = Debug|x86 - {45B15612-0725-479C-8E1B-9B63F2FB45A3}.Debug|x86.Build.0 = Debug|x86 - {45B15612-0725-479C-8E1B-9B63F2FB45A3}.Release|x86.ActiveCfg = Release|x86 - {45B15612-0725-479C-8E1B-9B63F2FB45A3}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/msi/VizLauncher/VizLauncher.suo b/msi/VizLauncher/VizLauncher.suo deleted file mode 100644 index cd5496cb2c..0000000000 Binary files a/msi/VizLauncher/VizLauncher.suo and /dev/null differ diff --git a/msi/VizLauncher/VizLauncher/Form1.Designer.cs b/msi/VizLauncher/VizLauncher/Form1.Designer.cs deleted file mode 100644 index 0f61ba1709..0000000000 --- a/msi/VizLauncher/VizLauncher/Form1.Designer.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace VizLauncher -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.lblFailureDetail = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(12, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(337, 50); - this.label1.TabIndex = 0; - this.label1.Text = "Failed to Start AWIPS II Viz!"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblFailureDetail - // - this.lblFailureDetail.BackColor = System.Drawing.Color.White; - this.lblFailureDetail.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblFailureDetail.Location = new System.Drawing.Point(14, 59); - this.lblFailureDetail.Name = "lblFailureDetail"; - this.lblFailureDetail.Size = new System.Drawing.Size(335, 119); - this.lblFailureDetail.TabIndex = 1; - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(361, 187); - this.Controls.Add(this.lblFailureDetail); - this.Controls.Add(this.label1); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "Form1"; - this.ShowInTaskbar = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Viz Launcher"; - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label lblFailureDetail; - } -} - diff --git a/msi/VizLauncher/VizLauncher/Form1.cs b/msi/VizLauncher/VizLauncher/Form1.cs deleted file mode 100644 index 4c206c62fe..0000000000 --- a/msi/VizLauncher/VizLauncher/Form1.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace VizLauncher -{ - public partial class Form1 : Form - { - public Form1(String errorText) - { - InitializeComponent(); - this.lblFailureDetail.Text = errorText; - } - } -} \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/Form1.resx b/msi/VizLauncher/VizLauncher/Form1.resx deleted file mode 100644 index 29dcb1b3a3..0000000000 --- a/msi/VizLauncher/VizLauncher/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/Program.cs b/msi/VizLauncher/VizLauncher/Program.cs deleted file mode 100644 index dd5d415317..0000000000 --- a/msi/VizLauncher/VizLauncher/Program.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; -using VizLauncher.com.raytheon.viz.launcher; - -namespace VizLauncher -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - VizLauncher.com.raytheon.viz.launcher.VizLauncher vizLauncher = - new VizLauncher.com.raytheon.viz.launcher.VizLauncher(); - bool success = vizLauncher.run(Application.StartupPath); - if (success == false) - { - // Display the "Failure" dialog. - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1(vizLauncher.getErrorDetail())); - } - - Application.Exit(); - } - } -} diff --git a/msi/VizLauncher/VizLauncher/Properties/AssemblyInfo.cs b/msi/VizLauncher/VizLauncher/Properties/AssemblyInfo.cs deleted file mode 100644 index 5d149225c7..0000000000 --- a/msi/VizLauncher/VizLauncher/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("VizLauncher")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("VizLauncher")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("7f929b46-b56e-47eb-b6e6-ff79e54f6572")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/msi/VizLauncher/VizLauncher/Properties/Resources.Designer.cs b/msi/VizLauncher/VizLauncher/Properties/Resources.Designer.cs deleted file mode 100644 index fb7e7281d0..0000000000 --- a/msi/VizLauncher/VizLauncher/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17929 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace VizLauncher.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VizLauncher.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/msi/VizLauncher/VizLauncher/Properties/Resources.resx b/msi/VizLauncher/VizLauncher/Properties/Resources.resx deleted file mode 100644 index ffecec851a..0000000000 --- a/msi/VizLauncher/VizLauncher/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/Properties/Settings.Designer.cs b/msi/VizLauncher/VizLauncher/Properties/Settings.Designer.cs deleted file mode 100644 index b5a088c6b6..0000000000 --- a/msi/VizLauncher/VizLauncher/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17929 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace VizLauncher.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/msi/VizLauncher/VizLauncher/Properties/Settings.settings b/msi/VizLauncher/VizLauncher/Properties/Settings.settings deleted file mode 100644 index abf36c5d3d..0000000000 --- a/msi/VizLauncher/VizLauncher/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/msi/VizLauncher/VizLauncher/VizLauncher.csproj b/msi/VizLauncher/VizLauncher/VizLauncher.csproj deleted file mode 100644 index ccd040c7b0..0000000000 --- a/msi/VizLauncher/VizLauncher/VizLauncher.csproj +++ /dev/null @@ -1,94 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {45B15612-0725-479C-8E1B-9B63F2FB45A3} - WinExe - Properties - VizLauncher - VizLauncher - v4.0 - Client - 512 - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - Form - - - Form1.cs - - - - - Form1.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/VizLauncher.csproj.user b/msi/VizLauncher/VizLauncher/VizLauncher.csproj.user deleted file mode 100644 index 695b5c78b9..0000000000 --- a/msi/VizLauncher/VizLauncher/VizLauncher.csproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/VizLauncher.cs b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/VizLauncher.cs deleted file mode 100644 index f00af7eaf9..0000000000 --- a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/VizLauncher.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using VizLauncher.com.raytheon.viz.launcher.environment; -using VizLauncher.com.raytheon.viz.launcher.process; -using VizLauncher.com.raytheon.viz.launcher.process.impl; - -namespace VizLauncher.com.raytheon.viz.launcher -{ - public class VizLauncher - { - private String errorDetail; - - public bool run(String location) - { - VizEnvironment vizEnvironment = new VizEnvironment(location); - if (vizEnvironment.isReady() == false) - { - this.errorDetail = vizEnvironment.getExceptionText(); - return false; - } - - /* Alternatively, we would be able to construct both process launchers using Spring and inject them. */ - - // Construct the AlertViz Process Launcher. - IProcessLauncher alertvizProcessLauncher = new AlertvizProcessLauncher(vizEnvironment); - if (alertvizProcessLauncher.isReady() == false) - { - this.errorDetail = alertvizProcessLauncher.getExceptionText(); - return false; - } - Thread alertvizThread = new Thread(alertvizProcessLauncher.launchProcess); - - // Construct the CAVE Process Launcher. - IProcessLauncher caveProcessLauncher = new CaveProcessLauncher(vizEnvironment); - if (caveProcessLauncher.isReady() == false) - { - this.errorDetail = caveProcessLauncher.getExceptionText(); - return false; - } - Thread caveThread = new Thread(caveProcessLauncher.launchProcess); - - // Start AlertViz. - alertvizThread.Start(); - - // Delay - Give Alertviz Time To Start. - Thread.Sleep(1000); - - // Start CAVE. - caveThread.Start(); - - // Wait for CAVE. - caveThread.Join(); - - // Wait for AlertViz. - alertvizThread.Join(); - - return true; - } - - public String getErrorDetail() - { - return this.errorDetail; - } - } -} \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/environment/EnvironmentProperties.cs b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/environment/EnvironmentProperties.cs deleted file mode 100644 index 6db871db40..0000000000 --- a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/environment/EnvironmentProperties.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; - -namespace VizLauncher.com.raytheon.viz.launcher.environment -{ - public abstract class EnvironmentProperties - { - /* Environment Properties */ - public static readonly String USER_HOME_ENV_PROPERTY = "%HOMEDRIVE%%HOMEPATH%"; - public static readonly String COMPUTER_NAME_ENV_PROPERTY = "%COMPUTERNAME%"; - - /* Registry Constants */ - public static readonly String A2_JAVA_REG = @"Software\Raytheon\Runtime Environment\AWIPS II Java"; - public static readonly String A2_PYTHON_REG = @"Software\Raytheon\Runtime Environment\AWIPS II Python"; - - public static readonly String JAVA_JRE_VALUE_NAME = "JavaJreDirectory"; - public static readonly String PYTHON_INSTALL_NAME = "PythonInstallDirectory"; - - /* Environment Additions */ - public static readonly String ENVIRONMENT_VARIABLE_PATH = "Path"; - public static readonly String ENVIRONMENT_VARIABLE_PYTHON_PATH = "PythonPath"; - - public static readonly String PATH_PYTHON_DLLS = Path.DirectorySeparatorChar + "DLLs"; - public static readonly String PATH_JAVA_BIN = Path.DirectorySeparatorChar + "bin"; - - public static readonly String PYTHON_PATH_PYTHON_LIBTK = - Path.DirectorySeparatorChar + "Lib" + Path.DirectorySeparatorChar + "lib-tk"; - public static readonly String PYTHON_PATH_PYTHON_DLLS = Path.DirectorySeparatorChar + "DLLs"; - public static readonly String PYTHON_PATH_PYTHON_LIB = Path.DirectorySeparatorChar + "Lib"; - } -} diff --git a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/environment/VizEnvironment.cs b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/environment/VizEnvironment.cs deleted file mode 100644 index 5172e046ee..0000000000 --- a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/environment/VizEnvironment.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using Microsoft.Win32; - -namespace VizLauncher.com.raytheon.viz.launcher.environment -{ - public class VizEnvironment - { - private static readonly String CONSOLE_LOGS_DIRECTORY = - Path.DirectorySeparatorChar + "caveData" + Path.DirectorySeparatorChar + - "logs" + Path.DirectorySeparatorChar + "consoleLogs"; - private String location; - private String logDirectory = null; - private String path = null; - private String pythonPath = null; - - // did an error occur while initializing this object? - private bool ready; - // details about the error that has occurred. - private String exceptionText; - - public VizEnvironment(String location) - { - this.location = location; - this.init(); - } - - private void init() - { - /* For now we will assume that the environment properties will be available */ - // determine the location of the user's "home" directory. - String homeDirectory = - this.resolveEnvironmentProperty(EnvironmentProperties.USER_HOME_ENV_PROPERTY); - - // determine the computer name. - String computerName = - this.resolveEnvironmentProperty(EnvironmentProperties.COMPUTER_NAME_ENV_PROPERTY); - - // construct the path to the log directory. - this.logDirectory = homeDirectory + CONSOLE_LOGS_DIRECTORY + - Path.DirectorySeparatorChar + computerName; - - // retrieve the jdk directory from the registry. - String jdkDirectory = - this.retrieveRegistryProperty(EnvironmentProperties.A2_JAVA_REG, - EnvironmentProperties.JAVA_JRE_VALUE_NAME); - if (jdkDirectory == null) - { - this.notReady("Unable to retrieve the Java JDK Path from the registry!"); - return; - } - - // retrieve the python location from the registry. - String pythonLocation = - this.retrieveRegistryProperty(EnvironmentProperties.A2_PYTHON_REG, - EnvironmentProperties.PYTHON_INSTALL_NAME); - if (pythonLocation == null) - { - this.notReady("Unable to retrieve the Python Install Location from the registry!"); - return; - } - - // Construct the PATH. - this.path = pythonLocation + Path.PathSeparator; - this.path += pythonLocation + EnvironmentProperties.PATH_PYTHON_DLLS + Path.PathSeparator; - this.path += jdkDirectory + EnvironmentProperties.PATH_JAVA_BIN; - - // Construct the PYTHON_PATH. - this.pythonPath = pythonLocation + EnvironmentProperties.PYTHON_PATH_PYTHON_LIBTK + Path.PathSeparator; - this.pythonPath += pythonLocation + EnvironmentProperties.PYTHON_PATH_PYTHON_DLLS + Path.PathSeparator; - this.pythonPath += pythonLocation + EnvironmentProperties.PYTHON_PATH_PYTHON_LIB + Path.PathSeparator; - this.pythonPath += pythonLocation; - - this.ready = true; - } - - private String resolveEnvironmentProperty(String property) - { - return Environment.ExpandEnvironmentVariables(property); - } - - private String retrieveRegistryProperty(String registryKeyName, String valueName) - { - RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(registryKeyName); - if (registryKey == null) - { - return null; - } - Object registryValue = registryKey.GetValue(valueName, null); - if (registryValue == null) - { - return null; - } - - return registryValue.ToString(); - } - - private void notReady(String reason) - { - this.ready = false; - this.exceptionText = reason; - } - - public String getLocation() - { - return this.location; - } - - public String getLogDirectory() - { - return this.logDirectory; - } - - public String getPath() - { - return this.path; - } - - public String getPythonPath() - { - return this.pythonPath; - } - - public bool isReady() - { - return this.ready; - } - - public String getExceptionText() - { - return this.exceptionText; - } - } -} \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/AbstractProcessLauncher.cs b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/AbstractProcessLauncher.cs deleted file mode 100644 index be55359cb7..0000000000 --- a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/AbstractProcessLauncher.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Diagnostics; -using VizLauncher.com.raytheon.viz.launcher.environment; - -namespace VizLauncher.com.raytheon.viz.launcher.process -{ - public abstract class AbstractProcessLauncher : IProcessLauncher - { - private static readonly String LOG_DATE_FORMAT = "yyyyMMdd_HHmmss"; - protected static readonly String LOG_SUFFIX = ".log"; - protected Process process = null; - private StreamWriter logFileWriter; - protected VizEnvironment vizEnvironment; - - private bool ready = false; - private String exceptionText = null; - - public AbstractProcessLauncher(VizEnvironment vizEnvironment) - { - this.vizEnvironment = vizEnvironment; - // Prepare the log file. - if (Directory.Exists(vizEnvironment.getLogDirectory()) == false) - { - Directory.CreateDirectory(vizEnvironment.getLogDirectory()); - } - String logName = vizEnvironment.getLogDirectory() + - Path.DirectorySeparatorChar + this.constructLogName(this.determineLogDate()); - - // Prepare the process. - this.process = new Process(); - this.process.StartInfo = this.constructProcessStartInfo(vizEnvironment); - this.process.OutputDataReceived += new DataReceivedEventHandler(processOutputHandler); - this.validate(); - if (this.ready == false) - { - return; - } - - /* - * Access the log file for write access; other processes will have read-only access to - * the log file until it is closed. - **/ - this.logFileWriter = - new StreamWriter(File.Open(logName, FileMode.Append, - FileAccess.Write, FileShare.Read)); - } - - private String determineLogDate() - { - return DateTime.Now.ToString(LOG_DATE_FORMAT); - } - - private ProcessStartInfo constructProcessStartInfo(VizEnvironment vizEnvironment) - { - ProcessStartInfo processStartInfo = - new ProcessStartInfo(this.constructProcessName(vizEnvironment.getLocation())); - // include the default system PATH in the application PATH - String systemPath = System.Environment.GetEnvironmentVariable("PATH"); - processStartInfo.EnvironmentVariables[EnvironmentProperties.ENVIRONMENT_VARIABLE_PATH] = - vizEnvironment.getPath() + this.getApplicationSpecificPath() + systemPath; - processStartInfo.EnvironmentVariables[EnvironmentProperties.ENVIRONMENT_VARIABLE_PYTHON_PATH] = - vizEnvironment.getPythonPath(); - processStartInfo.UseShellExecute = false; - processStartInfo.Arguments = this.getCommandLineArguments(); - processStartInfo.RedirectStandardOutput = true; - - return processStartInfo; - } - - protected void validate() - { - String application = this.process.StartInfo.FileName; - /* ensure that the specified application exists. */ - if (File.Exists(application) == false) - { - this.ready = false; - this.exceptionText = "Unable to find the specified Viz application: " + application; - return; - } - - this.ready = true; - } - - public virtual void launchProcess() - { - this.runProcess(); - this.closeLog(); - } - - protected void runProcess() - { - this.process.Start(); - this.process.BeginOutputReadLine(); - this.process.WaitForExit(); - this.process.CancelOutputRead(); - } - - protected void closeLog() - { - this.logFileWriter.Close(); - } - - private void processOutputHandler(Object sendingProcess, DataReceivedEventArgs outline) - { - if (String.IsNullOrEmpty(outline.Data)) - { - return; - } - this.logFileWriter.WriteLine(outline.Data); - } - - public bool isReady() - { - return this.ready; - } - - public String getExceptionText() - { - return this.exceptionText; - } - - protected virtual String getApplicationSpecificPath() - { - return String.Empty; - } - - protected abstract String constructProcessName(String location); - - protected abstract String constructLogName(String logDate); - - protected abstract String getCommandLineArguments(); - } -} \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/IProcessLauncher.cs b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/IProcessLauncher.cs deleted file mode 100644 index 0540d4b4ab..0000000000 --- a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/IProcessLauncher.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Diagnostics; - -namespace VizLauncher.com.raytheon.viz.launcher.process -{ - public interface IProcessLauncher - { - void launchProcess(); - - bool isReady(); - String getExceptionText(); - } -} \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/impl/AlertvizProcessLauncher.cs b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/impl/AlertvizProcessLauncher.cs deleted file mode 100644 index 2b281391c9..0000000000 --- a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/impl/AlertvizProcessLauncher.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Diagnostics; -using System.IO; -using VizLauncher.com.raytheon.viz.launcher.process; -using VizLauncher.com.raytheon.viz.launcher.environment; - -namespace VizLauncher.com.raytheon.viz.launcher.process.impl -{ - public class AlertvizProcessLauncher : AbstractProcessLauncher - { - private static readonly String LOG_PREFIX = "alertviz_"; - private static readonly String COMMAND_LINE_ARGUMENTS = "-component thinalertviz"; - private static readonly String ALERTVIZ_PROCESS_NAME = "alertviz"; - private static readonly String ALERTVIZ_EXECUTABLE = - Path.DirectorySeparatorChar + "AlertViz" + - Path.DirectorySeparatorChar + "alertviz.exe"; - - public AlertvizProcessLauncher(VizEnvironment vizEnvironment) : base(vizEnvironment) - { - } - - public override void launchProcess() - { - // need to verify that another AlertViz process is not already running. - if (this.isAlertVizAlreadyRunning()) - { - // do not start a new AlertViz process. - return; - } - - this.runProcess(); - while (this.process.ExitCode != 0) - { - this.runProcess(); - } - this.closeLog(); - } - - private Boolean isAlertVizAlreadyRunning() - { - return (Process.GetProcessesByName(ALERTVIZ_PROCESS_NAME).Length > 0); - } - - protected override String constructProcessName(String location) - { - return location + ALERTVIZ_EXECUTABLE; - } - - protected override String constructLogName(String logDate) - { - return LOG_PREFIX + logDate + AbstractProcessLauncher.LOG_SUFFIX; - } - - protected override String getCommandLineArguments() - { - return COMMAND_LINE_ARGUMENTS; - } - } -} \ No newline at end of file diff --git a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/impl/CaveProcessLauncher.cs b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/impl/CaveProcessLauncher.cs deleted file mode 100644 index 83321fea2d..0000000000 --- a/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/impl/CaveProcessLauncher.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using VizLauncher.com.raytheon.viz.launcher.process; -using VizLauncher.com.raytheon.viz.launcher.environment; - -namespace VizLauncher.com.raytheon.viz.launcher.process.impl -{ - public class CaveProcessLauncher : AbstractProcessLauncher - { - private static readonly String LOG_PREFIX = "cave_"; - private static readonly String COMMAND_LINE_ARGUMENTS = "-component thinclient"; - private static readonly String CAVE_DIRECTORY = Path.DirectorySeparatorChar + "CAVE"; - private static readonly String CAVE_EXECUTABLE = - CAVE_DIRECTORY + Path.DirectorySeparatorChar + "cave.exe"; - - public CaveProcessLauncher(VizEnvironment vizEnvironment) - : base(vizEnvironment) - { - } - - protected override String getApplicationSpecificPath() - { - return Path.PathSeparator + this.vizEnvironment.getLocation() + - CAVE_DIRECTORY + Path.DirectorySeparatorChar + "lib" + Path.PathSeparator; - } - - protected override String constructProcessName(String location) - { - return location + CAVE_EXECUTABLE; - } - - protected override String constructLogName(String logDate) - { - return LOG_PREFIX + logDate + AbstractProcessLauncher.LOG_SUFFIX; - } - - protected override String getCommandLineArguments() - { - return COMMAND_LINE_ARGUMENTS; - } - } -} \ No newline at end of file