Example usage for org.apache.commons.lang SystemUtils USER_LANGUAGE

List of usage examples for org.apache.commons.lang SystemUtils USER_LANGUAGE

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils USER_LANGUAGE.

Prototype

String USER_LANGUAGE

To view the source code for org.apache.commons.lang SystemUtils USER_LANGUAGE.

Click Source Link

Document

The user.language System Property.

Usage

From source file:com.yahoo.flowetl.commons.runner.Main.java

/**
 * Gets some useful runtime info as a map of names -> info.
 *///from   w  w  w. ja  va 2s .c om
private static Map<String, Object> getRuntimeInfo() {
    Map<String, Object> sysInfo = new TreeMap<String, Object>();
    StringBuilder jvminfo = new StringBuilder();
    jvminfo.append("Vendor: ");
    jvminfo.append(SystemUtils.JAVA_VENDOR);
    jvminfo.append(", Version: ");
    jvminfo.append(SystemUtils.JAVA_VERSION + " - " + SystemUtils.JAVA_VM_INFO);
    jvminfo.append(", OS: ");
    jvminfo.append(SystemUtils.OS_NAME + " (" + SystemUtils.OS_VERSION + " : " + SystemUtils.OS_ARCH + ")");
    sysInfo.put(WordUtils.capitalizeFully("jvm"), jvminfo.toString());
    sysInfo.put(WordUtils.capitalizeFully("default charset encoding"), DEF_CHAR_SET.name());
    String netAdd = NetUtils.getLocalAddress();
    if (StringUtils.isEmpty(netAdd)) {
        netAdd = "????";
    }
    String localName = NetUtils.getLocalHostName();
    if (StringUtils.isEmpty(localName)) {
        localName = "????";
    }
    sysInfo.put(WordUtils.capitalizeFully("network"), localName + " at ip address " + netAdd);
    String cPath = SystemUtils.JAVA_CLASS_PATH;
    String linesep = StringEscapeUtils.escapeJava(SystemUtils.LINE_SEPARATOR);
    sysInfo.put(WordUtils.capitalizeFully("classpath"), cPath);
    sysInfo.put(WordUtils.capitalizeFully("jvm home"), SystemUtils.JAVA_HOME);
    sysInfo.put(WordUtils.capitalizeFully("jvm tmpdir"), SystemUtils.JAVA_IO_TMPDIR);
    sysInfo.put(WordUtils.capitalizeFully("jvm libpath"), SystemUtils.JAVA_LIBRARY_PATH);
    sysInfo.put(WordUtils.capitalizeFully("line separator"), linesep);
    sysInfo.put(WordUtils.capitalizeFully("path separator"),
            StringEscapeUtils.escapeJava(SystemUtils.PATH_SEPARATOR));
    sysInfo.put(WordUtils.capitalizeFully("user timezone"), SystemUtils.USER_TIMEZONE);
    sysInfo.put(WordUtils.capitalizeFully("user home"), SystemUtils.USER_HOME);
    sysInfo.put(WordUtils.capitalizeFully("user language"), SystemUtils.USER_LANGUAGE);
    sysInfo.put(WordUtils.capitalizeFully("user name"), SystemUtils.USER_NAME);
    return sysInfo;
}

From source file:org.candlepin.client.cmds.SubscribeCommand.java

@Override
protected void execute(CommandLine cmdLine, CandlepinClientFacade client) {
    String[] pools = cmdLine.getOptionValues("p");
    String[] products = cmdLine.getOptionValues("pr");
    String[] regTokens = cmdLine.getOptionValues("r");
    int[] quantity = Utils.toInt(cmdLine.getOptionValues("q"));
    String email = cmdLine.getOptionValue("e");
    String defLocale = StringUtils.defaultIfEmpty(cmdLine.getOptionValue("l"), SystemUtils.USER_LANGUAGE);
    int iter = 0;
    if (!this.getClient().isRegistered()) {
        System.out.println("This system is currently not registered.");
        return;/*from   w  w w  .j  a v a  2s.  c  o m*/
    }
    if (isEmpty(pools) && isEmpty(products) && isEmpty(regTokens)) {
        System.err.println("Error: Need either --product or --pool" + " or --regtoken, Try --help");
        return;
    }
    if (!isEmpty(pools)) {
        for (String pool : pools) {
            client.bindByPool(pool.trim(), Utils.getSafeInt(quantity, iter++, 1));
        }
    }

    if (!isEmpty(products)) {
        for (String product : products) {
            client.bindByProductId(product, Utils.getSafeInt(quantity, iter++, 1));
        }
    }

    if (!isEmpty(regTokens)) {
        for (String token : regTokens) {
            if (StringUtils.isNotBlank(email)) {
                client.bindByRegNumber(token, Utils.getSafeInt(quantity, iter++, 1), email, defLocale);
            } else {
                client.bindByRegNumber(token, Utils.getSafeInt(quantity, iter++, 1));
            }
        }
    }
    client.updateEntitlementCertificates();
}