From a3965633403fbf90b8abf14ab8bc77552d8a8acd Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 22 Aug 2013 14:52:02 -0700 Subject: [PATCH] 414635 Modular start.d and jetty.base property + More work on startup of real jetty server. --- jetty-distribution/pom.xml | 2 +- .../src/main/resources/start.d/demo.ini | 2 -- jetty-jsp/pom.xml | 19 +++++++++++++++++++ jetty-jsp/src/main/config/modules/jsp.mod | 8 ++++++++ .../java/org/eclipse/jetty/start/Main.java | 19 ++++++++----------- .../org/eclipse/jetty/start/StartArgs.java | 18 ++++++++++++++++++ .../src/main/config/modules/jndi.demo.mod | 10 ++++++++++ 7 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 jetty-jsp/src/main/config/modules/jsp.mod create mode 100644 tests/test-webapps/test-jetty-webapp/src/main/config/modules/jndi.demo.mod diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index c008de54ed0..502eba080c3 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -298,7 +298,7 @@ org.eclipse.jetty org.eclipse.jetty.orbit,org.eclipse.jetty.spdy,org.eclipse.jetty.websocket,org.eclipse.jetty.toolchain - jetty-all,jetty-start,jetty-monitor + jetty-all,jetty-jsp,jetty-start,jetty-monitor jar ${assembly-directory}/lib diff --git a/jetty-distribution/src/main/resources/start.d/demo.ini b/jetty-distribution/src/main/resources/start.d/demo.ini index 037e743f2c9..bffdd8c0c54 100644 --- a/jetty-distribution/src/main/resources/start.d/demo.ini +++ b/jetty-distribution/src/main/resources/start.d/demo.ini @@ -10,7 +10,5 @@ jaas.login.conf=webapps.demo/test-jaas.d/login.conf # Activate the demo options and configurations MODULES=jndi.demo -etc/jetty-demo.xml -etc/test-realm.xml diff --git a/jetty-jsp/pom.xml b/jetty-jsp/pom.xml index b8067b473a4..04fa8c5d340 100644 --- a/jetty-jsp/pom.xml +++ b/jetty-jsp/pom.xml @@ -10,6 +10,25 @@ http://www.eclipse.org/jetty jar + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + + config + + + + + + diff --git a/jetty-jsp/src/main/config/modules/jsp.mod b/jetty-jsp/src/main/config/modules/jsp.mod new file mode 100644 index 00000000000..d24dddf44d5 --- /dev/null +++ b/jetty-jsp/src/main/config/modules/jsp.mod @@ -0,0 +1,8 @@ +# +# Jetty Servlet Module +# + +DEPEND=servlet + +LIB=lib/jsp/*.jar + 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 060eeba4837..c23bae2eb01 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 @@ -263,9 +263,9 @@ public class Main // TODO } - private void listModules() + private void listModules(StartArgs args) { - // TODO Auto-generated method stub + args.getAllModules().dump(); } public StartArgs processCommandLine(String[] cmdLine) throws Exception @@ -336,6 +336,7 @@ public class Main StartLog.debug("Building Module Graph"); modules.buildGraph(); + args.setAllModules(modules); List activeModules = modules.resolveEnabled(); // 7) Lib & XML Expansion / Resolution @@ -352,11 +353,6 @@ public class Main return baseHome; } - private void showAllOptionsWithVersions() - { - // TODO - } - private void showClasspathWithVersions(Classpath classpath) { // Iterate through active classpath, and fetch Implementation Version from each entry (if present) @@ -378,19 +374,20 @@ public class Main int i = 0; for (File element : classpath.getElements()) { - System.out.printf("%2d: %20s | %s\n",i++,getVersion(element),baseHome.toShortForm(element)); + System.out.printf("%2d: %24s | %s\n",i++,getVersion(element),baseHome.toShortForm(element)); } } public void start(StartArgs args) throws IOException, InterruptedException { + StartLog.debug("StartArgs: %s",args); + // Get Desired Classpath based on user provided Active Options. Classpath classpath = args.getClasspath(); System.setProperty("java.class.path",classpath.toString()); ClassLoader cl = classpath.getClassLoader(); - StartLog.debug("java.class.path=" + System.getProperty("java.class.path")); StartLog.debug("jetty.home=" + System.getProperty("jetty.home")); StartLog.debug("jetty.base=" + System.getProperty("jetty.base")); StartLog.debug("java.home=" + System.getProperty("java.home")); @@ -407,7 +404,7 @@ public class Main } // Show the version information and return - if (args.isVersion()) + if (args.isListClasspath()) { showClasspathWithVersions(classpath); } @@ -421,7 +418,7 @@ public class Main // Show modules if (args.isListModules()) { - listModules(); + listModules(args); } // Show Command Line to execute Jetty 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 9eb8a5ff81c..a52b3b5424e 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 @@ -71,6 +71,7 @@ public class StartArgs private Properties properties = new Properties(); private Set systemPropertyKeys = new HashSet<>(); private List jvmArgs = new ArrayList<>(); + private Modules allModules; // Should the server be run? private boolean run = true; @@ -207,6 +208,11 @@ public class StartArgs } } + public Modules getAllModules() + { + return allModules; + } + public Classpath getClasspath() { return classpath; @@ -415,6 +421,13 @@ public class StartArgs run = false; return; } + + if ("--list-modules".equals(arg)) + { + listModules = true; + run = false; + return; + } if ("--dry-run".equals(arg) || "--exec-print".equals(arg)) { @@ -550,6 +563,11 @@ public class StartArgs } } + public void setAllModules(Modules allModules) + { + this.allModules = allModules; + } + @Override public String toString() { diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/modules/jndi.demo.mod b/tests/test-webapps/test-jetty-webapp/src/main/config/modules/jndi.demo.mod new file mode 100644 index 00000000000..20f7807991f --- /dev/null +++ b/tests/test-webapps/test-jetty-webapp/src/main/config/modules/jndi.demo.mod @@ -0,0 +1,10 @@ +# +# Jetty Demo Module +# + +DEPEND=jndi + +LIB=lib/jndi.demo/*.jar + +etc/test-realm.xml +