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/LocalServiceScavenger.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 java.util.*;
9   import java.net.*;
10  import java.io.*;
11  import org.embl.ebi.escience.scuflui.workbench.Scavenger;
12  import org.embl.ebi.escience.scuflui.workbench.ScavengerCreationException;
13  
14  /**
15   * A scavenger that can create new LocalServiceProcessor nodes
16   * @author Tom Oinn
17   */
18  public class LocalServiceScavenger extends Scavenger {
19      
20      private static List workerList = new ArrayList();
21  
22      static {
23    try {
24        Enumeration en = ClassLoader.getSystemResources("taverna.local.properties");
25        Properties tavernaProperties = new Properties();
26        while (en.hasMoreElements()) {
27      URL resourceURL = (URL)en.nextElement();
28      tavernaProperties.load(resourceURL.openStream());
29        }
30        // Iterate over the available local properties
31        for (Iterator i = tavernaProperties.keySet().iterator(); i.hasNext();) {
32      String className = (String)i.next();
33      String description = (String)tavernaProperties.get(className);
34      workerList.add(new Scavenger(new LocalServiceProcessorFactory(className, description)));
35        }
36    }
37    catch (Exception e) {
38        //
39    }
40      }
41  
42      /**
43       * Create a new local service scavenger
44       */
45      public LocalServiceScavenger()
46    throws ScavengerCreationException {
47    super("Local Java widgets");
48    // for all available local widgets, add them as 
49    // children to this scavenger.
50    for (Iterator i = workerList.iterator(); i.hasNext();) {
51        add((Scavenger)i.next());
52    }
53      }
54  
55  }