Example usage for com.google.common.base StandardSystemProperty USER_HOME

List of usage examples for com.google.common.base StandardSystemProperty USER_HOME

Introduction

In this page you can find the example usage for com.google.common.base StandardSystemProperty USER_HOME.

Prototype

StandardSystemProperty USER_HOME

To view the source code for com.google.common.base StandardSystemProperty USER_HOME.

Click Source Link

Document

User's home directory.

Usage

From source file:com.github.nbyl.xfdcontrol.service.Application.java

private static void installConfigLocation() throws FileNotFoundException {
    if (Strings.isNullOrEmpty(System.getProperty(SPRING_CONFIG_LOCATION))) {
        File configFile = new File(StandardSystemProperty.USER_HOME.value(), ".xfdcontrol.properties");
        LOGGER.debug("Loading configuration from file {}.", configFile.getAbsolutePath());

        if (!configFile.exists()) {
            throw new FileNotFoundException("Config file " + configFile.getPath() + " does not exist.");
        }//from  w  ww  . ja  va  2s. c  o  m

        System.setProperty(SPRING_CONFIG_LOCATION, configFile.getAbsolutePath());
    } else {
        LOGGER.debug("Configuration location already set.");
    }
}

From source file:ec.tss.tsproviders.jdbc.dsm.identification.aes.KeyGen.java

/**
 * Saves key to default location.//from  ww w.jav  a 2  s .  c o m
 *
 * @param skey
 */
public static void saveKey(final SecretKey skey) {
    saveKey(skey, StandardSystemProperty.USER_HOME.value() + "/.encrypt/", "jdemetra.key");
}

From source file:org.kurento.client.KurentoClient.java

public static synchronized String getKmsUrl(String id, Properties properties) {

    if (properties == null) {
        properties = new Properties();
    }//w  ww . jav a2s  .com

    if (kmsUrlLoader == null) {

        Path configFile = Paths.get(StandardSystemProperty.USER_HOME.value(), ".kurento", "config.properties");

        kmsUrlLoader = new KmsUrlLoader(configFile);
    }

    Object load = properties.get("loadPoints");
    if (load == null) {
        return kmsUrlLoader.getKmsUrl(id);
    } else {
        if (load instanceof Number) {
            return kmsUrlLoader.getKmsUrlLoad(id, ((Number) load).intValue());
        } else {
            return kmsUrlLoader.getKmsUrlLoad(id, Integer.parseInt(load.toString()));
        }
    }
}

From source file:ec.tss.tsproviders.jdbc.dsm.identification.aes.KeyGen.java

/**
 * Retrieves a previously serialized key from the default location.
 *
 * @return/*from w ww. j a v a  2 s .  com*/
 */
public static SecretKeySpec retrieveKeySpec() {
    return retrieveKeySpec(StandardSystemProperty.USER_HOME.value() + "/.encrypt/jdemetra.key");
}

From source file:ec.tss.tsproviders.jdbc.dsm.datasource.DataSourceManager.java

private DataSourceManager() {
    m_dataSources = new HashMap<>();
    m_registered = ArrayListMultimap.create();
    File defaultFolder = Files2.fromPath(StandardSystemProperty.USER_HOME.value(), ".jdemetra");
    defaultFile = new File(defaultFolder, "datasources.xml");
    AccountManager.INSTANCE.setManager(new AESContentManager(defaultFolder, KeyGen.retrieveKeySpec()));

    // Register known types of databases
    registerDataSourceProvider(DataSourceType.MYSQL.getSourceQualifier(), "Server", "Database");
    registerDataSourceProvider(DataSourceType.ORACLE.getSourceQualifier(), "Server", "Port", "SID");

    load();/*  w  ww .  j  a  va2  s.  c om*/
}

From source file:org.kurento.repository.RepositoryClientProvider.java

private static synchronized String getRepositoryUrl() {

    if (repositoryUrlLoader == null) {

        Path configFile = Paths.get(StandardSystemProperty.USER_HOME.value(), ".kurento", "config.properties");

        repositoryUrlLoader = new RepositoryUrlLoader(configFile);
    }//from  w  w w  . j a  va 2 s  . co  m

    return repositoryUrlLoader.getRepositoryUrl();
}

From source file:org.syncany.gui.util.DesktopUtil.java

private static void writeAutostartLinux(boolean launchAtStartupEnabled) {
    File autostartDir = new File(StandardSystemProperty.USER_HOME.value(), ".config/autostart");
    File startupScriptFile = new File(autostartDir, STARTUP_LINUX_SCRIPT_TARGET_FILENAME);

    if (launchAtStartupEnabled) {
        writeLinuxStartupFile(autostartDir, startupScriptFile);
    } else {//  www .  j a  va2 s  .  c o  m
        deleteLinuxStartupScriptFile(startupScriptFile);
    }
}

From source file:com.google.copybara.Main.java

/**
 * Returns the base directory to be used by Copybara to write execution related files (Like
 * logs)./*w w w. j  a  v a  2s  .c o m*/
 */
private String getBaseExecDir() {
    // In this case we are not using GeneralOptions.getEnvironment() because we still haven't built
    // the options, but it's fine. This is the tool's Main and is also injecting System.getEnv()
    // to the options, so the value is the same.
    String userHome = StandardSystemProperty.USER_HOME.value();

    switch (StandardSystemProperty.OS_NAME.value()) {
    case "Linux":
        String xdgCacheHome = System.getenv("XDG_CACHE_HOME");
        return Strings.isNullOrEmpty(xdgCacheHome) ? userHome + "/.cache/" + COPYBARA_NAMESPACE
                : xdgCacheHome + COPYBARA_NAMESPACE;
    case "Mac OS X":
        return userHome + "/Library/Logs/" + COPYBARA_NAMESPACE;
    default:
        return "/var/tmp/" + COPYBARA_NAMESPACE;
    }
}