[java-identity-provider] branch main updated: Rename main plugin interface and classes.

Scott Cantor cantor.2 at osu.edu
Thu Oct 1 16:05:30 UTC 2020


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=084f72403e12a8ea01e55d3c577c34fc376192a6

The following commit(s) were added to refs/heads/main by this push:
       new  084f72403 Rename main plugin interface and classes.
084f72403 is described below

commit 084f72403e12a8ea01e55d3c577c34fc376192a6
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Oct 1 12:05:27 2020 -0400

    Rename main plugin interface and classes.
---
 ...ctPluginDescription.java => AbstractIdPPlugin.java} | 12 +++++++-----
 .../plugin/{PluginDescription.java => IdPPlugin.java}  | 18 ++++++++----------
 .../java/net/shibboleth/idp/plugin/PluginSupport.java  | 12 ++++++------
 .../idp/installer/plugin/impl/PluginInstaller.java     | 18 +++++++++---------
 .../idp/installer/plugin/impl/PluginInstallerCLI.java  | 14 +++++++-------
 .../idp/installer/plugin/impl/PluginState.java         |  6 +++---
 .../idp/installer/plugin/impl/PluginInstallerTest.java |  8 ++++----
 .../idp/installer/plugin/impl/PluginStateTest.java     |  6 +++---
 .../idp/installer/plugin/impl/TestPlugin.java          |  4 ++--
 ...Description => net.shibboleth.idp.plugin.IdPPlugin} |  0
 10 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/AbstractPluginDescription.java b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/AbstractIdPPlugin.java
similarity index 77%
rename from idp-admin-api/src/main/java/net/shibboleth/idp/plugin/AbstractPluginDescription.java
rename to idp-admin-api/src/main/java/net/shibboleth/idp/plugin/AbstractIdPPlugin.java
index e3bc3c8fd..c3b5134c1 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/AbstractPluginDescription.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/AbstractIdPPlugin.java
@@ -26,20 +26,21 @@ import java.util.List;
 import javax.annotation.Nonnegative;
 import javax.annotation.Nonnull;
 
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.collection.Pair;
 
 /**
- * A base class {@link PluginDescription} which defaults many common settings.
+ * A base class implementing {@link IdPPlugin} that defaults common settings.
  */
