KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > spring > integrationtests > framework > TempDirectoryUtil


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.spring.integrationtests.framework;
5
6 import com.tc.exception.TCRuntimeException;
7 import com.tc.test.TempDirectoryHelper;
8 import com.tctest.spring.integrationtests.framework.PropertiesHackForRunningInEclipse;
9
10 import java.io.File JavaDoc;
11 import java.io.IOException JavaDoc;
12
13 public class TempDirectoryUtil {
14
15   private static TempDirectoryHelper tempDirectoryHelper;
16
17   public static File JavaDoc getTempDirectory(Class JavaDoc type) throws IOException JavaDoc {
18     return getTempDirectoryHelper(type).getDirectory();
19   }
20   
21   protected static synchronized TempDirectoryHelper getTempDirectoryHelper(Class JavaDoc type) {
22     if (tempDirectoryHelper == null) {
23       try {
24         PropertiesHackForRunningInEclipse.initializePropertiesWhenRunningInEclipse();
25         tempDirectoryHelper = new TempDirectoryHelper(type, true);
26       } catch (IOException JavaDoc ioe) {
27         throw new TCRuntimeException("Can't get configuration for temp directory", ioe);
28       }
29     }
30
31     return tempDirectoryHelper;
32   }
33
34 }
35
Popular Tags