List of usage examples for org.apache.commons.lang3 SystemUtils JAVA_IO_TMPDIR
String JAVA_IO_TMPDIR
To view the source code for org.apache.commons.lang3 SystemUtils JAVA_IO_TMPDIR.
Click Source Link
The java.io.tmpdir System Property.
From source file:com.sunchenbin.store.feilong.core.io.SpecialFolder.java
/** * ?./*from w w w . j a v a2s. co m*/ * <ul> * <li>win7:C:\Users\VENUSD~1\AppData\Local\Temp\</li> * <li>win7:C:\Users\feilong\AppData\Local\Temp\</li> * </ul> * * @return ? * * @see org.apache.commons.lang3.SystemUtils#JAVA_IO_TMPDIR */ public static String getTemp() { return SystemUtils.JAVA_IO_TMPDIR; }
From source file:eu.ggnet.dwoss.util.TempUtil.java
/** * Tryies to find a location for Temporary files. Optionaly creates the supplied name as Directory an returns a handle. * * @param name the desired name of the directory * @return a handle to a temp directory// w ww. j ava 2 s . co m * @throws RuntimeException if somthing goes wrong. */ public static File getDirectory(String name) throws RuntimeException { File outputPath = null; if (SystemUtils.JAVA_IO_TMPDIR != null) outputPath = tryPath(new File(SystemUtils.JAVA_IO_TMPDIR), name); if (outputPath == null) outputPath = tryPath(new File(SystemUtils.USER_HOME), "Temp/" + name); if (outputPath == null) { if (SystemUtils.IS_OS_WINDOWS) { outputPath = tryPath(new File("C:/Temp/"), name); if (outputPath == null) outputPath = tryPath(new File("D:/Temp/"), name); } } if (outputPath == null) throw new RuntimeException("No usable Templocation found, giving up"); return outputPath; }
From source file:com.kuzumeji.framework.enterprise.SystemUtilsTest.java
/** #see {@link SystemUtils#JAVA_IO_TMPDIR} */ @Test public void test() { LOG.debug("{}", SystemUtils.JAVA_IO_TMPDIR); }
From source file:com.feilong.commons.core.io.SpecialFolder.java
/** * ?./*from w ww.j a v a2s. co m*/ * <ul> * <li>win7:C:\Users\VENUSD~1\AppData\Local\Temp\</li> * <li>win7:C:\Users\feilong\AppData\Local\Temp\</li> * </ul> * * @return ? * * @see org.apache.commons.lang3.SystemUtils#JAVA_IO_TMPDIR */ public static final String getTemp() { // XXX ??? java.io.tmpdir ???? // String property = "java.io.tmpdir"; // String tempDir = System.getProperty(property); return SystemUtils.JAVA_IO_TMPDIR; }
From source file:com.jaeksoft.searchlib.util.ExecuteUtils.java
final public static int command(File workingDirectory, String cmd, String classpath, boolean setJavaTempDir, OutputStream outputStream, OutputStream errorStream, Long timeOut, String... arguments) throws ExecuteException, IOException { Map<String, String> envMap = null; if (classpath != null) { envMap = new HashMap<String, String>(); envMap.put("CLASSPATH", classpath); }//ww w. j av a2 s . c om CommandLine commandLine = new CommandLine(cmd); if (setJavaTempDir) if (!StringUtils.isEmpty(SystemUtils.JAVA_IO_TMPDIR)) commandLine.addArgument(StringUtils.fastConcat("-Djava.io.tmpdir=", SystemUtils.JAVA_IO_TMPDIR), false); if (arguments != null) for (String argument : arguments) commandLine.addArgument(argument); DefaultExecutor executor = new DefaultExecutor(); if (workingDirectory != null) executor.setWorkingDirectory(workingDirectory); if (outputStream != null) { PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(outputStream, errorStream); executor.setStreamHandler(pumpStreamHandler); } if (timeOut != null) { ExecuteWatchdog watchdog = new ExecuteWatchdog(timeOut); executor.setWatchdog(watchdog); } return envMap != null ? executor.execute(commandLine, envMap) : executor.execute(commandLine); }
From source file:ch.vorburger.mariadb4j.tests.springframework.MariaDB4jSpringServiceStandardDefaultsTest.java
@Test public void testStandardDefaults() { assertNotEquals(3306, s.getConfiguration().getPort()); assertTrue(s.getConfiguration().getBaseDir().contains(SystemUtils.JAVA_IO_TMPDIR)); assertTrue(s.getConfiguration().getDataDir().contains(SystemUtils.JAVA_IO_TMPDIR)); }
From source file:com.norconex.commons.wicket.ThreadContextMocker.java
/** * Invoke this method in the new thread before doing something with Wicket. *///from w ww .java2s. c o m public void mock() { ThreadContext.setApplication(application); ThreadContext.setSession(session); final MockServletContext context = new MockServletContext(application, SystemUtils.JAVA_IO_TMPDIR); ThreadContext.setRequestCycle( application.createRequestCycle(new MockWebRequest(Url.parse("http://localhost/mock")) { @Override public Object getContainerRequest() { return new MockHttpServletRequest(application, new MockHttpSession(context), context); } }, new MockWebResponse())); }
From source file:ch.vorburger.mariadb4j.Util.java
/** * Check for temporary directory name./*w ww. jav a2s .co m*/ * * @param directory directory name * @return true if the passed directory name starts with the system temporary directory name. */ public static boolean isTemporaryDirectory(String directory) { return directory.startsWith(SystemUtils.JAVA_IO_TMPDIR); }
From source file:ch.vorburger.mariadb4j.tests.MariaDB4jSampleOtherTest.java
/** * Reproduces issue #30 re. Exception if there are spaces in the data directory path #30. * //from w ww . j a v a2s.c om * @see <a href="https://github.com/vorburger/MariaDB4j/issues/30">MariaDB4j issue #30</a> */ @Test public void dataDirWithSpace() throws Exception { DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder(); // Note that this dataDir intentionally contains a space before its last word config.setDataDir(SystemUtils.JAVA_IO_TMPDIR + "/MariaDB4j/" + MariaDB4jSampleOtherTest.class.getName() + " dataDirWithSpace"); DB db = DB.newEmbeddedDB(config.build()); db.start(); db.stop(); // see below in customBaseDir() why we need this here FileUtils.deleteQuietly(new File(db.getConfiguration().getBaseDir())); }
From source file:ch.vorburger.mariadb4j.tests.MariaDB4jSampleOtherTest.java
/** * Reproduces issue #39 re. libDir having to be correctly sate "late" and not on DBConfigurationBuilder constructor in case of a * non-default baseDir./* ww w . j a va2s. c o m*/ * * <p>This test passes even without the bug fix if another test "left over" a base dir with a libs/ directory in JAVA_IO_TMPDIR. The two * tests above does clean up after themselves directly. The default behaviour is for the class DB to do this only in a Shutdown hook, * which is too late for what this test wants to ensure. * * @see <a href="https://github.com/vorburger/MariaDB4j/issues/39">MariaDB4j issue #39</a> */ @Test public void customBaseDir() throws Exception { DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder(); config.setBaseDir(SystemUtils.JAVA_IO_TMPDIR + "/MariaDB4j/" + MariaDB4jSampleOtherTest.class.getName() + "customBaseDir"); DB db = DB.newEmbeddedDB(config.build()); db.start(); db.stop(); }