Various fixes for Windows NCService

- Fix RESOURCE_PATH
- Use windows platform in appassembler instead of booter-windows for client-helper
- Fix a few redirection bugs in sample start/stop batch files

Change-Id: If7af80292bddd5191d83bac18f0a518621d7db71
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1518
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Ian Maxon <imaxon@apache.org>
Tested-by: Ian Maxon <imaxon@apache.org>
diff --git a/asterixdb/asterix-client-helper/pom.xml b/asterixdb/asterix-client-helper/pom.xml
index 9a7bb64..726e8fa 100644
--- a/asterixdb/asterix-client-helper/pom.xml
+++ b/asterixdb/asterix-client-helper/pom.xml
@@ -41,26 +41,17 @@
             <program>
               <platforms>
                 <platform>unix</platform>
+                <platform>windows</platform>
               </platforms>
               <name>asterixhelper</name>
               <mainClass>org.apache.asterix.clienthelper.AsterixHelper</mainClass>
             </program>
           </programs>
-          <daemons>
-            <daemon>
-              <id>asterixhelper</id>
-              <mainClass>org.apache.asterix.clienthelper.AsterixHelper</mainClass>
-              <platforms>
-                <platform>booter-windows</platform>
-              </platforms>
-            </daemon>
-          </daemons>
         </configuration>
         <executions>
           <execution>
             <goals>
               <goal>assemble</goal>
-              <goal>generate-daemons</goal>
             </goals>
           </execution>
         </executions>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
index dd7c8e4..83ff3a2 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
@@ -31,7 +31,7 @@
 // 3000 ---- 3999: feed errors
 // 4000 ---- 4999: lifecycle management errors
 public class ErrorCode {
-    private static final String RESOURCE_PATH = "asx_errormsg" + File.separator + "en.properties";
+    private static final String RESOURCE_PATH = "asx_errormsg/en.properties";
     public static final String ASTERIX = "ASX";
 
     // Extension errors
diff --git a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
index 580e1e0..74ca87e 100644
--- a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
@@ -52,20 +52,6 @@
 goto opts
 :postopts
 
-if NOT DEFINED JAVA_HOME (
-  echo ERROR: JAVA_HOME not defined
-  goto :ERROR
-)
-REM ensure JAVA_HOME has no spaces nor quotes, since appassembler can't handle them
-set JAVA_HOME=%JAVA_HOME:"=%
-for %%I in ("%JAVA_HOME%") do (
-  set JAVA_HOME=%%~sI
-)
-
-set JAVACMD=%JAVA_HOME%\bin\java
-
-REM TODO(mblow): check java version, spaces in CWD
-
 set DIRNAME=%~dp0
 
 pushd %DIRNAME%\..
@@ -92,7 +78,7 @@
 
 wmic process where ^
   "name='java.exe' and CommandLine like '%%org.codehaus.mojo.appassembler.booter.AppassemblerBooter%%' and (CommandLine like '%%app.name=\"%%[cn]c\"%%' or CommandLine like '%%app.name=\"%%ncservice\"%%')" ^
-  GET processid > %tempfile% 2>/dev/null
+  GET processid > %tempfile% 2> nul
 
 set severity=ERROR
 if "%force%" == "1" set severity=WARNING
diff --git a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
index 7ac9483..6b02174 100644
--- a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
@@ -58,17 +58,6 @@
 goto opts
 :postopts
 
-if NOT DEFINED JAVA_HOME (
-  echo ERROR: JAVA_HOME not defined
-  goto :ERROR
-)
-
-REM ensure JAVA_HOME has no spaces nor quotes, since appassembler can't handle them
-set JAVA_HOME=%JAVA_HOME:"=%
-for %%I in ("%JAVA_HOME%") do (
-  set JAVA_HOME=%%~sI
-)
-
 set DIRNAME=%~dp0
 
 pushd %DIRNAME%\..
@@ -92,12 +81,12 @@
 if "%tries%" == "60" goto :timed_out
 wmic process where ^
   "name='java.exe' and CommandLine like '%%org.codehaus.mojo.appassembler.booter.AppassemblerBooter%%' and (CommandLine like '%%app.name=\"%%[cn]c\"%%' or CommandLine like '%%app.name=\"%%ncservice\"%%')" ^
-  GET processid >%tempfile% 2>/dev/null
+  GET processid >%tempfile% 2> nul
 
 set found=
 for /F "skip=1" %%P in ('type %tempfile%') DO set found=1
 if "%found%" == "1" (
-  timeout /T 1 /NOBREAK >/dev/null
+  timeout /T 1 /NOBREAK > nul
   goto :wait_loop
 )
 goto :post_shutdown
@@ -110,7 +99,7 @@
 
 wmic process where ^
   "name='java.exe' and CommandLine like '%%org.codehaus.mojo.appassembler.booter.AppassemblerBooter%%' and (CommandLine like '%%app.name=\"%%[cn]c\"%%' or CommandLine like '%%app.name=\"%%ncservice\"%%')" ^
-  GET processid > %tempfile% 2>/dev/null
+  GET processid > %tempfile% 2> nul
 
 set found=
 for /F "skip=1" %%P in ('type %tempfile%') DO set found=1
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
index 3d99cdb..8d312d5 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
@@ -31,7 +31,7 @@
  * 10000 ---- 19999: compilation errors
  */
 public class ErrorCode {
-    private static final String RESOURCE_PATH = "errormsg" + File.separator + "en.properties";
+    private static final String RESOURCE_PATH = "errormsg/en.properties";
     public static final String HYRACKS = "HYR";
 
     // Runtime error codes.