From 2a86d49ab4572cd59ae3272f2e114cd051971ae9 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 30 Apr 2015 12:08:45 -0700 Subject: [PATCH] 465867 - Implement --skip-file-validation= + Adding --skip-file-validation= support --- .../org/eclipse/jetty/start/BaseBuilder.java | 27 ++++++++++++---- .../java/org/eclipse/jetty/start/Main.java | 6 ++++ .../java/org/eclipse/jetty/start/Module.java | 22 +++++++++++-- .../org/eclipse/jetty/start/StartArgs.java | 31 +++++++++++++++++++ 4 files changed, 78 insertions(+), 8 deletions(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/BaseBuilder.java b/jetty-start/src/main/java/org/eclipse/jetty/start/BaseBuilder.java index b284e297a4f..5b94d27b051 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/BaseBuilder.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/BaseBuilder.java @@ -198,10 +198,18 @@ public class BaseBuilder // skip ambiguous module continue; } - dirty |= builder.addModule(mod); - for (String file : mod.getFiles()) + + if (mod.isSkipFilesValidation()) { - files.add(new FileArg(mod,file)); + StartLog.debug("Skipping [files] validation on %s",mod.getName()); + } + else + { + dirty |= builder.addModule(mod); + for (String file : mod.getFiles()) + { + files.add(new FileArg(mod,file)); + } } } } @@ -211,10 +219,17 @@ public class BaseBuilder StartIniBuilder builder = new StartIniBuilder(this); for (Module mod : startIniModules) { - dirty |= builder.addModule(mod); - for (String file : mod.getFiles()) + if (mod.isSkipFilesValidation()) { - files.add(new FileArg(mod,file)); + StartLog.debug("Skipping [files] validation on %s",mod.getName()); + } + else + { + dirty |= builder.addModule(mod); + for (String file : mod.getFiles()) + { + files.add(new FileArg(mod,file)); + } } } } diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 80ffbcaf40a..be92129b7b6 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -308,6 +308,12 @@ public class Main args.setAllModules(modules); List activeModules = modules.getSelected(); + + for(String name: args.getSkipFileValidationModules()) + { + Module module = modules.get(name); + module.setSkipFilesValidation(true); + } // ------------------------------------------------------------ // 5) Lib & XML Expansion / Resolution diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java index 33d9a082e5f..b40ce6ba4c7 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java @@ -56,20 +56,28 @@ public class Module extends Node /** The file of the module */ private Path file; + /** The name of this Module (as a filesystem reference) */ private String fileRef; /** List of xml configurations for this Module */ private List xmls; + /** List of ini template lines */ private List defaultConfig; private boolean hasDefaultConfig = false; + /** List of library options for this Module */ private List libs; + /** List of files for this Module */ private List files; + /** Skip File Validation (default: false) */ + private boolean skipFilesValidation = false; + /** List of jvm Args */ private List jvmArgs; + /** License lines */ private List license; @@ -137,6 +145,11 @@ public class Module extends Node return files; } + public boolean isSkipFilesValidation() + { + return skipFilesValidation; + } + public String getFilesystemRef() { return fileRef; @@ -156,7 +169,7 @@ public class Module extends Node { return license; } - + public List getXmls() { return xmls; @@ -306,7 +319,12 @@ public class Module extends Node { throw new RuntimeException("Don't enable directly"); } - + + public void setSkipFilesValidation(boolean skipFilesValidation) + { + this.skipFilesValidation = skipFilesValidation; + } + @Override public String toString() { diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java index 850b1f392a0..6f2c4e3a839 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java @@ -73,16 +73,25 @@ public class StartArgs /** List of enabled modules */ private Set modules = new HashSet<>(); + + /** List of modules to skip [files] section validation */ + private Set skipFileValidationModules = new HashSet<>(); + /** Map of enabled modules to the source of where that activation occurred */ private Map> sources = new HashMap<>(); + /** Map of properties to where that property was declared */ private Map propertySource = new HashMap<>(); + /** List of all active [files] sections from enabled modules */ private List files = new ArrayList<>(); + /** List of all active [lib] sections from enabled modules */ private Classpath classpath; + /** List of all active [xml] sections from enabled modules */ private List xmls = new ArrayList<>(); + /** JVM arguments, found via commmand line and in all active [exec] sections from enabled modules */ private List jvmArgs = new ArrayList<>(); @@ -137,6 +146,12 @@ public class StartArgs private void addFile(Module module, String uriLocation) { + if(module.isSkipFilesValidation()) + { + StartLog.debug("Not validating %s [files] for %s",module,uriLocation); + return; + } + FileArg arg = new FileArg(module, uriLocation); if (!files.contains(arg)) { @@ -602,6 +617,11 @@ public class StartArgs { return properties; } + + public Set getSkipFileValidationModules() + { + return skipFileValidationModules; + } public List getSources(String module) { @@ -886,6 +906,17 @@ public class StartArgs enableModules(source,moduleNames); return; } + + // Skip [files] validation on a module + if (arg.startsWith("--skip-file-validation=")) + { + List moduleNames = Props.getValues(arg); + for (String moduleName : moduleNames) + { + skipFileValidationModules.add(moduleName); + } + return; + } // Create graphviz output of module graph if (arg.startsWith("--write-module-graph="))