Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,15 @@ public interface CustomSessionConfiguration extends SessionCustomization {
*/
public CustomSessionConfiguration setConfigIniValue(String key, String value);

/**
* Sets the given system property for all subsequently executed sessions. If the
* value is null, the property will not be set in subsequent runs anymore.
*
* @param key the system property key
* @param value the value to set for the key or {@code null} to remove the key
*
* @return this
*/
public CustomSessionConfiguration setSystemProperty(String key, String value);

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,9 @@ public CustomSessionConfiguration setConfigIniValue(String key, String value) {
return this;
}

@Override
public CustomSessionConfiguration setSystemProperty(String key, String value) {
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class CustomSessionConfigurationImpl implements CustomSessionConfiguratio
private final Collection<BundleReference> bundleReferences = new LinkedHashSet<>();
private Path configurationDirectory;
private final Map<String, String> configIniValues = new HashMap<>();
private final Map<String, String> systemProperties = new HashMap<>();
private boolean readOnly = false;
private boolean cascaded = false;
private boolean firstExecutedSession = true;
Expand Down Expand Up @@ -154,6 +155,16 @@ public CustomSessionConfiguration setConfigIniValue(String key, String value) {
return this;
}

@Override
public CustomSessionConfiguration setSystemProperty(String key, String value) {
if (value == null) {
systemProperties.remove(key);
} else {
systemProperties.put(key, value);
}
return this;
}

@Override
public CustomSessionConfiguration setConfigurationDirectory(Path configurationDirectory) {
Objects.requireNonNull(configurationDirectory);
Expand Down Expand Up @@ -189,6 +200,7 @@ public void prepareSession(Setup setup) throws IOException {
if (cascaded) {
createOrRefreshConfigIni();
}
setup.setSystemProperties(systemProperties);
}

@Override
Expand Down
Loading