Skip to content

Commit a5763f2

Browse files
committed
Simple system properties in glassfish.properties for runneble Embedded GlassFish
1 parent 3dad4ae commit a5763f2

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

docs/embedded-server-guide/src/main/asciidoc/embedded-server-guide.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ The value will be treated as a command to execute at startup.
285285
- Keys that start with the "deploy." prefix, followed by any text. The
286286
value will be treated as an application to deploy at startup, as if it
287287
was specified on the command line.
288+
- If a property name doesn't match any already supported patterns and is not
289+
a recognized GlassFish property, it will be set as a system property, if
290+
it's not already defined.
288291
For example, the ${productName} domain directory can be specified with the
289292
usual Embedded ${productName} property
290293
"glassfish.embedded.tmpdir=myDomainDir", as well as with the property

nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/AutoDisposableGlassFish.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.glassfish.embeddable.GlassFishProperties;
3838
import org.glassfish.hk2.api.ServiceLocator;
3939
import org.glassfish.main.boot.impl.GlassFishImpl;
40+
import org.glassfish.main.jdke.props.SystemProperties;
4041

4142
import static com.sun.enterprise.glassfish.bootstrap.cfg.BootstrapKeys.AUTO_DELETE;
4243

@@ -79,8 +80,9 @@ class AutoDisposableGlassFish extends GlassFishImpl {
7980
&& resultList.getOutput().contains(propertyPrefix)) {
8081
knownPropertyPrefixes.add(propertyPrefix);
8182
} else {
82-
// unknown property prefix, skip it
83-
continue;
83+
// unknown property, set as system property
84+
LOG.log(Level.INFO, "Setting system property " + key + " from GlassFish properties, it doesn't match any known property");
85+
SystemProperties.setProperty(key, gfProps.getProperty(key), false);
8486
}
8587
}
8688
CommandResult result = commandRunner.run("set", propertyName + "=" + propertyValue);

nucleus/core/kernel/src/main/java/org/glassfish/runnablejar/commandline/Option.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ public enum Option {
5151
+ " - Keys that start with the \"" + Arguments.DEPLOY_KEY_PREFIX
5252
+ "\" prefix, followed by any text. The value will be"
5353
+ " treated as an application to deploy at startup, as if it was specified on the command line.\n"
54-
+ "For example, the GlassFish domain directory can be specified with the usual GlassFish Embedded"
54+
+ " - If a property name doesn't match any already supported patterns and is not"
55+
+ " a recognized GlassFish property, it will be set as a system property, if it's not already defined.\n"
56+
+ "\nFor example, the GlassFish domain directory can be specified with the usual GlassFish Embedded"
5557
+ " property \"glassfish.embedded.tmpdir=myDomainDir\", as well as with the property"
5658
+ " \"domainDir=myDomainDir\" that represents the \"--domainDir=myDomainDir\" command-line option."
5759
+ " A command to deploy an application can be specified via a property key"

nucleus/core/kernel/src/test/java/org/glassfish/runnablejar/commandline/WordWrapperTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void testWrapper() {
3838
.map(Option::getHelpText)
3939
.collect(wordWrapper);
4040
final List<String> linesEndingWithSpace = message.lines()
41-
.filter(line -> line.endsWith(" "))
41+
.filter(line -> line.endsWith(" ") && !line.isBlank())
4242
.collect(toList());
4343
assertTrue(linesEndingWithSpace.isEmpty(), "Some lines end with a space: " + linesEndingWithSpace);
4444

0 commit comments

Comments
 (0)