[java-identity-provider] 01/02: IDP-2073 Consider enabling the installer to download new versions

Rod Widdowson rdw at steadingsoftware.com
Thu Jun 1 15:43:05 UTC 2023


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

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=532dad7b68f95eb84ff9ce9aee4bf6f581ea473d

commit 532dad7b68f95eb84ff9ce9aee4bf6f581ea473d
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Jun 1 15:49:16 2023 +0100

    IDP-2073 Consider enabling the installer to download new versions
    
    https://shibboleth.atlassian.net/browse/IDP-2073
    
    Refactor the plugin installer to provide more support for the IdP installer
    doing similar things.
---
 .../installer/plugin/impl/PluginInstallerCLI.java  | 32 +---------------------
 .../plugin/impl/PluginInstallerSupport.java        | 31 +++++++++++++++++++++
 2 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
index c3a6ff09a..9f5f7eddf 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
@@ -32,7 +32,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
-import java.util.function.Predicate;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -56,7 +55,6 @@ import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.shared.primitive.StringSupport;
 
 /**
  * Command line for Plugin Installation.
@@ -218,7 +216,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
         assert idpHome != null;
         inst.setIdpHome(idpHome);
         if (!args.isUnattended()) {
-            inst.setAcceptKey(new InstallerQuery("Accept this key"));
+            inst.setAcceptKey(new PluginInstallerSupport.InstallerQuery("Accept this key"));
         }
         inst.setTrustore(args.getTruststore());
         final HttpClient client = getHttpClient();
@@ -550,32 +548,4 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
     public static void main(@Nonnull final String[] args) {
         System.exit(runMain(args));
     }
-
-    /** Predicate to ask the user if they want to install the trust store provided. */
-    private class InstallerQuery implements Predicate<String> {
-
-        /** What to say. */
-        @Nonnull
-        private final String promptText;
-
-        /**
-         * Constructor.
-         * @param text What to say before the prompt information
-         */
-        public InstallerQuery(@Nonnull final String text) {
-            promptText = Constraint.isNotNull(text, "Text should not be null");
-        }
-
-        /** {@inheritDoc} */
-        public boolean test(final String keyString) {
-        	if (System.console() == null) {
-        		log.error("No Console Attached to installer");
-        		return false;
-        	}
-            System.console().printf("%s:\n%s [yN] ", promptText, keyString);
-            System.console().flush();
-            final String result  = StringSupport.trimOrNull(System.console().readLine());
-            return result != null && "y".equalsIgnoreCase(result.substring(0, 1));
-        }
-    }
 }
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerSupport.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerSupport.java
index 76ca64ff2..f3fc533f7 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerSupport.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerSupport.java
@@ -31,6 +31,7 @@ import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
+import java.util.function.Predicate;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -51,7 +52,9 @@ import net.shibboleth.idp.plugin.PluginVersion;
 import net.shibboleth.shared.annotation.constraint.Live;
 import net.shibboleth.shared.collection.Pair;
 import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.LoggerFactory;
+import net.shibboleth.shared.primitive.StringSupport;
 import net.shibboleth.shared.spring.httpclient.resource.HTTPResource;
 
 /**
@@ -363,4 +366,32 @@ public final class PluginInstallerSupport {
         }
     }
 
+/** Predicate to ask the user if they want to install the trust store provided. */
+    public static class InstallerQuery implements Predicate<String> {
+
+        /** What to say. */
+        @Nonnull
+        private final String promptText;
+
+        /**
+         * Constructor.
+         * @param text What to say before the prompt information
+         */
+        public InstallerQuery(@Nonnull final String text) {
+            promptText = Constraint.isNotNull(text, "Text should not be null");
+        }
+
+        /** {@inheritDoc} */
+        public boolean test(final String keyString) {
+            if (System.console() == null) {
+                LOG.error("No Console Attached to installer");
+                return false;
+            }
+            System.console().printf("%s:\n%s [yN] ", promptText, keyString);
+            System.console().flush();
+            final String result  = StringSupport.trimOrNull(System.console().readLine());
+            return result != null && "y".equalsIgnoreCase(result.substring(0, 1));
+        }
+    }
 }
+

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


More information about the commits mailing list