From 68e86e4d4efe9a285eacb7496eac5ea31c130e91 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 14 Oct 2016 10:48:51 +1100 Subject: [PATCH] Deprecated Modules #1003 Added deprecated.properties file to provide more details of deprecated modules --- .../resources/modules/deprecated.properties | 8 ++++++ .../java/org/eclipse/jetty/start/Modules.java | 27 +++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 jetty-home/src/main/resources/modules/deprecated.properties diff --git a/jetty-home/src/main/resources/modules/deprecated.properties b/jetty-home/src/main/resources/modules/deprecated.properties new file mode 100644 index 00000000000..d128ab80fc8 --- /dev/null +++ b/jetty-home/src/main/resources/modules/deprecated.properties @@ -0,0 +1,8 @@ +gcloud-memcached-sessions : replaced by 'session-store-cache,session-store-gcloud' +gcloud-session-idmgr : no longer required. +gcloud-sessions : replaced by 'session-store-gcloud' +infinispan : replaced by either 'session-store-infinispan-embedded' or 'session-store-infinispan-remote' +jdbc-sessions : replaced by 'session-store-jdbc' +logging : renamed to 'stderrout-capture' +monitor : no longer supported +nosql : replaced by 'session-store-mongo' \ No newline at end of file diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java index e648719260d..d4a25087363 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java @@ -18,6 +18,7 @@ package org.eclipse.jetty.start; +import java.io.FileInputStream; import java.io.IOException; import java.nio.file.Path; import java.util.ArrayList; @@ -27,6 +28,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Properties; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; @@ -44,6 +46,7 @@ public class Modules implements Iterable private final Map> _provided = new HashMap<>(); private final BaseHome _baseHome; private final StartArgs _args; + private final Properties _deprecated = new Properties(); public Modules(BaseHome basehome, StartArgs args) { @@ -59,6 +62,19 @@ public class Modules implements Iterable args.setProperty("java.version",java_version,""); } } + + try + { + Path deprecated_path = _baseHome.getPath("modules/deprecated.properties"); + if (deprecated_path!=null && FS.exists(deprecated_path)) + { + _deprecated.load(new FileInputStream(deprecated_path.toFile())); + } + } + catch (IOException e) + { + StartLog.debug(e); + } } public void dump(List tags) @@ -260,7 +276,7 @@ public class Modules implements Iterable { Module module = get(name); if (module==null) - throw new UsageException(UsageException.ERR_UNKNOWN,"Unknown module='%s'",name); + throw new UsageException(UsageException.ERR_UNKNOWN,"Unknown module='%s. List available with --list-modules",name); Set enabled = new HashSet<>(); enable(enabled,module,enabledFrom,false); @@ -354,7 +370,14 @@ public class Modules implements Iterable public Module get(String name) { - return _names.get(name); + Module module = _names.get(name); + if (module==null) + { + String reason = _deprecated.getProperty(name); + if (reason!=null) + StartLog.warn("Deprecated module '%s' is %s",name,reason); + } + return module; } @Override