source: other-projects/the-macronizer/trunk/src/java/monogram/plugin/PluginManager.java@ 29855

Last change on this file since 29855 was 29855, checked in by davidb, 9 years ago

John's code after refactoring by Tom over the summer of 2014/2015

File size: 1.5 KB
Line 
1
2package monogram.plugin;
3
4import java.io.File;
5
6/**
7 * @author University of Waikato - Te Whare Wānanga o Waikato
8 * @version 1.0
9 * @since 2014-11-20
10 */
11public class PluginManager implements Plugin {
12
13 private File tmpdir;
14
15 public PluginManager(File tmpdir) {
16 this.tmpdir = tmpdir;
17 }
18
19 public File run(PluginConfiguration fileView) throws UnsupportedOperationException, Exception {
20 String fileType = fileView.getFileType();
21 System.out.println("test 2");
22 if (fileType.equalsIgnoreCase(".txt")) {
23 System.out.println("test 3");
24 return runPluginTXT(fileView);
25 } else if (fileType.equalsIgnoreCase(".docx")) {
26 return runPluginDOCX(fileView);
27 } else if (fileType.equalsIgnoreCase(".odt")) {
28 return runPluginODT(fileView);
29 } else {
30 throw new UnsupportedOperationException("Not supported yet.");
31 }
32 }
33
34 private File runPluginTXT(PluginConfiguration fileView) throws Exception {
35 Plugin plugin = new PluginTXT(tmpdir);
36 System.out.println("test 4");
37 return plugin.run(fileView);
38 }
39
40 private File runPluginDOCX(PluginConfiguration fileView) throws Exception {
41 Plugin plugin = new PluginDOCX(tmpdir);
42 return plugin.run(fileView);
43 }
44
45 private File runPluginODT(PluginConfiguration fileView) throws Exception {
46 Plugin plugin = new PluginODT(tmpdir);
47 return plugin.run(fileView);
48 }
49}
Note: See TracBrowser for help on using the repository browser.