diff --git a/cave/build/static/win32.x86/alertviz/alertviz.bat b/cave/build/static/win32.x86/alertviz/alertviz.bat deleted file mode 100644 index 5e4b50ee83..0000000000 --- a/cave/build/static/win32.x86/alertviz/alertviz.bat +++ /dev/null @@ -1,69 +0,0 @@ -@echo OFF - -REM Determine if we are running on a 32-bit or 64-bit OS. -IF NOT EXIST C:\Windows\SysWOW64\reg.exe ( - SET REG_EXE=C:\Windows\System32\reg.exe -) ELSE ( - SET REG_EXE=C:\Windows\SysWOW64\reg.exe -) - -REM Determine where we are located. -SET CONTAINING_DIRECTORY=%~dp0 - -REM Prepare the environment. - -REM Registry Query Variables. -SET A2_JAVA_REG="HKLM\Software\Raytheon\Runtime Environment\AWIPS II Java" -SET A2_PYTHON_REG="HKLM\Software\Raytheon\Runtime Environment\AWIPS II Python" -REM Determine where AWIPS II Java (the jre) is located. -%REG_EXE% QUERY %A2_JAVA_REG% /v JavaJreDirectory > NUL 2>&1 -IF ERRORLEVEL 1 (echo ENVIRONMENT ERROR - Unable to find AWIPS II Java. && PAUSE && EXIT) -FOR /F "tokens=2* delims= " %%A IN ( -'%REG_EXE% QUERY %A2_JAVA_REG% /v JavaJreDirectory') DO ( -SET JavaJreDirectory=%%B) -REM Determine where AWIPS II Python is located. -%REG_EXE% QUERY %A2_PYTHON_REG% /v PythonInstallDirectory > NUL 2>&1 -IF ERRORLEVEL 1 (echo ENVIRONMENT ERROR - Unable to find AWIPS II Python. && PAUSE && EXIT) -FOR /F "tokens=2* delims= " %%A IN ( -'%REG_EXE% QUERY %A2_PYTHON_REG% /v PythonInstallDirectory') DO ( -SET PythonInstallDirectory=%%B) - -REM Add Java and Python to the path. -SET Path=%PythonInstallDirectory%;%PythonInstallDirectory%\DLLs;%Path% -SET Path=%JavaJreDirectory%\bin;%Path% -REM Define 'PythonPath'. -SET PythonPath=%PythonInstallDirectory%\Lib\lib-tk;%PythonPath% -SET PythonPath=%PythonInstallDirectory%\DLLs;%PythonPath% -SET PythonPath=%PythonInstallDirectory%\Lib;%PythonPath% -SET PythonPath=%PythonInstallDirectory%;%PythonPath% - -REM Eliminate variables that will no longer be used. -SET PythonInstallDirectory= -SET JavaJreDirectory= -SET REG_EXE= -SET A2_JAVA_REG= -SET A2_PYTHON_REG= - -REM Determine where we will be logging to. -SET HOME_DIRECTORY=%HOMEDRIVE%%HOMEPATH% -SET CAVEDATA_LOG_DIRECTORY=%HOMEDRIVE%%HOMEPATH%\caveData\logs -SET CONSOLE_LOG_DIRECTORY=%CAVEDATA_LOG_DIRECTORY%\consoleLogs\%COMPUTERNAME% -IF NOT EXIST "%CONSOLE_LOG_DIRECTORY%" (MKDIR "%CONSOLE_LOG_DIRECTORY%") - -echo Starting ALERTVIZ; leave this CMD window open to enable AlertViz 'restart'. -REM Start AlertViz (and implement the alertviz restart capability). -:AlertVizLoopStart -SET RND=%random% -SET RND_DATETIME_FILE=%TMP%\awips2dt_%RND%.tmp -REM Python is used to retrieve the current date and time because the order -REM of the Windows date/time fields is not necessarily guaranteed and the -REM Windows date/time fields can only be extracted using substring operations -REM instead of -formatter- strings like Linux allows. -python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE% -SET /p LOG_DATETIME= < %RND_DATETIME_FILE% -DEL %RND_DATETIME_FILE% -"%CONTAINING_DIRECTORY%alertviz.exe" %* > "%CONSOLE_LOG_DIRECTORY%\alertviz_%LOG_DATETIME%.log" 2>&1 -IF %ERRORLEVEL% == 0 (EXIT) -echo Restarting AlertViz. -GOTO AlertVizLoopStart - diff --git a/cave/build/static/win32.x86/cave/cave.bat b/cave/build/static/win32.x86/cave/cave.bat deleted file mode 100644 index 0b347287dd..0000000000 --- a/cave/build/static/win32.x86/cave/cave.bat +++ /dev/null @@ -1,72 +0,0 @@ -@echo OFF - -REM Determine if we are running on a 32-bit or 64-bit OS. -IF NOT EXIST C:\Windows\SysWOW64\reg.exe ( - SET REG_EXE=C:\Windows\System32\reg.exe -) ELSE ( - SET REG_EXE=C:\Windows\SysWOW64\reg.exe -) - -REM Determine where we are located. -SET CONTAINING_DIRECTORY=%~dp0 - -REM Prepare the environment. - -REM Registry Query Variables. -SET A2_JAVA_REG="HKLM\Software\Raytheon\Runtime Environment\AWIPS II Java" -SET A2_PYTHON_REG="HKLM\Software\Raytheon\Runtime Environment\AWIPS II Python" -REM Determine where AWIPS II Java (the jre) is located. -%REG_EXE% QUERY %A2_JAVA_REG% /v JavaJreDirectory > NUL 2>&1 -IF ERRORLEVEL 1 (echo ENVIRONMENT ERROR - Unable to find AWIPS II Java. && PAUSE && EXIT) -FOR /F "tokens=2* delims= " %%A IN ( -'%REG_EXE% QUERY %A2_JAVA_REG% /v JavaJreDirectory') DO ( -SET JavaJreDirectory=%%B) -REM Determine where AWIPS II Python is located. -%REG_EXE% QUERY %A2_PYTHON_REG% /v PythonInstallDirectory > NUL 2>&1 -IF ERRORLEVEL 1 (echo ENVIRONMENT ERROR - Unable to find AWIPS II Python. && PAUSE && EXIT) -FOR /F "tokens=2* delims= " %%A IN ( -'%REG_EXE% QUERY %A2_PYTHON_REG% /v PythonInstallDirectory') DO ( -SET PythonInstallDirectory=%%B) - -REM Add Java and Python to the path. -SET Path=%PythonInstallDirectory%;%PythonInstallDirectory%\DLLs;%Path% -SET Path=%JavaJreDirectory%\bin;%Path% -REM Add the CAVE lib directory to the path. -SET Path=%CONTAINING_DIRECTORY%lib;%Path% -REM Define 'PythonPath'. -SET PythonPath=%CONTAINING_DIRECTORY%lib;%PythonPath% -SET PythonPath=%PythonInstallDirectory%\Lib\lib-tk;%PythonPath% -SET PythonPath=%PythonInstallDirectory%\DLLs;%PythonPath% -SET PythonPath=%PythonInstallDirectory%\Lib;%PythonPath% -SET PythonPath=%PythonInstallDirectory%;%PythonPath% - -REM Eliminate variables that will no longer be used. -SET PythonInstallDirectory= -SET JavaJreDirectory= -SET REG_EXE= -SET A2_JAVA_REG= -SET A2_PYTHON_REG= - -REM Determine where we will be logging to. -SET HOME_DIRECTORY=%HOMEDRIVE%%HOMEPATH% -SET CAVEDATA_LOG_DIRECTORY=%HOMEDRIVE%%HOMEPATH%\caveData\logs -SET CONSOLE_LOG_DIRECTORY=%CAVEDATA_LOG_DIRECTORY%\consoleLogs\%COMPUTERNAME% -IF NOT EXIST "%CONSOLE_LOG_DIRECTORY%" (MKDIR "%CONSOLE_LOG_DIRECTORY%") - -SET RND=%random% -SET RND_DATETIME_FILE=%TMP%\awips2dt_%RND%.tmp -REM Python is used to retrieve the current date and time because the order -REM of the Windows date/time fields is not necessarily guaranteed and the -REM Windows date/time fields can only be extracted using substring operations -REM instead of -formatter- strings like Linux allows. -python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE% -SET /p LOG_DATETIME= < %RND_DATETIME_FILE% -DEL %RND_DATETIME_FILE% - -echo THIS CMD WINDOW CAN BE CLOSED AT ANY TIME! -cd %HOMEPATH% -REM Start CAVE. -"%CONTAINING_DIRECTORY%cave.exe" %* > "%CONSOLE_LOG_DIRECTORY%\cave_%LOG_DATETIME%.log" 2>&1 -IF ERRORLEVEL 1 (echo CAVE ERROR - check the logs for additional information. && PAUSE) - -EXIT diff --git a/msi/AWIPSII.CAVE/AWIPSII.CAVE.suo b/msi/AWIPSII.CAVE/AWIPSII.CAVE.suo index 9728b75303..34a3fcf7d8 100644 Binary files a/msi/AWIPSII.CAVE/AWIPSII.CAVE.suo and b/msi/AWIPSII.CAVE/AWIPSII.CAVE.suo differ diff --git a/msi/AWIPSII.CAVE/AWIPSII.CAVE/AWIPSII.wxs b/msi/AWIPSII.CAVE/AWIPSII.CAVE/AWIPSII.wxs index ff3181a90c..43f0b45823 100644 --- a/msi/AWIPSII.CAVE/AWIPSII.CAVE/AWIPSII.wxs +++ b/msi/AWIPSII.CAVE/AWIPSII.CAVE/AWIPSII.wxs @@ -24,30 +24,14 @@ - - - - - + + + + - - - - - - - - @@ -71,7 +55,6 @@ - @@ -80,16 +63,20 @@ - + + + + - diff --git a/msi/VizLauncher/VizLauncher.sln b/msi/VizLauncher/VizLauncher.sln new file mode 100644 index 0000000000..b9a96d5c02 --- /dev/null +++ b/msi/VizLauncher/VizLauncher.sln @@ -0,0 +1,20 @@ + +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 new file mode 100644 index 0000000000..610c195a0e Binary files /dev/null and b/msi/VizLauncher/VizLauncher.suo differ diff --git a/msi/VizLauncher/VizLauncher/Form1.Designer.cs b/msi/VizLauncher/VizLauncher/Form1.Designer.cs new file mode 100644 index 0000000000..0f61ba1709 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/Form1.Designer.cs @@ -0,0 +1,79 @@ +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 new file mode 100644 index 0000000000..4c206c62fe --- /dev/null +++ b/msi/VizLauncher/VizLauncher/Form1.cs @@ -0,0 +1,20 @@ +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 new file mode 100644 index 0000000000..29dcb1b3a3 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..dd5d415317 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/Program.cs @@ -0,0 +1,31 @@ +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 new file mode 100644 index 0000000000..5d149225c7 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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 new file mode 100644 index 0000000000..fb7e7281d0 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 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 new file mode 100644 index 0000000000..ffecec851a --- /dev/null +++ b/msi/VizLauncher/VizLauncher/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..b5a088c6b6 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// 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 new file mode 100644 index 0000000000..abf36c5d3d --- /dev/null +++ b/msi/VizLauncher/VizLauncher/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/msi/VizLauncher/VizLauncher/VizLauncher.csproj b/msi/VizLauncher/VizLauncher/VizLauncher.csproj new file mode 100644 index 0000000000..ccd040c7b0 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/VizLauncher.csproj @@ -0,0 +1,94 @@ + + + + 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 new file mode 100644 index 0000000000..695b5c78b9 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/VizLauncher.csproj.user @@ -0,0 +1,3 @@ + + + \ 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 new file mode 100644 index 0000000000..f00af7eaf9 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/VizLauncher.cs @@ -0,0 +1,68 @@ +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 new file mode 100644 index 0000000000..6db871db40 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/environment/EnvironmentProperties.cs @@ -0,0 +1,34 @@ +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 new file mode 100644 index 0000000000..5172e046ee --- /dev/null +++ b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/environment/VizEnvironment.cs @@ -0,0 +1,137 @@ +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 new file mode 100644 index 0000000000..db02974126 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/AbstractProcessLauncher.cs @@ -0,0 +1,129 @@ +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; + + private bool ready = false; + private String exceptionText = null; + + public AbstractProcessLauncher(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())); + processStartInfo.EnvironmentVariables.Remove(EnvironmentProperties.ENVIRONMENT_VARIABLE_PATH); + processStartInfo.EnvironmentVariables.Add( + EnvironmentProperties.ENVIRONMENT_VARIABLE_PATH, vizEnvironment.getPath()); + processStartInfo.EnvironmentVariables.Add( + 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 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 new file mode 100644 index 0000000000..0540d4b4ab --- /dev/null +++ b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/IProcessLauncher.cs @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000000..2b281391c9 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/impl/AlertvizProcessLauncher.cs @@ -0,0 +1,62 @@ +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 new file mode 100644 index 0000000000..ef7e113cc1 --- /dev/null +++ b/msi/VizLauncher/VizLauncher/com/raytheon/viz/launcher/process/impl/CaveProcessLauncher.cs @@ -0,0 +1,38 @@ +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_EXECUTABLE = + Path.DirectorySeparatorChar + "CAVE" + Path.DirectorySeparatorChar + "cave.exe"; + + public CaveProcessLauncher(VizEnvironment vizEnvironment) + : base(vizEnvironment) + { + } + + 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 diff --git a/msi/build/A2Staging/Scripts/WiXBuild.ps1 b/msi/build/A2Staging/Scripts/WiXBuild.ps1 index 1e6006f906..f246f81f19 100644 Binary files a/msi/build/A2Staging/Scripts/WiXBuild.ps1 and b/msi/build/A2Staging/Scripts/WiXBuild.ps1 differ diff --git a/msi/build/A2Staging/VisualStudio/VizLauncher.exe b/msi/build/A2Staging/VisualStudio/VizLauncher.exe new file mode 100644 index 0000000000..7b199ed61c Binary files /dev/null and b/msi/build/A2Staging/VisualStudio/VizLauncher.exe differ diff --git a/msi/build/A2Staging/VisualStudio/_DELETE_ME_ b/msi/build/A2Staging/VisualStudio/_DELETE_ME_ deleted file mode 100644 index e69de29bb2..0000000000