Permalink
Browse files

AS7-6206 Deprecate AbstractWriteAttributeHandler constructor variants…

… not based on AttributeDefinition
  • Loading branch information...
1 parent 1f87bac commit 6db3448b76c526348babf97f50a644e77d9a2834 @bstansberry bstansberry committed Dec 18, 2012
Showing with 66 additions and 140 deletions.
  1. +0 −12 ...main/java/org/jboss/as/connector/subsystems/datasources/DisableRequiredWriteAttributeHandler.java
  2. +2 −2 ...c/main/java/org/jboss/as/connector/subsystems/resourceadapters/AdminObjectResourceDefinition.java
  3. +1 −2 ...va/org/jboss/as/connector/subsystems/resourceadapters/ConnectionDefinitionResourceDefinition.java
  4. +1 −2 ...in/java/org/jboss/as/connector/subsystems/resourceadapters/ResourceAdapterResourceDefinition.java
  5. +13 −0 controller/src/main/java/org/jboss/as/controller/AbstractWriteAttributeHandler.java
  6. +15 −0 controller/src/main/java/org/jboss/as/controller/ReloadRequiredWriteAttributeHandler.java
  7. +9 −0 controller/src/main/java/org/jboss/as/controller/RestartParentWriteAttributeHandler.java
  8. +4 −5 ...t-scanner/src/main/java/org/jboss/as/server/deployment/scanner/AbstractWriteAttributeHandler.java
  9. +2 −2 ...ent-scanner/src/main/java/org/jboss/as/server/deployment/scanner/DeploymentScannerDefinition.java
  10. +1 −3 ...src/main/java/org/jboss/as/server/deployment/scanner/WriteAutoDeployExplodedAttributeHandler.java
  11. +1 −3 ...nner/src/main/java/org/jboss/as/server/deployment/scanner/WriteAutoDeployXMLAttributeHandler.java
  12. +1 −3 ...nner/src/main/java/org/jboss/as/server/deployment/scanner/WriteAutoDeployZipAttributeHandler.java
  13. +1 −3 .../src/main/java/org/jboss/as/server/deployment/scanner/WriteDeploymentTimeoutAttributeHandler.java
  14. +1 −3 ...nt-scanner/src/main/java/org/jboss/as/server/deployment/scanner/WriteEnabledAttributeHandler.java
  15. +1 −3 ...anner/src/main/java/org/jboss/as/server/deployment/scanner/WriteScanIntervalAttributeHandler.java
  16. +6 −1 ...java/org/jboss/as/ejb3/subsystem/EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler.java
  17. +2 −0 ...er/src/main/java/org/jboss/as/host/controller/operations/HttpManagementWriteAttributeHandler.java
  18. +3 −2 jacorb/src/main/java/org/jboss/as/jacorb/JacORBSubsystemResource.java
  19. +1 −0 jaxr/src/main/java/org/jboss/as/jaxr/extension/JAXRWriteAttributeHandler.java
  20. +1 −8 security/src/main/java/org/jboss/as/security/SecurityDomainReloadWriteHandler.java
  21. +0 −37 server/src/main/java/org/jboss/as/server/services/net/BindingGroupDefaultInterfaceHandler.java
  22. +0 −37 server/src/main/java/org/jboss/as/server/services/net/BindingGroupPortOffsetHandler.java
  23. +0 −12 transactions/src/main/java/org/jboss/as/txn/subsystem/ParticipantWriteAttributeHandler.java
