01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.test.server.appserver.deployment;
05:
06: import com.tc.exception.TCRuntimeException;
07: import com.tc.test.TempDirectoryHelper;
08:
09: import java.io.File;
10: import java.io.IOException;
11:
12: public class TempDirectoryUtil {
13:
14: private static TempDirectoryHelper tempDirectoryHelper;
15:
16: public static File getTempDirectory(Class type) throws IOException {
17: return getTempDirectoryHelper(type).getDirectory();
18: }
19:
20: protected static synchronized TempDirectoryHelper getTempDirectoryHelper(
21: Class type) {
22: if (tempDirectoryHelper == null) {
23: try {
24: PropertiesHackForRunningInEclipse
25: .initializePropertiesWhenRunningInEclipse();
26: tempDirectoryHelper = new TempDirectoryHelper(type,
27: true);
28: } catch (IOException ioe) {
29: throw new TCRuntimeException(
30: "Can't get configuration for temp directory",
31: ioe);
32: }
33: }
34:
35: return tempDirectoryHelper;
36: }
37:
38: }
|