diff --git a/plugwerk-java-cli-example/plugwerk-java-cli-example-app/src/main/java/io/plugwerk/example/cli/command/UpdateCommand.java b/plugwerk-java-cli-example/plugwerk-java-cli-example-app/src/main/java/io/plugwerk/example/cli/command/UpdateCommand.java index 33e0a15..2815bee 100644 --- a/plugwerk-java-cli-example/plugwerk-java-cli-example-app/src/main/java/io/plugwerk/example/cli/command/UpdateCommand.java +++ b/plugwerk-java-cli-example/plugwerk-java-cli-example-app/src/main/java/io/plugwerk/example/cli/command/UpdateCommand.java @@ -18,11 +18,9 @@ import io.plugwerk.example.cli.DynamicCommandLoader; import io.plugwerk.example.cli.PlugwerkCli; import io.plugwerk.spi.extension.PlugwerkMarketplace; +import io.plugwerk.spi.model.InstalledPluginRef; import io.plugwerk.spi.model.UpdateInfo; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import org.pf4j.PluginWrapper; import picocli.CommandLine.Command; import picocli.CommandLine.Option; import picocli.CommandLine.ParentCommand; @@ -54,12 +52,11 @@ public class UpdateCommand implements Runnable { public void run() { PlugwerkMarketplace marketplace = parent.getMarketplace(); - // Build a map of installed plugin ID → current version from PF4J plugin manager - Map installed = + // Collect installed plugin id+version pairs from the PF4J plugin manager + List installed = parent.getPluginManager().getPlugins().stream() - .collect( - Collectors.toMap( - PluginWrapper::getPluginId, pw -> pw.getDescriptor().getVersion())); + .map(pw -> new InstalledPluginRef(pw.getPluginId(), pw.getDescriptor().getVersion())) + .toList(); if (installed.isEmpty()) { System.out.println("No plugins currently installed."); diff --git a/plugwerk-springboot-thymeleaf-example/src/main/java/io/plugwerk/example/webapp/controller/PluginInstalledController.java b/plugwerk-springboot-thymeleaf-example/src/main/java/io/plugwerk/example/webapp/controller/PluginInstalledController.java index 0005f6d..dd44bdd 100644 --- a/plugwerk-springboot-thymeleaf-example/src/main/java/io/plugwerk/example/webapp/controller/PluginInstalledController.java +++ b/plugwerk-springboot-thymeleaf-example/src/main/java/io/plugwerk/example/webapp/controller/PluginInstalledController.java @@ -18,6 +18,7 @@ import io.plugwerk.example.webapp.config.PluginContributionRegistry; import io.plugwerk.spi.PlugwerkPlugin; import io.plugwerk.spi.extension.PlugwerkMarketplace; +import io.plugwerk.spi.model.InstalledPluginRef; import io.plugwerk.spi.model.UpdateInfo; import java.util.List; import java.util.Map; @@ -69,11 +70,10 @@ public String installed(Model model) { // Check for available updates if the marketplace is configured if (marketplace != null && !plugins.isEmpty()) { try { - Map installed = + List installed = plugins.stream() - .collect( - Collectors.toMap( - PluginWrapper::getPluginId, p -> p.getDescriptor().getVersion())); + .map(p -> new InstalledPluginRef(p.getPluginId(), p.getDescriptor().getVersion())) + .toList(); List updates = marketplace.updateChecker().checkForUpdates(installed); Map updateMap = updates.stream()