Source code: org/embl/ebi/escience/scuflui/workbench/SoaplabProcessorFactory.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.SoaplabProcessor;
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 * SoaplabProcessor nodes
22 * @author Tom Oinn
23 */
24 public class SoaplabProcessorFactory implements ProcessorFactory {
25
26 private String endpoint;
27 private String applicationname;
28
29 /**
30 * Create a new factory configured with the specified
31 * endpoint base and application name, which will
32 * be concatenated to produce the endpoint URL.
33 */
34 public SoaplabProcessorFactory(String endpointbase, String applicationname) {
35 this.endpoint = endpointbase+applicationname;
36 String[] split = applicationname.split(":");
37 this.applicationname = split[split.length - 1];
38 }
39
40 /**
41 * Return the application name as the toString result
42 */
43 public String toString() {
44 return this.applicationname;
45 }
46
47 /**
48 * Create a new SoaplabProcessor and add it to the model
49 */
50 public void createProcessor(String name, ScuflModel model)
51 throws ProcessorCreationException,
52 DuplicateProcessorNameException {
53 Processor theProcessor = new SoaplabProcessor(model, name, this.endpoint);
54 model.addProcessor(theProcessor);
55 }
56
57 /**
58 * Return a textual description of the factory
59 */
60 public String getProcessorDescription() {
61 return "A processor based on Soaplab, with an access endpoint of "+this.endpoint;
62 }
63
64 /**
65 * Return the Class object for processors that would
66 * be created by this factory
67 */
68 public Class getProcessorClass() {
69 return org.embl.ebi.escience.scufl.SoaplabProcessor.class;
70 }
71
72 }