This is an automated email from the ASF dual-hosted git repository.
greyp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 158c5417bc NIFI-9500 Added nifi.cmd for Windows; Switched to NiFi Home
directory to run command actions
158c5417bc is described below
commit 158c5417bcccd3d031c9a8750263bfc6f35ec2af
Author: exceptionfactory <[email protected]>
AuthorDate: Sat Sep 3 14:18:57 2022 -0500
NIFI-9500 Added nifi.cmd for Windows; Switched to NiFi Home directory to
run command actions
This closes #6370
Signed-off-by: Paul Grey <[email protected]>
---
.../src/main/resources/bin/nifi-env.cmd | 31 +++++++++++
.../nifi-resources/src/main/resources/bin/nifi.cmd | 60 ++++++++++++++++++++++
2 files changed, 91 insertions(+)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi-env.cmd
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi-env.cmd
new file mode 100644
index 0000000000..e3a4755261
--- /dev/null
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi-env.cmd
@@ -0,0 +1,31 @@
+@echo off
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+rem
+
+rem Set Java version
+rem set JAVA_HOME="C:\Program Files\Java\jdk1.8.0"
+
+rem Set application home directory based on parent directory of script location
+pushd %~dp0..
+set NIFI_HOME=%CD%
+popd
+
+rem Set run directory for process identifier tracking
+set NIFI_PID_DIR=%NIFI_HOME%\run
+
+rem Set application log directory
+set NIFI_LOG_DIR=%NIFI_HOME%\logs
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.cmd
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.cmd
new file mode 100644
index 0000000000..157cad3295
--- /dev/null
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.cmd
@@ -0,0 +1,60 @@
+@echo off
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+rem
+
+call %~dp0\nifi-env.cmd
+
+if exist "%JAVA_HOME%\bin\java.exe" (
+ set JAVA_EXE=%JAVA_HOME%\bin\java.exe
+) else (
+ echo JAVA_HOME not defined: using PATH for java command
+ set JAVA_EXE=java
+)
+
+set BOOTSTRAP_LIB_DIR=%NIFI_HOME%\lib\bootstrap
+set CONF_DIR=%NIFI_HOME%\conf
+
+set LOG_DIR_PROPERTY=-Dorg.apache.nifi.bootstrap.config.log.dir=%NIFI_LOG_DIR%
+set PID_DIR_PROPERTY=-Dorg.apache.nifi.bootstrap.config.pid.dir=%NIFI_PID_DIR%
+set
CONFIG_FILE_PROPERTY=-Dorg.apache.nifi.bootstrap.config.file=%CONF_DIR%\bootstrap.conf
+set
PROPERTIES_FILE_PROPERTY=-Dnifi.properties.file.path=%CONF_DIR%\nifi.properties
+set BOOTSTRAP_HEAP_SIZE=48m
+
+set JAVA_ARGS=%LOG_DIR_PROPERTY% %PID_DIR_PROPERTY% %CONFIG_FILE_PROPERTY%
%PROPERTIES_FILE_PROPERTY%
+set JAVA_PARAMS=-cp %BOOTSTRAP_LIB_DIR%\*;%CONF_DIR% %JAVA_ARGS%
+set JAVA_MEMORY=-Xms%BOOTSTRAP_HEAP_SIZE% -Xmx%BOOTSTRAP_HEAP_SIZE%
+
+echo JAVA_HOME: %JAVA_HOME%
+echo NIFI_HOME: %NIFI_HOME%
+echo.
+
+pushd %NIFI_HOME%
+
+set RUN_COMMAND="%~1"
+if %RUN_COMMAND% == "set-single-user-credentials" (
+ rem Set credentials with quoted arguments passed to Java command
+ set "CREDENTIALS=^"%~2^" ^"%~3^""
+ call "%JAVA_EXE%" %JAVA_PARAMS%
org.apache.nifi.authentication.single.user.command.SetSingleUserCredentials
%CREDENTIALS%
+) else if %RUN_COMMAND% == "set-sensitive-properties-key" (
+ call "%JAVA_EXE%" %JAVA_PARAMS%
org.apache.nifi.flow.encryptor.command.SetSensitivePropertiesKey %~2
+) else if %RUN_COMMAND% == "set-sensitive-properties-algorithm" (
+ call "%JAVA_EXE%" %JAVA_PARAMS%
org.apache.nifi.flow.encryptor.command.SetSensitivePropertiesAlgorithm %~2
+) else (
+ call "%JAVA_EXE%" %JAVA_MEMORY% %JAVA_PARAMS%
org.apache.nifi.bootstrap.RunNiFi %RUN_COMMAND%
+)
+
+popd