in src/main/java/org/apache/tomcat/jakartaee/MigrationCLI.java [52:112]
public static void main(String[] args) throws IOException {
// Defaults
System.setProperty("java.util.logging.SimpleFormatter.format", "%5$s%n");
Migration migration = new Migration();
// Process argumnets
List<String> arguments = new ArrayList<>(Arrays.asList(args));
// Process the custom log level if present
// Use an iterator so we can remove the log level argument if found
Iterator<String> iter = arguments.iterator();
while (iter.hasNext()) {
String argument = iter.next();
if (argument.startsWith(EXCLUDE_ARG)) {
iter.remove();
String exclude = argument.substring(EXCLUDE_ARG.length());
migration.addExclude(exclude);
} else if (argument.startsWith(LOGLEVEL_ARG)) {
iter.remove();
String logLevelName = argument.substring(LOGLEVEL_ARG.length());
Level level = null;
try {
level = Level.parse(logLevelName.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException iae) {
invalidArguments();
}
// Configure the explicit level
Logger.getGlobal().getParent().getHandlers()[0].setLevel(level);
Logger.getGlobal().getParent().setLevel(level);
} else if (argument.startsWith(PROFILE_ARG)) {
iter.remove();
String profileName = argument.substring(PROFILE_ARG.length());
try {
EESpecProfile profile = EESpecProfiles.valueOf(profileName.toUpperCase(Locale.ENGLISH));
migration.setEESpecProfile(profile);
} catch (IllegalArgumentException e) {
// Invalid profile value
invalidArguments();
}
} else if (argument.equals(ZIPINMEMORY_ARG)) {
iter.remove();
migration.setZipInMemory(true);
} else if (argument.equals(MATCHEXCLUDESPATH_ARG)) {
iter.remove();
migration.setMatchExcludesAgainstPathName(true);
}
}
if (arguments.size() != 2) {
invalidArguments();
}
String source = arguments.get(0);
String dest = arguments.get(1);
migration.setSource(new File(source));
migration.setDestination(new File(dest));
migration.execute();
}