use of org.jboss.as.controller.SimpleOperationDefinitionBuilder in project wildfly by wildfly.
the class LogStoreDefinition method registerOperations.
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
super.registerOperations(resourceRegistration);
final OperationDefinition probe = new SimpleOperationDefinitionBuilder(LogStoreConstants.PROBE, getResourceDescriptionResolver()).setRuntimeOnly().setReadOnly().build();
resourceRegistration.registerOperationHandler(probe, LogStoreProbeHandler.INSTANCE);
}
use of org.jboss.as.controller.SimpleOperationDefinitionBuilder in project wildfly by wildfly.
the class EJB3SubsystemRootResourceDefinition method registerAddOperation.
/**
* Overrides the default impl to use a special definition of the add op that includes additional parameter
* {@link #DEFAULT_CLUSTERED_SFSB_CACHE}
* {@inheritDoc}
*/
@Override
protected void registerAddOperation(ManagementResourceRegistration registration, AbstractAddStepHandler handler, OperationEntry.Flag... flags) {
OperationDefinition od = new SimpleOperationDefinitionBuilder(ADD, getResourceDescriptionResolver()).setParameters(ATTRIBUTES).addParameter(DEFAULT_CLUSTERED_SFSB_CACHE).withFlags(flags).build();
registration.registerOperationHandler(od, handler);
}
use of org.jboss.as.controller.SimpleOperationDefinitionBuilder in project wildfly by wildfly.
the class NamingBindingResourceDefinition method registerOperations.
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
super.registerOperations(resourceRegistration);
SimpleOperationDefinitionBuilder builder = new SimpleOperationDefinitionBuilder(NamingSubsystemModel.REBIND, getResourceDescriptionResolver()).addParameter(BINDING_TYPE).addParameter(TYPE).addParameter(VALUE).addParameter(CLASS).addParameter(MODULE).addParameter(LOOKUP).addParameter(ENVIRONMENT);
resourceRegistration.registerOperationHandler(builder.build(), new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
validateResourceModel(operation, false);
Resource resource = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS);
ModelNode model = resource.getModel();
for (AttributeDefinition attr : ATTRIBUTES) {
attr.validateAndSet(operation, model);
}
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final String name = context.getCurrentAddressValue();
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name);
ServiceController<ManagedReferenceFactory> service = (ServiceController<ManagedReferenceFactory>) context.getServiceRegistry(false).getService(bindInfo.getBinderServiceName());
if (service == null) {
context.reloadRequired();
return;
}
NamingBindingAdd.INSTANCE.doRebind(context, operation, (BinderService) service.getService());
}
}, OperationContext.Stage.RUNTIME);
}
}, OperationContext.Stage.MODEL);
}
});
}
Aggregations