use of org.jboss.as.controller.OperationStepHandler in project wildfly by wildfly.
the class AbstractPicketLinkMetricsOperationHandler method execute.
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
final String name = address.getLastElement().getValue();
final String attributeName = operation.require(NAME).asString();
final ServiceController<?> controller = context.getServiceRegistry(false).getRequiredService(createServiceName(name));
try {
PicketLinkFederationService<?> service = (PicketLinkFederationService<?>) controller.getValue();
doPopulateResult(service.getMetrics(), context.getResult(), attributeName);
} catch (Exception e) {
throw PicketLinkLogger.ROOT_LOGGER.failedToGetMetrics(e.getMessage());
}
context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
}
}, OperationContext.Stage.RUNTIME);
context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
}
use of org.jboss.as.controller.OperationStepHandler in project wildfly by wildfly.
the class IDMConfigWriteAttributeHandler method execute.
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final PathAddress address = getParentAddress(PathAddress.pathAddress(operation.require(OP_ADDR)));
Resource resource = context.readResourceFromRoot(address);
final ModelNode parentModel = Resource.Tools.readModel(resource);
PartitionManagerAddHandler.INSTANCE.validateModel(context, address.getLastElement().getValue(), parentModel);
context.stepCompleted();
}
}, OperationContext.Stage.MODEL);
super.execute(context, operation);
}
use of org.jboss.as.controller.OperationStepHandler in project wildfly by wildfly.
the class IdentityConfigurationRemoveStepHandler method updateModel.
@Override
protected void updateModel(OperationContext context, ModelNode operation) throws OperationFailedException {
PathAddress partitionManagerAddress = getParentAddress(context.getCurrentAddress());
Resource partitionManagerResource = context.readResourceFromRoot(partitionManagerAddress);
checkIfLastConfiguration(partitionManagerResource);
ModelNode originalParentModel = Resource.Tools.readModel(partitionManagerResource);
super.updateModel(context, operation);
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
PartitionManagerRemoveHandler.INSTANCE.removeIdentityStoreServices(context, originalParentModel, partitionManagerAddress.getLastElement().getValue(), context.getCurrentAddressValue());
context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER);
}
}, OperationContext.Stage.RUNTIME);
}
use of org.jboss.as.controller.OperationStepHandler in project wildfly by wildfly.
the class ConfigurationResource method registerOperations.
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
super.registerOperations(resourceRegistration);
resourceRegistration.registerOperationHandler(UPDATE_DEFINITION, new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER);
}
});
}
use of org.jboss.as.controller.OperationStepHandler in project wildfly by wildfly.
the class BroadcastGroupAdd method populateModel.
@Override
protected void populateModel(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
super.populateModel(context, operation, resource);
final ModelNode connectorRefs = resource.getModel().get(CONNECTOR_REFS.getName());
if (connectorRefs.isDefined()) {
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
validateConnectors(context, operation, connectorRefs);
}
}, OperationContext.Stage.MODEL);
}
}
Aggregations