use of org.jboss.as.controller.ReloadRequiredRemoveStepHandler in project wildfly by wildfly.
the class ModClusterRemoveCustomMetric method execute.
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
PathAddress parent = PathAddress.pathAddress(ModClusterSubsystemResourceDefinition.PATH, ModClusterConfigResourceDefinition.PATH, DynamicLoadProviderDefinition.PATH);
String clazz = CustomLoadMetricDefinition.CLASS.resolveModelAttribute(context, operation).asString();
String name = getMetricName(context, clazz);
if (name == null) {
context.setRollbackOnly();
} else {
ModelNode targetOperation = Util.createRemoveOperation(parent.append(PathElement.pathElement(CustomLoadMetricDefinition.PATH.getKey(), name)));
context.addStep(targetOperation, new ReloadRequiredRemoveStepHandler(), OperationContext.Stage.MODEL, true);
}
context.stepCompleted();
}
use of org.jboss.as.controller.ReloadRequiredRemoveStepHandler in project wildfly by wildfly.
the class ModClusterRemoveMetric method execute.
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
PathAddress parent = PathAddress.pathAddress(ModClusterSubsystemResourceDefinition.PATH, ModClusterConfigResourceDefinition.PATH, DynamicLoadProviderDefinition.PATH);
String type = LoadMetricDefinition.TYPE.resolveModelAttribute(context, operation).asString();
String name = getMetricName(context, type);
if (name == null) {
context.setRollbackOnly();
} else {
ModelNode targetOperation = Util.createRemoveOperation(parent.append(PathElement.pathElement(LoadMetricDefinition.PATH.getKey(), name)));
context.addStep(targetOperation, new ReloadRequiredRemoveStepHandler(), OperationContext.Stage.MODEL, true);
}
context.stepCompleted();
}
use of org.jboss.as.controller.ReloadRequiredRemoveStepHandler in project wildfly by wildfly.
the class EeLegacySubsystemTestCase method createAdditionalInitialization.
@Override
protected AdditionalInitialization createAdditionalInitialization() {
return new AdditionalInitialization() {
@Override
protected RunningMode getRunningMode() {
return RunningMode.ADMIN_ONLY;
}
@Override
protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) {
if (!extensionAdded) {
//extensionAdded = true;
//bean validation depends on EE, so we can't use the real subsystem here
final OperationDefinition removeExtension = new SimpleOperationDefinitionBuilder("remove", NonResolvingResourceDescriptionResolver.INSTANCE).build();
final OperationDefinition addExtension = new SimpleOperationDefinitionBuilder("add", NonResolvingResourceDescriptionResolver.INSTANCE).addParameter(new SimpleAttributeDefinition("module", ModelType.STRING, false)).build();
PathElement bvExtension = PathElement.pathElement(EXTENSION, "org.wildfly.extension.bean-validation");
ManagementResourceRegistration extensionRegistration = rootRegistration.registerSubModel(new SimpleResourceDefinition(bvExtension, NonResolvingResourceDescriptionResolver.INSTANCE));
extensionRegistration.registerReadOnlyAttribute(new SimpleAttributeDefinition("module", ModelType.STRING, false), new ReloadRequiredWriteAttributeHandler());
extensionRegistration.registerOperationHandler(removeExtension, new ReloadRequiredRemoveStepHandler());
extensionRegistration.registerOperationHandler(addExtension, new ReloadRequiredAddStepHandler(new SimpleAttributeDefinition("module", ModelType.STRING, false)));
final OperationDefinition removeSubsystem = new SimpleOperationDefinitionBuilder("remove", NonResolvingResourceDescriptionResolver.INSTANCE).build();
final OperationDefinition addSubsystem = new SimpleOperationDefinitionBuilder("add", NonResolvingResourceDescriptionResolver.INSTANCE).build();
PathElement bvSubsystem = PathElement.pathElement(SUBSYSTEM, "bean-validation");
ManagementResourceRegistration subsystemRegistration = rootRegistration.registerSubModel(new SimpleResourceDefinition(bvSubsystem, NonResolvingResourceDescriptionResolver.INSTANCE));
subsystemRegistration.registerOperationHandler(removeSubsystem, new ReloadRequiredRemoveStepHandler());
subsystemRegistration.registerOperationHandler(addSubsystem, new ReloadRequiredAddStepHandler());
}
}
};
}
Aggregations