Java Code Examples for org.jboss.as.controller.registry.ManagementResourceRegistration#registerNotification()

The following examples show how to use org.jboss.as.controller.registry.ManagementResourceRegistration#registerNotification() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OperationWithNotificationTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected void initModel(ManagementModel managementModel) {
    ManagementResourceRegistration registration = managementModel.getRootResourceRegistration();
    registration.registerOperationHandler(new SimpleOperationDefinitionBuilder(MY_OPERATION, new NonResolvingResourceDescriptionResolver())
                    .setPrivateEntry()
                    .build(),
            new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    Notification notification = new Notification(MY_NOTIFICATION_TYPE, PathAddress.pathAddress(operation.get(OP_ADDR)), "notification message");
                    context.emit(notification);
                }
            }
    );
    registration.registerNotification(NotificationDefinition.Builder.create(MY_NOTIFICATION_TYPE, new NonResolvingResourceDescriptionResolver()).build());
}
 
Example 2
Source File: NotificationCompositeOperationTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected void initModel(ManagementModel managementModel) {
    ManagementResourceRegistration registration = managementModel.getRootResourceRegistration();
    registration.registerOperationHandler(CompositeOperationHandler.DEFINITION, CompositeOperationHandler.INSTANCE);

    registration.registerOperationHandler(new SimpleOperationDefinitionBuilder(MY_OPERATION, new NonResolvingResourceDescriptionResolver())
                    .setParameters(FAIL_OPERATION)
            .setPrivateEntry()
            .build(),
            new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    Notification notification = new Notification(MY_NOTIFICATION_TYPE, pathAddress(operation.get(OP_ADDR)), operation.get("param").asString());
                    context.emit(notification);

                    boolean failOperation = FAIL_OPERATION.resolveModelAttribute(context, operation).asBoolean();
                    if (failOperation) {
                        throw new OperationFailedException("failed operation");
                    }
                }
            }
    );
    registration.registerNotification(NotificationDefinition.Builder.create(MY_NOTIFICATION_TYPE, new NonResolvingResourceDescriptionResolver()).build());
}
 
Example 3
Source File: ManagementControllerResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerNotifications(ManagementResourceRegistration resourceRegistration) {
    super.registerNotifications(resourceRegistration);
    resourceRegistration.registerNotification(NOTIFICATION_BEGIN_RUNTIME_MODIFICATION);
    resourceRegistration.registerNotification(NOTIFICATION_COMPLETE_RUNTIME_MODIFICATION);
    resourceRegistration.registerNotification(NOTIFICATION_BOOT_COMPLETE);
}
 
Example 4
Source File: GlobalNotifications.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static void registerGlobalNotifications(ManagementResourceRegistration root, ProcessType processType) {
    root.registerNotification(RESOURCE_ADDED, true);
    root.registerNotification(RESOURCE_REMOVED, true);

    if (processType != ProcessType.DOMAIN_SERVER) {
        root.registerNotification(ATTRIBUTE_VALUE_WRITTEN, true);
    }
}
 
Example 5
Source File: DeploymentResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerNotifications(ManagementResourceRegistration resourceRegistration) {
    for (NotificationDefinition notif : parent.getNotifications()) {
        resourceRegistration.registerNotification(notif);
    }
}