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

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

Introduction

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

Prototype

String USER_DIR

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

Click Source Link

Document

The user.dir System Property.

Usage

From source file:mitm.common.template.TemplateBuilderTest.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    templateBuilder = new TemplateBuilderImpl(new File(SystemUtils.USER_DIR));
}

From source file:com.erdfelt.joakim.jsvntk.tasks.SetEolProp.java

public SetEolProp() {
    this.dir = new File(SystemUtils.USER_DIR);
}

From source file:mitm.application.djigzo.ca.PFXMailBuilderTest.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    BasicConfigurator.configure();//from ww  w.  j a  v a2s.  com

    templateBuilder = new TemplateBuilderImpl(new File(SystemUtils.USER_DIR));
}

From source file:ddf.content.plugin.video.TestVideoThumbnailPlugin.java

@Before
public void setUp() throws IOException, MimeTypeParseException, URISyntaxException {
    System.setProperty("ddf.home", SystemUtils.USER_DIR);

    binaryPath = FilenameUtils.concat(System.getProperty("ddf.home"), "bin_third_party");

    setUpMockBundleContext();/*w  w  w.ja  v a2 s  .c o  m*/

    videoThumbnailPlugin = new VideoThumbnailPlugin(mockBundleContext);
}

From source file:org.apache.cocoon.bean.CocoonWrapper.java

/**
 * Look around for the configuration file.
 *
 * @param dir a <code>File</code> where to look for configuration files
 * @return a <code>File</code> representing the configuration
 * @exception IOException if an error occurs
 *///from   w w  w.  ja  v a 2s. c  o m
private File getConfigurationFile(File dir, String configFile) throws IOException {
    File conf;
    if (configFile == null) {
        conf = tryConfigurationFile(dir + File.separator + Constants.DEFAULT_CONF_FILE);
        if (conf == null) {
            conf = tryConfigurationFile(
                    dir + File.separator + "WEB-INF" + File.separator + Constants.DEFAULT_CONF_FILE);
        }
        if (conf == null) {
            conf = tryConfigurationFile(SystemUtils.USER_DIR + File.separator + Constants.DEFAULT_CONF_FILE);
        }
        if (conf == null) {
            conf = tryConfigurationFile("/usr/local/etc/" + Constants.DEFAULT_CONF_FILE);
        }
    } else {
        conf = new File(configFile);
        if (!conf.exists()) {
            conf = new File(dir, configFile);
        }
    }
    if (conf == null) {
        log.error("Could not find the configuration file.");
        throw new FileNotFoundException("The configuration file could not be found.");
    }
    return conf;
}

From source file:org.apache.ctakes.jdl.common.FileUtil.java

/**
 * @param file/*  w  ww  .j a v  a  2  s  . c  o  m*/
 *            the file to get
 * @return the canonical pathname string or USER_DIR if the file is null
 */
public static String getCanonical(File file) {
    return getCanonical(file, SystemUtils.USER_DIR);
}

From source file:org.apache.ctakes.jdl.common.FileUtilTest.java

@Theory
public void getCanonical(String fileName) throws IOException {
    assertThat(FileUtil.getCanonical(null, SystemUtils.USER_HOME), is(SystemUtils.USER_HOME));
    assertThat(FileUtil.getCanonical(null), is(SystemUtils.USER_DIR));
    assertThat(FileUtil.getCanonical(new File(fileName)), is(new File(fileName).getCanonicalPath()));
}

From source file:org.codice.ddf.catalog.content.plugin.video.VideoThumbnailPluginTest.java

@Before
public void setUp() throws IOException, MimeTypeParseException, URISyntaxException {
    System.setProperty("ddf.home", SystemUtils.USER_DIR);

    binaryPath = FilenameUtils.concat(System.getProperty("ddf.home"), "bin_third_party");

    videoThumbnailPlugin = new VideoThumbnailPlugin(createMockBundleContext());
    tmpContentPaths = new HashMap<>();
}

From source file:org.novelang.build.unicode.UnicodeNamesGenerator.java

public static void main(final String[] args) throws IOException {
    final File targetDirectory;
    if (args.length == 0) {
        final File projectDirectory = SystemUtils.USER_DIR.endsWith("idea")
                ? new File(SystemUtils.USER_DIR).getParentFile()
                : new File(SystemUtils.USER_DIR);
        targetDirectory = new File(projectDirectory, "idea/generated/antlr");
    } else if (args.length == 1) {
        targetDirectory = new File(args[0]);
    } else {//from   w ww  . jav a2  s  .c  o m
        throw new IllegalArgumentException(
                "Usage: " + ClassUtils.getShortClassName(UnicodeNamesGenerator.class) + "[target-directory]");
    }
    new UnicodeNamesGenerator("org.novelang.parser.unicode", "names.bin", targetDirectory).generate();

}

From source file:ws.michalski.velogen.VeloGenManager.java

/**
 * Liefert Output-Path fr generierte Dateien
 * // ww  w  .  j a  va2  s .  c o m
 * 1. Es wird geprft, ob Parameter -op gesetzt ist, sonst
 * 2. wird geprft, ob config diese Information enthlt, sonst
 * 3. wird Unterverzeichnis ./output genutzt.
 * 
 * 
 * @return
 */
public String getOutputPath() {

    String outputPath = null;

    if (veloCmd.getCommonParam().getOutputPath() != null) {
        outputPath = veloCmd.getCommonParam().getOutputPath();
    } else if (config.getOutputPath() != null) {
        outputPath = config.getOutputPath();
    } else {
        outputPath = SystemUtils.USER_DIR + SystemUtils.FILE_SEPARATOR + "output";
    }

    Path path = Paths.get(outputPath);

    if (Files.notExists(path, LinkOption.NOFOLLOW_LINKS)
            || !Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS)) {
        logger.error("Output path error");
        // TODO: Exception
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Path " + path.toAbsolutePath().normalize().toString());
    }

    return path.toAbsolutePath().normalize().toString();
}