From 110d2a9ed9673d4edd8b6f3067204d457d66de3f Mon Sep 17 00:00:00 2001 From: Hauke Hund Date: Thu, 19 Aug 2021 23:32:06 +0200 Subject: [PATCH] adds detection of milestone and release candidate process dependencies if a plugin defines a dependency to e.g. 'dsf-bpe-process-feasibility-0.5.0' the following jars will be used as dependencies in order: * dsf-bpe-process-feasibility-0.5.0.jar * dsf-bpe-process-feasibility-0.5.0-RC#.jar or dsf-bpe-process-feasibility-0.5.0-M#.jar where # is one or multiple numeric characters * dsf-bpe-process-feasibility-0.5.0-SNAPSHOT.jar fixes #234 --- .../bpe/plugin/ProcessPluginProviderImpl.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/org/highmed/dsf/bpe/plugin/ProcessPluginProviderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/org/highmed/dsf/bpe/plugin/ProcessPluginProviderImpl.java index d04755555..06d9a9cc8 100644 --- a/dsf-bpe/dsf-bpe-server/src/main/java/org/highmed/dsf/bpe/plugin/ProcessPluginProviderImpl.java +++ b/dsf-bpe/dsf-bpe-server/src/main/java/org/highmed/dsf/bpe/plugin/ProcessPluginProviderImpl.java @@ -16,6 +16,8 @@ import java.util.ServiceLoader; import java.util.ServiceLoader.Provider; import java.util.function.BinaryOperator; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -47,6 +49,9 @@ private static final class Pair public static final String FILE_DRAFT_SUFIX = "-SNAPSHOT.jar"; public static final String FOLDER_DRAFT_SUFIX = "-SNAPSHOT"; + public static final String RC_AND_M_PATTERN_STRING = "^(.+)((-RC[0-9]+)|(-M[0-9]+))\\.jar$"; + private static final Pattern RC_AND_M_PATTERN = Pattern.compile(RC_AND_M_PATTERN_STRING); + private static final Logger logger = LoggerFactory.getLogger(ProcessPluginProviderImpl.class); private final FhirContext fhirContext; @@ -247,6 +252,13 @@ private Stream findDefinition(Map fileNames = definitionsByJar.keySet().stream() + .filter(filename -> matchesReleaseCandidateMilestonePatternAndIsDependency(filename, dependency)) + .collect(Collectors.toList()); + if (fileNames.size() == 1) + return definitionsByJar.get(fileNames.get(0)).getJars().stream(); + ProcessPluginDefinitionAndClassLoader bySnapshotJar = definitionsByJar.get(dependency + "-SNAPSHOT.jar"); if (bySnapshotJar != null) return bySnapshotJar.getJars().stream(); @@ -254,6 +266,15 @@ private Stream findDefinition(Map dependencyJars) {