Skip to content

Commit

Permalink
[WFCORE-7124] Remove use of server-side Stability type from the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
bstansberry committed Jan 14, 2025
1 parent 55e18a0 commit 349b32d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
4 changes: 0 additions & 4 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-version</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.security</groupId>
<artifactId>wildfly-elytron-auth-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.jboss.as.cli.operation.ParsedCommandLine;
import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.as.controller.client.helpers.ClientConstants;
import org.jboss.as.version.Stability;
import org.jboss.dmr.ModelNode;
import org.jboss.logmanager.LogContext;
import org.jboss.modules.ModuleLoader;
Expand Down Expand Up @@ -90,7 +89,7 @@ static EmbedHostControllerHandler create(final AtomicReference<EmbeddedProcessLa
result.removeExistingDomainConfig = new ArgumentWithoutValue(result, REMOVE_EXISTING_DOMAIN_CONFIG);
result.emptyHostConfig = new ArgumentWithoutValue(result, EMPTY_HOST_CONFIG);
result.removeExistingHostConfig = new ArgumentWithoutValue(result, REMOVE_EXISTING_HOST_CONFIG);
// TODO: Use ProductConfig.getStabilitySet()
// We must use our own Stability for tab completion choices as the client-side CLI can't depend on the server-side type
result.stability = new ArgumentWithValue(result, new SimpleTabCompleter(EnumSet.allOf(Stability.class)), "--stability");
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.jboss.as.cli.operation.ParsedCommandLine;
import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.as.controller.client.helpers.ClientConstants;
import org.jboss.as.version.Stability;
import org.jboss.dmr.ModelNode;
import org.jboss.logmanager.LogContext;
import org.jboss.modules.ModuleLoader;
Expand Down Expand Up @@ -81,7 +80,7 @@ static EmbedServerHandler create(final AtomicReference<EmbeddedProcessLaunch> se
result.removeExisting = new ArgumentWithoutValue(result, "--remove-existing");
result.removeExisting.addRequiredPreceding(result.emptyConfig);
result.timeout = new ArgumentWithValue(result, "--timeout");
// TODO: Use ProductConfig.getStabilitySet()
// We must use our own Stability for tab completion choices as the client-side CLI can't depend on the server-side type
result.stability = new ArgumentWithValue(result, new SimpleTabCompleter(EnumSet.allOf(Stability.class)), "--stability");

return result;
Expand Down
34 changes: 34 additions & 0 deletions cli/src/main/java/org/jboss/as/cli/embedded/Stability.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/

package org.jboss.as.cli.embedded;

/**
* Counterpart to the server-side {@code org.jboss.as.version.Stability}.
* We cannot depend on the server-side type in the strictly client-side CLI.
* <p/>
* <strong>This must only be used for tab completion suggestions. The CLI does not
* control the valid stability levels for a server, so if this class is out of sync
* with what a server allows, the only acceptable effect is incorrect suggestions.</strong>
* The alternative to this restriction is to not suggest values at all and remove this type.
*/
enum Stability {

DEFAULT("default"),
COMMUNITY("community"),
PREVIEW("preview"),
EXPERIMENTAL("experimental"),
;
private final String value;

Stability(String value) {
this.value = value;
}

@Override
public String toString() {
return this.value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<module name="org.jboss.modules"/>
<module name="org.jboss.as.controller-client"/>
<module name="org.jboss.as.protocol"/>
<module name="org.jboss.as.version"/>
<module name="org.wildfly.security.elytron-private" services="import"/>
<!-- optional dep that we will remove when galleon patching is used-->
<module name="org.jboss.as.patching.cli" optional="true" services="import"/>
Expand Down

0 comments on commit 349b32d

Please sign in to comment.