Search in sources :

Example 11 with SimpleOperationDefinitionBuilder

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);
}
Also used : SimpleOperationDefinitionBuilder(org.jboss.as.controller.SimpleOperationDefinitionBuilder) OperationDefinition(org.jboss.as.controller.OperationDefinition)

Example 12 with SimpleOperationDefinitionBuilder

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);
}
Also used : SimpleOperationDefinitionBuilder(org.jboss.as.controller.SimpleOperationDefinitionBuilder) OperationDefinition(org.jboss.as.controller.OperationDefinition)

Example 13 with SimpleOperationDefinitionBuilder

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);
        }
    });
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) SimpleOperationDefinitionBuilder(org.jboss.as.controller.SimpleOperationDefinitionBuilder) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) OperationFailedException(org.jboss.as.controller.OperationFailedException) Resource(org.jboss.as.controller.registry.Resource) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) PropertiesAttributeDefinition(org.jboss.as.controller.PropertiesAttributeDefinition) BinderService(org.jboss.as.naming.service.BinderService) ManagedReferenceFactory(org.jboss.as.naming.ManagedReferenceFactory) ServiceController(org.jboss.msc.service.ServiceController) ModelNode(org.jboss.dmr.ModelNode)

Aggregations

SimpleOperationDefinitionBuilder (org.jboss.as.controller.SimpleOperationDefinitionBuilder)13 OperationDefinition (org.jboss.as.controller.OperationDefinition)6 SimpleOperationDefinition (org.jboss.as.controller.SimpleOperationDefinition)4 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)3 OperationContext (org.jboss.as.controller.OperationContext)2 OperationFailedException (org.jboss.as.controller.OperationFailedException)2 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)2 PathElement (org.jboss.as.controller.PathElement)2 SimpleAttributeDefinition (org.jboss.as.controller.SimpleAttributeDefinition)2 ManagementResourceRegistration (org.jboss.as.controller.registry.ManagementResourceRegistration)2 Resource (org.jboss.as.controller.registry.Resource)2 ModelNode (org.jboss.dmr.ModelNode)2 ResourceDescriptor (org.jboss.as.clustering.controller.ResourceDescriptor)1 ResourceServiceHandler (org.jboss.as.clustering.controller.ResourceServiceHandler)1 SimpleResourceRegistration (org.jboss.as.clustering.controller.SimpleResourceRegistration)1 ObjectListAttributeDefinition (org.jboss.as.controller.ObjectListAttributeDefinition)1 ObjectTypeAttributeDefinition (org.jboss.as.controller.ObjectTypeAttributeDefinition)1 PathAddress (org.jboss.as.controller.PathAddress)1 PropertiesAttributeDefinition (org.jboss.as.controller.PropertiesAttributeDefinition)1 ReloadRequiredAddStepHandler (org.jboss.as.controller.ReloadRequiredAddStepHandler)1