private static AgroalDataSource getDataSource(OperationContext context) throws OperationFailedException {
        ServiceRegistry registry = context.getServiceRegistry(false);
        String dataSourceName = context.getCurrentAddressValue();

        switch (context.getCurrentAddress().getLastElement().getKey()) {
            case DataSourceOperations.DATASOURCE_SERVICE_NAME:
                ServiceController<?> controller = registry.getRequiredService(AbstractDataSourceDefinition.DATA_SOURCE_CAPABILITY.getCapabilityServiceName(dataSourceName));
                return ((AgroalDataSource) controller.getValue());
            case XADataSourceOperations.XADATASOURCE_SERVICE_NAME:
                ServiceController<?> xaController = registry.getRequiredService(AbstractDataSourceDefinition.DATA_SOURCE_CAPABILITY.getCapabilityServiceName(dataSourceName));
                return ((AgroalDataSource) xaController.getValue());
            default:
                throw AgroalLogger.SERVICE_LOGGER.unknownDatasourceServiceType(context.getCurrentAddress().getLastElement().getKey());
        }
    }
private static AgroalDataSource getDataSource ( OperationContext context ) throws OperationFailedException { ServiceRegistry registry = context . getServiceRegistry ( false ) ; String dataSourceName = context . getCurrentAddressValue ( ) ; switch ( context . getCurrentAddress ( ) . getLastElement ( ) . getKey ( ) ) { case DataSourceOperations . DATASOURCE_SERVICE_NAME : ServiceController < ? > controller = registry . getRequiredService ( AbstractDataSourceDefinition . DATA_SOURCE_CAPABILITY . getCapabilityServiceName ( dataSourceName ) ) ; return ( ( AgroalDataSource ) controller . getValue ( ) ) ; case XADataSourceOperations . XADATASOURCE_SERVICE_NAME : ServiceController < ? > xaController = registry . getRequiredService ( AbstractDataSourceDefinition . DATA_SOURCE_CAPABILITY . getCapabilityServiceName ( dataSourceName ) ) ; return ( ( AgroalDataSource ) xaController . getValue ( ) ) ; default : throw AgroalLogger . SERVICE_LOGGER . unknownDatasourceServiceType ( context . getCurrentAddress ( ) . getLastElement ( ) . getKey ( ) ) ; } }
--- //