Search in sources :

Example 1 with SimpleResourceDefinition

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

the class MessagingExtension method initialize.

public void initialize(ExtensionContext context) {
    final SubsystemRegistration subsystemRegistration = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
    subsystemRegistration.registerXMLElementWriter(MessagingSubsystemParser_1_1.INSTANCE);
    boolean registerRuntimeOnly = context.isRuntimeOnlyRegistrationValid();
    // Root resource
    final ManagementResourceRegistration subsystem = subsystemRegistration.registerSubsystemModel(MessagingSubsystemRootResourceDefinition.INSTANCE);
    subsystem.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
    // ActiveMQ Servers
    final ManagementResourceRegistration server = subsystem.registerSubModel(new ServerDefinition(registerRuntimeOnly));
    for (PathDefinition path : new PathDefinition[] { PathDefinition.JOURNAL_INSTANCE, PathDefinition.BINDINGS_INSTANCE, PathDefinition.LARGE_MESSAGES_INSTANCE, PathDefinition.PAGING_INSTANCE }) {
        ManagementResourceRegistration pathRegistry = server.registerSubModel(path);
        PathDefinition.registerResolveOperationHandler(context, pathRegistry);
    }
    subsystem.registerSubModel(JMSBridgeDefinition.INSTANCE);
    if (registerRuntimeOnly) {
        final ManagementResourceRegistration deployment = subsystemRegistration.registerDeploymentModel(new SimpleResourceDefinition(SUBSYSTEM_PATH, getResourceDescriptionResolver("deployed")));
        final ManagementResourceRegistration deployedServer = deployment.registerSubModel(new SimpleResourceDefinition(SERVER_PATH, getResourceDescriptionResolver(SERVER)));
        deployedServer.registerSubModel(new JMSQueueDefinition(true, registerRuntimeOnly));
        deployedServer.registerSubModel(new JMSTopicDefinition(true, registerRuntimeOnly));
        deployedServer.registerSubModel(PooledConnectionFactoryDefinition.DEPLOYMENT_INSTANCE);
    }
    if (context.isRegisterTransformers()) {
        MessagingSubsystemRootResourceDefinition.registerTransformers(subsystemRegistration);
    }
}
Also used : JMSTopicDefinition(org.wildfly.extension.messaging.activemq.jms.JMSTopicDefinition) SimpleResourceDefinition(org.jboss.as.controller.SimpleResourceDefinition) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) JMSQueueDefinition(org.wildfly.extension.messaging.activemq.jms.JMSQueueDefinition) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration)

Example 2 with SimpleResourceDefinition

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

the class BatchSubsystemExtension method initialize.

@Override
public void initialize(ExtensionContext context) {
    final SubsystemRegistration subsystem = context.registerSubsystem(BatchSubsystemDefinition.NAME, CURRENT_MODEL_VERSION);
    subsystem.registerSubsystemModel(BatchSubsystemDefinition.INSTANCE);
    subsystem.registerXMLElementWriter(BatchSubsystemParser.INSTANCE);
    // Register the deployment resources
    if (context.isRuntimeOnlyRegistrationValid()) {
        final SimpleResourceDefinition deploymentResource = new SimpleResourceDefinition(new SimpleResourceDefinition.Parameters(BatchSubsystemDefinition.SUBSYSTEM_PATH, BatchResourceDescriptionResolver.getResourceDescriptionResolver("deployment")).setRuntime());
        final ManagementResourceRegistration deployments = subsystem.registerDeploymentModel(deploymentResource);
        final ManagementResourceRegistration jobRegistration = deployments.registerSubModel(BatchJobResourceDefinition.INSTANCE);
        jobRegistration.registerSubModel(new BatchJobExecutionResourceDefinition());
    }
}
Also used : BatchJobExecutionResourceDefinition(org.wildfly.extension.batch.jberet.deployment.BatchJobExecutionResourceDefinition) SimpleResourceDefinition(org.jboss.as.controller.SimpleResourceDefinition) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration)

Example 3 with SimpleResourceDefinition

use of org.jboss.as.controller.SimpleResourceDefinition 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)

Example 4 with SimpleResourceDefinition

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

the class EJB3Extension method initialize.