@@ -32,22 +32,10 @@
public class DisableRequiredWriteAttributeHandler extends AbstractWriteAttributeHandler<Void> {
- public DisableRequiredWriteAttributeHandler() {
- super();
- }
-
- public DisableRequiredWriteAttributeHandler(final ParameterValidator validator) {
- super(validator);
- }
-
public DisableRequiredWriteAttributeHandler(final AttributeDefinition... definitions) {
super(definitions);
}
- public DisableRequiredWriteAttributeHandler(final ParameterValidator unresolvedValidator, final ParameterValidator resolvedValidator) {
- super(unresolvedValidator, resolvedValidator);
- }
-
@Override
protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<Void> voidHandback) {
ModelNode submodel = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();
@@ -45,12 +45,12 @@ public AdminObjectResourceDefinition(boolean readOnly) {
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
- ReloadRequiredWriteAttributeHandler writeAttributeHandler = new ReloadRequiredWriteAttributeHandler();
+
for (final AttributeDefinition attribute : CommonAttributes.ADMIN_OBJECTS_NODE_ATTRIBUTE) {
if (readOnly) {
resourceRegistration.registerReadOnlyAttribute(attribute, null);
} else {
- resourceRegistration.registerReadWriteAttribute(attribute, null, writeAttributeHandler);
+ resourceRegistration.registerReadWriteAttribute(attribute, null, new ReloadRequiredWriteAttributeHandler(attribute));
}
}
}
@@ -63,12 +63,11 @@ public ConnectionDefinitionResourceDefinition(final boolean readOnly, final bool
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
- ReloadRequiredWriteAttributeHandler writeAttributeHandler = new ReloadRequiredWriteAttributeHandler();
for (final AttributeDefinition attribute : CommonAttributes.CONNECTION_DEFINITIONS_NODE_ATTRIBUTE) {
if (readOnly) {
resourceRegistration.registerReadOnlyAttribute(attribute, null);
} else {
- resourceRegistration.registerReadWriteAttribute(attribute, null, writeAttributeHandler);
+ resourceRegistration.registerReadWriteAttribute(attribute, null, new ReloadRequiredWriteAttributeHandler(attribute));
}
}
}
@@ -59,12 +59,11 @@ public void registerOperations(ManagementResourceRegistration resourceRegistrati
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
- ReloadRequiredWriteAttributeHandler writeAttributeHandler = new ReloadRequiredWriteAttributeHandler();
for (final AttributeDefinition attribute : CommonAttributes.RESOURCE_ADAPTER_ATTRIBUTE) {
if (readOnly) {
resourceRegistration.registerReadOnlyAttribute(attribute, null);
} else {
- resourceRegistration.registerReadWriteAttribute(attribute, null, writeAttributeHandler);
+ resourceRegistration.registerReadWriteAttribute(attribute, null, new ReloadRequiredWriteAttributeHandler(attribute));
}
}
@@ -27,6 +27,7 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -57,10 +58,16 @@
private final ParameterValidator resolvedValueValidator;
private final Map<String, AttributeDefinition> attributeDefinitions;
+ /** @deprecated use a variant that takes {@link AttributeDefinition} */
+ @Deprecated
+ @SuppressWarnings("deprecation")
protected AbstractWriteAttributeHandler() {
this(null, null);
}
+ /** @deprecated use a variant that takes {@link AttributeDefinition} */
+ @Deprecated
+ @SuppressWarnings("deprecation")
protected AbstractWriteAttributeHandler(final ParameterValidator validator) {
this(validator, validator);
}
@@ -75,6 +82,12 @@ protected AbstractWriteAttributeHandler(final AttributeDefinition... definitions
this.resolvedValueValidator = null;
}
+ protected AbstractWriteAttributeHandler(final Collection<AttributeDefinition> definitions) {
+ this(definitions.toArray(new AttributeDefinition[definitions.size()]));
+ }
+
+ /** @deprecated use a variant that takes {@link AttributeDefinition} */
+ @Deprecated
protected AbstractWriteAttributeHandler(final ParameterValidator unresolvedValidator, final ParameterValidator resolvedValidator) {
this.nameValidator.registerValidator(NAME, new StringLengthValidator(1));
@@ -22,6 +22,8 @@
package org.jboss.as.controller;
+import java.util.Collection;
+
import org.jboss.as.controller.operations.validation.ParameterValidator;
import org.jboss.dmr.ModelNode;
@@ -32,10 +34,16 @@
*/
public class ReloadRequiredWriteAttributeHandler extends AbstractWriteAttributeHandler<Void> {
+ /** @deprecated use a variant that takes {@link AttributeDefinition} */
+ @Deprecated
+ @SuppressWarnings("deprecation")
public ReloadRequiredWriteAttributeHandler() {
super();
}
+ /** @deprecated use a variant that takes {@link AttributeDefinition} */
+ @Deprecated
+ @SuppressWarnings("deprecation")
public ReloadRequiredWriteAttributeHandler(final ParameterValidator validator) {
super(validator);
}
@@ -44,6 +52,13 @@ public ReloadRequiredWriteAttributeHandler(final AttributeDefinition... definiti
super(definitions);
}
+ public ReloadRequiredWriteAttributeHandler(final Collection<AttributeDefinition> definitions) {
+ super(definitions);
+ }
+
+ /** @deprecated use a variant that takes {@link AttributeDefinition} */
+ @Deprecated
+ @SuppressWarnings("deprecation")
public ReloadRequiredWriteAttributeHandler(final ParameterValidator unresolvedValidator, final ParameterValidator resolvedValidator) {
super(unresolvedValidator, resolvedValidator);
}
@@ -42,10 +42,16 @@
public abstract class RestartParentWriteAttributeHandler extends AbstractWriteAttributeHandler<ModelNode> {
private final String parentKeyName;
+ /** @deprecated use a variant that takes {@link AttributeDefinition} */
+ @Deprecated
+ @SuppressWarnings("deprecation")
public RestartParentWriteAttributeHandler(String parentKeyName) {
this.parentKeyName = parentKeyName;
}
+ /** @deprecated use a variant that takes {@link AttributeDefinition} */
+ @Deprecated
+ @SuppressWarnings("deprecation")
public RestartParentWriteAttributeHandler(String parentKeyName, ParameterValidator validator) {
super(validator);
this.parentKeyName = parentKeyName;
@@ -57,6 +63,9 @@ public RestartParentWriteAttributeHandler(String parentKeyName, AttributeDefinit
this.parentKeyName = parentKeyName;
}
+ /** @deprecated use a variant that takes {@link AttributeDefinition} */
+ @Deprecated
+ @SuppressWarnings("deprecation")
public RestartParentWriteAttributeHandler(String parentKeyName, ParameterValidator unresolvedValidator, ParameterValidator resolvedValidator) {
super(unresolvedValidator, resolvedValidator);
this.parentKeyName = parentKeyName;
@@ -25,10 +25,10 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.server.deployment.scanner.DeploymentScannerMessages.MESSAGES;
+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.controller.operations.validation.ParameterValidator;
import org.jboss.as.server.deployment.scanner.api.DeploymentScanner;
import org.jboss.dmr.ModelNode;
import org.jboss.msc.service.ServiceController;
@@ -40,8 +40,8 @@
*/
abstract class AbstractWriteAttributeHandler extends org.jboss.as.controller.AbstractWriteAttributeHandler<DeploymentScanner> {
- AbstractWriteAttributeHandler(ParameterValidator valueValidator, ParameterValidator resolvedValueValidator) {
- super(valueValidator, resolvedValueValidator);
+ AbstractWriteAttributeHandler(AttributeDefinition attributeDefinition) {
+ super(attributeDefinition);
}
@Override
@@ -52,11 +52,10 @@ protected boolean applyUpdateToRuntime(final OperationContext context, final Mod
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
final String name = address.getLastElement().getValue();
final ServiceController<?> controller = context.getServiceRegistry(false).getService(DeploymentScannerService.getServiceName(name));
- DeploymentScanner scanner = null;
if (controller == null) {
throw new OperationFailedException(new ModelNode().set(MESSAGES.scannerNotConfigured()));
} else {
- scanner = (DeploymentScanner) controller.getValue();
+ DeploymentScanner scanner = (DeploymentScanner) controller.getValue();
updateScanner(scanner, newValue);
handbackHolder.setHandback(scanner);
}
@@ -107,8 +107,8 @@
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
//resourceRegistration.registerReadOnlyAttribute(NAME, null);
- resourceRegistration.registerReadWriteAttribute(PATH, null, new ReloadRequiredWriteAttributeHandler());
- resourceRegistration.registerReadWriteAttribute(RELATIVE_TO, null, new ReloadRequiredWriteAttributeHandler());
+ resourceRegistration.registerReadWriteAttribute(PATH, null, new ReloadRequiredWriteAttributeHandler(PATH));
+ resourceRegistration.registerReadWriteAttribute(RELATIVE_TO, null, new ReloadRequiredWriteAttributeHandler(RELATIVE_TO));
resourceRegistration.registerReadWriteAttribute(SCAN_ENABLED, null, WriteEnabledAttributeHandler.INSTANCE);
resourceRegistration.registerReadWriteAttribute(SCAN_INTERVAL, null, WriteScanIntervalAttributeHandler.INSTANCE);
resourceRegistration.registerReadWriteAttribute(AUTO_DEPLOY_ZIPPED, null, WriteAutoDeployZipAttributeHandler.INSTANCE);
@@ -22,10 +22,8 @@
package org.jboss.as.server.deployment.scanner;
-import org.jboss.as.controller.operations.validation.ModelTypeValidator;
import org.jboss.as.server.deployment.scanner.api.DeploymentScanner;
import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
/**
* Toggle the 'auto-deploy-exploded' attribute on a {@code DeploymentScanner}.
@@ -37,7 +35,7 @@
static final WriteAutoDeployExplodedAttributeHandler INSTANCE = new WriteAutoDeployExplodedAttributeHandler();
private WriteAutoDeployExplodedAttributeHandler() {
- super(new ModelTypeValidator(ModelType.BOOLEAN, false, true), new ModelTypeValidator(ModelType.BOOLEAN, false, false));
+ super(DeploymentScannerDefinition.AUTO_DEPLOY_EXPLODED);
}
@Override
@@ -22,10 +22,8 @@
package org.jboss.as.server.deployment.scanner;
-import org.jboss.as.controller.operations.validation.ModelTypeValidator;
import org.jboss.as.server.deployment.scanner.api.DeploymentScanner;
import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
/**
* Toggle the 'auto-deploy-xml' attribute on a {@code DeploymentScanner}.
@@ -37,7 +35,7 @@
static final WriteAutoDeployXMLAttributeHandler INSTANCE = new WriteAutoDeployXMLAttributeHandler();
private WriteAutoDeployXMLAttributeHandler() {
- super(new ModelTypeValidator(ModelType.BOOLEAN, false, true), new ModelTypeValidator(ModelType.BOOLEAN, false, false));
+ super(DeploymentScannerDefinition.AUTO_DEPLOY_XML);
}
@Override
@@ -22,10 +22,8 @@
package org.jboss.as.server.deployment.scanner;
-import org.jboss.as.controller.operations.validation.ModelTypeValidator;
import org.jboss.as.server.deployment.scanner.api.DeploymentScanner;
import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
/**
* Toggle the 'auto-deploy-zipped' attribute on a {@code DeploymentScanner}.
@@ -37,7 +35,7 @@
static final WriteAutoDeployZipAttributeHandler INSTANCE = new WriteAutoDeployZipAttributeHandler();
private WriteAutoDeployZipAttributeHandler() {
- super(new ModelTypeValidator(ModelType.BOOLEAN, false, true), new ModelTypeValidator(ModelType.BOOLEAN, false, false));
+ super(DeploymentScannerDefinition.AUTO_DEPLOY_ZIPPED);
}
@Override
@@ -22,10 +22,8 @@
package org.jboss.as.server.deployment.scanner;
-import org.jboss.as.controller.operations.validation.ModelTypeValidator;
import org.jboss.as.server.deployment.scanner.api.DeploymentScanner;
import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
/**
* Update the 'deployment-timeout' attribute on a {@code DeploymentScanner}.
@@ -36,7 +34,7 @@
static final WriteDeploymentTimeoutAttributeHandler INSTANCE = new WriteDeploymentTimeoutAttributeHandler();
public WriteDeploymentTimeoutAttributeHandler() {
- super(new ModelTypeValidator(ModelType.LONG, false, true), new ModelTypeValidator(ModelType.LONG, false, false));
+ super(DeploymentScannerDefinition.DEPLOYMENT_TIMEOUT);
}
protected void updateScanner(final DeploymentScanner scanner, final ModelNode newValue) {
@@ -22,10 +22,8 @@
package org.jboss.as.server.deployment.scanner;
-import org.jboss.as.controller.operations.validation.ModelTypeValidator;
import org.jboss.as.server.deployment.scanner.api.DeploymentScanner;
import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
/**
* Toggle the 'enabled' attribute on a {@code DeploymentScanner}.
@@ -37,7 +35,7 @@
static final WriteEnabledAttributeHandler INSTANCE = new WriteEnabledAttributeHandler();
private WriteEnabledAttributeHandler() {
- super(new ModelTypeValidator(ModelType.BOOLEAN, false, true), new ModelTypeValidator(ModelType.BOOLEAN, false, false));
+ super(DeploymentScannerDefinition.SCAN_ENABLED);
}
@Override
@@ -22,10 +22,8 @@
package org.jboss.as.server.deployment.scanner;
-import org.jboss.as.controller.operations.validation.ModelTypeValidator;
import org.jboss.as.server.deployment.scanner.api.DeploymentScanner;
import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
/**
* Update the 'scanInterval' attribute on a {@code DeploymentScanner}.
@@ -37,7 +35,7 @@
static final WriteScanIntervalAttributeHandler INSTANCE = new WriteScanIntervalAttributeHandler();
private WriteScanIntervalAttributeHandler() {
- super(new ModelTypeValidator(ModelType.INT, false, true), new ModelTypeValidator(ModelType.INT, false, false));
+ super(DeploymentScannerDefinition.SCAN_INTERVAL);
}
@Override
@@ -44,7 +44,12 @@
public static final ServiceName SERVICE_NAME = ServiceName.JBOSS.append("ejb3", "entity-bean", "optimistic-locking");
- public static final EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler INSTANCE = new EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler();
+ public static final EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler INSTANCE =
+ new EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler();
+
+ private EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler() {
+ super(EJB3SubsystemRootResourceDefinition.DEFAULT_ENTITY_BEAN_OPTIMISTIC_LOCKING);
+ }
@Override
protected void validateResolvedValue(String attributeName, ModelNode value) throws OperationFailedException {
@@ -29,6 +29,7 @@
import org.jboss.as.controller.ServiceVerificationHandler;
import org.jboss.as.controller.registry.Resource;
import org.jboss.as.host.controller.HostControllerEnvironment;
+import org.jboss.as.host.controller.resources.HttpManagementResourceDefinition;
import org.jboss.dmr.ModelNode;
/**
@@ -42,6 +43,7 @@
private final HostControllerEnvironment environment;
public HttpManagementWriteAttributeHandler(final LocalHostControllerInfoImpl hostControllerInfo, final HostControllerEnvironment environment) {
+ super(HttpManagementResourceDefinition.ATTRIBUTE_DEFINITIONS);
this.hostControllerInfo = hostControllerInfo;
this.environment = environment;
}
@@ -28,6 +28,7 @@
import java.util.EnumSet;
import org.jboss.as.controller.AttributeDefinition;
+import org.jboss.as.controller.OperationStepHandler;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
import org.jboss.as.controller.ReloadRequiredWriteAttributeHandler;
@@ -46,7 +47,6 @@
*/
public class JacORBSubsystemResource extends SimpleResourceDefinition {
public static final JacORBSubsystemResource INSTANCE = new JacORBSubsystemResource();
- private static final ReloadRequiredWriteAttributeHandler ATTRIBUTE_HANDLER = new ReloadRequiredWriteAttributeHandler();
private JacORBSubsystemResource() {
super(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, JacORBExtension.SUBSYSTEM_NAME),
@@ -58,8 +58,9 @@ private JacORBSubsystemResource() {
@Override
public void registerAttributes(final ManagementResourceRegistration registry) {
+ OperationStepHandler attributeHander = new ReloadRequiredWriteAttributeHandler(JacORBSubsystemDefinitions.SUBSYSTEM_ATTRIBUTES);
for (AttributeDefinition attr : JacORBSubsystemDefinitions.SUBSYSTEM_ATTRIBUTES) {
- registry.registerReadWriteAttribute(attr, null, ATTRIBUTE_HANDLER);
+ registry.registerReadWriteAttribute(attr, null, attributeHander);
}
}
Oops, something went wrong.

0 comments on commit 6db3448

Please sign in to comment.