Skip to content

Commit

Permalink
WFLY-7732 Clustering subsystems use deprecated SimpleAttributeDefinit…
Browse files Browse the repository at this point in the history
…ion.setAllowNull(boolean)
  • Loading branch information
pferraro committed Dec 5, 2016
1 parent 267c85e commit d3795ee
Show file tree
Hide file tree
Showing 36 changed files with 56 additions and 63 deletions.
Expand Up @@ -48,7 +48,7 @@ public ParameterValidatorBuilder allowExpression(boolean allowsExpressions) {
@Override @Override
public ParameterValidatorBuilder configure(AttributeDefinition definition) { public ParameterValidatorBuilder configure(AttributeDefinition definition) {
this.allowsExpressions = definition.isAllowExpression(); this.allowsExpressions = definition.isAllowExpression();
this.allowsUndefined = definition.isAllowNull(); this.allowsUndefined = !definition.isRequired();
return this; return this;
} }


Expand Down
Expand Up @@ -58,7 +58,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, ModelType type, ModelNode defaultValue) { Attribute(String name, ModelType type, ModelNode defaultValue) {
this.definition = new SimpleAttributeDefinitionBuilder(name, type) this.definition = new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build(); .build();
Expand Down
Expand Up @@ -98,7 +98,7 @@ public AttributeDefinition getDefinition() {
static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -59,7 +59,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, ModelType type, ModelNode defaultValue) { Attribute(String name, ModelType type, ModelNode defaultValue) {
this.definition = new SimpleAttributeDefinitionBuilder(name, type) this.definition = new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build(); .build();
Expand Down
Expand Up @@ -154,7 +154,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {


Attribute(String name) { Attribute(String name) {
this.definition = new StringListAttributeDefinition.Builder(name) this.definition = new StringListAttributeDefinition.Builder(name)
.setAllowNull(true) .setRequired(false)
.setAttributeParser(AttributeParsers.COLLECTION) .setAttributeParser(AttributeParsers.COLLECTION)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build(); .build();
Expand Down Expand Up @@ -204,7 +204,7 @@ public AttributeDefinition getDefinition() {
static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
; ;
Expand Down
Expand Up @@ -152,7 +152,7 @@ public AttributeDefinition getDefinition() {
static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
; ;
Expand Down
Expand Up @@ -46,7 +46,7 @@
public class ClusteredCacheResourceDefinition extends CacheResourceDefinition { public class ClusteredCacheResourceDefinition extends CacheResourceDefinition {


enum Attribute implements org.jboss.as.clustering.controller.Attribute { enum Attribute implements org.jboss.as.clustering.controller.Attribute {
MODE("mode", ModelType.STRING, null, new EnumValidatorBuilder<>(Mode.class)), MODE("mode", ModelType.STRING, new EnumValidatorBuilder<>(Mode.class)),
REMOTE_TIMEOUT("remote-timeout", ModelType.LONG, new ModelNode(10000L)), REMOTE_TIMEOUT("remote-timeout", ModelType.LONG, new ModelNode(10000L)),
; ;
private final AttributeDefinition definition; private final AttributeDefinition definition;
Expand All @@ -55,8 +55,8 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
this.definition = createBuilder(name, type, defaultValue).build(); this.definition = createBuilder(name, type, defaultValue).build();
} }


Attribute(String name, ModelType type, ModelNode defaultValue, ParameterValidatorBuilder validator) { Attribute(String name, ModelType type, ParameterValidatorBuilder validator) {
SimpleAttributeDefinitionBuilder builder = createBuilder(name, type, defaultValue); SimpleAttributeDefinitionBuilder builder = createBuilder(name, type, null);
this.definition = builder.setValidator(validator.configure(builder).build()).build(); this.definition = builder.setValidator(validator.configure(builder).build()).build();
} }


Expand Down Expand Up @@ -87,7 +87,7 @@ public AttributeDefinition getDefinition() {
static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(defaultValue != null) .setRequired(defaultValue == null)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -58,7 +58,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, ModelType type) { Attribute(String name, ModelType type) {
this.definition = new SimpleAttributeDefinitionBuilder(name, type) this.definition = new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(false) .setRequired(true)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build(); .build();
} }
Expand Down
Expand Up @@ -78,7 +78,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -78,7 +78,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
; ;
Expand Down
Expand Up @@ -59,7 +59,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, ModelNode defaultValue) { Attribute(String name, ModelNode defaultValue) {
this.definition = new SimpleAttributeDefinitionBuilder(name, ModelType.LONG) this.definition = new SimpleAttributeDefinitionBuilder(name, ModelType.LONG)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit(MeasurementUnit.MILLISECONDS) .setMeasurementUnit(MeasurementUnit.MILLISECONDS)
Expand Down
Expand Up @@ -63,7 +63,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, ModelType type, ModelNode defaultValue) { Attribute(String name, ModelType type, ModelNode defaultValue) {
this.definition = new SimpleAttributeDefinitionBuilder(name, type) this.definition = new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build(); .build();
Expand Down
Expand Up @@ -93,11 +93,11 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
private final AttributeDefinition definition; private final AttributeDefinition definition;


Attribute(String name, ModelType type, CapabilityReferenceRecorder reference) { Attribute(String name, ModelType type, CapabilityReferenceRecorder reference) {
this.definition = createBuilder(name, type, true).setAllowExpression(false).setCapabilityReference(reference).build(); this.definition = createBuilder(name, type, false).setAllowExpression(false).setCapabilityReference(reference).build();
} }


Attribute(String name, ModelType type, ParameterValidatorBuilder validator) { Attribute(String name, ModelType type, ParameterValidatorBuilder validator) {
SimpleAttributeDefinitionBuilder builder = createBuilder(name, type, true).setAllowExpression(true); SimpleAttributeDefinitionBuilder builder = createBuilder(name, type, false).setAllowExpression(true);
this.definition = builder.setValidator(validator.configure(builder).build()).build(); this.definition = builder.setValidator(validator.configure(builder).build()).build();
} }


Expand All @@ -113,7 +113,7 @@ enum DeprecatedAttribute implements org.jboss.as.clustering.controller.Attribute
private final AttributeDefinition definition; private final AttributeDefinition definition;


DeprecatedAttribute(String name, ModelType type, InfinispanModel deprecation) { DeprecatedAttribute(String name, ModelType type, InfinispanModel deprecation) {
this.definition = createBuilder(name, type, true).setAllowExpression(true).setDeprecated(deprecation.getVersion()).build(); this.definition = createBuilder(name, type, false).setAllowExpression(true).setDeprecated(deprecation.getVersion()).build();
} }


@Override @Override
Expand All @@ -122,9 +122,9 @@ public AttributeDefinition getDefinition() {
} }
} }


static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, boolean allowNull) { static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, boolean required) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowNull(allowNull) .setRequired(required)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
; ;
} }
Expand Down Expand Up @@ -201,12 +201,13 @@ public void execute(OperationContext context, ModelNode operation) throws Operat
static final OperationStepHandler DATA_SOURCE_TRANSLATOR = new OperationStepHandler() { static final OperationStepHandler DATA_SOURCE_TRANSLATOR = new OperationStepHandler() {
@Override @Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
if (!operation.hasDefined(JDBCStoreResourceDefinition.Attribute.DATA_SOURCE.getName())) { String targetAttributeName = JDBCStoreResourceDefinition.Attribute.DATA_SOURCE.getName();
if (operation.hasDefined(JDBCStoreResourceDefinition.DeprecatedAttribute.DATASOURCE.getName())) { if (!operation.hasDefined(targetAttributeName)) {
ModelNode jndiName = JDBCStoreResourceDefinition.DeprecatedAttribute.DATASOURCE.resolveModelAttribute(context, operation);
if (jndiName.isDefined()) {
// Translate JNDI name into pool name // Translate JNDI name into pool name
String jndiName = JDBCStoreResourceDefinition.DeprecatedAttribute.DATASOURCE.resolveModelAttribute(context, operation).asString(); String poolName = findPoolName(context, jndiName.asString());
String poolName = findPoolName(context, jndiName); operation.get(targetAttributeName).set(poolName);
operation.get(JDBCStoreResourceDefinition.Attribute.DATA_SOURCE.getName()).set(poolName);
} else { } else {
throw ControllerLogger.MGMT_OP_LOGGER.validationFailedRequiredParameterNotPresent(JDBCStoreResourceDefinition.Attribute.DATA_SOURCE.getDefinition().getName(), operation.toString()); throw ControllerLogger.MGMT_OP_LOGGER.validationFailedRequiredParameterNotPresent(JDBCStoreResourceDefinition.Attribute.DATA_SOURCE.getDefinition().getName(), operation.toString());
} }
Expand Down
Expand Up @@ -144,7 +144,7 @@ public AttributeDefinition getDefinition() {
static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -74,7 +74,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -54,7 +54,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, ModelType type, ModelNode defaultValue) { Attribute(String name, ModelType type, ModelNode defaultValue) {
this.definition = new SimpleAttributeDefinitionBuilder(name, type) this.definition = new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build(); .build();
Expand Down
Expand Up @@ -99,7 +99,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, ModelType type, ModelNode defaultValue) { Attribute(String name, ModelType type, ModelNode defaultValue) {
this.definition = new SimpleAttributeDefinitionBuilder(name, type) this.definition = new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -85,7 +85,7 @@ private static PathElement pathElement(String name) {
private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue, ParameterValidatorBuilder validatorBuilder) { private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue, ParameterValidatorBuilder validatorBuilder) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -89,7 +89,7 @@ public AttributeDefinition getDefinition() {
static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -70,7 +70,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, boolean defaultValue) { Attribute(String name, boolean defaultValue) {
this.definition = new SimpleAttributeDefinitionBuilder(name, ModelType.BOOLEAN) this.definition = new SimpleAttributeDefinitionBuilder(name, ModelType.BOOLEAN)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(new ModelNode(defaultValue)) .setDefaultValue(new ModelNode(defaultValue))
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build(); .build();
Expand Down
Expand Up @@ -87,7 +87,7 @@ public AttributeDefinition getDefinition() {
static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -58,7 +58,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, ModelType type, ModelNode defaultValue) { Attribute(String name, ModelType type, ModelNode defaultValue) {
this.definition = new SimpleAttributeDefinitionBuilder(name, type) this.definition = new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build(); .build();
Expand Down
Expand Up @@ -52,7 +52,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
Attribute(String name, ModelType type, ModelNode defaultValue) { Attribute(String name, ModelType type, ModelNode defaultValue) {
this.definition = new SimpleAttributeDefinitionBuilder(name, type) this.definition = new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build(); .build();
Expand All @@ -76,18 +76,18 @@ enum ColumnAttribute implements org.jboss.as.clustering.controller.Attribute {
ColumnAttribute(String name, String defaultName, String defaultType) { ColumnAttribute(String name, String defaultName, String defaultType) {
this.name = new SimpleAttribute(new SimpleAttributeDefinitionBuilder("name", ModelType.STRING) this.name = new SimpleAttribute(new SimpleAttributeDefinitionBuilder("name", ModelType.STRING)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setDefaultValue(new ModelNode(defaultName)) .setDefaultValue(new ModelNode(defaultName))
.build()); .build());
this.type = new SimpleAttribute(new SimpleAttributeDefinitionBuilder("type", ModelType.STRING) this.type = new SimpleAttribute(new SimpleAttributeDefinitionBuilder("type", ModelType.STRING)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setDefaultValue(new ModelNode(defaultType)) .setDefaultValue(new ModelNode(defaultType))
.build()); .build());
this.definition = ObjectTypeAttributeDefinition.Builder.of(name, this.name.getDefinition(), this.type.getDefinition()) this.definition = ObjectTypeAttributeDefinition.Builder.of(name, this.name.getDefinition(), this.type.getDefinition())
.setAllowNull(true) .setRequired(false)
.setSuffix("column") .setSuffix("column")
.build(); .build();
} }
Expand Down
Expand Up @@ -93,7 +93,7 @@ private static PathElement pathElement(String name) {
private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue, ParameterValidatorBuilder validatorBuilder) { private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue, ParameterValidatorBuilder validatorBuilder) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down
Expand Up @@ -94,7 +94,7 @@ enum Attribute implements org.jboss.as.clustering.controller.Attribute {
private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) { private static SimpleAttributeDefinitionBuilder createBuilder(String name, ModelType type, ModelNode defaultValue) {
return new SimpleAttributeDefinitionBuilder(name, type) return new SimpleAttributeDefinitionBuilder(name, type)
.setAllowExpression(true) .setAllowExpression(true)
.setAllowNull(true) .setRequired(false)
.setDefaultValue(defaultValue) .setDefaultValue(defaultValue)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null) .setMeasurementUnit((type == ModelType.LONG) ? MeasurementUnit.MILLISECONDS : null)
Expand Down

0 comments on commit d3795ee

Please sign in to comment.