1 package com.googlecode.t7mp.steps;
2
3 import java.io.File;
4 import java.io.IOException;
5
6 import org.apache.commons.io.FileUtils;
7
8 import com.googlecode.t7mp.PluginLog;
9 import com.googlecode.t7mp.T7Configuration;
10
11
12
13
14
15
16
17
18
19
20 public class DeleteDocsAndExamplesStep implements Step {
21
22 protected PluginLog logger;
23 protected T7Configuration configuration;
24
25 @Override
26 public void execute(Context context) {
27 this.logger = context.getLog();
28 this.configuration = context.getConfiguration();
29 if (configuration.isDownloadTomcatExamples()) {
30
31
32 logger.info("Skip deletion of 'docs' and 'examples' directories.");
33 return;
34 }
35
36 try {
37 FileUtils.deleteDirectory(new File(configuration.getCatalinaBase(), "/docs"));
38 } catch (IOException e) {
39 logger.error("Could not delete the 'docs' example.", e);
40 }
41 try {
42 FileUtils.deleteDirectory(new File(configuration.getCatalinaBase(), "/examples"));
43 } catch (IOException e) {
44 logger.error("Could not delete the 'examples' directory.", e);
45 }
46 }
47
48 }