All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hpccsystems.ws.client.utils.FileFormat Maven / Gradle / Ivy

Go to download

This project allows a user to interact with ESP services in a controlled manner. The API calls available under org.hpccsystems.ws.client.platform allow for a user to target ESP's across multiple environments running a range of hpccsystems-platform versions. There is no guarantee that if a user utilizes org.hpccsystems.ws.client.gen generated stub code from wsdl, that the calls will be backwards compatible with older hpccsystems-platform versions.

There is a newer version: 9.8.20-1
Show newest version
package org.hpccsystems.ws.client.utils;

import java.util.HashMap;

/**
 * Enumeration and convenience methods of known HPCC File formats.
 *
 */
public enum FileFormat
{
    UNKNOWN,
    FLAT,
    CSV,
    XML,
    JSON,
    KEYED;

    private final static HashMap mapFileFormat2Name = new HashMap();
    static
    {
        mapFileFormat2Name.put(FLAT,       "FLAT");
        mapFileFormat2Name.put(CSV,        "CSV");
        mapFileFormat2Name.put(XML,        "XML");
        mapFileFormat2Name.put(JSON,       "JSON");
        mapFileFormat2Name.put(KEYED,      "KEYED");
    }

    public static String getFileFormatName(FileFormat fileformat)
    {
        if(mapFileFormat2Name.containsKey(fileformat))
            return mapFileFormat2Name.get(fileformat);
        else
            return null;
    }

    private final static HashMap mapFileFormatName = new HashMap();
    static
    {
       mapFileFormatName.put("FLAT",     FLAT);
       mapFileFormatName.put("THOR",     FLAT);
       mapFileFormatName.put("FIXED",    FLAT);
       mapFileFormatName.put("CSV",      CSV);
       mapFileFormatName.put("VARIABLE", CSV);
       mapFileFormatName.put("XML",      XML);
       mapFileFormatName.put("JSON",     JSON);
       mapFileFormatName.put("KEYED",    KEYED);
       mapFileFormatName.put("KEY",      KEYED);
       mapFileFormatName.put("INDEX",    KEYED);
    }

    public static FileFormat getFileFormat(String name)
    {
        if (name != null)
        {
            String upperName = name.toUpperCase();
            if (mapFileFormatName.containsKey(upperName))
                return mapFileFormatName.get(upperName);
        }

        return FileFormat.UNKNOWN;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy