Added discoverable start options

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@707 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-08-13 01:30:40 +00:00
parent e9c6245eb6
commit 50fc3906aa
7 changed files with 109 additions and 66 deletions

View File

@ -1,5 +1,6 @@
jetty-7.0.0.RC4-SNAPSHOT
+ 286185 Implement ability for JSON implementation to automatically register convertors
+ Added discoverable start options
jetty-7.0.0.RC3 7 August 2009
+ 277403 remove system properties

View File

@ -44,13 +44,13 @@
dest="${assembly.directory}/lib/servlet-api-2.5.jar"
usetimestamp="true"
verbose="true" />
<mkdir dir="${assembly.directory}/lib/jetty-jndi"/>
<mkdir dir="${assembly.directory}/lib/jndi"/>
<get src="http://download.eclipse.org/tools/orbit/downloads/drops/R20090529135407/bundles/javax.activation_1.1.0.v200905021805.jar"
dest="${assembly.directory}/lib/jetty-jndi/activation-1.1.jar"
dest="${assembly.directory}/lib/jndi/activation-1.1.jar"
usetimestamp="true"
verbose="true" />
<get src="http://download.eclipse.org/tools/orbit/downloads/drops/R20090529135407/bundles/javax.mail_1.4.0.v200905040518.jar"
dest="${assembly.directory}/lib/jetty-jndi/mail-1.4.jar"
dest="${assembly.directory}/lib/jndi/mail-1.4.jar"
usetimestamp="true"
verbose="true" />
</tasks>
@ -341,7 +341,7 @@
<type>jar</type>
<overWrite>true</overWrite>
<includes>**</includes>
<outputDirectory>${assembly.directory}/lib/security</outputDirectory>
<outputDirectory>${assembly.directory}/lib</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty</groupId>
@ -384,53 +384,43 @@
</artifactItems>
</configuration>
</execution>
<execution>
<!--
<execution>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>${mail-version}</version>
<outputDirectory>${assembly.directory}/lib/jetty-jndi</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>${activation-version}</version>
<outputDirectory>${assembly.directory}/lib/jetty-jndi</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.0_spec</artifactId>
<version>1.1.1</version>
<outputDirectory>${assembly.directory}/lib/jetty-annotations</outputDirectory>
<outputDirectory>${assembly.directory}/lib/annotations</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>asm</groupId>
<artifactId>asm-commons</artifactId>
<version>3.1</version>
<outputDirectory>${assembly.directory}/lib/jetty-annotations</outputDirectory>
<outputDirectory>${assembly.directory}/lib/annotations</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.1</version>
<outputDirectory>${assembly.directory}/lib/jetty-annotations</outputDirectory>
<outputDirectory>${assembly.directory}/lib/annotations</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>asm</groupId>
<artifactId>asm-tree</artifactId>
<version>3.1</version>
<outputDirectory>${assembly.directory}/lib/jetty-annotations</outputDirectory>
<outputDirectory>${assembly.directory}/lib/annotations</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
-->
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -196,9 +196,7 @@ public class Config
{
Classpath cp = _classpaths.get(section);
if (cp == null)
{
cp = new Classpath();
}
boolean added = cp.addComponent(component);
_classpaths.put(section,cp);
@ -247,8 +245,11 @@ public class Config
for (File entry : entries)
{
if (entry.isDirectory() && recurse)
addJars(sections,entry,recurse);
if (entry.isDirectory())
{
if (recurse)
addJars(sections,entry,recurse);
}
else
{
String name = entry.getName().toLowerCase();
@ -561,24 +562,35 @@ public class Config
if (trim.startsWith("[") && trim.endsWith("]"))
{
String identifier = trim.substring(1,trim.length() - 1);
if (identifier.charAt(0) == '=')
// Normal case: section identifier (possibly separated by commas)
sections = Arrays.asList(identifier.split(","));
List<String> section_ids=new ArrayList<String>();
// Ensure section classpaths exist
for (String sectionId : sections)
{
// Special case: dynamic/discovered option section identifier.
processDynamicSectionIdentifier(identifier.substring(1));
if (sectionId.charAt(0) == '=')
continue;
if (!_classpaths.containsKey(sectionId))
_classpaths.put(sectionId,new Classpath());
section_ids.add(sectionId);
}
else
// Process Dynamic
for (String sectionId : sections)
{
// Normal case: section identifier (possibly separated by commas)
sections = Arrays.asList(identifier.split(","));
// Ensure section classpaths exist
for (String sectionId : sections)
{
if (!_classpaths.containsKey(sectionId))
{
_classpaths.put(sectionId,new Classpath());
}
}
if (sectionId.charAt(0) != '=')
continue;
section_ids = processDynamicSectionIdentifier(sectionId.substring(1),section_ids);
}
sections = section_ids;
continue;
}
@ -820,19 +832,42 @@ public class Config
}
}
private void processDynamicSectionIdentifier(String dynamicPathId) throws IOException
private List<String> processDynamicSectionIdentifier(String dynamicPathId,List<String> sections) throws IOException
{
if (!dynamicPathId.endsWith("/*"))
String section=null;
String rawPath;
boolean deep;
if (dynamicPathId.endsWith("/*"))
{
String msg = "Dynamic Section IDs must end in \"/*\" to work. Ignoring: [=" + dynamicPathId + "]";
System.err.println(msg);
deep=false;
rawPath = fixPath(dynamicPathId.substring(0,dynamicPathId.length() - 1));
}
else if (dynamicPathId.endsWith("/**"))
{
deep=true;
rawPath = fixPath(dynamicPathId.substring(0,dynamicPathId.length() - 2));
}
else if (dynamicPathId.indexOf('/')>1 && !dynamicPathId.endsWith("/"))
{
section=dynamicPathId.substring(dynamicPathId.lastIndexOf('/')+1);
rawPath=dynamicPathId.substring(0,dynamicPathId.lastIndexOf('/'));
deep=true;
}
else
{
String msg = "Illegal dynamic path [" + dynamicPathId + "]";
throw new IOException(msg);
}
String rawPath = fixPath(dynamicPathId.substring(0,dynamicPathId.length() - 1));
File parentDir = new File(expand(rawPath));
debug("Adding dynamic section entries based on path: " + parentDir);
File dirs[] = parentDir.listFiles(new FileFilter()
if (!parentDir.exists())
return sections;
debug("dynamic: " + parentDir);
File dirs[] = section!=null
?new File[]{new File(parentDir,section)}
:parentDir.listFiles(new FileFilter()
{
public boolean accept(File path)
{
@ -840,15 +875,28 @@ public class Config
}
});
List<String> sections = new ArrayList<String>();
List<String> dyn_sections = new ArrayList<String>();
List<String> super_sections = new ArrayList<String>();
if (sections!=null)
super_sections.addAll(sections);
for (File dir : dirs)
{
sections.clear();
sections.add("All");
String id = dir.getName();
sections.add(id);
addJars(sections,dir,false);
if (_classpaths.keySet().contains(id))
continue;
_classpaths.put(id,new Classpath());
dyn_sections.clear();
if (sections!=null)
dyn_sections.addAll(sections);
dyn_sections.add(id);
super_sections.add(id);
debug("dynamic: " + dyn_sections);
addJars(dyn_sections,dir,deep);
}
return super_sections;
}
private String fixPath(String path)

View File

@ -81,8 +81,12 @@ public class Main
try
{
List<String> arguments = new ArrayList<String>();
arguments.addAll(Arrays.asList(args)); // Add Arguments on Command Line
arguments.addAll(loadStartIni()); // Add Arguments from start.ini (if it exists)
if (args.length>0)
arguments.addAll(Arrays.asList(args)); // Add Arguments on Command Line
else
// if no command line args
arguments.addAll(loadStartIni()); // Add Arguments from start.ini (if it exists)
// The XML Configuration Files to initialize with
List<String> xmls = new ArrayList<String>();

View File

@ -79,10 +79,6 @@ $(jetty.home)/etc/jetty.xml nargs == 0
# Default OPTIONS if not specified on the command line
OPTIONS~=default,* ! property OPTIONS
# Add a ext lib directory if it is there
[All,ext,default]
$(jetty.home)/lib/ext/**
# Add a resources directory if it is there
[All,resources,default]
$(jetty.home)/resources/
@ -126,23 +122,26 @@ $(jetty.home)/lib/jetty-jmx-$(version).jar
[All,ajp]
$(jetty.home)/lib/jetty-ajp-$(version).jar ! available org.eclipse.jetty.ajp.Ajp13Connection
[All,plus]
[All,plus,jndi]
$(jetty.home)/lib/jetty-jndi-${version}.jar ! available org.eclipse.jetty.jndi.ContextFactory
$(jetty.home)/lib/jetty-jndi/** exists $(jetty.home)/lib/jetty-jndi
$(jetty.home)/lib/jetty-plus-${version}.jar ! available org.eclipse.jetty.plus.jndi.NamingEntry
$(jetty.home)/lib/jndi/** exists $(jetty.home)/lib/jndi
[All,annotations]
$(jetty.home)/lib/jetty-annotations-$(version).jar ! available org.eclipse.jetty.annotations.AnnotationFinder
$(jetty.home)/lib/jetty-annotations/** exists $(jetty.home)/lib/jetty-annotations
$(jetty.home)/lib/annotations/** exists $(jetty.home)/lib/jndi
[All,policy]
$(jetty.home)/lib/jetty-policy-$(version).jar ! available org.eclipse.jetty.annotations.AnnotationFinder
$(jetty.home)/lib/policy/** exists $(jetty.home)/lib/jndi
[All,client]
$(jetty.home)/lib/jetty-http-$(version).jar ! available org.eclipse.jetty.http.HttpParser
$(jetty.home)/lib/jetty-client-$(version).jar ! available org.eclipse.jetty.client.HttpClient
[All,secure]
$(jetty.home)/lib/security/jetty-policy-$(version).jar ! available org.eclipse.jetty.policy.JettyPolicy
$(jetty.home)/lib/security/jetty.policy always
# Add ext if it exists
[All,default,=$(jetty.home)/lib/ext]
# Add all other sub-directories in /lib/ as options in a dynamic way
[=$(jetty.home)/lib/*]
[All,=$(jetty.home)/lib/**]

View File

@ -149,6 +149,7 @@
<module>jetty-aggregate</module>
<module>example-jetty-embedded</module>
<module>tests</module>
<module>jetty-distribution</module>
</modules>
<dependencyManagement>
<dependencies>