def jdbc_datasource_present(name,
                            description='',
                            enabled=True,
                            restype='datasource',
                            vendor='mysql',
                            sql_url='',
                            sql_user='',
                            sql_password='',
                            min_size=8,
                            max_size=32,
                            resize_quantity=2,
                            idle_timeout=300,
                            wait_timeout=60,
                            non_transactional=False,
                            transaction_isolation='',
                            isolation_guaranteed=True,
                            server=None):
    '''
    Ensures that the JDBC Datasource exists

    name
        Name of the datasource

    description
        Description of the datasource

    enabled
        Is the datasource enabled? defaults to ``true``

    restype
        Resource type, can be ``datasource``, ``xa_datasource``,
        ``connection_pool_datasource`` or ``driver``, defaults to ``datasource``

    vendor
        SQL Server type, currently supports ``mysql``,
        ``postgresql`` and ``mssql``, defaults to ``mysql``

    sql_url
        URL of the server in jdbc form

    sql_user
        Username for the server

    sql_password
        Password for that username

    min_size
        Minimum and initial number of connections in the pool, defaults to ``8``

    max_size
        Maximum number of connections that can be created in the pool, defaults to ``32``

    resize_quantity
        Number of connections to be removed when idle_timeout expires, defaults to ``2``

    idle_timeout
        Maximum time a connection can remain idle in the pool, in seconds, defaults to ``300``

    wait_timeout
        Maximum time a caller can wait before timeout, in seconds, defaults to ``60``

    non_transactional
        Return non-transactional connections

    transaction_isolation
        Defaults to the JDBC driver default

    isolation_guaranteed
        All connections use the same isolation level
    '''
    ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}

    # Manage parameters
    res_name = 'jdbc/{0}'.format(name)
    pool_data = {}
    pool_data_properties = {}
    res_data = {}
    if restype == 'datasource':
        pool_data['resType'] = 'javax.sql.DataSource'
    elif restype == 'xa_datasource':
        pool_data['resType'] = 'javax.sql.XADataSource'
    elif restype == 'connection_pool_datasource':
        pool_data['resType'] = 'javax.sql.ConnectionPoolDataSource'
    elif restype == 'driver':
        pool_data['resType'] = 'javax.sql.Driver'

    datasources = {}
    datasources['mysql'] = {
        'driver': 'com.mysql.jdbc.Driver',
        'datasource': 'com.mysql.jdbc.jdbc2.optional.MysqlDataSource',
        'xa_datasource': 'com.mysql.jdbc.jdbc2.optional.MysqlXADataSource',
        'connection_pool_datasource': 'com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource'
    }
    datasources['postgresql'] = {
        'driver': 'org.postgresql.Driver',
        'datasource': 'org.postgresql.ds.PGSimpleDataSource',
        'xa_datasource': 'org.postgresql.xa.PGXADataSource',
        'connection_pool_datasource': 'org.postgresql.ds.PGConnectionPoolDataSource'
    }
    datasources['mssql'] = {
        'driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
        'datasource': 'com.microsoft.sqlserver.jdbc.SQLServerDataSource',
        'xa_datasource': 'com.microsoft.sqlserver.jdbc.SQLServerXADataSource',
        'connection_pool_datasource': 'com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource'
    }

    if restype == 'driver':
        pool_data['driverClassname'] = datasources[vendor]['driver']
    else:
        pool_data['datasourceClassname'] = datasources[vendor][restype]

    pool_data_properties['url'] = sql_url
    pool_data_properties['user'] = sql_user
    pool_data_properties['password'] = sql_password
    pool_data['properties'] = pool_data_properties
    pool_data['description'] = description
    res_data['description'] = description
    res_data['poolName'] = name
    res_data['enabled'] = enabled
    pool_data['steadyPoolSize'] = min_size
    pool_data['maxPoolSize'] = max_size
    pool_data['poolResizeQuantity'] = resize_quantity
    pool_data['idleTimeoutInSeconds'] = idle_timeout
    pool_data['maxWaitTimeInMillis'] = wait_timeout*1000
    pool_data['nonTransactionalConnections'] = non_transactional
    pool_data['transactionIsolationLevel'] = transaction_isolation
    pool_data['isIsolationLevelGuaranteed'] = isolation_guaranteed

    pool_ret = _do_element_present(name, 'jdbc_connection_pool', pool_data, server)
    res_ret = _do_element_present(res_name, 'jdbc_resource', res_data, server)

    if not pool_ret['error'] and not res_ret['error']:
        if not __opts__['test']:
            ret['result'] = True

        if pool_ret['create'] or res_ret['create']:
            ret['changes']['pool'] = pool_ret['changes']
            ret['changes']['resource'] = res_ret['changes']
            if __opts__['test']:
                ret['comment'] = 'JDBC Datasource set to be created'
            else:
                ret['comment'] = 'JDBC Datasource created'
        elif pool_ret['update'] or res_ret['update']:
            ret['changes']['pool'] = pool_ret['changes']
            ret['changes']['resource'] = res_ret['changes']
            if __opts__['test']:
                ret['comment'] = 'JDBC Datasource set to be updated'
            else:
                ret['comment'] = 'JDBC Datasource updated'
        else:
            ret['result'] = True
            ret['changes'] = {}
            ret['comment'] = 'JDBC Datasource is already up-to-date'
    else:
        ret['result'] = False
        ret['comment'] = 'ERROR: {0} // {1}'.format(pool_ret['error'], res_ret['error'])

    return ret