use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class QueueDefinition method registerAttributes.
@Override
public void registerAttributes(ManagementResourceRegistration registry) {
super.registerAttributes(registry);
for (SimpleAttributeDefinition attr : ATTRIBUTES) {
if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) {
if (isRuntime()) {
AttributeDefinition readOnlyRuntimeAttr = create(attr).setStorageRuntime().build();
registry.registerReadOnlyAttribute(readOnlyRuntimeAttr, QueueReadAttributeHandler.RUNTIME_INSTANCE);
} else {
registry.registerReadOnlyAttribute(attr, null);
}
}
}
for (AttributeDefinition attr : READONLY_ATTRIBUTES) {
registry.registerReadOnlyAttribute(attr, QueueReadAttributeHandler.INSTANCE);
}
for (AttributeDefinition metric : METRICS) {
registry.registerMetric(metric, QueueReadAttributeHandler.INSTANCE);
}
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class SecurityRoleDefinition method registerAttributes.
@Override
public void registerAttributes(ManagementResourceRegistration registry) {
super.registerAttributes(registry);
if (runtimeOnly) {
for (SimpleAttributeDefinition attr : ATTRIBUTES) {
AttributeDefinition readOnlyAttr = SimpleAttributeDefinitionBuilder.create(attr).setStorageRuntime().build();
registry.registerReadOnlyAttribute(readOnlyAttr, SecurityRoleReadAttributeHandler.INSTANCE);
}
} else {
for (AttributeDefinition attr : ATTRIBUTES) {
if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) {
registry.registerReadWriteAttribute(attr, null, SecurityRoleAttributeHandler.INSTANCE);
}
}
}
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class AbstractFederationResourceDefinition method createAttributeWriterHandler.
@Override
protected OperationStepHandler createAttributeWriterHandler() {
List<SimpleAttributeDefinition> attributes = getAttributes();
final List<AttributeDefinition> alternativeAttributes = getAlternativesAttributes();
return new ReloadRequiredWriteAttributeHandler(attributes.toArray(new AttributeDefinition[attributes.size()])) {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
if (!alternativeAttributes.isEmpty()) {
context.addStep(new AlternativeAttributeValidationStepHandler(alternativeAttributes.toArray(new AttributeDefinition[alternativeAttributes.size()])), OperationContext.Stage.MODEL);
}
doRegisterModelWriteAttributeHandler(context, operation);
super.execute(context, operation);
}
};
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class AlternativeAttributeValidationStepHandler method validateAlternatives.
protected void validateAlternatives(OperationContext context, ModelNode operation) throws OperationFailedException {
ModelNode elementNode = context.readResource(EMPTY_ADDRESS, false).getModel();
PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
ModelNode definedAttribute = null;
for (AttributeDefinition attribute : this.attributes) {
if (elementNode.hasDefined(attribute.getName())) {
if (definedAttribute != null) {
throw ROOT_LOGGER.invalidAlternativeAttributeOccurrence(attribute.getName(), address.getLastElement().toString(), getAttributeNames());
}
definedAttribute = attribute.resolveModelAttribute(context, elementNode);
}
}
if (this.required && definedAttribute == null) {
throw ROOT_LOGGER.requiredAlternativeAttributes(address.getLastElement().toString(), getAttributeNames());
}
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class AbstractIDMResourceDefinition method createAttributeWriterHandler.
@Override
protected OperationStepHandler createAttributeWriterHandler() {
List<SimpleAttributeDefinition> attributes = getAttributes();
final List<AttributeDefinition> alternativeAttributes = getAlternativesAttributes();
return new IDMConfigWriteAttributeHandler(attributes.toArray(new AttributeDefinition[attributes.size()])) {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
if (!alternativeAttributes.isEmpty()) {
context.addStep(new AlternativeAttributeValidationStepHandler(alternativeAttributes.toArray(new AttributeDefinition[alternativeAttributes.size()])), OperationContext.Stage.MODEL);
}
doRegisterModelWriteAttributeHandler(context, operation);
super.execute(context, operation);
}
};
}
Aggregations