01: /*
02: * Milin Radivoj
03: * rmilin@gmail.com
04: */
05:
06: package org.enhydra.snapperPreviewer.business;
07:
08: import java.io.File;
09: import java.util.ArrayList;
10: import java.util.Iterator;
11:
12: import org.apache.xmlbeans.XmlOptions;
13: import org.enhydra.snapper.SnapperManager;
14: import org.enhydra.snapper.xml.configuration.DOCUMENTGROUPLISTDocument;
15: import org.enhydra.snapper.xml.configuration.SITELISTDocument;
16: import org.enhydra.snapper.xml.configuration.DOCUMENTGROUPLISTDocument.DOCUMENTGROUPLIST;
17: import org.enhydra.snapper.xml.configuration.PATHDocument.PATH;
18: import org.enhydra.snapper.xml.configuration.SITEDocument.SITE;
19: import org.enhydra.snapperPreviewer.Previewer;
20: import org.enhydra.snapperPreviewer.spec.DocumentGroup;
21: import org.enhydra.snapperPreviewer.spec.Site;
22: import org.enhydra.snapperPreviewer.spec.SiteList;
23:
24: /**
25: * @author Milin Radivoj
26: */
27:
28: public class DeleterImpl implements SiteList {
29:
30: private Thread runThread;
31:
32: private static long timeToSleep = 24;
33:
34: public static boolean stop = false;
35:
36: public Site[] getList() {
37:
38: return null;
39: }
40:
41: public Site findSiteByName(String name) {
42:
43: return null;
44: }
45:
46: public DocumentGroup getDefaultDocumentGroup() {
47:
48: return null;
49: }
50:
51: public void init(String confFilePath,
52: String documentGroupConfFilePath) {
53:
54: }
55:
56: public void run() {
57: runThread = Thread.currentThread();
58: while (!stop) {
59: timeToSleep = (new Long(
60: Previewer.getTimeToSleep() * 1000 * 60))
61: .longValue();
62: try {
63: File temp = new File(SnapperManager.getInstance()
64: .getTempDir()
65: + File.separator);
66: FinalDeleter.deleteDir(temp);
67: Thread.sleep(timeToSleep);
68: } catch (Exception e) {
69: Thread.currentThread().interrupt();
70: }
71:
72: }
73: }
74:
75: public void stopThread() {
76: stop = true;
77: if (runThread != null) {
78: runThread.interrupt();
79: }
80: }
81: }
|