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

com.tigergraph.jdbc.log.Util Maven / Gradle / Ivy

Go to download

This project is a type 4 jdbc driver which implemented the standard jdbc interface. It supports connectivity to tigergraph server and varieties of query types.

There is a newer version: 1.3.20
Show newest version
package com.tigergraph.jdbc.log;

public class Util {

    /**
     * Convert slf4j message format to java.util.logging style
     * "hello {}, this is {}" -> "hello {0}, this is {1}"
     * 
     * @param format
     * @return
     */
    public static String formatConverter(String format) {
        StringBuilder sb = new StringBuilder();
        int argCount = 0;
        for (int i = 0; i < format.length(); i++) {
            if (i < format.length() - 1 && format.charAt(i) == '{' && format.charAt(i + 1) == '}') {
                sb.append(String.format("{%d}", argCount));
                argCount++;
                i++;
            } else {
                sb.append(format.charAt(i));
            }
        }
        return sb.toString();
    }

    public static final String getSysProperty(String key) {
        try {
            String val = System.getProperty(key);
            return val;
        } catch (SecurityException e) {
            System.out.printf(">>> Unable to get %s: %s, assume a null value.\n", key, e.getMessage());
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy