Source code: org/embl/ebi/escience/scuflui/workbench/WSDLBasedProcessorFactory.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.WSDLBasedProcessor;
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 * WSDLBasedProcessor nodes
22 * @author Tom Oinn
23 */
24 public class WSDLBasedProcessorFactory implements ProcessorFactory {
25
26 String wsdlLocation, portTypeName, operationName;
27
28 /**
29 * Create a new factory with the specified wsdl location,
30 * port type name and operation name
31 */
32 public WSDLBasedProcessorFactory(String wsdlLocation, String portTypeName, String operationName) {
33 this.wsdlLocation = wsdlLocation;
34 this.portTypeName = portTypeName;
35 this.operationName = operationName;
36 }
37
38 /**
39 * Return the operation name as the toString result
40 */
41 public String toString() {
42 return this.operationName;
43 }
44
45 /**
46 * Create a new WSDLBasedProcessor and add it to the model
47 */
48 public void createProcessor(String name, ScuflModel model)
49 throws ProcessorCreationException,
50 DuplicateProcessorNameException {
51 Processor theProcessor = new WSDLBasedProcessor(model, name, this.wsdlLocation, this.portTypeName, this.operationName);
52 model.addProcessor(theProcessor);
53 }
54
55 /**
56 * Return a description of the factory
57 */
58 public String getProcessorDescription() {
59 return "A WSDL based processor using the wsdl document at '"+wsdlLocation+"', port type '"+portTypeName+"' and operation name '"+operationName+"'";
60 }
61
62 /**
63 * Return the Class object for processors that would
64 * be created by this factory
65 */
66 public Class getProcessorClass() {
67 return org.embl.ebi.escience.scufl.WSDLBasedProcessor.class;
68 }
69
70 }