Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFMP-244] Allow the known management configuration system properties… #563

Merged
merged 1 commit into from
Sep 9, 2024
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 @@ -268,6 +268,38 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
}

@Override
protected int getManagementPort() {
// Check the java-opts for a management port override
if (javaOpts != null) {
for (String opt : javaOpts) {
if (opt.startsWith("-Djboss.management.http.port=") || opt.startsWith("-Djboss.management.https.port=")) {
final int equals = opt.indexOf('=');
return Integer.parseInt(opt.substring(equals + 1).trim());
}
if (opt.startsWith("-Djboss.socket.binding.port-offset=")) {
final int equals = opt.indexOf('=');
return super.getManagementPort() + Integer.parseInt(opt.substring(equals + 1).trim());
}
}
}
return super.getManagementPort();
}

@Override
protected String getManagementHostName() {
// Check the java-opts for a management port override
if (javaOpts != null) {
for (String opt : javaOpts) {
if (opt.startsWith("-Djboss.bind.address.management=")) {
final int equals = opt.indexOf('=');
return opt.substring(equals + 1).trim();
}
}
}
return super.getManagementHostName();
}

/**
* Allows the {@link #javaOpts} to be set as a string. The string is assumed to be space delimited.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ protected synchronized MavenModelControllerClientConfiguration getClientConfigur
}
final ModelControllerClientConfiguration.Builder builder = new ModelControllerClientConfiguration.Builder()
.setProtocol(protocol)
.setHostName(hostname)
.setPort(port)
.setHostName(getManagementHostName())
.setPort(getManagementPort())
.setConnectionTimeout(timeout * 1000);
if (authenticationConfig != null) {
try {
Expand All @@ -175,6 +175,14 @@ protected synchronized MavenModelControllerClientConfiguration getClientConfigur
return new MavenModelControllerClientConfiguration(builder.build(), username, password);
}

protected int getManagementPort() {
return port;
}

protected String getManagementHostName() {
return hostname;
}

private String decrypt(final Server server) {
SettingsDecryptionResult decrypt = settingsDecrypter.decrypt(new DefaultSettingsDecryptionRequest(server));
return decrypt.getServer().getPassword();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,36 @@ protected ServerContext actOnServerState(final ModelControllerClient client, fin
}
return context;
}

@Override
protected int getManagementPort() {
// Check the java-opts for a management port override
if (javaOpts != null) {
for (String opt : javaOpts) {
if (opt.startsWith("-Djboss.management.http.port=") || opt.startsWith("-Djboss.management.https.port=")) {
final int equals = opt.indexOf('=');
return Integer.parseInt(opt.substring(equals + 1).trim());
}
if (opt.startsWith("-Djboss.socket.binding.port-offset=")) {
final int equals = opt.indexOf('=');
return super.getManagementPort() + Integer.parseInt(opt.substring(equals + 1).trim());
}
}
}
return super.getManagementPort();
}

@Override
protected String getManagementHostName() {
// Check the java-opts for a management port override
if (javaOpts != null) {
for (String opt : javaOpts) {
if (opt.startsWith("-Djboss.bind.address.management=")) {
final int equals = opt.indexOf('=');
return opt.substring(equals + 1).trim();
}
}
}
return super.getManagementHostName();
}
}