01: /*
02: * Copyright (C) 2006 Erik Swenson - erik@oreports.com
03: *
04: * This program is free software; you can redistribute it and/or modify it
05: * under the terms of the GNU General Public License as published by the Free
06: * Software Foundation; either version 2 of the License, or (at your option)
07: * any later version.
08: *
09: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12: * more details.
13: *
14: * You should have received a copy of the GNU General Public License along with
15: * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16: * Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: */
19:
20: package org.efs.openreports.actions.admin;
21:
22: import java.io.File;
23:
24: import org.apache.commons.io.FileUtils;
25: import org.apache.log4j.Logger;
26: import org.efs.openreports.providers.DirectoryProvider;
27:
28: import com.opensymphony.xwork2.ActionSupport;
29:
30: public class ImageCleanupAction extends ActionSupport {
31: private static final long serialVersionUID = -6328918417249571746L;
32:
33: protected static Logger log = Logger
34: .getLogger(ImageCleanupAction.class);
35:
36: private String submitType;
37:
38: private DirectoryProvider directoryProvider;
39:
40: public String execute() {
41: File imageTempDirectory = new File(directoryProvider
42: .getTempDirectory());
43:
44: try {
45: FileUtils.cleanDirectory(imageTempDirectory);
46: } catch (Exception e) {
47: addActionError(e.toString());
48: }
49:
50: return SUCCESS;
51: }
52:
53: public String getSubmitType() {
54: return submitType;
55: }
56:
57: public void setSubmitType(String submitType) {
58: this .submitType = submitType;
59: }
60:
61: public void setDirectoryProvider(DirectoryProvider directoryProvider) {
62: this.directoryProvider = directoryProvider;
63: }
64:
65: }
|