-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WFCORE-6893] Add information to product-info
- Loading branch information
Showing
11 changed files
with
148 additions
and
29 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
67 changes: 67 additions & 0 deletions
67
...allation-manager/src/main/java/org/wildfly/core/instmgr/InstMgrHistoryRuntimeHandler.java
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package org.wildfly.core.instmgr; | ||
|
||
import org.jboss.as.controller.OperationContext; | ||
import org.jboss.as.controller.OperationDefinition; | ||
import org.jboss.as.controller.OperationFailedException; | ||
import org.jboss.as.controller.SimpleOperationDefinitionBuilder; | ||
import org.jboss.as.controller.registry.OperationEntry; | ||
import org.jboss.dmr.ModelNode; | ||
import org.jboss.dmr.ModelType; | ||
import org.wildfly.installationmanager.HistoryResult; | ||
import org.wildfly.installationmanager.ManifestVersion; | ||
import org.wildfly.installationmanager.MavenOptions; | ||
import org.wildfly.installationmanager.spi.InstallationManager; | ||
import org.wildfly.installationmanager.spi.InstallationManagerFactory; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
|
||
public class InstMgrHistoryRuntimeHandler extends InstMgrOperationStepHandler { | ||
public static final String OPERATION_NAME = "history-runtime"; | ||
|
||
public static final OperationDefinition DEFINITION = new SimpleOperationDefinitionBuilder(OPERATION_NAME, InstMgrResolver.RESOLVER) | ||
.withFlags(OperationEntry.Flag.HOST_CONTROLLER_ONLY).setReplyType(ModelType.LIST) | ||
.setPrivateEntry() | ||
.setRuntimeOnly() | ||
.withFlag(OperationEntry.Flag.HIDDEN) | ||
.setReplyValueType(ModelType.OBJECT).build(); | ||
|
||
InstMgrHistoryRuntimeHandler(InstMgrService imService, InstallationManagerFactory imf) { | ||
super(imService, imf); | ||
} | ||
|
||
@Override | ||
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { | ||
try { | ||
Path serverHome = imService.getHomeDir(); | ||
MavenOptions mavenOptions = new MavenOptions(null, false); | ||
InstallationManager installationManager = imf.create(serverHome, mavenOptions); | ||
ModelNode resulList = new ModelNode(); | ||
|
||
List<HistoryResult> history = installationManager.history(); | ||
for (HistoryResult hr : history) { | ||
ModelNode entry = new ModelNode(); | ||
entry.get(InstMgrConstants.HISTORY_RESULT_HASH).set(hr.getName()); | ||
entry.get(InstMgrConstants.HISTORY_RESULT_TIMESTAMP).set(hr.timestamp().toString()); | ||
entry.get(InstMgrConstants.HISTORY_RESULT_TYPE).set(hr.getType().toLowerCase()); | ||
if (hr.getVersions() != null && !hr.getVersions().isEmpty()) { | ||
final ModelNode versions = entry.get(InstMgrConstants.HISTORY_RESULT_CHANNEL_VERSIONS); | ||
hr.getVersions().stream() | ||
.map(ManifestVersion::getDescription) | ||
.map(ModelNode::new) | ||
.forEach(versions::add); | ||
} | ||
if (hr.getDescription() != null) { | ||
entry.get(InstMgrConstants.HISTORY_RESULT_DESCRIPTION).set(hr.getDescription()); | ||
} | ||
resulList.add(entry); | ||
} | ||
|
||
context.getResult().set(resulList); | ||
} catch (OperationFailedException | RuntimeException e) { | ||
throw e; | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
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