Source code: org/embl/ebi/escience/scuflui/workbench/TalismanProcessorFactory.java
1 /**
2 * This file is a component of the Taverna project,
3 * and is licensed under the GNU LGPL.
4 * Copyright Tom Oinn, EMBL-EBI
5 */
6 package org.embl.ebi.escience.scuflui.workbench;
7 import org.embl.ebi.escience.scufl.DuplicateProcessorNameException;
8 import org.embl.ebi.escience.scufl.Processor;
9 import org.embl.ebi.escience.scufl.ProcessorCreationException;
10 import org.embl.ebi.escience.scufl.ScuflModel;
11 import org.embl.ebi.escience.scufl.TalismanProcessor;
12
13 import org.embl.ebi.escience.scuflui.workbench.ProcessorFactory;
14 import java.lang.Class;
15 import java.lang.String;
16
17
18
19 /**
20 * Implementation of ProcessorFactory that creates
21 * TalismanProcessor nodes
22 * @author Tom Oinn
23 */
24 public class TalismanProcessorFactory implements ProcessorFactory {
25
26 private String scriptURL;
27
28 /**
29 * Create a new factory configured with the specified
30 * script URL
31 */
32 public TalismanProcessorFactory(String scriptURL) {
33 this.scriptURL = scriptURL;
34 }
35
36 /**
37 * Return the leaf of the path as the factory name
38 */
39 public String toString() {
40 String[] parts = scriptURL.split("/");
41 return parts[parts.length - 1];
42 }
43
44 /**
45 * Create a new SoaplabProcessor and add it to the model
46 */
47 public void createProcessor(String name, ScuflModel model)
48 throws ProcessorCreationException,
49 DuplicateProcessorNameException {
50 Processor theProcessor = new TalismanProcessor(model, name, this.scriptURL);
51 model.addProcessor(theProcessor);
52 }
53
54 /**
55 * Return a textual description of the factory
56 */
57 public String getProcessorDescription() {
58 return "A processor based on Talisman, using the tscript at "+this.scriptURL;
59 }
60
61 /**
62 * Return the Class object for processors that would
63 * be created by this factory
64 */
65 public Class getProcessorClass() {
66 return org.embl.ebi.escience.scufl.TalismanProcessor.class;
67 }
68
69 }