414635 Modular start.d and jetty.base property

+ More work on startup of real jetty server.
This commit is contained in:
Joakim Erdfelt 2013-08-22 14:52:02 -07:00
parent b8e1f42b37
commit a396563340
7 changed files with 64 additions and 14 deletions

View File

@ -298,7 +298,7 @@
<configuration> <configuration>
<includeGroupIds>org.eclipse.jetty</includeGroupIds> <includeGroupIds>org.eclipse.jetty</includeGroupIds>
<excludeGroupIds>org.eclipse.jetty.orbit,org.eclipse.jetty.spdy,org.eclipse.jetty.websocket,org.eclipse.jetty.toolchain</excludeGroupIds> <excludeGroupIds>org.eclipse.jetty.orbit,org.eclipse.jetty.spdy,org.eclipse.jetty.websocket,org.eclipse.jetty.toolchain</excludeGroupIds>
<excludeArtifactIds>jetty-all,jetty-start,jetty-monitor</excludeArtifactIds> <excludeArtifactIds>jetty-all,jetty-jsp,jetty-start,jetty-monitor</excludeArtifactIds>
<includeTypes>jar</includeTypes> <includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib</outputDirectory> <outputDirectory>${assembly-directory}/lib</outputDirectory>
</configuration> </configuration>

View File

@ -10,7 +10,5 @@ jaas.login.conf=webapps.demo/test-jaas.d/login.conf
# Activate the demo options and configurations # Activate the demo options and configurations
MODULES=jndi.demo MODULES=jndi.demo
etc/jetty-demo.xml
etc/test-realm.xml

View File

@ -10,6 +10,25 @@
<url>http://www.eclipse.org/jetty</url> <url>http://www.eclipse.org/jetty</url>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>config</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build> </build>
<dependencies> <dependencies>

View File

@ -0,0 +1,8 @@
#
# Jetty Servlet Module
#
DEPEND=servlet
LIB=lib/jsp/*.jar

View File

@ -263,9 +263,9 @@ public class Main
// TODO // TODO
} }
private void listModules() private void listModules(StartArgs args)
{ {
// TODO Auto-generated method stub args.getAllModules().dump();
} }
public StartArgs processCommandLine(String[] cmdLine) throws Exception public StartArgs processCommandLine(String[] cmdLine) throws Exception
@ -336,6 +336,7 @@ public class Main
StartLog.debug("Building Module Graph"); StartLog.debug("Building Module Graph");
modules.buildGraph(); modules.buildGraph();
args.setAllModules(modules);
List<Module> activeModules = modules.resolveEnabled(); List<Module> activeModules = modules.resolveEnabled();
// 7) Lib & XML Expansion / Resolution // 7) Lib & XML Expansion / Resolution
@ -352,11 +353,6 @@ public class Main
return baseHome; return baseHome;
} }
private void showAllOptionsWithVersions()
{
// TODO
}
private void showClasspathWithVersions(Classpath classpath) private void showClasspathWithVersions(Classpath classpath)
{ {
// Iterate through active classpath, and fetch Implementation Version from each entry (if present) // Iterate through active classpath, and fetch Implementation Version from each entry (if present)
@ -378,19 +374,20 @@ public class Main
int i = 0; int i = 0;
for (File element : classpath.getElements()) 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 public void start(StartArgs args) throws IOException, InterruptedException
{ {
StartLog.debug("StartArgs: %s",args);
// Get Desired Classpath based on user provided Active Options. // Get Desired Classpath based on user provided Active Options.
Classpath classpath = args.getClasspath(); Classpath classpath = args.getClasspath();
System.setProperty("java.class.path",classpath.toString()); System.setProperty("java.class.path",classpath.toString());
ClassLoader cl = classpath.getClassLoader(); 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.home=" + System.getProperty("jetty.home"));
StartLog.debug("jetty.base=" + System.getProperty("jetty.base")); StartLog.debug("jetty.base=" + System.getProperty("jetty.base"));
StartLog.debug("java.home=" + System.getProperty("java.home")); StartLog.debug("java.home=" + System.getProperty("java.home"));
@ -407,7 +404,7 @@ public class Main
} }
// Show the version information and return // Show the version information and return
if (args.isVersion()) if (args.isListClasspath())
{ {
showClasspathWithVersions(classpath); showClasspathWithVersions(classpath);
} }
@ -421,7 +418,7 @@ public class Main
// Show modules // Show modules
if (args.isListModules()) if (args.isListModules())
{ {
listModules(); listModules(args);
} }
// Show Command Line to execute Jetty // Show Command Line to execute Jetty

View File

@ -71,6 +71,7 @@ public class StartArgs
private Properties properties = new Properties(); private Properties properties = new Properties();
private Set<String> systemPropertyKeys = new HashSet<>(); private Set<String> systemPropertyKeys = new HashSet<>();
private List<String> jvmArgs = new ArrayList<>(); private List<String> jvmArgs = new ArrayList<>();
private Modules allModules;
// Should the server be run? // Should the server be run?
private boolean run = true; private boolean run = true;
@ -207,6 +208,11 @@ public class StartArgs
} }
} }
public Modules getAllModules()
{
return allModules;
}
public Classpath getClasspath() public Classpath getClasspath()
{ {
return classpath; return classpath;
@ -415,6 +421,13 @@ public class StartArgs
run = false; run = false;
return; return;
} }
if ("--list-modules".equals(arg))
{
listModules = true;
run = false;
return;
}
if ("--dry-run".equals(arg) || "--exec-print".equals(arg)) 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 @Override
public String toString() public String toString()
{ {

View File

@ -0,0 +1,10 @@
#
# Jetty Demo Module
#
DEPEND=jndi
LIB=lib/jndi.demo/*.jar
etc/test-realm.xml