Rev | Line | |
---|
[29855] | 1 |
|
---|
| 2 | package monogram.plugin;
|
---|
| 3 |
|
---|
| 4 | import 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 | */
|
---|
| 11 | public 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 | if (fileType.equalsIgnoreCase(".txt")) {
|
---|
| 22 | return runPluginTXT(fileView);
|
---|
| 23 | } else if (fileType.equalsIgnoreCase(".docx")) {
|
---|
| 24 | return runPluginDOCX(fileView);
|
---|
| 25 | } else if (fileType.equalsIgnoreCase(".odt")) {
|
---|
| 26 | return runPluginODT(fileView);
|
---|
| 27 | } else {
|
---|
| 28 | throw new UnsupportedOperationException("Not supported yet.");
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | private File runPluginTXT(PluginConfiguration fileView) throws Exception {
|
---|
| 33 | Plugin plugin = new PluginTXT(tmpdir);
|
---|
| 34 | return plugin.run(fileView);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | private File runPluginDOCX(PluginConfiguration fileView) throws Exception {
|
---|
| 38 | Plugin plugin = new PluginDOCX(tmpdir);
|
---|
| 39 | return plugin.run(fileView);
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | private File runPluginODT(PluginConfiguration fileView) throws Exception {
|
---|
| 43 | Plugin plugin = new PluginODT(tmpdir);
|
---|
| 44 | return plugin.run(fileView);
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.