Search in sources :

Example 1 with ContextServiceService

use of org.jboss.as.ee.concurrent.service.ContextServiceService in project wildfly by wildfly.

the class ContextServiceAdd method performRuntime.

@Override
protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
    final ModelNode model = resource.getModel();
    final String name = context.getCurrentAddressValue();
    final String jndiName = ContextServiceResourceDefinition.JNDI_NAME_AD.resolveModelAttribute(context, model).asString();
    final boolean useTransactionSetupProvider = ContextServiceResourceDefinition.USE_TRANSACTION_SETUP_PROVIDER_AD.resolveModelAttribute(context, model).asBoolean();
    // install the service which manages the default context service
    final ContextServiceService contextServiceService = new ContextServiceService(name, jndiName, new DefaultContextSetupProviderImpl());
    final CapabilityServiceBuilder serviceBuilder = context.getCapabilityServiceTarget().addCapability(ContextServiceResourceDefinition.CAPABILITY, contextServiceService);
    if (useTransactionSetupProvider) {
        // add it to deps of context service's service, for injection of its value
        serviceBuilder.addDependency(ConcurrentServiceNames.TRANSACTION_SETUP_PROVIDER_SERVICE_NAME, TransactionSetupProvider.class, contextServiceService.getTransactionSetupProvider());
    }
    serviceBuilder.install();
}
Also used : ContextServiceService(org.jboss.as.ee.concurrent.service.ContextServiceService) CapabilityServiceBuilder(org.jboss.as.controller.CapabilityServiceBuilder) DefaultContextSetupProviderImpl(org.jboss.as.ee.concurrent.DefaultContextSetupProviderImpl) ModelNode(org.jboss.dmr.ModelNode)

Aggregations

CapabilityServiceBuilder (org.jboss.as.controller.CapabilityServiceBuilder)1 DefaultContextSetupProviderImpl (org.jboss.as.ee.concurrent.DefaultContextSetupProviderImpl)1 ContextServiceService (org.jboss.as.ee.concurrent.service.ContextServiceService)1 ModelNode (org.jboss.dmr.ModelNode)1