Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/embl/ebi/escience/scuflworkers/java/LocalServiceProcessorFactory.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.scuflworkers.java;
7   
8   import org.embl.ebi.escience.scufl.DuplicateProcessorNameException;
9   import org.embl.ebi.escience.scufl.Processor;
10  import org.embl.ebi.escience.scufl.ProcessorCreationException;
11  import org.embl.ebi.escience.scufl.ScuflModel;
12  import org.embl.ebi.escience.scuflworkers.ProcessorFactory;
13  
14  /**
15   * Implementation of ProcessorFactory that can create LocalServiceProcessor instances
16   * @author Tom Oinn
17   */
18  public class LocalServiceProcessorFactory implements ProcessorFactory {
19      
20      private String className;
21      private String descriptiveName;
22      
23      /**
24       * Create a new factory configured with the specified
25       * worker class.
26       */
27      public LocalServiceProcessorFactory(String workerClassName, String descriptiveName) {
28    this.className = workerClassName;
29    this.descriptiveName = descriptiveName;
30      }
31      
32      /**
33       * Return a name
34       */
35      public String toString() {
36    return descriptiveName;
37      }
38  
39      /**
40       * Create a new processor and add to the model
41       */
42      public void createProcessor(String name, ScuflModel model)
43    throws ProcessorCreationException,
44           DuplicateProcessorNameException {
45    Processor theProcessor = new LocalServiceProcessor(model, name, this.className);
46    model.addProcessor(theProcessor);
47      }
48  
49      /**
50       * A description of the factory
51       */
52      public String getProcessorDescription() {
53    return "A processor that uses the worker class "+className+" to run a process locally to the enactor.";
54      }
55  
56      /**
57       * Return the Class object for the processors that this factory creates
58       */
59      public Class getProcessorClass() {
60    return org.embl.ebi.escience.scuflworkers.java.LocalServiceProcessor.class;
61      }
62  
63  }