[java-identity-provider] branch main updated: IDP-2223 - Version added to plugin module filenames is incorrect

Scott Cantor cantor.2 at osu.edu
Thu Jan 11 13:48:49 UTC 2024


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

scantor 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=7f0118f76371ac13429858bed5acc261f70774db

The following commit(s) were added to refs/heads/main by this push:
     new 7f0118f76 IDP-2223 - Version added to plugin module filenames is incorrect
7f0118f76 is described below

commit 7f0118f76371ac13429858bed5acc261f70774db
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jan 11 08:48:43 2024 -0500

    IDP-2223 - Version added to plugin module filenames is incorrect
    
    https://shibboleth.atlassian.net/browse/IDP-2223
    
    Add constructors so modules can override the version.
    Deprecate the original constructor the modules use now.
    Add notes to make various classes abstract and move to protected c'tors.
---
 .../idp/module/PropertyDrivenIdPModule.java        | 51 +++++++++++++++++++++-
 .../idp/module/impl/PluginIdPModule.java           | 18 ++++++++
 2 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/module/PropertyDrivenIdPModule.java b/idp-admin-api/src/main/java/net/shibboleth/idp/module/PropertyDrivenIdPModule.java
index ca0539043..50d349622 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/module/PropertyDrivenIdPModule.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/module/PropertyDrivenIdPModule.java
@@ -27,13 +27,15 @@ import net.shibboleth.profile.module.PropertyDrivenModule;
 /**
  * Implementation of {@link IdPModule} relying on Java {@link Properties}.
  * 
+ * TODO: Make abstract in V6 and make all constructors protected. 
+ * 
  * @since 4.1.0
  */
 public class PropertyDrivenIdPModule extends PropertyDrivenModule implements IdPModule {
 
     /**
      * Constructor.
-     *
+     * 
      * @param claz type of object used to locate default module.properties resource
      * 
      * @throws IOException if unable to read file
@@ -67,6 +69,53 @@ public class PropertyDrivenIdPModule extends PropertyDrivenModule implements IdP
         super(Version.getVersion(), properties);
     }
 
+    /**
+     * Constructor for version-overriding subclasses.
+     *
+     * @param version overridden version
+     * @param claz type of object used to locate default module.properties resource
+     * 
+     * @throws IOException if unable to read file
+     * @throws ModuleException if the module is not in a valid state
+     * 
+     * @since 5.1.0
+     */
+    protected PropertyDrivenIdPModule(@Nonnull final String version, @Nonnull final Class<? extends IdPModule> claz)
+            throws IOException, ModuleException {
+        this(version, claz.getResourceAsStream(DEFAULT_RESOURCE));
+    }
+    
+    /**
+     * Constructor for version-overriding subclasses.
+     *
+     * @param version overridden version
+     * @param inputStream property stream
+     * 
+     * @throws IOException if unable to read file
+     * @throws ModuleException if the module is not in a valid state
+     * 
+     * @since 5.1.0
+     */
+    protected PropertyDrivenIdPModule(@Nonnull final String version, @Nonnull final InputStream inputStream)
+            throws IOException, ModuleException {
+        super(version, inputStream);
+    }
+
+    /**
+     * Constructor for version-overriding subclasses.
+     *
+     * @param version overridden version
+     * @param properties property set
+     * 
+     * @throws ModuleException if the module is not in a valid state
+     * 
+     * @since 5.1.0
+     */
+    protected PropertyDrivenIdPModule(@Nonnull final String version, @Nonnull final Properties properties)
+            throws ModuleException {
+        super(version, properties);
+    }
+
     /** {@inheritDoc} */
     @Override
     @Nonnull public String getSaveExtension() {
diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/PluginIdPModule.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/PluginIdPModule.java
index 0059dc876..742384b2d 100644
--- a/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/PluginIdPModule.java
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/module/impl/PluginIdPModule.java
@@ -28,6 +28,7 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
  * produced by the Shibboleth Project ourselves and for which the documentation
  * will be in the wiki in a fixed location.
  * 
+ * TODO: Make abstract in V6 and make all constructors protected. 
  */
 public class PluginIdPModule extends PropertyDrivenIdPModule {
 
@@ -42,10 +43,27 @@ public class PluginIdPModule extends PropertyDrivenIdPModule {
      * 
      * @throws IOException if an I/O error occurs
      * @throws ModuleException if a generic error occurs
+     * 
+     * @deprecated
      */
+    @Deprecated(forRemoval=true, since="5.1.0")
     public PluginIdPModule(@Nonnull final Class<? extends IdPModule> claz) throws IOException, ModuleException {
         super(claz);
     }
+    
+    /**
+     * Constructor for concrete modules.
+     *
+     * @param version version of plugin
+     * @param claz implementation class of the module
+     * 
+     * @throws IOException if an I/O error occurs
+     * @throws ModuleException if a generic error occurs
+     */
+    protected PluginIdPModule(@Nonnull final String version, @Nonnull final Class<? extends IdPModule> claz)
+            throws IOException, ModuleException {
+        super(version, claz);
+    }
 
     /**
      * {@inheritDoc}

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


More information about the commits mailing list