public static DbProperties build(final Map<String, ?> properties) {
    """
	Initialize a set of database properties based on key / values in a <code>HashMap</code>.
	
	@param properties A <code>HashMap</code> with configuration properties as required by the init() method in JAAS,
	using the keys as specified in this class
	@return A <code>DbProperties</code> object with default values, plus the provided parameters
	@throws NullPointerException When {@code properties} is {@code null}
    """

        Validate.notNull(properties, "The validated object 'properties' is null");

        final DbProperties dbProps = new DbProperties();
        String tmp = getOption(KEY_JNDI_CONNECTION_NAME, properties);
        if (StringUtils.isNotEmpty(tmp)) { // JNDI connection name can be null or empty
            dbProps.setJndiConnectionName(tmp);
            logValue(KEY_JNDI_CONNECTION_NAME, tmp);
        } else {
            dbProps.setJndiConnectionName(DEFAULT_JNDI_NAME);
            logDefault(KEY_JNDI_CONNECTION_NAME, DEFAULT_JNDI_NAME);
        }

        tmp = getOption(KEY_SQL_USER_QUERY, properties);
        if (StringUtils.isNotEmpty(tmp)) { // sql query cannot be null or empty, defaulting to null to catch it
            dbProps.setSqlUserQuery(tmp);
            logValue(KEY_SQL_USER_QUERY, tmp);
        } else {
            dbProps.setSqlUserQuery(DEFAULT_SQL_USER_QUERY);
            logDefault(KEY_SQL_USER_QUERY, DEFAULT_SQL_USER_QUERY);
        }

        // set the additional properties, preserving the originally provided properties
        // create a defensive copy of the map and all its properties
        // the code looks a little more complicated than a simple "putAll()", but it catches situations
        // where a Map is provided that supports null values (e.g. a HashMap) vs Map implementations
        // that do not (e.g. ConcurrentHashMap).
        final Map<String, String> tempMap = new ConcurrentHashMap<>();
        try {
            for (final Map.Entry<String, ?> entry : properties.entrySet()) {
                final String key = entry.getKey();
                final String value = (String) entry.getValue();

                if (value != null) {
                    tempMap.put(key, value);
                }
            }
        } catch (ClassCastException e) {
            final String error = "The values of the configured JAAS properties must be Strings. "
                    + "Sorry, but we do not support anything else here!";
            throw new IllegalArgumentException(error, e);
        }
        dbProps.setAdditionalProperties(tempMap);


        return dbProps;
    }
public static DbProperties build(final Map<String, ?> properties) {

        Validate.notNull(properties, "The validated object 'properties' is null");

        final DbProperties dbProps = new DbProperties();
        String tmp = getOption(KEY_JNDI_CONNECTION_NAME, properties);
        if (StringUtils.isNotEmpty(tmp)) { // JNDI connection name can be null or empty
            dbProps.setJndiConnectionName(tmp);
            logValue(KEY_JNDI_CONNECTION_NAME, tmp);
        } else {
            dbProps.setJndiConnectionName(DEFAULT_JNDI_NAME);
            logDefault(KEY_JNDI_CONNECTION_NAME, DEFAULT_JNDI_NAME);
        }

        tmp = getOption(KEY_SQL_USER_QUERY, properties);
        if (StringUtils.isNotEmpty(tmp)) { // sql query cannot be null or empty, defaulting to null to catch it
            dbProps.setSqlUserQuery(tmp);
            logValue(KEY_SQL_USER_QUERY, tmp);
        } else {
            dbProps.setSqlUserQuery(DEFAULT_SQL_USER_QUERY);
            logDefault(KEY_SQL_USER_QUERY, DEFAULT_SQL_USER_QUERY);
        }

        // set the additional properties, preserving the originally provided properties
        // create a defensive copy of the map and all its properties
        // the code looks a little more complicated than a simple "putAll()", but it catches situations
        // where a Map is provided that supports null values (e.g. a HashMap) vs Map implementations
        // that do not (e.g. ConcurrentHashMap).
        final Map<String, String> tempMap = new ConcurrentHashMap<>();
        try {
            for (final Map.Entry<String, ?> entry : properties.entrySet()) {
                final String key = entry.getKey();
                final String value = (String) entry.getValue();

                if (value != null) {
                    tempMap.put(key, value);
                }
            }
        } catch (ClassCastException e) {
            final String error = "The values of the configured JAAS properties must be Strings. "
                    + "Sorry, but we do not support anything else here!";
            throw new IllegalArgumentException(error, e);
        }
        dbProps.setAdditionalProperties(tempMap);


        return dbProps;
    }
public static DbProperties build ( final Map < String , ? > properties ) { Validate . notNull ( properties , "The validated object 'properties' is null" ) ; final DbProperties dbProps = new DbProperties ( ) ; String tmp = getOption ( KEY_JNDI_CONNECTION_NAME , properties ) ; if ( StringUtils . isNotEmpty ( tmp ) ) { // JNDI connection name can be null or empty dbProps . setJndiConnectionName ( tmp ) ; logValue ( KEY_JNDI_CONNECTION_NAME , tmp ) ; } else { dbProps . setJndiConnectionName ( DEFAULT_JNDI_NAME ) ; logDefault ( KEY_JNDI_CONNECTION_NAME , DEFAULT_JNDI_NAME ) ; } tmp = getOption ( KEY_SQL_USER_QUERY , properties ) ; if ( StringUtils . isNotEmpty ( tmp ) ) { // sql query cannot be null or empty, defaulting to null to catch it dbProps . setSqlUserQuery ( tmp ) ; logValue ( KEY_SQL_USER_QUERY , tmp ) ; } else { dbProps . setSqlUserQuery ( DEFAULT_SQL_USER_QUERY ) ; logDefault ( KEY_SQL_USER_QUERY , DEFAULT_SQL_USER_QUERY ) ; } // set the additional properties, preserving the originally provided properties // create a defensive copy of the map and all its properties // the code looks a little more complicated than a simple "putAll()", but it catches situations // where a Map is provided that supports null values (e.g. a HashMap) vs Map implementations // that do not (e.g. ConcurrentHashMap). final Map < String , String > tempMap = new ConcurrentHashMap <> ( ) ; try { for ( final Map . Entry < String , ? > entry : properties . entrySet ( ) ) { final String key = entry . getKey ( ) ; final String value = ( String ) entry . getValue ( ) ; if ( value != null ) { tempMap . put ( key , value ) ; } } } catch ( ClassCastException e ) { final String error = "The values of the configured JAAS properties must be Strings. " + "Sorry, but we do not support anything else here!" ; throw new IllegalArgumentException ( error , e ) ; } dbProps . setAdditionalProperties ( tempMap ) ; return dbProps ; }
Initialize a set of database properties based on key / values in a <code>HashMap</code>.

@param properties A <code>HashMap</code> with configuration properties as required by the init() method in JAAS,
using the keys as specified in this class
@return A <code>DbProperties</code> object with default values, plus the provided parameters
@throws NullPointerException When {@code properties} is {@code null}
Initialize a set of database properties based on key / values in a <code > HashMap< / code > .