improved protonego module structure to avoid ini files of parameterized modules

This commit is contained in:
Greg Wilkins 2014-04-03 16:50:10 +11:00
parent c62500c63d
commit 303fa57eaf
29 changed files with 146 additions and 106 deletions

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="protonego" class="org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory">
<Arg name="protocols">
<Array type="String">
<Item>spdy/3</Item>
<Item>spdy/2</Item>
<Item>http/1.1</Item>
</Array>
</Arg>
<Set name="defaultProtocol">http/1.1</Set>
</Configure>

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0/alpn-boot-7.0.0.jar:lib/alpn/alpn-boot-7.0.0.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0/alpn-boot-7.0.0.jar:lib/alpn/alpn-boot-7.0.0.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0/alpn-boot-7.0.0.jar:lib/alpn/alpn-boot-7.0.0.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.0.0/alpn-boot-8.0.0.jar:lib/alpn/alpn-boot-8.0.0.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-8.0.0.jar

View File

@ -1,14 +1,3 @@
[name]
protonego
[depend]
protonego/alpn-${java.version}
[files]
lib/
lib/alpn/
[ini-template]
# ALPN is provided via a -Xbootclasspath that modifies the secure connections
# in java to support the ALPN layer needed for SPDY (and eventually HTTP/2)
#
@ -28,5 +17,20 @@ lib/alpn/
# All versions of alpn-boot can be found at
# http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/
[name]
protonego-impl
[depend]
protonego-impl/alpn-${java.version}
[lib]
lib/jetty-alpn-client-${jetty.version}.jar
lib/jetty-alpn-server-${jetty.version}.jar
[xml]
etc/protonego-alpn.xml
[files]
lib/
lib/alpn/

View File

@ -0,0 +1,15 @@
#
# Protocol Negotiatin Selection Module
#
[depend]
protonego-impl/${protonego}
[ini-template]
# Protocol Negotiation Implementation Selection
# choices are:
# 'npn' : original implementation for SPDY (now deprecated)
# 'alpn' : replacement for NPN, in use by current SPDY implementations
# and the future HTTP/2 spec
# Note: java 1.8+ are ALPN only.
protonego=alpn

View File

@ -8,12 +8,6 @@
<!-- ============================================================= -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Enables NPN debugging on System.err -->
<!-- ===========================================================
<Set class="org.eclipse.jetty.npn.NextProtoNego" name="debug" type="boolean">true</Set>
-->
<!-- =========================================================== -->
<!-- Create a push strategy which can be used by reference by -->
<!-- individual connection factories below. -->
@ -53,16 +47,17 @@
<!-- =========================================================== -->
<!-- Add a SPDY/HTTPS Connector. -->
<!-- Configure an o.e.j.server.ServerConnector with connection -->
<!-- factories for TLS (aka SSL), NPN, SPDY and HTTP to provide -->
<!-- a connector that can accept HTTPS or SPDY connections. -->
<!-- factories for TLS (aka SSL), ProtoNego, SPDY and HTTP to -->
<!-- provide a connector that can accept HTTPS or SPDY -->
<!-- connections. -->
<!-- -->
<!-- All accepted TLS connections are initially wired to a NPN -->
<!-- connection, which attempts to use a TLS extension to -->
<!-- negotiation the protocol. If NPN is not supported by -->
<!-- the client, then the NPN connection is replaced by a HTTP -->
<!-- All accepted TLS connections are initially wired to a -->
<!-- Protonego connection, which attempts to use a TLS extension -->
<!-- to negotiation the protocol. If it is not supported by -->
<!-- the client, then the connection is replaced by a HTTP -->
<!-- connection. If a specific protocol version (eg spdy/3) is -->
<!-- negotiated by NPN, then the appropriate connection factory -->
<!-- is used to create a connection to replace the NPN connection-->
<!-- negotiated, then the appropriate connection factory -->
<!-- is used to create a connection to replace the connection -->
<!-- -->
<!-- The final result is a SPDY or HTTP connection wired behind -->
<!-- a TLS (aka SSL) connection. -->
@ -80,10 +75,10 @@
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<!-- SSL Connection factory with NPN as next protocol -->
<!-- SSL Connection factory with Protonego as next protocol -->
<Item>
<New class="org.eclipse.jetty.server.SslConnectionFactory">
<Arg name="next">npn</Arg>
<Arg name="next"><Property name="protonego"/></Arg>
<Arg name="sslContextFactory">
<Ref refid="sslContextFactory"/>
</Arg>
@ -92,16 +87,7 @@
<!-- NPN Connection factory with HTTP as default protocol -->
<Item>
<New class="org.eclipse.jetty.spdy.server.NPNServerConnectionFactory">
<Arg name="protocols">
<Array type="String">
<Item>spdy/3</Item>
<Item>spdy/2</Item>
<Item>http/1.1</Item>
</Array>
</Arg>
<Set name="defaultProtocol">http/1.1</Set>
</New>
<Ref refid="protonego"/>
</Item>
<!-- SPDY/3 Connection factory -->

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="protonego" class="org.eclipse.jetty.spdy.server.NPNServerConnectionFactory">
<Arg name="protocols">
<Array type="String">
<Item>spdy/3</Item>
<Item>spdy/2</Item>
<Item>http/1.1</Item>
</Array>
</Arg>
<Set name="defaultProtocol">http/1.1</Set>
<!-- =========================================================== -->
<!-- Enables NPN debugging on System.err -->
<!-- ===========================================================
<Set class="org.eclipse.jetty.npn.NextProtoNego" name="debug" type="boolean">true</Set>
-->
</Configure>

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar:lib/npn/npn-boot-1.1.0.v20120525.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.0.v20120525.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar:lib/npn/npn-boot-1.1.0.v20120525.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.0.v20120525.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar:lib/npn/npn-boot-1.1.1.v20121030.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.1.v20121030.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar:lib/npn/npn-boot-1.1.1.v20121030.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.1.v20121030.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.4.v20130313/npn-boot-1.1.4.v20130313.jar:lib/npn/npn-boot-1.1.4.v20130313.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.4.v20130313.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar

