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

[WFCORE-6345] Add missing JavaDoc and ensure the --yaml argument is a… #5495

Merged
merged 1 commit into from
May 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public StandaloneCommandBuilder setDebug(final int port) {
* Sets the debug JPDA remote socket debugging argument.
*
* @param suspend {@code true} to suspend otherwise {@code false}
* @param port the port to listen on
* @param port the port to listen on
*
* @return the builder
*/
Expand Down Expand Up @@ -488,7 +488,7 @@ public StandaloneCommandBuilder addSecurityProperty(final String key) {
/**
* Adds a security property to be passed to the server.
*
* @param key the property key
* @param key the property key
* @param value the property value
*
* @return the builder
Expand All @@ -510,6 +510,15 @@ public StandaloneCommandBuilder addSecurityProperties(final Map<String, String>
return this;
}

/**
* Configures the git repository for the standalone server.
*
* @param gitRepository the git repository to clone to get the server configuration from
* @param gitBranch the branch to use to get the server configuration
* @param gitAuthentication the Elytron configuration file for managing git credentials
*
* @return the builder
*/
public StandaloneCommandBuilder setGitRepository(final String gitRepository, final String gitBranch, final String gitAuthentication) {
if (gitRepository == null) {
throw MESSAGES.nullParam("git-repo");
Expand All @@ -525,18 +534,39 @@ public StandaloneCommandBuilder setGitRepository(final String gitRepository, fin
return this;
}

public StandaloneCommandBuilder setYamlFiles(Path[] yamlFiles) {
if (yamlFiles == null || yamlFiles.length == 0) {
/**
* Adds the YAML configuration file argument with the given YAML configuration files.
*
* @param yamlFiles the files to add
*
* @return the builder
*/
public StandaloneCommandBuilder setYamlFiles(final Collection<Path> yamlFiles) {
if (yamlFiles == null || yamlFiles.isEmpty()) {
return this;
}
StringJoiner joiner = new StringJoiner(File.pathSeparator);
for (Path yamlFile : yamlFiles) {
joiner.add(yamlFile.toAbsolutePath().toString());
}
addServerArg("--yaml", joiner.toString());
setSingleServerArg("--yaml", joiner.toString());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a suggestion: addServerArg and setSingleServerArg do exactly the same; I'm not sure about the intention behind but probably we can remove one, they are package protected so, so the removal could be simple.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addServerArg() should add arguments to the command line, e.g. addServerArg("-yaml", "config-a.yml") and addServerArg("-yaml", "config-b.yml") should result in --yaml confiig-a.yml --yaml config-b.yml. Where as serSingleServerArg() should first remove an argument, then add it.

return this;
}

/**
* Adds the YAML configuration file argument with the given YAML configuration files.
*
* @param yamlFiles the files to add
*
* @return the builder
*/
public StandaloneCommandBuilder setYamlFiles(final Path... yamlFiles) {
if (yamlFiles == null || yamlFiles.length == 0) {
return this;
}
return setYamlFiles(List.of(yamlFiles));
}

@Override
public List<String> buildArguments() {
final List<String> cmd = new ArrayList<>();
Expand Down