use of org.jboss.as.ejb3.component.messagedriven.DefaultResourceAdapterService in project wildfly by wildfly.
the class DefaultResourceAdapterWriteHandler method updateDefaultAdapterService.
void updateDefaultAdapterService(final OperationContext context, final ModelNode model) throws OperationFailedException {
final ModelNode adapterNameNode = EJB3SubsystemRootResourceDefinition.DEFAULT_RESOURCE_ADAPTER_NAME.resolveModelAttribute(context, model);
final String adapterName = adapterNameNode.isDefined() ? adapterNameNode.asString() : null;
final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
ServiceController<DefaultResourceAdapterService> existingDefaultRANameService = (ServiceController<DefaultResourceAdapterService>) serviceRegistry.getService(DefaultResourceAdapterService.DEFAULT_RA_NAME_SERVICE_NAME);
// if a default RA name service is already installed then just update the resource adapter name
if (existingDefaultRANameService != null) {
existingDefaultRANameService.getValue().setResourceAdapterName(adapterName);
} else if (adapterName != null) {
// create a new one and install
final DefaultResourceAdapterService defaultResourceAdapterService = new DefaultResourceAdapterService(adapterName);
ServiceController<?> newController = context.getServiceTarget().addService(DefaultResourceAdapterService.DEFAULT_RA_NAME_SERVICE_NAME, defaultResourceAdapterService).install();
}
}
Aggregations