View File

@ -4,6 +4,5 @@ protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar
[ini-template]
--exec
[exec]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar

View File

@ -1,14 +1,3 @@
[name]
protonego
[depend]
protonego/npn-${java.version}
[files]
lib/
lib/npn/
[ini-template]
# NPN is provided via a -Xbootclasspath that modifies the secure connections
# in java to support the NPN layer needed for SPDY.
#
@ -28,4 +17,15 @@ lib/npn/
# http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/
[name]
protonego-impl
[depend]
protonego-impl/npn-${java.version}
[xml]
etc/protonego-npn.xml
[files]
lib/
lib/npn/

View File

@ -4,7 +4,7 @@
[depend]
ssl
protonego/${proto.nego}
protonego
[lib]
lib/spdy/*.jar
@ -15,16 +15,12 @@ etc/jetty-spdy.xml
[ini-template]
## SPDY Configuration
# Protocol Negotiation Implementation
# choices are:
# 'npn' : original implementation for SPDY (now deprecated)
# 'alpn' : replacement for NPN, in use by current SPDY implementations
# and the future HTTP/2 spec
# Note: java 1.8+ are ALPN only.
proto.nego=alpn
# Port for SPDY connections
spdy.port=8443
# SPDY idle timeout in milliseconds
spdy.timeout=30000
# Initial Window Size for SPDY
#spdy.initialWindowSize=65536

View File

@ -334,6 +334,8 @@ public class Main
private void moduleIni(StartArgs args, String name, boolean topLevel, boolean appendStartIni) throws IOException
{
System.err.println("module ini "+name);
// Find the start.d relative to the base directory only.
File start_d = baseHome.getBaseFile("start.d");

View File

@ -100,6 +100,8 @@ public class Module
private List<String> libs;
/** List of files for this Module */
private List<String> files;
/** List of jvm Args */
private List<String> jvmArgs;
/** Is this Module enabled via start.jar command line, start.ini, or start.d/*.ini ? */
private boolean enabled = false;
@ -250,6 +252,11 @@ public class Module
return xmls;
}
public List<String> getJvmArgs()
{
return jvmArgs;
}
@Override
public int hashCode()
{
@ -281,6 +288,7 @@ public class Module
initialise = new ArrayList<>();
libs = new ArrayList<>();
files = new ArrayList<>();
jvmArgs = new ArrayList<>();
}
public boolean isEnabled()
@ -331,27 +339,30 @@ public class Module
case "":
// ignore (this would be entries before first section)
break;
case "NAME":
logicalName = line;
break;
case "DEPEND":
parentNames.add(line);
break;
case "LIB":
libs.add(line);
break;
case "XML":
xmls.add(line);
break;
case "OPTIONAL":
optionalParentNames.add(line);
break;
case "FILES":
files.add(line);
break;
case "INI-TEMPLATE":
initialise.add(line);
break;
case "LIB":
libs.add(line);
break;
case "NAME":
logicalName = line;
break;
case "OPTIONAL":
optionalParentNames.add(line);
break;
case "EXEC":
jvmArgs.add(line);
break;
case "XML":
xmls.add(line);
break;
default:
throw new IOException("Unrecognized Module section: [" + sectionType + "]");
}

View File

@ -355,6 +355,12 @@ public class StartArgs
}
}
for (String jvmArg : module.getJvmArgs())
{
exec=true;
jvmArgs.add(jvmArg);
}
// Find and Expand XML files
for (String xmlRef : module.getXmls())
{
@ -766,6 +772,7 @@ public class StartArgs
}
moduleStartdIni.addAll(getValues(arg));
run = false;
download = true;
return;
}
@ -777,6 +784,7 @@ public class StartArgs
}
moduleStartIni.addAll(getValues(arg));
run = false;
download = true;
return;
}