<commit_before>/**
 * Narvaro: @VERSION@
 * Build Date: @DATE@
 * Commit Head: @HEAD@
 * JDK: @JDK@
 * ANT: @ANT@
 *
 */

package edu.csus.ecs.moneybeets.narvaro.database;

/**
 * Narvaro supported database types.
 *
 */
public enum DatabaseType {

    sqlserver,
    
    mysql,
    
    ;
    <commit_msg>Add database server names and fromString() method<commit_after>/**
 * Narvaro: @VERSION@
 * Build Date: @DATE@
 * Commit Head: @HEAD@
 * JDK: @JDK@
 * ANT: @ANT@
 *
 */

package edu.csus.ecs.moneybeets.narvaro.database;

import java.util.zip.DataFormatException;

/**
 * Narvaro supported database types.
 *
 */
public enum DatabaseType {

    sqlserver("SQL Server"),
    
    mysql("MySQL"),
    
    ;
    
    private DatabaseType(final String name) {
    	this.name = name;
    }
    
    final String name;
    
    /**
     * @return The database name.
     */
    public String getName() {
    	return name;
    }
    
    /**
     * Converts a string to the proper matching DatabaseType.
     * 
     * @param in The string.
     * @return The database type if found.
     * @throws DataFormatException If input is null or empty, or not found.
     */
    public static DatabaseType fromString(final String in) throws DataFormatException {
    	if ("".equals(in) || in == null) {
    		throw new DataFormatException("Input not found");
    	}
    	for (DatabaseType dbType : DatabaseType.values()) {
    		if (in.equalsIgnoreCase(dbType.toString()) 
    				|| in.equalsIgnoreCase(dbType.getName())) {
    			return dbType;
    		}
    	}
    	throw new DataFormatException("Input not found");
    }
    
{'fraction_non_alphanumeric': 0.12407407407407407, 'fraction_numerical': 0.0, 'mean_word_length': 2.427061310782241, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4670442', 'n_tokens_mistral': 542, 'n_tokens_neox': 527, 'n_words': 135}