Issue #984 Improve module listing

This commit is contained in:
Greg Wilkins 2016-10-06 17:01:08 +11:00
parent 9148678dad
commit 91e9e7b76a
68 changed files with 384 additions and 61 deletions

View File

@ -1,6 +1,10 @@
[description]
Enables GCloud Datastore API and implementation
[Tags]
3rdparty
gcloud
[depends]
gcloud
jcl-api

View File

@ -1,6 +1,10 @@
[description]
Control GCloud API classpath
[Tags]
3rdparty
gcloud
[files]
basehome:modules/gcloud/gcloud.xml|etc/gcloud.xml

View File

@ -1,6 +1,10 @@
[description]
Enables GCloudDatastore session management.
[Tags]
session
gcloud
[provides]
session-store

View File

@ -1,6 +1,9 @@
[description]
Deploys the Hawtio console as a webapplication.
[Tags]
3rdparty
[depend]
stats
deploy

View File

@ -1,6 +1,9 @@
[description]
Deploys the JAMon webapplication
[Tags]
3rdparty
[depend]
stats
deploy

View File

@ -1,6 +1,9 @@
[description]
Deploys the Jminix JMX Console within the server
[Tags]
3rdparty
[depend]
stats
jmx

View File

@ -1,6 +1,9 @@
[description]
Deploys the Jolokia console as a web application.
[Tags]
3rdparty
[depend]
stats
deploy

View File

@ -2,6 +2,12 @@
Enables HTTP2 protocol support on the TLS(SSL) Connector,
using the ALPN extension to select which protocol to use.
[Tags]
connector
http2
http
ssl
[depend]
ssl
alpn

View File

@ -2,6 +2,11 @@
Enables the HTTP2C protocol on the HTTP Connector
The connector will accept both HTTP/1 and HTTP/2 connections.
[Tags]
connector
http2
http
[depend]
http

View File

@ -1,6 +1,9 @@
[description]
Enables session data store in a local Infinispan cache
[Tags]
session
[provides]
session-store

View File

@ -1,6 +1,9 @@
[description]
Enables session data store in a remote Infinispan cache
[Tags]
session
[provides]
session-store

View File

@ -1,6 +1,9 @@
[description]
Memcache cache for SessionData
[Tags]
session
[depends]
session-store
slf4j-api

View File

@ -1,6 +1,9 @@
[description]
Enables NoSql session management with a MongoDB driver.
[Tags]
session
[provides]
session-store

View File

@ -3,6 +3,9 @@ Enables the DebugListener to generate additional
logging regarding detailed request handling events.
Renames threads to include request URI.
[Tags]
debug
[depend]
deploy

View File

@ -2,6 +2,9 @@
Deprecated Debug Log using the DebugHandle.
Replaced with the debug module.
[Tags]
debug
[depend]
server

View File

