-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #408 from jamezp/WFARQ-147
[WFARQ-147] Migrate to using the wildfly-plugin-tools as the maven-pl…
- Loading branch information
Showing
10 changed files
with
58 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,15 +18,12 @@ | |
|
||
import java.io.IOException; | ||
|
||
import org.jboss.as.controller.client.helpers.Operations; | ||
import org.jboss.dmr.ModelNode; | ||
import org.jboss.logging.Logger; | ||
|
||
/** | ||
* Information about the running container. | ||
* | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
@Deprecated(forRemoval = true) | ||
public interface ContainerDescription { | ||
|
||
/** | ||
|
@@ -79,42 +76,8 @@ default ModelVersion getModelVersion() { | |
* @throws IOException if an error occurs while executing the management operation | ||
*/ | ||
static ContainerDescription lookup(final ManagementClient client) throws IOException { | ||
final ModelNode op = Operations.createReadResourceOperation(new ModelNode().setEmptyList()); | ||
final ModelNode result = client.getControllerClient().execute(op); | ||
if (Operations.isSuccessfulOutcome(result)) { | ||
final ModelNode model = Operations.readResult(result); | ||
final String productName; | ||
if (model.hasDefined("product-name")) { | ||
productName = model.get("product-name").asString(); | ||
} else { | ||
productName = "WildFly"; | ||
} | ||
|
||
String productVersion = null; | ||
if (model.hasDefined("product-version")) { | ||
productVersion = model.get("product-version").asString(); | ||
} | ||
|
||
String releaseCodename = null; | ||
if (model.hasDefined("release-codename")) { | ||
releaseCodename = model.get("release-codename").asString(); | ||
} | ||
|
||
String releaseVersion = null; | ||
if (model.hasDefined("release-version")) { | ||
releaseVersion = model.get("release-version").asString(); | ||
} | ||
final ModelVersion modelVersion = new ModelVersion( | ||
model.get("management-major-version").asInt(0), | ||
model.get("management-minor-version").asInt(0), | ||
model.get("management-micro-version").asInt(0)); | ||
return new StandardContainerDescription(productName, productVersion, releaseCodename, releaseVersion, modelVersion); | ||
} else { | ||
Logger.getLogger(ContainerDescription.class).errorf("Failed to read the root resource: ", | ||
Operations.getFailureDescription(result)); | ||
} | ||
|
||
return StandardContainerDescription.NULL_DESCRIPTION; | ||
return new StandardContainerDescription( | ||
org.wildfly.plugin.tools.ContainerDescription.lookup(client.getControllerClient())); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,44 +22,33 @@ | |
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
class StandardContainerDescription implements ContainerDescription { | ||
|
||
static final StandardContainerDescription NULL_DESCRIPTION = new StandardContainerDescription("WildFly", | ||
null, null, null, ModelVersion.DEFAULT); | ||
|
||
private final String productName; | ||
private final String productVersion; | ||
private final String releaseCodename; | ||
private final String releaseVersion; | ||
private final org.wildfly.plugin.tools.ContainerDescription delegate; | ||
private final ModelVersion modelVersion; | ||
|
||
StandardContainerDescription(final String productName, final String productVersion, | ||
final String releaseCodename, final String releaseVersion, | ||
final ModelVersion modelVersion) { | ||
this.productName = productName; | ||
this.productVersion = productVersion; | ||
this.releaseCodename = releaseCodename; | ||
this.releaseVersion = releaseVersion; | ||
this.modelVersion = modelVersion; | ||
StandardContainerDescription(final org.wildfly.plugin.tools.ContainerDescription delegate) { | ||
this.delegate = delegate; | ||
final var modelVersion = delegate.getModelVersion(); | ||
this.modelVersion = new ModelVersion(modelVersion.major(), modelVersion.minor(), modelVersion.micro()); | ||
} | ||
|
||
@Override | ||
public String getProductName() { | ||
return productName; | ||
return delegate.getProductName(); | ||
} | ||
|
||
@Override | ||
public String getProductVersion() { | ||
return productVersion; | ||
return delegate.getProductVersion(); | ||
} | ||
|
||
@Override | ||
public String getReleaseCodename() { | ||
return releaseCodename; | ||
return ""; | ||
} | ||
|
||
@Override | ||
public String getReleaseVersion() { | ||
return releaseVersion; | ||
return delegate.getReleaseVersion(); | ||
} | ||
|
||
@Override | ||
|
@@ -69,24 +58,6 @@ public ModelVersion getModelVersion() { | |
|
||
@Override | ||
public String toString() { | ||
final StringBuilder result = new StringBuilder(64); | ||
result.append(productName); | ||
if (productVersion != null) { | ||
result.append(' ').append(productVersion); | ||
if (releaseCodename != null) { | ||
result.append(' ').append('"').append(releaseCodename).append('"'); | ||
} | ||
if (releaseVersion != null) { | ||
result.append(" (WildFly Core ").append(releaseVersion).append(')'); | ||
} | ||
} else { | ||
if (releaseVersion != null) { | ||
result.append(' ').append(releaseVersion); | ||
} | ||
if (releaseCodename != null) { | ||
result.append(' ').append('"').append(releaseCodename).append('"'); | ||
} | ||
} | ||
return result.toString(); | ||
return delegate.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters