01: package org.claros.intouch.common.utility;
02:
03: import java.io.File;
04:
05: import javax.servlet.ServletException;
06: import javax.servlet.http.HttpServlet;
07:
08: import org.apache.commons.logging.Log;
09: import org.apache.commons.logging.LogFactory;
10: import org.claros.commons.exception.SystemException;
11:
12: public class Initiator extends HttpServlet {
13: private static final long serialVersionUID = -1124952420163920030L;
14: private static Log log = LogFactory.getLog(Initiator.class);
15:
16: /**
17: * Initialization of the servlet. <br>
18: *
19: * @throws ServletException if an error occure
20: */
21: public void init() throws ServletException {
22:
23: // delete all files in the tempDir
24: File dir = new File(Constants.tmpDir);
25: if (dir.exists() && dir.isDirectory()) {
26: String files[] = dir.list();
27: for (int i = 0; i < files.length; i++) {
28: File f = new File(Constants.tmpDir + "/" + files[i]);
29: f.delete();
30: }
31: } else {
32: log
33: .fatal("Temp dir does not exist or is not a directory, please check the tmp-dir setting in the config.xml file");
34: throw new SystemException();
35: }
36: }
37:
38: }
|