@ -2,6 +2,9 @@
Adds all jar files discovered in $JETTY_HOME/lib/ext
and $JETTY_BASE/lib/ext to the servers classpath.
[Tags]
classpath
[lib]
lib/ext/**.jar

View File

@ -2,6 +2,9 @@
Enable GzipHandler for dynamic gzip compression
for the entire server.
[Tags]
handler
[depend]
server

View File

@ -2,6 +2,9 @@
Adds a forwarded request customizer to the HTTP Connector
to process forwarded-for style headers from a proxy.
[Tags]
connector
[depend]
http

View File

@ -3,6 +3,10 @@ Enables a HTTP connector on the server.
By default HTTP/1 is support, but HTTP2C can
be added to the connector with the http2c module.
[Tags]
connector
http
[depend]
server

View File

@ -1,6 +1,12 @@
[description]
Adds HTTPS protocol support to the TLS(SSL) Connector
[Tags]
connector
https
http
ssl
[depend]
ssl

View File

@ -2,6 +2,9 @@
Enable the ipaccess handler to apply a white/black list
control of the remote IP of requests.
[Tags]
handler
[depend]
server

View File

@ -1,6 +1,7 @@
[description]
A noop module that creates an ini template useful for
setting JVM arguments (eg -Xmx )
[ini-template]
## JVM Configuration
## If JVM args are include in an ini file then --exec is needed

View File

@ -1,6 +1,11 @@
[description]
Enables logback request log.
[Tags]
requestlog
logging
logback
[depend]
server
logback-core

View File

@ -5,6 +5,10 @@ This allows a Proxy operating in TCP mode to transport
details of the proxied connection to the server.
Both V1 and V2 versions of the protocol are supported.
[Tags]
connector
ssl
[depend]
ssl

View File

@ -1,6 +1,9 @@
[description]
Enables a NCSA style request log.
[Tags]
requestlog
[depend]
server

View File

@ -3,6 +3,9 @@ Adds the $JETTY_HOME/resources and/or $JETTY_BASE/resources
directory to the server classpath. Useful for configuration
property files (eg jetty-logging.properties)
[Tags]
classpath
[lib]
resources/

View File

@ -4,6 +4,9 @@ If not enabled, sessions will use a HashSessionCache by default, so enabling
via this module is only needed if the configuration properties need to be
changed.
[Tags]
session
[provides]
session-cache

View File

@ -1,6 +1,9 @@
[description]
A trivial SessionCache that does not actually cache sessions.
[Tags]
session
[provides]
session-cache

View File

@ -1,6 +1,9 @@
[description]
Enables caching of SessionData in front of a SessionDataStore.
[Tags]
session
[depend]
session-store

View File

@ -1,6 +1,9 @@
[description]
Enables session persistent storage in files.
[Tags]
session
[provides]
session-store

View File

@ -1,6 +1,9 @@
[description]
Enables JDBC peristent/distributed session storage.
[Tags]
session
[provides]
session-store

View File

@ -5,6 +5,9 @@ created or by enabling other session-cache or session-store
modules. Without this module enabled, the server may still
use sessions, but their management cannot be configured.
[Tags]
session
[depends]
server

View File

@ -3,6 +3,10 @@ Enables a TLS(SSL) Connector on the server.
This may be used for HTTPS and/or HTTP2 by enabling
the associated support modules.
[Tags]
connector
ssl
[depend]
server

View File

@ -2,6 +2,9 @@
Enable detailed statistics collection for the server,
available via JMX.
[Tags]
handler
[depend]
server

View File

@ -3,6 +3,9 @@
# Applies ThreadLimiteHandler to entire server
#
[Tags]
handler
[depend]
server

View File

@ -243,16 +243,19 @@ public class Main
public void listModules(StartArgs args)
{
List<String> tags = args.getListModules();
StartLog.endStartLog();
System.out.println();
System.out.println("Jetty All Available Modules:");
System.out.println("----------------------------");
args.getAllModules().dump();
System.out.println("Available Modules:");
System.out.println("==================");
System.out.println("tags: "+tags);
args.getAllModules().dump(tags);
// Dump Enabled Modules
System.out.println();
System.out.println("Jetty Selected Module Ordering:");
System.out.println("-------------------------------");
System.out.println("Enabled Modules:");
System.out.println("================");
Modules modules = args.getAllModules();
modules.dumpEnabled();
}
@ -381,7 +384,7 @@ public class Main
}
// Show modules
if (args.isListModules())
if (args.getListModules()!=null)
{
listModules(args);
}

View File

@ -55,7 +55,7 @@ import java.util.stream.Collectors;
* A module may be enabled, either directly by name or transiently via a dependency
* from another module by name or provided capability.
*/
public class Module
public class Module implements Comparable<Module>
{
private static final String VERSION_UNSPECIFIED = "9.2";
private static Pattern MOD_NAME = Pattern.compile("^(.*)\\.mod",Pattern.CASE_INSENSITIVE);
@ -96,6 +96,9 @@ public class Module
/** List of provides for this Module */
private final Set<String> _provides=new HashSet<>();
/** List of tags for this Module */
private final List<String> _tags=new ArrayList<>();
/** Boolean true if directly enabled, false if all selections are transitive */
private boolean _notTransitive;
@ -328,6 +331,10 @@ public class Module
case "FILES":
_files.add(line);
break;
case "TAG":
case "TAGS":
_tags.add(line);
break;
case "DEFAULTS": // old name introduced in 9.2.x
case "INI": // new name for 9.3+
_defaultConfig.add(line);
@ -446,6 +453,16 @@ public class Module
return _description;
}
public List<String> getTags()
{
return _tags;
}
public String getPrimaryTag()
{
return _tags.isEmpty()?"*":_tags.get(0);
}
public boolean isEnabled()
{
return !_enables.isEmpty();
@ -504,4 +521,13 @@ public class Module
out.println();
out.flush();
}
@Override
public int compareTo(Module m)
{
int by_tag = getPrimaryTag().compareTo(m.getPrimaryTag());
if (by_tag!=0)
return by_tag;
return getName().compareTo(m.getName());
}
}

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -30,10 +31,13 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.hamcrest.core.StringStartsWith;
/**
* Access for all modules declared, as well as what is enabled.
*/
@ -57,38 +61,71 @@ public class Modules implements Iterable<Module>
}
}
public void dump()
public void dump(List<String> tags)
{
List<String> ordered = _modules.stream().map(m->{return m.getName();}).collect(Collectors.toList());
Collections.sort(ordered);
ordered.stream().map(n->{return get(n);}).forEach(module->
Set<String> exclude = tags.stream().filter(t->t.startsWith("-")).map(t->t.substring(1)).collect(Collectors.toSet());
Set<String> include = tags.stream().filter(t->!t.startsWith("-")).collect(Collectors.toSet());
boolean all = include.contains("*") || include.isEmpty();
AtomicReference<String> tag = new AtomicReference<>();
_modules.stream()
.filter(m->
{
String status = "[ ]";
if (module.isTransitive())
boolean included = all || m.getTags().stream().anyMatch(t->include.contains(t));
boolean excluded = m.getTags().stream().anyMatch(t->exclude.contains(t));
return included && !excluded;
})
.sorted()
.forEach(module->
{
status = "[t]";
}
else if (module.isEnabled())
if (!module.getPrimaryTag().equals(tag.get()))
{
status = "[x]";
tag.set(module.getPrimaryTag());
System.out.printf("%nModules for tag '%s':%n",module.getPrimaryTag());
System.out.print("-------------------");
for (int i=module.getPrimaryTag().length();i-->0;)
System.out.print("-");
System.out.println();
}
System.out.printf("%n %s Module: %s%n",status,module.getName());
if (module.getProvides().size()>1)
{
System.out.printf(" Provides: %s%n",module.getProvides());
}
String label;
Set<String> provides = module.getProvides();
provides.remove(module.getName());
System.out.printf("%n Module: %s %s%n",module.getName(),provides.size()>0?provides:"");
for (String description : module.getDescription())
{
System.out.printf(" : %s%n",description);
}
if (!module.getTags().isEmpty())
{
label=" Tags: %s";
for (String t : module.getTags())
{
System.out.printf(label,t);
label=", %s";
}
System.out.println();
}
if (!module.getDepends().isEmpty())
{
label=" Depend: %s";
for (String parent : module.getDepends())
{
System.out.printf(" Depend: %s%n",parent);
System.out.printf(label,parent);
label=", %s";
}
for (String optional : module.getOptional())
System.out.println();
}
if (!module.getOptional().isEmpty())
{
System.out.printf(" Optional: %s%n",optional);
label=" Optional: %s";
for (String parent : module.getOptional())
{
System.out.printf(label,parent);
label=", %s";
}
System.out.println();
}
for (String lib : module.getLibs())
{

View File

@ -170,7 +170,7 @@ public class StartArgs
private boolean help = false;
private boolean stopCommand = false;
private boolean listModules = false;
private List<String> listModules = null;
private boolean listClasspath = false;
private boolean listConfig = false;
private boolean version = false;
@ -750,7 +750,7 @@ public class StartArgs
return listConfig;
}
public boolean isListModules()
public List<String> getListModules()
{
return listModules;
}
@ -873,7 +873,7 @@ public class StartArgs
if (arg.equals("--create-files"))
{
run = false;
download = true;
download = true;boolean
licenseCheckRequired = true;
return;
}
@ -938,10 +938,25 @@ public class StartArgs
return;
}
// Module Management
if ("--list-all-modules".equals(arg))
{
listModules = Collections.singletonList("*");
run = false;
return;
}
// Module Management
if ("--list-modules".equals(arg))
{
listModules = true;
listModules = Collections.singletonList("-verbose");
run = false;
return;
}
if (arg.startsWith("--list-modules="))
{
listModules = Props.getValues(arg);
run = false;
return;
}

View File

@ -59,7 +59,7 @@ Debug and Start Logging:
Module Management:
------------------
--list-modules List all modules defined by the system.
--list-modules List non verbose modules defined by the system.
Looking for module files in ${jetty.base}/modules/*.mod and
then ${jetty.home}/modules/*.mod
Will also list enabled state based on information
@ -68,6 +68,13 @@ Module Management:
o The ${jetty.base}/start.ini
o The ${jetty.base}/start.d/*.ini files
--list-modules=<tag>(,<tag>)*
List modules by tag. Use '*' for all tags. Prefix a tag
with '-' to exclude the tag.
--list-all-modules
List all modules.
--module=<modulename>(,<modulename>)*
Temporarily enable a module from the command line.
Note: this can also be used in the ${jetty.base}/start.ini

View File

@ -4,6 +4,9 @@ by the Unix Domain Socket connector, for use when behind a proxy operating
in HTTP mode that adds forwarded-for style HTTP headers. Typically this
is an alternate to the Proxy Protocol used mostly for TCP mode.
[Tags]
connector
[depend]
unixsocket-http

View File

@ -4,6 +4,10 @@ It should be used when a proxy is forwarding either HTTP or decrypted
HTTPS traffic to the connector and may be used with the
unix-socket-http2c modules to upgrade to HTTP/2.
[Tags]
connector
http
[depend]
unixsocket

View File

@ -3,6 +3,10 @@ Adds a HTTP2C connetion factory to the Unix Domain Socket Connector
It can be used when either the proxy forwards direct
HTTP/2C (unecrypted) or decrypted HTTP/2 traffic.
[Tags]
connector
http2
[depend]
unixsocket-http

View File

@ -8,6 +8,9 @@ SSL properties may be interpreted by the unixsocket-secure
module to indicate secure HTTPS traffic. Typically this
is an alternate to the forwarded module.
[Tags]
connector
[depend]
unixsocket

View File

@ -5,6 +5,9 @@ This looks for a secure scheme transported either by the
unixsocket-forwarded, unixsocket-proxy-protocol or in a
HTTP2 request.
[Tags]
connector
[depend]
unixsocket-http

View File

@ -7,6 +7,9 @@ needless fragmentation and have better dispatch behaviours.
When enabled with corresponding support modules, the connector can
accept HTTP, HTTPS or HTTP2C traffic.
[Tags]
connector
[depend]
server

View File

@ -2,6 +2,11 @@
Provides a Java Commons Logging implementation that logs to the SLF4J API.
Requires another module that provides and SLF4J implementation.
[tags]
logging
jcl
slf4j
[depends]
slf4j-api

View File

@ -2,6 +2,10 @@
Provides a Java Commons Logging implementation.
To receive jetty logs the jetty-slf4j and slf4j-jcl must also be enabled.
[tags]
logging
jcl
[depends]
[provides]

View File

@ -2,6 +2,9 @@
Provides a Jetty Logging implementation that logs to the Java Util Logging API.
Requires another module that provides a Java Util Logging implementation.
[tags]
logging
[provide]
logging

View File

@ -3,6 +3,10 @@ Provides a Jetty Logging implementation that logs to the log4j API.
Uses the slf4j mechanism as an intermediary
Requires another module that provides an log4j implementation.
[tags]
logging
log4j
[depend]
jetty-slf4j
slf4j-log4j

View File

@ -3,6 +3,11 @@ Provides a Jetty Logging implementation that logs to the log4j API.
Uses the slf4j and log4j v1.2 mechanisms as intermediaries.
Requires another module that provides an log4j2 implementation.
[tags]
logging
log4j2
log4j
[depend]
jetty-slf4j
slf4j-log4j2

View File

@ -2,6 +2,9 @@
Provides a Jetty Logging implementation that logs to logback.
Uses the slf4j API as an intermediary
[tags]
logging
[depend]
jetty-slf4j
slf4j-logback

View File

@ -2,6 +2,9 @@
Enables the Jetty Logging implementation and installs a template
configuration in ${jetty.base} resources/jetty-logging.properties.
[tags]
logging
[depends]
resources

View File

@ -2,6 +2,10 @@
Provides a Jetty Logging implementation that logs to the SLF4J API.
Requires another module that provides and SLF4J implementation.
[tags]
logging
slf4j
[depend]
slf4j-api
slf4j-impl

View File

@ -3,6 +3,11 @@ Provides a Log4j v1.2 implementation that logs to the Log4j v2 API.
Requires another module that provides and Log4j v2 implementation.
To receive jetty logs the jetty-slf4j and slf4j-log4j must also be enabled.
[tags]
logging
log4j2
log4j
[depends]
log4j2-api
log4j2-impl

View File

@ -2,6 +2,10 @@
Provides a Log4j v1.2 API and implementation.
To receive jetty logs enable the jetty-slf4j and slf4j-log4j modules.
[tags]
logging
log4j
[depends]
resources

View File

@ -3,6 +3,12 @@ Provides the Log4j v2 API
Requires another module that provides an Log4j v2 implementation.
To receive jetty logs enable the jetty-slf4j, slf4j-log4j and log4j-log4j2 modules.
[tags]
logging
log4j2
log4j
verbose
[files]
maven://org.apache.logging.log4j/log4j-api/${log4j2.version}|lib/log4j/log4j-api-${log4j2.version}.jar

View File

@ -2,6 +2,11 @@
Provides a Log4j v2 implementation.
To receive jetty logs enable the jetty-slf4j, slf4j-log4j and log4j-log4j2 modules.
[tags]
logging
log4j2
log4j
[depends]
log4j2-api
resources

View File

@ -3,6 +3,12 @@ Provides a Log4j v2 implementation that logs to the SLF4J API.
Requires another module that provides and SLF4J implementation.
To receive jetty logs enable the jetty-slf4j module.
[tags]
logging
log4j2
log4j
slf4j
[depends]
log4j2-api
slf4j-api

View File

@ -2,6 +2,9 @@
Provides the logback core implementation, used by slf4j-logback
and logback-access
[tags]
logging
[files]
maven://ch.qos.logback/logback-core/${logback.version}|lib/logback/logback-core-${logback.version}.jar

View File

@ -2,6 +2,11 @@
Provides SLF4J API. Requires a slf4j implementation (eg slf4j-simple)
otherwise a noop implementation is used.
[tags]
logging
slf4j
verbose
[files]
maven://org.slf4j/slf4j-api/${slf4j.version}|lib/slf4j/slf4j-api-${slf4j.version}.jar

View File

@ -3,6 +3,11 @@ Provides a SLF4J implementation that logs to the Java Commons Logging API.
Requires another module that provides an JCL implementation.
To receive jetty logs enable the jetty-slf4j module.
[tags]
logging
jcl
slf4j
[depend]
slf4j-api
jcl-api

View File

@ -2,6 +2,10 @@
Provides a SLF4J implementation that logs to the Java Util Logging API.
To receive jetty logs enable the jetty-slf4j module.
[tags]
logging
slf4j
[depend]
slf4j-api

View File

@ -3,6 +3,11 @@ Provides a SLF4J implementation that logs to the Log4j v1.2 API.
Requires another module that provides a Log4j implementation.
To receive jetty logs enable the jetty-slf4j module.
[tags]
logging
log4j
slf4j
[depend]
slf4j-api
log4j-api

View File

@ -3,6 +3,12 @@ Provides a SLF4J implementation that logs to the Log4j v2 API.
Requires another module that provides a Log4j2 implementation.
To receive jetty logs enable the jetty-slf4j2 module.
[tags]
logging
log4j2
log4j
slf4j
[depend]
slf4j-api
log4j2-api

View File

@ -2,6 +2,10 @@
Provides a SLF4J implementation that logs to Logback classic
To receive jetty logs enable the jetty-slf4j module.
[tags]
logging
slf4j
[depend]
slf4j-api
logback-core

View File

@ -2,6 +2,10 @@
Provides SLF4J simple logging implementation.
To receive jetty logs enable the jetty-slf4j module.
[tags]
logging
slf4j
[depend]
slf4j-api

View File

@ -2,6 +2,9 @@
Redirects JVMs stderr and stdout to a log file,
including output from Jetty's default StdErrLog logging.
[tags]
logging
[xml]
etc/stderrout-logging.xml