Example usage for org.apache.hadoop.util StringUtils toLowerCase

List of usage examples for org.apache.hadoop.util StringUtils toLowerCase

Introduction

In this page you can find the example usage for org.apache.hadoop.util StringUtils toLowerCase.

Prototype

public static String toLowerCase(String str) 

Source Link

Document

Converts all of the characters in this String to lower case with Locale.ENGLISH.

Usage

From source file:cn.itcast.hadoop.mr.wordcount.DBCountPageView.java

License:Apache License

private void createConnection(String driverClassName //?
        , String url) throws Exception {
    if (StringUtils.toLowerCase(driverClassName).contains("oracle")) { //driverClassName???????oracle ??oracle?
        isOracle = true;//from   w w w . j  a v a 2 s.  c o  m
    }
    Class.forName(driverClassName);
    connection = DriverManager.getConnection(url);
    connection.setAutoCommit(false);
}

From source file:com.bigstep.datalake.DLFileSystem.java

License:Apache License

/**
 * Remove offset parameter, if there is any, from the url
 *///  w w w  .ja  v  a  2  s. co  m
static URL removeOffsetParam(final URL url) throws MalformedURLException {
    String query = url.getQuery();
    if (query == null) {
        return url;
    }
    final String lower = StringUtils.toLowerCase(query);
    if (!lower.startsWith(OFFSET_PARAM_PREFIX) && !lower.contains("&" + OFFSET_PARAM_PREFIX)) {
        return url;
    }

    //rebuild query
    StringBuilder b = null;
    for (final StringTokenizer st = new StringTokenizer(query, "&"); st.hasMoreTokens();) {
        final String token = st.nextToken();
        if (!StringUtils.toLowerCase(token).startsWith(OFFSET_PARAM_PREFIX)) {
            if (b == null) {
                b = new StringBuilder("?").append(token);
            } else {
                b.append('&').append(token);
            }
        }
    }
    query = b == null ? "" : b.toString();

    final String urlStr = url.toString();
    return new URL(urlStr.substring(0, urlStr.indexOf('?')) + query);
}

From source file:com.intel.hadoopRPCBenchmark.HadoopRPCBenchmarkEngine.java

License:Apache License

public static void main(String[] args) throws Exception {
    String mode = "simple";
    int packetSize = 1024; // default 1KB
    int clientNum = 1024; // default 1024 clients
    int execTime = 60; // default 60s

    for (int i = 0; i < args.length; i++) { // parse command line
        if (StringUtils.toLowerCase(args[i]).startsWith("-mode")) {
            mode = args[++i];// www. ja v a2 s  . c om
        } else if (StringUtils.toLowerCase(args[i]).startsWith("-packetsize")) {
            packetSize = parseSize(args[++i]);
        } else if (StringUtils.toLowerCase(args[i]).startsWith("-clientnum")) {
            clientNum = Integer.parseInt(args[++i]);
        } else if (StringUtils.toLowerCase(args[i]).startsWith("-exectime")) {
            execTime = Integer.parseInt(args[++i]);
        } else {
            System.out.println(USAGE);
        }
    }
    HadoopRPCBenchmarkEngine engine = new HadoopRPCBenchmarkEngine(mode, packetSize, clientNum, execTime);
    engine.testRPCThoughput();
}

From source file:org.apache.hadoop.examples.DBCountPageView.java

License:Apache License

private void createConnection(String driverClassName, String url) throws Exception {
    if (StringUtils.toLowerCase(driverClassName).contains("oracle")) {
        isOracle = true;/*from w ww .  j a va 2 s . co m*/
    }
    Class.forName(driverClassName);
    connection = DriverManager.getConnection(url);
    connection.setAutoCommit(false);
}