This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
The following commit(s) were added to refs/heads/master by this push: new 2b642ba Improvements 2b642ba is described below commit 2b642ba552011240095ab706f9c31e289267ace6 Author: remm <r...@apache.org> AuthorDate: Tue Mar 17 10:25:56 2020 +0100 Improvements The name should be profile rather than level. Use a nicer command line argument. Try to include all the Jakarta EE packages that are available at geronimo-jakarta in the EE pattern. --- .../org/apache/tomcat/jakartaee/Migration.java | 18 ++++++----- .../java/org/apache/tomcat/jakartaee/Util.java | 37 ++++++++++++++++------ .../tomcat/jakartaee/LocalStrings.properties | 4 +-- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java b/src/main/java/org/apache/tomcat/jakartaee/Migration.java index a7e2f0c..734ebd8 100644 --- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java +++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java @@ -230,19 +230,22 @@ public class Migration { } } + private static final String PROFILE_ARG = "-profile="; public static void main(String[] args) { boolean valid = false; String source = null; String dest = null; - Util.EESpecLevel level = Util.EESpecLevel.TOMCAT; if (args.length == 3) { - if (args[0].startsWith("-level")) { - level = Util.EESpecLevel.valueOf(args[0].substring("-level".length())); - if (level != null) { - source = args[1]; - dest = args[2]; - valid = true; + if (args[0].startsWith(PROFILE_ARG)) { + source = args[1]; + dest = args[2]; + valid = true; + try { + Util.setEESpecProfile(args[0].substring(PROFILE_ARG.length())); + } catch (IllegalArgumentException e) { + // Invalid profile value + valid = false; } } } @@ -255,7 +258,6 @@ public class Migration { usage(); System.exit(1); } - Util.setEESpecLevel(level); Migration migration = new Migration(); migration.setSource(new File(source)); migration.setDestination(new File(dest)); diff --git a/src/main/java/org/apache/tomcat/jakartaee/Util.java b/src/main/java/org/apache/tomcat/jakartaee/Util.java index 9bc0712..2a2ae81 100644 --- a/src/main/java/org/apache/tomcat/jakartaee/Util.java +++ b/src/main/java/org/apache/tomcat/jakartaee/Util.java @@ -22,29 +22,46 @@ import java.util.regex.Pattern; public class Util { - public enum EESpecLevel { TOMCAT, EE }; + public enum EESpecProfile { TOMCAT, EE }; private static final Pattern TOMCAT_PATTERN = Pattern.compile( "javax([/\\.](annotation|ejb|el|mail|persistence|security[/\\.]auth[/\\.]message|servlet|transaction|websocket))"); private static final Pattern EE_PATTERN = Pattern.compile( - "javax([/\\.](annotation|decorator|ejb|el|enterprise|inject|mail|persistence|security[/\\.]auth[/\\" - + ".]message|servlet|transaction|websocket))"); + "javax([/\\.](activation|annotation|decorator|ejb|el|enterprise|json|interceptor|inject|mail|persistence|" + + "security[/\\.]auth[/\\.]message|servlet|transaction|validation|websocket|ws[/\\.]rs|" + + "xml[/\\.](bind|namespace|rpc|soap|stream|ws|XMLConstants)))"); - private static EESpecLevel level = EESpecLevel.TOMCAT; + private static EESpecProfile profile = EESpecProfile.TOMCAT; private static Pattern pattern = TOMCAT_PATTERN; - public static void setEESpecLevel(EESpecLevel level) { - Util.level = level; - if (level == EESpecLevel.TOMCAT) { + /** + * Set the Jakarta EE specifications that should be used. + * @param profile the Jakarta EE specification profile + */ + public static void setEESpecProfile(String profile) { + setEESpecProfile(EESpecProfile.valueOf(profile)); + } + + /** + * Set the Jakarta EE specifications that should be used. + * @param profile the Jakarta EE specification profile + */ + public static void setEESpecProfile(EESpecProfile profile) { + Util.profile = profile; + if (profile == EESpecProfile.TOMCAT) { pattern = TOMCAT_PATTERN; - } else if (level == EESpecLevel.EE) { + } else if (profile == EESpecProfile.EE) { pattern = EE_PATTERN; } } - public static EESpecLevel getEESpecLevel() { - return level; + /** + * Get the Jakarta EE profile being used. + * @return the profile + */ + public static EESpecProfile getEESpecLevel() { + return profile; } /** diff --git a/src/main/resources/org/apache/tomcat/jakartaee/LocalStrings.properties b/src/main/resources/org/apache/tomcat/jakartaee/LocalStrings.properties index f7b8e03..f1c0e85 100644 --- a/src/main/resources/org/apache/tomcat/jakartaee/LocalStrings.properties +++ b/src/main/resources/org/apache/tomcat/jakartaee/LocalStrings.properties @@ -18,10 +18,10 @@ migration.cannotReadSource=Cannot read source location [{0}] migration.done=Migration completed successfully [{1}] in [{0}] milliseconds migration.entry=Migrating Jar entry [{0}] migration.error=Error performing migration -migration.execute=Performing migration from source [{0}] to destination [{1}] with EE specification level [{2}] +migration.execute=Performing migration from source [{0}] to destination [{1}] with Jakarta EE specification profile [{2}] migration.mkdirError=Error creating destination directory [{0}] migration.removeSignature=Remove cryptographic signature for [{0}] migration.skipSignatureFile=Drop cryptographic signature file [{0}] migration.stream=Migrating stream [{0}] -migration.usage=Usage: Migration [-levelTOMCAT|-levelEE] <source> <destination> +migration.usage=Usage: Migration [-profile=TOMCAT|-profile=EE] <source> <destination> migration.warnSignatureRemoval=Removed cryptographic signature from JAR file \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org