[java-idp-jetty-base] 11/18: IDP-2297 Explore extending the Plugin and Module Infrastructure to allow Jetty installation

Rod Widdowson rdw at steadingsoftware.com
Tue Oct 15 15:14:58 UTC 2024


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch dev/IDP-2297
in repository java-idp-jetty-base.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-jetty-base.git;a=commit;h=6f4046419df3f10654ec60e094d123c7957e005e

commit 6f4046419df3f10654ec60e094d123c7957e005e
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Sep 23 15:45:17 2024 +0100

    IDP-2297 Explore extending the Plugin and Module Infrastructure to allow Jetty installation
    
    https://shibboleth.atlassian.net/browse/IDP-2297
    
    Misc cleanup and bug fixes to the windows script
---
 .../idp/plugin/jettybase/JettyBaseModule.java      | 11 ++++----
 .../idp/plugin/jettybase/module.properties         |  2 +-
 .../idp/plugin/jettybase/module/runjetty.bat       | 33 +++++++++++-----------
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/jetty-base-impl/src/main/java/net/shibboleth/idp/plugin/jettybase/JettyBaseModule.java b/jetty-base-impl/src/main/java/net/shibboleth/idp/plugin/jettybase/JettyBaseModule.java
index be7b83b..d71b5e9 100644
--- a/jetty-base-impl/src/main/java/net/shibboleth/idp/plugin/jettybase/JettyBaseModule.java
+++ b/jetty-base-impl/src/main/java/net/shibboleth/idp/plugin/jettybase/JettyBaseModule.java
@@ -50,7 +50,7 @@ public class JettyBaseModule extends PluginIdPModule {
         final Map<ModuleResource, ResourceResult> result = super.enable(moduleContext);
         final Path idpHome = Path.of(moduleContext.getInstallLocation());
         final Path jettyBase = idpHome.resolve("jetty-base");
-        log.debug("Creating directories (if needed): 'credentials', 'logs', 'static', 'tmp' below {}", jettyBase);
+        log.debug("Creating directories (if needed): '{}' '{}'\n", idpHome.resolve("static"), jettyBase.resolve("tmp"));
         try {
             Files.createDirectories(idpHome.resolve("static"));
             Files.createDirectories(jettyBase.resolve("tmp"));
@@ -59,18 +59,17 @@ public class JettyBaseModule extends PluginIdPModule {
             throw new ModuleException(e);
         }
         if (SystemUtils.IS_OS_WINDOWS) {
-            final File jettyHelper = idpHome.resolve("bin").resolve("Jetty-helper.bat").toFile();
+            final File jettyHelper = idpHome.resolve("jetty-base").resolve("jetty.base.linux").toFile();
             if (!jettyHelper.exists()) {
                 try {
                     final String idpHomeString = idpHome.toFile().getCanonicalPath().replace('\\', '/');
                     try (final PrintStream stream = new PrintStream(jettyHelper)) {
-                        stream.println("@echo off\n\nREM Helper to set up the UNIX delimited IDP_HOME\n\n");
-                        stream.printf("IDP_HOME_UNIX=%s\n", idpHomeString);
+                        stream.printf("%s\n", idpHomeString);
                     }
                 }
                 catch (IOException e) {
-                    log.error("Could not write bin\\jetty-helper.bat", e);
-                    throw new ModuleException("Could not write bin\\jetty-helper.bat", e);
+                    log.error("Could not write jetty-base/jetty.base.linux", e);
+                    throw new ModuleException("Could not write jetty-base/jetty.base.linux", e);
                 }
             }
         }
diff --git a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module.properties b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module.properties
index 8d3cd7f..d4c7439 100644
--- a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module.properties
+++ b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module.properties
@@ -43,7 +43,7 @@ jetty.base.module.8.windows = false
 jetty.base.module.8.replace = false
 
 jetty.base.module.9.src = /net/shibboleth/idp/plugin/jettybase/module/start.d/idp-system.ini
-jetty.base.module.9.dest = jetty-base/start.d/start.d/idp-system.ini
+jetty.base.module.9.dest = jetty-base/start.d/idp-system.ini
 jetty.base.module.9.nonwindows = false
 jetty.base.module.9.windows = true
 jetty.base.module.9.replace = true
diff --git a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/runjetty.bat b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/runjetty.bat
index 3944ed0..1b3089c 100644
--- a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/runjetty.bat
+++ b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/runjetty.bat
@@ -1,35 +1,35 @@
-rem @echo off
+ at echo off
 setlocal
 
+
 REM We need a JVM
 if not defined JAVA_HOME  (
   echo Error: JAVA_HOME is not defined.
   exit /b
 )
 
-if not defined IDP_HOME  (
-  echo Error: IDP_HOME is not defined.
-  exit /b
-)
-
 if not defined JAVACMD (
   set JAVACMD="%JAVA_HOME%\bin\java.exe"
 )
 
-set IDP_HOME_WINDOWS=%~dp0..
+if not exist %JAVACMD% (
+  echo Error: %JAVACMD%  not found
+  exit /b
+)
 
-REM setup IDP_HOME_UNIX
-%~dp0/jetty-helper.bat
+set IDP_HOME_WINDOWS=%~dp0..
 
-echo %IDP_HOME_UNIX%
+for /f "tokens=* USEBACKQ" %%F in (`type %~dp0..\jetty-base\jetty.base.linux`) do (
+SET IDP_HOME_UNIX=%%F
+)
 
-if not defined JETTY_HOME {
+if not defined JETTY_HOME (
    set JETTY_HOME=%IDP_HOME_WINDOWS%\jetty-home
-}
+)
 
-if not defined JETTY_BASE {
+if not defined JETTY_BASE (
    set JETTY_BASE=%IDP_HOME_WINDOWS%\jetty-base
-}
+)
 
 if not exist "%JETTY_HOME%\start.jar" (
   echo Error: JETTY_HOME does not point to a valid Jetty Installation
@@ -41,10 +41,11 @@ if not exist "%JETTY_BASE%\start.d" (
   exit /b
 )
 
-set JVM_ARGS=-Didp.home="%IDP_HOME%" -Djdk.tls.ephemeralDHKeySize=2048 -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog -Djava.io.tmpdir="%JETTY_BASE%/tmp" -XX:+UseG1GC
+set JVM_ARGS=-Didp.home="%IDP_HOME_UNIX%" -Djdk.tls.ephemeralDHKeySize=2048 -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog -Djava.io.tmpdir="%JETTY_BASE%/tmp" -XX:+UseG1GC
+
 
 SET JETTY_ARGS=jetty.base="%JETTY_BASE%" jetty.logging.dir="%IDP_HOME_WINDOWS%\logs"
 
 %JAVACMD% -jar "%JETTY_HOME%/start.jar" %JVM_ARGS% %JETTY_ARGS%
 
-
+:dome

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list