/**
     * {@inheritDoc}
     */
@Override
public void initialize(ExtensionContext context) {
    final boolean registerRuntimeOnly = context.isRuntimeOnlyRegistrationValid();
    final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
    subsystem.registerXMLElementWriter(EJB3SubsystemXMLPersister.INSTANCE);
    PathManager pathManager = context.getProcessType().isServer() ? context.getPathManager() : null;
    subsystem.registerSubsystemModel(new EJB3SubsystemRootResourceDefinition(registerRuntimeOnly, pathManager));
    if (registerRuntimeOnly) {
        ResourceDefinition deploymentsDef = new SimpleResourceDefinition(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, SUBSYSTEM_NAME), getResourceDescriptionResolver("deployed"));
        final ManagementResourceRegistration deploymentsRegistration = subsystem.registerDeploymentModel(deploymentsDef);
        deploymentsRegistration.registerSubModel(MessageDrivenBeanResourceDefinition.INSTANCE);
        deploymentsRegistration.registerSubModel(SingletonBeanDeploymentResourceDefinition.INSTANCE);
        deploymentsRegistration.registerSubModel(StatelessSessionBeanDeploymentResourceDefinition.INSTANCE);
        deploymentsRegistration.registerSubModel(StatefulSessionBeanDeploymentResourceDefinition.INSTANCE);
    }
    // Transformers
    if (context.isRegisterTransformers()) {
        EJB3SubsystemRootResourceDefinition.registerTransformers(subsystem);
    }
}
Also used : PathManager(org.jboss.as.controller.services.path.PathManager) StatelessSessionBeanDeploymentResourceDefinition(org.jboss.as.ejb3.subsystem.deployment.StatelessSessionBeanDeploymentResourceDefinition) SimpleResourceDefinition(org.jboss.as.controller.SimpleResourceDefinition) SingletonBeanDeploymentResourceDefinition(org.jboss.as.ejb3.subsystem.deployment.SingletonBeanDeploymentResourceDefinition) ResourceDefinition(org.jboss.as.controller.ResourceDefinition) MessageDrivenBeanResourceDefinition(org.jboss.as.ejb3.subsystem.deployment.MessageDrivenBeanResourceDefinition) StatefulSessionBeanDeploymentResourceDefinition(org.jboss.as.ejb3.subsystem.deployment.StatefulSessionBeanDeploymentResourceDefinition) SimpleResourceDefinition(org.jboss.as.controller.SimpleResourceDefinition) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration)

Aggregations

SimpleResourceDefinition (org.jboss.as.controller.SimpleResourceDefinition)4 ManagementResourceRegistration (org.jboss.as.controller.registry.ManagementResourceRegistration)4 SubsystemRegistration (org.jboss.as.controller.SubsystemRegistration)3 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 ResourceDefinition (org.jboss.as.controller.ResourceDefinition)1 SimpleAttributeDefinition (org.jboss.as.controller.SimpleAttributeDefinition)1 SimpleOperationDefinitionBuilder (org.jboss.as.controller.SimpleOperationDefinitionBuilder)1 RuntimeCapabilityRegistry (org.jboss.as.controller.capability.registry.RuntimeCapabilityRegistry)1 ExtensionRegistry (org.jboss.as.controller.extension.ExtensionRegistry)1 Resource (org.jboss.as.controller.registry.Resource)1 PathManager (org.jboss.as.controller.services.path.PathManager)1 MessageDrivenBeanResourceDefinition (org.jboss.as.ejb3.subsystem.deployment.MessageDrivenBeanResourceDefinition)1 SingletonBeanDeploymentResourceDefinition (org.jboss.as.ejb3.subsystem.deployment.SingletonBeanDeploymentResourceDefinition)1 StatefulSessionBeanDeploymentResourceDefinition (org.jboss.as.ejb3.subsystem.deployment.StatefulSessionBeanDeploymentResourceDefinition)1 StatelessSessionBeanDeploymentResourceDefinition (org.jboss.as.ejb3.subsystem.deployment.StatelessSessionBeanDeploymentResourceDefinition)1 AdditionalInitialization (org.jboss.as.subsystem.test.AdditionalInitialization)1