• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one   *
3  * or more contributor license agreements.  See the NOTICE file *
4  * distributed with this work for additional information        *
5  * regarding copyright ownership.  The ASF licenses this file   *
6  * to you under the Apache License, Version 2.0 (the            *
7  * "License"); you may not use this file except in compliance   *
8  * with the License.  You may obtain a copy of the License at   *
9  *                                                              *
10  *   http://www.apache.org/licenses/LICENSE-2.0                 *
11  *                                                              *
12  * Unless required by applicable law or agreed to in writing,   *
13  * software distributed under the License is distributed on an  *
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
15  * KIND, either express or implied.  See the License for the    *
16  * specific language governing permissions and limitations      *
17  * under the License.                                           *
18  ****************************************************************/
19 
20 package org.apache.james.mime4j.util;
21 
22 //BEGIN android-changed: Stubbing out logging
23 import org.apache.james.mime4j.Log;
24 import org.apache.james.mime4j.LogFactory;
25 //END android-changed
26 
27 /**
28  *
29  * @version $Id: TempStorage.java,v 1.2 2004/10/02 12:41:11 ntherning Exp $
30  */
31 public abstract class TempStorage {
32     private static Log log = LogFactory.getLog(TempStorage.class);
33     private static TempStorage inst = null;
34 
35     static {
36 
37         String clazz = System.getProperty("org.apache.james.mime4j.tempStorage");
38         try {
39 
40             if (inst != null) {
41                 inst = (TempStorage) Class.forName(clazz).newInstance();
42             }
43 
44         } catch (Throwable t) {
45             log.warn("Unable to create or instantiate TempStorage class '"
46                       + clazz + "' using SimpleTempStorage instead", t);
47         }
48 
49         if (inst == null) {
50             inst = new SimpleTempStorage();
51         }
52     }
53 
54     /**
55      * Gets the root temporary path which should be used to
56      * create new temporary paths or files.
57      *
58      * @return the root temporary path.
59      */
getRootTempPath()60     public abstract TempPath getRootTempPath();
61 
getInstance()62     public static TempStorage getInstance() {
63         return inst;
64     }
65 
setInstance(TempStorage inst)66     public static void setInstance(TempStorage inst) {
67         if (inst == null) {
68             throw new NullPointerException("inst");
69         }
70         TempStorage.inst = inst;
71     }
72 }
73