[java-shib-profile] branch main updated: IDP-2311 Discuss ways of mitigating the plugin/module dependency issues
Rod Widdowson
rdw at steadingsoftware.com
Tue Sep 10 17:59:18 UTC 2024
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-shib-profile.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-profile.git;a=commit;h=c317b5c0e23912a71b3a201824d00806ae0ca522
The following commit(s) were added to refs/heads/main by this push:
new c317b5c IDP-2311 Discuss ways of mitigating the plugin/module dependency issues
c317b5c is described below
commit c317b5c0e23912a71b3a201824d00806ae0ca522
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Sep 10 18:54:32 2024 +0100
IDP-2311 Discuss ways of mitigating the plugin/module dependency issues
https://shibboleth.atlassian.net/browse/IDP-2311
Add a method to the plugin API to provide a location to look up module
dependencies.
---
.../java/net/shibboleth/profile/plugin/Plugin.java | 14 +++++++-
.../profile/plugin/PropertyDrivenPlugin.java | 41 +++++++++++++++++++++-
2 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/shib-profile-api/src/main/java/net/shibboleth/profile/plugin/Plugin.java b/shib-profile-api/src/main/java/net/shibboleth/profile/plugin/Plugin.java
index 5a3bd18..439d5fb 100644
--- a/shib-profile-api/src/main/java/net/shibboleth/profile/plugin/Plugin.java
+++ b/shib-profile-api/src/main/java/net/shibboleth/profile/plugin/Plugin.java
@@ -57,7 +57,19 @@ public interface Plugin<T extends Module> {
* @throws IOException if the resource construction failed.
*/
@Nonnull @Unmodifiable @NotLive List<URL> getUpdateURLs() throws IOException;
-
+
+ /** Return the places to look for information for the modules this plugin may require
+ * The format of the (property) file at this location is fixed.
+ * modules.id.plugin=PluginIdRequired
+ * modules.id.version=VersionOfPlugin
+ *
+ * @return Zero or more URLs
+ * @throws IOException if the resource construction failed.
+ */
+ default @Nonnull @Unmodifiable @NotLive List<URL> getModuleInfoSources() throws IOException {
+ return CollectionSupport.emptyList();
+ }
+
/** Return the major version, (as defined by the
* <a href="https://wiki.shibboleth.net/confluence/display/DEV/Java+Product+Version+Policy">
* Java Product Version Policy</a>.
diff --git a/shib-profile-api/src/main/java/net/shibboleth/profile/plugin/PropertyDrivenPlugin.java b/shib-profile-api/src/main/java/net/shibboleth/profile/plugin/PropertyDrivenPlugin.java
index c8f8137..a66d876 100644
--- a/shib-profile-api/src/main/java/net/shibboleth/profile/plugin/PropertyDrivenPlugin.java
+++ b/shib-profile-api/src/main/java/net/shibboleth/profile/plugin/PropertyDrivenPlugin.java
@@ -64,6 +64,9 @@ public abstract class PropertyDrivenPlugin<T extends Module> extends AbstractPlu
/** Prefix of property for plugin update URL. */
@Nonnull @NotEmpty public static final String PLUGIN_URL_PROPERTY = "plugin.url.";
+ /** Prefix of property for plugin module URL. */
+ @Nonnull @NotEmpty public static final String PLUGIN_MODULE_URL_PROPERTY = "plugin.module.url.";
+
/** Property for plugin's required modules. */
@Nonnull @NotEmpty public static final String PLUGIN_REQ_MODULES_PROPERTY = "plugin.modules.required";
@@ -100,6 +103,9 @@ public abstract class PropertyDrivenPlugin<T extends Module> extends AbstractPlu
/** Plugin update URLs. */
@Nonnull private List<URL> updateURLs = CollectionSupport.emptyList();
+ /** Module source URLs. */
+ @Nonnull private List<URL> moduleSourceURLs = CollectionSupport.emptyList();
+
/** Required modules. */
@Nonnull private Set<String> requiredModules = CollectionSupport.emptySet();
@@ -165,7 +171,7 @@ public abstract class PropertyDrivenPlugin<T extends Module> extends AbstractPlu
throw new PluginException(e);
}
- final List<URL> urls = new ArrayList<>();
+ List<URL> urls = new ArrayList<>();
for (Integer urlnum = 1; ; ++urlnum) {
@@ -183,6 +189,24 @@ public abstract class PropertyDrivenPlugin<T extends Module> extends AbstractPlu
urls.addAll(getDefaultUpdateURLs());
updateURLs = CollectionSupport.copyToList(urls);
+ urls.clear();
+
+ for (Integer urlnum = 1; ; ++urlnum) {
+
+ final String urlstr = pluginProperties.getProperty(PLUGIN_MODULE_URL_PROPERTY + urlnum.toString());
+ if (urlstr == null) {
+ break;
+ }
+
+ try {
+ urls.add(new URL(urlstr));
+ } catch (final MalformedURLException e) {
+ log.error("Unable to convert property value '{}' to URL", urlstr, e);
+ }
+ }
+ urls.addAll(getDefaultModuleInfoSources());
+
+ moduleSourceURLs = CollectionSupport.copyToList(urls);
final String propVals = pluginProperties.getProperty(PLUGIN_REQ_MODULES_PROPERTY, "");
assert propVals != null;
@@ -234,6 +258,11 @@ public abstract class PropertyDrivenPlugin<T extends Module> extends AbstractPlu
return updateURLs;
}
+ /** {@inheritDoc} */
+ @Nonnull @Unmodifiable @NotLive public List<URL> getModuleInfoSources() {
+ return moduleSourceURLs;
+ }
+
/** {@inheritDoc} */
@Override
@Nonnull @Unmodifiable @NotLive public Set<String> getRequiredModules() {
@@ -274,6 +303,16 @@ public abstract class PropertyDrivenPlugin<T extends Module> extends AbstractPlu
return CollectionSupport.emptyList();
}
+ /**
+ * Provides default module info locations to use.
+ *
+ * @return default module locations
+ * @throws PluginException if a derived class throws it (see derived classes)
+ */
+ @Nonnull @Unmodifiable @NotLive protected List<URL> getDefaultModuleInfoSources() throws PluginException {
+ return CollectionSupport.emptyList();
+ }
+
/** Implementation of {@link Plugin.Package} for our use. */
private static class PackageDescriptor implements Package {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list