Search in sources :

Example 1 with SimpleOperationDefinition

use of org.jboss.as.controller.SimpleOperationDefinition in project wildfly by wildfly.

the class MessageDrivenBeanResourceDefinition method registerOperations.

@Override
public void registerOperations(ManagementResourceRegistration registry) {
    super.registerOperations(registry);
    final SimpleOperationDefinition startDelivery = new SimpleOperationDefinitionBuilder(START_DELIVERY, getResourceDescriptionResolver()).setRuntimeOnly().build();
    registry.registerOperationHandler(startDelivery, MessageDrivenBeanRuntimeHandler.INSTANCE);
    final SimpleOperationDefinition stopDelivery = new SimpleOperationDefinitionBuilder(STOP_DELIVERY, getResourceDescriptionResolver()).setRuntimeOnly().build();
    registry.registerOperationHandler(stopDelivery, MessageDrivenBeanRuntimeHandler.INSTANCE);
}
Also used : SimpleOperationDefinitionBuilder(org.jboss.as.controller.SimpleOperationDefinitionBuilder) SimpleOperationDefinition(org.jboss.as.controller.SimpleOperationDefinition)

Example 2 with SimpleOperationDefinition

use of org.jboss.as.controller.SimpleOperationDefinition in project wildfly by wildfly.

the class ManagementResourceDefinition method registerOperations.

@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    super.registerOperations(resourceRegistration);
    for (final String statisticName : statistics.getNames()) {
        final ModelType modelType = getModelType(statistics.getType(statisticName));
        if (statistics.isOperation(statisticName)) {
            AttributeDefinition attributeDefinition = new SimpleAttributeDefinitionBuilder(statisticName, modelType, true).setXmlName(statisticName).setAllowExpression(true).setFlags(AttributeAccess.Flag.STORAGE_RUNTIME).build();
            OperationStepHandler operationHandler = new AbstractMetricsHandler() {

                @Override
                void handle(final ModelNode response, OperationContext context, final ModelNode operation) {
                    Object result = statistics.getValue(statisticName, entityManagerFactoryLookup, StatisticNameLookup.statisticNameLookup(statisticName), Path.path(PathAddress.pathAddress(operation.get(ADDRESS))));
                    if (result != null) {
                        setResponse(response, result, modelType);
                    }
                }
            };
            SimpleOperationDefinition definition = new SimpleOperationDefinition(statisticName, descriptionResolver, attributeDefinition);
            resourceRegistration.registerOperationHandler(definition, operationHandler);
        }
    }
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) ModelType(org.jboss.dmr.ModelType) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) ModelNode(org.jboss.dmr.ModelNode) SimpleOperationDefinition(org.jboss.as.controller.SimpleOperationDefinition) SimpleAttributeDefinitionBuilder(org.jboss.as.controller.SimpleAttributeDefinitionBuilder)

Example 3 with SimpleOperationDefinition

use of org.jboss.as.controller.SimpleOperationDefinition in project wildfly by wildfly.

the class JGroupsBroadcastGroupDefinition method registerOperations.

@Override
public void registerOperations(ManagementResourceRegistration registry) {
    super.registerOperations(registry);
    if (registerRuntimeOnly) {
        BroadcastGroupControlHandler.INSTANCE.registerOperations(registry, getResourceDescriptionResolver());
        SimpleOperationDefinition op = new SimpleOperationDefinitionBuilder(GET_CONNECTOR_PAIRS_AS_JSON, getResourceDescriptionResolver()).setReadOnly().setRuntimeOnly().setReplyType(STRING).build();
        registry.registerOperationHandler(op, BroadcastGroupControlHandler.INSTANCE);
    }
}
Also used : SimpleOperationDefinitionBuilder(org.jboss.as.controller.SimpleOperationDefinitionBuilder) SimpleOperationDefinition(org.jboss.as.controller.SimpleOperationDefinition)

Example 4 with SimpleOperationDefinition

use of org.jboss.as.controller.SimpleOperationDefinition in project wildfly by wildfly.

the class SocketBroadcastGroupDefinition method registerOperations.

@Override
public void registerOperations(ManagementResourceRegistration registry) {
    super.registerOperations(registry);
    if (registerRuntimeOnly) {
        BroadcastGroupControlHandler.INSTANCE.registerOperations(registry, getResourceDescriptionResolver());
        SimpleOperationDefinition op = new SimpleOperationDefinitionBuilder(GET_CONNECTOR_PAIRS_AS_JSON, getResourceDescriptionResolver()).setReadOnly().setRuntimeOnly().setReplyType(STRING).build();
        registry.registerOperationHandler(op, BroadcastGroupControlHandler.INSTANCE);
    }
}
Also used : SimpleOperationDefinitionBuilder(org.jboss.as.controller.SimpleOperationDefinitionBuilder) SimpleOperationDefinition(org.jboss.as.controller.SimpleOperationDefinition)

Example 5 with SimpleOperationDefinition

use of org.jboss.as.controller.SimpleOperationDefinition in project wildfly by wildfly.

the class AbstractUpdateJndiHandler method registerOperation.

protected void registerOperation(ManagementResourceRegistration registry, ResourceDescriptionResolver resolver) {
    SimpleOperationDefinition operation = new SimpleOperationDefinition(addOperation ? ADD_JNDI : REMOVE_JNDI, resolver, JNDI_BINDING);
    registry.registerOperationHandler(operation, this);
}
Also used : SimpleOperationDefinition(org.jboss.as.controller.SimpleOperationDefinition)

Aggregations

SimpleOperationDefinition (org.jboss.as.controller.SimpleOperationDefinition)10 SimpleOperationDefinitionBuilder (org.jboss.as.controller.SimpleOperationDefinitionBuilder)6 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)1 OperationContext (org.jboss.as.controller.OperationContext)1 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)1 SimpleAttributeDefinitionBuilder (org.jboss.as.controller.SimpleAttributeDefinitionBuilder)1 ModelNode (org.jboss.dmr.ModelNode)1 ModelType (org.jboss.dmr.ModelType)1