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

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

Introduction

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

Prototype

public static File getJavaIoTmpDir() 

Source Link

Document

Gets the Java IO temporary directory as a File.

Usage

From source file:org.springframework.integration.twitter.oauth.ConsoleBasedAccessTokenInitialRequestProcessListener.java

public void persistReturnedAccessToken(AccessToken accessToken) throws Exception {
    Map<String, String> output = new HashMap<String, String>();
    output.put(OAuthConfigurationFactoryBean.WELL_KNOWN_CONSUMER_ACCESS_TOKEN, accessToken.getToken());
    output.put(OAuthConfigurationFactoryBean.WELL_KNOWN_CONSUMER_ACCESS_TOKEN_SECRET,
            accessToken.getTokenSecret());

    File accessTokenCreds = new File(SystemUtils.getJavaIoTmpDir(), "twitter-accesstoken.properties");
    FileOutputStream fileOutputStream = new FileOutputStream(accessTokenCreds);
    Properties props = new Properties();
    props.putAll(output);//from  w  w  w  .j  a va2 s  .c  om
    props.store(fileOutputStream, "oauth-access-token");
    IOUtils.closeQuietly(fileOutputStream);

    System.out.println(
            "The oauth accesstoken credentials have been written to " + accessTokenCreds.getAbsolutePath());
}

From source file:org.springsource.greenbeans.examples.edawithspring.etailer.common.MarshallingTests.java

@Before
public void start() throws Exception {
    file = new File(SystemUtils.getJavaIoTmpDir(), "output.xml");
}

From source file:org.wso2.carbon.apimgt.core.SampleTestObjectCreator.java

/**
 * Returns default WSDL 1.0 archive extracted path
 *
 * @return default WSDL 1.0 archive extracted path
 *//* w w  w.  jav a 2s  .  c  o  m*/
public static String createDefaultWSDL11Archive() throws IOException, APIMgtDAOException {
    InputStream zipInputStream = createDefaultWSDL11ArchiveInputStream();
    final String tempFolderPath = SystemUtils.getJavaIoTmpDir() + File.separator + UUID.randomUUID().toString();
    String archivePath = tempFolderPath + File.separator + "wsdl11.zip";
    return APIFileUtils.extractUploadedArchive(zipInputStream, "extracted", archivePath, tempFolderPath);
}

From source file:org.wso2.carbon.apimgt.core.SampleTestObjectCreator.java

/**
 * Returns default WSDL 2.0 archive extracted path
 *
 * @return default WSDL 2.0 archive extracted path
 *///from  w  w  w.jav  a2s.  c o m
public static String createDefaultWSDL20Archive() throws APIMgtDAOException {
    InputStream zipInputStream = Thread.currentThread().getContextClassLoader()
            .getResourceAsStream(PATH_WSDL20_ZIP_1);
    final String tempFolderPath = SystemUtils.getJavaIoTmpDir() + File.separator + UUID.randomUUID().toString();
    String archivePath = tempFolderPath + File.separator + "wsdl20.zip";
    return APIFileUtils.extractUploadedArchive(zipInputStream, "extracted", archivePath, tempFolderPath);
}