Search in sources :

Example 1 with RuntimeCapabilityRegistry

use of org.jboss.as.controller.capability.registry.RuntimeCapabilityRegistry in project wildfly by wildfly.

the class EeLegacySubsystemTestCase method createAdditionalInitialization.

@Override
protected AdditionalInitialization createAdditionalInitialization() {
    return new AdditionalInitialization() {

        @Override
        protected RunningMode getRunningMode() {
            return RunningMode.ADMIN_ONLY;
        }

        @Override
        protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) {
            if (!extensionAdded) {
                //extensionAdded = true;
                //bean validation depends on EE, so we can't use the real subsystem here
                final OperationDefinition removeExtension = new SimpleOperationDefinitionBuilder("remove", NonResolvingResourceDescriptionResolver.INSTANCE).build();
                final OperationDefinition addExtension = new SimpleOperationDefinitionBuilder("add", NonResolvingResourceDescriptionResolver.INSTANCE).addParameter(new SimpleAttributeDefinition("module", ModelType.STRING, false)).build();
                PathElement bvExtension = PathElement.pathElement(EXTENSION, "org.wildfly.extension.bean-validation");
                ManagementResourceRegistration extensionRegistration = rootRegistration.registerSubModel(new SimpleResourceDefinition(bvExtension, NonResolvingResourceDescriptionResolver.INSTANCE));
                extensionRegistration.registerReadOnlyAttribute(new SimpleAttributeDefinition("module", ModelType.STRING, false), new ReloadRequiredWriteAttributeHandler());
                extensionRegistration.registerOperationHandler(removeExtension, new ReloadRequiredRemoveStepHandler());
                extensionRegistration.registerOperationHandler(addExtension, new ReloadRequiredAddStepHandler(new SimpleAttributeDefinition("module", ModelType.STRING, false)));
                final OperationDefinition removeSubsystem = new SimpleOperationDefinitionBuilder("remove", NonResolvingResourceDescriptionResolver.INSTANCE).build();
                final OperationDefinition addSubsystem = new SimpleOperationDefinitionBuilder("add", NonResolvingResourceDescriptionResolver.INSTANCE).build();
                PathElement bvSubsystem = PathElement.pathElement(SUBSYSTEM, "bean-validation");
                ManagementResourceRegistration subsystemRegistration = rootRegistration.registerSubModel(new SimpleResourceDefinition(bvSubsystem, NonResolvingResourceDescriptionResolver.INSTANCE));
                subsystemRegistration.registerOperationHandler(removeSubsystem, new ReloadRequiredRemoveStepHandler());
                subsystemRegistration.registerOperationHandler(addSubsystem, new ReloadRequiredAddStepHandler());
            }
        }
    };
}
Also used : RuntimeCapabilityRegistry(org.jboss.as.controller.capability.registry.RuntimeCapabilityRegistry) SimpleOperationDefinitionBuilder(org.jboss.as.controller.SimpleOperationDefinitionBuilder) Resource(org.jboss.as.controller.registry.Resource) SimpleResourceDefinition(org.jboss.as.controller.SimpleResourceDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) AdditionalInitialization(org.jboss.as.subsystem.test.AdditionalInitialization) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler) ReloadRequiredAddStepHandler(org.jboss.as.controller.ReloadRequiredAddStepHandler) ExtensionRegistry(org.jboss.as.controller.extension.ExtensionRegistry) PathElement(org.jboss.as.controller.PathElement) ReloadRequiredRemoveStepHandler(org.jboss.as.controller.ReloadRequiredRemoveStepHandler) OperationDefinition(org.jboss.as.controller.OperationDefinition)

Aggregations

OperationDefinition (org.jboss.as.controller.OperationDefinition)1 PathElement (org.jboss.as.controller.PathElement)1 ReloadRequiredAddStepHandler (org.jboss.as.controller.ReloadRequiredAddStepHandler)1 ReloadRequiredRemoveStepHandler (org.jboss.as.controller.ReloadRequiredRemoveStepHandler)1 ReloadRequiredWriteAttributeHandler (org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)1 SimpleAttributeDefinition (org.jboss.as.controller.SimpleAttributeDefinition)1 SimpleOperationDefinitionBuilder (org.jboss.as.controller.SimpleOperationDefinitionBuilder)1 SimpleResourceDefinition (org.jboss.as.controller.SimpleResourceDefinition)1 RuntimeCapabilityRegistry (org.jboss.as.controller.capability.registry.RuntimeCapabilityRegistry)1 ExtensionRegistry (org.jboss.as.controller.extension.ExtensionRegistry)1 ManagementResourceRegistration (org.jboss.as.controller.registry.ManagementResourceRegistration)1 Resource (org.jboss.as.controller.registry.Resource)1 AdditionalInitialization (org.jboss.as.subsystem.test.AdditionalInitialization)1