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-6920 Remove usage of deprecated AbstractWriteAttributeHandler constructors in deployment-scanner #6099

Merged
merged 1 commit into from
Jul 23, 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 @@ -17,6 +17,7 @@
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.server.deployment.scanner.api.DeploymentScanner;
import org.jboss.dmr.ModelNode;
import org.jboss.msc.service.ServiceController;
Expand All @@ -28,11 +29,6 @@
*/
final class UpdateScannerWriteAttributeHandler extends AbstractWriteAttributeHandler<DeploymentScanner> {

UpdateScannerWriteAttributeHandler() {
super(AUTO_DEPLOY_EXPLODED, AUTO_DEPLOY_XML, AUTO_DEPLOY_ZIPPED, DEPLOYMENT_TIMEOUT,
RUNTIME_FAILURE_CAUSES_ROLLBACK, SCAN_ENABLED, SCAN_INTERVAL);
}

@Override
protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation,
final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue,
Expand All @@ -42,7 +38,7 @@ protected boolean applyUpdateToRuntime(final OperationContext context, final Mod
final ServiceController<?> controller = context.getServiceRegistry(true).getRequiredService(DeploymentScannerService.getServiceName(name));
if (controller.getState() == ServiceController.State.UP) {// https://issues.jboss.org/browse/WFCORE-1635
DeploymentScanner scanner = (DeploymentScanner) controller.getValue();
updateScanner(attributeName, scanner, resolvedValue);
updateScanner(context, attributeName, scanner, resolvedValue);
handbackHolder.setHandback(scanner);
}

Expand All @@ -53,12 +49,12 @@ protected boolean applyUpdateToRuntime(final OperationContext context, final Mod
protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName,
ModelNode valueToRestore, ModelNode valueToRevert, DeploymentScanner handback) throws OperationFailedException {
if (handback != null) {
updateScanner(attributeName, handback, context.resolveExpressions(valueToRestore));
updateScanner(context, attributeName, handback, context.resolveExpressions(valueToRestore));
}
}

private void updateScanner(String attributeName, DeploymentScanner scanner, ModelNode resolvedNewValue) {
AttributeDefinition ad = getAttributeDefinition(attributeName);
private void updateScanner(OperationContext context, String attributeName, DeploymentScanner scanner, ModelNode resolvedNewValue) {
AttributeDefinition ad = context.getResourceRegistration().getAttributeAccess(PathAddress.EMPTY_ADDRESS, attributeName).getAttributeDefinition();
if (ad == AUTO_DEPLOY_EXPLODED) {
scanner.setAutoDeployExplodedContent(resolvedNewValue.asBoolean());
} else if (ad == AUTO_DEPLOY_XML) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class WritePathAttributeHandler extends ReloadRequiredWriteAttributeHandl
private final PathManager pathManager;

public WritePathAttributeHandler(PathManager pathManager) {
super(DeploymentScannerDefinition.PATH);
this.pathManager = pathManager;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class WriteRelativeToAttributeHandler extends ReloadRequiredWriteAttribut
private final PathManager pathManager;

public WriteRelativeToAttributeHandler(PathManager pathManager) {
super(DeploymentScannerDefinition.RELATIVE_TO);
this.pathManager = pathManager;
}

Expand Down