-public abstract class AbstractPluginDescription implements PluginDescription {
+public abstract class AbstractIdPPlugin implements IdPPlugin {
     
     /** {@inheritDoc} */
-    @Nonnull public List<Path> getFilePathsToCopy() {
+    @Nonnull @NonnullElements public List<Path> getFilePathsToCopy() {
         return Collections.emptyList();
     }
     
     /** {@inheritDoc} */
-    @Nonnull public List<Pair<URL, Path>> getExternalFilePathsToCopy() throws IOException {
+    @Nonnull @NonnullElements public List<Pair<URL, Path>> getExternalFilePathsToCopy() throws IOException {
         return Collections.emptyList();
     }
     
@@ -47,4 +48,5 @@ public abstract class AbstractPluginDescription implements PluginDescription {
     @Nonnegative public int getPatchVersion() {
         return 0;
     }
-}
+
+}
\ No newline at end of file
diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginDescription.java b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/IdPPlugin.java
similarity index 87%
rename from idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginDescription.java
rename to idp-admin-api/src/main/java/net/shibboleth/idp/plugin/IdPPlugin.java
index ede655044..aa61eddb9 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginDescription.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/IdPPlugin.java
@@ -27,13 +27,12 @@ import javax.annotation.Nonnull;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-import net.shibboleth.utilities.java.support.annotation.constraint.Positive;
 import net.shibboleth.utilities.java.support.collection.Pair;
 
 /**
  * This interface is exported (via the service API) by every IdP plugin.
  */
-public interface PluginDescription {
+public interface IdPPlugin {
     
     /** Return the unique identifier for the plugin.  This name <em>MUST</em> be
      * <ul>
@@ -44,7 +43,7 @@ public interface PluginDescription {
      *
      * @return The id of this plugin.
      */
-    @Nonnull @NotEmpty public String getPluginId();
+    @Nonnull @NotEmpty String getPluginId();
 
     /** Return the list of (idp.home) relative paths (of files, <em>not directories </em>) 
      * to copy from the distribution into the IdP installation.
@@ -59,7 +58,7 @@ public interface PluginDescription {
      *
      * @return The list of paths.
      */
-    @Nonnull public List<Path> getFilePathsToCopy();
+    @Nonnull @NonnullElements List<Path> getFilePathsToCopy();
     
     /** <p>Return the list of files <em>not directories </em> to get from 'external'
      * sources. This allows external content to be downloaded during installation.</p>
@@ -72,7 +71,7 @@ public interface PluginDescription {
      * @return The list.
      * @throws IOException if the resource construction failed.
      */
-    @Nonnull public List<Pair<URL, Path>> getExternalFilePathsToCopy() throws IOException;
+    @Nonnull @NonnullElements List<Pair<URL, Path>> getExternalFilePathsToCopy() throws IOException;
 
     /** Return the places to look for information for this plugin package.
      * The format of the (property) file at this location is fixed.
@@ -80,27 +79,26 @@ public interface PluginDescription {
      * @return Zero or more URLs
      * @throws IOException if the resource construction failed.
      */
-    @Nonnull @NonnullElements public List<URL> getUpdateURLs() throws IOException;
+    @Nonnull @NonnullElements List<URL> getUpdateURLs() throws IOException;
     
     /** 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>.
      * @return The major version.
      */
-    @Positive public int getMajorVersion();
+    @Nonnegative int getMajorVersion();
 
     /** Return the minor version, (as defined by the 
      * <a href="https://wiki.shibboleth.net/confluence/display/DEV/Java+Product+Version+Policy">
      * Java Product Version Policy</a>.
      * @return The minor version.
      */
-    @Nonnegative public int getMinorVersion();
+    @Nonnegative int getMinorVersion();
     
     /** Return The patch version, (as defined by the 
      * <a href="https://wiki.shibboleth.net/confluence/display/DEV/Java+Product+Version+Policy">
      * Java Product Version Policy</a>.
      * @return The patch version.
      */
-    @Nonnegative public int getPatchVersion();
-    
+    @Nonnegative int getPatchVersion();
 }
diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java
index 672596669..88fddfe60 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PluginSupport.java
@@ -29,22 +29,22 @@ import net.shibboleth.idp.Version;
  */
 public final class PluginSupport {
     
-    /** Property Name suffix for available versions inside {@link PluginDescription#getUpdateURLs()}. */
+    /** Property Name suffix for available versions inside {@link IdPPlugin#getUpdateURLs()}. */
     @Nonnull public static final String AVAILABLE_VERSIONS_PROPERTY_SUFFIX = ".versions";
 
-    /** Property Name for Download directory {@link PluginDescription#getUpdateURLs()}. */
+    /** Property Name for Download directory {@link IdPPlugin#getUpdateURLs()}. */
     @Nonnull public static final String DOWNLOAD_URL_INTERFIX = ".downloadURL.";
 
-    /** Property Name for download name {@link PluginDescription#getUpdateURLs()}. */
+    /** Property Name for download name {@link IdPPlugin#getUpdateURLs()}. */
     @Nonnull public static final String BASE_NAME_INTERFIX = ".baseName.";
 
-    /** Property Name for max supported IdP version inside inside {@link PluginDescription#getUpdateURLs()}. */
+    /** Property Name for max supported IdP version inside inside {@link IdPPlugin#getUpdateURLs()}. */
     @Nonnull public static final String MAX_IDP_VERSION_INTERFIX = ".idpVersionMax.";
 
-    /** Property Name for minimum supported IdP version inside inside {@link PluginDescription#getUpdateURLs()}. */
+    /** Property Name for minimum supported IdP version inside inside {@link IdPPlugin#getUpdateURLs()}. */
     @Nonnull public static final String MIN_IDP_VERSION_INTERFIX = ".idpVersionMin.";
 
-    /** Property Name for support level inside inside {@link PluginDescription#getUpdateURLs()}. */
+    /** Property Name for support level inside inside {@link IdPPlugin#getUpdateURLs()}. */
     @Nonnull public static final String SUPPORT_LEVEL_INTERFIX = ".supportLevel.";
 
     /** Value for support level pointed to by {@link #SUPPORT_LEVEL_INTERFIX}.*/
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
index 814793e54..ae06a1d37 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
@@ -65,7 +65,7 @@ import net.shibboleth.idp.installer.BuildWar;
 import net.shibboleth.idp.installer.InstallerSupport;
 import net.shibboleth.idp.installer.ProgressReportingOutputStream;
 import net.shibboleth.idp.installer.plugin.impl.TrustStore.Signature;
-import net.shibboleth.idp.plugin.PluginDescription;
+import net.shibboleth.idp.plugin.IdPPlugin;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.collection.Pair;
@@ -102,7 +102,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
     private Path downloadDirectory;
     
     /** The plugin's story about itself. */
-    private PluginDescription description;
+    private IdPPlugin description;
 
     /** The callback before we install a certificate into the TrustStore. */
     @Nonnull private Predicate<String> acceptCert = Predicates.alwaysFalse();
@@ -316,7 +316,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
         }
     }
 
-    /** Get hold of the {@link PluginDescription} for this plugin.
+    /** Get hold of the {@link IdPPlugin} for this plugin.
      * @throws BuildException if badness is happens.
      */
     private void getDescription() throws BuildException {
@@ -329,13 +329,13 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
             }
            try (final URLClassLoader loader = new URLClassLoader(urls.toArray(URL[]::new))){
 
-               final ServiceLoader<PluginDescription> plugins = ServiceLoader.load(PluginDescription.class, loader);
-               final Optional<PluginDescription> first = plugins.findFirst();
+               final ServiceLoader<IdPPlugin> plugins = ServiceLoader.load(IdPPlugin.class, loader);
+               final Optional<IdPPlugin> first = plugins.findFirst();
                if (first.isEmpty()) {
                    LOG.error("No Plugin services found in plugin distribution");
                    throw new BuildException("No Plugin services found in plugin distribution");
                }
-               for (final PluginDescription plugin:plugins) {
+               for (final IdPPlugin plugin:plugins) {
                    LOG.debug("Found Service announcing itself as {}", plugin.getPluginId() );
                    if (pluginId.equals(plugin.getPluginId())) {
                        description = plugin;
@@ -648,7 +648,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
      * Return a list of the installed plugins.
      * @return All the plugins.
      */
-    public List<PluginDescription> getInstalledPlugins() {
+    public List<IdPPlugin> getInstalledPlugins() {
         try {
             final List<URL> urls = new ArrayList<>();
 
@@ -664,8 +664,8 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
                 }
             }
             try (final URLClassLoader loader = new URLClassLoader(urls.toArray(URL[]::new))){
-               try (final Stream<Provider<PluginDescription>> loaderStream =
-                       ServiceLoader.load(PluginDescription.class, loader).stream()) {
+               try (final Stream<Provider<IdPPlugin>> loaderStream =
+                       ServiceLoader.load(IdPPlugin.class, loader).stream()) {
                    return loaderStream.map(ServiceLoader.Provider::get).collect(Collectors.toList());
                }
            }
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 a3f32a7e3..8b075f549 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
@@ -40,7 +40,7 @@ import net.shibboleth.ext.spring.cli.AbstractCommandLine;
 import net.shibboleth.idp.Version;
 import net.shibboleth.idp.cli.AbstractIdPHomeAwareCommandLine;
 import net.shibboleth.idp.installer.plugin.impl.PluginState.VersionInfo;
-import net.shibboleth.idp.plugin.PluginDescription;
+import net.shibboleth.idp.plugin.IdPPlugin;
 import net.shibboleth.idp.plugin.PluginSupport.SupportLevel;
 import net.shibboleth.idp.plugin.PluginVersion;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
@@ -180,7 +180,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
      * Helper method for {@link #doList(boolean, String)}
      * @param plugin what we are interested in.
      */
-    private void printDetails(final PluginDescription plugin) {
+    private void printDetails(final IdPPlugin plugin) {
         log.debug("Interrogating {} ", plugin.getPluginId());
         final PluginState state =  new PluginState(plugin);
         if (getHttpClient() != null) {
@@ -216,8 +216,8 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
      */
     private void doList(final boolean fullList, @Nullable final String pluginId) {
         boolean list = false;
-        final List<PluginDescription> plugins = installer.getInstalledPlugins();
-        for (final PluginDescription plugin: plugins) {
+        final List<IdPPlugin> plugins = installer.getInstalledPlugins();
+        for (final IdPPlugin plugin: plugins) {
             if (pluginId == null || pluginId.equals(plugin.getPluginId())) {
                 list = true;
                 System.out.println(String.format("Plugin: %-22s\tCurrent Version: %d.%d.%d",
@@ -242,7 +242,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
      * @param state all about the plugin
      * @return the best version (or null)
      */
-    @Nullable private PluginVersion getBestVersion(final PluginDescription plugin, final PluginState state) {
+    @Nullable private PluginVersion getBestVersion(final IdPPlugin plugin, final PluginState state) {
 
         final String idpVersionString = net.shibboleth.idp.Version.getVersion();
         final PluginVersion myVersion = new PluginVersion(plugin.getMajorVersion(),
@@ -290,8 +290,8 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
      * @param pluginVersion (optionally) the version to update to.
      */
     private void doUpdate(@Nonnull final String pluginId, @Nullable final PluginVersion pluginVersion) {
-        final List<PluginDescription> plugins = installer.getInstalledPlugins();
-        for (final PluginDescription plugin: plugins) {
+        final List<IdPPlugin> plugins = installer.getInstalledPlugins();
+        for (final IdPPlugin plugin: plugins) {
             if (pluginId.equals(plugin.getPluginId())) {
                 log.debug("Interrogating {} ", plugin.getPluginId());
                 final PluginState state =  new PluginState(plugin);
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java
index e876e2348..7723fc3c0 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java
@@ -36,7 +36,7 @@ import org.springframework.core.io.FileSystemResource;
 import org.springframework.core.io.Resource;
 
 import net.shibboleth.ext.spring.resource.HTTPResource;
-import net.shibboleth.idp.plugin.PluginDescription;
+import net.shibboleth.idp.plugin.IdPPlugin;
 import net.shibboleth.idp.plugin.PluginSupport;
 import net.shibboleth.idp.plugin.PluginSupport.SupportLevel;
 import net.shibboleth.idp.plugin.PluginVersion;
@@ -60,7 +60,7 @@ public class PluginState extends AbstractInitializableComponent {
     private static final Pattern SPACE_CONTAINING = Pattern.compile("\\s+");
 
     /** The plug in in question. */
-    @Nonnull private final PluginDescription plugin;
+    @Nonnull private final IdPPlugin plugin;
     
     /** The version of this plugin. */
     @Nonnull private final PluginVersion myPluginVersion;
@@ -85,7 +85,7 @@ public class PluginState extends AbstractInitializableComponent {
      *
      * @param description what we are talking about.
      */
-    public PluginState(@Nonnull final PluginDescription description) {
+    public PluginState(@Nonnull final IdPPlugin description) {
         plugin = Constraint.isNotNull(description, "Plugin must not be null");
         myPluginVersion = new PluginVersion(plugin.getMajorVersion(), 
                 plugin.getMinorVersion(), plugin.getPatchVersion());
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerTest.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerTest.java
index b9c59a4fe..28a9269a9 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerTest.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerTest.java
@@ -35,8 +35,8 @@ import org.slf4j.LoggerFactory;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import net.shibboleth.idp.plugin.AbstractPluginDescription;
-import net.shibboleth.idp.plugin.PluginDescription;
+import net.shibboleth.idp.plugin.AbstractIdPPlugin;
+import net.shibboleth.idp.plugin.IdPPlugin;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 
 @SuppressWarnings("javadoc")
@@ -69,7 +69,7 @@ public class PluginInstallerTest extends BasePluginTest {
         try (final PluginInstaller inst = new PluginInstaller()) {
             inst.setIdpHome(getIdpHome());
             inst.initialize();
-            final Map<String, Object> result = inst.getInstalledPlugins().stream().collect(Collectors.toMap(PluginDescription::getPluginId,
+            final Map<String, Object> result = inst.getInstalledPlugins().stream().collect(Collectors.toMap(IdPPlugin::getPluginId,
                     e->e));
             
             assertTrue(result.containsKey("org.example.Plugin"));
@@ -124,7 +124,7 @@ public class PluginInstallerTest extends BasePluginTest {
     }
 
 
-    public static class Wibble extends AbstractPluginDescription {
+    public static class Wibble extends AbstractIdPPlugin {
 
         /** {@inheritDoc} */
         public String getPluginId() {
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginStateTest.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginStateTest.java
index 9636c5720..b58f6e429 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginStateTest.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginStateTest.java
@@ -29,7 +29,7 @@ import java.util.List;
 
 import org.testng.annotations.Test;
 
-import net.shibboleth.idp.plugin.PluginDescription;
+import net.shibboleth.idp.plugin.IdPPlugin;
 import net.shibboleth.idp.plugin.PluginVersion;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 
@@ -47,7 +47,7 @@ public class PluginStateTest {
     @Test
     public void testSimple() throws ComponentInitializationException {
 
-        final PluginDescription simple = new TestPlugin();
+        final IdPPlugin simple = new TestPlugin();
         
         final PluginState state = new PluginState(simple);
         
@@ -88,7 +88,7 @@ public class PluginStateTest {
     @Test
     public void testMulti() throws IOException, Exception {
 
-        final PluginDescription simple = new TestPlugin() {
+        final IdPPlugin simple = new TestPlugin() {
             @Override
             public java.util.List<URL> getUpdateURLs() {
                 try {
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TestPlugin.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TestPlugin.java
index fa709b474..14600c972 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TestPlugin.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TestPlugin.java
@@ -24,12 +24,12 @@ import java.util.List;
 
 import org.springframework.core.io.ClassPathResource;
 
-import net.shibboleth.idp.plugin.AbstractPluginDescription;
+import net.shibboleth.idp.plugin.AbstractIdPPlugin;
 
 /**
  *
  */
-public class TestPlugin extends AbstractPluginDescription {
+public class TestPlugin extends AbstractIdPPlugin {
 
     /** {@inheritDoc} */
     @Override
diff --git a/idp-installer/src/test/resources/META-INF/services/net.shibboleth.idp.plugin.PluginDescription b/idp-installer/src/test/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin
similarity index 100%
rename from idp-installer/src/test/resources/META-INF/services/net.shibboleth.idp.plugin.PluginDescription
rename to idp-installer/src/test/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin

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


More information about the commits mailing list